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) { if (state == AuthenticationState.allowed) {
await _navigateBasedOnWalletType(navigatorKey, appStore); await _navigateBasedOnWalletType(navigatorKey, appStore);
return;
} }
}, },
); );
@ -43,17 +44,20 @@ Future<void> _loadCurrentWallet() async {
Future<void> _navigateBasedOnWalletType( Future<void> _navigateBasedOnWalletType(
GlobalKey<NavigatorState> navigatorKey, AppStore appStore) async { GlobalKey<NavigatorState> navigatorKey, AppStore appStore) async {
final typeRaw = getIt.get<SharedPreferences>().getInt(PreferencesKey.currentWalletType) ?? 0; final wallet = appStore.wallet!;
final type = deserializeFromInt(typeRaw);
if (type == WalletType.haven) {
final wallet = appStore.wallet;
await navigatorKey.currentState!.pushNamed(Routes.havenRemovalNoticePage, arguments: wallet);
if (wallet.type == WalletType.haven) {
await navigatorKey.currentState!.pushNamedAndRemoveUntil(
Routes.havenRemovalNoticePage,
(route) => false,
arguments: wallet,
);
return; return;
} else { } else {
await navigatorKey.currentState!.pushNamedAndRemoveUntil(Routes.dashboard, (route) => false); await navigatorKey.currentState!.pushNamedAndRemoveUntil(Routes.dashboard, (route) => false);
return; return;
} }
// await navigatorKey.currentState!.pushNamedAndRemoveUntil(Routes.dashboard, (route) => false);
// return;
} }

View file

@ -70,7 +70,7 @@ class HavenRemovalNoticePage extends BasePage {
), ),
PrimaryButton( PrimaryButton(
onPressed: () => Navigator.of(context) onPressed: () => Navigator.of(context)
.popAndPushNamed(Routes.havenRemovalSeedPage, arguments: [wallet, viewModel]), .pushNamed(Routes.havenRemovalSeedPage, arguments: [wallet, viewModel]),
text: S.of(context).pre_seed_button_text, text: S.of(context).pre_seed_button_text,
color: Theme.of(context).primaryColor, color: Theme.of(context).primaryColor,
textColor: Colors.white, textColor: Colors.white,

View file

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

View file

@ -270,6 +270,7 @@ class WalletListBodyState extends State<WalletListBody> {
if (ResponsiveLayoutUtil.instance.shouldRenderMobileUI()) { if (ResponsiveLayoutUtil.instance.shouldRenderMobileUI()) {
WidgetsBinding.instance.addPostFrameCallback((_) { WidgetsBinding.instance.addPostFrameCallback((_) {
Navigator.of(context).pop(); Navigator.of(context).pop();
return;
}); });
} }
} catch (e) { } catch (e) {
@ -283,7 +284,9 @@ class WalletListBodyState extends State<WalletListBody> {
} }
Future<void> _onHavenWalletSelected(WalletListItem walletListItem) async { Future<void> _onHavenWalletSelected(WalletListItem walletListItem) async {
changeProcessText(S.of(context).wallet_list_loading_wallet(walletListItem.name));
final wallet = await widget.walletListViewModel.loadWalletWithoutChanging(walletListItem); final wallet = await widget.walletListViewModel.loadWalletWithoutChanging(walletListItem);
await hideProgressText();
await Navigator.pushNamed(context, Routes.havenRemovalNoticePage, arguments: wallet); await Navigator.pushNamed(context, Routes.havenRemovalNoticePage, arguments: wallet);
} }