From 29f9f28e4c04f86a320d99694e7427048da8c2a9 Mon Sep 17 00:00:00 2001 From: Bob Sun Date: Sun, 19 Mar 2017 10:36:59 -0700 Subject: [PATCH 01/38] Fix #62 --- pass/Models/PasswordStore.swift | 3 +++ 1 file changed, 3 insertions(+) diff --git a/pass/Models/PasswordStore.swift b/pass/Models/PasswordStore.swift index be28d0f..8cc99d6 100644 --- a/pass/Models/PasswordStore.swift +++ b/pass/Models/PasswordStore.swift @@ -359,6 +359,9 @@ class PasswordStore { } func getRecentCommits(count: Int) -> [GTCommit] { + guard storeRepository != nil else { + return [] + } var commits = [GTCommit]() do { let enumerator = try GTEnumerator(repository: storeRepository!) From f0b4d2990ec2b794e264ffbcf76158b0d342dee2 Mon Sep 17 00:00:00 2001 From: Bob Sun Date: Sun, 19 Mar 2017 14:36:20 -0700 Subject: [PATCH 02/38] Simplify about repository controller --- .../AboutRepositoryTableViewController.swift | 23 ++++++------------- 1 file changed, 7 insertions(+), 16 deletions(-) diff --git a/pass/Controllers/AboutRepositoryTableViewController.swift b/pass/Controllers/AboutRepositoryTableViewController.swift index f6e7178..a136494 100644 --- a/pass/Controllers/AboutRepositoryTableViewController.swift +++ b/pass/Controllers/AboutRepositoryTableViewController.swift @@ -11,25 +11,18 @@ import UIKit class AboutRepositoryTableViewController: BasicStaticTableViewController { var needRefresh = false - var indicatorLabel: UILabel! - var indicator: UIActivityIndicatorView! + var indicator: UIActivityIndicatorView = { + let indicator = UIActivityIndicatorView(activityIndicatorStyle: .gray) + return indicator + }() let passwordStore = PasswordStore.shared override func viewDidLoad() { navigationItemTitle = "About Repository" super.viewDidLoad() - - indicatorLabel = UILabel(frame: CGRect(x: 0, y: 0, width: view.frame.width, height: 21)) - indicatorLabel.center = CGPoint(x: view.frame.size.width / 2, y: view.frame.size.height * 0.382 + 22) - indicatorLabel.backgroundColor = UIColor.clear - indicatorLabel.textColor = UIColor.gray - indicatorLabel.text = "calculating" - indicatorLabel.textAlignment = .center - indicatorLabel.font = UIFont.preferredFont(forTextStyle: .footnote) - indicator = UIActivityIndicatorView(activityIndicatorStyle: .gray) + indicator.center = CGPoint(x: view.frame.size.width / 2, y: view.frame.size.height * 0.382) tableView.addSubview(indicator) - tableView.addSubview(indicatorLabel) setTableData() @@ -40,7 +33,6 @@ class AboutRepositoryTableViewController: BasicStaticTableViewController { override func viewWillAppear(_ animated: Bool) { super.viewWillAppear(animated) if needRefresh { - indicatorLabel.text = "reloading" setTableData() needRefresh = false } @@ -51,7 +43,6 @@ class AboutRepositoryTableViewController: BasicStaticTableViewController { // clear current contents (if any) self.tableData.removeAll(keepingCapacity: true) self.tableView.reloadData() - indicatorLabel.isHidden = false indicator.startAnimating() // reload the table @@ -82,14 +73,14 @@ class AboutRepositoryTableViewController: BasicStaticTableViewController { self?.tableData = [ // section 0 [[.style: CellDataStyle.value1, .accessoryType: type, .title: "Passwords", .detailText: numberOfPasswords], - [.style: CellDataStyle.value1, .accessoryType: type, .title: "Size", .detailText: sizeOfRepository], [.style: CellDataStyle.value1, .accessoryType: type, .title: "Unsynced", .detailText: String(self?.passwordStore.getNumberOfUnsyncedPasswords() ?? 0)], + [.style: CellDataStyle.value1, .accessoryType: type, .title: "Size", .detailText: sizeOfRepository], + [.style: CellDataStyle.value1, .accessoryType: type, .title: "Unsynced", .detailText: String(self?.passwordStore.getNumberOfUnsyncedPasswords() ?? 0)], [.style: CellDataStyle.value1, .accessoryType: type, .title: "Last Synced", .detailText: Utils.getLastUpdatedTimeString()], [.style: CellDataStyle.value1, .accessoryType: type, .title: "Commits", .detailText: numberOfCommitsString], [.title: "Commit Logs", .action: "segue", .link: "showCommitLogsSegue"], ], ] self?.indicator.stopAnimating() - self?.indicatorLabel.isHidden = true self?.tableView.reloadData() } } From 3369d1f41abeb56ef9d03c5c57377f7fb4a357b5 Mon Sep 17 00:00:00 2001 From: Bob Sun Date: Sun, 19 Mar 2017 14:54:24 -0700 Subject: [PATCH 03/38] Update commit logs cell UI --- pass/Base.lproj/Main.storyboard | 46 ++++++++++++++++----------------- 1 file changed, 23 insertions(+), 23 deletions(-) diff --git a/pass/Base.lproj/Main.storyboard b/pass/Base.lproj/Main.storyboard index 84b2fb4..059fe5f 100644 --- a/pass/Base.lproj/Main.storyboard +++ b/pass/Base.lproj/Main.storyboard @@ -1,5 +1,5 @@ - + @@ -89,11 +89,11 @@ - +