|
|
@ -98,7 +98,12 @@ class BiometricPlugin: Plugin {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@objc func authenticate(_ invoke: Invoke) throws {
|
|
|
|
@objc func authenticate(_ invoke: Invoke) throws {
|
|
|
|
guard self.status.available else {
|
|
|
|
let args = try invoke.parseArgs(AuthOptions.self)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
let allowDeviceCredential = args.allowDeviceCredential ?? false
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
guard self.status.available || allowDeviceCredential else {
|
|
|
|
|
|
|
|
// Biometry unavailable, fallback disabled
|
|
|
|
invoke.reject(
|
|
|
|
invoke.reject(
|
|
|
|
self.status.errorReason ?? "",
|
|
|
|
self.status.errorReason ?? "",
|
|
|
|
code: self.status.errorCode ?? ""
|
|
|
|
code: self.status.errorCode ?? ""
|
|
|
@ -106,15 +111,11 @@ class BiometricPlugin: Plugin {
|
|
|
|
return
|
|
|
|
return
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
let args = try invoke.parseArgs(AuthOptions.self)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
let context = LAContext()
|
|
|
|
let context = LAContext()
|
|
|
|
context.localizedFallbackTitle = args.fallbackTitle
|
|
|
|
context.localizedFallbackTitle = args.fallbackTitle
|
|
|
|
context.localizedCancelTitle = args.cancelTitle
|
|
|
|
context.localizedCancelTitle = args.cancelTitle
|
|
|
|
context.touchIDAuthenticationAllowableReuseDuration = 0
|
|
|
|
context.touchIDAuthenticationAllowableReuseDuration = 0
|
|
|
|
|
|
|
|
|
|
|
|
let allowDeviceCredential = args.allowDeviceCredential ?? false
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// force system default fallback title if an empty string is provided (the OS hides the fallback button in this case)
|
|
|
|
// force system default fallback title if an empty string is provided (the OS hides the fallback button in this case)
|
|
|
|
if allowDeviceCredential,
|
|
|
|
if allowDeviceCredential,
|
|
|
|
let fallbackTitle = context.localizedFallbackTitle,
|
|
|
|
let fallbackTitle = context.localizedFallbackTitle,
|
|
|
|