Polish the logic about updating last synced time.

- Update the date right after corresponding operations, and before reloading any "table view".
This commit is contained in:
Yishi Lin 2017-03-29 00:56:07 +08:00
parent 66688b5f66
commit 0197444e30
6 changed files with 15 additions and 13 deletions

View file

@ -63,7 +63,7 @@ class AboutRepositoryTableViewController: BasicStaticTableViewController {
[[.style: CellDataStyle.value1, .accessoryType: type, .title: "Passwords", .detailText: numberOfPasswordsString],
[.style: CellDataStyle.value1, .accessoryType: type, .title: "Size", .detailText: sizeOfRepositoryString],
[.style: CellDataStyle.value1, .accessoryType: type, .title: "Local Commits", .detailText: String(self?.passwordStore.numberOfLocalCommits() ?? 0)],
[.style: CellDataStyle.value1, .accessoryType: type, .title: "Last Synced", .detailText: Utils.getLastUpdatedTimeString()],
[.style: CellDataStyle.value1, .accessoryType: type, .title: "Last Synced", .detailText: Utils.getLastSyncedTimeString()],
[.style: CellDataStyle.value1, .accessoryType: type, .title: "Commits", .detailText: numberOfCommitsString],
[.title: "Commit Logs", .action: "segue", .link: "showCommitLogsSegue"],
],

View file

@ -143,7 +143,6 @@ class PasswordsViewController: UIViewController, UITableViewDataSource, UITableV
}
DispatchQueue.main.async {
self.reloadTableView(parent: nil)
Defaults[.lastUpdatedTime] = Date()
Defaults[.gitRepositoryPasswordAttempts] = 0
SVProgressHUD.showSuccess(withStatus: "Done")
SVProgressHUD.dismiss(withDelay: 1)
@ -428,7 +427,7 @@ class PasswordsViewController: UIViewController, UITableViewDataSource, UITableV
self.tableView.layer.removeAnimation(forKey: "UITableViewReloadDataAnimationKey")
// set the sync control title
let atribbutedTitle = "Last Synced: \(Utils.getLastUpdatedTimeString())"
let atribbutedTitle = "Last Synced: \(Utils.getLastSyncedTimeString())"
syncControl.attributedTitle = NSAttributedString(string: atribbutedTitle)
}

View file

@ -140,7 +140,6 @@ class SettingsTableViewController: UITableViewController {
}
})
DispatchQueue.main.async {
Defaults[.lastUpdatedTime] = Date()
Defaults[.gitRepositoryURL] = URL(string: gitRepostiroyURL)
Defaults[.gitRepositoryUsername] = username
Defaults[.gitRepositoryAuthenticationMethod] = auth