diff --git a/CHANGELOG.md b/CHANGELOG.md index b19cf30..4460c9b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,10 @@ # Changelog +### 0.3.10 + +- **Remove**: `isTouchIdSupported` and `isFaceIdSupported`. +- **Add** BiometryType for BiometricsService: `touchID`, `faceID`, `none`. + ### 0.3.9 - **Add**: `allowableReuseDuration` variable to `BiometricsService` which is a wrapper for touchIDAuthenticationAllowableReuseDuration. diff --git a/LeadKitAdditions.podspec b/LeadKitAdditions.podspec index e88b912..f1b086a 100644 --- a/LeadKitAdditions.podspec +++ b/LeadKitAdditions.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = "LeadKitAdditions" - s.version = "0.3.9" + s.version = "0.3.10" s.summary = "iOS framework with a bunch of tools for rapid development" s.homepage = "https://github.com/TouchInstinct/LeadKitAdditions" s.license = "Apache License, Version 2.0" diff --git a/Sources/Services/BiometricsService.swift b/Sources/Services/BiometricsService.swift index 83fa2c6..a7a76c3 100644 --- a/Sources/Services/BiometricsService.swift +++ b/Sources/Services/BiometricsService.swift @@ -26,6 +26,15 @@ public typealias BiometricsAuthHandler = (Bool, Error?) -> Void /// Service that provide access to authentication via biometric public final class BiometricsService { + + public enum BiometryType { + + case faceID + + case touchID + + case none + } private lazy var laContext = LAContext() @@ -43,21 +52,22 @@ public final class BiometricsService { } } - /// Returns true if user can authenticate via Face ID - public var isFaceIdSupported: Bool { - if #available(iOS 11.0, *) { - return canAuthenticateWithBiometrics && laContext.biometryType == .faceID - } - return false - } - - /// Returns true if user can authenticate via Touch ID - public var isTouchIdSupported: Bool { + /// Returns BiometryType supporting by device: TouchID, FaceID or none + public var biometryType: BiometryType { let canEvaluate = canAuthenticateWithBiometrics + if #available(iOS 11.0, *) { - return canEvaluate && laContext.biometryType == .touchID + switch laContext.biometryType { + case .touchID: + return .touchID + case .faceID: + return .faceID + case .none: + return .none + } } - return canEvaluate + + return canEvaluate ? .touchID : .none } /// Returns current domain state