Reenabled mac toolbar validation
This commit is contained in:
parent
dabf471db7
commit
5c8aaed54c
|
@ -128,20 +128,31 @@ private extension SceneModel {
|
||||||
|
|
||||||
// MARK: Subscriptions
|
// MARK: Subscriptions
|
||||||
func subscribeToToolbarChangeEvents() {
|
func subscribeToToolbarChangeEvents() {
|
||||||
// NotificationCenter.default.publisher(for: .UnreadCountDidChange)
|
guard let selectedArticlesPublisher = timelineModel.selectedArticlesPublisher,
|
||||||
// .compactMap { $0.object as? AccountManager }
|
let articlesPublisher = timelineModel.articlesPublisher else { return }
|
||||||
// .sink { [weak self] accountManager in
|
|
||||||
// self?.updateNextUnreadButtonState(accountManager: accountManager)
|
NotificationCenter.default.publisher(for: .UnreadCountDidChange)
|
||||||
// }.store(in: &cancellables)
|
.compactMap { $0.object as? AccountManager }
|
||||||
//
|
.sink { [weak self] accountManager in
|
||||||
// let blankNotification = Notification(name: .StatusesDidChange)
|
self?.updateNextUnreadButtonState(accountManager: accountManager)
|
||||||
// let statusesDidChangePublisher = NotificationCenter.default.publisher(for: .StatusesDidChange).prepend(blankNotification)
|
}.store(in: &cancellables)
|
||||||
// let combinedPublisher = timelineModel.$articles.combineLatest(timelineModel.$selectedArticles, statusesDidChangePublisher)
|
|
||||||
//
|
let blankNotification = Notification(name: .StatusesDidChange)
|
||||||
// combinedPublisher.sink { [weak self] (articles, selectedArticles, _) in
|
let statusesDidChangePublisher = NotificationCenter.default.publisher(for: .StatusesDidChange).prepend(blankNotification)
|
||||||
// self?.updateMarkAllAsReadButtonsState(articles: articles)
|
|
||||||
// self?.updateArticleButtonsState(selectedArticles: selectedArticles)
|
statusesDidChangePublisher
|
||||||
// }.store(in: &cancellables)
|
.combineLatest(selectedArticlesPublisher)
|
||||||
|
.sink { [weak self] _, selectedArticles in
|
||||||
|
self?.updateArticleButtonsState(selectedArticles: selectedArticles)
|
||||||
|
}
|
||||||
|
.store(in: &cancellables)
|
||||||
|
|
||||||
|
statusesDidChangePublisher
|
||||||
|
.combineLatest(articlesPublisher)
|
||||||
|
.sink { [weak self] _, articles in
|
||||||
|
self?.updateMarkAllAsReadButtonsState(articles: articles)
|
||||||
|
}
|
||||||
|
.store(in: &cancellables)
|
||||||
}
|
}
|
||||||
|
|
||||||
func subscribeToAccountSyncErrors() {
|
func subscribeToAccountSyncErrors() {
|
||||||
|
|
|
@ -31,6 +31,7 @@ class TimelineModel: ObservableObject, UndoableCommandRunner {
|
||||||
@Published var isReadFiltered: Bool? = nil
|
@Published var isReadFiltered: Bool? = nil
|
||||||
|
|
||||||
var timelineItemsPublisher: AnyPublisher<OrderedDictionary<String, TimelineItem>, Never>?
|
var timelineItemsPublisher: AnyPublisher<OrderedDictionary<String, TimelineItem>, Never>?
|
||||||
|
var articlesPublisher: AnyPublisher<[Article], Never>?
|
||||||
var selectedTimelineItemsPublisher: AnyPublisher<[TimelineItem], Never>?
|
var selectedTimelineItemsPublisher: AnyPublisher<[TimelineItem], Never>?
|
||||||
var selectedArticlesPublisher: AnyPublisher<[Article], Never>?
|
var selectedArticlesPublisher: AnyPublisher<[Article], Never>?
|
||||||
|
|
||||||
|
@ -80,6 +81,7 @@ class TimelineModel: ObservableObject, UndoableCommandRunner {
|
||||||
// }.store(in: &cancellables)
|
// }.store(in: &cancellables)
|
||||||
// }
|
// }
|
||||||
|
|
||||||
|
// TODO: Don't forget to redo this!!!
|
||||||
func subscribeToReadFilterChanges() {
|
func subscribeToReadFilterChanges() {
|
||||||
guard let selectedFeedsPublisher = delegate?.selectedFeedsPublisher else { return }
|
guard let selectedFeedsPublisher = delegate?.selectedFeedsPublisher else { return }
|
||||||
|
|
||||||
|
@ -132,6 +134,12 @@ class TimelineModel: ObservableObject, UndoableCommandRunner {
|
||||||
.share(replay: 1)
|
.share(replay: 1)
|
||||||
.eraseToAnyPublisher()
|
.eraseToAnyPublisher()
|
||||||
|
|
||||||
|
articlesPublisher = timelineItemsPublisher!
|
||||||
|
.map { timelineItems in
|
||||||
|
timelineItems.values.values.map { $0.article }
|
||||||
|
}
|
||||||
|
.eraseToAnyPublisher()
|
||||||
|
|
||||||
// Set the timeline name for display
|
// Set the timeline name for display
|
||||||
selectedFeedsPublisher
|
selectedFeedsPublisher
|
||||||
.map { feeds -> String in
|
.map { feeds -> String in
|
||||||
|
|
Loading…
Reference in New Issue