Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IOS code access, no error code (always undefined) #48

Open
Robernator opened this issue Mar 27, 2019 · 1 comment
Open

IOS code access, no error code (always undefined) #48

Robernator opened this issue Mar 27, 2019 · 1 comment

Comments

@Robernator
Copy link

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.

@bradmartin
Copy link
Contributor

bradmartin commented Jun 25, 2019

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants