From db4413d6ba12930e0fd4a01de3f77284b517a9cc Mon Sep 17 00:00:00 2001 From: Yishi Lin Date: Sat, 11 Mar 2017 02:14:53 +0800 Subject: [PATCH 1/9] Polish the "discard all local changes" feature --- .../AdvancedSettingsTableViewController.swift | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/pass/Controllers/AdvancedSettingsTableViewController.swift b/pass/Controllers/AdvancedSettingsTableViewController.swift index 0454c60..b73305b 100644 --- a/pass/Controllers/AdvancedSettingsTableViewController.swift +++ b/pass/Controllers/AdvancedSettingsTableViewController.swift @@ -35,15 +35,24 @@ class AdvancedSettingsTableViewController: UITableViewController { tableView.deselectRow(at: indexPath, animated: true) } 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 Changesa", 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 ...") DispatchQueue.main.async { do { let numberDiscarded = try PasswordStore.shared.reset() - NotificationCenter.default.post(Notification(name: Notification.Name("passwordStoreChangeDiscarded"))) + if numberDiscarded > 0 { + NotificationCenter.default.post(Notification(name: Notification.Name("passwordStoreChangeDiscarded"))) + } self.navigationController!.popViewController(animated: true) - SVProgressHUD.showSuccess(withStatus: "Discarded \(numberDiscarded) commits") + 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 { DispatchQueue.main.async { From d1476c1d4013492746ac6112aca9ccbd4ccf51a4 Mon Sep 17 00:00:00 2001 From: Yishi Lin Date: Sat, 11 Mar 2017 02:21:01 +0800 Subject: [PATCH 2/9] Improve the about repository page refresh --- pass/Controllers/AboutRepositoryTableViewController.swift | 1 + 1 file changed, 1 insertion(+) diff --git a/pass/Controllers/AboutRepositoryTableViewController.swift b/pass/Controllers/AboutRepositoryTableViewController.swift index c8a1a1f..36588ee 100644 --- a/pass/Controllers/AboutRepositoryTableViewController.swift +++ b/pass/Controllers/AboutRepositoryTableViewController.swift @@ -39,6 +39,7 @@ class AboutRepositoryTableViewController: BasicStaticTableViewController { if needRefresh { indicatorLabel.text = "reloading" setTableData() + needRefresh = false } } From d82396a3225a1167410a8a6862fb6735228a4d37 Mon Sep 17 00:00:00 2001 From: Bob Sun Date: Wed, 8 Mar 2017 21:52:07 -0800 Subject: [PATCH 3/9] Separate two advanced settings --- pass/Base.lproj/Main.storyboard | 64 +++++++++++++++++---------------- 1 file changed, 34 insertions(+), 30 deletions(-) diff --git a/pass/Base.lproj/Main.storyboard b/pass/Base.lproj/Main.storyboard index 05ccc23..0a1cd55 100644 --- a/pass/Base.lproj/Main.storyboard +++ b/pass/Base.lproj/Main.storyboard @@ -1,11 +1,11 @@ - + - + @@ -292,7 +292,7 @@