Change screen for new wallets for monero.com app

M committed Jan 3, 2022 at 20:25 UTC 800c3ec14ae517cb1440ad442f8aed6f78db10b1
4 files changed +19 -7
lib/router.dart
+8 -3
@@ -67,6 +67,7 @@ import 'package:cake_wallet/src/screens/exchange_trade/exchange_confirm_page.dar
67 import 'package:cake_wallet/src/screens/exchange_trade/exchange_trade_page.dart';
68 import 'package:flutter/services.dart';
69 import 'package:hive/hive.dart';
70 +import 'package:cake_wallet/wallet_type_utils.dart';
71
72 RouteSettings currentRouteSettings;
73
@@ -80,9 +81,13 @@ Route<dynamic> createRoute(RouteSettings settings) {
81 case Routes.newWalletFromWelcome:
82 return CupertinoPageRoute<void>(
83 builder: (_) => getIt.get<SetupPinCodePage>(
83 - param1: (PinCodeState<PinCodeWidget> context, dynamic _) =>
84 - Navigator.of(context.context)
85 - .pushNamed(Routes.newWalletType)),
84 + param1: (PinCodeState<PinCodeWidget> context, dynamic _) {
85 + if (isMoneroOnly) {
86 + Navigator.of(context.context).pushNamed(Routes.newWallet, arguments: WalletType.monero);
87 + } else {
88 + Navigator.of(context.context).pushNamed(Routes.newWalletType);
89 + }
90 + }),
91 fullscreenDialog: true);
92
93 case Routes.newWalletType:
lib/src/screens/new_wallet/new_wallet_page.dart
+1 -1
@@ -60,7 +60,7 @@ class _WalletNameFormState extends State<WalletNameForm> {
60 _stateReaction ??=
61 reaction((_) => _walletNewVM.state, (ExecutionState state) {
62 if (state is ExecutedSuccessfullyState) {
63 - Navigator.of(context).pushNamed(Routes.seed, arguments: true);
63 + Navigator.of(context).pushNamed(Routes.preSeed, arguments: _walletNewVM.type);
64 }
65
66 if (state is FailureState) {
lib/src/screens/wallet_list/wallet_list_page.dart
+7 -2
@@ -173,8 +173,13 @@ class WalletListBodyState extends State<WalletListBody> {
173 EdgeInsets.only(bottom: 24, right: 24, left: 24),
174 bottomSection: Column(children: <Widget>[
175 PrimaryImageButton(
176 - onPressed: () =>
177 - Navigator.of(context).pushNamed(Routes.newWalletType),
176 + onPressed: () {
177 + if (isMoneroOnly) {
178 + Navigator.of(context).pushNamed(Routes.newWallet, arguments: WalletType.monero);
179 + } else {
180 + Navigator.of(context).pushNamed(Routes.newWalletType);
181 + }
182 + },
183 image: newWalletImage,
184 text: S.of(context).wallet_list_create_new_wallet,
185 color: Theme.of(context).accentTextTheme.body2.color,
lib/view_model/wallet_creation_vm.dart
+3 -1
@@ -35,7 +35,9 @@ abstract class WalletCreationVMBase with Store {
35 Future<void> create({dynamic options}) async {
36 try {
37 state = IsExecutingState();
38 - name = await generateName();
38 + if (name?.isEmpty ?? true) {
39 + name = await generateName();
40 + }
41 final dirPath = await pathForWalletDir(name: name, type: type);
42 final path = await pathForWallet(name: name, type: type);
43 final credentials = getCredentials(options);