Fix LAContext.biometryType none case

This commit is contained in:
ismailgulek
2020-08-19 15:37:05 +03:00
parent f6bbad6821
commit efb01ea43b

View File

@@ -111,6 +111,8 @@ final class PinCodePreferences: NSObject {
func localizedBiometricsName() -> String? {
if isBiometricsAvailable {
let context = LAContext()
// canEvaluatePolicy should be called for biometryType to be set
_ = context.canEvaluatePolicy(.deviceOwnerAuthenticationWithBiometrics, error: nil)
switch context.biometryType {
case .touchID:
return VectorL10n.biometricsModeTouchId
@@ -126,6 +128,8 @@ final class PinCodePreferences: NSObject {
func biometricsIcon() -> UIImage? {
if isBiometricsAvailable {
let context = LAContext()
// canEvaluatePolicy should be called for biometryType to be set
_ = context.canEvaluatePolicy(.deviceOwnerAuthenticationWithBiometrics, error: nil)
switch context.biometryType {
case .touchID:
return Asset.Images.touchidIcon.image