Polish notification

- define notification names
- move "post notification" to PasswordStore (todo: move "search" and the one for "show folder switch")
- "erase" and "reset" also post the "passwordStoreUpdated" notification
This commit is contained in:
Yishi Lin 2017-03-18 00:18:55 +08:00
parent 0ad9713fc0
commit 1f829fffcc
11 changed files with 41 additions and 29 deletions

View file

@ -26,7 +26,6 @@ class AdvancedSettingsTableViewController: UITableViewController {
alert.addAction(UIAlertAction(title: "Erase Password Data", style: UIAlertActionStyle.destructive, handler: {[unowned self] (action) -> Void in
SVProgressHUD.show(withStatus: "Erasing ...")
self.passwordStore.erase()
NotificationCenter.default.post(Notification(name: Notification.Name("passwordStoreErased")))
self.navigationController!.popViewController(animated: true)
SVProgressHUD.showSuccess(withStatus: "Done")
SVProgressHUD.dismiss(withDelay: 1)
@ -42,9 +41,6 @@ class AdvancedSettingsTableViewController: UITableViewController {
DispatchQueue.main.async {
do {
let numberDiscarded = try self.passwordStore.reset()
if numberDiscarded > 0 {
NotificationCenter.default.post(Notification(name: Notification.Name("passwordStoreChangeDiscarded")))
}
self.navigationController!.popViewController(animated: true)
switch numberDiscarded {
case 0: