mirror of
https://github.com/cake-tech/cake_wallet.git
synced 2025-01-23 19:16:09 +00:00
Fix navigation error when state is changed to denied at app first start [skip_ci]
This commit is contained in:
parent
ffd0079e1d
commit
11a5e97711
3 changed files with 6 additions and 6 deletions
|
@ -261,7 +261,7 @@ class AppState extends State<App> with SingleTickerProviderStateMixin {
|
||||||
final statusBarColor = Colors.transparent;
|
final statusBarColor = Colors.transparent;
|
||||||
final authenticationStore = getIt.get<AuthenticationStore>();
|
final authenticationStore = getIt.get<AuthenticationStore>();
|
||||||
final initialRoute =
|
final initialRoute =
|
||||||
authenticationStore.state == AuthenticationState.denied
|
authenticationStore.state == AuthenticationState.uninitialized
|
||||||
? Routes.disclaimer
|
? Routes.disclaimer
|
||||||
: Routes.login;
|
: Routes.login;
|
||||||
final currentTheme = settingsStore.currentTheme;
|
final currentTheme = settingsStore.currentTheme;
|
||||||
|
|
|
@ -22,9 +22,9 @@ Future<void> bootstrap(GlobalKey<NavigatorState> navigatorKey) async {
|
||||||
final currentWalletName = getIt
|
final currentWalletName = getIt
|
||||||
.get<SharedPreferences>()
|
.get<SharedPreferences>()
|
||||||
.getString(PreferencesKey.currentWalletName);
|
.getString(PreferencesKey.currentWalletName);
|
||||||
authenticationStore.state = currentWalletName == null
|
if (currentWalletName != null) {
|
||||||
? AuthenticationState.denied
|
authenticationStore.state = AuthenticationState.installed;
|
||||||
: AuthenticationState.installed;
|
}
|
||||||
|
|
||||||
startAuthenticationStateChange(authenticationStore, navigatorKey);
|
startAuthenticationStateChange(authenticationStore, navigatorKey);
|
||||||
startCurrentWalletChangeReaction(
|
startCurrentWalletChangeReaction(
|
||||||
|
|
|
@ -23,12 +23,12 @@ void startAuthenticationStateChange(AuthenticationStore authenticationStore,
|
||||||
}
|
}
|
||||||
|
|
||||||
if (state == AuthenticationState.allowed) {
|
if (state == AuthenticationState.allowed) {
|
||||||
await navigatorKey.currentState?.pushNamedAndRemoveUntil(Routes.dashboard, (route) => false);
|
await navigatorKey.currentState!.pushNamedAndRemoveUntil(Routes.dashboard, (route) => false);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (state == AuthenticationState.denied) {
|
if (state == AuthenticationState.denied) {
|
||||||
await navigatorKey.currentState?.pushNamedAndRemoveUntil(Routes.welcome, (_) => false);
|
await navigatorKey.currentState!.pushNamedAndRemoveUntil(Routes.welcome, (_) => false);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in a new issue