Polish AdvancedSettingsTableViewController
This commit is contained in:
parent
b429a6baf1
commit
2f790d7923
1 changed files with 15 additions and 19 deletions
|
|
@ -60,25 +60,21 @@ class AdvancedSettingsTableViewController: UITableViewController {
|
|||
} 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)
|
||||
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 ...")
|
||||
DispatchQueue.main.async {
|
||||
do {
|
||||
let numberDiscarded = try self.passwordStore.reset()
|
||||
self.navigationController!.popViewController(animated: true)
|
||||
switch numberDiscarded {
|
||||
case 0:
|
||||
SVProgressHUD.showSuccess(withStatus: "No local commits")
|
||||
case 1:
|
||||
SVProgressHUD.showSuccess(withStatus: "Discarded 1 commit")
|
||||
default:
|
||||
SVProgressHUD.showSuccess(withStatus: "Discarded \(numberDiscarded) commits")
|
||||
}
|
||||
SVProgressHUD.dismiss(withDelay: 1)
|
||||
} catch {
|
||||
Utils.alert(title: "Error", message: error.localizedDescription, controller: self, completion: nil)
|
||||
}
|
||||
SVProgressHUD.show(withStatus: "Resetting ...")
|
||||
do {
|
||||
let numberDiscarded = try self.passwordStore.reset()
|
||||
self.navigationController!.popViewController(animated: true)
|
||||
switch numberDiscarded {
|
||||
case 0:
|
||||
SVProgressHUD.showSuccess(withStatus: "No local commits")
|
||||
case 1:
|
||||
SVProgressHUD.showSuccess(withStatus: "Discarded 1 commit")
|
||||
default:
|
||||
SVProgressHUD.showSuccess(withStatus: "Discarded \(numberDiscarded) commits")
|
||||
}
|
||||
SVProgressHUD.dismiss(withDelay: 1)
|
||||
} catch {
|
||||
Utils.alert(title: "Error", message: error.localizedDescription, controller: self, completion: nil)
|
||||
}
|
||||
|
||||
}))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue