Add confirmation prompt for removing keys (fix #491)

This commit is contained in:
Mingshen Sun 2021-12-29 16:19:12 -08:00
parent 7320319031
commit ff6a1edf62
7 changed files with 42 additions and 9 deletions

View file

@ -184,11 +184,14 @@ class SettingsTableViewController: UITableViewController, UITabBarControllerDele
if Defaults.pgpKeySource != nil {
optionMenu.addAction(
UIAlertAction(title: "RemovePgpKeys".localize(), style: .destructive) { _ in
self.keychain.removeContent(for: PGPKey.PUBLIC.getKeychainKey())
self.keychain.removeContent(for: PGPKey.PRIVATE.getKeychainKey())
PGPAgent.shared.uninitKeys()
self.pgpKeyTableViewCell.detailTextLabel?.text = "NotSet".localize()
Defaults.pgpKeySource = nil
let alert = UIAlertController.removeConfirmationAlert(title: "RemovePgpKeys".localize(), message: "") { _ in
self.keychain.removeContent(for: PGPKey.PUBLIC.getKeychainKey())
self.keychain.removeContent(for: PGPKey.PRIVATE.getKeychainKey())
PGPAgent.shared.uninitKeys()
self.pgpKeyTableViewCell.detailTextLabel?.text = "NotSet".localize()
Defaults.pgpKeySource = nil
}
self.present(alert, animated: true, completion: nil)
}
)
}