Refactored DI, serialization, added feedback to document download

This commit is contained in:
Anton Stubenbord
2022-12-06 00:39:18 +01:00
parent d79682a011
commit 75fa2f7713
51 changed files with 711 additions and 366 deletions

View 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;
}
}