mirror of
https://github.com/Yubico/yubioath-flutter.git
synced 2024-11-23 00:57:26 +03:00
YADESK-623 update state on password operations
This commit is contained in:
parent
2222f2536a
commit
4a0014292d
@ -55,7 +55,10 @@ class _AndroidOathStateNotifier extends OathStateNotifier {
|
|||||||
|
|
||||||
if (unlocked) {
|
if (unlocked) {
|
||||||
_log.config('applet unlocked');
|
_log.config('applet unlocked');
|
||||||
setData(state.value!.copyWith(locked: false));
|
setData(state.value!.copyWith(
|
||||||
|
locked: false,
|
||||||
|
remembered: remembered,
|
||||||
|
));
|
||||||
}
|
}
|
||||||
return Pair(unlocked, remembered);
|
return Pair(unlocked, remembered);
|
||||||
} on PlatformException catch (e) {
|
} on PlatformException catch (e) {
|
||||||
@ -68,6 +71,7 @@ class _AndroidOathStateNotifier extends OathStateNotifier {
|
|||||||
Future<bool> setPassword(String? current, String password) async {
|
Future<bool> setPassword(String? current, String password) async {
|
||||||
try {
|
try {
|
||||||
await _api.setPassword(current, password);
|
await _api.setPassword(current, password);
|
||||||
|
setData(state.value!.copyWith(hasKey: true));
|
||||||
return true;
|
return true;
|
||||||
} on PlatformException catch (e) {
|
} on PlatformException catch (e) {
|
||||||
_log.config('Calling set password failed with exception: $e');
|
_log.config('Calling set password failed with exception: $e');
|
||||||
@ -79,6 +83,7 @@ class _AndroidOathStateNotifier extends OathStateNotifier {
|
|||||||
Future<bool> unsetPassword(String current) async {
|
Future<bool> unsetPassword(String current) async {
|
||||||
try {
|
try {
|
||||||
await _api.unsetPassword(current);
|
await _api.unsetPassword(current);
|
||||||
|
setData(state.value!.copyWith(hasKey: false, locked: false));
|
||||||
return true;
|
return true;
|
||||||
} on PlatformException catch (e) {
|
} on PlatformException catch (e) {
|
||||||
_log.config('Calling unset password failed with exception: $e');
|
_log.config('Calling unset password failed with exception: $e');
|
||||||
@ -90,6 +95,7 @@ class _AndroidOathStateNotifier extends OathStateNotifier {
|
|||||||
Future<void> forgetPassword() async {
|
Future<void> forgetPassword() async {
|
||||||
try {
|
try {
|
||||||
await _api.forgetPassword();
|
await _api.forgetPassword();
|
||||||
|
setData(state.value!.copyWith(remembered: false));
|
||||||
} on PlatformException catch (e) {
|
} on PlatformException catch (e) {
|
||||||
_log.config('Calling forgetPassword failed with exception: $e');
|
_log.config('Calling forgetPassword failed with exception: $e');
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user