mirror of
https://github.com/cake-tech/cake_wallet.git
synced 2024-10-30 08:57:38 +00:00
25 lines
905 B
Dart
25 lines
905 B
Dart
import 'package:cake_wallet/entities/biometric_auth.dart';
|
|
import 'package:cake_wallet/store/settings_store.dart';
|
|
import 'package:mobx/mobx.dart';
|
|
|
|
part 'security_settings_view_model.g.dart';
|
|
|
|
class SecuritySettingsViewModel = SecuritySettingsViewModelBase with _$SecuritySettingsViewModel;
|
|
|
|
abstract class SecuritySettingsViewModelBase with Store {
|
|
SecuritySettingsViewModelBase(this._settingsStore) : _biometricAuth = BiometricAuth();
|
|
|
|
final BiometricAuth _biometricAuth;
|
|
final SettingsStore _settingsStore;
|
|
|
|
@computed
|
|
bool get allowBiometricalAuthentication => _settingsStore.allowBiometricalAuthentication;
|
|
|
|
@action
|
|
Future<bool> biometricAuthenticated() async {
|
|
return await _biometricAuth.canCheckBiometrics() && await _biometricAuth.isAuthenticated();
|
|
}
|
|
|
|
@action
|
|
void setAllowBiometricalAuthentication(bool value) => _settingsStore.allowBiometricalAuthentication = value;
|
|
}
|