Add replay so that iOS filters work

This commit is contained in:
Maurice Parker 2020-07-25 19:44:50 -05:00
parent 4d8e8dab47
commit 4fe40f9ed6
2 changed files with 4 additions and 3 deletions

View File

@ -181,6 +181,7 @@ private extension TimelineModel {
readFilterAndFeedsPublisher = toggledReadFilterPublisher readFilterAndFeedsPublisher = toggledReadFilterPublisher
.merge(with: feedsReadFilterPublisher) .merge(with: feedsReadFilterPublisher)
.share(replay: 1)
.eraseToAnyPublisher() .eraseToAnyPublisher()
} }

View File

@ -30,6 +30,9 @@ struct TimelineToolbarModifier: ViewModifier {
AppAssets.filterInactiveImage.font(.title3) AppAssets.filterInactiveImage.font(.title3)
} }
} }
.onReceive(timelineModel.readFilterAndFeedsPublisher!) { (_, filtered) in
isReadFiltered = filtered
}
.hidden(isReadFiltered == nil) .hidden(isReadFiltered == nil)
.help(isReadFiltered ?? false ? "Show Read Articles" : "Filter Read Articles") .help(isReadFiltered ?? false ? "Show Read Articles" : "Filter Read Articles")
} }
@ -49,9 +52,6 @@ struct TimelineToolbarModifier: ViewModifier {
} }
#endif #endif
} }
.onReceive(timelineModel.readFilterAndFeedsPublisher!) { (_, filtered) in
isReadFiltered = filtered
}
} }
} }