nativescript-fingerprint-auth
nativescript-fingerprint-auth copied to clipboard
IOS code access, no error code (always undefined)
On an IOS device when canceling the access code, you do not receive an error code. With Android you get an error code 60 with IOS, the error is always undefined. I cannot make a distinguish whether or not the access code is enabled on the device.
It's possible on iOS
the user can end up locking access to the security within the app.
I use the following code to check
if (isIOS) {
// check if Biometry is locked out.
const laContext = LAContext.new();
laContext.evaluatePolicyLocalizedReasonReply(
LAPolicy.DeviceOwnerAuthentication,
'test',
(ok: boolean, error: NSError) => {
if (!ok) {
console.log(error.code, error.localizedDescription);
if (error.code === LAError.BiometryLockout) {
console.log(
`Biometry is locked out. User must enter passcode to enable Biometry.`,
);
} else if (error.code === LAError.UserCancel) {
console.log(`The user tapped the cancel button in the authentication dialog.`);
reject();
}
resolve();
} else {
resolve(ok);
}
},
);
}
I end up checking that if the available
call does NOT return result.any
in the promise.