Set navigation controller title as folder name

This commit is contained in:
Bob Sun 2017-03-02 15:49:46 +08:00
parent 853ea547e2
commit 301309f0cc
No known key found for this signature in database
GPG key ID: 1F86BA2052FED3B4

View file

@ -321,11 +321,17 @@ class PasswordsViewController: UIViewController, UITableViewDataSource, UITableV
}
private func setNavigationItemTitle() {
var title = ""
if parentPasswordEntity != nil {
title = parentPasswordEntity!.name!
} else {
title = "Password Store"
}
let numberOfUnsynced = PasswordStore.shared.getNumberOfUnsyncedPasswords()
if numberOfUnsynced == 0 {
navigationItem.title = "Password Store"
navigationItem.title = "\(title)"
} else {
navigationItem.title = "Password Store (\(numberOfUnsynced))"
navigationItem.title = "\(title) (\(numberOfUnsynced))"
}
}
@ -382,6 +388,7 @@ class PasswordsViewController: UIViewController, UITableViewDataSource, UITableV
}
func reloadTableView(data: [PasswordsTableEntry]) {
setNavigationItemTitle()
if parentPasswordEntity != nil {
navigationItem.leftBarButtonItem = backUIBarButtonItem
} else {