Skip to content

Commit da5aa61

Browse files
committed
Update tab bar badge value immediately after sync
1 parent dc0ac03 commit da5aa61

File tree

2 files changed

+11
-0
lines changed

2 files changed

+11
-0
lines changed

pass/Controllers/PasswordNavigationViewController.swift

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -208,6 +208,8 @@ class PasswordNavigationViewController: UIViewController {
208208
notificationCenter.addObserver(self, selector: #selector(actOnSearchNotification), name: .passwordSearch, object: nil)
209209
// A Siri shortcut can change the state of the app in the background. Hence, reload when opening the app.
210210
notificationCenter.addObserver(self, selector: #selector(actOnPossiblePasswordStoreUpdate), name: UIApplication.willEnterForegroundNotification, object: nil)
211+
// Sync with remote done.
212+
notificationCenter.addObserver(self, selector: #selector(actOnPasswordStoreSyncSucceeded), name: .passwordStoreSyncSucceeded, object: nil)
211213
}
212214

213215
@objc
@@ -397,6 +399,13 @@ extension PasswordNavigationViewController {
397399
}
398400
}
399401

402+
@objc
403+
func actOnPasswordStoreSyncSucceeded() {
404+
DispatchQueue.main.async {
405+
self.configureTabBarItem()
406+
}
407+
}
408+
400409
func resetViews() {
401410
configureTableView(in: parentPasswordEntity)
402411
tableView.reloadData()
@@ -510,6 +519,7 @@ extension PasswordNavigationViewController: PasswordAlertPresenter {
510519
}
511520
}
512521
DispatchQueue.main.async {
522+
NotificationCenter.default.post(name: .passwordStoreSyncSucceeded, object: nil)
513523
SVProgressHUD.showSuccess(withStatus: "Done".localize())
514524
SVProgressHUD.dismiss(withDelay: 1)
515525
}

passKit/Helpers/NotificationNames.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ public extension Notification.Name {
1212
static let passwordStoreUpdated = Notification.Name("passwordStoreUpdated")
1313
static let passwordStoreErased = Notification.Name("passwordStoreErased")
1414
static let passwordStoreChangeDiscarded = Notification.Name("passwordStoreChangeDiscarded")
15+
static let passwordStoreSyncSucceeded = Notification.Name("passwordStoreSyncSucceeded")
1516
static let passwordSearch = Notification.Name("passwordSearch")
1617

1718
static let passwordDisplaySettingChanged = Notification.Name("passwordDisplaySettingChanged")

0 commit comments

Comments
 (0)