mirror of
https://github.com/Ranchero-Software/NetNewsWire.git
synced 2024-12-25 01:01:21 +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
|
#endif
|
||||||
|
|
||||||
private let delegate: SmartFeedDelegate
|
private let delegate: SmartFeedDelegate
|
||||||
private var unreadCounts = [Account: Int]()
|
private var unreadCounts = [String: Int]()
|
||||||
|
|
||||||
init(delegate: SmartFeedDelegate) {
|
init(delegate: SmartFeedDelegate) {
|
||||||
self.delegate = delegate
|
self.delegate = delegate
|
||||||
@ -74,14 +74,14 @@ private extension SmartFeed {
|
|||||||
|
|
||||||
func fetchUnreadCount(for account: Account) {
|
func fetchUnreadCount(for account: Account) {
|
||||||
delegate.fetchUnreadCount(for: account) { (accountUnreadCount) in
|
delegate.fetchUnreadCount(for: account) { (accountUnreadCount) in
|
||||||
self.unreadCounts[account] = accountUnreadCount
|
self.unreadCounts[account.accountID] = accountUnreadCount
|
||||||
self.updateUnreadCount()
|
self.updateUnreadCount()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func updateUnreadCount() {
|
func updateUnreadCount() {
|
||||||
unreadCount = AccountManager.shared.activeAccounts.reduce(0) { (result, account) -> Int in
|
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 + oneUnreadCount
|
||||||
}
|
}
|
||||||
return result
|
return result
|
||||||
|
Loading…
Reference in New Issue
Block a user