Add canUseBiometrics parameter

This commit is contained in:
ismailgulek
2020-09-25 17:59:29 +03:00
parent 1cee003e82
commit d6c3b6f95d

View File

@@ -31,6 +31,7 @@ final class PinCodePreferences: NSObject {
private struct StoreKeys {
static let pin: String = "pin"
static let biometricsEnabled: String = "biometricsEnabled"
static let canUseBiometricsToUnlock: String = "canUseBiometricsToUnlock"
}
static let shared = PinCodePreferences()
@@ -111,6 +112,23 @@ final class PinCodePreferences: NSObject {
}
}
var canUseBiometricsToUnlock: Bool? {
get {
do {
return try store.bool(forKey: StoreKeys.canUseBiometricsToUnlock) ?? true
} catch let error {
NSLog("[PinCodePreferences] Error when reading canUseBiometricsToUnlock from store: \(error)")
return nil
}
} set {
do {
try store.set(newValue, forKey: StoreKeys.canUseBiometricsToUnlock)
} catch let error {
NSLog("[PinCodePreferences] Error when storing canUseBiometricsToUnlock to the store: \(error)")
}
}
}
var isBiometricsSet: Bool {
return biometricsEnabled == true
}