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

onNeedUnlock is called over and over again #51

Open
blueberry6401 opened this issue Jul 11, 2024 · 0 comments
Open

onNeedUnlock is called over and over again #51

blueberry6401 opened this issue Jul 11, 2024 · 0 comments

Comments

@blueberry6401
Copy link

There's an issue making onNeedUnlock is called over and over again.

Reproduce:

  1. Run the example
  2. Install local_auth
  3. Modify onNeedUnlock as below
onNeedUnlock: (secure) async {
          print(
              'need unlock maybe use biometric to confirm and then sercure.unlock() or you can use the lockedBuilder');
          try {
            final LocalAuthentication auth = LocalAuthentication();

            var authResult = await auth.authenticate(
              localizedReason: 'ZZZ',
              options: AuthenticationOptions(
                biometricOnly: false,
              ),
            );
            if (authResult) {
              secure?.unlock();
              return SecureApplicationAuthenticationStatus.SUCCESS;
            }
            else {
              return SecureApplicationAuthenticationStatus.FAILED;
            }
          } catch (e) {
            return SecureApplicationAuthenticationStatus.FAILED;
          }
          return null;
        },
  1. If the app asks for FaceID => face not matched => Cancel => onNeedUnlock is called over and over.

This is because of appstate changed to resumed when face id is dismissed.
I don't know this is a bug or not, but I
think onNeedUnlock should not work like that. Currently I put a small delay after .authenticate() to workaround this.

Screen recording:
https://github.com/neckaros/secure_application/assets/7337535/439df9c6-1a0d-4a95-ba0a-3e12d0ed18ea

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

1 participant