This commit is contained in:
M 2020-10-09 21:34:21 +03:00
parent 04e7c18841
commit f9cc21478a
16 changed files with 796 additions and 303 deletions

View file

@ -8,22 +8,25 @@ import 'package:cake_wallet/store/authentication_store.dart';
ReactionDisposer _onAuthenticationStateChange;
void startAuthenticationStateChange(AuthenticationStore authenticationStore,
GlobalKey<NavigatorState> navigatorKey) {
@required GlobalKey<NavigatorState> navigatorKey) {
_onAuthenticationStateChange ??= autorun((_) async {
final state = authenticationStore.state;
if (state == AuthenticationState.installed) {
await loadCurrentWallet();
return;
}
if (state == AuthenticationState.allowed) {
await navigatorKey.currentState
.pushNamedAndRemoveUntil(Routes.dashboard, (route) => false);
return;
}
if (state == AuthenticationState.denied) {
await navigatorKey.currentState
.pushNamedAndRemoveUntil(Routes.welcome, (_) => false);
return;
}
});
}