add authentication method selection UI

This commit is contained in:
Bob Sun 2017-01-25 18:28:37 +08:00
parent fcef83277f
commit cc7a53781c
No known key found for this signature in database
GPG key ID: 1F86BA2052FED3B4
9 changed files with 273 additions and 7 deletions

View file

@ -26,6 +26,7 @@ class GitServerSettingTableViewController: UITableViewController {
}
usernameTextField.text = Defaults[.gitRepositoryUsername]
passwordTextField.text = Defaults[.gitRepositoryPassword]
authenticationTableViewCell.detailTextLabel?.text = Defaults[.gitRepositoryAuthenticationMethod]
}
override func viewDidAppear(_ animated: Bool) {
@ -37,4 +38,21 @@ class GitServerSettingTableViewController: UITableViewController {
super.viewWillDisappear(animated)
view.endEditing(true)
}
@IBAction func save(segue: UIStoryboardSegue) {
if let controller = segue.source as? UITableViewController {
if controller.tableView.indexPathForSelectedRow == IndexPath(row: 0, section:0) {
authenticationTableViewCell.detailTextLabel?.text = "Password"
} else {
authenticationTableViewCell.detailTextLabel?.text = "SSH Key"
}
}
}
override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
if segue.identifier == "selectAuthenticationMethod" {
if let controller = segue.destination as? GitRepositoryAuthenticationSettingTableViewController {
controller.selectedMethod = authenticationTableViewCell.detailTextLabel!.text
}
}
}
}