Change "save" to "clone" button, and clone the repo by default.
This commit is contained in:
parent
dd254b21d9
commit
eccfeb19b5
3 changed files with 60 additions and 54 deletions
|
|
@ -482,7 +482,7 @@
|
|||
<segue destination="7K9-cE-9qq" kind="unwind" unwindAction="cancelGitServerSettingWithSegue:" id="SGr-tc-vDL"/>
|
||||
</connections>
|
||||
</barButtonItem>
|
||||
<barButtonItem key="rightBarButtonItem" style="done" systemItem="save" id="sgQ-zB-rxv">
|
||||
<barButtonItem key="rightBarButtonItem" title="Clone" style="done" id="sgQ-zB-rxv">
|
||||
<connections>
|
||||
<action selector="save:" destination="ynQ-64-MfA" id="HNL-Da-fXT"/>
|
||||
</connections>
|
||||
|
|
|
|||
|
|
@ -107,11 +107,12 @@ class GitServerSettingTableViewController: UITableViewController {
|
|||
tableView.deselectRow(at: indexPath, animated: true)
|
||||
}
|
||||
|
||||
@IBAction func save(_ sender: Any) {
|
||||
private func doClone() {
|
||||
if authenticationMethod == "Password" {
|
||||
let alert = UIAlertController(title: "Password", message: "Please fill in the password of your Git account.", preferredStyle: UIAlertControllerStyle.alert)
|
||||
alert.addAction(UIAlertAction(title: "OK", style: UIAlertActionStyle.default, handler: {_ in
|
||||
self.password = alert.textFields!.first!.text
|
||||
self.passwordStore.gitPassword = self.password
|
||||
if self.shouldPerformSegue(withIdentifier: "saveGitServerSettingSegue", sender: self) {
|
||||
self.performSegue(withIdentifier: "saveGitServerSettingSegue", sender: self)
|
||||
}
|
||||
|
|
@ -128,6 +129,19 @@ class GitServerSettingTableViewController: UITableViewController {
|
|||
}
|
||||
}
|
||||
|
||||
@IBAction func save(_ sender: Any) {
|
||||
if passwordStore.repositoryExisted() {
|
||||
let alert = UIAlertController(title: "Erase Current Password Store Data?", message: "A cloned password store exists. This operation will erase all local data. Data on your remote server will not be affected.", preferredStyle: UIAlertControllerStyle.alert)
|
||||
alert.addAction(UIAlertAction(title: "Erase", style: UIAlertActionStyle.destructive, handler: { _ in
|
||||
self.doClone()
|
||||
}))
|
||||
alert.addAction(UIAlertAction(title: "Cancel", style: UIAlertActionStyle.cancel, handler: nil))
|
||||
self.present(alert, animated: true, completion: nil)
|
||||
} else {
|
||||
doClone()
|
||||
}
|
||||
}
|
||||
|
||||
private func gitSSHKeyExists() -> Bool {
|
||||
return FileManager.default.fileExists(atPath: Globals.gitSSHPublicKeyPath) &&
|
||||
FileManager.default.fileExists(atPath: Globals.gitSSHPrivateKeyPath)
|
||||
|
|
|
|||
|
|
@ -101,13 +101,6 @@ class SettingsTableViewController: UITableViewController {
|
|||
let password = controller.password
|
||||
let auth = controller.authenticationMethod
|
||||
|
||||
if Defaults[.gitURL] == nil ||
|
||||
Defaults[.gitURL]!.absoluteString != gitRepostiroyURL ||
|
||||
auth != Defaults[.gitAuthenticationMethod] ||
|
||||
username != Defaults[.gitUsername] ||
|
||||
password != self.passwordStore.gitPassword ||
|
||||
self.passwordStore.repositoryExisted() == false {
|
||||
|
||||
SVProgressHUD.setDefaultMaskType(.black)
|
||||
SVProgressHUD.setDefaultStyle(.light)
|
||||
SVProgressHUD.show(withStatus: "Prepare Repository")
|
||||
|
|
@ -158,7 +151,6 @@ class SettingsTableViewController: UITableViewController {
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override func viewDidLoad() {
|
||||
super.viewDidLoad()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue