mirror of
https://github.com/cake-tech/cake_wallet.git
synced 2024-12-22 11:39:22 +00:00
feat: Haven removal flow, should go back to the previous screen/wallet if it is triggered within the app
This commit is contained in:
parent
04b9ebb366
commit
bb159a5c7c
8 changed files with 298 additions and 305 deletions
14
lib/core/haven_removal_flow_parameters.dart
Normal file
14
lib/core/haven_removal_flow_parameters.dart
Normal 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,
|
||||
);
|
||||
}
|
24
lib/di.dart
24
lib/di.dart
|
@ -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/payfura/payfura_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/entities/background_tasks.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(() =>
|
||||
SupportChatPage(
|
||||
getIt.get<SupportViewModel>(), secureStorage: getIt.get<FlutterSecureStorage>()));
|
||||
getIt.registerFactory(() => SupportChatPage(getIt.get<SupportViewModel>(),
|
||||
secureStorage: getIt.get<FlutterSecureStorage>()));
|
||||
|
||||
getIt.registerFactory(() => SupportOtherLinksPage(getIt.get<SupportViewModel>()));
|
||||
|
||||
|
@ -1059,13 +1059,21 @@ Future<void> setup({
|
|||
walletInfoSource: _walletInfoSource,
|
||||
walletLoadingService: getIt.get<WalletLoadingService>()));
|
||||
|
||||
getIt.registerFactoryParam<HavenRemovalNoticePage, WalletBase, void>(
|
||||
(wallet, _) => HavenRemovalNoticePage(wallet, getIt.get<HavenRemovalViewModel>()),
|
||||
getIt.registerFactoryParam<HavenRemovalNoticePage, WalletBase, bool>(
|
||||
(wallet, isFromHavenRemovalAtStartFlow) {
|
||||
final params = HavenRemovalFlowParameters(
|
||||
wallet,
|
||||
isFromHavenRemovalAtStartFlow,
|
||||
getIt.get<HavenRemovalViewModel>(),
|
||||
);
|
||||
|
||||
return HavenRemovalNoticePage(params);
|
||||
},
|
||||
);
|
||||
|
||||
getIt.registerFactoryParam<HavenRemovalSeedPage, WalletBase, HavenRemovalViewModel>(
|
||||
(wallet, viewModel) => HavenRemovalSeedPage(wallet, viewModel),
|
||||
getIt.registerFactoryParam<HavenRemovalSeedPage, HavenRemovalFlowParameters, void>(
|
||||
(params, _) => HavenRemovalSeedPage(params),
|
||||
);
|
||||
|
||||
|
||||
_isSetupFinished = true;
|
||||
}
|
||||
|
|
|
@ -44,11 +44,8 @@ Future<void> _navigateBasedOnWalletType(
|
|||
final wallet = appStore.wallet!;
|
||||
|
||||
if (wallet.type == WalletType.haven) {
|
||||
await navigatorKey.currentState!.pushNamedAndRemoveUntil(
|
||||
Routes.havenRemovalNoticePage,
|
||||
(route) => false,
|
||||
arguments: wallet,
|
||||
);
|
||||
await navigatorKey.currentState!
|
||||
.pushNamed(Routes.havenRemovalNoticePage, arguments: [wallet, true]);
|
||||
return;
|
||||
} else {
|
||||
await navigatorKey.currentState!.pushNamedAndRemoveUntil(Routes.dashboard, (route) => false);
|
||||
|
|
253
lib/router.dart
253
lib/router.dart
|
@ -1,5 +1,6 @@
|
|||
import 'package:cake_wallet/anonpay/anonpay_info_base.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/entities/contact_record.dart';
|
||||
import 'package:cake_wallet/buy/order.dart';
|
||||
|
@ -115,36 +116,34 @@ Route<dynamic> createRoute(RouteSettings settings) {
|
|||
|
||||
case Routes.newWalletFromWelcome:
|
||||
return CupertinoPageRoute<void>(
|
||||
builder: (_) => getIt.get<SetupPinCodePage>(
|
||||
param1: (PinCodeState<PinCodeWidget> context, dynamic _) {
|
||||
if (availableWalletTypes.length == 1) {
|
||||
Navigator.of(context.context).pushNamed(Routes.newWallet, arguments: availableWalletTypes.first);
|
||||
} else {
|
||||
Navigator.of(context.context).pushNamed(Routes.newWalletType);
|
||||
}
|
||||
}),
|
||||
builder: (_) =>
|
||||
getIt.get<SetupPinCodePage>(param1: (PinCodeState<PinCodeWidget> context, dynamic _) {
|
||||
if (availableWalletTypes.length == 1) {
|
||||
Navigator.of(context.context)
|
||||
.pushNamed(Routes.newWallet, arguments: availableWalletTypes.first);
|
||||
} else {
|
||||
Navigator.of(context.context).pushNamed(Routes.newWalletType);
|
||||
}
|
||||
}),
|
||||
fullscreenDialog: true);
|
||||
|
||||
case Routes.newWalletType:
|
||||
return CupertinoPageRoute<void>(
|
||||
builder: (_) => getIt.get<NewWalletTypePage>(
|
||||
param1: (BuildContext context, WalletType type) =>
|
||||
Navigator.of(context)
|
||||
.pushNamed(Routes.newWallet, arguments: type)));
|
||||
Navigator.of(context).pushNamed(Routes.newWallet, arguments: type)));
|
||||
|
||||
case Routes.newWallet:
|
||||
final type = settings.arguments as WalletType;
|
||||
final walletNewVM = getIt.get<WalletNewVM>(param1: type);
|
||||
|
||||
return CupertinoPageRoute<void>(
|
||||
builder: (_) => NewWalletPage(walletNewVM));
|
||||
return CupertinoPageRoute<void>(builder: (_) => NewWalletPage(walletNewVM));
|
||||
|
||||
case Routes.setupPin:
|
||||
Function(PinCodeState<PinCodeWidget>, String)? callback;
|
||||
|
||||
if (settings.arguments is Function(PinCodeState<PinCodeWidget>, String)) {
|
||||
callback =
|
||||
settings.arguments as Function(PinCodeState<PinCodeWidget>, String);
|
||||
callback = settings.arguments as Function(PinCodeState<PinCodeWidget>, String);
|
||||
}
|
||||
|
||||
return CupertinoPageRoute<void>(
|
||||
|
@ -154,8 +153,7 @@ Route<dynamic> createRoute(RouteSettings settings) {
|
|||
return CupertinoPageRoute<void>(
|
||||
builder: (_) => getIt.get<NewWalletTypePage>(
|
||||
param1: (BuildContext context, WalletType type) =>
|
||||
Navigator.of(context)
|
||||
.pushNamed(Routes.restoreWallet, arguments: type),
|
||||
Navigator.of(context).pushNamed(Routes.restoreWallet, arguments: type),
|
||||
param2: false));
|
||||
|
||||
case Routes.restoreOptions:
|
||||
|
@ -170,66 +168,57 @@ Route<dynamic> createRoute(RouteSettings settings) {
|
|||
if (isNewInstall) {
|
||||
return CupertinoPageRoute<void>(
|
||||
builder: (_) => getIt.get<SetupPinCodePage>(
|
||||
param1: (PinCodeState<PinCodeWidget> context, dynamic _) {
|
||||
param1: (PinCodeState<PinCodeWidget> context, dynamic _) {
|
||||
if (isSingleCoin) {
|
||||
return Navigator.of(context.context)
|
||||
.pushNamed(Routes.restoreWallet, arguments: availableWalletTypes.first);
|
||||
}
|
||||
|
||||
return Navigator.pushNamed(
|
||||
context.context, Routes.restoreWalletType);
|
||||
return Navigator.pushNamed(context.context, Routes.restoreWalletType);
|
||||
}),
|
||||
fullscreenDialog: true);
|
||||
} else if (isSingleCoin) {
|
||||
return MaterialPageRoute<void>(
|
||||
builder: (_) => getIt.get<WalletRestorePage>(
|
||||
param1: availableWalletTypes.first
|
||||
));
|
||||
builder: (_) => getIt.get<WalletRestorePage>(param1: availableWalletTypes.first));
|
||||
} else {
|
||||
return CupertinoPageRoute<void>(
|
||||
builder: (_) => getIt.get<NewWalletTypePage>(
|
||||
param1: (BuildContext context, WalletType type) =>
|
||||
Navigator.of(context)
|
||||
.pushNamed(Routes.restoreWallet, arguments: type),
|
||||
Navigator.of(context).pushNamed(Routes.restoreWallet, arguments: type),
|
||||
param2: false));
|
||||
}
|
||||
|
||||
case Routes.seed:
|
||||
return MaterialPageRoute<void>(
|
||||
fullscreenDialog: true,
|
||||
builder: (_) =>
|
||||
getIt.get<WalletSeedPage>(param1: settings.arguments as bool));
|
||||
builder: (_) => getIt.get<WalletSeedPage>(param1: settings.arguments as bool));
|
||||
|
||||
case Routes.restoreWallet:
|
||||
return MaterialPageRoute<void>(
|
||||
builder: (_) => getIt.get<WalletRestorePage>(
|
||||
param1: settings.arguments as WalletType));
|
||||
builder: (_) => getIt.get<WalletRestorePage>(param1: settings.arguments as WalletType));
|
||||
|
||||
case Routes.sweepingWalletPage:
|
||||
return CupertinoPageRoute<void>(
|
||||
builder: (_) => getIt.get<SweepingWalletPage>());
|
||||
return CupertinoPageRoute<void>(builder: (_) => getIt.get<SweepingWalletPage>());
|
||||
|
||||
case Routes.dashboard:
|
||||
return CupertinoPageRoute<void>(
|
||||
settings: settings,
|
||||
builder: (_) => getIt.get<DashboardPage>());
|
||||
settings: settings, builder: (_) => getIt.get<DashboardPage>());
|
||||
|
||||
case Routes.send:
|
||||
final initialPaymentRequest = settings.arguments as PaymentRequest?;
|
||||
|
||||
return CupertinoPageRoute<void>(
|
||||
fullscreenDialog: true, builder: (_) => getIt.get<SendPage>(
|
||||
param1: initialPaymentRequest,
|
||||
));
|
||||
fullscreenDialog: true,
|
||||
builder: (_) => getIt.get<SendPage>(
|
||||
param1: initialPaymentRequest,
|
||||
));
|
||||
|
||||
case Routes.sendTemplate:
|
||||
return CupertinoPageRoute<void>(
|
||||
fullscreenDialog: true,
|
||||
builder: (_) => getIt.get<SendTemplatePage>());
|
||||
fullscreenDialog: true, builder: (_) => getIt.get<SendTemplatePage>());
|
||||
|
||||
case Routes.receive:
|
||||
return CupertinoPageRoute<void>(
|
||||
builder: (_) => getIt.get<ReceivePage>());
|
||||
return CupertinoPageRoute<void>(builder: (_) => getIt.get<ReceivePage>());
|
||||
|
||||
case Routes.addressPage:
|
||||
return CupertinoPageRoute<void>(
|
||||
|
@ -238,20 +227,18 @@ Route<dynamic> createRoute(RouteSettings settings) {
|
|||
case Routes.transactionDetails:
|
||||
return CupertinoPageRoute<void>(
|
||||
fullscreenDialog: true,
|
||||
builder: (_) => getIt.get<TransactionDetailsPage>(
|
||||
param1: settings.arguments as TransactionInfo));
|
||||
builder: (_) =>
|
||||
getIt.get<TransactionDetailsPage>(param1: settings.arguments as TransactionInfo));
|
||||
|
||||
case Routes.newSubaddress:
|
||||
return CupertinoPageRoute<void>(
|
||||
builder: (_) =>
|
||||
getIt.get<AddressEditOrCreatePage>(param1: settings.arguments));
|
||||
builder: (_) => getIt.get<AddressEditOrCreatePage>(param1: settings.arguments));
|
||||
|
||||
case Routes.disclaimer:
|
||||
return CupertinoPageRoute<void>(builder: (_) => DisclaimerPage());
|
||||
|
||||
case Routes.readDisclaimer:
|
||||
return CupertinoPageRoute<void>(
|
||||
builder: (_) => DisclaimerPage(isReadOnly: true));
|
||||
return CupertinoPageRoute<void>(builder: (_) => DisclaimerPage(isReadOnly: true));
|
||||
|
||||
case Routes.seedLanguage:
|
||||
final args = settings.arguments as List<dynamic>;
|
||||
|
@ -260,8 +247,8 @@ Route<dynamic> createRoute(RouteSettings settings) {
|
|||
|
||||
return CupertinoPageRoute<void>(builder: (_) {
|
||||
return SeedLanguage(
|
||||
onConfirm: (context, lang) => Navigator.of(context)
|
||||
.popAndPushNamed(redirectRoute, arguments: [type, lang]));
|
||||
onConfirm: (context, lang) =>
|
||||
Navigator.of(context).popAndPushNamed(redirectRoute, arguments: [type, lang]));
|
||||
});
|
||||
|
||||
case Routes.walletList:
|
||||
|
@ -271,15 +258,13 @@ Route<dynamic> createRoute(RouteSettings settings) {
|
|||
case Routes.walletEdit:
|
||||
return MaterialPageRoute<void>(
|
||||
fullscreenDialog: true,
|
||||
builder: (_) => getIt.get<WalletEditPage>(
|
||||
param1: settings.arguments as List<dynamic>));
|
||||
builder: (_) => getIt.get<WalletEditPage>(param1: settings.arguments as List<dynamic>));
|
||||
|
||||
case Routes.auth:
|
||||
return MaterialPageRoute<void>(
|
||||
fullscreenDialog: true,
|
||||
builder: (_) => getIt.get<AuthPage>(
|
||||
param1: settings.arguments as OnAuthenticationFinished,
|
||||
param2: true));
|
||||
param1: settings.arguments as OnAuthenticationFinished, param2: true));
|
||||
|
||||
case Routes.totpAuthCodePage:
|
||||
final args = settings.arguments as TotpAuthArgumentsModel;
|
||||
|
@ -294,9 +279,9 @@ Route<dynamic> createRoute(RouteSettings settings) {
|
|||
return CupertinoPageRoute<void>(
|
||||
builder: (context) => WillPopScope(
|
||||
child: getIt.get<AuthPage>(instanceName: 'login'),
|
||||
onWillPop: () async =>
|
||||
// FIX-ME: Additional check does it works correctly
|
||||
(await SystemChannels.platform.invokeMethod<bool>('SystemNavigator.pop') ??
|
||||
onWillPop: () async =>
|
||||
// FIX-ME: Additional check does it works correctly
|
||||
(await SystemChannels.platform.invokeMethod<bool>('SystemNavigator.pop') ??
|
||||
false),
|
||||
),
|
||||
fullscreenDialog: true);
|
||||
|
@ -306,43 +291,34 @@ Route<dynamic> createRoute(RouteSettings settings) {
|
|||
fullscreenDialog: true,
|
||||
builder: (_) => WillPopScope(
|
||||
child: getIt.get<AuthPage>(
|
||||
param1: settings.arguments as OnAuthenticationFinished,
|
||||
param2: false),
|
||||
param1: settings.arguments as OnAuthenticationFinished, param2: false),
|
||||
onWillPop: () async => false));
|
||||
|
||||
case Routes.connectionSync:
|
||||
return CupertinoPageRoute<void>(
|
||||
fullscreenDialog: true,
|
||||
builder: (_) => getIt.get<ConnectionSyncPage>());
|
||||
fullscreenDialog: true, builder: (_) => getIt.get<ConnectionSyncPage>());
|
||||
|
||||
case Routes.securityBackupPage:
|
||||
return CupertinoPageRoute<void>(
|
||||
fullscreenDialog: true,
|
||||
builder: (_) => getIt.get<SecurityBackupPage>());
|
||||
fullscreenDialog: true, builder: (_) => getIt.get<SecurityBackupPage>());
|
||||
|
||||
case Routes.privacyPage:
|
||||
case Routes.privacyPage:
|
||||
return CupertinoPageRoute<void>(
|
||||
fullscreenDialog: true,
|
||||
builder: (_) => getIt.get<PrivacyPage>());
|
||||
fullscreenDialog: true, builder: (_) => getIt.get<PrivacyPage>());
|
||||
|
||||
case Routes.displaySettingsPage:
|
||||
case Routes.displaySettingsPage:
|
||||
return CupertinoPageRoute<void>(
|
||||
fullscreenDialog: true,
|
||||
builder: (_) => getIt.get<DisplaySettingsPage>());
|
||||
fullscreenDialog: true, builder: (_) => getIt.get<DisplaySettingsPage>());
|
||||
|
||||
case Routes.otherSettingsPage:
|
||||
return CupertinoPageRoute<void>(
|
||||
fullscreenDialog: true,
|
||||
builder: (_) => getIt.get<OtherSettingsPage>());
|
||||
fullscreenDialog: true, builder: (_) => getIt.get<OtherSettingsPage>());
|
||||
|
||||
case Routes.newNode:
|
||||
final args = settings.arguments as Map<String, dynamic>?;
|
||||
return CupertinoPageRoute<void>(
|
||||
builder: (_) => getIt.get<NodeCreateOrEditPage>(
|
||||
param1: args?['editingNode'] as Node?,
|
||||
param2: args?['isSelected'] as bool?));
|
||||
|
||||
|
||||
param1: args?['editingNode'] as Node?, param2: args?['isSelected'] as bool?));
|
||||
|
||||
case Routes.accountCreation:
|
||||
return CupertinoPageRoute<String>(
|
||||
|
@ -351,8 +327,7 @@ Route<dynamic> createRoute(RouteSettings settings) {
|
|||
|
||||
case Routes.addressBook:
|
||||
return MaterialPageRoute<void>(
|
||||
fullscreenDialog: true,
|
||||
builder: (_) => getIt.get<ContactListPage>());
|
||||
fullscreenDialog: true, builder: (_) => getIt.get<ContactListPage>());
|
||||
|
||||
case Routes.pickerAddressBook:
|
||||
final selectedCurrency = settings.arguments as CryptoCurrency?;
|
||||
|
@ -361,31 +336,26 @@ Route<dynamic> createRoute(RouteSettings settings) {
|
|||
|
||||
case Routes.addressBookAddContact:
|
||||
return CupertinoPageRoute<void>(
|
||||
builder: (_) => getIt.get<ContactPage>(
|
||||
param1: settings.arguments as ContactRecord?));
|
||||
builder: (_) => getIt.get<ContactPage>(param1: settings.arguments as ContactRecord?));
|
||||
|
||||
case Routes.showKeys:
|
||||
return MaterialPageRoute<void>(
|
||||
builder: (_) => getIt.get<WalletKeysPage>(), fullscreenDialog: true);
|
||||
|
||||
case Routes.exchangeTrade:
|
||||
return CupertinoPageRoute<void>(
|
||||
builder: (_) => getIt.get<ExchangeTradePage>());
|
||||
return CupertinoPageRoute<void>(builder: (_) => getIt.get<ExchangeTradePage>());
|
||||
|
||||
case Routes.exchangeConfirm:
|
||||
return MaterialPageRoute<void>(
|
||||
builder: (_) => getIt.get<ExchangeConfirmPage>());
|
||||
return MaterialPageRoute<void>(builder: (_) => getIt.get<ExchangeConfirmPage>());
|
||||
|
||||
case Routes.tradeDetails:
|
||||
return MaterialPageRoute<void>(
|
||||
fullscreenDialog: true,
|
||||
builder: (_) =>
|
||||
getIt.get<TradeDetailsPage>(param1: settings.arguments as Trade));
|
||||
builder: (_) => getIt.get<TradeDetailsPage>(param1: settings.arguments as Trade));
|
||||
|
||||
case Routes.orderDetails:
|
||||
return MaterialPageRoute<void>(
|
||||
builder: (_) =>
|
||||
getIt.get<OrderDetailsPage>(param1: settings.arguments as Order));
|
||||
builder: (_) => getIt.get<OrderDetailsPage>(param1: settings.arguments as Order));
|
||||
|
||||
case Routes.buy:
|
||||
return MaterialPageRoute<void>(builder: (_) => getIt.get<BuyOptionsPage>());
|
||||
|
@ -394,18 +364,14 @@ Route<dynamic> createRoute(RouteSettings settings) {
|
|||
final args = settings.arguments as List;
|
||||
|
||||
return MaterialPageRoute<void>(
|
||||
fullscreenDialog: true,
|
||||
builder: (_) =>
|
||||
getIt.get<BuyWebViewPage>(param1: args));
|
||||
fullscreenDialog: true, builder: (_) => getIt.get<BuyWebViewPage>(param1: args));
|
||||
|
||||
case Routes.exchange:
|
||||
return CupertinoPageRoute<void>(
|
||||
fullscreenDialog: true,
|
||||
builder: (_) => getIt.get<ExchangePage>());
|
||||
fullscreenDialog: true, builder: (_) => getIt.get<ExchangePage>());
|
||||
|
||||
case Routes.exchangeTemplate:
|
||||
return CupertinoPageRoute<void>(
|
||||
builder: (_) => getIt.get<ExchangeTemplatePage>());
|
||||
return CupertinoPageRoute<void>(builder: (_) => getIt.get<ExchangeTemplatePage>());
|
||||
|
||||
case Routes.rescan:
|
||||
return MaterialPageRoute<void>(builder: (_) => getIt.get<RescanPage>());
|
||||
|
@ -415,51 +381,41 @@ Route<dynamic> createRoute(RouteSettings settings) {
|
|||
|
||||
case Routes.preSeed:
|
||||
return MaterialPageRoute<void>(
|
||||
builder: (_) =>
|
||||
getIt.get<PreSeedPage>(param1: settings.arguments as WalletType));
|
||||
builder: (_) => getIt.get<PreSeedPage>(param1: settings.arguments as WalletType));
|
||||
|
||||
case Routes.backup:
|
||||
return CupertinoPageRoute<void>(
|
||||
fullscreenDialog: true, builder: (_) => getIt.get<BackupPage>());
|
||||
|
||||
case Routes.editBackupPassword:
|
||||
return CupertinoPageRoute<void>(
|
||||
builder: (_) => getIt.get<EditBackupPasswordPage>());
|
||||
return CupertinoPageRoute<void>(builder: (_) => getIt.get<EditBackupPasswordPage>());
|
||||
|
||||
case Routes.restoreFromBackup:
|
||||
return CupertinoPageRoute<void>(
|
||||
fullscreenDialog: true,
|
||||
builder: (_) => getIt.get<RestoreFromBackupPage>());
|
||||
fullscreenDialog: true, builder: (_) => getIt.get<RestoreFromBackupPage>());
|
||||
|
||||
case Routes.support:
|
||||
return CupertinoPageRoute<void>(
|
||||
builder: (_) => getIt.get<SupportPage>());
|
||||
return CupertinoPageRoute<void>(builder: (_) => getIt.get<SupportPage>());
|
||||
|
||||
case Routes.supportLiveChat:
|
||||
return CupertinoPageRoute<void>(
|
||||
builder: (_) => getIt.get<SupportChatPage>());
|
||||
return CupertinoPageRoute<void>(builder: (_) => getIt.get<SupportChatPage>());
|
||||
|
||||
case Routes.supportOtherLinks:
|
||||
return CupertinoPageRoute<void>(
|
||||
fullscreenDialog: true,
|
||||
builder: (_) => getIt.get<SupportOtherLinksPage>());
|
||||
fullscreenDialog: true, builder: (_) => getIt.get<SupportOtherLinksPage>());
|
||||
|
||||
case Routes.unspentCoinsList:
|
||||
return MaterialPageRoute<void>(
|
||||
builder: (_) => getIt.get<UnspentCoinsListPage>());
|
||||
return MaterialPageRoute<void>(builder: (_) => getIt.get<UnspentCoinsListPage>());
|
||||
|
||||
case Routes.unspentCoinsDetails:
|
||||
final args = settings.arguments as List;
|
||||
|
||||
return MaterialPageRoute<void>(
|
||||
builder: (_) =>
|
||||
getIt.get<UnspentCoinsDetailsPage>(
|
||||
param1: args));
|
||||
builder: (_) => getIt.get<UnspentCoinsDetailsPage>(param1: args));
|
||||
|
||||
case Routes.fullscreenQR:
|
||||
return MaterialPageRoute<void>(
|
||||
builder: (_) =>
|
||||
getIt.get<FullscreenQRPage>(
|
||||
builder: (_) => getIt.get<FullscreenQRPage>(
|
||||
param1: settings.arguments as QrViewData,
|
||||
));
|
||||
|
||||
|
@ -470,26 +426,27 @@ Route<dynamic> createRoute(RouteSettings settings) {
|
|||
);
|
||||
|
||||
case Routes.ioniaLoginPage:
|
||||
return CupertinoPageRoute<void>( builder: (_) => getIt.get<IoniaLoginPage>());
|
||||
return CupertinoPageRoute<void>(builder: (_) => getIt.get<IoniaLoginPage>());
|
||||
|
||||
case Routes.ioniaCreateAccountPage:
|
||||
return CupertinoPageRoute<void>( builder: (_) => getIt.get<IoniaCreateAccountPage>());
|
||||
return CupertinoPageRoute<void>(builder: (_) => getIt.get<IoniaCreateAccountPage>());
|
||||
|
||||
case Routes.ioniaManageCardsPage:
|
||||
return CupertinoPageRoute<void>(
|
||||
builder: (_) => getIt.get<IoniaManageCardsPage>());
|
||||
return CupertinoPageRoute<void>(builder: (_) => getIt.get<IoniaManageCardsPage>());
|
||||
|
||||
case Routes.ioniaBuyGiftCardPage:
|
||||
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:
|
||||
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:
|
||||
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:
|
||||
return CupertinoPageRoute<void>(builder: (_) => getIt.get<IoniaDebitCardPage>());
|
||||
|
@ -505,57 +462,60 @@ Route<dynamic> createRoute(RouteSettings settings) {
|
|||
|
||||
case Routes.ioniaCustomTipPage:
|
||||
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:
|
||||
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:
|
||||
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:
|
||||
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:
|
||||
final args = settings.arguments as List;
|
||||
final paymentInfo = args.first as IoniaAnyPayPaymentInfo;
|
||||
final commitedInfo = args[1] as AnyPayPaymentCommittedInfo;
|
||||
return CupertinoPageRoute<void>(builder: (_) => getIt.get<IoniaPaymentStatusPage>(
|
||||
param1: paymentInfo,
|
||||
param2: commitedInfo));
|
||||
return CupertinoPageRoute<void>(
|
||||
builder: (_) =>
|
||||
getIt.get<IoniaPaymentStatusPage>(param1: paymentInfo, param2: commitedInfo));
|
||||
|
||||
case Routes.webViewPage:
|
||||
final args = settings.arguments as List;
|
||||
final title = args.first as String;
|
||||
final url = args[1] as Uri;
|
||||
return CupertinoPageRoute<void>(builder: (_) => getIt.get<WebViewPage>(
|
||||
param1: title,
|
||||
param2: url));
|
||||
return CupertinoPageRoute<void>(
|
||||
builder: (_) => getIt.get<WebViewPage>(param1: title, param2: url));
|
||||
|
||||
case Routes.advancedPrivacySettings:
|
||||
final type = settings.arguments as WalletType;
|
||||
|
||||
return CupertinoPageRoute<void>(
|
||||
builder: (_) => AdvancedPrivacySettingsPage(
|
||||
getIt.get<AdvancedPrivacySettingsViewModel>(param1: type),
|
||||
getIt.get<NodeCreateOrEditViewModel>(param1: type),
|
||||
));
|
||||
getIt.get<AdvancedPrivacySettingsViewModel>(param1: type),
|
||||
getIt.get<NodeCreateOrEditViewModel>(param1: type),
|
||||
));
|
||||
|
||||
case Routes.anonPayInvoicePage:
|
||||
final args = settings.arguments as List;
|
||||
return CupertinoPageRoute<void>(
|
||||
builder: (_) => getIt.get<AnonPayInvoicePage>(param1: args));
|
||||
return CupertinoPageRoute<void>(builder: (_) => getIt.get<AnonPayInvoicePage>(param1: args));
|
||||
|
||||
case Routes.anonPayReceivePage:
|
||||
final anonInvoiceViewData = settings.arguments as AnonpayInfoBase;
|
||||
return CupertinoPageRoute<void>(builder: (_) => getIt.get<AnonPayReceivePage>(param1: anonInvoiceViewData));
|
||||
final anonInvoiceViewData = settings.arguments as AnonpayInfoBase;
|
||||
return CupertinoPageRoute<void>(
|
||||
builder: (_) => getIt.get<AnonPayReceivePage>(param1: anonInvoiceViewData));
|
||||
|
||||
case Routes.anonPayDetailsPage:
|
||||
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:
|
||||
return PageRouteBuilder(
|
||||
|
@ -564,12 +524,10 @@ Route<dynamic> createRoute(RouteSettings settings) {
|
|||
);
|
||||
|
||||
case Routes.desktop_settings_page:
|
||||
return CupertinoPageRoute<void>(
|
||||
builder: (_) => DesktopSettingsPage());
|
||||
return CupertinoPageRoute<void>(builder: (_) => DesktopSettingsPage());
|
||||
|
||||
case Routes.empty_no_route:
|
||||
return MaterialPageRoute<void>(
|
||||
builder: (_) => SizedBox.shrink());
|
||||
return MaterialPageRoute<void>(builder: (_) => SizedBox.shrink());
|
||||
|
||||
case Routes.transactionsPage:
|
||||
return CupertinoPageRoute<void>(
|
||||
|
@ -609,24 +567,25 @@ Route<dynamic> createRoute(RouteSettings settings) {
|
|||
return MaterialPageRoute<void>(builder: (_) => getIt.get<ManageNodesPage>());
|
||||
|
||||
case Routes.havenRemovalNoticePage:
|
||||
final args = settings.arguments as List;
|
||||
|
||||
final wallet = args.first as WalletBase;
|
||||
final isFromHavenRemovalAtStartFlow = args[1];
|
||||
|
||||
return CupertinoPageRoute<void>(
|
||||
builder: (_) => getIt.get<HavenRemovalNoticePage>(param1: settings.arguments as WalletBase),
|
||||
builder: (_) => getIt.get<HavenRemovalNoticePage>(param1: wallet, param2: isFromHavenRemovalAtStartFlow),
|
||||
);
|
||||
|
||||
case Routes.havenRemovalSeedPage:
|
||||
final args = settings.arguments as List;
|
||||
final wallet = args.first as WalletBase;
|
||||
final havenRemovalViewModel = args[1] as HavenRemovalViewModel;
|
||||
final args = settings.arguments as HavenRemovalFlowParameters;
|
||||
|
||||
return CupertinoPageRoute<void>(
|
||||
builder: (_) =>
|
||||
getIt.get<HavenRemovalSeedPage>(param1: wallet, param2: havenRemovalViewModel),
|
||||
builder: (_) => getIt.get<HavenRemovalSeedPage>(param1: args),
|
||||
);
|
||||
|
||||
default:
|
||||
return MaterialPageRoute<void>(
|
||||
builder: (_) => Scaffold(
|
||||
body: Center(
|
||||
child: Text(S.current.router_no_route(settings.name ?? 'No route')))));
|
||||
body: Center(child: Text(S.current.router_no_route(settings.name ?? 'No route')))));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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/themes/extensions/cake_text_theme.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/routes.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';
|
||||
|
||||
class HavenRemovalNoticePage extends BasePage {
|
||||
HavenRemovalNoticePage(this.wallet, this.viewModel)
|
||||
HavenRemovalNoticePage(this.params)
|
||||
: imageLight = Image.asset('assets/images/pre_seed_light.png'),
|
||||
imageDark = Image.asset('assets/images/pre_seed_dark.png');
|
||||
|
||||
final Image imageDark;
|
||||
final Image imageLight;
|
||||
|
||||
final WalletBase wallet;
|
||||
final HavenRemovalViewModel viewModel;
|
||||
final HavenRemovalFlowParameters params;
|
||||
|
||||
@override
|
||||
Widget? leading(BuildContext context) => null;
|
||||
|
@ -30,53 +28,50 @@ class HavenRemovalNoticePage extends BasePage {
|
|||
Widget body(BuildContext context) {
|
||||
final image = currentTheme.type == ThemeType.dark ? imageDark : imageLight;
|
||||
|
||||
return WillPopScope(
|
||||
onWillPop: () async => false,
|
||||
child: Container(
|
||||
alignment: Alignment.center,
|
||||
padding: EdgeInsets.all(24),
|
||||
child: ConstrainedBox(
|
||||
constraints: BoxConstraints(maxWidth: ResponsiveLayoutUtil.kDesktopMaxWidthConstraint),
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: <Widget>[
|
||||
ConstrainedBox(
|
||||
constraints: BoxConstraints(maxHeight: MediaQuery.of(context).size.height * 0.3),
|
||||
child: AspectRatio(aspectRatio: 1, child: image),
|
||||
),
|
||||
Column(
|
||||
children: [
|
||||
Text(
|
||||
S.current.havenSupportNotice,
|
||||
style: TextStyle(
|
||||
fontSize: 18.0,
|
||||
fontWeight: FontWeight.bold,
|
||||
fontFamily: 'Lato',
|
||||
color: titleColor(context),
|
||||
),
|
||||
textAlign: TextAlign.center,
|
||||
return Container(
|
||||
alignment: Alignment.center,
|
||||
padding: EdgeInsets.all(24),
|
||||
child: ConstrainedBox(
|
||||
constraints: BoxConstraints(maxWidth: ResponsiveLayoutUtil.kDesktopMaxWidthConstraint),
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: <Widget>[
|
||||
ConstrainedBox(
|
||||
constraints: BoxConstraints(maxHeight: MediaQuery.of(context).size.height * 0.3),
|
||||
child: AspectRatio(aspectRatio: 1, child: image),
|
||||
),
|
||||
Column(
|
||||
children: [
|
||||
Text(
|
||||
S.current.havenSupportNotice,
|
||||
style: TextStyle(
|
||||
fontSize: 18.0,
|
||||
fontWeight: FontWeight.bold,
|
||||
fontFamily: 'Lato',
|
||||
color: titleColor(context),
|
||||
),
|
||||
SizedBox(height: 8),
|
||||
Text(
|
||||
S.current.havenSupportSeedsNotice,
|
||||
textAlign: TextAlign.center,
|
||||
style: TextStyle(
|
||||
fontSize: 14,
|
||||
fontWeight: FontWeight.normal,
|
||||
color: Theme.of(context).extension<CakeTextTheme>()!.secondaryTextColor,
|
||||
),
|
||||
textAlign: TextAlign.center,
|
||||
),
|
||||
SizedBox(height: 8),
|
||||
Text(
|
||||
S.current.havenSupportSeedsNotice,
|
||||
textAlign: TextAlign.center,
|
||||
style: TextStyle(
|
||||
fontSize: 14,
|
||||
fontWeight: FontWeight.normal,
|
||||
color: Theme.of(context).extension<CakeTextTheme>()!.secondaryTextColor,
|
||||
),
|
||||
],
|
||||
),
|
||||
PrimaryButton(
|
||||
onPressed: () => Navigator.of(context)
|
||||
.pushNamed(Routes.havenRemovalSeedPage, arguments: [wallet, viewModel]),
|
||||
text: S.of(context).pre_seed_button_text,
|
||||
color: Theme.of(context).primaryColor,
|
||||
textColor: Colors.white,
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
PrimaryButton(
|
||||
onPressed: () => Navigator.of(context)
|
||||
.popAndPushNamed(Routes.havenRemovalSeedPage, arguments: params),
|
||||
text: S.of(context).pre_seed_button_text,
|
||||
color: Theme.of(context).primaryColor,
|
||||
textColor: Colors.white,
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
|
|
|
@ -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/pin_code_theme.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';
|
||||
|
||||
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 imageDark = Image.asset('assets/images/crypto_lock.png');
|
||||
|
||||
final HavenRemovalFlowParameters params;
|
||||
|
||||
final WalletBase wallet;
|
||||
final bool isFromRemoveHavenAppStartFlow;
|
||||
final HavenRemovalViewModel havenRemovalViewModel;
|
||||
|
||||
@override
|
||||
|
@ -30,7 +37,7 @@ class HavenRemovalSeedPage extends BasePage {
|
|||
|
||||
@override
|
||||
void onClose(BuildContext context) async {
|
||||
await showPopUp<bool>(
|
||||
final shouldPopBack = await showPopUp<bool>(
|
||||
context: context,
|
||||
builder: (BuildContext context) {
|
||||
return AlertWithTwoActions(
|
||||
|
@ -39,12 +46,17 @@ class HavenRemovalSeedPage extends BasePage {
|
|||
leftButtonText: S.of(context).seed_alert_back,
|
||||
rightButtonText: S.of(context).seed_alert_yes,
|
||||
actionLeftButton: () => Navigator.of(context).pop(false),
|
||||
actionRightButton: () async => await havenRemovalViewModel.onSeedsCopiedConfirmed(),
|
||||
actionRightButton: () async =>
|
||||
await havenRemovalViewModel.onSeedsCopiedConfirmed(isFromRemoveHavenAppStartFlow),
|
||||
);
|
||||
},
|
||||
) ??
|
||||
false;
|
||||
|
||||
if (shouldPopBack) {
|
||||
Navigator.of(context).pop();
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -80,103 +92,99 @@ class HavenRemovalSeedPage extends BasePage {
|
|||
Widget body(BuildContext context) {
|
||||
final image = currentTheme.type == ThemeType.dark ? imageDark : imageLight;
|
||||
|
||||
return WillPopScope(
|
||||
onWillPop: () async => false,
|
||||
child: Container(
|
||||
padding: EdgeInsets.all(24),
|
||||
alignment: Alignment.center,
|
||||
child: ConstrainedBox(
|
||||
constraints: BoxConstraints(maxWidth: ResponsiveLayoutUtil.kDesktopMaxWidthConstraint),
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: <Widget>[
|
||||
ConstrainedBox(
|
||||
constraints: BoxConstraints(maxHeight: MediaQuery.of(context).size.height * 0.3),
|
||||
child: AspectRatio(aspectRatio: 1, child: image),
|
||||
),
|
||||
Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: <Widget>[
|
||||
Text(
|
||||
wallet.name,
|
||||
return Container(
|
||||
padding: EdgeInsets.all(24),
|
||||
alignment: Alignment.center,
|
||||
child: ConstrainedBox(
|
||||
constraints: BoxConstraints(maxWidth: ResponsiveLayoutUtil.kDesktopMaxWidthConstraint),
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: <Widget>[
|
||||
ConstrainedBox(
|
||||
constraints: BoxConstraints(maxHeight: MediaQuery.of(context).size.height * 0.3),
|
||||
child: AspectRatio(aspectRatio: 1, child: image),
|
||||
),
|
||||
Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: <Widget>[
|
||||
Text(
|
||||
wallet.name,
|
||||
style: TextStyle(
|
||||
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(
|
||||
fontSize: 20,
|
||||
fontWeight: FontWeight.w600,
|
||||
color: Theme.of(context).extension<CakeTextTheme>()!.titleColor,
|
||||
fontSize: 14,
|
||||
fontWeight: FontWeight.normal,
|
||||
color: Theme.of(context).extension<CakeTextTheme>()!.secondaryTextColor,
|
||||
),
|
||||
),
|
||||
Padding(
|
||||
padding: EdgeInsets.only(top: 20, left: 16, right: 16),
|
||||
child: Text(
|
||||
wallet.seed ?? '',
|
||||
textAlign: TextAlign.center,
|
||||
style: TextStyle(
|
||||
fontSize: 14,
|
||||
fontWeight: FontWeight.normal,
|
||||
color: Theme.of(context).extension<CakeTextTheme>()!.secondaryTextColor,
|
||||
),
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
Column(
|
||||
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,
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
Column(
|
||||
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,
|
||||
children: <Widget>[
|
||||
Flexible(
|
||||
child: Container(
|
||||
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(
|
||||
),
|
||||
Row(
|
||||
mainAxisSize: MainAxisSize.max,
|
||||
children: <Widget>[
|
||||
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,
|
||||
),
|
||||
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(
|
||||
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,
|
||||
),
|
||||
),
|
||||
)
|
||||
],
|
||||
)
|
||||
],
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
)
|
||||
],
|
||||
)
|
||||
],
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
|
|
|
@ -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/core/auth_service.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));
|
||||
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, false]);
|
||||
}
|
||||
|
||||
void changeProcessText(String text) {
|
||||
|
|
|
@ -18,10 +18,15 @@ class HavenRemovalViewModel {
|
|||
final Box<WalletInfo> walletInfoSource;
|
||||
final WalletLoadingService walletLoadingService;
|
||||
|
||||
Future<void> onSeedsCopiedConfirmed() async {
|
||||
Future<bool> onSeedsCopiedConfirmed(bool isFromStart) async {
|
||||
if (walletInfoSource.length == 1) {
|
||||
_navigateToWelcomePage();
|
||||
return;
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!isFromStart) {
|
||||
goBack();
|
||||
return true;
|
||||
}
|
||||
|
||||
final walletInfo = _getFirstNonHavenWallet();
|
||||
|
@ -31,6 +36,8 @@ class HavenRemovalViewModel {
|
|||
_changeWallet(wallet);
|
||||
|
||||
await _navigateToDashboardPage();
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
WalletInfo _getFirstNonHavenWallet() {
|
||||
|
@ -56,4 +63,8 @@ class HavenRemovalViewModel {
|
|||
await navigatorKey.currentState!.pushNamedAndRemoveUntil(Routes.welcome, (route) => false);
|
||||
return;
|
||||
}
|
||||
|
||||
void goBack() {
|
||||
navigatorKey.currentState!.pop(true);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue