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 PODFILE CHECKSUM: ae71bdf0eb731a1ffc399c122f6aa4dea0cb5f6f
COCOAPODS: 1.11.2 COCOAPODS: 1.11.3

View file

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

View file

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