mirror of
https://github.com/Such-Software/hash-wallet.git
synced 2026-10-19 05:58:50 +02:00
Fix navigation error when state is changed to denied at app first start [skip_ci]
This commit is contained in:
+1
-1
@@ -261,7 +261,7 @@ class AppState extends State<App> with SingleTickerProviderStateMixin {
|
||||
final statusBarColor = Colors.transparent;
|
||||
final authenticationStore = getIt.get<AuthenticationStore>();
|
||||
final initialRoute =
|
||||
authenticationStore.state == AuthenticationState.denied
|
||||
authenticationStore.state == AuthenticationState.uninitialized
|
||||
? Routes.disclaimer
|
||||
: Routes.login;
|
||||
final currentTheme = settingsStore.currentTheme;
|
||||
|
||||
@@ -22,9 +22,9 @@ Future<void> bootstrap(GlobalKey<NavigatorState> navigatorKey) async {
|
||||
final currentWalletName = getIt
|
||||
.get<SharedPreferences>()
|
||||
.getString(PreferencesKey.currentWalletName);
|
||||
authenticationStore.state = currentWalletName == null
|
||||
? AuthenticationState.denied
|
||||
: AuthenticationState.installed;
|
||||
if (currentWalletName != null) {
|
||||
authenticationStore.state = AuthenticationState.installed;
|
||||
}
|
||||
|
||||
startAuthenticationStateChange(authenticationStore, navigatorKey);
|
||||
startCurrentWalletChangeReaction(
|
||||
|
||||
@@ -23,12 +23,12 @@ void startAuthenticationStateChange(AuthenticationStore authenticationStore,
|
||||
}
|
||||
|
||||
if (state == AuthenticationState.allowed) {
|
||||
await navigatorKey.currentState?.pushNamedAndRemoveUntil(Routes.dashboard, (route) => false);
|
||||
await navigatorKey.currentState!.pushNamedAndRemoveUntil(Routes.dashboard, (route) => false);
|
||||
return;
|
||||
}
|
||||
|
||||
if (state == AuthenticationState.denied) {
|
||||
await navigatorKey.currentState?.pushNamedAndRemoveUntil(Routes.welcome, (_) => false);
|
||||
await navigatorKey.currentState!.pushNamedAndRemoveUntil(Routes.welcome, (_) => false);
|
||||
return;
|
||||
}
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user