some code cleanup

This commit is contained in:
Matthew Fosse 2024-04-25 10:41:57 -07:00
parent 3c05baec28
commit 1e468176c1

View file

@ -106,14 +106,12 @@ abstract class AuthViewModelBase with Store {
@action
Future<void> 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());
}