From 1570ce331d1eb29a4231e2ba0a8c6edc2d5f31df Mon Sep 17 00:00:00 2001 From: Madhas Date: Wed, 18 Jul 2018 18:32:35 +0300 Subject: [PATCH 1/4] add methods to BasePassCodeViewController to make fakeTextField become and resign first responder --- CHANGELOG.md | 4 ++++ LeadKitAdditions.podspec | 2 +- .../PassCode/View/BasePassCodeViewController.swift | 12 ++++++++++++ 3 files changed, 17 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d1c7870..7e28105 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ # Changelog +### 0.3.2 + +- **Add**: functions to `BasePassCodeViewController` to make `fakeTextField` become and resign first responder + ### 0.3.1 - **Add**: `PinLayoutTableViewCell` and `SeparatorTableViewCell` to `Core-iOS-Extension`. diff --git a/LeadKitAdditions.podspec b/LeadKitAdditions.podspec index 8632cfe..464da23 100644 --- a/LeadKitAdditions.podspec +++ b/LeadKitAdditions.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = "LeadKitAdditions" - s.version = "0.3.1" + s.version = "0.3.2" 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/Controllers/PassCode/View/BasePassCodeViewController.swift b/Sources/Controllers/PassCode/View/BasePassCodeViewController.swift index a24be3a..a711480 100644 --- a/Sources/Controllers/PassCode/View/BasePassCodeViewController.swift +++ b/Sources/Controllers/PassCode/View/BasePassCodeViewController.swift @@ -239,6 +239,18 @@ open class BasePassCodeViewController: UIViewController, ConfigurableController titleLabel?.attributedText = actionTitle(for: passCodeControllerState) } + // MARK: - Public functions + + /// Make fakeTextField become first responder + public func enableInput() { + fakeTextField.becomeFirstResponder() + } + + /// Make fakeTextField resign first responder + public func disableInput() { + fakeTextField.resignFirstResponder() + } + // MARK: - ConfigurableController open func bindViews() { From c11573e493cbbaf7239669cf81a3a6dec5ee093d Mon Sep 17 00:00:00 2001 From: Aliona Date: Tue, 24 Jul 2018 18:20:08 +0300 Subject: [PATCH 2/4] Add public init to biometricsService --- CHANGELOG.md | 5 +++++ LeadKitAdditions.podspec | 2 +- Sources/Services/BiometricsService.swift | 2 ++ 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7e28105..125494b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,10 @@ # Changelog + +### 0.3.3 + +- **Add**: Public `init` to `BiometricsService` + ### 0.3.2 - **Add**: functions to `BasePassCodeViewController` to make `fakeTextField` become and resign first responder diff --git a/LeadKitAdditions.podspec b/LeadKitAdditions.podspec index 464da23..60dba35 100644 --- a/LeadKitAdditions.podspec +++ b/LeadKitAdditions.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = "LeadKitAdditions" - s.version = "0.3.2" + s.version = "0.3.3" 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 504045f..31e1030 100644 --- a/Sources/Services/BiometricsService.swift +++ b/Sources/Services/BiometricsService.swift @@ -64,4 +64,6 @@ public final class BiometricsService { } } + public init() {} + } From c27a031dccafa117f67f879e1691247414b4e615 Mon Sep 17 00:00:00 2001 From: Aliona Date: Wed, 25 Jul 2018 15:46:41 +0300 Subject: [PATCH 3/4] Move isFaceIdSupported to Leadkit --- CHANGELOG.md | 4 ++++ LeadKitAdditions.podspec | 2 +- Sources/Services/BiometricsService.swift | 10 ++++++++++ 3 files changed, 15 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 125494b..a207bfe 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,10 @@ # Changelog +### 0.3.4 + +- **Add**: `isFaceIdSupported` variable to `BiometricsService` to distinguish FaceID from TouchID. + ### 0.3.3 - **Add**: Public `init` to `BiometricsService` diff --git a/LeadKitAdditions.podspec b/LeadKitAdditions.podspec index 60dba35..611630a 100644 --- a/LeadKitAdditions.podspec +++ b/LeadKitAdditions.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = "LeadKitAdditions" - s.version = "0.3.3" + s.version = "0.3.4" 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 31e1030..90a91d5 100644 --- a/Sources/Services/BiometricsService.swift +++ b/Sources/Services/BiometricsService.swift @@ -29,6 +29,16 @@ public final class BiometricsService { private lazy var laContext = LAContext() + /// Returns true if user can authenticate via faceID + public var isFaceIdSupported: Bool { + if #available(iOS 11.0, *) { + return laContext.canEvaluatePolicy(.deviceOwnerAuthenticationWithBiometrics, error: nil) + && laContext.biometryType == .faceID + } else { + return false + } + } + /// Returns current domain state public var evaluatedPolicyDomainState: Data? { // We need to call canEvaluatePolicy function for evaluatedPolicyDomainState to be updated From af4ca742c04acd9a56b25700577cf9b4f5965a76 Mon Sep 17 00:00:00 2001 From: Aliona Date: Wed, 25 Jul 2018 16:04:52 +0300 Subject: [PATCH 4/4] Update BiometricsService.swift --- Sources/Services/BiometricsService.swift | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Sources/Services/BiometricsService.swift b/Sources/Services/BiometricsService.swift index 90a91d5..37ee7f0 100644 --- a/Sources/Services/BiometricsService.swift +++ b/Sources/Services/BiometricsService.swift @@ -32,8 +32,7 @@ public final class BiometricsService { /// Returns true if user can authenticate via faceID public var isFaceIdSupported: Bool { if #available(iOS 11.0, *) { - return laContext.canEvaluatePolicy(.deviceOwnerAuthenticationWithBiometrics, error: nil) - && laContext.biometryType == .faceID + return canAuthenticateWithBiometrics && laContext.biometryType == .faceID } else { return false }