feat: Haven removal flow, should go back to the previous screen/wallet if it is triggered within the app

This commit is contained in:
Blazebrain 2023-10-03 15:03:02 +01:00
parent 04b9ebb366
commit bb159a5c7c
8 changed files with 298 additions and 305 deletions

View file

@ -0,0 +1,14 @@
import 'package:cake_wallet/view_model/haven_removal_view_model.dart';
import 'package:cw_core/wallet_base.dart';
class HavenRemovalFlowParameters {
final WalletBase wallet;
final bool isFromRemoveHavenAppStartFlow;
final HavenRemovalViewModel? havenRemovalViewModel;
HavenRemovalFlowParameters(
this.wallet,
this.isFromRemoveHavenAppStartFlow,
this.havenRemovalViewModel,
);
}

View file

@ -4,6 +4,7 @@ import 'package:cake_wallet/anonpay/anonpay_invoice_info.dart';
import 'package:cake_wallet/buy/onramper/onramper_buy_provider.dart'; import 'package:cake_wallet/buy/onramper/onramper_buy_provider.dart';
import 'package:cake_wallet/buy/payfura/payfura_buy_provider.dart'; import 'package:cake_wallet/buy/payfura/payfura_buy_provider.dart';
import 'package:cake_wallet/buy/robinhood/robinhood_buy_provider.dart'; import 'package:cake_wallet/buy/robinhood/robinhood_buy_provider.dart';
import 'package:cake_wallet/core/haven_removal_flow_parameters.dart';
import 'package:cake_wallet/core/yat_service.dart'; import 'package:cake_wallet/core/yat_service.dart';
import 'package:cake_wallet/entities/background_tasks.dart'; import 'package:cake_wallet/entities/background_tasks.dart';
import 'package:cake_wallet/entities/auto_generate_subaddress_status.dart'; import 'package:cake_wallet/entities/auto_generate_subaddress_status.dart';
@ -855,9 +856,8 @@ Future<void> setup({
getIt.registerFactory(() => SupportPage(getIt.get<SupportViewModel>())); getIt.registerFactory(() => SupportPage(getIt.get<SupportViewModel>()));
getIt.registerFactory(() => getIt.registerFactory(() => SupportChatPage(getIt.get<SupportViewModel>(),
SupportChatPage( secureStorage: getIt.get<FlutterSecureStorage>()));
getIt.get<SupportViewModel>(), secureStorage: getIt.get<FlutterSecureStorage>()));
getIt.registerFactory(() => SupportOtherLinksPage(getIt.get<SupportViewModel>())); getIt.registerFactory(() => SupportOtherLinksPage(getIt.get<SupportViewModel>()));
@ -1059,13 +1059,21 @@ Future<void> setup({
walletInfoSource: _walletInfoSource, walletInfoSource: _walletInfoSource,
walletLoadingService: getIt.get<WalletLoadingService>())); walletLoadingService: getIt.get<WalletLoadingService>()));
getIt.registerFactoryParam<HavenRemovalNoticePage, WalletBase, void>( getIt.registerFactoryParam<HavenRemovalNoticePage, WalletBase, bool>(
(wallet, _) => HavenRemovalNoticePage(wallet, getIt.get<HavenRemovalViewModel>()), (wallet, isFromHavenRemovalAtStartFlow) {
final params = HavenRemovalFlowParameters(
wallet,
isFromHavenRemovalAtStartFlow,
getIt.get<HavenRemovalViewModel>(),
);
return HavenRemovalNoticePage(params);
},
); );
getIt.registerFactoryParam<HavenRemovalSeedPage, WalletBase, HavenRemovalViewModel>( getIt.registerFactoryParam<HavenRemovalSeedPage, HavenRemovalFlowParameters, void>(
(wallet, viewModel) => HavenRemovalSeedPage(wallet, viewModel), (params, _) => HavenRemovalSeedPage(params),
); );
_isSetupFinished = true; _isSetupFinished = true;
} }

View file

