feat: Haven removal

This commit is contained in:
Blazebrain 2023-10-03 14:04:15 +01:00
parent 28985b0f52
commit 19120dfbc4
4 changed files with 15 additions and 12 deletions

View file

@ -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;
}

View file

@ -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,

View file

@ -45,10 +45,6 @@ class HavenRemovalSeedPage extends BasePage {
) ??
false;
// if (confirmed) {
// await havenRemovalViewModel.onSeedsCopiedConfirmed();
// }
return;
}

View file

@ -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);
}