diff --git a/Frameworks/Account/Account.swift b/Frameworks/Account/Account.swift index ef2d6fb32..0d9ab4443 100644 --- a/Frameworks/Account/Account.swift +++ b/Frameworks/Account/Account.swift @@ -289,8 +289,12 @@ public final class Account: DisplayNameProvider, UnreadCountProvider, Container, } @objc func unreadCountDidChange(_ note: Notification) { - - + + if let object = note.object as? AnyObject { + if objectIsChild(object) { + updateUnreadCount() + } + } } // MARK: - Equatable diff --git a/Frameworks/Account/Container.swift b/Frameworks/Account/Container.swift index e60b91db2..7192da2ed 100644 --- a/Frameworks/Account/Container.swift +++ b/Frameworks/Account/Container.swift @@ -1,3 +1,4 @@ + // // Container.swift // Evergreen @@ -19,6 +20,8 @@ public protocol Container { var children: [AnyObject] { get } + func objectIsChild(_ object: AnyObject) -> Bool + //Recursive func flattenedFeeds() -> Set func hasFeed(with feedID: String) -> Bool @@ -32,6 +35,16 @@ public protocol Container { public extension Container { + func objectIsChild(_ object: AnyObject) -> Bool { + + for child in children { + if object === child { + return true + } + } + return false + } + func flattenedFeeds() -> Set { var feeds = Set()