mirror of
https://github.com/Ranchero-Software/NetNewsWire.git
synced 2024-12-24 08:41:31 +01:00
Remove strong reference to Account that was preventing Accounts from being deallocated
This commit is contained in:
parent
c422b4b82c
commit
5d1c7d08ac
@ -36,7 +36,7 @@ final class SmartFeed: PseudoFeed {
|
||||
#endif
|
||||
|
||||
private let delegate: SmartFeedDelegate
|
||||
private var unreadCounts = [Account: Int]()
|
||||
private var unreadCounts = [String: Int]()
|
||||
|
||||
init(delegate: SmartFeedDelegate) {
|
||||
self.delegate = delegate
|
||||
@ -74,14 +74,14 @@ private extension SmartFeed {
|
||||
|
||||
func fetchUnreadCount(for account: Account) {
|
||||
delegate.fetchUnreadCount(for: account) { (accountUnreadCount) in
|
||||
self.unreadCounts[account] = accountUnreadCount
|
||||
self.unreadCounts[account.accountID] = accountUnreadCount
|
||||
self.updateUnreadCount()
|
||||
}
|
||||
}
|
||||
|
||||
func updateUnreadCount() {
|
||||
unreadCount = AccountManager.shared.activeAccounts.reduce(0) { (result, account) -> Int in
|
||||
if let oneUnreadCount = unreadCounts[account] {
|
||||
if let oneUnreadCount = unreadCounts[account.accountID] {
|
||||
return result + oneUnreadCount
|
||||
}
|
||||
return result
|
||||
|
Loading…
Reference in New Issue
Block a user