Skip to content

Commit d9503fc

Browse files
authored
Merge pull request #21 from phampton24/master
Made the value of reason in authenticateWithBiometrics injectable
2 parents 094401e + a94bc30 commit d9503fc

3 files changed

Lines changed: 8 additions & 1 deletion

File tree

PasscodeLock/PasscodeLock/PasscodeLock.swift

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,12 @@ public class PasscodeLock: PasscodeLockType {
6868
guard isTouchIDAllowed else { return }
6969

7070
let context = LAContext()
71-
let reason = localizedStringFor("PasscodeLockTouchIDReason", comment: "TouchID authentication reason")
71+
let reason: String
72+
if let configReason = configuration.touchIdReason {
73+
reason = configReason
74+
} else {
75+
reason = localizedStringFor("PasscodeLockTouchIDReason", comment: "TouchID authentication reason")
76+
}
7277

7378
context.localizedFallbackTitle = localizedStringFor("PasscodeLockTouchIDButton", comment: "TouchID authentication fallback button")
7479

PasscodeLock/Protocols/PasscodeLockConfigurationType.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,5 +14,6 @@ public protocol PasscodeLockConfigurationType {
1414
var passcodeLength: Int {get}
1515
var isTouchIDAllowed: Bool {get set}
1616
var shouldRequestTouchIDImmediately: Bool {get}
17+
var touchIdReason: String? {get set}
1718
var maximumInccorectPasscodeAttempts: Int {get}
1819
}

PasscodeLockTests/Fakes/FakePasscodeLockConfiguration.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ class FakePasscodeLockConfiguration: PasscodeLockConfigurationType {
1515
var isTouchIDAllowed = false
1616
let maximumInccorectPasscodeAttempts = 3
1717
let shouldRequestTouchIDImmediately = false
18+
var touchIdReason: String? = nil
1819

1920
init(repository: PasscodeRepositoryType) {
2021

0 commit comments

Comments
 (0)