Add PGPAgent tests and minor updated
This commit is contained in:
parent
a628a9b4da
commit
e967bb1f4c
8 changed files with 68 additions and 43 deletions
|
|
@ -31,7 +31,7 @@ class AddPasswordTableViewController: PasswordEditorTableViewController {
|
|||
override func shouldPerformSegue(withIdentifier identifier: String, sender: Any?) -> Bool {
|
||||
if identifier == "saveAddPasswordSegue" {
|
||||
// check PGP key
|
||||
guard passwordStore.pgpAgent?.imported ?? false else {
|
||||
guard passwordStore.pgpAgent?.isImported ?? false else {
|
||||
let alertTitle = "CannotAddPassword".localize()
|
||||
let alertMessage = "PgpKeyNotSet.".localize()
|
||||
Utils.alert(title: alertTitle, message: alertMessage, controller: self, completion: nil)
|
||||
|
|
|
|||
|
|
@ -391,7 +391,7 @@ class PasswordsViewController: UIViewController, UITableViewDataSource, UITableV
|
|||
}
|
||||
|
||||
private func decryptThenCopyPassword(from indexPath: IndexPath) {
|
||||
guard self.passwordStore.pgpAgent?.imported ?? false else {
|
||||
guard self.passwordStore.pgpAgent?.isImported ?? false else {
|
||||
Utils.alert(title: "CannotCopyPassword".localize(), message: "SetPgpKey.".localize(), controller: self, completion: nil)
|
||||
return
|
||||
}
|
||||
|
|
@ -453,7 +453,7 @@ class PasswordsViewController: UIViewController, UITableViewDataSource, UITableV
|
|||
|
||||
override func shouldPerformSegue(withIdentifier identifier: String, sender: Any?) -> Bool {
|
||||
if identifier == "showPasswordDetail" {
|
||||
guard self.passwordStore.pgpAgent?.imported ?? false else {
|
||||
guard self.passwordStore.pgpAgent?.isImported ?? false else {
|
||||
Utils.alert(title: "CannotShowPassword".localize(), message: "SetPgpKey.".localize(), controller: self, completion: nil)
|
||||
if let s = sender as? UITableViewCell {
|
||||
let selectedIndexPath = tableView.indexPath(for: s)!
|
||||
|
|
@ -462,7 +462,7 @@ class PasswordsViewController: UIViewController, UITableViewDataSource, UITableV
|
|||
return false
|
||||
}
|
||||
} else if identifier == "addPasswordSegue" {
|
||||
guard self.passwordStore.pgpAgent?.imported ?? false && self.passwordStore.storeRepository != nil else {
|
||||
guard self.passwordStore.pgpAgent?.isImported ?? false && self.passwordStore.storeRepository != nil else {
|
||||
Utils.alert(title: "CannotAddPassword".localize(), message: "MakeSurePgpAndGitProperlySet.".localize(), controller: self, completion: nil)
|
||||
return false
|
||||
}
|
||||
|
|
|
|||
|
|
@ -89,8 +89,7 @@ class SettingsTableViewController: UITableViewController, UITabBarControllerDele
|
|||
SVProgressHUD.show(withStatus: "FetchingPgpKey".localize())
|
||||
DispatchQueue.global(qos: .userInitiated).async { [unowned self] in
|
||||
do {
|
||||
try self.passwordStore.pgpAgent?.pgpKeyImportFromFileSharing()
|
||||
try self.passwordStore.pgpAgent?.initPGPKeys()
|
||||
try self.passwordStore.pgpAgent?.initPGPKeyFromFileSharing()
|
||||
DispatchQueue.main.async {
|
||||
self.pgpKeyTableViewCell.detailTextLabel?.text = self.passwordStore.pgpAgent?.pgpKeyID
|
||||
SVProgressHUD.showSuccess(withStatus: "Imported".localize())
|
||||
|
|
@ -193,7 +192,7 @@ class SettingsTableViewController: UITableViewController, UITabBarControllerDele
|
|||
optionMenu.addAction(urlAction)
|
||||
optionMenu.addAction(armorAction)
|
||||
|
||||
if passwordStore.pgpKeyExists(inFileSharing: true) {
|
||||
if passwordStore.pgpAgent?.isFileSharingReady ?? false {
|
||||
fileActionTitle.append(" (\("Import".localize()))")
|
||||
let fileAction = UIAlertAction(title: fileActionTitle, style: .default) { _ in
|
||||
// passphrase related
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue