Fix the Touch ID setting of passcode lock
- Disable Touch ID alone does not work before this commit.
This commit is contained in:
parent
611dd39131
commit
81af389a07
2 changed files with 7 additions and 5 deletions
|
|
@ -165,12 +165,12 @@ class SettingsTableViewController: UITableViewController {
|
||||||
private func setPasscodeLockTouchIDCells() {
|
private func setPasscodeLockTouchIDCells() {
|
||||||
if PasscodeLockConfiguration.shared.repository.hasPasscode {
|
if PasscodeLockConfiguration.shared.repository.hasPasscode {
|
||||||
self.passcodeTableViewCell.detailTextLabel?.text = "On"
|
self.passcodeTableViewCell.detailTextLabel?.text = "On"
|
||||||
passcodeLockConfig.isTouchIDAllowed = true
|
passcodeLockConfig.isTouchIDAllowed = SharedDefaults[.isTouchIDOn]
|
||||||
touchIDSwitch.isOn = SharedDefaults[.isTouchIDOn]
|
touchIDSwitch.isOn = SharedDefaults[.isTouchIDOn]
|
||||||
} else {
|
} else {
|
||||||
self.passcodeTableViewCell.detailTextLabel?.text = "Off"
|
self.passcodeTableViewCell.detailTextLabel?.text = "Off"
|
||||||
passcodeLockConfig.isTouchIDAllowed = false
|
|
||||||
SharedDefaults[.isTouchIDOn] = false
|
SharedDefaults[.isTouchIDOn] = false
|
||||||
|
passcodeLockConfig.isTouchIDAllowed = SharedDefaults[.isTouchIDOn]
|
||||||
touchIDSwitch.isOn = SharedDefaults[.isTouchIDOn]
|
touchIDSwitch.isOn = SharedDefaults[.isTouchIDOn]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -214,14 +214,15 @@ class SettingsTableViewController: UITableViewController {
|
||||||
}
|
}
|
||||||
|
|
||||||
func touchIDSwitchAction(uiSwitch: UISwitch) {
|
func touchIDSwitchAction(uiSwitch: UISwitch) {
|
||||||
if !passcodeLockConfig.isTouchIDAllowed || !isTouchIDEnabled() {
|
if !PasscodeLockConfiguration.shared.repository.hasPasscode || !isTouchIDEnabled() {
|
||||||
// switch off
|
// switch off
|
||||||
DispatchQueue.main.asyncAfter(deadline: .now() + .milliseconds(500)) {
|
DispatchQueue.main.asyncAfter(deadline: .now() + .milliseconds(500)) {
|
||||||
uiSwitch.isOn = SharedDefaults[.isTouchIDOn] // false
|
uiSwitch.isOn = SharedDefaults[.isTouchIDOn] // SharedDefaults[.isTouchIDOn] should be false
|
||||||
Utils.alert(title: "Notice", message: "Please enable Touch ID and set the passcode lock first.", controller: self, completion: nil)
|
Utils.alert(title: "Notice", message: "Please enable Touch ID of your phone and setup the passcode lock for Pass.", controller: self, completion: nil)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
SharedDefaults[.isTouchIDOn] = uiSwitch.isOn
|
SharedDefaults[.isTouchIDOn] = uiSwitch.isOn
|
||||||
|
passcodeLockConfig.isTouchIDAllowed = SharedDefaults[.isTouchIDOn]
|
||||||
}
|
}
|
||||||
let appDelegate = UIApplication.shared.delegate as! AppDelegate
|
let appDelegate = UIApplication.shared.delegate as! AppDelegate
|
||||||
appDelegate.passcodeLockPresenter = PasscodeLockPresenter(mainWindow: appDelegate.window, configuration: passcodeLockConfig)
|
appDelegate.passcodeLockPresenter = PasscodeLockPresenter(mainWindow: appDelegate.window, configuration: passcodeLockConfig)
|
||||||
|
|
|
||||||
|
|
@ -16,6 +16,7 @@ public struct PasscodeLockConfiguration: PasscodeLockConfigurationType {
|
||||||
public let repository: PasscodeRepositoryType
|
public let repository: PasscodeRepositoryType
|
||||||
public let passcodeLength = 4
|
public let passcodeLength = 4
|
||||||
public var isTouchIDAllowed = SharedDefaults[.isTouchIDOn]
|
public var isTouchIDAllowed = SharedDefaults[.isTouchIDOn]
|
||||||
|
|
||||||
public let shouldRequestTouchIDImmediately = true
|
public let shouldRequestTouchIDImmediately = true
|
||||||
public let maximumInccorectPasscodeAttempts = 3
|
public let maximumInccorectPasscodeAttempts = 3
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue