Fixes for monero only app version.

M committed Dec 30, 2021 at 19:20 UTC 226d546d5540aa5493de3e3f5563fe56ab71f7a8
25 files changed +176 -102
lib/router.dart
+8
@@ -111,6 +111,14 @@ Route<dynamic> createRoute(RouteSettings settings) {
111 return CupertinoPageRoute<void>(
112 builder: (_) => getIt.get<SetupPinCodePage>(param1: callback));
113
114 + case Routes.moneroRestoreWalletFromWelcome:
115 + return CupertinoPageRoute<void>(
116 + builder: (_) => getIt.get<SetupPinCodePage>(
117 + param1: (PinCodeState<PinCodeWidget> context, dynamic _) =>
118 + Navigator.pushNamed(
119 + context.context, Routes.restoreWallet, arguments: WalletType.monero)),
120 + fullscreenDialog: true);
121 +
122 case Routes.restoreWalletType:
123 return CupertinoPageRoute<void>(
124 builder: (_) => getIt.get<NewWalletTypePage>(
lib/routes.dart
+2
@@ -57,4 +57,6 @@ class Routes {
57 static const buyWebView = '/buy_web_view';
58 static const unspentCoinsList = '/unspent_coins_list';
59 static const unspentCoinsDetails = '/unspent_coins_details';
60 + static const moneroRestoreWalletFromWelcome = '/monero_restore_wallet';
61 + static const moneroNewWalletFromWelcome = '/monero_new_wallet';
62 }
\ No newline at end of file
lib/src/screens/dashboard/dashboard_page.dart
+29 -26
@@ -26,6 +26,7 @@ import 'package:cake_wallet/main.dart';
26 import 'package:cake_wallet/router.dart';
27 import 'package:cake_wallet/buy/moonpay/moonpay_buy_provider.dart';
28 import 'package:url_launcher/url_launcher.dart';
29 +import 'package:cake_wallet/wallet_type_utils.dart';
30
31 class DashboardPage extends BasePage {
32 DashboardPage({
@@ -144,17 +145,19 @@ class DashboardPage extends BasePage {
145 image: exchangeImage,
146 title: S.of(context).exchange,
147 route: Routes.exchange),
147 - ActionButton(
148 - image: buyImage,
149 - title: S.of(context).buy,
150 - onClick: () async =>
151 - await _onClickBuyButton(context),
152 - ),
153 - ActionButton(
154 - image: sellImage,
155 - title: 'Sell',
156 - onClick: () async =>
157 - await _onClickSellButton(context),
148 + if (isMoneroOnly)
149 + ActionButton(
150 + image: buyImage,
151 + title: S.of(context).buy,
152 + onClick: () async =>
153 + await _onClickBuyButton(context),
154 + ),
155 + if (isMoneroOnly)
156 + ActionButton(
157 + image: sellImage,
158 + title: 'Sell',
159 + onClick: () async =>
160 + await _onClickSellButton(context),
161 ),
162 ],
163 ),
@@ -174,23 +177,23 @@ class DashboardPage extends BasePage {
177 pages.add(TransactionsPage(dashboardViewModel: walletViewModel));
178 _isEffectsInstalled = true;
179
177 - if (walletViewModel.shouldShowYatPopup) {
178 - await Future<void>.delayed(Duration(seconds: 1));
180 + //if (walletViewModel.shouldShowYatPopup) {
181 + // await Future<void>.delayed(Duration(seconds: 1));
182
180 - if (currentRouteSettings.name == Routes.preSeed
181 - || currentRouteSettings.name == Routes.seed) {
182 - return;
183 - }
183 + // if (currentRouteSettings.name == Routes.preSeed
184 + // || currentRouteSettings.name == Routes.seed) {
185 + // return;
186 + // }
187
185 - await showPopUp<void>(
186 - context: context,
187 - builder: (BuildContext context) {
188 - return YatPopup(
189 - dashboardViewModel: walletViewModel,
190 - onClose: () => Navigator.of(context).pop());
191 - });
192 - walletViewModel.furtherShowYatPopup(false);
193 - }
188 + // await showPopUp<void>(
189 + // context: context,
190 + // builder: (BuildContext context) {
191 + // return YatPopup(
192 + // dashboardViewModel: walletViewModel,
193 + // onClose: () => Navigator.of(context).pop());
194 + // });
195 + // walletViewModel.furtherShowYatPopup(false);
196 + //}
197
198 autorun((_) async {
199 if (!walletViewModel.isOutdatedElectrumWallet) {
lib/src/screens/dashboard/wallet_menu.dart
+8 -6
@@ -6,6 +6,7 @@ import 'package:cake_wallet/routes.dart';
6 import 'package:cake_wallet/generated/i18n.dart';
7 import 'package:cake_wallet/src/screens/auth/auth_page.dart';
8 import 'package:cake_wallet/src/widgets/alert_with_two_actions.dart';
9 +import 'package:cake_wallet/wallet_type_utils.dart';
10
11 // FIXME: terrible design
12
@@ -37,12 +38,13 @@ class WalletMenu {
38 title: S.current.address_book_menu,
39 image: Image.asset('assets/images/open_book_menu.png',
40 height: 16, width: 16)),
40 - WalletMenuItem(
41 - title: S.current.backup,
42 - image: Image.asset('assets/images/restore_wallet.png',
43 - height: 16,
44 - width: 16,
45 - color: Palette.darkBlue)),
41 + if(!isMonerOnly)
42 + WalletMenuItem(
43 + title: S.current.backup,
44 + image: Image.asset('assets/images/restore_wallet.png',
45 + height: 16,
46 + width: 16,
47 + color: Palette.darkBlue)),
48 WalletMenuItem(
49 title: S.current.settings_title,
50 image: Image.asset('assets/images/settings_menu.png',
lib/src/screens/wallet_list/wallet_list_page.dart
+12 -2
@@ -15,6 +15,7 @@ import 'package:cake_wallet/src/widgets/primary_button.dart';
15 import 'package:cake_wallet/src/screens/base_page.dart';
16 import 'package:cake_wallet/src/widgets/scollable_with_bottom_section.dart';
17 import 'package:flutter_slidable/flutter_slidable.dart';
18 +import 'package:cake_wallet/wallet_type_utils.dart';
19
20 class WalletListPage extends BasePage {
21 WalletListPage({this.walletListViewModel});
@@ -181,8 +182,17 @@ class WalletListBodyState extends State<WalletListBody> {
182 ),
183 SizedBox(height: 10.0),
184 PrimaryImageButton(
184 - onPressed: () =>
185 - Navigator.of(context).pushNamed(Routes.restoreWalletType),
185 + onPressed: () {
186 + if (isMoneroOnly) {
187 + Navigator
188 + .of(context)
189 + .pushNamed(
190 + Routes.restoreWallet,
191 + arguments: widget.walletListViewModel.currentWalletType);
192 + } else {
193 + Navigator.of(context).pushNamed(Routes.restoreWalletType);
194 + }
195 + },
196 image: restoreWalletImage,
197 text: S.of(context).wallet_list_restore_wallet,
198 color: Theme.of(context).accentTextTheme.caption.color,
lib/src/screens/welcome/welcome_page.dart
+15 -9
@@ -4,6 +4,7 @@ import 'package:cake_wallet/routes.dart';
4 import 'package:cake_wallet/src/widgets/primary_button.dart';
5 import 'package:cake_wallet/src/screens/base_page.dart';
6 import 'package:cake_wallet/generated/i18n.dart';
7 +import 'package:cake_wallet/wallet_type_utils.dart';
8
9 class WelcomePage extends BasePage {
10 static const aspectRatioImage = 1.25;
@@ -82,9 +83,9 @@ class WelcomePage extends BasePage {
83 Padding(
84 padding: EdgeInsets.only(top: 5),
85 child: Text(
85 - S
86 - .of(context)
87 - .cake_wallet,
86 + isMoneroOnly
87 + ? S.of(context).monero_com
88 + : S.of(context).cake_wallet,
89 style: TextStyle(
90 fontSize: 36,
91 fontWeight: FontWeight.bold,
@@ -100,9 +101,9 @@ class WelcomePage extends BasePage {
101 Padding(
102 padding: EdgeInsets.only(top: 5),
103 child: Text(
103 - S
104 - .of(context)
105 - .first_wallet_text,
104 + isMoneroOnly
105 + ? S.of(context).monero_com_wallet_text
106 + : S.of(context).first_wallet_text,
107 style: TextStyle(
108 fontSize: 16,
109 fontWeight: FontWeight.w500,
@@ -159,9 +160,14 @@ class WelcomePage extends BasePage {
160 Padding(
161 padding: EdgeInsets.only(top: 10),
162 child: PrimaryImageButton(
162 - onPressed: () =>
163 - Navigator.pushNamed(context,
164 - Routes.restoreOptions),
163 + onPressed: () {
164 + if (isMoneroOnly) {
165 + Navigator.of(context).pushNamed(Routes.moneroRestoreWalletFromWelcome);
166 + } else {
167 + Navigator.pushNamed(context,
168 + Routes.restoreOptions);
169 + }
170 + },
171 image: restoreWalletImage,
172 text: S
173 .of(context)
lib/view_model/settings/settings_view_model.dart
+17 -17
@@ -183,23 +183,23 @@ abstract class SettingsViewModelBase with Store {
183 onItemSelected: (ThemeBase theme) =>
184 _settingsStore.currentTheme = theme)
185 ],
186 - [
187 - if (_yatStore.emoji.isNotEmpty) ...[
188 - LinkListItem(
189 - title: S.current.manage_yats,
190 - link: manageYatUrl,
191 - linkTitle: ''),
192 - ] else ...[
193 - LinkListItem(
194 - title: S.current.connect_yats,
195 - link: connectYatUrl,
196 - linkTitle: ''),
197 - LinkListItem(
198 - title: 'Create new Yats',
199 - link: createNewYatUrl,
200 - linkTitle: '')
201 - ]
202 - ],
186 + //[
187 + //if (_yatStore.emoji.isNotEmpty) ...[
188 + // LinkListItem(
189 + // title: S.current.manage_yats,
190 + // link: manageYatUrl,
191 + // linkTitle: ''),
192 + //] else ...[
193 + //LinkListItem(
194 + // title: S.current.connect_yats,
195 + // link: connectYatUrl,
196 + // linkTitle: ''),
197 + //LinkListItem(
198 + // title: 'Create new Yats',
199 + // link: createNewYatUrl,
200 + // linkTitle: '')
201 + //]
202 + //],
203 [
204 RegularListItem(
205 title: S.current.settings_terms_and_conditions,
lib/view_model/support_view_model.dart
+20 -17
@@ -6,6 +6,7 @@ import 'package:flutter/cupertino.dart';
6 import 'package:flutter/material.dart';
7 import 'package:mobx/mobx.dart';
8 import 'package:url_launcher/url_launcher.dart';
9 +import 'package:cake_wallet/wallet_type_utils.dart';
10
11 part 'support_view_model.g.dart';
12
@@ -49,23 +50,25 @@ abstract class SupportViewModelBase with Store {
50 icon: 'assets/images/change_now.png',
51 linkTitle: 'support@changenow.io',
52 link: 'mailto:support@changenow.io'),
52 - LinkListItem(
53 - title: 'Wyre',
54 - icon: 'assets/images/wyre.png',
55 - linkTitle: S.current.submit_request,
56 - link: 'https://wyre-support.zendesk.com/hc/en-us/requests/new'),
57 - LinkListItem(
58 - title: 'MoonPay',
59 - icon: 'assets/images/moonpay.png',
60 - hasIconColor: true,
61 - linkTitle: S.current.submit_request,
62 - link: 'https://support.moonpay.com/hc/en-gb/requests/new'),
63 - LinkListItem(
64 - title: 'Yat',
65 - icon: 'assets/images/yat_mini_logo.png',
66 - hasIconColor: true,
67 - linkTitle: 'support@y.at',
68 - link: 'mailto:support@y.at')
53 + if (!isMoneroOnly) ... [
54 + LinkListItem(
55 + title: 'Wyre',
56 + icon: 'assets/images/wyre.png',
57 + linkTitle: S.current.submit_request,
58 + link: 'https://wyre-support.zendesk.com/hc/en-us/requests/new'),
59 + LinkListItem(
60 + title: 'MoonPay',
61 + icon: 'assets/images/moonpay.png',
62 + hasIconColor: true,
63 + linkTitle: S.current.submit_request,
64 + link: 'https://support.moonpay.com/hc/en-gb/requests/new')
65 + ]
66 + //LinkListItem(
67 + // title: 'Yat',
68 + // icon: 'assets/images/yat_mini_logo.png',
69 + // hasIconColor: true,
70 + // linkTitle: 'support@y.at',
71 + // link: 'mailto:support@y.at')
72 ];
73 }
74 static const url = 'https://cakewallet.com/guide/';
lib/view_model/wallet_keys_view_model.dart
+13 -12
@@ -4,6 +4,7 @@ import 'package:cake_wallet/generated/i18n.dart';
4 import 'package:cw_core/wallet_base.dart';
5 import 'package:cake_wallet/bitcoin/bitcoin.dart';
6 import 'package:cake_wallet/src/screens/transaction_details/standart_list_item.dart';
7 +import 'package:cake_wallet/monero/monero.dart';
8
9 part 'wallet_keys_view_model.g.dart';
10
@@ -13,19 +14,19 @@ abstract class WalletKeysViewModelBase with Store {
14 WalletKeysViewModelBase(WalletBase wallet)
15 : items = ObservableList<StandartListItem>() {
16 if (wallet.type == WalletType.monero) {
16 - //final keys = moneroUtils.getKeys(wallet);
17 + final keys = monero.getKeys(wallet);
18
18 - //items.addAll([
19 - // StandartListItem(
20 - // title: S.current.spend_key_public, value: keys['publicSpendKey']),
21 - // StandartListItem(
22 - // title: S.current.spend_key_private, value: keys['privateSpendKey']),
23 - // StandartListItem(
24 - // title: S.current.view_key_public, value: keys['publicViewKey']),
25 - // StandartListItem(
26 - // title: S.current.view_key_private, value: keys['privateViewKey']),
27 - // StandartListItem(title: S.current.wallet_seed, value: wallet.seed),
28 - //]);
19 + items.addAll([
20 + StandartListItem(
21 + title: S.current.spend_key_public, value: keys['publicSpendKey']),
22 + StandartListItem(
23 + title: S.current.spend_key_private, value: keys['privateSpendKey']),
24 + StandartListItem(
25 + title: S.current.view_key_public, value: keys['publicViewKey']),
26 + StandartListItem(
27 + title: S.current.view_key_private, value: keys['privateViewKey']),
28 + StandartListItem(title: S.current.wallet_seed, value: wallet.seed),
29 + ]);
30 }
31
32 if (wallet.type == WalletType.bitcoin || wallet.type == WalletType.litecoin) {
lib/view_model/wallet_list/wallet_list_view_model.dart
+3
@@ -7,6 +7,7 @@ import 'package:cake_wallet/core/key_service.dart';
7 import 'package:cw_core/wallet_service.dart';
8 import 'package:cake_wallet/view_model/wallet_list/wallet_list_item.dart';
9 import 'package:cw_core/wallet_info.dart';
10 +import 'package:cw_core/wallet_type.dart';
11
12 part 'wallet_list_view_model.g.dart';
13
@@ -27,6 +28,8 @@ abstract class WalletListViewModelBase with Store {
28 final KeyService _keyService;
29 final WalletNewVM walletNewVM;
30
31 + WalletType get currentWalletType => _appStore.wallet.type;
32 +
33 @action
34 Future<void> loadWallet(WalletListItem wallet) async {
35 final password =
lib/wallet_type_utils.dart new
+7
@@ -0,0 +1,7 @@
1 +import 'package:cw_core/wallet_type.dart';
2 +import 'package:cake_wallet/wallet_types.g.dart';
3 +
4 +bool get isMoneroOnly {
5 + return availableWalletTypes.length == 1
6 + && availableWalletTypes.first == WalletType.monero;
7 +}
\ No newline at end of file
res/values/strings_de.arb
+3 -1
@@ -6,7 +6,9 @@
6 "create_new" : "Neue Wallet erstellen",
7 "restore_wallet" : "Wallet wiederherstellen",
8
9 -
9 + "monero_com": "Monero.com",
10 + "monero_com_wallet_text": "Awesome wallet for Monero",
11 +
12 "accounts" : "Konten",
13 "edit" : "Bearbeiten",
14 "account" : "Konto",
res/values/strings_en.arb
+3
@@ -6,6 +6,9 @@
6 "create_new" : "Create New Wallet",
7 "restore_wallet" : "Restore Wallet",
8
9 + "monero_com": "Monero.com",
10 + "monero_com_wallet_text": "Awesome wallet for Monero",
11 +
12
13 "accounts" : "Accounts",
14 "edit" : "Edit",
res/values/strings_es.arb
+3 -1
@@ -6,7 +6,9 @@
6 "create_new" : "Crear nueva billetera",
7 "restore_wallet" : "Restaurar billetera",
8
9 -
9 + "monero_com": "Monero.com",
10 + "monero_com_wallet_text": "Awesome wallet for Monero",
11 +
12 "accounts" : "Cuentas",
13 "edit" : "Editar",
14 "account" : "Cuenta",
res/values/strings_hi.arb
+3 -1
@@ -6,7 +6,9 @@
6 "create_new" : "नया बटुआ बनाएँ",
7 "restore_wallet" : "वॉलेट को पुनर्स्थापित करें",
8
9 -
9 + "monero_com": "Monero.com",
10 + "monero_com_wallet_text": "Awesome wallet for Monero",
11 +
12 "accounts" : "हिसाब किताब",
13 "edit" : "संपादित करें",
14 "account" : "लेखा",
res/values/strings_hr.arb
+3 -1
@@ -6,7 +6,9 @@
6 "create_new" : "Izradi novi novčanik",
7 "restore_wallet" : "Oporavi novčanik",
8
9 -
9 + "monero_com": "Monero.com",
10 + "monero_com_wallet_text": "Awesome wallet for Monero",
11 +
12 "accounts" : "Računi",
13 "edit" : "Uredi",
14 "account" : "Račun",
res/values/strings_it.arb
+3 -1
@@ -6,7 +6,9 @@
6 "create_new" : "Genera nuovo Portafoglio",
7 "restore_wallet" : "Recupera Portafoglio",
8
9 -
9 + "monero_com": "Monero.com",
10 + "monero_com_wallet_text": "Awesome wallet for Monero",
11 +
12 "accounts" : "Accounts",
13 "edit" : "Modifica",
14 "account" : "Account",
res/values/strings_ja.arb
+3 -1
@@ -6,7 +6,9 @@
6 "create_new" : "新しいウォレットを作成",
7 "restore_wallet" : "ウォレットを復元",
8
9 -
9 + "monero_com": "Monero.com",
10 + "monero_com_wallet_text": "Awesome wallet for Monero",
11 +
12 "accounts" : "アカウント",
13 "edit" : "編集",
14 "account" : "アカウント",
res/values/strings_ko.arb
+3 -1
@@ -6,7 +6,9 @@
6 "create_new" : "새 월렛 만들기",
7 "restore_wallet" : "월렛 복원",
8
9 -
9 + "monero_com": "Monero.com",
10 + "monero_com_wallet_text": "Awesome wallet for Monero",
11 +
12 "accounts" : "계정",
13 "edit" : "편집하다",
14 "account" : "계정",
res/values/strings_nl.arb
+3 -1
@@ -6,7 +6,9 @@
6 "create_new" : "Maak een nieuwe portemonnee",
7 "restore_wallet" : "Portemonnee herstellen",
8
9 -
9 + "monero_com": "Monero.com",
10 + "monero_com_wallet_text": "Awesome wallet for Monero",
11 +
12 "accounts" : "Accounts",
13 "edit" : "Bewerk",
14 "account" : "Account",
res/values/strings_pl.arb
+3 -1
@@ -6,7 +6,9 @@
6 "create_new" : "Utwórz nowy portfel",
7 "restore_wallet" : "Przywróć portfel",
8
9 -
9 + "monero_com": "Monero.com",
10 + "monero_com_wallet_text": "Awesome wallet for Monero",
11 +
12 "accounts" : "Konta",
13 "edit" : "Edytować",
14 "account" : "Konto",
res/values/strings_pt.arb
+3 -1
@@ -6,7 +6,9 @@
6 "create_new" : "Criar nova carteira",
7 "restore_wallet" : "Restaurar carteira",
8
9 -
9 + "monero_com": "Monero.com",
10 + "monero_com_wallet_text": "Awesome wallet for Monero",
11 +
12 "accounts" : "Contas",
13 "edit" : "Editar",
14 "account" : "Conta",
res/values/strings_ru.arb
+3 -1
@@ -6,7 +6,9 @@
6 "create_new" : "Создать новый кошелёк",
7 "restore_wallet" : "Восстановить кошелёк",
8
9 -
9 + "monero_com": "Monero.com",
10 + "monero_com_wallet_text": "Awesome wallet for Monero",
11 +
12 "accounts" : "Аккаунты",
13 "edit" : "Редактировать",
14 "account" : "Аккаунт",
res/values/strings_uk.arb
+3 -1
@@ -6,7 +6,9 @@
6 "create_new" : "Створити новий гаманець",
7 "restore_wallet" : "Відновити гаманець",
8
9 -
9 + "monero_com": "Monero.com",
10 + "monero_com_wallet_text": "Awesome wallet for Monero",
11 +
12 "accounts" : "Акаунти",
13 "edit" : "Редагувати",
14 "account" : "Акаунт",
res/values/strings_zh.arb
+3 -1
@@ -6,7 +6,9 @@
6 "create_new" : "创建新钱包",
7 "restore_wallet" : "恢复钱包",
8
9 -
9 + "monero_com": "Monero.com",
10 + "monero_com_wallet_text": "Awesome wallet for Monero",
11 +
12 "accounts" : "账户",
13 "edit" : "编辑",
14 "account" : "帐户",