Polish AdvancedSettingsTableViewController
This commit is contained in:
parent
b429a6baf1
commit
2f790d7923
1 changed files with 15 additions and 19 deletions
|
|
@ -60,27 +60,23 @@ class AdvancedSettingsTableViewController: UITableViewController {
|
||||||
} else if tableView.cellForRow(at: indexPath) == discardChangesTableViewCell {
|
} else if tableView.cellForRow(at: indexPath) == discardChangesTableViewCell {
|
||||||
let alert = UIAlertController(title: "Discard All Changes?", message: "Do you want to permanently discard all changes to the local copy of your password data? You cannot undo this action.", preferredStyle: UIAlertControllerStyle.alert)
|
let alert = UIAlertController(title: "Discard All Changes?", message: "Do you want to permanently discard all changes to the local copy of your password data? You cannot undo this action.", preferredStyle: UIAlertControllerStyle.alert)
|
||||||
alert.addAction(UIAlertAction(title: "Discard All Changes", style: UIAlertActionStyle.destructive, handler: {[unowned self] (action) -> Void in
|
alert.addAction(UIAlertAction(title: "Discard All Changes", style: UIAlertActionStyle.destructive, handler: {[unowned self] (action) -> Void in
|
||||||
DispatchQueue.global(qos: .userInitiated).async {
|
SVProgressHUD.show(withStatus: "Resetting ...")
|
||||||
SVProgressHUD.show(withStatus: "Resetting ...")
|
do {
|
||||||
DispatchQueue.main.async {
|
let numberDiscarded = try self.passwordStore.reset()
|
||||||
do {
|
self.navigationController!.popViewController(animated: true)
|
||||||
let numberDiscarded = try self.passwordStore.reset()
|
switch numberDiscarded {
|
||||||
self.navigationController!.popViewController(animated: true)
|
case 0:
|
||||||
switch numberDiscarded {
|
SVProgressHUD.showSuccess(withStatus: "No local commits")
|
||||||
case 0:
|
case 1:
|
||||||
SVProgressHUD.showSuccess(withStatus: "No local commits")
|
SVProgressHUD.showSuccess(withStatus: "Discarded 1 commit")
|
||||||
case 1:
|
default:
|
||||||
SVProgressHUD.showSuccess(withStatus: "Discarded 1 commit")
|
SVProgressHUD.showSuccess(withStatus: "Discarded \(numberDiscarded) commits")
|
||||||
default:
|
|
||||||
SVProgressHUD.showSuccess(withStatus: "Discarded \(numberDiscarded) commits")
|
|
||||||
}
|
|
||||||
SVProgressHUD.dismiss(withDelay: 1)
|
|
||||||
} catch {
|
|
||||||
Utils.alert(title: "Error", message: error.localizedDescription, controller: self, completion: nil)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
SVProgressHUD.dismiss(withDelay: 1)
|
||||||
|
} catch {
|
||||||
|
Utils.alert(title: "Error", message: error.localizedDescription, controller: self, completion: nil)
|
||||||
}
|
}
|
||||||
|
|
||||||
}))
|
}))
|
||||||
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