mirror of
https://github.com/Ranchero-Software/NetNewsWire
synced 2025-08-12 06:26:36 +00:00
Handle unread count did change notification in Account.
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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>()
|
||||
|
||||
Reference in New Issue
Block a user