mirror of
https://github.com/cake-tech/cake_wallet.git
synced 2025-01-09 12:29:31 +00:00
feat: Haven removal
This commit is contained in:
parent
28985b0f52
commit
19120dfbc4
4 changed files with 15 additions and 12 deletions
|
@ -27,6 +27,7 @@ void startAuthenticationStateChange(AuthenticationStore authenticationStore,
|
|||
|
||||
if (state == AuthenticationState.allowed) {
|
||||
await _navigateBasedOnWalletType(navigatorKey, appStore);
|
||||
return;
|
||||
}
|
||||
},
|
||||
);
|
||||
|
@ -43,17 +44,20 @@ Future<void> _loadCurrentWallet() async {
|
|||
|
||||
Future<void> _navigateBasedOnWalletType(
|
||||
GlobalKey<NavigatorState> navigatorKey, AppStore appStore) async {
|
||||
final typeRaw = getIt.get<SharedPreferences>().getInt(PreferencesKey.currentWalletType) ?? 0;
|
||||
final type = deserializeFromInt(typeRaw);
|
||||
|
||||
if (type == WalletType.haven) {
|
||||
final wallet = appStore.wallet;
|
||||
|
||||
await navigatorKey.currentState!.pushNamed(Routes.havenRemovalNoticePage, arguments: wallet);
|
||||
final wallet = appStore.wallet!;
|
||||
|
||||
if (wallet.type == WalletType.haven) {
|
||||
await navigatorKey.currentState!.pushNamedAndRemoveUntil(
|
||||
Routes.havenRemovalNoticePage,
|
||||
(route) => false,
|
||||
arguments: wallet,
|
||||
);
|
||||
return;
|
||||
} else {
|
||||
await navigatorKey.currentState!.pushNamedAndRemoveUntil(Routes.dashboard, (route) => false);
|
||||
return;
|
||||
}
|
||||
|
||||
// await navigatorKey.currentState!.pushNamedAndRemoveUntil(Routes.dashboard, (route) => false);
|
||||
// return;
|
||||
}
|
||||
|
|
|
@ -70,7 +70,7 @@ class HavenRemovalNoticePage extends BasePage {
|
|||
),
|
||||
PrimaryButton(
|
||||
onPressed: () => Navigator.of(context)
|
||||
.popAndPushNamed(Routes.havenRemovalSeedPage, arguments: [wallet, viewModel]),
|
||||
.pushNamed(Routes.havenRemovalSeedPage, arguments: [wallet, viewModel]),
|
||||
text: S.of(context).pre_seed_button_text,
|
||||
color: Theme.of(context).primaryColor,
|
||||
textColor: Colors.white,
|
||||
|
|
|
@ -45,10 +45,6 @@ class HavenRemovalSeedPage extends BasePage {
|
|||
) ??
|
||||
false;
|
||||
|
||||
// if (confirmed) {
|
||||
// await havenRemovalViewModel.onSeedsCopiedConfirmed();
|
||||
// }
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -270,6 +270,7 @@ class WalletListBodyState extends State<WalletListBody> {
|
|||
if (ResponsiveLayoutUtil.instance.shouldRenderMobileUI()) {
|
||||
WidgetsBinding.instance.addPostFrameCallback((_) {
|
||||
Navigator.of(context).pop();
|
||||
return;
|
||||
});
|
||||
}
|
||||
} catch (e) {
|
||||
|
@ -283,7 +284,9 @@ class WalletListBodyState extends State<WalletListBody> {
|
|||
}
|
||||
|
||||
Future<void> _onHavenWalletSelected(WalletListItem walletListItem) async {
|
||||
changeProcessText(S.of(context).wallet_list_loading_wallet(walletListItem.name));
|
||||
final wallet = await widget.walletListViewModel.loadWalletWithoutChanging(walletListItem);
|
||||
await hideProgressText();
|
||||
await Navigator.pushNamed(context, Routes.havenRemovalNoticePage, arguments: wallet);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue