Skip to content

Commit 82830de

Browse files
committed
Fix early biometric status check not accounting for allowDeviceCredential fallback logic
1 parent 60075f0 commit 82830de

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

plugins/biometric/ios/Sources/BiometricPlugin.swift

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -98,23 +98,24 @@ class BiometricPlugin: Plugin {
9898
}
9999

100100
@objc func authenticate(_ invoke: Invoke) throws {
101-
guard self.status.available else {
101+
let args = try invoke.parseArgs(AuthOptions.self)
102+
103+
let allowDeviceCredential = args.allowDeviceCredential ?? false
104+
105+
guard self.status.available || allowDeviceCredential else {
106+
// Biometry unavailable, fallback disabled
102107
invoke.reject(
103108
self.status.errorReason ?? "",
104109
code: self.status.errorCode ?? ""
105110
)
106111
return
107112
}
108113

109-
let args = try invoke.parseArgs(AuthOptions.self)
110-
111114
let context = LAContext()
112115
context.localizedFallbackTitle = args.fallbackTitle
113116
context.localizedCancelTitle = args.cancelTitle
114117
context.touchIDAuthenticationAllowableReuseDuration = 0
115118

116-
let allowDeviceCredential = args.allowDeviceCredential ?? false
117-
118119
// force system default fallback title if an empty string is provided (the OS hides the fallback button in this case)
119120
if allowDeviceCredential,
120121
let fallbackTitle = context.localizedFallbackTitle,

0 commit comments

Comments
 (0)