From 1e468176c16c32398f62b63b31e4002c168fcb62 Mon Sep 17 00:00:00 2001 From: Matthew Fosse Date: Thu, 25 Apr 2024 10:41:57 -0700 Subject: [PATCH] some code cleanup --- lib/view_model/auth_view_model.dart | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/lib/view_model/auth_view_model.dart b/lib/view_model/auth_view_model.dart index 0e6590845..bbaaf3c75 100644 --- a/lib/view_model/auth_view_model.dart +++ b/lib/view_model/auth_view_model.dart @@ -106,14 +106,12 @@ abstract class AuthViewModelBase with Store { @action Future biometricAuth() async { - final _flutterLocalAuthenticationPlugin = FlutterLocalAuthentication(); - try { - final authenticated = await _flutterLocalAuthenticationPlugin.authenticate(); - if (!authenticated) { + if (await _biometricAuth.canCheckBiometrics() && await _biometricAuth.isAuthenticated()) { + state = ExecutedSuccessfullyState(); + } else { throw Exception('Biometric authentication failed'); } - state = ExecutedSuccessfullyState(); } catch (e) { state = FailureState(e.toString()); }