@ -44,11 +44,8 @@ Future<void> _navigateBasedOnWalletType(
final wallet = appStore.wallet!; final wallet = appStore.wallet!;
if (wallet.type == WalletType.haven) { if (wallet.type == WalletType.haven) {
await navigatorKey.currentState!.pushNamedAndRemoveUntil( await navigatorKey.currentState!
Routes.havenRemovalNoticePage, .pushNamed(Routes.havenRemovalNoticePage, arguments: [wallet, true]);
(route) => false,
arguments: wallet,
);
return; return;
} else { } else {
await navigatorKey.currentState!.pushNamedAndRemoveUntil(Routes.dashboard, (route) => false); await navigatorKey.currentState!.pushNamedAndRemoveUntil(Routes.dashboard, (route) => false);

View file

@ -1,5 +1,6 @@
import 'package:cake_wallet/anonpay/anonpay_info_base.dart'; import 'package:cake_wallet/anonpay/anonpay_info_base.dart';
import 'package:cake_wallet/anonpay/anonpay_invoice_info.dart'; import 'package:cake_wallet/anonpay/anonpay_invoice_info.dart';
import 'package:cake_wallet/core/haven_removal_flow_parameters.dart';
import 'package:cake_wallet/core/totp_request_details.dart'; import 'package:cake_wallet/core/totp_request_details.dart';
import 'package:cake_wallet/entities/contact_record.dart'; import 'package:cake_wallet/entities/contact_record.dart';
import 'package:cake_wallet/buy/order.dart'; import 'package:cake_wallet/buy/order.dart';
@ -115,36 +116,34 @@ Route<dynamic> createRoute(RouteSettings settings) {
case Routes.newWalletFromWelcome: case Routes.newWalletFromWelcome:
return CupertinoPageRoute<void>( return CupertinoPageRoute<void>(
builder: (_) => getIt.get<SetupPinCodePage>( builder: (_) =>
param1: (PinCodeState<PinCodeWidget> context, dynamic _) { getIt.get<SetupPinCodePage>(param1: (PinCodeState<PinCodeWidget> context, dynamic _) {
if (availableWalletTypes.length == 1) { if (availableWalletTypes.length == 1) {
Navigator.of(context.context).pushNamed(Routes.newWallet, arguments: availableWalletTypes.first); Navigator.of(context.context)
} else { .pushNamed(Routes.newWallet, arguments: availableWalletTypes.first);
Navigator.of(context.context).pushNamed(Routes.newWalletType); } else {
} Navigator.of(context.context).pushNamed(Routes.newWalletType);
}), }
}),
fullscreenDialog: true); fullscreenDialog: true);
case Routes.newWalletType: case Routes.newWalletType:
return CupertinoPageRoute<void>( return CupertinoPageRoute<void>(
builder: (_) => getIt.get<NewWalletTypePage>( builder: (_) => getIt.get<NewWalletTypePage>(
param1: (BuildContext context, WalletType type) => param1: (BuildContext context, WalletType type) =>
Navigator.of(context) Navigator.of(context).pushNamed(Routes.newWallet, arguments: type)));
.pushNamed(Routes.newWallet, arguments: type)));
case Routes.newWallet: case Routes.newWallet:
final type = settings.arguments as WalletType; final type = settings.arguments as WalletType;
final walletNewVM = getIt.get<WalletNewVM>(param1: type); final walletNewVM = getIt.get<WalletNewVM>(param1: type);
return CupertinoPageRoute<void>( return CupertinoPageRoute<void>(builder: (_) => NewWalletPage(walletNewVM));
builder: (_) => NewWalletPage(walletNewVM));
case Routes.setupPin: case Routes.setupPin:
Function(PinCodeState<PinCodeWidget>, String)? callback; Function(PinCodeState<PinCodeWidget>, String)? callback;
if (settings.arguments is Function(PinCodeState<PinCodeWidget>, String)) { if (settings.arguments is Function(PinCodeState<PinCodeWidget>, String)) {
callback = callback = settings.arguments as Function(PinCodeState<PinCodeWidget>, String);
settings.arguments as Function(PinCodeState<PinCodeWidget>, String);
} }
return CupertinoPageRoute<void>( return CupertinoPageRoute<void>(
@ -154,8 +153,7 @@ Route<dynamic> createRoute(RouteSettings settings) {
return CupertinoPageRoute<void>( return CupertinoPageRoute<void>(
builder: (_) => getIt.get<NewWalletTypePage>( builder: (_) => getIt.get<NewWalletTypePage>(
param1: (BuildContext context, WalletType type) => param1: (BuildContext context, WalletType type) =>
Navigator.of(context) Navigator.of(context).pushNamed(Routes.restoreWallet, arguments: type),
.pushNamed(Routes.restoreWallet, arguments: type),
param2: false)); param2: false));
case Routes.restoreOptions: case Routes.restoreOptions:
@ -170,66 +168,57 @@ Route<dynamic> createRoute(RouteSettings settings) {
if (isNewInstall) { if (isNewInstall) {
return CupertinoPageRoute<void>( return CupertinoPageRoute<void>(
builder: (_) => getIt.get<SetupPinCodePage>( builder: (_) => getIt.get<SetupPinCodePage>(
param1: (PinCodeState<PinCodeWidget> context, dynamic _) { param1: (PinCodeState<PinCodeWidget> context, dynamic _) {
if (isSingleCoin) { if (isSingleCoin) {
return Navigator.of(context.context) return Navigator.of(context.context)
.pushNamed(Routes.restoreWallet, arguments: availableWalletTypes.first); .pushNamed(Routes.restoreWallet, arguments: availableWalletTypes.first);
} }
return Navigator.pushNamed( return Navigator.pushNamed(context.context, Routes.restoreWalletType);
context.context, Routes.restoreWalletType);
}), }),
fullscreenDialog: true); fullscreenDialog: true);
} else if (isSingleCoin) { } else if (isSingleCoin) {
return MaterialPageRoute<void>( return MaterialPageRoute<void>(
builder: (_) => getIt.get<WalletRestorePage>( builder: (_) => getIt.get<WalletRestorePage>(param1: availableWalletTypes.first));
param1: availableWalletTypes.first
));
} else { } else {
return CupertinoPageRoute<void>( return CupertinoPageRoute<void>(
builder: (_) => getIt.get<NewWalletTypePage>( builder: (_) => getIt.get<NewWalletTypePage>(
param1: (BuildContext context, WalletType type) => param1: (BuildContext context, WalletType type) =>
Navigator.of(context) Navigator.of(context).pushNamed(Routes.restoreWallet, arguments: type),
.pushNamed(Routes.restoreWallet, arguments: type),
param2: false)); param2: false));
} }
case Routes.seed: case Routes.seed:
return MaterialPageRoute<void>( return MaterialPageRoute<void>(
fullscreenDialog: true, fullscreenDialog: true,
builder: (_) => builder: (_) => getIt.get<WalletSeedPage>(param1: settings.arguments as bool));
getIt.get<WalletSeedPage>(param1: settings.arguments as bool));
case Routes.restoreWallet: case Routes.restoreWallet:
return MaterialPageRoute<void>( return MaterialPageRoute<void>(
builder: (_) => getIt.get<WalletRestorePage>( builder: (_) => getIt.get<WalletRestorePage>(param1: settings.arguments as WalletType));
param1: settings.arguments as WalletType));
case Routes.sweepingWalletPage: case Routes.sweepingWalletPage:
return CupertinoPageRoute<void>( return CupertinoPageRoute<void>(builder: (_) => getIt.get<SweepingWalletPage>());
builder: (_) => getIt.get<SweepingWalletPage>());
case Routes.dashboard: case Routes.dashboard:
return CupertinoPageRoute<void>( return CupertinoPageRoute<void>(
settings: settings, settings: settings, builder: (_) => getIt.get<DashboardPage>());
builder: (_) => getIt.get<DashboardPage>());
case Routes.send: case Routes.send:
final initialPaymentRequest = settings.arguments as PaymentRequest?; final initialPaymentRequest = settings.arguments as PaymentRequest?;
return CupertinoPageRoute<void>( return CupertinoPageRoute<void>(
fullscreenDialog: true, builder: (_) => getIt.get<SendPage>( fullscreenDialog: true,
param1: initialPaymentRequest, builder: (_) => getIt.get<SendPage>(
)); param1: initialPaymentRequest,
));
case Routes.sendTemplate: case Routes.sendTemplate:
return CupertinoPageRoute<void>( return CupertinoPageRoute<void>(
fullscreenDialog: true, fullscreenDialog: true, builder: (_) => getIt.get<SendTemplatePage>());
builder: (_) => getIt.get<SendTemplatePage>());
case Routes.receive: case Routes.receive:
return CupertinoPageRoute<void>( return CupertinoPageRoute<void>(builder: (_) => getIt.get<ReceivePage>());
builder: (_) => getIt.get<ReceivePage>());
case Routes.addressPage: case Routes.addressPage:
return CupertinoPageRoute<void>( return CupertinoPageRoute<void>(
@ -238,20 +227,18 @@ Route<dynamic> createRoute(RouteSettings settings) {
case Routes.transactionDetails: case Routes.transactionDetails:
return CupertinoPageRoute<void>( return CupertinoPageRoute<void>(
fullscreenDialog: true, fullscreenDialog: true,
builder: (_) => getIt.get<TransactionDetailsPage>( builder: (_) =>
param1: settings.arguments as TransactionInfo)); getIt.get<TransactionDetailsPage>(param1: settings.arguments as TransactionInfo));
case Routes.newSubaddress: case Routes.newSubaddress:
return CupertinoPageRoute<void>( return CupertinoPageRoute<void>(
builder: (_) => builder: (_) => getIt.get<AddressEditOrCreatePage>(param1: settings.arguments));
getIt.get<AddressEditOrCreatePage>(param1: settings.arguments));
case Routes.disclaimer: case Routes.disclaimer:
return CupertinoPageRoute<void>(builder: (_) => DisclaimerPage()); return CupertinoPageRoute<void>(builder: (_) => DisclaimerPage());
case Routes.readDisclaimer: case Routes.readDisclaimer:
return CupertinoPageRoute<void>( return CupertinoPageRoute<void>(builder: (_) => DisclaimerPage(isReadOnly: true));
builder: (_) => DisclaimerPage(isReadOnly: true));
case Routes.seedLanguage: case Routes.seedLanguage:
final args = settings.arguments as List<dynamic>; final args = settings.arguments as List<dynamic>;
@ -260,8 +247,8 @@ Route<dynamic> createRoute(RouteSettings settings) {
return CupertinoPageRoute<void>(builder: (_) { return CupertinoPageRoute<void>(builder: (_) {
return SeedLanguage( return SeedLanguage(
onConfirm: (context, lang) => Navigator.of(context) onConfirm: (context, lang) =>
.popAndPushNamed(redirectRoute, arguments: [type, lang])); Navigator.of(context).popAndPushNamed(redirectRoute, arguments: [type, lang]));
}); });
case Routes.walletList: case Routes.walletList:
@ -271,15 +258,13 @@ Route<dynamic> createRoute(RouteSettings settings) {
case Routes.walletEdit: case Routes.walletEdit:
return MaterialPageRoute<void>( return MaterialPageRoute<void>(
fullscreenDialog: true, fullscreenDialog: true,
builder: (_) => getIt.get<WalletEditPage>( builder: (_) => getIt.get<WalletEditPage>(param1: settings.arguments as List<dynamic>));
param1: settings.arguments as List<dynamic>));
case Routes.auth: case Routes.auth:
return MaterialPageRoute<void>( return MaterialPageRoute<void>(
fullscreenDialog: true, fullscreenDialog: true,
builder: (_) => getIt.get<AuthPage>( builder: (_) => getIt.get<AuthPage>(
param1: settings.arguments as OnAuthenticationFinished, param1: settings.arguments as OnAuthenticationFinished, param2: true));
param2: true));
case Routes.totpAuthCodePage: case Routes.totpAuthCodePage:
final args = settings.arguments as TotpAuthArgumentsModel; final args = settings.arguments as TotpAuthArgumentsModel;
@ -294,9 +279,9 @@ Route<dynamic> createRoute(RouteSettings settings) {
return CupertinoPageRoute<void>( return CupertinoPageRoute<void>(
builder: (context) => WillPopScope( builder: (context) => WillPopScope(
child: getIt.get<AuthPage>(instanceName: 'login'), child: getIt.get<AuthPage>(instanceName: 'login'),
onWillPop: () async => onWillPop: () async =>
// FIX-ME: Additional check does it works correctly // FIX-ME: Additional check does it works correctly
(await SystemChannels.platform.invokeMethod<bool>('SystemNavigator.pop') ?? (await SystemChannels.platform.invokeMethod<bool>('SystemNavigator.pop') ??
false), false),
), ),
fullscreenDialog: true); fullscreenDialog: true);
@ -306,43 +291,34 @@ Route<dynamic> createRoute(RouteSettings settings) {
fullscreenDialog: true, fullscreenDialog: true,
builder: (_) => WillPopScope( builder: (_) => WillPopScope(
child: getIt.get<AuthPage>( child: getIt.get<AuthPage>(
param1: settings.arguments as OnAuthenticationFinished, param1: settings.arguments as OnAuthenticationFinished, param2: false),
param2: false),
onWillPop: () async => false)); onWillPop: () async => false));
case Routes.connectionSync: case Routes.connectionSync:
return CupertinoPageRoute<void>( return CupertinoPageRoute<void>(
fullscreenDialog: true, fullscreenDialog: true, builder: (_) => getIt.get<ConnectionSyncPage>());
builder: (_) => getIt.get<ConnectionSyncPage>());
case Routes.securityBackupPage: case Routes.securityBackupPage:
return CupertinoPageRoute<void>( return CupertinoPageRoute<void>(
fullscreenDialog: true, fullscreenDialog: true, builder: (_) => getIt.get<SecurityBackupPage>());
builder: (_) => getIt.get<SecurityBackupPage>());
case Routes.privacyPage: case Routes.privacyPage:
return CupertinoPageRoute<void>( return CupertinoPageRoute<void>(
fullscreenDialog: true, fullscreenDialog: true, builder: (_) => getIt.get<PrivacyPage>());
builder: (_) => getIt.get<PrivacyPage>());
case Routes.displaySettingsPage: case Routes.displaySettingsPage:
return CupertinoPageRoute<void>( return CupertinoPageRoute<void>(
fullscreenDialog: true, fullscreenDialog: true, builder: (_) => getIt.get<DisplaySettingsPage>());
builder: (_) => getIt.get<DisplaySettingsPage>());
case Routes.otherSettingsPage: case Routes.otherSettingsPage:
return CupertinoPageRoute<void>( return CupertinoPageRoute<void>(
fullscreenDialog: true, fullscreenDialog: true, builder: (_) => getIt.get<OtherSettingsPage>());
builder: (_) => getIt.get<OtherSettingsPage>());
case Routes.newNode: case Routes.newNode:
final args = settings.arguments as Map<String, dynamic>?; final args = settings.arguments as Map<String, dynamic>?;
return CupertinoPageRoute<void>( return CupertinoPageRoute<void>(
builder: (_) => getIt.get<NodeCreateOrEditPage>( builder: (_) => getIt.get<NodeCreateOrEditPage>(
param1: args?['editingNode'] as Node?, param1: args?['editingNode'] as Node?, param2: args?['isSelected'] as bool?));
param2: args?['isSelected'] as bool?));
case Routes.accountCreation: case Routes.accountCreation:
return CupertinoPageRoute<String>( return CupertinoPageRoute<String>(
@ -351,8 +327,7 @@ Route<dynamic> createRoute(RouteSettings settings) {
case Routes.addressBook: case Routes.addressBook:
return MaterialPageRoute<void>( return MaterialPageRoute<void>(
fullscreenDialog: true, fullscreenDialog: true, builder: (_) => getIt.get<ContactListPage>());
builder: (_) => getIt.get<ContactListPage>());
case Routes.pickerAddressBook: case Routes.pickerAddressBook:
final selectedCurrency = settings.arguments as CryptoCurrency?; final selectedCurrency = settings.arguments as CryptoCurrency?;
@ -361,31 +336,26 @@ Route<dynamic> createRoute(RouteSettings settings) {
case Routes.addressBookAddContact: case Routes.addressBookAddContact:
return CupertinoPageRoute<void>( return CupertinoPageRoute<void>(
builder: (_) => getIt.get<ContactPage>( builder: (_) => getIt.get<ContactPage>(param1: settings.arguments as ContactRecord?));
param1: settings.arguments as ContactRecord?));
case Routes.showKeys: case Routes.showKeys:
return MaterialPageRoute<void>( return MaterialPageRoute<void>(
builder: (_) => getIt.get<WalletKeysPage>(), fullscreenDialog: true); builder: (_) => getIt.get<WalletKeysPage>(), fullscreenDialog: true);
case Routes.exchangeTrade: case Routes.exchangeTrade:
return CupertinoPageRoute<void>( return CupertinoPageRoute<void>(builder: (_) => getIt.get<ExchangeTradePage>());
builder: (_) => getIt.get<ExchangeTradePage>());
case Routes.exchangeConfirm: case Routes.exchangeConfirm:
return MaterialPageRoute<void>( return MaterialPageRoute<void>(builder: (_) => getIt.get<ExchangeConfirmPage>());
builder: (_) => getIt.get<ExchangeConfirmPage>());
case Routes.tradeDetails: case Routes.tradeDetails:
return MaterialPageRoute<void>( return MaterialPageRoute<void>(
fullscreenDialog: true, fullscreenDialog: true,
builder: (_) => builder: (_) => getIt.get<TradeDetailsPage>(param1: settings.arguments as Trade));
getIt.get<TradeDetailsPage>(param1: settings.arguments as Trade));
case Routes.orderDetails: case Routes.orderDetails:
return MaterialPageRoute<void>( return MaterialPageRoute<void>(
builder: (_) => builder: (_) => getIt.get<OrderDetailsPage>(param1: settings.arguments as Order));
getIt.get<OrderDetailsPage>(param1: settings.arguments as Order));
case Routes.buy: case Routes.buy:
return MaterialPageRoute<void>(builder: (_) => getIt.get<BuyOptionsPage>()); return MaterialPageRoute<void>(builder: (_) => getIt.get<BuyOptionsPage>());
@ -394,18 +364,14 @@ Route<dynamic> createRoute(RouteSettings settings) {
final args = settings.arguments as List; final args = settings.arguments as List;
return MaterialPageRoute<void>( return MaterialPageRoute<void>(
fullscreenDialog: true, fullscreenDialog: true, builder: (_) => getIt.get<BuyWebViewPage>(param1: args));
builder: (_) =>
getIt.get<BuyWebViewPage>(param1: args));
case Routes.exchange: case Routes.exchange:
return CupertinoPageRoute<void>( return CupertinoPageRoute<void>(
fullscreenDialog: true, fullscreenDialog: true, builder: (_) => getIt.get<ExchangePage>());
builder: (_) => getIt.get<ExchangePage>());
case Routes.exchangeTemplate: case Routes.exchangeTemplate:
return CupertinoPageRoute<void>( return CupertinoPageRoute<void>(builder: (_) => getIt.get<ExchangeTemplatePage>());
builder: (_) => getIt.get<ExchangeTemplatePage>());
case Routes.rescan: case Routes.rescan:
return MaterialPageRoute<void>(builder: (_) => getIt.get<RescanPage>()); return MaterialPageRoute<void>(builder: (_) => getIt.get<RescanPage>());
@ -415,51 +381,41 @@ Route<dynamic> createRoute(RouteSettings settings) {
case Routes.preSeed: case Routes.preSeed:
return MaterialPageRoute<void>( return MaterialPageRoute<void>(
builder: (_) => builder: (_) => getIt.get<PreSeedPage>(param1: settings.arguments as WalletType));
getIt.get<PreSeedPage>(param1: settings.arguments as WalletType));
case Routes.backup: case Routes.backup:
return CupertinoPageRoute<void>( return CupertinoPageRoute<void>(
fullscreenDialog: true, builder: (_) => getIt.get<BackupPage>()); fullscreenDialog: true, builder: (_) => getIt.get<BackupPage>());
case Routes.editBackupPassword: case Routes.editBackupPassword:
return CupertinoPageRoute<void>( return CupertinoPageRoute<void>(builder: (_) => getIt.get<EditBackupPasswordPage>());
builder: (_) => getIt.get<EditBackupPasswordPage>());
case Routes.restoreFromBackup: case Routes.restoreFromBackup:
return CupertinoPageRoute<void>( return CupertinoPageRoute<void>(
fullscreenDialog: true, fullscreenDialog: true, builder: (_) => getIt.get<RestoreFromBackupPage>());
builder: (_) => getIt.get<RestoreFromBackupPage>());
case Routes.support: case Routes.support:
return CupertinoPageRoute<void>( return CupertinoPageRoute<void>(builder: (_) => getIt.get<SupportPage>());
builder: (_) => getIt.get<SupportPage>());
case Routes.supportLiveChat: case Routes.supportLiveChat:
return CupertinoPageRoute<void>( return CupertinoPageRoute<void>(builder: (_) => getIt.get<SupportChatPage>());
builder: (_) => getIt.get<SupportChatPage>());
case Routes.supportOtherLinks: case Routes.supportOtherLinks:
return CupertinoPageRoute<void>( return CupertinoPageRoute<void>(
fullscreenDialog: true, fullscreenDialog: true, builder: (_) => getIt.get<SupportOtherLinksPage>());
builder: (_) => getIt.get<SupportOtherLinksPage>());
case Routes.unspentCoinsList: case Routes.unspentCoinsList:
return MaterialPageRoute<void>( return MaterialPageRoute<void>(builder: (_) => getIt.get<UnspentCoinsListPage>());
builder: (_) => getIt.get<UnspentCoinsListPage>());
case Routes.unspentCoinsDetails: case Routes.unspentCoinsDetails:
final args = settings.arguments as List; final args = settings.arguments as List;
return MaterialPageRoute<void>( return MaterialPageRoute<void>(
builder: (_) => builder: (_) => getIt.get<UnspentCoinsDetailsPage>(param1: args));
getIt.get<UnspentCoinsDetailsPage>(
param1: args));
case Routes.fullscreenQR: case Routes.fullscreenQR:
return MaterialPageRoute<void>( return MaterialPageRoute<void>(
builder: (_) => builder: (_) => getIt.get<FullscreenQRPage>(
getIt.get<FullscreenQRPage>(
param1: settings.arguments as QrViewData, param1: settings.arguments as QrViewData,
)); ));
@ -470,26 +426,27 @@ Route<dynamic> createRoute(RouteSettings settings) {
); );
case Routes.ioniaLoginPage: case Routes.ioniaLoginPage:
return CupertinoPageRoute<void>( builder: (_) => getIt.get<IoniaLoginPage>()); return CupertinoPageRoute<void>(builder: (_) => getIt.get<IoniaLoginPage>());
case Routes.ioniaCreateAccountPage: case Routes.ioniaCreateAccountPage:
return CupertinoPageRoute<void>( builder: (_) => getIt.get<IoniaCreateAccountPage>()); return CupertinoPageRoute<void>(builder: (_) => getIt.get<IoniaCreateAccountPage>());
case Routes.ioniaManageCardsPage: case Routes.ioniaManageCardsPage:
return CupertinoPageRoute<void>( return CupertinoPageRoute<void>(builder: (_) => getIt.get<IoniaManageCardsPage>());
builder: (_) => getIt.get<IoniaManageCardsPage>());
case Routes.ioniaBuyGiftCardPage: case Routes.ioniaBuyGiftCardPage:
final args = settings.arguments as List; final args = settings.arguments as List;
return CupertinoPageRoute<void>(builder: (_) => getIt.get<IoniaBuyGiftCardPage>(param1: args)); return CupertinoPageRoute<void>(
builder: (_) => getIt.get<IoniaBuyGiftCardPage>(param1: args));
case Routes.ioniaBuyGiftCardDetailPage: case Routes.ioniaBuyGiftCardDetailPage:
final args = settings.arguments as List; final args = settings.arguments as List;
return CupertinoPageRoute<void>(builder: (_) => getIt.get<IoniaBuyGiftCardDetailPage>(param1: args)); return CupertinoPageRoute<void>(
builder: (_) => getIt.get<IoniaBuyGiftCardDetailPage>(param1: args));
case Routes.ioniaVerifyIoniaOtpPage: case Routes.ioniaVerifyIoniaOtpPage:
final args = settings.arguments as List; final args = settings.arguments as List;
return CupertinoPageRoute<void>(builder: (_) =>getIt.get<IoniaVerifyIoniaOtp>(param1: args)); return CupertinoPageRoute<void>(builder: (_) => getIt.get<IoniaVerifyIoniaOtp>(param1: args));
case Routes.ioniaDebitCardPage: case Routes.ioniaDebitCardPage:
return CupertinoPageRoute<void>(builder: (_) => getIt.get<IoniaDebitCardPage>()); return CupertinoPageRoute<void>(builder: (_) => getIt.get<IoniaDebitCardPage>());
@ -505,57 +462,60 @@ Route<dynamic> createRoute(RouteSettings settings) {
case Routes.ioniaCustomTipPage: case Routes.ioniaCustomTipPage:
final args = settings.arguments as List; final args = settings.arguments as List;
return CupertinoPageRoute<void>(builder: (_) =>getIt.get<IoniaCustomTipPage>(param1: args)); return CupertinoPageRoute<void>(builder: (_) => getIt.get<IoniaCustomTipPage>(param1: args));
case Routes.ioniaGiftCardDetailPage: case Routes.ioniaGiftCardDetailPage:
final args = settings.arguments as List; final args = settings.arguments as List;
return CupertinoPageRoute<void>(builder: (_) => getIt.get<IoniaGiftCardDetailPage>(param1: args.first)); return CupertinoPageRoute<void>(
builder: (_) => getIt.get<IoniaGiftCardDetailPage>(param1: args.first));
case Routes.ioniaCustomRedeemPage: case Routes.ioniaCustomRedeemPage:
final args = settings.arguments as List; final args = settings.arguments as List;
return CupertinoPageRoute<void>(builder: (_) => getIt.get<IoniaCustomRedeemPage>(param1: args)); return CupertinoPageRoute<void>(
builder: (_) => getIt.get<IoniaCustomRedeemPage>(param1: args));
case Routes.ioniaMoreOptionsPage: case Routes.ioniaMoreOptionsPage:
final args = settings.arguments as List; final args = settings.arguments as List;
return CupertinoPageRoute<void>(builder: (_) => getIt.get<IoniaMoreOptionsPage>(param1: args)); return CupertinoPageRoute<void>(
builder: (_) => getIt.get<IoniaMoreOptionsPage>(param1: args));
case Routes.ioniaPaymentStatusPage: case Routes.ioniaPaymentStatusPage:
final args = settings.arguments as List; final args = settings.arguments as List;
final paymentInfo = args.first as IoniaAnyPayPaymentInfo; final paymentInfo = args.first as IoniaAnyPayPaymentInfo;
final commitedInfo = args[1] as AnyPayPaymentCommittedInfo; final commitedInfo = args[1] as AnyPayPaymentCommittedInfo;
return CupertinoPageRoute<void>(builder: (_) => getIt.get<IoniaPaymentStatusPage>( return CupertinoPageRoute<void>(
param1: paymentInfo, builder: (_) =>
param2: commitedInfo)); getIt.get<IoniaPaymentStatusPage>(param1: paymentInfo, param2: commitedInfo));
case Routes.webViewPage: case Routes.webViewPage:
final args = settings.arguments as List; final args = settings.arguments as List;
final title = args.first as String; final title = args.first as String;
final url = args[1] as Uri; final url = args[1] as Uri;
return CupertinoPageRoute<void>(builder: (_) => getIt.get<WebViewPage>( return CupertinoPageRoute<void>(
param1: title, builder: (_) => getIt.get<WebViewPage>(param1: title, param2: url));
param2: url));
case Routes.advancedPrivacySettings: case Routes.advancedPrivacySettings:
final type = settings.arguments as WalletType; final type = settings.arguments as WalletType;
return CupertinoPageRoute<void>( return CupertinoPageRoute<void>(
builder: (_) => AdvancedPrivacySettingsPage( builder: (_) => AdvancedPrivacySettingsPage(
getIt.get<AdvancedPrivacySettingsViewModel>(param1: type), getIt.get<AdvancedPrivacySettingsViewModel>(param1: type),
getIt.get<NodeCreateOrEditViewModel>(param1: type), getIt.get<NodeCreateOrEditViewModel>(param1: type),
)); ));
case Routes.anonPayInvoicePage: case Routes.anonPayInvoicePage:
final args = settings.arguments as List; final args = settings.arguments as List;
return CupertinoPageRoute<void>( return CupertinoPageRoute<void>(builder: (_) => getIt.get<AnonPayInvoicePage>(param1: args));
builder: (_) => getIt.get<AnonPayInvoicePage>(param1: args));
case Routes.anonPayReceivePage: case Routes.anonPayReceivePage:
final anonInvoiceViewData = settings.arguments as AnonpayInfoBase; final anonInvoiceViewData = settings.arguments as AnonpayInfoBase;
return CupertinoPageRoute<void>(builder: (_) => getIt.get<AnonPayReceivePage>(param1: anonInvoiceViewData)); return CupertinoPageRoute<void>(
builder: (_) => getIt.get<AnonPayReceivePage>(param1: anonInvoiceViewData));
case Routes.anonPayDetailsPage: case Routes.anonPayDetailsPage:
final anonInvoiceViewData = settings.arguments as AnonpayInvoiceInfo; final anonInvoiceViewData = settings.arguments as AnonpayInvoiceInfo;
return CupertinoPageRoute<void>(builder: (_) => getIt.get<AnonpayDetailsPage>(param1: anonInvoiceViewData)); return CupertinoPageRoute<void>(
builder: (_) => getIt.get<AnonpayDetailsPage>(param1: anonInvoiceViewData));
case Routes.desktop_actions: case Routes.desktop_actions:
return PageRouteBuilder( return PageRouteBuilder(
@ -564,12 +524,10 @@ Route<dynamic> createRoute(RouteSettings settings) {
); );
case Routes.desktop_settings_page: case Routes.desktop_settings_page:
return CupertinoPageRoute<void>( return CupertinoPageRoute<void>(builder: (_) => DesktopSettingsPage());
builder: (_) => DesktopSettingsPage());
case Routes.empty_no_route: case Routes.empty_no_route:
return MaterialPageRoute<void>( return MaterialPageRoute<void>(builder: (_) => SizedBox.shrink());
builder: (_) => SizedBox.shrink());
case Routes.transactionsPage: case Routes.transactionsPage:
return CupertinoPageRoute<void>( return CupertinoPageRoute<void>(
@ -609,24 +567,25 @@ Route<dynamic> createRoute(RouteSettings settings) {
return MaterialPageRoute<void>(builder: (_) => getIt.get<ManageNodesPage>()); return MaterialPageRoute<void>(builder: (_) => getIt.get<ManageNodesPage>());
case Routes.havenRemovalNoticePage: case Routes.havenRemovalNoticePage:
final args = settings.arguments as List;
final wallet = args.first as WalletBase;
final isFromHavenRemovalAtStartFlow = args[1];
return CupertinoPageRoute<void>( return CupertinoPageRoute<void>(
builder: (_) => getIt.get<HavenRemovalNoticePage>(param1: settings.arguments as WalletBase), builder: (_) => getIt.get<HavenRemovalNoticePage>(param1: wallet, param2: isFromHavenRemovalAtStartFlow),
); );
case Routes.havenRemovalSeedPage: case Routes.havenRemovalSeedPage:
final args = settings.arguments as List; final args = settings.arguments as HavenRemovalFlowParameters;
final wallet = args.first as WalletBase;
final havenRemovalViewModel = args[1] as HavenRemovalViewModel;
return CupertinoPageRoute<void>( return CupertinoPageRoute<void>(
builder: (_) => builder: (_) => getIt.get<HavenRemovalSeedPage>(param1: args),
getIt.get<HavenRemovalSeedPage>(param1: wallet, param2: havenRemovalViewModel),
); );
default: default:
return MaterialPageRoute<void>( return MaterialPageRoute<void>(
builder: (_) => Scaffold( builder: (_) => Scaffold(
body: Center( body: Center(child: Text(S.current.router_no_route(settings.name ?? 'No route')))));
child: Text(S.current.router_no_route(settings.name ?? 'No route')))));
} }
} }

View file

@ -1,3 +1,4 @@
import 'package:cake_wallet/core/haven_removal_flow_parameters.dart';
import 'package:cake_wallet/utils/responsive_layout_util.dart'; import 'package:cake_wallet/utils/responsive_layout_util.dart';
import 'package:cake_wallet/themes/extensions/cake_text_theme.dart'; import 'package:cake_wallet/themes/extensions/cake_text_theme.dart';
import 'package:cake_wallet/src/screens/base_page.dart'; import 'package:cake_wallet/src/screens/base_page.dart';
@ -5,20 +6,17 @@ import 'package:cake_wallet/src/widgets/primary_button.dart';
import 'package:cake_wallet/generated/i18n.dart'; import 'package:cake_wallet/generated/i18n.dart';
import 'package:cake_wallet/routes.dart'; import 'package:cake_wallet/routes.dart';
import 'package:cake_wallet/themes/theme_base.dart'; import 'package:cake_wallet/themes/theme_base.dart';
import 'package:cake_wallet/view_model/haven_removal_view_model.dart';
import 'package:cw_core/wallet_base.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
class HavenRemovalNoticePage extends BasePage { class HavenRemovalNoticePage extends BasePage {
HavenRemovalNoticePage(this.wallet, this.viewModel) HavenRemovalNoticePage(this.params)
: imageLight = Image.asset('assets/images/pre_seed_light.png'), : imageLight = Image.asset('assets/images/pre_seed_light.png'),
imageDark = Image.asset('assets/images/pre_seed_dark.png'); imageDark = Image.asset('assets/images/pre_seed_dark.png');
final Image imageDark; final Image imageDark;
final Image imageLight; final Image imageLight;
final WalletBase wallet; final HavenRemovalFlowParameters params;
final HavenRemovalViewModel viewModel;
@override @override
Widget? leading(BuildContext context) => null; Widget? leading(BuildContext context) => null;
@ -30,53 +28,50 @@ class HavenRemovalNoticePage extends BasePage {
Widget body(BuildContext context) { Widget body(BuildContext context) {
final image = currentTheme.type == ThemeType.dark ? imageDark : imageLight; final image = currentTheme.type == ThemeType.dark ? imageDark : imageLight;
return WillPopScope( return Container(
onWillPop: () async => false, alignment: Alignment.center,
child: Container( padding: EdgeInsets.all(24),
alignment: Alignment.center, child: ConstrainedBox(
padding: EdgeInsets.all(24), constraints: BoxConstraints(maxWidth: ResponsiveLayoutUtil.kDesktopMaxWidthConstraint),
child: ConstrainedBox( child: Column(
constraints: BoxConstraints(maxWidth: ResponsiveLayoutUtil.kDesktopMaxWidthConstraint), mainAxisAlignment: MainAxisAlignment.spaceBetween,
child: Column( children: <Widget>[
mainAxisAlignment: MainAxisAlignment.spaceBetween, ConstrainedBox(
children: <Widget>[ constraints: BoxConstraints(maxHeight: MediaQuery.of(context).size.height * 0.3),
ConstrainedBox( child: AspectRatio(aspectRatio: 1, child: image),
constraints: BoxConstraints(maxHeight: MediaQuery.of(context).size.height * 0.3), ),
child: AspectRatio(aspectRatio: 1, child: image), Column(
), children: [
Column( Text(
children: [ S.current.havenSupportNotice,
Text( style: TextStyle(
S.current.havenSupportNotice, fontSize: 18.0,
style: TextStyle( fontWeight: FontWeight.bold,
fontSize: 18.0, fontFamily: 'Lato',
fontWeight: FontWeight.bold, color: titleColor(context),
fontFamily: 'Lato',
color: titleColor(context),
),
textAlign: TextAlign.center,
), ),
SizedBox(height: 8), textAlign: TextAlign.center,
Text( ),
S.current.havenSupportSeedsNotice, SizedBox(height: 8),
textAlign: TextAlign.center, Text(
style: TextStyle( S.current.havenSupportSeedsNotice,
fontSize: 14, textAlign: TextAlign.center,
fontWeight: FontWeight.normal, style: TextStyle(
color: Theme.of(context).extension<CakeTextTheme>()!.secondaryTextColor, fontSize: 14,
), fontWeight: FontWeight.normal,
color: Theme.of(context).extension<CakeTextTheme>()!.secondaryTextColor,
), ),
], ),
), ],
PrimaryButton( ),
onPressed: () => Navigator.of(context) PrimaryButton(
.pushNamed(Routes.havenRemovalSeedPage, arguments: [wallet, viewModel]), onPressed: () => Navigator.of(context)
text: S.of(context).pre_seed_button_text, .popAndPushNamed(Routes.havenRemovalSeedPage, arguments: params),
color: Theme.of(context).primaryColor, text: S.of(context).pre_seed_button_text,
textColor: Colors.white, color: Theme.of(context).primaryColor,
) textColor: Colors.white,
], )
), ],
), ),
), ),
); );

View file

@ -1,3 +1,4 @@
import 'package:cake_wallet/core/haven_removal_flow_parameters.dart';
import 'package:cake_wallet/themes/extensions/cake_text_theme.dart'; import 'package:cake_wallet/themes/extensions/cake_text_theme.dart';
import 'package:cake_wallet/themes/extensions/pin_code_theme.dart'; import 'package:cake_wallet/themes/extensions/pin_code_theme.dart';
import 'package:cake_wallet/themes/theme_base.dart'; import 'package:cake_wallet/themes/theme_base.dart';
@ -17,12 +18,18 @@ import 'package:cake_wallet/src/screens/base_page.dart';
import 'package:cake_wallet/themes/extensions/transaction_trade_theme.dart'; import 'package:cake_wallet/themes/extensions/transaction_trade_theme.dart';
class HavenRemovalSeedPage extends BasePage { class HavenRemovalSeedPage extends BasePage {
HavenRemovalSeedPage(this.wallet, this.havenRemovalViewModel); HavenRemovalSeedPage(this.params)
: wallet = params.wallet,
isFromRemoveHavenAppStartFlow = params.isFromRemoveHavenAppStartFlow,
havenRemovalViewModel = params.havenRemovalViewModel!;
final imageLight = Image.asset('assets/images/crypto_lock_light.png'); final imageLight = Image.asset('assets/images/crypto_lock_light.png');
final imageDark = Image.asset('assets/images/crypto_lock.png'); final imageDark = Image.asset('assets/images/crypto_lock.png');
final HavenRemovalFlowParameters params;
final WalletBase wallet; final WalletBase wallet;
final bool isFromRemoveHavenAppStartFlow;
final HavenRemovalViewModel havenRemovalViewModel; final HavenRemovalViewModel havenRemovalViewModel;
@override @override
@ -30,7 +37,7 @@ class HavenRemovalSeedPage extends BasePage {
@override @override
void onClose(BuildContext context) async { void onClose(BuildContext context) async {
await showPopUp<bool>( final shouldPopBack = await showPopUp<bool>(
context: context, context: context,
builder: (BuildContext context) { builder: (BuildContext context) {
return AlertWithTwoActions( return AlertWithTwoActions(
@ -39,12 +46,17 @@ class HavenRemovalSeedPage extends BasePage {
leftButtonText: S.of(context).seed_alert_back, leftButtonText: S.of(context).seed_alert_back,
rightButtonText: S.of(context).seed_alert_yes, rightButtonText: S.of(context).seed_alert_yes,
actionLeftButton: () => Navigator.of(context).pop(false), actionLeftButton: () => Navigator.of(context).pop(false),
actionRightButton: () async => await havenRemovalViewModel.onSeedsCopiedConfirmed(), actionRightButton: () async =>
await havenRemovalViewModel.onSeedsCopiedConfirmed(isFromRemoveHavenAppStartFlow),
); );
}, },
) ?? ) ??
false; false;
if (shouldPopBack) {
Navigator.of(context).pop();
}
return; return;
} }
@ -80,103 +92,99 @@ class HavenRemovalSeedPage extends BasePage {
Widget body(BuildContext context) { Widget body(BuildContext context) {
final image = currentTheme.type == ThemeType.dark ? imageDark : imageLight; final image = currentTheme.type == ThemeType.dark ? imageDark : imageLight;
return WillPopScope( return Container(
onWillPop: () async => false, padding: EdgeInsets.all(24),
child: Container( alignment: Alignment.center,
padding: EdgeInsets.all(24), child: ConstrainedBox(
alignment: Alignment.center, constraints: BoxConstraints(maxWidth: ResponsiveLayoutUtil.kDesktopMaxWidthConstraint),
child: ConstrainedBox( child: Column(
constraints: BoxConstraints(maxWidth: ResponsiveLayoutUtil.kDesktopMaxWidthConstraint), mainAxisAlignment: MainAxisAlignment.spaceBetween,
child: Column( children: <Widget>[
mainAxisAlignment: MainAxisAlignment.spaceBetween, ConstrainedBox(
children: <Widget>[ constraints: BoxConstraints(maxHeight: MediaQuery.of(context).size.height * 0.3),
ConstrainedBox( child: AspectRatio(aspectRatio: 1, child: image),
constraints: BoxConstraints(maxHeight: MediaQuery.of(context).size.height * 0.3), ),
child: AspectRatio(aspectRatio: 1, child: image), Column(
), crossAxisAlignment: CrossAxisAlignment.center,
Column( children: <Widget>[
crossAxisAlignment: CrossAxisAlignment.center, Text(
children: <Widget>[ wallet.name,
Text( style: TextStyle(
wallet.name, fontSize: 20,
fontWeight: FontWeight.w600,
color: Theme.of(context).extension<CakeTextTheme>()!.titleColor,
),
),
Padding(
padding: EdgeInsets.only(top: 20, left: 16, right: 16),
child: Text(
wallet.seed ?? '',
textAlign: TextAlign.center,
style: TextStyle( style: TextStyle(
fontSize: 20, fontSize: 14,
fontWeight: FontWeight.w600, fontWeight: FontWeight.normal,
color: Theme.of(context).extension<CakeTextTheme>()!.titleColor, color: Theme.of(context).extension<CakeTextTheme>()!.secondaryTextColor,
), ),
), ),
Padding( )
padding: EdgeInsets.only(top: 20, left: 16, right: 16), ],
child: Text( ),
wallet.seed ?? '', Column(
textAlign: TextAlign.center, children: <Widget>[
style: TextStyle( Padding(
fontSize: 14, padding: EdgeInsets.only(bottom: 43, left: 43, right: 43),
fontWeight: FontWeight.normal, child: Text(
color: Theme.of(context).extension<CakeTextTheme>()!.secondaryTextColor, S.of(context).seed_reminder,
), textAlign: TextAlign.center,
), style: TextStyle(
) fontSize: 12,
], fontWeight: FontWeight.normal,
), color:
Column( Theme.of(context).extension<TransactionTradeTheme>()!.detailsTitlesColor,
children: <Widget>[
Padding(
padding: EdgeInsets.only(bottom: 43, left: 43, right: 43),
child: Text(
S.of(context).seed_reminder,
textAlign: TextAlign.center,
style: TextStyle(
fontSize: 12,
fontWeight: FontWeight.normal,
color: Theme.of(context)
.extension<TransactionTradeTheme>()!
.detailsTitlesColor,
),
), ),
), ),
Row( ),
mainAxisSize: MainAxisSize.max, Row(
children: <Widget>[ mainAxisSize: MainAxisSize.max,
Flexible( children: <Widget>[
child: Container( Flexible(
padding: EdgeInsets.only(right: 8.0),
child: PrimaryButton(
onPressed: () {
ShareUtil.share(
text: wallet.seed ?? '',
context: context,
);
},
text: S.of(context).save,
color: Colors.green,
textColor: Colors.white,
),
)),
Flexible(
child: Container( child: Container(
padding: EdgeInsets.only(left: 8.0), padding: EdgeInsets.only(right: 8.0),
child: Builder( child: PrimaryButton(
builder: (context) => PrimaryButton( onPressed: () {
onPressed: () { ShareUtil.share(
ClipboardUtil.setSensitiveDataToClipboard( text: wallet.seed ?? '',
ClipboardData(text: wallet.seed ?? ''), context: context,
); );
showBar<void>(context, S.of(context).copied_to_clipboard); },
}, text: S.of(context).save,
text: S.of(context).copy, color: Colors.green,
color: Theme.of(context).extension<PinCodeTheme>()!.indicatorsColor, textColor: Colors.white,
textColor: Colors.white, ),
), )),
Flexible(
child: Container(
padding: EdgeInsets.only(left: 8.0),
child: Builder(
builder: (context) => PrimaryButton(
onPressed: () {
ClipboardUtil.setSensitiveDataToClipboard(
ClipboardData(text: wallet.seed ?? ''),
);
showBar<void>(context, S.of(context).copied_to_clipboard);
},
text: S.of(context).copy,
color: Theme.of(context).extension<PinCodeTheme>()!.indicatorsColor,
textColor: Colors.white,
), ),
), ),
) ),
], )
) ],
], )
) ],
], )
), ],
), ),
), ),
); );

View file

@ -1,3 +1,4 @@
import 'package:cake_wallet/core/haven_removal_flow_parameters.dart';
import 'package:cake_wallet/themes/extensions/cake_text_theme.dart'; import 'package:cake_wallet/themes/extensions/cake_text_theme.dart';
import 'package:cake_wallet/core/auth_service.dart'; import 'package:cake_wallet/core/auth_service.dart';
import 'package:cake_wallet/themes/extensions/receive_page_theme.dart'; import 'package:cake_wallet/themes/extensions/receive_page_theme.dart';
@ -286,7 +287,7 @@ class WalletListBodyState extends State<WalletListBody> {
changeProcessText(S.of(context).wallet_list_loading_wallet(walletListItem.name)); 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 hideProgressText();
await Navigator.pushNamed(context, Routes.havenRemovalNoticePage, arguments: wallet); await Navigator.pushNamed(context, Routes.havenRemovalNoticePage, arguments: [wallet, false]);
} }
void changeProcessText(String text) { void changeProcessText(String text) {

View file

@ -18,10 +18,15 @@ class HavenRemovalViewModel {
final Box<WalletInfo> walletInfoSource; final Box<WalletInfo> walletInfoSource;
final WalletLoadingService walletLoadingService; final WalletLoadingService walletLoadingService;
Future<void> onSeedsCopiedConfirmed() async { Future<bool> onSeedsCopiedConfirmed(bool isFromStart) async {
if (walletInfoSource.length == 1) { if (walletInfoSource.length == 1) {
_navigateToWelcomePage(); _navigateToWelcomePage();
return; return false;
}
if (!isFromStart) {
goBack();
return true;
} }
final walletInfo = _getFirstNonHavenWallet(); final walletInfo = _getFirstNonHavenWallet();
@ -31,6 +36,8 @@ class HavenRemovalViewModel {
_changeWallet(wallet); _changeWallet(wallet);
await _navigateToDashboardPage(); await _navigateToDashboardPage();
return false;
} }
WalletInfo _getFirstNonHavenWallet() { WalletInfo _getFirstNonHavenWallet() {
@ -56,4 +63,8 @@ class HavenRemovalViewModel {
await navigatorKey.currentState!.pushNamedAndRemoveUntil(Routes.welcome, (route) => false); await navigatorKey.currentState!.pushNamedAndRemoveUntil(Routes.welcome, (route) => false);
return; return;
} }
void goBack() {
navigatorKey.currentState!.pop(true);
}
} }