add PGP key url check
This commit is contained in:
parent
27c12abdc4
commit
6e5f6d9360
3 changed files with 16 additions and 3 deletions
|
|
@ -485,7 +485,7 @@
|
|||
</barButtonItem>
|
||||
<barButtonItem key="rightBarButtonItem" systemItem="done" id="TNt-ne-l7W">
|
||||
<connections>
|
||||
<segue destination="jjl-Xi-fkn" kind="unwind" unwindAction="saveWithSegue:" id="aKP-AF-lfv"/>
|
||||
<segue destination="jjl-Xi-fkn" kind="unwind" identifier="savePGPKeySegue" unwindAction="saveWithSegue:" id="aKP-AF-lfv"/>
|
||||
</connections>
|
||||
</barButtonItem>
|
||||
</navigationItem>
|
||||
|
|
|
|||
|
|
@ -19,4 +19,17 @@ class PGPKeySettingTableViewController: UITableViewController {
|
|||
pgpKeyURLTextField.text = Defaults[.pgpKeyURL]?.absoluteString
|
||||
pgpKeyPassphraseTextField.text = Defaults[.pgpKeyPassphrase]
|
||||
}
|
||||
|
||||
override func shouldPerformSegue(withIdentifier identifier: String, sender: Any?) -> Bool {
|
||||
if identifier == "savePGPKeySegue" {
|
||||
if URL(string: pgpKeyURLTextField.text!)!.scheme! == "http" {
|
||||
let alertMessage = "HTTP connection is not supported."
|
||||
let alert = UIAlertController(title: "Cannot Save Settings", message: alertMessage, preferredStyle: UIAlertControllerStyle.alert)
|
||||
alert.addAction(UIAlertAction(title: "OK", style: UIAlertActionStyle.default, handler: nil))
|
||||
self.present(alert, animated: true, completion: nil)
|
||||
return false
|
||||
}
|
||||
}
|
||||
return true
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -75,9 +75,9 @@ class SettingsTableViewController: UITableViewController {
|
|||
}
|
||||
}
|
||||
} else if let controller = segue.source as? PGPKeySettingTableViewController {
|
||||
|
||||
if Defaults[.pgpKeyURL] != URL(string: controller.pgpKeyURLTextField.text!) ||
|
||||
Defaults[.pgpKeyPassphrase] != controller.pgpKeyPassphraseTextField.text!
|
||||
{
|
||||
Defaults[.pgpKeyPassphrase] != controller.pgpKeyPassphraseTextField.text! {
|
||||
Defaults[.pgpKeyURL] = URL(string: controller.pgpKeyURLTextField.text!)
|
||||
Defaults[.pgpKeyPassphrase] = controller.pgpKeyPassphraseTextField.text!
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue