From 5d1c7d08ac133913073b494e2ae79a305cf0ab55 Mon Sep 17 00:00:00 2001 From: Maurice Parker Date: Wed, 22 May 2019 15:08:22 -0500 Subject: [PATCH] Remove strong reference to Account that was preventing Accounts from being deallocated --- Shared/SmartFeeds/SmartFeed.swift | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Shared/SmartFeeds/SmartFeed.swift b/Shared/SmartFeeds/SmartFeed.swift index 9b6c1d484..22f629d69 100644 --- a/Shared/SmartFeeds/SmartFeed.swift +++ b/Shared/SmartFeeds/SmartFeed.swift @@ -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