Polish logic on initializing PGP keys.

- simplify interfaces
- more robust
This commit is contained in:
Bob Sun 2017-03-16 22:06:39 -07:00
parent df8e254c34
commit d338e725d5
6 changed files with 93 additions and 63 deletions

View file

@ -27,7 +27,7 @@ class AddPasswordTableViewController: PasswordEditorTableViewController {
override func shouldPerformSegue(withIdentifier identifier: String, sender: Any?) -> Bool {
if identifier == "saveAddPasswordSegue" {
// check PGP key
if Defaults[.pgpKeyID] == nil {
if PasswordStore.shared.privateKey == nil {
let alertTitle = "Cannot Add Password"
let alertMessage = "PGP Key is not set. Please set your PGP Key first."
Utils.alert(title: alertTitle, message: alertMessage, controller: self, completion: nil)