mirror of
https://github.com/Ranchero-Software/NetNewsWire
synced 2025-08-12 06:26:36 +00:00
Show unread count in dock badge. Force-update unread counts at startup.
This commit is contained in:
@@ -138,6 +138,10 @@ public final class Account: DisplayNameProvider, UnreadCountProvider, Container,
|
||||
NotificationCenter.default.addObserver(self, selector: #selector(unreadCountDidChange(_:)), name: .UnreadCountDidChange, object: nil)
|
||||
|
||||
pullObjectsFromDisk()
|
||||
|
||||
DispatchQueue.main.async {
|
||||
self.updateUnreadCount()
|
||||
}
|
||||
}
|
||||
|
||||
// MARK: - API
|
||||
|
||||
@@ -80,6 +80,10 @@ public final class AccountManager: UnreadCountProvider {
|
||||
readNonLocalAccountsFromDisk()
|
||||
|
||||
NotificationCenter.default.addObserver(self, selector: #selector(unreadCountDidChange(_:)), name: .UnreadCountDidChange, object: nil)
|
||||
|
||||
DispatchQueue.main.async {
|
||||
self.updateUnreadCount()
|
||||
}
|
||||
}
|
||||
|
||||
// MARK: API
|
||||
@@ -117,10 +121,7 @@ public final class AccountManager: UnreadCountProvider {
|
||||
|
||||
func updateUnreadCount() {
|
||||
|
||||
let updatedUnreadCount = calculateUnreadCount(accounts)
|
||||
if updatedUnreadCount != unreadCount {
|
||||
unreadCount = updatedUnreadCount
|
||||
}
|
||||
unreadCount = calculateUnreadCount(accounts)
|
||||
}
|
||||
|
||||
// MARK: Notifications
|
||||
|
||||
Reference in New Issue
Block a user