mirror of
https://github.com/Xevion/paperless-mobile.git
synced 2025-12-08 18:08:07 -06:00
Refactored DI, serialization, added feedback to document download
This commit is contained in:
28
lib/features/login/services/authentication_service.dart
Normal file
28
lib/features/login/services/authentication_service.dart
Normal file
@@ -0,0 +1,28 @@
|
||||
import 'package:injectable/injectable.dart';
|
||||
import 'package:local_auth/local_auth.dart';
|
||||
import 'package:paperless_mobile/core/store/local_vault.dart';
|
||||
|
||||
@lazySingleton
|
||||
class LocalAuthenticationService {
|
||||
final LocalVault localStore;
|
||||
final LocalAuthentication localAuthentication;
|
||||
|
||||
LocalAuthenticationService(
|
||||
this.localStore,
|
||||
this.localAuthentication,
|
||||
);
|
||||
|
||||
Future<bool> authenticateLocalUser(String localizedReason) async {
|
||||
if (await localAuthentication.isDeviceSupported()) {
|
||||
return await localAuthentication.authenticate(
|
||||
localizedReason: localizedReason,
|
||||
options: const AuthenticationOptions(
|
||||
stickyAuth: true,
|
||||
biometricOnly: true,
|
||||
useErrorDialogs: true,
|
||||
),
|
||||
);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user