Check for readiness before doing any import actions
This commit is contained in:
parent
a5570a8409
commit
ea27c73b99
2 changed files with 4 additions and 4 deletions
|
|
@ -38,6 +38,9 @@ extension PGPKeyImporter {
|
|||
extension PGPKeyImporter where Self: UIViewController {
|
||||
|
||||
func savePassphraseDialog() {
|
||||
guard self.isReadyToUse() else {
|
||||
return
|
||||
}
|
||||
let savePassphraseAlert = UIAlertController(title: "Passphrase".localize(), message: "WantToSavePassphrase?".localize(), preferredStyle: .alert)
|
||||
// Do not save the key's passphrase.
|
||||
savePassphraseAlert.addAction(UIAlertAction(title: "No".localize(), style: .default) { _ in
|
||||
|
|
|
|||
|
|
@ -26,16 +26,13 @@ class SettingsTableViewController: UITableViewController, UITabBarControllerDele
|
|||
}
|
||||
|
||||
@IBAction func savePGPKey(segue: UIStoryboardSegue) {
|
||||
guard let sourceController = segue.source as? PGPKeyImporter else {
|
||||
guard let sourceController = segue.source as? PGPKeyImporter, sourceController.isReadyToUse() else {
|
||||
return
|
||||
}
|
||||
savePGPKey(using: sourceController)
|
||||
}
|
||||
|
||||
private func savePGPKey(using keyImporter: PGPKeyImporter) {
|
||||
guard keyImporter.isReadyToUse() else {
|
||||
return
|
||||
}
|
||||
SVProgressHUD.setDefaultMaskType(.black)
|
||||
SVProgressHUD.setDefaultStyle(.light)
|
||||
SVProgressHUD.show(withStatus: "FetchingPgpKey".localize())
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue