Moved title update to the correct func for subscription

This commit is contained in:
Maurice Parker 2020-07-26 07:54:04 -05:00
parent bb1b7ad0b0
commit 2217dc492f
1 changed files with 16 additions and 15 deletions

View File

@ -147,6 +147,21 @@ private extension TimelineModel {
func subscribeToReadFilterAndFeedChanges() { func subscribeToReadFilterAndFeedChanges() {
guard let selectedFeedsPublisher = delegate?.selectedFeedsPublisher else { return } guard let selectedFeedsPublisher = delegate?.selectedFeedsPublisher else { return }
// Set the timeline name for display
selectedFeedsPublisher
.map { feeds -> String in
switch feeds.count {
case 0:
return ""
case 1:
return feeds.first!.nameForDisplay
default:
return NSLocalizedString("Multiple", comment: "Multiple")
}
}
.assign(to: &$nameForDisplay)
// Clear the selected timeline items when the selected feed(s) change
selectedFeedsPublisher selectedFeedsPublisher
.sink { [weak self] _ in .sink { [weak self] _ in
self?.selectedTimelineItemIDs = Set<String>() self?.selectedTimelineItemIDs = Set<String>()
@ -193,8 +208,7 @@ private extension TimelineModel {
} }
func subscribeToArticleFetchChanges() { func subscribeToArticleFetchChanges() {
guard let readFilterAndFeedsPublisher = readFilterAndFeedsPublisher, guard let readFilterAndFeedsPublisher = readFilterAndFeedsPublisher else { return }
let selectedFeedsPublisher = delegate?.selectedFeedsPublisher else { return }
let sortDirectionPublisher = sortDirectionSubject.removeDuplicates() let sortDirectionPublisher = sortDirectionSubject.removeDuplicates()
let groupByPublisher = groupByFeedSubject.removeDuplicates() let groupByPublisher = groupByFeedSubject.removeDuplicates()
@ -225,19 +239,6 @@ private extension TimelineModel {
.share() .share()
.eraseToAnyPublisher() .eraseToAnyPublisher()
// Set the timeline name for display
selectedFeedsPublisher
.map { feeds -> String in
switch feeds.count {
case 0:
return ""
case 1:
return feeds.first!.nameForDisplay
default:
return NSLocalizedString("Multiple", comment: "Multiple")
}
}
.assign(to: &$nameForDisplay)
} }
func subscribeToArticleSelectionChanges() { func subscribeToArticleSelectionChanges() {