Observe passwordStoreUpdated notification in CommitLogs controller

This commit is contained in:
Bob Sun 2017-04-26 22:09:27 -07:00
parent eccfeb19b5
commit d94c7626a6
No known key found for this signature in database
GPG key ID: 1F86BA2052FED3B4

View file

@ -15,6 +15,7 @@ class CommitLogsTableViewController: UITableViewController {
override func viewDidLoad() {
super.viewDidLoad()
NotificationCenter.default.addObserver(self, selector: #selector(updateCommitLogs), name: .passwordStoreUpdated, object: nil)
commits = passwordStore.getRecentCommits(count: 20)
self.tableView.estimatedRowHeight = 50
self.tableView.rowHeight = UITableViewAutomaticDimension
@ -39,4 +40,9 @@ class CommitLogsTableViewController: UITableViewController {
messageLabel?.text = commits[indexPath.row].message?.trimmingCharacters(in: .whitespacesAndNewlines)
return cell
}
func updateCommitLogs () {
commits = passwordStore.getRecentCommits(count: 20)
tableView.reloadData()
}
}