Provide the 'remember git credential passphrases' option
This commit is contained in:
parent
c57ae4f88e
commit
d0bad8660b
11 changed files with 97 additions and 44 deletions
|
|
@ -28,12 +28,21 @@ class GeneralSettingsTableViewController: BasicStaticTableViewController {
|
|||
return uiSwitch
|
||||
}()
|
||||
|
||||
let rememberPassphraseSwitch: UISwitch = {
|
||||
let rememberPGPPassphraseSwitch: UISwitch = {
|
||||
let uiSwitch = UISwitch()
|
||||
uiSwitch.onTintColor = Globals.blue
|
||||
uiSwitch.sizeToFit()
|
||||
uiSwitch.addTarget(self, action: #selector(rememberPassphraseSwitchAction(_:)), for: UIControlEvents.valueChanged)
|
||||
uiSwitch.isOn = SharedDefaults[.isRememberPassphraseOn]
|
||||
uiSwitch.addTarget(self, action: #selector(rememberPGPPassphraseSwitchAction(_:)), for: UIControlEvents.valueChanged)
|
||||
uiSwitch.isOn = SharedDefaults[.isRememberPGPPassphraseOn]
|
||||
return uiSwitch
|
||||
}()
|
||||
|
||||
let rememberGitCredentialPassphraseSwitch: UISwitch = {
|
||||
let uiSwitch = UISwitch()
|
||||
uiSwitch.onTintColor = Globals.blue
|
||||
uiSwitch.sizeToFit()
|
||||
uiSwitch.addTarget(self, action: #selector(rememberGitCredentialPassphraseSwitchAction(_:)), for: UIControlEvents.valueChanged)
|
||||
uiSwitch.isOn = SharedDefaults[.isRememberGitCredentialPassphraseOn]
|
||||
return uiSwitch
|
||||
}()
|
||||
|
||||
|
|
@ -58,7 +67,8 @@ class GeneralSettingsTableViewController: BasicStaticTableViewController {
|
|||
|
||||
// section 2
|
||||
[
|
||||
[.title: "Remember Passphrase", .action: "none",],
|
||||
[.title: "Remember PGP Key Passphrase", .action: "none",],
|
||||
[.title: "Remember Git Credential Passphrase", .action: "none",],
|
||||
],
|
||||
[
|
||||
[.title: "Show Folder", .action: "none",],
|
||||
|
|
@ -98,10 +108,14 @@ class GeneralSettingsTableViewController: BasicStaticTableViewController {
|
|||
cell.accessoryView = accessoryView
|
||||
cell.selectionStyle = .none
|
||||
hideOTPSwitch.isOn = SharedDefaults[.isHideOTPOn]
|
||||
case "Remember Passphrase":
|
||||
case "Remember PGP Key Passphrase":
|
||||
cell.accessoryType = .none
|
||||
cell.selectionStyle = .none
|
||||
cell.accessoryView = rememberPassphraseSwitch
|
||||
cell.accessoryView = rememberPGPPassphraseSwitch
|
||||
case "Remember Git Credential Passphrase":
|
||||
cell.accessoryType = .none
|
||||
cell.selectionStyle = .none
|
||||
cell.accessoryView = rememberGitCredentialPassphraseSwitch
|
||||
case "Show Folder":
|
||||
cell.accessoryType = .none
|
||||
cell.selectionStyle = .none
|
||||
|
|
@ -176,13 +190,21 @@ class GeneralSettingsTableViewController: BasicStaticTableViewController {
|
|||
NotificationCenter.default.post(name: .passwordDetailDisplaySettingChanged, object: nil)
|
||||
}
|
||||
|
||||
@objc func rememberPassphraseSwitchAction(_ sender: Any?) {
|
||||
SharedDefaults[.isRememberPassphraseOn] = rememberPassphraseSwitch.isOn
|
||||
if rememberPassphraseSwitch.isOn == false {
|
||||
@objc func rememberPGPPassphraseSwitchAction(_ sender: Any?) {
|
||||
SharedDefaults[.isRememberPGPPassphraseOn] = rememberPGPPassphraseSwitch.isOn
|
||||
if rememberPGPPassphraseSwitch.isOn == false {
|
||||
passwordStore.pgpKeyPassphrase = nil
|
||||
}
|
||||
}
|
||||
|
||||
@objc func rememberGitCredentialPassphraseSwitchAction(_ sender: Any?) {
|
||||
SharedDefaults[.isRememberGitCredentialPassphraseOn] = rememberGitCredentialPassphraseSwitch.isOn
|
||||
if rememberGitCredentialPassphraseSwitch.isOn == false {
|
||||
passwordStore.gitSSHPrivateKeyPassphrase = nil
|
||||
passwordStore.gitPassword = nil
|
||||
}
|
||||
}
|
||||
|
||||
@objc func showFolderSwitchAction(_ sender: Any?) {
|
||||
SharedDefaults[.isShowFolderOn] = showFolderSwitch.isOn
|
||||
NotificationCenter.default.post(name: .passwordDisplaySettingChanged, object: nil)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue