Update unread counts for activate/inactivate and delete account

This commit is contained in:
Maurice Parker 2019-05-02 08:41:22 -05:00
parent c25680ca5d
commit e0efcfa847
1 changed files with 7 additions and 1 deletions

View File

@ -90,7 +90,8 @@ public final class AccountManager: UnreadCountProvider {
readAccountsFromDisk()
NotificationCenter.default.addObserver(self, selector: #selector(unreadCountDidChange(_:)), name: .UnreadCountDidChange, object: nil)
NotificationCenter.default.addObserver(self, selector: #selector(accountStateDidChange(_:)), name: .AccountStateDidChange, object: nil)
DispatchQueue.main.async {
self.updateUnreadCount()
}
@ -134,6 +135,7 @@ public final class AccountManager: UnreadCountProvider {
abort()
}
updateUnreadCount()
NotificationCenter.default.post(name: .AccountsDidChangeNotification, object: self)
}
@ -184,6 +186,10 @@ public final class AccountManager: UnreadCountProvider {
updateUnreadCount()
}
@objc func accountStateDidChange(_ notification: Notification) {
updateUnreadCount()
}
// MARK: Private
private func loadAccount(_ accountSpecifier: AccountSpecifier) -> Account? {