Make selected articles available to Share dialog
This commit is contained in:
parent
8b1aa3e88a
commit
67eb319703
|
@ -25,8 +25,7 @@ final class SceneModel: ObservableObject {
|
||||||
@Published var accountSyncErrors: [AccountSyncError] = []
|
@Published var accountSyncErrors: [AccountSyncError] = []
|
||||||
|
|
||||||
var selectedArticles: [Article] {
|
var selectedArticles: [Article] {
|
||||||
return [Article]()
|
timelineModel.selectedArticles
|
||||||
// timelineModel.selectedArticles
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private var refreshProgressModel: RefreshProgressModel? = nil
|
private var refreshProgressModel: RefreshProgressModel? = nil
|
||||||
|
|
|
@ -30,6 +30,8 @@ class TimelineModel: ObservableObject, UndoableCommandRunner {
|
||||||
@Published var selectedTimelineItemID: String? = nil // Don't use directly. Use selectedTimelineItemsPublisher
|
@Published var selectedTimelineItemID: String? = nil // Don't use directly. Use selectedTimelineItemsPublisher
|
||||||
@Published var isReadFiltered: Bool? = nil
|
@Published var isReadFiltered: Bool? = nil
|
||||||
|
|
||||||
|
var selectedArticles = [Article]()
|
||||||
|
|
||||||
var timelineItemsPublisher: AnyPublisher<TimelineItems, Never>?
|
var timelineItemsPublisher: AnyPublisher<TimelineItems, Never>?
|
||||||
var articlesPublisher: AnyPublisher<[Article], Never>?
|
var articlesPublisher: AnyPublisher<[Article], Never>?
|
||||||
var selectedTimelineItemsPublisher: AnyPublisher<[TimelineItem], Never>?
|
var selectedTimelineItemsPublisher: AnyPublisher<[TimelineItem], Never>?
|
||||||
|
@ -57,7 +59,7 @@ class TimelineModel: ObservableObject, UndoableCommandRunner {
|
||||||
subscribeToUserDefaultsChanges()
|
subscribeToUserDefaultsChanges()
|
||||||
subscribeToReadFilterChanges()
|
subscribeToReadFilterChanges()
|
||||||
subscribeToArticleFetchChanges()
|
subscribeToArticleFetchChanges()
|
||||||
subscribeToSelectedArticleSelectionChanges()
|
subscribeToArticleSelectionChanges()
|
||||||
subscribeToArticleStatusChanges()
|
subscribeToArticleStatusChanges()
|
||||||
// subscribeToAccountDidDownloadArticles()
|
// subscribeToAccountDidDownloadArticles()
|
||||||
subscribeToArticleMarkingEvents()
|
subscribeToArticleMarkingEvents()
|
||||||
|
@ -222,7 +224,7 @@ private extension TimelineModel {
|
||||||
.assign(to: &$nameForDisplay)
|
.assign(to: &$nameForDisplay)
|
||||||
}
|
}
|
||||||
|
|
||||||
func subscribeToSelectedArticleSelectionChanges() {
|
func subscribeToArticleSelectionChanges() {
|
||||||
guard let timelineItemsPublisher = timelineItemsPublisher else { return }
|
guard let timelineItemsPublisher = timelineItemsPublisher else { return }
|
||||||
|
|
||||||
let timelineSelectedIDsPublisher = $selectedTimelineItemIDs
|
let timelineSelectedIDsPublisher = $selectedTimelineItemIDs
|
||||||
|
@ -249,6 +251,12 @@ private extension TimelineModel {
|
||||||
.share(replay: 1)
|
.share(replay: 1)
|
||||||
.eraseToAnyPublisher()
|
.eraseToAnyPublisher()
|
||||||
|
|
||||||
|
selectedArticlesPublisher!
|
||||||
|
.sink { [weak self] selectedArticles in
|
||||||
|
self?.selectedArticles = selectedArticles
|
||||||
|
}
|
||||||
|
.store(in: &cancellables)
|
||||||
|
|
||||||
// Automatically mark a selected record as read
|
// Automatically mark a selected record as read
|
||||||
selectedTimelineItemsPublisher!
|
selectedTimelineItemsPublisher!
|
||||||
.filter { $0.count == 1 }
|
.filter { $0.count == 1 }
|
||||||
|
|
Loading…
Reference in New Issue