mirror of
https://github.com/Ranchero-Software/NetNewsWire
synced 2025-08-12 06:26:36 +00:00
Clean up deleted and inactive accounts from Smartfeeds. Issue #1205
This commit is contained in:
@@ -51,8 +51,23 @@ final class SmartFeed: PseudoFeed {
|
||||
}
|
||||
|
||||
@objc func fetchUnreadCounts() {
|
||||
AccountManager.shared.activeAccounts.forEach { self.fetchUnreadCount(for: $0) }
|
||||
let activeAccounts = AccountManager.shared.activeAccounts
|
||||
|
||||
// Remove any accounts that are no longer active or have been deleted
|
||||
let activeAccountIDs = activeAccounts.map { $0.accountID }
|
||||
unreadCounts.keys.forEach { accountID in
|
||||
if !activeAccountIDs.contains(accountID) {
|
||||
unreadCounts.removeValue(forKey: accountID)
|
||||
}
|
||||
}
|
||||
|
||||
if activeAccounts.isEmpty {
|
||||
updateUnreadCount()
|
||||
} else {
|
||||
activeAccounts.forEach { self.fetchUnreadCount(for: $0) }
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
extension SmartFeed: ArticleFetcher {
|
||||
|
||||
Reference in New Issue
Block a user