Cw 218 fix change pin using bio auth (#599)

* - push change pin page as a replacement for auth page to avoid closing it once its opened
- Add cool-down duration after popping flushbars and pushing new routes
This commit is contained in:
Omar Hatem 2022-11-07 22:35:34 +02:00 committed by GitHub
parent 2696c242a9
commit 71444219be
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 19 additions and 19 deletions

View file

@ -252,4 +252,4 @@ SPEC CHECKSUMS:
PODFILE CHECKSUM: ae71bdf0eb731a1ffc399c122f6aa4dea0cb5f6f
COCOAPODS: 1.11.2
COCOAPODS: 1.11.3

View file

@ -106,22 +106,22 @@ class AuthPageState extends State<AuthPage> {
_progressBar = null;
}
Future<void> close({String? route}) async {
Future<void> close({String? route, dynamic arguments}) async {
if (_key.currentContext == null) {
throw Exception('Key context is null. Should be not happened');
}
WidgetsBinding.instance.addPostFrameCallback((_) {
dismissFlushBar(_authBar);
dismissFlushBar(_progressBar);
WidgetsBinding.instance.addPostFrameCallback((_) {
if (route != null) {
Navigator.of(_key.currentContext!).pushReplacementNamed(route);
} else {
Navigator.of(_key.currentContext!).pop();
}
});
});
/// not the best scenario, but WidgetsBinding is not behaving correctly on Android
await Future<void>.delayed(Duration(milliseconds: 50));
await _authBar?.dismiss();
await Future<void>.delayed(Duration(milliseconds: 50));
await _progressBar?.dismiss();
await Future<void>.delayed(Duration(milliseconds: 50));
if (route != null) {
Navigator.of(_key.currentContext!).pushReplacementNamed(route, arguments: arguments);
} else {
Navigator.of(_key.currentContext!).pop();
}
}
@override

View file

@ -156,13 +156,13 @@ abstract class SettingsViewModelBase with Store {
handler: (BuildContext context) {
Navigator.of(context).pushNamed(Routes.auth, arguments:
(bool isAuthenticatedSuccessfully, AuthPageState auth) {
auth.close();
if (isAuthenticatedSuccessfully) {
Navigator.of(context).pushNamed(Routes.setupPin, arguments:
(PinCodeState<PinCodeWidget> setupPinContext, String _) {
auth.close(
route: isAuthenticatedSuccessfully ? Routes.setupPin : null,
arguments: (PinCodeState<PinCodeWidget> setupPinContext,
String _) {
setupPinContext.close();
});
}
},
);
});
}),
PickerListItem(