mirror of
https://github.com/Ranchero-Software/NetNewsWire.git
synced 2025-01-18 12:31:01 +01:00
Refresh smart feeds when they are selected and articles are downloaded
This commit is contained in:
parent
b98877c7df
commit
6844762dfc
@ -273,7 +273,11 @@ class AppCoordinator: NSObject, UndoableCommandRunner, UnreadCountProvider {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@objc func containerChildrenDidChange(_ note: Notification) {
|
@objc func containerChildrenDidChange(_ note: Notification) {
|
||||||
rebuildBackingStores()
|
if timelineFetcherContainsAnyPseudoFeed() || timelineFetcherContainsAnyFolder() {
|
||||||
|
fetchAndReplaceArticlesAsync() { [weak self] in
|
||||||
|
self?.rebuildBackingStores()
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@objc func batchUpdateDidPerform(_ notification: Notification) {
|
@objc func batchUpdateDidPerform(_ notification: Notification) {
|
||||||
@ -951,7 +955,7 @@ private extension AppCoordinator {
|
|||||||
replaceArticles(with: fetchedArticles)
|
replaceArticles(with: fetchedArticles)
|
||||||
}
|
}
|
||||||
|
|
||||||
func fetchAndReplaceArticlesAsync() {
|
func fetchAndReplaceArticlesAsync(completion: @escaping () -> Void) {
|
||||||
// To be called when we need to do an entire fetch, but an async delay is okay.
|
// To be called when we need to do an entire fetch, but an async delay is okay.
|
||||||
// Example: we have the Today feed selected, and the calendar day just changed.
|
// Example: we have the Today feed selected, and the calendar day just changed.
|
||||||
cancelPendingAsyncFetches()
|
cancelPendingAsyncFetches()
|
||||||
@ -961,6 +965,7 @@ private extension AppCoordinator {
|
|||||||
}
|
}
|
||||||
fetchUnsortedArticlesAsync(for: [timelineFetcher]) { [weak self] (articles) in
|
fetchUnsortedArticlesAsync(for: [timelineFetcher]) { [weak self] (articles) in
|
||||||
self?.replaceArticles(with: articles)
|
self?.replaceArticles(with: articles)
|
||||||
|
completion()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1000,6 +1005,13 @@ private extension AppCoordinator {
|
|||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func timelineFetcherContainsAnyFolder() -> Bool {
|
||||||
|
if timelineFetcher is Folder {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
func timelineFetcherContainsAnyFeed(_ feeds: Set<Feed>) -> Bool {
|
func timelineFetcherContainsAnyFeed(_ feeds: Set<Feed>) -> Bool {
|
||||||
|
|
||||||
// Return true if there’s a match or if a folder contains (recursively) one of feeds
|
// Return true if there’s a match or if a folder contains (recursively) one of feeds
|
||||||
|
Loading…
Reference in New Issue
Block a user