add check when saving Git server settings (#1)
This commit is contained in:
parent
81b707266d
commit
d3f186013e
3 changed files with 20 additions and 2 deletions
|
|
@ -314,7 +314,7 @@
|
||||||
</barButtonItem>
|
</barButtonItem>
|
||||||
<barButtonItem key="rightBarButtonItem" style="done" systemItem="save" id="sgQ-zB-rxv">
|
<barButtonItem key="rightBarButtonItem" style="done" systemItem="save" id="sgQ-zB-rxv">
|
||||||
<connections>
|
<connections>
|
||||||
<segue destination="7K9-cE-9qq" kind="unwind" unwindAction="saveWithSegue:" id="hvX-Fk-F21"/>
|
<segue destination="7K9-cE-9qq" kind="unwind" identifier="saveGitServerSettingSegue" unwindAction="saveWithSegue:" id="hvX-Fk-F21"/>
|
||||||
</connections>
|
</connections>
|
||||||
</barButtonItem>
|
</barButtonItem>
|
||||||
</navigationItem>
|
</navigationItem>
|
||||||
|
|
|
||||||
|
|
@ -55,6 +55,24 @@ class GitServerSettingTableViewController: UITableViewController {
|
||||||
view.endEditing(true)
|
view.endEditing(true)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
override func shouldPerformSegue(withIdentifier identifier: String, sender: Any?) -> Bool {
|
||||||
|
if identifier == "saveGitServerSettingSegue" {
|
||||||
|
if gitRepositoryURLTextField.text == "" || authenticationMethod == "" {
|
||||||
|
var alertMessage = ""
|
||||||
|
if gitRepositoryURLTextField.text == "" {
|
||||||
|
alertMessage = "Git Server is not set. Please set the Git server first."
|
||||||
|
} else if authenticationMethod == "" {
|
||||||
|
alertMessage = "PGP Key is not set. Please set your PGP Key first."
|
||||||
|
}
|
||||||
|
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
|
||||||
|
}
|
||||||
|
|
||||||
@IBAction func save(segue: UIStoryboardSegue) {
|
@IBAction func save(segue: UIStoryboardSegue) {
|
||||||
if let controller = segue.source as? UITableViewController {
|
if let controller = segue.source as? UITableViewController {
|
||||||
if controller.tableView.indexPathForSelectedRow == IndexPath(row: 0, section:0) {
|
if controller.tableView.indexPathForSelectedRow == IndexPath(row: 0, section:0) {
|
||||||
|
|
|
||||||
|
|
@ -156,7 +156,7 @@ class PasswordsViewController: UIViewController, UITableViewDataSource, UITableV
|
||||||
override func shouldPerformSegue(withIdentifier identifier: String, sender: Any?) -> Bool {
|
override func shouldPerformSegue(withIdentifier identifier: String, sender: Any?) -> Bool {
|
||||||
if identifier == "showPasswordDetail" {
|
if identifier == "showPasswordDetail" {
|
||||||
if Defaults[.pgpKeyID] == "" {
|
if Defaults[.pgpKeyID] == "" {
|
||||||
let alert = UIAlertController(title: "Unable to Decrypt Password", message: "PGP Key is not set. Please set your PGP Key first.", preferredStyle: UIAlertControllerStyle.alert)
|
let alert = UIAlertController(title: "Cannot Show Password", message: "PGP Key is not set. Please set your PGP Key first.", preferredStyle: UIAlertControllerStyle.alert)
|
||||||
alert.addAction(UIAlertAction(title: "OK", style: UIAlertActionStyle.default, handler: nil))
|
alert.addAction(UIAlertAction(title: "OK", style: UIAlertActionStyle.default, handler: nil))
|
||||||
self.present(alert, animated: true, completion: nil)
|
self.present(alert, animated: true, completion: nil)
|
||||||
if let s = sender as? UITableViewCell {
|
if let s = sender as? UITableViewCell {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue