Fix PGP key importing issue

This commit is contained in:
Mingshen Sun 2020-04-14 11:55:18 -07:00
parent c35aedb7ad
commit 50dec23b02
No known key found for this signature in database
GPG key ID: 1F86BA2052FED3B4

View file

@ -39,6 +39,8 @@ class SettingsTableViewController: UITableViewController, UITabBarControllerDele
DispatchQueue.global(qos: .userInitiated).async { [unowned self] in DispatchQueue.global(qos: .userInitiated).async { [unowned self] in
Defaults.pgpKeySource = type(of: keyImporter).keySource Defaults.pgpKeySource = type(of: keyImporter).keySource
do { do {
// Remove exiting passphrase
AppKeychain.shared.removeAllContent(withPrefix: Globals.pgpKeyPassphrase)
try keyImporter.importKeys() try keyImporter.importKeys()
try PGPAgent.shared.initKeys() try PGPAgent.shared.initKeys()
DispatchQueue.main.async { DispatchQueue.main.async {
@ -148,7 +150,9 @@ class SettingsTableViewController: UITableViewController, UITabBarControllerDele
}) })
if isReadyToUse() { if isReadyToUse() {
optionMenu.addAction(UIAlertAction(title: "\(Self.menuLabel) (\("Import".localize()))", style: .default)) optionMenu.addAction(UIAlertAction(title: "\(Self.menuLabel) (\("Import".localize()))", style: .default) { _ in
self.saveImportedKeys()
})
} else { } else {
optionMenu.addAction(UIAlertAction(title: "\(Self.menuLabel) (\("Tips".localize()))", style: .default) { _ in optionMenu.addAction(UIAlertAction(title: "\(Self.menuLabel) (\("Tips".localize()))", style: .default) { _ in
let title = "Tips".localize() let title = "Tips".localize()