diff --git a/Frameworks/Account/Account.swift b/Frameworks/Account/Account.swift index efa50753f..ef2d6fb32 100644 --- a/Frameworks/Account/Account.swift +++ b/Frameworks/Account/Account.swift @@ -135,6 +135,8 @@ public final class Account: DisplayNameProvider, UnreadCountProvider, Container, NotificationCenter.default.addObserver(self, selector: #selector(downloadProgressDidChange(_:)), name: .DownloadProgressDidChange, object: nil) + NotificationCenter.default.addObserver(self, selector: #selector(unreadCountDidChange(_:)), name: .UnreadCountDidChange, object: nil) + pullObjectsFromDisk() } @@ -285,6 +287,11 @@ public final class Account: DisplayNameProvider, UnreadCountProvider, Container, refreshInProgress = refreshProgress.numberRemaining > 0 NotificationCenter.default.post(name: .AccountRefreshProgressDidChange, object: self) } + + @objc func unreadCountDidChange(_ note: Notification) { + + + } // MARK: - Equatable @@ -444,10 +451,10 @@ private extension Account { unreadCount = calculateUnreadCount(children) } - func noteStatusesForArticlesDidChange(articles: Set
) { + func noteStatusesForArticlesDidChange(_ articles: Set
) { - let feeds = articles.feeds() - let statuses = articles.statuses() + let feeds = Set(articles.flatMap { $0.feed }) + let statuses = Set(articles.map { $0.status }) // .UnreadCountDidChange notification will get sent to Folder and Account objects, // which will update their own unread counts. diff --git a/Frameworks/Account/DataExtensions.swift b/Frameworks/Account/DataExtensions.swift index e96f08821..3d6ad3dae 100644 --- a/Frameworks/Account/DataExtensions.swift +++ b/Frameworks/Account/DataExtensions.swift @@ -42,13 +42,3 @@ public extension Article { } } -public extension Set where Element == Article { - - public func feeds() -> Set { - return Set(flatMap { $0.feed }) - } - - public func statuses() -> Set { - return Set(map { $0.articleStatus }) - } -}