add HUD for erasing data
This commit is contained in:
parent
5fc7c469c3
commit
0eb2745d88
1 changed files with 11 additions and 3 deletions
|
|
@ -7,6 +7,7 @@
|
||||||
//
|
//
|
||||||
|
|
||||||
import UIKit
|
import UIKit
|
||||||
|
import SVProgressHUD
|
||||||
|
|
||||||
class AdvancedSettingsTableViewController: UITableViewController {
|
class AdvancedSettingsTableViewController: UITableViewController {
|
||||||
|
|
||||||
|
|
@ -20,9 +21,16 @@ class AdvancedSettingsTableViewController: UITableViewController {
|
||||||
print("erase data")
|
print("erase data")
|
||||||
let alert = UIAlertController(title: "Erase Password Store Data?", message: "This will delete all local data and settings. Password store data on your remote server will not be affected.", preferredStyle: UIAlertControllerStyle.alert)
|
let alert = UIAlertController(title: "Erase Password Store Data?", message: "This will delete all local data and settings. Password store data on your remote server will not be affected.", preferredStyle: UIAlertControllerStyle.alert)
|
||||||
alert.addAction(UIAlertAction(title: "Erase Password Data", style: UIAlertActionStyle.destructive, handler: {[unowned self] (action) -> Void in
|
alert.addAction(UIAlertAction(title: "Erase Password Data", style: UIAlertActionStyle.destructive, handler: {[unowned self] (action) -> Void in
|
||||||
PasswordStore.shared.erase()
|
SVProgressHUD.show(withStatus: "Erasing ...")
|
||||||
NotificationCenter.default.post(Notification(name: Notification.Name("passwordStoreErased")))
|
DispatchQueue.global(qos: .userInitiated).sync {
|
||||||
self.navigationController!.popViewController(animated: true)
|
PasswordStore.shared.erase()
|
||||||
|
DispatchQueue.main.async {
|
||||||
|
NotificationCenter.default.post(Notification(name: Notification.Name("passwordStoreErased")))
|
||||||
|
self.navigationController!.popViewController(animated: true)
|
||||||
|
SVProgressHUD.showSuccess(withStatus: "Done")
|
||||||
|
SVProgressHUD.dismiss(withDelay: 1)
|
||||||
|
}
|
||||||
|
}
|
||||||
}))
|
}))
|
||||||
alert.addAction(UIAlertAction(title: "Dismiss", style: UIAlertActionStyle.cancel, handler:nil))
|
alert.addAction(UIAlertAction(title: "Dismiss", style: UIAlertActionStyle.cancel, handler:nil))
|
||||||
self.present(alert, animated: true, completion: nil)
|
self.present(alert, animated: true, completion: nil)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue