Update tab bar badge value immediately after sync

This commit is contained in:
Mingshen Sun 2023-03-18 15:54:18 -07:00
parent dc0ac03474
commit da5aa61986
2 changed files with 11 additions and 0 deletions

View file

@ -208,6 +208,8 @@ class PasswordNavigationViewController: UIViewController {
notificationCenter.addObserver(self, selector: #selector(actOnSearchNotification), name: .passwordSearch, object: nil)
// A Siri shortcut can change the state of the app in the background. Hence, reload when opening the app.
notificationCenter.addObserver(self, selector: #selector(actOnPossiblePasswordStoreUpdate), name: UIApplication.willEnterForegroundNotification, object: nil)
// Sync with remote done.
notificationCenter.addObserver(self, selector: #selector(actOnPasswordStoreSyncSucceeded), name: .passwordStoreSyncSucceeded, object: nil)
}
@objc
@ -397,6 +399,13 @@ extension PasswordNavigationViewController {
}
}
@objc
func actOnPasswordStoreSyncSucceeded() {
DispatchQueue.main.async {
self.configureTabBarItem()
}
}
func resetViews() {
configureTableView(in: parentPasswordEntity)
tableView.reloadData()
@ -510,6 +519,7 @@ extension PasswordNavigationViewController: PasswordAlertPresenter {
}
}
DispatchQueue.main.async {
NotificationCenter.default.post(name: .passwordStoreSyncSucceeded, object: nil)
SVProgressHUD.showSuccess(withStatus: "Done".localize())
SVProgressHUD.dismiss(withDelay: 1)
}