Fixes for monero only app version.

This commit is contained in:
M 2021-12-30 19:20:00 +02:00
parent 4535a1aaa8
commit 226d546d55
25 changed files with 176 additions and 102 deletions

View file

@ -111,6 +111,14 @@ Route<dynamic> createRoute(RouteSettings settings) {
return CupertinoPageRoute<void>( return CupertinoPageRoute<void>(
builder: (_) => getIt.get<SetupPinCodePage>(param1: callback)); builder: (_) => getIt.get<SetupPinCodePage>(param1: callback));
case Routes.moneroRestoreWalletFromWelcome:
return CupertinoPageRoute<void>(
builder: (_) => getIt.get<SetupPinCodePage>(
param1: (PinCodeState<PinCodeWidget> context, dynamic _) =>
Navigator.pushNamed(
context.context, Routes.restoreWallet, arguments: WalletType.monero)),
fullscreenDialog: true);
case Routes.restoreWalletType: case Routes.restoreWalletType:
return CupertinoPageRoute<void>( return CupertinoPageRoute<void>(
builder: (_) => getIt.get<NewWalletTypePage>( builder: (_) => getIt.get<NewWalletTypePage>(

View file

@ -57,4 +57,6 @@ class Routes {
static const buyWebView = '/buy_web_view'; static const buyWebView = '/buy_web_view';
static const unspentCoinsList = '/unspent_coins_list'; static const unspentCoinsList = '/unspent_coins_list';
static const unspentCoinsDetails = '/unspent_coins_details'; static const unspentCoinsDetails = '/unspent_coins_details';
static const moneroRestoreWalletFromWelcome = '/monero_restore_wallet';
static const moneroNewWalletFromWelcome = '/monero_new_wallet';
} }

View file

@ -26,6 +26,7 @@ import 'package:cake_wallet/main.dart';
import 'package:cake_wallet/router.dart'; import 'package:cake_wallet/router.dart';
import 'package:cake_wallet/buy/moonpay/moonpay_buy_provider.dart'; import 'package:cake_wallet/buy/moonpay/moonpay_buy_provider.dart';
import 'package:url_launcher/url_launcher.dart'; import 'package:url_launcher/url_launcher.dart';
import 'package:cake_wallet/wallet_type_utils.dart';
class DashboardPage extends BasePage { class DashboardPage extends BasePage {
DashboardPage({ DashboardPage({
@ -144,12 +145,14 @@ class DashboardPage extends BasePage {
image: exchangeImage, image: exchangeImage,
title: S.of(context).exchange, title: S.of(context).exchange,
route: Routes.exchange), route: Routes.exchange),
if (isMoneroOnly)
ActionButton( ActionButton(
image: buyImage, image: buyImage,
title: S.of(context).buy, title: S.of(context).buy,
onClick: () async => onClick: () async =>
await _onClickBuyButton(context), await _onClickBuyButton(context),
), ),
if (isMoneroOnly)
ActionButton( ActionButton(
image: sellImage, image: sellImage,
title: 'Sell', title: 'Sell',
@ -174,23 +177,23 @@ class DashboardPage extends BasePage {
pages.add(TransactionsPage(dashboardViewModel: walletViewModel)); pages.add(TransactionsPage(dashboardViewModel: walletViewModel));
_isEffectsInstalled = true; _isEffectsInstalled = true;
if (walletViewModel.shouldShowYatPopup) { //if (walletViewModel.shouldShowYatPopup) {
await Future<void>.delayed(Duration(seconds: 1)); // await Future<void>.delayed(Duration(seconds: 1));
if (currentRouteSettings.name == Routes.preSeed // if (currentRouteSettings.name == Routes.preSeed
|| currentRouteSettings.name == Routes.seed) { // || currentRouteSettings.name == Routes.seed) {
return; // return;
} // }
await showPopUp<void>( // await showPopUp<void>(
context: context, // context: context,
builder: (BuildContext context) { // builder: (BuildContext context) {
return YatPopup( // return YatPopup(
dashboardViewModel: walletViewModel, // dashboardViewModel: walletViewModel,
onClose: () => Navigator.of(context).pop()); // onClose: () => Navigator.of(context).pop());
}); // });
walletViewModel.furtherShowYatPopup(false); // walletViewModel.furtherShowYatPopup(false);
} //}
autorun((_) async { autorun((_) async {
if (!walletViewModel.isOutdatedElectrumWallet) { if (!walletViewModel.isOutdatedElectrumWallet) {

View file

@ -6,6 +6,7 @@ import 'package:cake_wallet/routes.dart';
import 'package:cake_wallet/generated/i18n.dart'; import 'package:cake_wallet/generated/i18n.dart';
import 'package:cake_wallet/src/screens/auth/auth_page.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/src/widgets/alert_with_two_actions.dart';
import 'package:cake_wallet/wallet_type_utils.dart';
// FIXME: terrible design // FIXME: terrible design
@ -37,6 +38,7 @@ class WalletMenu {
title: S.current.address_book_menu, title: S.current.address_book_menu,
image: Image.asset('assets/images/open_book_menu.png', image: Image.asset('assets/images/open_book_menu.png',
height: 16, width: 16)), height: 16, width: 16)),
if(!isMonerOnly)
WalletMenuItem( WalletMenuItem(
title: S.current.backup, title: S.current.backup,
image: Image.asset('assets/images/restore_wallet.png', image: Image.asset('assets/images/restore_wallet.png',

View file

@ -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/screens/base_page.dart';
import 'package:cake_wallet/src/widgets/scollable_with_bottom_section.dart'; import 'package:cake_wallet/src/widgets/scollable_with_bottom_section.dart';
import 'package:flutter_slidable/flutter_slidable.dart'; import 'package:flutter_slidable/flutter_slidable.dart';
import 'package:cake_wallet/wallet_type_utils.dart';
class WalletListPage extends BasePage { class WalletListPage extends BasePage {
WalletListPage({this.walletListViewModel}); WalletListPage({this.walletListViewModel});
@ -181,8 +182,17 @@ class WalletListBodyState extends State<WalletListBody> {
), ),
SizedBox(height: 10.0), SizedBox(height: 10.0),
PrimaryImageButton( PrimaryImageButton(
onPressed: () => onPressed: () {
Navigator.of(context).pushNamed(Routes.restoreWalletType), if (isMoneroOnly) {
Navigator
.of(context)
.pushNamed(
Routes.restoreWallet,
arguments: widget.walletListViewModel.currentWalletType);
} else {
Navigator.of(context).pushNamed(Routes.restoreWalletType);
}
},
image: restoreWalletImage, image: restoreWalletImage,
text: S.of(context).wallet_list_restore_wallet, text: S.of(context).wallet_list_restore_wallet,
color: Theme.of(context).accentTextTheme.caption.color, color: Theme.of(context).accentTextTheme.caption.color,

View file

@ -4,6 +4,7 @@ import 'package:cake_wallet/routes.dart';
import 'package:cake_wallet/src/widgets/primary_button.dart'; import 'package:cake_wallet/src/widgets/primary_button.dart';
import 'package:cake_wallet/src/screens/base_page.dart'; import 'package:cake_wallet/src/screens/base_page.dart';
import 'package:cake_wallet/generated/i18n.dart'; import 'package:cake_wallet/generated/i18n.dart';
import 'package:cake_wallet/wallet_type_utils.dart';
class WelcomePage extends BasePage { class WelcomePage extends BasePage {
static const aspectRatioImage = 1.25; static const aspectRatioImage = 1.25;
@ -82,9 +83,9 @@ class WelcomePage extends BasePage {
Padding( Padding(
padding: EdgeInsets.only(top: 5), padding: EdgeInsets.only(top: 5),
child: Text( child: Text(
S isMoneroOnly
.of(context) ? S.of(context).monero_com
.cake_wallet, : S.of(context).cake_wallet,
style: TextStyle( style: TextStyle(
fontSize: 36, fontSize: 36,
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
@ -100,9 +101,9 @@ class WelcomePage extends BasePage {
Padding( Padding(
padding: EdgeInsets.only(top: 5), padding: EdgeInsets.only(top: 5),
child: Text( child: Text(
S isMoneroOnly
.of(context) ? S.of(context).monero_com_wallet_text
.first_wallet_text, : S.of(context).first_wallet_text,
style: TextStyle( style: TextStyle(
fontSize: 16, fontSize: 16,
fontWeight: FontWeight.w500, fontWeight: FontWeight.w500,
@ -159,9 +160,14 @@ class WelcomePage extends BasePage {
Padding( Padding(
padding: EdgeInsets.only(top: 10), padding: EdgeInsets.only(top: 10),
child: PrimaryImageButton( child: PrimaryImageButton(
onPressed: () => onPressed: () {
if (isMoneroOnly) {
Navigator.of(context).pushNamed(Routes.moneroRestoreWalletFromWelcome);
} else {
Navigator.pushNamed(context, Navigator.pushNamed(context,
Routes.restoreOptions), Routes.restoreOptions);
}
},
image: restoreWalletImage, image: restoreWalletImage,
text: S text: S
.of(context) .of(context)

View file

@ -183,23 +183,23 @@ abstract class SettingsViewModelBase with Store {
onItemSelected: (ThemeBase theme) => onItemSelected: (ThemeBase theme) =>
_settingsStore.currentTheme = theme) _settingsStore.currentTheme = theme)
], ],
[ //[
if (_yatStore.emoji.isNotEmpty) ...[ //if (_yatStore.emoji.isNotEmpty) ...[
LinkListItem( // LinkListItem(
title: S.current.manage_yats, // title: S.current.manage_yats,
link: manageYatUrl, // link: manageYatUrl,
linkTitle: ''), // linkTitle: ''),
] else ...[ //] else ...[
LinkListItem( //LinkListItem(
title: S.current.connect_yats, // title: S.current.connect_yats,
link: connectYatUrl, // link: connectYatUrl,
linkTitle: ''), // linkTitle: ''),
LinkListItem( //LinkListItem(
title: 'Create new Yats', // title: 'Create new Yats',
link: createNewYatUrl, // link: createNewYatUrl,
linkTitle: '') // linkTitle: '')
] //]
], //],
[ [
RegularListItem( RegularListItem(
title: S.current.settings_terms_and_conditions, title: S.current.settings_terms_and_conditions,

View file

@ -6,6 +6,7 @@ import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:mobx/mobx.dart'; import 'package:mobx/mobx.dart';
import 'package:url_launcher/url_launcher.dart'; import 'package:url_launcher/url_launcher.dart';
import 'package:cake_wallet/wallet_type_utils.dart';
part 'support_view_model.g.dart'; part 'support_view_model.g.dart';
@ -49,6 +50,7 @@ abstract class SupportViewModelBase with Store {
icon: 'assets/images/change_now.png', icon: 'assets/images/change_now.png',
linkTitle: 'support@changenow.io', linkTitle: 'support@changenow.io',
link: 'mailto:support@changenow.io'), link: 'mailto:support@changenow.io'),
if (!isMoneroOnly) ... [
LinkListItem( LinkListItem(
title: 'Wyre', title: 'Wyre',
icon: 'assets/images/wyre.png', icon: 'assets/images/wyre.png',
@ -59,13 +61,14 @@ abstract class SupportViewModelBase with Store {
icon: 'assets/images/moonpay.png', icon: 'assets/images/moonpay.png',
hasIconColor: true, hasIconColor: true,
linkTitle: S.current.submit_request, linkTitle: S.current.submit_request,
link: 'https://support.moonpay.com/hc/en-gb/requests/new'), link: 'https://support.moonpay.com/hc/en-gb/requests/new')
LinkListItem( ]
title: 'Yat', //LinkListItem(
icon: 'assets/images/yat_mini_logo.png', // title: 'Yat',
hasIconColor: true, // icon: 'assets/images/yat_mini_logo.png',
linkTitle: 'support@y.at', // hasIconColor: true,
link: 'mailto:support@y.at') // linkTitle: 'support@y.at',
// link: 'mailto:support@y.at')
]; ];
} }
static const url = 'https://cakewallet.com/guide/'; static const url = 'https://cakewallet.com/guide/';

View file

@ -4,6 +4,7 @@ import 'package:cake_wallet/generated/i18n.dart';
import 'package:cw_core/wallet_base.dart'; import 'package:cw_core/wallet_base.dart';
import 'package:cake_wallet/bitcoin/bitcoin.dart'; import 'package:cake_wallet/bitcoin/bitcoin.dart';
import 'package:cake_wallet/src/screens/transaction_details/standart_list_item.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'; part 'wallet_keys_view_model.g.dart';
@ -13,19 +14,19 @@ abstract class WalletKeysViewModelBase with Store {
WalletKeysViewModelBase(WalletBase wallet) WalletKeysViewModelBase(WalletBase wallet)
: items = ObservableList<StandartListItem>() { : items = ObservableList<StandartListItem>() {
if (wallet.type == WalletType.monero) { if (wallet.type == WalletType.monero) {
//final keys = moneroUtils.getKeys(wallet); final keys = monero.getKeys(wallet);
//items.addAll([ items.addAll([
// StandartListItem( StandartListItem(
// title: S.current.spend_key_public, value: keys['publicSpendKey']), title: S.current.spend_key_public, value: keys['publicSpendKey']),
// StandartListItem( StandartListItem(
// title: S.current.spend_key_private, value: keys['privateSpendKey']), title: S.current.spend_key_private, value: keys['privateSpendKey']),
// StandartListItem( StandartListItem(
// title: S.current.view_key_public, value: keys['publicViewKey']), title: S.current.view_key_public, value: keys['publicViewKey']),
// StandartListItem( StandartListItem(
// title: S.current.view_key_private, value: keys['privateViewKey']), title: S.current.view_key_private, value: keys['privateViewKey']),
// StandartListItem(title: S.current.wallet_seed, value: wallet.seed), StandartListItem(title: S.current.wallet_seed, value: wallet.seed),
//]); ]);
} }
if (wallet.type == WalletType.bitcoin || wallet.type == WalletType.litecoin) { if (wallet.type == WalletType.bitcoin || wallet.type == WalletType.litecoin) {

View file

@ -7,6 +7,7 @@ import 'package:cake_wallet/core/key_service.dart';
import 'package:cw_core/wallet_service.dart'; import 'package:cw_core/wallet_service.dart';
import 'package:cake_wallet/view_model/wallet_list/wallet_list_item.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_info.dart';
import 'package:cw_core/wallet_type.dart';
part 'wallet_list_view_model.g.dart'; part 'wallet_list_view_model.g.dart';
@ -27,6 +28,8 @@ abstract class WalletListViewModelBase with Store {
final KeyService _keyService; final KeyService _keyService;
final WalletNewVM walletNewVM; final WalletNewVM walletNewVM;
WalletType get currentWalletType => _appStore.wallet.type;
@action @action
Future<void> loadWallet(WalletListItem wallet) async { Future<void> loadWallet(WalletListItem wallet) async {
final password = final password =

View file

@ -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;
}

View file

@ -6,6 +6,8 @@
"create_new" : "Neue Wallet erstellen", "create_new" : "Neue Wallet erstellen",
"restore_wallet" : "Wallet wiederherstellen", "restore_wallet" : "Wallet wiederherstellen",
"monero_com": "Monero.com",
"monero_com_wallet_text": "Awesome wallet for Monero",
"accounts" : "Konten", "accounts" : "Konten",
"edit" : "Bearbeiten", "edit" : "Bearbeiten",

View file

@ -6,6 +6,9 @@
"create_new" : "Create New Wallet", "create_new" : "Create New Wallet",
"restore_wallet" : "Restore Wallet", "restore_wallet" : "Restore Wallet",
"monero_com": "Monero.com",
"monero_com_wallet_text": "Awesome wallet for Monero",
"accounts" : "Accounts", "accounts" : "Accounts",
"edit" : "Edit", "edit" : "Edit",

View file

@ -6,6 +6,8 @@
"create_new" : "Crear nueva billetera", "create_new" : "Crear nueva billetera",
"restore_wallet" : "Restaurar billetera", "restore_wallet" : "Restaurar billetera",
"monero_com": "Monero.com",
"monero_com_wallet_text": "Awesome wallet for Monero",
"accounts" : "Cuentas", "accounts" : "Cuentas",
"edit" : "Editar", "edit" : "Editar",

View file

@ -6,6 +6,8 @@
"create_new" : "नया बटुआ बनाएँ", "create_new" : "नया बटुआ बनाएँ",
"restore_wallet" : "वॉलेट को पुनर्स्थापित करें", "restore_wallet" : "वॉलेट को पुनर्स्थापित करें",
"monero_com": "Monero.com",
"monero_com_wallet_text": "Awesome wallet for Monero",
"accounts" : "हिसाब किताब", "accounts" : "हिसाब किताब",
"edit" : "संपादित करें", "edit" : "संपादित करें",

View file

@ -6,6 +6,8 @@
"create_new" : "Izradi novi novčanik", "create_new" : "Izradi novi novčanik",
"restore_wallet" : "Oporavi novčanik", "restore_wallet" : "Oporavi novčanik",
"monero_com": "Monero.com",
"monero_com_wallet_text": "Awesome wallet for Monero",
"accounts" : "Računi", "accounts" : "Računi",
"edit" : "Uredi", "edit" : "Uredi",

View file

@ -6,6 +6,8 @@
"create_new" : "Genera nuovo Portafoglio", "create_new" : "Genera nuovo Portafoglio",
"restore_wallet" : "Recupera Portafoglio", "restore_wallet" : "Recupera Portafoglio",
"monero_com": "Monero.com",
"monero_com_wallet_text": "Awesome wallet for Monero",
"accounts" : "Accounts", "accounts" : "Accounts",
"edit" : "Modifica", "edit" : "Modifica",

View file

@ -6,6 +6,8 @@
"create_new" : "新しいウォレットを作成", "create_new" : "新しいウォレットを作成",
"restore_wallet" : "ウォレットを復元", "restore_wallet" : "ウォレットを復元",
"monero_com": "Monero.com",
"monero_com_wallet_text": "Awesome wallet for Monero",
"accounts" : "アカウント", "accounts" : "アカウント",
"edit" : "編集", "edit" : "編集",

View file

@ -6,6 +6,8 @@
"create_new" : "새 월렛 만들기", "create_new" : "새 월렛 만들기",
"restore_wallet" : "월렛 복원", "restore_wallet" : "월렛 복원",
"monero_com": "Monero.com",
"monero_com_wallet_text": "Awesome wallet for Monero",
"accounts" : "계정", "accounts" : "계정",
"edit" : "편집하다", "edit" : "편집하다",

View file

@ -6,6 +6,8 @@
"create_new" : "Maak een nieuwe portemonnee", "create_new" : "Maak een nieuwe portemonnee",
"restore_wallet" : "Portemonnee herstellen", "restore_wallet" : "Portemonnee herstellen",
"monero_com": "Monero.com",
"monero_com_wallet_text": "Awesome wallet for Monero",
"accounts" : "Accounts", "accounts" : "Accounts",
"edit" : "Bewerk", "edit" : "Bewerk",

View file

@ -6,6 +6,8 @@
"create_new" : "Utwórz nowy portfel", "create_new" : "Utwórz nowy portfel",
"restore_wallet" : "Przywróć portfel", "restore_wallet" : "Przywróć portfel",
"monero_com": "Monero.com",
"monero_com_wallet_text": "Awesome wallet for Monero",
"accounts" : "Konta", "accounts" : "Konta",
"edit" : "Edytować", "edit" : "Edytować",

View file

@ -6,6 +6,8 @@
"create_new" : "Criar nova carteira", "create_new" : "Criar nova carteira",
"restore_wallet" : "Restaurar carteira", "restore_wallet" : "Restaurar carteira",
"monero_com": "Monero.com",
"monero_com_wallet_text": "Awesome wallet for Monero",
"accounts" : "Contas", "accounts" : "Contas",
"edit" : "Editar", "edit" : "Editar",

View file

@ -6,6 +6,8 @@
"create_new" : "Создать новый кошелёк", "create_new" : "Создать новый кошелёк",
"restore_wallet" : "Восстановить кошелёк", "restore_wallet" : "Восстановить кошелёк",
"monero_com": "Monero.com",
"monero_com_wallet_text": "Awesome wallet for Monero",
"accounts" : "Аккаунты", "accounts" : "Аккаунты",
"edit" : "Редактировать", "edit" : "Редактировать",

View file

@ -6,6 +6,8 @@
"create_new" : "Створити новий гаманець", "create_new" : "Створити новий гаманець",
"restore_wallet" : "Відновити гаманець", "restore_wallet" : "Відновити гаманець",
"monero_com": "Monero.com",
"monero_com_wallet_text": "Awesome wallet for Monero",
"accounts" : "Акаунти", "accounts" : "Акаунти",
"edit" : "Редагувати", "edit" : "Редагувати",

View file

@ -6,6 +6,8 @@
"create_new" : "创建新钱包", "create_new" : "创建新钱包",
"restore_wallet" : "恢复钱包", "restore_wallet" : "恢复钱包",
"monero_com": "Monero.com",
"monero_com_wallet_text": "Awesome wallet for Monero",
"accounts" : "账户", "accounts" : "账户",
"edit" : "编辑", "edit" : "编辑",