Handle unread count did change notification in Account.
This commit is contained in:
parent
4897181909
commit
505f4bcdba
|
@ -290,7 +290,11 @@ 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
|
||||
|
|
|
@ -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<Feed>
|
||||
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<Feed> {
|
||||
|
||||
var feeds = Set<Feed>()
|
||||
|
|
Loading…
Reference in New Issue