mirror of
https://github.com/Ranchero-Software/NetNewsWire.git
synced 2025-02-03 20:37:34 +01:00
Make Folder watch for children-did-change notifications — when its own children change, update the unread count. Fix #322.
This commit is contained in:
parent
0762074e91
commit
192439abe7
@ -58,6 +58,7 @@ public final class Folder: DisplayNameProvider, Container, UnreadCountProvider,
|
||||
self.hashValue = folderID
|
||||
|
||||
NotificationCenter.default.addObserver(self, selector: #selector(unreadCountDidChange(_:)), name: .UnreadCountDidChange, object: nil)
|
||||
NotificationCenter.default.addObserver(self, selector: #selector(childrenDidChange(_:)), name: .ChildrenDidChange, object: self)
|
||||
}
|
||||
|
||||
// MARK: - Disk Dictionary
|
||||
@ -130,7 +131,7 @@ public final class Folder: DisplayNameProvider, Container, UnreadCountProvider,
|
||||
return true
|
||||
}
|
||||
|
||||
// MARK: Notifications
|
||||
// MARK: - Notifications
|
||||
|
||||
@objc func unreadCountDidChange(_ note: Notification) {
|
||||
|
||||
@ -141,6 +142,11 @@ public final class Folder: DisplayNameProvider, Container, UnreadCountProvider,
|
||||
}
|
||||
}
|
||||
|
||||
@objc func childrenDidChange(_ note: Notification) {
|
||||
|
||||
updateUnreadCount()
|
||||
}
|
||||
|
||||
// MARK: - Equatable
|
||||
|
||||
static public func ==(lhs: Folder, rhs: Folder) -> Bool {
|
||||
|
Loading…
x
Reference in New Issue
Block a user