remove passphrase cell and add passphrase alert dialog
This commit is contained in:
parent
7598c81da8
commit
a3a09beebf
4 changed files with 153 additions and 132 deletions
|
|
@ -11,14 +11,27 @@ import SwiftyUserDefaults
|
|||
|
||||
class PGPKeyArmorSettingTableViewController: UITableViewController {
|
||||
@IBOutlet weak var armorPublicKeyTextView: UITextView!
|
||||
@IBOutlet weak var passphraseTextField: UITextField!
|
||||
@IBOutlet weak var armorPrivateKeyTextView: UITextView!
|
||||
var pgpPassphrase: String?
|
||||
|
||||
override func viewDidLoad() {
|
||||
super.viewDidLoad()
|
||||
armorPublicKeyTextView.text = Defaults[.pgpPublicKeyArmor]
|
||||
armorPrivateKeyTextView.text = Defaults[.pgpPrivateKeyArmor]
|
||||
passphraseTextField.text = Defaults[.pgpKeyPassphrase]
|
||||
pgpPassphrase = Defaults[.pgpKeyPassphrase]
|
||||
}
|
||||
|
||||
@IBAction func save(_ sender: Any) {
|
||||
let alert = UIAlertController(title: "Phassphrase", message: "Please fill in the passphrase of your PGP secret key.", preferredStyle: UIAlertControllerStyle.alert)
|
||||
alert.addAction(UIAlertAction(title: "OK", style: UIAlertActionStyle.default, handler: {_ in
|
||||
self.pgpPassphrase = alert.textFields?.first?.text
|
||||
self.performSegue(withIdentifier: "savePGPKeySegue", sender: self)
|
||||
}))
|
||||
alert.addTextField(configurationHandler: {(textField: UITextField!) in
|
||||
textField.text = self.pgpPassphrase
|
||||
textField.isSecureTextEntry = true
|
||||
})
|
||||
self.present(alert, animated: true, completion: nil)
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue