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>(
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:
return CupertinoPageRoute<void>(
builder: (_) => getIt.get<NewWalletTypePage>(

View file

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

View file

@ -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<void>.delayed(Duration(seconds: 1));
//if (walletViewModel.shouldShowYatPopup) {
// await Future<void>.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<void>(
context: context,
builder: (BuildContext context) {
return YatPopup(
dashboardViewModel: walletViewModel,
onClose: () => Navigator.of(context).pop());
});
walletViewModel.furtherShowYatPopup(false);
}
// await showPopUp<void>(
// context: context,
// builder: (BuildContext context) {
// return YatPopup(
// dashboardViewModel: walletViewModel,
// onClose: () => Navigator.of(context).pop());
// });
// walletViewModel.furtherShowYatPopup(false);
//}
autorun((_) async {
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/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',

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/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<WalletListBody> {
),
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,

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/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)

View file

@ -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,

View file

@ -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/';

View file

@ -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<StandartListItem>() {
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) {

View file

@ -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<void> loadWallet(WalletListItem wallet) async {
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,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",

View file

@ -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",

View file

@ -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",

View file

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

View file

@ -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",

View file

@ -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",

View file

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

View file

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

View file

@ -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",

View file

@ -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",

View file

@ -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",

View file

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

View file

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

View file

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