mirror of
https://github.com/cake-tech/cake_wallet.git
synced 2025-06-28 12:29:51 +00:00
Part 1
This commit is contained in:
parent
5e1132a299
commit
e4ebfc94b2
273 changed files with 2472 additions and 7285 deletions
31
lib/reactions/on_authentication_state_change.dart
Normal file
31
lib/reactions/on_authentication_state_change.dart
Normal file
|
@ -0,0 +1,31 @@
|
|||
import 'package:cake_wallet/routes.dart';
|
||||
import 'package:flutter/widgets.dart';
|
||||
import 'package:mobx/mobx.dart';
|
||||
import 'package:cake_wallet/router.dart';
|
||||
import 'package:cake_wallet/entities/load_current_wallet.dart';
|
||||
import 'package:cake_wallet/store/authentication_store.dart';
|
||||
|
||||
ReactionDisposer _onAuthenticationStateChange;
|
||||
|
||||
void startAuthenticationStateChange(AuthenticationStore authenticationStore,
|
||||
GlobalKey<NavigatorState> navigatorKey) {
|
||||
_onAuthenticationStateChange ??= autorun((_) async {
|
||||
final state = authenticationStore.state;
|
||||
|
||||
if (state == AuthenticationState.installed) {
|
||||
await loadCurrentWallet();
|
||||
// await navigatorKey.currentState
|
||||
// .pushNamedAndRemoveUntil(Routes.login, (_) => false);
|
||||
}
|
||||
|
||||
if (state == AuthenticationState.allowed) {
|
||||
await navigatorKey.currentState
|
||||
.pushNamedAndRemoveUntil(Routes.dashboard, (route) => false);
|
||||
}
|
||||
|
||||
if (state == AuthenticationState.denied) {
|
||||
await navigatorKey.currentState
|
||||
.pushNamedAndRemoveUntil(Routes.welcome, (_) => false);
|
||||
}
|
||||
});
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue