Remove optional arguments and qualified names

This commit is contained in:
Danny Moesch 2020-02-09 22:43:21 +01:00 committed by Mingshen Sun
parent 43bba1fb50
commit a5570a8409
4 changed files with 14 additions and 14 deletions

View file

@ -38,28 +38,28 @@ extension PGPKeyImporter {
extension PGPKeyImporter where Self: UIViewController {
func savePassphraseDialog() {
let savePassphraseAlert = UIAlertController(title: "Passphrase".localize(), message: "WantToSavePassphrase?".localize(), preferredStyle: UIAlertController.Style.alert)
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: UIAlertAction.Style.default) { _ in
savePassphraseAlert.addAction(UIAlertAction(title: "No".localize(), style: .default) { _ in
AppKeychain.shared.removeContent(for: Globals.pgpKeyPassphrase)
Defaults.isRememberPGPPassphraseOn = false
self.saveImportedKeys()
})
// Save the key's passphrase.
savePassphraseAlert.addAction(UIAlertAction(title: "Yes".localize(), style: UIAlertAction.Style.destructive) {_ in
savePassphraseAlert.addAction(UIAlertAction(title: "Yes".localize(), style: .destructive) { _ in
// Ask for the passphrase.
let alert = UIAlertController(title: "Passphrase".localize(), message: "FillInPgpPassphrase.".localize(), preferredStyle: UIAlertController.Style.alert)
alert.addAction(UIAlertAction(title: "Ok".localize(), style: UIAlertAction.Style.default, handler: {_ in
let alert = UIAlertController(title: "Passphrase".localize(), message: "FillInPgpPassphrase.".localize(), preferredStyle: .alert)
alert.addAction(UIAlertAction(title: "Ok".localize(), style: .default) { _ in
AppKeychain.shared.add(string: alert.textFields?.first?.text, for: Globals.pgpKeyPassphrase)
Defaults.isRememberPGPPassphraseOn = true
self.saveImportedKeys()
}))
})
alert.addTextField { textField in
textField.text = AppKeychain.shared.get(for: Globals.pgpKeyPassphrase)
textField.isSecureTextEntry = true
}
self.present(alert, animated: true, completion: nil)
self.present(alert, animated: true)
})
self.present(savePassphraseAlert, animated: true, completion: nil)
present(savePassphraseAlert, animated: true)
}
}