diff --git a/lib/router.dart b/lib/router.dart index 1dfde4891..e5ab7dde5 100644 --- a/lib/router.dart +++ b/lib/router.dart @@ -111,6 +111,14 @@ Route createRoute(RouteSettings settings) { return CupertinoPageRoute( builder: (_) => getIt.get(param1: callback)); + case Routes.moneroRestoreWalletFromWelcome: + return CupertinoPageRoute( + builder: (_) => getIt.get( + param1: (PinCodeState context, dynamic _) => + Navigator.pushNamed( + context.context, Routes.restoreWallet, arguments: WalletType.monero)), + fullscreenDialog: true); + case Routes.restoreWalletType: return CupertinoPageRoute( builder: (_) => getIt.get( diff --git a/lib/routes.dart b/lib/routes.dart index 19269337c..afb64f9ad 100644 --- a/lib/routes.dart +++ b/lib/routes.dart @@ -57,4 +57,6 @@ class Routes { static const buyWebView = '/buy_web_view'; static const unspentCoinsList = '/unspent_coins_list'; static const unspentCoinsDetails = '/unspent_coins_details'; + static const moneroRestoreWalletFromWelcome = '/monero_restore_wallet'; + static const moneroNewWalletFromWelcome = '/monero_new_wallet'; } \ No newline at end of file diff --git a/lib/src/screens/dashboard/dashboard_page.dart b/lib/src/screens/dashboard/dashboard_page.dart index 5ed599ebf..f193bd335 100644 --- a/lib/src/screens/dashboard/dashboard_page.dart +++ b/lib/src/screens/dashboard/dashboard_page.dart @@ -26,6 +26,7 @@ import 'package:cake_wallet/main.dart'; import 'package:cake_wallet/router.dart'; import 'package:cake_wallet/buy/moonpay/moonpay_buy_provider.dart'; import 'package:url_launcher/url_launcher.dart'; +import 'package:cake_wallet/wallet_type_utils.dart'; class DashboardPage extends BasePage { DashboardPage({ @@ -144,17 +145,19 @@ class DashboardPage extends BasePage { image: exchangeImage, title: S.of(context).exchange, route: Routes.exchange), - ActionButton( - image: buyImage, - title: S.of(context).buy, - onClick: () async => - await _onClickBuyButton(context), - ), - ActionButton( - image: sellImage, - title: 'Sell', - onClick: () async => - await _onClickSellButton(context), + if (isMoneroOnly) + ActionButton( + image: buyImage, + title: S.of(context).buy, + onClick: () async => + await _onClickBuyButton(context), + ), + if (isMoneroOnly) + ActionButton( + image: sellImage, + title: 'Sell', + onClick: () async => + await _onClickSellButton(context), ), ], ), @@ -174,23 +177,23 @@ class DashboardPage extends BasePage { pages.add(TransactionsPage(dashboardViewModel: walletViewModel)); _isEffectsInstalled = true; - if (walletViewModel.shouldShowYatPopup) { - await Future.delayed(Duration(seconds: 1)); + //if (walletViewModel.shouldShowYatPopup) { + // await Future.delayed(Duration(seconds: 1)); - if (currentRouteSettings.name == Routes.preSeed - || currentRouteSettings.name == Routes.seed) { - return; - } + // if (currentRouteSettings.name == Routes.preSeed + // || currentRouteSettings.name == Routes.seed) { + // return; + // } - await showPopUp( - context: context, - builder: (BuildContext context) { - return YatPopup( - dashboardViewModel: walletViewModel, - onClose: () => Navigator.of(context).pop()); - }); - walletViewModel.furtherShowYatPopup(false); - } + // await showPopUp( + // context: context, + // builder: (BuildContext context) { + // return YatPopup( + // dashboardViewModel: walletViewModel, + // onClose: () => Navigator.of(context).pop()); + // }); + // walletViewModel.furtherShowYatPopup(false); + //} autorun((_) async { if (!walletViewModel.isOutdatedElectrumWallet) { diff --git a/lib/src/screens/dashboard/wallet_menu.dart b/lib/src/screens/dashboard/wallet_menu.dart index 01a5010df..ad00a5bc9 100644 --- a/lib/src/screens/dashboard/wallet_menu.dart +++ b/lib/src/screens/dashboard/wallet_menu.dart @@ -6,6 +6,7 @@ import 'package:cake_wallet/routes.dart'; import 'package:cake_wallet/generated/i18n.dart'; import 'package:cake_wallet/src/screens/auth/auth_page.dart'; import 'package:cake_wallet/src/widgets/alert_with_two_actions.dart'; +import 'package:cake_wallet/wallet_type_utils.dart'; // FIXME: terrible design @@ -37,12 +38,13 @@ class WalletMenu { title: S.current.address_book_menu, image: Image.asset('assets/images/open_book_menu.png', height: 16, width: 16)), - WalletMenuItem( - title: S.current.backup, - image: Image.asset('assets/images/restore_wallet.png', - height: 16, - width: 16, - color: Palette.darkBlue)), + if(!isMonerOnly) + WalletMenuItem( + title: S.current.backup, + image: Image.asset('assets/images/restore_wallet.png', + height: 16, + width: 16, + color: Palette.darkBlue)), WalletMenuItem( title: S.current.settings_title, image: Image.asset('assets/images/settings_menu.png', diff --git a/lib/src/screens/wallet_list/wallet_list_page.dart b/lib/src/screens/wallet_list/wallet_list_page.dart index a7f634675..19996a1e0 100644 --- a/lib/src/screens/wallet_list/wallet_list_page.dart +++ b/lib/src/screens/wallet_list/wallet_list_page.dart @@ -15,6 +15,7 @@ import 'package:cake_wallet/src/widgets/primary_button.dart'; import 'package:cake_wallet/src/screens/base_page.dart'; import 'package:cake_wallet/src/widgets/scollable_with_bottom_section.dart'; import 'package:flutter_slidable/flutter_slidable.dart'; +import 'package:cake_wallet/wallet_type_utils.dart'; class WalletListPage extends BasePage { WalletListPage({this.walletListViewModel}); @@ -181,8 +182,17 @@ class WalletListBodyState extends State { ), SizedBox(height: 10.0), PrimaryImageButton( - onPressed: () => - Navigator.of(context).pushNamed(Routes.restoreWalletType), + onPressed: () { + if (isMoneroOnly) { + Navigator + .of(context) + .pushNamed( + Routes.restoreWallet, + arguments: widget.walletListViewModel.currentWalletType); + } else { + Navigator.of(context).pushNamed(Routes.restoreWalletType); + } + }, image: restoreWalletImage, text: S.of(context).wallet_list_restore_wallet, color: Theme.of(context).accentTextTheme.caption.color, diff --git a/lib/src/screens/welcome/welcome_page.dart b/lib/src/screens/welcome/welcome_page.dart index 626197848..4621ac6e8 100644 --- a/lib/src/screens/welcome/welcome_page.dart +++ b/lib/src/screens/welcome/welcome_page.dart @@ -4,6 +4,7 @@ import 'package:cake_wallet/routes.dart'; import 'package:cake_wallet/src/widgets/primary_button.dart'; import 'package:cake_wallet/src/screens/base_page.dart'; import 'package:cake_wallet/generated/i18n.dart'; +import 'package:cake_wallet/wallet_type_utils.dart'; class WelcomePage extends BasePage { static const aspectRatioImage = 1.25; @@ -82,9 +83,9 @@ class WelcomePage extends BasePage { Padding( padding: EdgeInsets.only(top: 5), child: Text( - S - .of(context) - .cake_wallet, + isMoneroOnly + ? S.of(context).monero_com + : S.of(context).cake_wallet, style: TextStyle( fontSize: 36, fontWeight: FontWeight.bold, @@ -100,9 +101,9 @@ class WelcomePage extends BasePage { Padding( padding: EdgeInsets.only(top: 5), child: Text( - S - .of(context) - .first_wallet_text, + isMoneroOnly + ? S.of(context).monero_com_wallet_text + : S.of(context).first_wallet_text, style: TextStyle( fontSize: 16, fontWeight: FontWeight.w500, @@ -159,9 +160,14 @@ class WelcomePage extends BasePage { Padding( padding: EdgeInsets.only(top: 10), child: PrimaryImageButton( - onPressed: () => - Navigator.pushNamed(context, - Routes.restoreOptions), + onPressed: () { + if (isMoneroOnly) { + Navigator.of(context).pushNamed(Routes.moneroRestoreWalletFromWelcome); + } else { + Navigator.pushNamed(context, + Routes.restoreOptions); + } + }, image: restoreWalletImage, text: S .of(context) diff --git a/lib/view_model/settings/settings_view_model.dart b/lib/view_model/settings/settings_view_model.dart index 544f41528..eca7a7173 100644 --- a/lib/view_model/settings/settings_view_model.dart +++ b/lib/view_model/settings/settings_view_model.dart @@ -183,23 +183,23 @@ abstract class SettingsViewModelBase with Store { onItemSelected: (ThemeBase theme) => _settingsStore.currentTheme = theme) ], - [ - if (_yatStore.emoji.isNotEmpty) ...[ - LinkListItem( - title: S.current.manage_yats, - link: manageYatUrl, - linkTitle: ''), - ] else ...[ - LinkListItem( - title: S.current.connect_yats, - link: connectYatUrl, - linkTitle: ''), - LinkListItem( - title: 'Create new Yats', - link: createNewYatUrl, - linkTitle: '') - ] - ], + //[ + //if (_yatStore.emoji.isNotEmpty) ...[ + // LinkListItem( + // title: S.current.manage_yats, + // link: manageYatUrl, + // linkTitle: ''), + //] else ...[ + //LinkListItem( + // title: S.current.connect_yats, + // link: connectYatUrl, + // linkTitle: ''), + //LinkListItem( + // title: 'Create new Yats', + // link: createNewYatUrl, + // linkTitle: '') + //] + //], [ RegularListItem( title: S.current.settings_terms_and_conditions, diff --git a/lib/view_model/support_view_model.dart b/lib/view_model/support_view_model.dart index d355e0608..6bc73027b 100644 --- a/lib/view_model/support_view_model.dart +++ b/lib/view_model/support_view_model.dart @@ -6,6 +6,7 @@ import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:mobx/mobx.dart'; import 'package:url_launcher/url_launcher.dart'; +import 'package:cake_wallet/wallet_type_utils.dart'; part 'support_view_model.g.dart'; @@ -49,23 +50,25 @@ abstract class SupportViewModelBase with Store { icon: 'assets/images/change_now.png', linkTitle: 'support@changenow.io', link: 'mailto:support@changenow.io'), - LinkListItem( - title: 'Wyre', - icon: 'assets/images/wyre.png', - linkTitle: S.current.submit_request, - link: 'https://wyre-support.zendesk.com/hc/en-us/requests/new'), - LinkListItem( - title: 'MoonPay', - icon: 'assets/images/moonpay.png', - hasIconColor: true, - linkTitle: S.current.submit_request, - link: 'https://support.moonpay.com/hc/en-gb/requests/new'), - LinkListItem( - title: 'Yat', - icon: 'assets/images/yat_mini_logo.png', - hasIconColor: true, - linkTitle: 'support@y.at', - link: 'mailto:support@y.at') + if (!isMoneroOnly) ... [ + LinkListItem( + title: 'Wyre', + icon: 'assets/images/wyre.png', + linkTitle: S.current.submit_request, + link: 'https://wyre-support.zendesk.com/hc/en-us/requests/new'), + LinkListItem( + title: 'MoonPay', + icon: 'assets/images/moonpay.png', + hasIconColor: true, + linkTitle: S.current.submit_request, + link: 'https://support.moonpay.com/hc/en-gb/requests/new') + ] + //LinkListItem( + // title: 'Yat', + // icon: 'assets/images/yat_mini_logo.png', + // hasIconColor: true, + // linkTitle: 'support@y.at', + // link: 'mailto:support@y.at') ]; } static const url = 'https://cakewallet.com/guide/'; diff --git a/lib/view_model/wallet_keys_view_model.dart b/lib/view_model/wallet_keys_view_model.dart index bc8a51d31..b2c4f80ae 100644 --- a/lib/view_model/wallet_keys_view_model.dart +++ b/lib/view_model/wallet_keys_view_model.dart @@ -4,6 +4,7 @@ import 'package:cake_wallet/generated/i18n.dart'; import 'package:cw_core/wallet_base.dart'; import 'package:cake_wallet/bitcoin/bitcoin.dart'; import 'package:cake_wallet/src/screens/transaction_details/standart_list_item.dart'; +import 'package:cake_wallet/monero/monero.dart'; part 'wallet_keys_view_model.g.dart'; @@ -13,19 +14,19 @@ abstract class WalletKeysViewModelBase with Store { WalletKeysViewModelBase(WalletBase wallet) : items = ObservableList() { if (wallet.type == WalletType.monero) { - //final keys = moneroUtils.getKeys(wallet); + final keys = monero.getKeys(wallet); - //items.addAll([ - // StandartListItem( - // title: S.current.spend_key_public, value: keys['publicSpendKey']), - // StandartListItem( - // title: S.current.spend_key_private, value: keys['privateSpendKey']), - // StandartListItem( - // title: S.current.view_key_public, value: keys['publicViewKey']), - // StandartListItem( - // title: S.current.view_key_private, value: keys['privateViewKey']), - // StandartListItem(title: S.current.wallet_seed, value: wallet.seed), - //]); + items.addAll([ + StandartListItem( + title: S.current.spend_key_public, value: keys['publicSpendKey']), + StandartListItem( + title: S.current.spend_key_private, value: keys['privateSpendKey']), + StandartListItem( + title: S.current.view_key_public, value: keys['publicViewKey']), + StandartListItem( + title: S.current.view_key_private, value: keys['privateViewKey']), + StandartListItem(title: S.current.wallet_seed, value: wallet.seed), + ]); } if (wallet.type == WalletType.bitcoin || wallet.type == WalletType.litecoin) { diff --git a/lib/view_model/wallet_list/wallet_list_view_model.dart b/lib/view_model/wallet_list/wallet_list_view_model.dart index 35b4adf03..ee44a78ea 100644 --- a/lib/view_model/wallet_list/wallet_list_view_model.dart +++ b/lib/view_model/wallet_list/wallet_list_view_model.dart @@ -7,6 +7,7 @@ import 'package:cake_wallet/core/key_service.dart'; import 'package:cw_core/wallet_service.dart'; import 'package:cake_wallet/view_model/wallet_list/wallet_list_item.dart'; import 'package:cw_core/wallet_info.dart'; +import 'package:cw_core/wallet_type.dart'; part 'wallet_list_view_model.g.dart'; @@ -27,6 +28,8 @@ abstract class WalletListViewModelBase with Store { final KeyService _keyService; final WalletNewVM walletNewVM; + WalletType get currentWalletType => _appStore.wallet.type; + @action Future loadWallet(WalletListItem wallet) async { final password = diff --git a/lib/wallet_type_utils.dart b/lib/wallet_type_utils.dart new file mode 100644 index 000000000..19edffd94 --- /dev/null +++ b/lib/wallet_type_utils.dart @@ -0,0 +1,7 @@ +import 'package:cw_core/wallet_type.dart'; +import 'package:cake_wallet/wallet_types.g.dart'; + +bool get isMoneroOnly { + return availableWalletTypes.length == 1 + && availableWalletTypes.first == WalletType.monero; +} \ No newline at end of file diff --git a/res/values/strings_de.arb b/res/values/strings_de.arb index a2679cea7..a4b45a0bc 100644 --- a/res/values/strings_de.arb +++ b/res/values/strings_de.arb @@ -6,7 +6,9 @@ "create_new" : "Neue Wallet erstellen", "restore_wallet" : "Wallet wiederherstellen", - + "monero_com": "Monero.com", + "monero_com_wallet_text": "Awesome wallet for Monero", + "accounts" : "Konten", "edit" : "Bearbeiten", "account" : "Konto", diff --git a/res/values/strings_en.arb b/res/values/strings_en.arb index c0a4b6971..f55c3cc2b 100644 --- a/res/values/strings_en.arb +++ b/res/values/strings_en.arb @@ -6,6 +6,9 @@ "create_new" : "Create New Wallet", "restore_wallet" : "Restore Wallet", + "monero_com": "Monero.com", + "monero_com_wallet_text": "Awesome wallet for Monero", + "accounts" : "Accounts", "edit" : "Edit", diff --git a/res/values/strings_es.arb b/res/values/strings_es.arb index 49d183f98..d2bb5ba86 100644 --- a/res/values/strings_es.arb +++ b/res/values/strings_es.arb @@ -6,7 +6,9 @@ "create_new" : "Crear nueva billetera", "restore_wallet" : "Restaurar billetera", - + "monero_com": "Monero.com", + "monero_com_wallet_text": "Awesome wallet for Monero", + "accounts" : "Cuentas", "edit" : "Editar", "account" : "Cuenta", diff --git a/res/values/strings_hi.arb b/res/values/strings_hi.arb index e30fa8f1a..ab7ed2c47 100644 --- a/res/values/strings_hi.arb +++ b/res/values/strings_hi.arb @@ -6,7 +6,9 @@ "create_new" : "नया बटुआ बनाएँ", "restore_wallet" : "वॉलेट को पुनर्स्थापित करें", - + "monero_com": "Monero.com", + "monero_com_wallet_text": "Awesome wallet for Monero", + "accounts" : "हिसाब किताब", "edit" : "संपादित करें", "account" : "लेखा", diff --git a/res/values/strings_hr.arb b/res/values/strings_hr.arb index 614b1ffdd..aec14a736 100644 --- a/res/values/strings_hr.arb +++ b/res/values/strings_hr.arb @@ -6,7 +6,9 @@ "create_new" : "Izradi novi novčanik", "restore_wallet" : "Oporavi novčanik", - + "monero_com": "Monero.com", + "monero_com_wallet_text": "Awesome wallet for Monero", + "accounts" : "Računi", "edit" : "Uredi", "account" : "Račun", diff --git a/res/values/strings_it.arb b/res/values/strings_it.arb index 871612f6c..c26e4756c 100644 --- a/res/values/strings_it.arb +++ b/res/values/strings_it.arb @@ -6,7 +6,9 @@ "create_new" : "Genera nuovo Portafoglio", "restore_wallet" : "Recupera Portafoglio", - + "monero_com": "Monero.com", + "monero_com_wallet_text": "Awesome wallet for Monero", + "accounts" : "Accounts", "edit" : "Modifica", "account" : "Account", diff --git a/res/values/strings_ja.arb b/res/values/strings_ja.arb index 06e1c212c..c91cea487 100644 --- a/res/values/strings_ja.arb +++ b/res/values/strings_ja.arb @@ -6,7 +6,9 @@ "create_new" : "新しいウォレットを作成", "restore_wallet" : "ウォレットを復元", - + "monero_com": "Monero.com", + "monero_com_wallet_text": "Awesome wallet for Monero", + "accounts" : "アカウント", "edit" : "編集", "account" : "アカウント", diff --git a/res/values/strings_ko.arb b/res/values/strings_ko.arb index d642f5407..a7ab06fc4 100644 --- a/res/values/strings_ko.arb +++ b/res/values/strings_ko.arb @@ -6,7 +6,9 @@ "create_new" : "새 월렛 만들기", "restore_wallet" : "월렛 복원", - + "monero_com": "Monero.com", + "monero_com_wallet_text": "Awesome wallet for Monero", + "accounts" : "계정", "edit" : "편집하다", "account" : "계정", diff --git a/res/values/strings_nl.arb b/res/values/strings_nl.arb index 569d944fd..869b83705 100644 --- a/res/values/strings_nl.arb +++ b/res/values/strings_nl.arb @@ -6,7 +6,9 @@ "create_new" : "Maak een nieuwe portemonnee", "restore_wallet" : "Portemonnee herstellen", - + "monero_com": "Monero.com", + "monero_com_wallet_text": "Awesome wallet for Monero", + "accounts" : "Accounts", "edit" : "Bewerk", "account" : "Account", diff --git a/res/values/strings_pl.arb b/res/values/strings_pl.arb index 7016783df..74e8fe277 100644 --- a/res/values/strings_pl.arb +++ b/res/values/strings_pl.arb @@ -6,7 +6,9 @@ "create_new" : "Utwórz nowy portfel", "restore_wallet" : "Przywróć portfel", - + "monero_com": "Monero.com", + "monero_com_wallet_text": "Awesome wallet for Monero", + "accounts" : "Konta", "edit" : "Edytować", "account" : "Konto", diff --git a/res/values/strings_pt.arb b/res/values/strings_pt.arb index 97eda0568..fdeb88678 100644 --- a/res/values/strings_pt.arb +++ b/res/values/strings_pt.arb @@ -6,7 +6,9 @@ "create_new" : "Criar nova carteira", "restore_wallet" : "Restaurar carteira", - + "monero_com": "Monero.com", + "monero_com_wallet_text": "Awesome wallet for Monero", + "accounts" : "Contas", "edit" : "Editar", "account" : "Conta", diff --git a/res/values/strings_ru.arb b/res/values/strings_ru.arb index bf12a992c..bf2562e67 100644 --- a/res/values/strings_ru.arb +++ b/res/values/strings_ru.arb @@ -6,7 +6,9 @@ "create_new" : "Создать новый кошелёк", "restore_wallet" : "Восстановить кошелёк", - + "monero_com": "Monero.com", + "monero_com_wallet_text": "Awesome wallet for Monero", + "accounts" : "Аккаунты", "edit" : "Редактировать", "account" : "Аккаунт", diff --git a/res/values/strings_uk.arb b/res/values/strings_uk.arb index 70b2e9a99..58e53dd62 100644 --- a/res/values/strings_uk.arb +++ b/res/values/strings_uk.arb @@ -6,7 +6,9 @@ "create_new" : "Створити новий гаманець", "restore_wallet" : "Відновити гаманець", - + "monero_com": "Monero.com", + "monero_com_wallet_text": "Awesome wallet for Monero", + "accounts" : "Акаунти", "edit" : "Редагувати", "account" : "Акаунт", diff --git a/res/values/strings_zh.arb b/res/values/strings_zh.arb index 52972c8fd..b57b5f426 100644 --- a/res/values/strings_zh.arb +++ b/res/values/strings_zh.arb @@ -6,7 +6,9 @@ "create_new" : "创建新钱包", "restore_wallet" : "恢复钱包", - + "monero_com": "Monero.com", + "monero_com_wallet_text": "Awesome wallet for Monero", + "accounts" : "账户", "edit" : "编辑", "account" : "帐户",