Init PGPAgent while getting keyID
This commit is contained in:
parent
f69f8bb867
commit
e4630e950d
2 changed files with 6 additions and 6 deletions
|
|
@ -40,7 +40,7 @@ class SettingsTableViewController: UITableViewController, UITabBarControllerDele
|
||||||
try KeyFileManager.PrivatePgp.importKey(from: SharedDefaults[.pgpPrivateKeyURL]!)
|
try KeyFileManager.PrivatePgp.importKey(from: SharedDefaults[.pgpPrivateKeyURL]!)
|
||||||
try PGPAgent.shared.initKeys()
|
try PGPAgent.shared.initKeys()
|
||||||
DispatchQueue.main.async {
|
DispatchQueue.main.async {
|
||||||
self.pgpKeyTableViewCell.detailTextLabel?.text = PGPAgent.shared.keyId
|
self.setPGPKeyTableViewCellDetailText()
|
||||||
SVProgressHUD.showSuccess(withStatus: "Success".localize())
|
SVProgressHUD.showSuccess(withStatus: "Success".localize())
|
||||||
SVProgressHUD.dismiss(withDelay: 1)
|
SVProgressHUD.dismiss(withDelay: 1)
|
||||||
Utils.alert(title: "RememberToRemoveKey".localize(), message: "RememberToRemoveKeyFromServer.".localize(), controller: self, completion: nil)
|
Utils.alert(title: "RememberToRemoveKey".localize(), message: "RememberToRemoveKeyFromServer.".localize(), controller: self, completion: nil)
|
||||||
|
|
@ -65,7 +65,7 @@ class SettingsTableViewController: UITableViewController, UITabBarControllerDele
|
||||||
try KeyFileManager.PrivatePgp.importKey(from: controller.armorPrivateKeyTextView.text ?? "")
|
try KeyFileManager.PrivatePgp.importKey(from: controller.armorPrivateKeyTextView.text ?? "")
|
||||||
try PGPAgent.shared.initKeys()
|
try PGPAgent.shared.initKeys()
|
||||||
DispatchQueue.main.async {
|
DispatchQueue.main.async {
|
||||||
self.pgpKeyTableViewCell.detailTextLabel?.text = PGPAgent.shared.keyId
|
self.setPGPKeyTableViewCellDetailText()
|
||||||
SVProgressHUD.showSuccess(withStatus: "Success".localize())
|
SVProgressHUD.showSuccess(withStatus: "Success".localize())
|
||||||
SVProgressHUD.dismiss(withDelay: 1)
|
SVProgressHUD.dismiss(withDelay: 1)
|
||||||
}
|
}
|
||||||
|
|
@ -91,7 +91,7 @@ class SettingsTableViewController: UITableViewController, UITabBarControllerDele
|
||||||
try KeyFileManager.PrivatePgp.importKeyFromFileSharing()
|
try KeyFileManager.PrivatePgp.importKeyFromFileSharing()
|
||||||
try PGPAgent.shared.initKeys()
|
try PGPAgent.shared.initKeys()
|
||||||
DispatchQueue.main.async {
|
DispatchQueue.main.async {
|
||||||
self.pgpKeyTableViewCell.detailTextLabel?.text = PGPAgent.shared.keyId
|
self.setPGPKeyTableViewCellDetailText()
|
||||||
SVProgressHUD.showSuccess(withStatus: "Imported".localize())
|
SVProgressHUD.showSuccess(withStatus: "Imported".localize())
|
||||||
SVProgressHUD.dismiss(withDelay: 1)
|
SVProgressHUD.dismiss(withDelay: 1)
|
||||||
}
|
}
|
||||||
|
|
@ -135,8 +135,7 @@ class SettingsTableViewController: UITableViewController, UITabBarControllerDele
|
||||||
}
|
}
|
||||||
|
|
||||||
private func setPGPKeyTableViewCellDetailText() {
|
private func setPGPKeyTableViewCellDetailText() {
|
||||||
try? PGPAgent.shared.initKeys()
|
pgpKeyTableViewCell.detailTextLabel?.text = try? PGPAgent.shared.getKeyId() ?? "NotSet".localize()
|
||||||
pgpKeyTableViewCell.detailTextLabel?.text = PGPAgent.shared.keyId ?? "NotSet".localize()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private func setPasswordRepositoryTableViewCellDetailText() {
|
private func setPasswordRepositoryTableViewCellDetailText() {
|
||||||
|
|
|
||||||
|
|
@ -35,7 +35,8 @@ public class PGPAgent {
|
||||||
pgpInterface = nil
|
pgpInterface = nil
|
||||||
}
|
}
|
||||||
|
|
||||||
public var keyId: String? {
|
public func getKeyId() throws -> String? {
|
||||||
|
try checkAndInit()
|
||||||
return pgpInterface?.keyId
|
return pgpInterface?.keyId
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue