Handle unread count did change notification in Account.
This commit is contained in:
parent
4897181909
commit
505f4bcdba
|
@ -289,8 +289,12 @@ public final class Account: DisplayNameProvider, UnreadCountProvider, Container,
|
||||||
}
|
}
|
||||||
|
|
||||||
@objc func unreadCountDidChange(_ note: Notification) {
|
@objc func unreadCountDidChange(_ note: Notification) {
|
||||||
|
|
||||||
|
if let object = note.object as? AnyObject {
|
||||||
|
if objectIsChild(object) {
|
||||||
|
updateUnreadCount()
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// MARK: - Equatable
|
// MARK: - Equatable
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
|
||||||
//
|
//
|
||||||
// Container.swift
|
// Container.swift
|
||||||
// Evergreen
|
// Evergreen
|
||||||
|
@ -19,6 +20,8 @@ public protocol Container {
|
||||||
|
|
||||||
var children: [AnyObject] { get }
|
var children: [AnyObject] { get }
|
||||||
|
|
||||||
|
func objectIsChild(_ object: AnyObject) -> Bool
|
||||||
|
|
||||||
//Recursive
|
//Recursive
|
||||||
func flattenedFeeds() -> Set<Feed>
|
func flattenedFeeds() -> Set<Feed>
|
||||||
func hasFeed(with feedID: String) -> Bool
|
func hasFeed(with feedID: String) -> Bool
|
||||||
|
@ -32,6 +35,16 @@ public protocol Container {
|
||||||
|
|
||||||
public extension Container {
|
public extension Container {
|
||||||
|
|
||||||
|
func objectIsChild(_ object: AnyObject) -> Bool {
|
||||||
|
|
||||||
|
for child in children {
|
||||||
|
if object === child {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
func flattenedFeeds() -> Set<Feed> {
|
func flattenedFeeds() -> Set<Feed> {
|
||||||
|
|
||||||
var feeds = Set<Feed>()
|
var feeds = Set<Feed>()
|
||||||
|
|
Loading…
Reference in New Issue