2020-06-30 18:03:33 +02:00
|
|
|
//
|
|
|
|
// TimelineView.swift
|
|
|
|
// NetNewsWire
|
|
|
|
//
|
|
|
|
// Created by Maurice Parker on 6/30/20.
|
|
|
|
// Copyright © 2020 Ranchero Software. All rights reserved.
|
|
|
|
//
|
|
|
|
|
|
|
|
import SwiftUI
|
|
|
|
|
|
|
|
struct TimelineView: View {
|
2020-07-01 18:13:11 +02:00
|
|
|
|
|
|
|
@EnvironmentObject private var timelineModel: TimelineModel
|
2020-07-12 01:22:47 +02:00
|
|
|
@State var navigate = false
|
2020-07-01 18:13:11 +02:00
|
|
|
|
2020-07-12 01:22:47 +02:00
|
|
|
@ViewBuilder var body: some View {
|
|
|
|
#if os(macOS)
|
|
|
|
ZStack {
|
|
|
|
NavigationLink(destination: ArticleContainerView(articles: timelineModel.selectedArticles), isActive: $navigate) {
|
|
|
|
EmptyView()
|
|
|
|
}.hidden()
|
|
|
|
List(timelineModel.timelineItems, selection: $timelineModel.selectedArticleIDs) { timelineItem in
|
2020-07-12 03:11:01 +02:00
|
|
|
TimelineItemView(timelineItem: timelineItem)
|
2020-07-06 01:53:18 +02:00
|
|
|
}
|
2020-07-01 19:30:55 +02:00
|
|
|
}
|
2020-07-12 01:22:47 +02:00
|
|
|
.onChange(of: timelineModel.selectedArticleIDs) { value in
|
|
|
|
navigate = !timelineModel.selectedArticleIDs.isEmpty
|
|
|
|
}
|
|
|
|
#else
|
|
|
|
List(timelineModel.timelineItems) { timelineItem in
|
2020-07-12 03:11:01 +02:00
|
|
|
ZStack {
|
|
|
|
TimelineItemView(timelineItem: timelineItem)
|
|
|
|
NavigationLink(destination: ArticleContainerView(articles: timelineModel.selectedArticles),
|
|
|
|
tag: timelineItem.article.articleID,
|
|
|
|
selection: $timelineModel.selectedArticleID) {
|
|
|
|
EmptyView()
|
|
|
|
}.buttonStyle(PlainButtonStyle())
|
|
|
|
}
|
2020-07-12 01:22:47 +02:00
|
|
|
}
|
|
|
|
#endif
|
2020-06-30 18:03:33 +02:00
|
|
|
}
|
2020-07-12 01:22:47 +02:00
|
|
|
|
2020-06-30 18:03:33 +02:00
|
|
|
}
|