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

Omar Hatem committed Nov 7, 2022 at 22:35 UTC 71444219bea2c32d0095b831ac23cbbb1a33e559
3 files changed +19 -19
ios/Podfile.lock
+1 -1
@@ -252,4 +252,4 @@ SPEC CHECKSUMS:
252
253 PODFILE CHECKSUM: ae71bdf0eb731a1ffc399c122f6aa4dea0cb5f6f
254
255 -COCOAPODS: 1.11.2
255 +COCOAPODS: 1.11.3
lib/src/screens/auth/auth_page.dart
+12 -12
@@ -106,22 +106,22 @@ class AuthPageState extends State<AuthPage> {
106 _progressBar = null;
107 }
108
109 - Future<void> close({String? route}) async {
109 + Future<void> close({String? route, dynamic arguments}) async {
110 if (_key.currentContext == null) {
111 throw Exception('Key context is null. Should be not happened');
112 }
113
114 - WidgetsBinding.instance.addPostFrameCallback((_) {
115 - dismissFlushBar(_authBar);
116 - dismissFlushBar(_progressBar);
117 - WidgetsBinding.instance.addPostFrameCallback((_) {
118 - if (route != null) {
119 - Navigator.of(_key.currentContext!).pushReplacementNamed(route);
120 - } else {
121 - Navigator.of(_key.currentContext!).pop();
122 - }
123 - });
124 - });
114 + /// not the best scenario, but WidgetsBinding is not behaving correctly on Android
115 + await Future<void>.delayed(Duration(milliseconds: 50));
116 + await _authBar?.dismiss();
117 + await Future<void>.delayed(Duration(milliseconds: 50));
118 + await _progressBar?.dismiss();
119 + await Future<void>.delayed(Duration(milliseconds: 50));
120 + if (route != null) {
121 + Navigator.of(_key.currentContext!).pushReplacementNamed(route, arguments: arguments);
122 + } else {
123 + Navigator.of(_key.currentContext!).pop();
124 + }
125 }
126
127 @override
lib/view_model/settings/settings_view_model.dart
+6 -6
@@ -156,13 +156,13 @@ abstract class SettingsViewModelBase with Store {
156 handler: (BuildContext context) {
157 Navigator.of(context).pushNamed(Routes.auth, arguments:
158 (bool isAuthenticatedSuccessfully, AuthPageState auth) {
159 - auth.close();
160 - if (isAuthenticatedSuccessfully) {
161 - Navigator.of(context).pushNamed(Routes.setupPin, arguments:
162 - (PinCodeState<PinCodeWidget> setupPinContext, String _) {
159 + auth.close(
160 + route: isAuthenticatedSuccessfully ? Routes.setupPin : null,
161 + arguments: (PinCodeState<PinCodeWidget> setupPinContext,
162 + String _) {
163 setupPinContext.close();
164 - });
165 - }
164 + },
165 + );
166 });
167 }),
168 PickerListItem(