Polish code to make sure detail text in settings are correct
This commit is contained in:
parent
30ae32ec5f
commit
ea3c12f2e4
1 changed files with 36 additions and 14 deletions
|
|
@ -170,21 +170,43 @@ class SettingsTableViewController: UITableViewController {
|
||||||
touchIDSwitch.onTintColor = UIColor(displayP3Red: 0, green: 122.0/255, blue: 1, alpha: 1)
|
touchIDSwitch.onTintColor = UIColor(displayP3Red: 0, green: 122.0/255, blue: 1, alpha: 1)
|
||||||
touchIDTableViewCell.accessoryView = touchIDSwitch
|
touchIDTableViewCell.accessoryView = touchIDSwitch
|
||||||
touchIDSwitch.addTarget(self, action: #selector(touchIDSwitchAction), for: UIControlEvents.valueChanged)
|
touchIDSwitch.addTarget(self, action: #selector(touchIDSwitchAction), for: UIControlEvents.valueChanged)
|
||||||
if Defaults[.pgpKeyID] == "" {
|
setPGPKeyTableViewCellDetailText()
|
||||||
pgpKeyTableViewCell.detailTextLabel?.text = "Not Set"
|
setPasswordRepositoryTableViewCellDetailText()
|
||||||
} else {
|
setTouchIDSwitch()
|
||||||
pgpKeyTableViewCell.detailTextLabel?.text = Defaults[.pgpKeyID]
|
setPasscodeLockRepositoryTableViewCellDetailText()
|
||||||
}
|
}
|
||||||
if Defaults[.isTouchIDOn] {
|
|
||||||
touchIDSwitch.isOn = true
|
private func setPasscodeLockRepositoryTableViewCellDetailText() {
|
||||||
} else {
|
|
||||||
touchIDSwitch.isOn = false
|
|
||||||
}
|
|
||||||
if PasscodeLockRepository().hasPasscode {
|
if PasscodeLockRepository().hasPasscode {
|
||||||
self.passcodeTableViewCell.detailTextLabel?.text = "On"
|
self.passcodeTableViewCell.detailTextLabel?.text = "On"
|
||||||
} else {
|
} else {
|
||||||
self.passcodeTableViewCell.detailTextLabel?.text = "Off"
|
self.passcodeTableViewCell.detailTextLabel?.text = "Off"
|
||||||
touchIDSwitch.isEnabled = false
|
touchIDSwitch.isEnabled = false
|
||||||
|
Globals.passcodeConfiguration.isTouchIDAllowed = false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private func setPGPKeyTableViewCellDetailText() {
|
||||||
|
if Defaults[.pgpKeyID] == nil {
|
||||||
|
pgpKeyTableViewCell.detailTextLabel?.text = "Not Set"
|
||||||
|
} else {
|
||||||
|
pgpKeyTableViewCell.detailTextLabel?.text = Defaults[.pgpKeyID]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private func setPasswordRepositoryTableViewCellDetailText() {
|
||||||
|
if Defaults[.gitRepositoryURL] == nil {
|
||||||
|
passwordRepositoryTableViewCell.detailTextLabel?.text = "Not Set"
|
||||||
|
} else {
|
||||||
|
passwordRepositoryTableViewCell.detailTextLabel?.text = Defaults[.gitRepositoryURL]!.host
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private func setTouchIDSwitch() {
|
||||||
|
if Defaults[.isTouchIDOn] {
|
||||||
|
touchIDSwitch.isOn = true
|
||||||
|
} else {
|
||||||
|
touchIDSwitch.isOn = false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -214,10 +236,10 @@ class SettingsTableViewController: UITableViewController {
|
||||||
}
|
}
|
||||||
|
|
||||||
func actOnPasswordStoreErasedNotification() {
|
func actOnPasswordStoreErasedNotification() {
|
||||||
pgpKeyTableViewCell.detailTextLabel?.text = "Not Set"
|
setPGPKeyTableViewCellDetailText()
|
||||||
touchIDSwitch.isOn = false
|
setPasswordRepositoryTableViewCellDetailText()
|
||||||
self.passcodeTableViewCell.detailTextLabel?.text = "Off"
|
setTouchIDSwitch()
|
||||||
Globals.passcodeConfiguration.isTouchIDAllowed = false
|
setPasscodeLockRepositoryTableViewCellDetailText()
|
||||||
|
|
||||||
let appDelegate = UIApplication.shared.delegate as! AppDelegate
|
let appDelegate = UIApplication.shared.delegate as! AppDelegate
|
||||||
appDelegate.passcodeLockPresenter = PasscodeLockPresenter(mainWindow: appDelegate.window, configuration: Globals.passcodeConfiguration)
|
appDelegate.passcodeLockPresenter = PasscodeLockPresenter(mainWindow: appDelegate.window, configuration: Globals.passcodeConfiguration)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue