From 66949fd41aaabf04f0e02b917b9a6010978abca6 Mon Sep 17 00:00:00 2001 From: Godwin Asuquo <41484542+godilite@users.noreply.github.com> Date: Fri, 21 Oct 2022 19:30:36 +0300 Subject: [PATCH 01/44] Update close button size (#551) --- lib/src/screens/auth/auth_page.dart | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/lib/src/screens/auth/auth_page.dart b/lib/src/screens/auth/auth_page.dart index b508d1123..2cd4b4d66 100644 --- a/lib/src/screens/auth/auth_page.dart +++ b/lib/src/screens/auth/auth_page.dart @@ -135,14 +135,9 @@ class AuthPageState extends State { child: SizedBox( height: 37, width: 37, - child: ButtonTheme( - minWidth: double.minPositive, - child: TextButton( - //highlightColor: Colors.transparent, - //splashColor: Colors.transparent, - //padding: EdgeInsets.all(0), - onPressed: () => Navigator.of(context).pop(), - child: _backArrowImageDarkTheme), + child: InkWell( + onTap: () => Navigator.of(context).pop(), + child: _backArrowImageDarkTheme, ), )) : Container(), From d2b951f7352515749bd227fede54d4e541ebf3c1 Mon Sep 17 00:00:00 2001 From: M Date: Fri, 21 Oct 2022 12:45:24 -0400 Subject: [PATCH 02/44] Update build version and build number --- scripts/android/app_env.sh | 8 ++++---- scripts/ios/app_env.sh | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/scripts/android/app_env.sh b/scripts/android/app_env.sh index 311913329..a5ce05d58 100755 --- a/scripts/android/app_env.sh +++ b/scripts/android/app_env.sh @@ -14,14 +14,14 @@ TYPES=($MONERO_COM $CAKEWALLET $HAVEN) APP_ANDROID_TYPE=$1 MONERO_COM_NAME="Monero.com" -MONERO_COM_VERSION="1.1.1" -MONERO_COM_BUILD_NUMBER=20 +MONERO_COM_VERSION="1.1.2" +MONERO_COM_BUILD_NUMBER=21 MONERO_COM_BUNDLE_ID="com.monero.app" MONERO_COM_PACKAGE="com.monero.app" CAKEWALLET_NAME="Cake Wallet" -CAKEWALLET_VERSION="4.4.7" -CAKEWALLET_BUILD_NUMBER=119 +CAKEWALLET_VERSION="4.4.8" +CAKEWALLET_BUILD_NUMBER=120 CAKEWALLET_BUNDLE_ID="com.cakewallet.cake_wallet" CAKEWALLET_PACKAGE="com.cakewallet.cake_wallet" diff --git a/scripts/ios/app_env.sh b/scripts/ios/app_env.sh index 236482b05..8fc1d7a1a 100755 --- a/scripts/ios/app_env.sh +++ b/scripts/ios/app_env.sh @@ -13,13 +13,13 @@ TYPES=($MONERO_COM $CAKEWALLET $HAVEN) APP_IOS_TYPE=$1 MONERO_COM_NAME="Monero.com" -MONERO_COM_VERSION="1.1.1" -MONERO_COM_BUILD_NUMBER=22 +MONERO_COM_VERSION="1.1.2" +MONERO_COM_BUILD_NUMBER=23 MONERO_COM_BUNDLE_ID="com.cakewallet.monero" CAKEWALLET_NAME="Cake Wallet" -CAKEWALLET_VERSION="4.4.7" -CAKEWALLET_BUILD_NUMBER=118 +CAKEWALLET_VERSION="4.4.8" +CAKEWALLET_BUILD_NUMBER=119 CAKEWALLET_BUNDLE_ID="com.fotolockr.cakewallet" HAVEN_NAME="Haven" From c34c3b0737d268a4116d701b110181115db3fedd Mon Sep 17 00:00:00 2001 From: Omar Hatem Date: Fri, 21 Oct 2022 22:06:59 +0200 Subject: [PATCH 03/44] Cw 199 add wallet deletion confirmation (#555) * Fix Slidable for deleting wallet Add confirmation dialog for deleting wallet * Swap confirmation dialog buttons to be consistent with other alerts --- .../screens/wallet_list/wallet_list_page.dart | 74 +++++++++++++------ res/values/strings_de.arb | 4 +- res/values/strings_en.arb | 4 +- res/values/strings_es.arb | 4 +- res/values/strings_fr.arb | 4 +- res/values/strings_hi.arb | 4 +- res/values/strings_hr.arb | 4 +- res/values/strings_it.arb | 4 +- res/values/strings_ja.arb | 4 +- res/values/strings_ko.arb | 4 +- res/values/strings_nl.arb | 4 +- res/values/strings_pl.arb | 4 +- res/values/strings_pt.arb | 4 +- res/values/strings_ru.arb | 4 +- res/values/strings_uk.arb | 4 +- res/values/strings_zh.arb | 4 +- 16 files changed, 95 insertions(+), 39 deletions(-) diff --git a/lib/src/screens/wallet_list/wallet_list_page.dart b/lib/src/screens/wallet_list/wallet_list_page.dart index d08126407..8c0f99e67 100644 --- a/lib/src/screens/wallet_list/wallet_list_page.dart +++ b/lib/src/screens/wallet_list/wallet_list_page.dart @@ -156,22 +156,14 @@ class WalletListBodyState extends State { ), )); - // FIX-ME: Slidable for current - return row; - // return wallet.isCurrent - // ? row - // : Slidable( - // key: Key('${wallet.key}'), - // actionPane: SlidableDrawerActionPane(), - // child: row, - // secondaryActions: [ - // IconSlideAction( - // caption: S.of(context).delete, - // color: Colors.red, - // icon: CupertinoIcons.delete, - // onTap: () async => _removeWallet(wallet), - // ) - // ]); + return wallet.isCurrent + ? row + : Slidable( + key: Key('${wallet.key}'), + startActionPane: _actionPane(wallet), + endActionPane: _actionPane(wallet), + child: row, + ); }), ), ), @@ -256,14 +248,34 @@ class WalletListBodyState extends State { return; } - try { - auth.changeProcessText( - S.of(context).wallet_list_removing_wallet(wallet.name)); - await widget.walletListViewModel.remove(wallet); - } catch (e) { - auth.changeProcessText(S - .of(context) - .wallet_list_failed_to_remove(wallet.name, e.toString())); + bool confirmed = false; + + await showPopUp( + context: context, + builder: (BuildContext context) { + return AlertWithTwoActions( + alertTitle: S.of(context).delete_wallet, + alertContent: S.of(context).delete_wallet_confirm_message(wallet.name), + leftButtonText: S.of(context).cancel, + rightButtonText: S.of(context).delete, + actionLeftButton: () => Navigator.of(context).pop(), + actionRightButton: () { + confirmed = true; + Navigator.of(context).pop(); + }, + ); + }); + + if (confirmed) { + try { + auth.changeProcessText( + S.of(context).wallet_list_removing_wallet(wallet.name)); + await widget.walletListViewModel.remove(wallet); + } catch (e) { + auth.changeProcessText(S + .of(context) + .wallet_list_failed_to_remove(wallet.name, e.toString())); + } } auth.close(); @@ -279,4 +291,18 @@ class WalletListBodyState extends State { // _progressBar?.dismiss(); // _progressBar = null; } + + ActionPane _actionPane(WalletListItem wallet) => ActionPane( + motion: const ScrollMotion(), + extentRatio: 0.3, + children: [ + SlidableAction( + onPressed: (_) => _removeWallet(wallet), + backgroundColor: Colors.red, + foregroundColor: Colors.white, + icon: CupertinoIcons.delete, + label: S.of(context).delete, + ), + ], + ); } diff --git a/res/values/strings_de.arb b/res/values/strings_de.arb index 3457f8ab2..33b6be87e 100644 --- a/res/values/strings_de.arb +++ b/res/values/strings_de.arb @@ -643,5 +643,7 @@ "choose_from_available_options": "Wähle aus verfügbaren Optionen:", "custom_redeem_amount": "Benutzerdefinierter Einlösungsbetrag", "add_custom_redemption": "Benutzerdefinierte Einlösung hinzufügen", - "remaining": "Rest" + "remaining": "Rest", + "delete_wallet": "Geldbörse löschen", + "delete_wallet_confirm_message" : "Sind Sie sicher, dass Sie das ${wallet_name} Wallet löschen möchten?" } diff --git a/res/values/strings_en.arb b/res/values/strings_en.arb index ef8e6e495..bf9c6e3ab 100644 --- a/res/values/strings_en.arb +++ b/res/values/strings_en.arb @@ -643,5 +643,7 @@ "choose_from_available_options": "Choose from the available options:", "custom_redeem_amount": "Custom Redeem Amount", "add_custom_redemption": "Add Custom Redemption", - "remaining": "remaining" + "remaining": "remaining", + "delete_wallet": "Delete wallet", + "delete_wallet_confirm_message" : "Are you sure that you want to delete ${wallet_name} wallet?" } diff --git a/res/values/strings_es.arb b/res/values/strings_es.arb index 7c996134e..1a355b0df 100644 --- a/res/values/strings_es.arb +++ b/res/values/strings_es.arb @@ -643,5 +643,7 @@ "choose_from_available_options": "Elija entre las opciones disponibles:", "custom_redeem_amount": "Cantidad de canje personalizada", "add_custom_redemption": "Agregar redención personalizada", - "remaining": "restante" + "remaining": "restante", + "delete_wallet": "Eliminar billetera", + "delete_wallet_confirm_message" : "¿Está seguro de que desea eliminar la billetera ${wallet_name}?" } diff --git a/res/values/strings_fr.arb b/res/values/strings_fr.arb index b347086ae..4088c5d5b 100644 --- a/res/values/strings_fr.arb +++ b/res/values/strings_fr.arb @@ -641,5 +641,7 @@ "choose_from_available_options": "Choisissez parmi les options disponibles :", "custom_redeem_amount": "Montant d'échange personnalisé", "add_custom_redemption": "Ajouter un remboursement personnalisé", - "remaining": "restant" + "remaining": "restant", + "delete_wallet": "Supprimer le portefeuille", + "delete_wallet_confirm_message" : "Êtes-vous sûr de vouloir supprimer le portefeuille ${wallet_name}?" } diff --git a/res/values/strings_hi.arb b/res/values/strings_hi.arb index 83c0808c4..779648f96 100644 --- a/res/values/strings_hi.arb +++ b/res/values/strings_hi.arb @@ -643,5 +643,7 @@ "choose_from_available_options": "उपलब्ध विकल्पों में से चुनें:", "custom_redeem_amount": "कस्टम रिडीम राशि", "add_custom_redemption": "कस्टम रिडेम्पशन जोड़ें", - "remaining": "शेष" + "remaining": "शेष", + "delete_wallet": "वॉलेट हटाएं", + "delete_wallet_confirm_message" : "क्या आप वाकई ${wallet_name} वॉलेट हटाना चाहते हैं?" } diff --git a/res/values/strings_hr.arb b/res/values/strings_hr.arb index 97d4d335c..98ed901fd 100644 --- a/res/values/strings_hr.arb +++ b/res/values/strings_hr.arb @@ -643,5 +643,7 @@ "choose_from_available_options": "Odaberite neku od dostupnih opcija:", "custom_redeem_amount": "Prilagođeni iznos otkupa", "add_custom_redemption": "Dodaj prilagođeni otkup", - "remaining": "preostalo" + "remaining": "preostalo", + "delete_wallet": "Izbriši novčanik", + "delete_wallet_confirm_message" : "Jeste li sigurni da želite izbrisati ${wallet_name} novčanik?" } diff --git a/res/values/strings_it.arb b/res/values/strings_it.arb index cd779471f..6247d83f7 100644 --- a/res/values/strings_it.arb +++ b/res/values/strings_it.arb @@ -643,5 +643,7 @@ "choose_from_available_options": "Scegli tra le opzioni disponibili:", "custom_redeem_amount": "Importo di riscatto personalizzato", "add_custom_redemption": "Aggiungi riscatto personalizzato", - "remaining": "rimanente" + "remaining": "rimanente", + "delete_wallet": "Elimina portafoglio", + "delete_wallet_confirm_message" : "Sei sicuro di voler eliminare il portafoglio ${wallet_name}?" } diff --git a/res/values/strings_ja.arb b/res/values/strings_ja.arb index 2b3920862..6b738c787 100644 --- a/res/values/strings_ja.arb +++ b/res/values/strings_ja.arb @@ -643,5 +643,7 @@ "choose_from_available_options": "利用可能なオプションから選択してください:", "custom_redeem_amount": "カスタム交換金額", "add_custom_redemption": "カスタム引き換えを追加", - "remaining": "残り" + "remaining": "残り", + "delete_wallet": "ウォレットを削除", + "delete_wallet_confirm_message" : "${wallet_name} ウォレットを削除してもよろしいですか?" } diff --git a/res/values/strings_ko.arb b/res/values/strings_ko.arb index 85ece0603..885f569db 100644 --- a/res/values/strings_ko.arb +++ b/res/values/strings_ko.arb @@ -643,5 +643,7 @@ "choose_from_available_options": "사용 가능한 옵션에서 선택:", "custom_redeem_amount": "사용자 지정 상환 금액", "add_custom_redemption": "사용자 지정 상환 추가", - "remaining": "남은" + "remaining": "남은", + "delete_wallet": "지갑 삭제", + "delete_wallet_confirm_message" : "${wallet_name} 지갑을 삭제하시겠습니까?" } diff --git a/res/values/strings_nl.arb b/res/values/strings_nl.arb index 15da6fd7b..7de7cab33 100644 --- a/res/values/strings_nl.arb +++ b/res/values/strings_nl.arb @@ -643,5 +643,7 @@ "choose_from_available_options": "Kies uit de beschikbare opties:", "custom_redeem_amount": "Aangepast inwisselbedrag", "add_custom_redemption": "Voeg aangepaste inwisseling toe", - "remaining": "resterende" + "remaining": "resterende", + "delete_wallet": "Portemonnee verwijderen", + "delete_wallet_confirm_message" : "Weet u zeker dat u de portemonnee van ${wallet_name} wilt verwijderen?" } diff --git a/res/values/strings_pl.arb b/res/values/strings_pl.arb index 26d8a38d4..87f2bbacb 100644 --- a/res/values/strings_pl.arb +++ b/res/values/strings_pl.arb @@ -643,5 +643,7 @@ "choose_from_available_options": "Wybierz z dostępnych opcji:", "custom_redeem_amount": "Niestandardowa kwota wykorzystania", "add_custom_redemption": "Dodaj niestandardowe wykorzystanie", - "remaining": "pozostałe" + "remaining": "pozostałe", + "delete_wallet": "Usuń portfel", + "delete_wallet_confirm_message" : "Czy na pewno chcesz usunąć portfel ${wallet_name}?" } diff --git a/res/values/strings_pt.arb b/res/values/strings_pt.arb index bfb4a2d0a..7f1bed93c 100644 --- a/res/values/strings_pt.arb +++ b/res/values/strings_pt.arb @@ -643,5 +643,7 @@ "choose_from_available_options": "Escolha entre as opções disponíveis:", "custom_redeem_amount": "Valor de resgate personalizado", "add_custom_redemption": "Adicionar resgate personalizado", - "remaining": "restante" + "remaining": "restante", + "delete_wallet": "Excluir carteira", + "delete_wallet_confirm_message" : "Tem certeza de que deseja excluir a carteira ${wallet_name}?" } diff --git a/res/values/strings_ru.arb b/res/values/strings_ru.arb index 94a5b3c0b..8cbf48793 100644 --- a/res/values/strings_ru.arb +++ b/res/values/strings_ru.arb @@ -643,5 +643,7 @@ "choose_from_available_options": "Выберите из доступных вариантов:", "custom_redeem_amount": "Пользовательская сумма погашения", "add_custom_redemption": "Добавить пользовательское погашение", - "remaining": "осталось" + "remaining": "осталось", + "delete_wallet": "Удалить кошелек", + "delete_wallet_confirm_message" : "Вы уверены, что хотите удалить кошелек ${wallet_name}?" } diff --git a/res/values/strings_uk.arb b/res/values/strings_uk.arb index b139750be..2f8de2884 100644 --- a/res/values/strings_uk.arb +++ b/res/values/strings_uk.arb @@ -642,5 +642,7 @@ "choose_from_available_options": "Виберіть із доступних варіантів:", "custom_redeem_amount": "Власна сума викупу", "add_custom_redemption": "Додати спеціальне погашення", - "remaining": "залишилося" + "remaining": "залишилося", + "delete_wallet": "Видалити гаманець", + "delete_wallet_confirm_message" : "Ви впевнені, що хочете видалити гаманець ${wallet_name}?" } diff --git a/res/values/strings_zh.arb b/res/values/strings_zh.arb index 487c6be52..025470941 100644 --- a/res/values/strings_zh.arb +++ b/res/values/strings_zh.arb @@ -641,5 +641,7 @@ "choose_from_available_options": "从可用选项中选择:", "custom_redeem_amount": "自定义兑换金额", "add_custom_redemption": "添加自定义兑换", - "remaining": "剩余" + "remaining": "剩余", + "delete_wallet": "删除钱包", + "delete_wallet_confirm_message" : "您确定要删除 ${wallet_name} 钱包吗?" } From 65b87ecae073723bed94b9bb7bb893abcb735662 Mon Sep 17 00:00:00 2001 From: Omar Hatem Date: Mon, 24 Oct 2022 21:06:03 +0200 Subject: [PATCH 04/44] Fix nullability of selected provider (#562) Remove un-necessary null operators --- lib/src/screens/buy/pre_order_page.dart | 21 +++++++++---------- .../screens/buy/widgets/buy_list_item.dart | 2 +- lib/view_model/buy/buy_view_model.dart | 3 +-- 3 files changed, 12 insertions(+), 14 deletions(-) diff --git a/lib/src/screens/buy/pre_order_page.dart b/lib/src/screens/buy/pre_order_page.dart index 2b9bf94d2..00a64896f 100644 --- a/lib/src/screens/buy/pre_order_page.dart +++ b/lib/src/screens/buy/pre_order_page.dart @@ -80,7 +80,7 @@ class PreOrderPage extends BasePage { return KeyboardActions( config: KeyboardActionsConfig( keyboardActionsPlatform: KeyboardActionsPlatform.IOS, - keyboardBarColor: Theme.of(context).accentTextTheme!.bodyText1! + keyboardBarColor: Theme.of(context).accentTextTheme.bodyText1! .backgroundColor!, nextFocus: false, actions: [ @@ -102,10 +102,9 @@ class PreOrderPage extends BasePage { bottomLeft: Radius.circular(24), bottomRight: Radius.circular(24)), gradient: LinearGradient(colors: [ - Theme.of(context).primaryTextTheme!.subtitle1!.color!, + Theme.of(context).primaryTextTheme.subtitle1!.color!, Theme.of(context) - .primaryTextTheme! - .subtitle1! + .primaryTextTheme.subtitle1! .decorationColor!, ], begin: Alignment.topLeft, end: Alignment.bottomRight), ), @@ -161,11 +160,11 @@ class PreOrderPage extends BasePage { ), ), hintText: '0.00', - borderColor: Theme.of(context).primaryTextTheme!.bodyText1!.decorationColor!, + borderColor: Theme.of(context).primaryTextTheme.bodyText1!.decorationColor!, borderWidth: 0.5, textStyle: TextStyle(fontSize: 36, fontWeight: FontWeight.w500, color: Colors.white), placeholderTextStyle: TextStyle( - color: Theme.of(context).primaryTextTheme!.headline5!.decorationColor!, + color: Theme.of(context).primaryTextTheme.headline5!.decorationColor!, fontWeight: FontWeight.w500, fontSize: 36, ), @@ -180,7 +179,7 @@ class PreOrderPage extends BasePage { S.of(context).buy_with + ':', textAlign: TextAlign.center, style: TextStyle( - color: Theme.of(context).primaryTextTheme!.headline6!.color!, + color: Theme.of(context).primaryTextTheme.headline6!.color!, fontSize: 18, fontWeight: FontWeight.bold ), @@ -197,11 +196,11 @@ class PreOrderPage extends BasePage { double achAmount; int minAmount; - if (snapshot.hasData) { + if (snapshot.hasData && snapshot.data != null) { sourceAmount = snapshot.data!.sourceAmount; destAmount = snapshot.data!.destAmount; minAmount = snapshot.data!.minAmount; - achAmount = snapshot.data!.achSourceAmount!; + achAmount = snapshot.data!.achSourceAmount ?? 0; } else { sourceAmount = 0.0; destAmount = 0.0; @@ -215,7 +214,7 @@ class PreOrderPage extends BasePage { child: Observer(builder: (_) { return BuyListItem( selectedProvider: - buyViewModel.selectedProvider!, + buyViewModel.selectedProvider, provider: item.provider, sourceAmount: sourceAmount, sourceCurrency: buyViewModel.fiatCurrency, @@ -247,7 +246,7 @@ class PreOrderPage extends BasePage { ? S.of(context).buy : S.of(context).buy_with + ' ${buyViewModel.selectedProvider!.description.title}', - color: Theme.of(context).accentTextTheme!.bodyText1!.color!, + color: Theme.of(context).accentTextTheme.bodyText1!.color!, textColor: Colors.white, isLoading: buyViewModel.isRunning, isDisabled: (buyViewModel.selectedProvider == null) || diff --git a/lib/src/screens/buy/widgets/buy_list_item.dart b/lib/src/screens/buy/widgets/buy_list_item.dart index 8dc12ac58..fc8fea81d 100644 --- a/lib/src/screens/buy/widgets/buy_list_item.dart +++ b/lib/src/screens/buy/widgets/buy_list_item.dart @@ -18,7 +18,7 @@ class BuyListItem extends StatelessWidget { this.onTap }); - final BuyProvider selectedProvider; + final BuyProvider? selectedProvider; final BuyProvider provider; final double sourceAmount; final FiatCurrency sourceCurrency; diff --git a/lib/view_model/buy/buy_view_model.dart b/lib/view_model/buy/buy_view_model.dart index 2baa1447b..080caa3ad 100644 --- a/lib/view_model/buy/buy_view_model.dart +++ b/lib/view_model/buy/buy_view_model.dart @@ -6,7 +6,6 @@ import 'package:cake_wallet/entities/fiat_currency.dart'; import 'package:cw_core/wallet_type.dart'; import 'package:cake_wallet/store/settings_store.dart'; import 'package:cake_wallet/view_model/buy/buy_item.dart'; -import 'package:flutter/foundation.dart'; import 'package:hive/hive.dart'; import 'package:cake_wallet/buy/order.dart'; import 'package:cake_wallet/store/dashboard/orders_store.dart'; @@ -103,7 +102,7 @@ abstract class BuyViewModelBase with Store { print(e.toString()); } - if (isMoonPayEnabled ?? false) { + if (isMoonPayEnabled) { _providerList.add(MoonPayBuyProvider(wallet: wallet)); } From 12e54426bd42da720994dc8d61150492047215d4 Mon Sep 17 00:00:00 2001 From: Omar Hatem Date: Mon, 24 Oct 2022 21:15:17 +0200 Subject: [PATCH 05/44] Fix edit/delete option slidable (#561) * Fix Edit Slidable in receive address cell Fix Edit/Delete slidable in contact list * Update Delete node slidable --- .../screens/contact/contact_list_page.dart | 81 ++++++++++--------- lib/src/screens/nodes/nodes_list_page.dart | 80 +++++++++--------- .../screens/receive/widgets/address_cell.dart | 36 +++++---- 3 files changed, 109 insertions(+), 88 deletions(-) diff --git a/lib/src/screens/contact/contact_list_page.dart b/lib/src/screens/contact/contact_list_page.dart index 501d3038c..7912472d8 100644 --- a/lib/src/screens/contact/contact_list_page.dart +++ b/lib/src/screens/contact/contact_list_page.dart @@ -1,4 +1,5 @@ import 'package:cake_wallet/entities/contact_base.dart'; +import 'package:cake_wallet/entities/contact_record.dart'; import 'package:cake_wallet/utils/show_bar.dart'; import 'package:cake_wallet/utils/show_pop_up.dart'; import 'package:flutter/material.dart'; @@ -34,12 +35,12 @@ class ContactListPage extends BasePage { height: 32.0, decoration: BoxDecoration( shape: BoxShape.circle, - color: Theme.of(context).accentTextTheme!.caption!.color!), + color: Theme.of(context).accentTextTheme.caption!.color!), child: Stack( alignment: Alignment.center, children: [ Icon(Icons.add, - color: Theme.of(context).primaryTextTheme!.headline6!.color!, + color: Theme.of(context).primaryTextTheme.headline6!.color!, size: 22.0), ButtonTheme( minWidth: 32.0, @@ -66,9 +67,9 @@ class ContactListPage extends BasePage { return CollapsibleSectionList( context: context, sectionCount: 2, - themeColor: Theme.of(context).primaryTextTheme!.headline6!.color!, + themeColor: Theme.of(context).primaryTextTheme.headline6!.color!, dividerThemeColor: - Theme.of(context).primaryTextTheme!.caption!.decorationColor!, + Theme.of(context).primaryTextTheme.caption!.decorationColor!, sectionTitleBuilder: (_, int sectionIndex) { var title = 'Contacts'; @@ -91,37 +92,13 @@ class ContactListPage extends BasePage { final contact = contactListViewModel.contacts[index]; final content = generateRaw(context, contact); - // FIX-ME: Slidable - return content; - // return !isEditable - // ? content - // : Slidable( - // key: Key('${contact.key}'), - // actionPane: SlidableDrawerActionPane(), - // child: content, - // secondaryActions: [ - // IconSlideAction( - // caption: S.of(context).edit, - // color: Colors.blue, - // icon: Icons.edit, - // onTap: () async => await Navigator.of(context) - // .pushNamed(Routes.addressBookAddContact, - // arguments: contact), - // ), - // IconSlideAction( - // caption: S.of(context).delete, - // color: Colors.red, - // icon: CupertinoIcons.delete, - // onTap: () async { - // final isDelete = - // await showAlertDialog(context) ?? false; - - // if (isDelete) { - // await contactListViewModel.delete(contact); - // } - // }, - // ), - // ]); + return !isEditable + ? content + : Slidable( + key: Key('${contact.key}'), + endActionPane: _actionPane(context, contact), + child: content, + ); }, ); }, @@ -141,7 +118,7 @@ class ContactListPage extends BasePage { final isCopied = await showNameAndAddressDialog( context, contact.name, contact.address); - if (isCopied != null && isCopied) { + if (isCopied) { await Clipboard.setData(ClipboardData(text: contact.address)); await showBar(context, S.of(context).copied_to_clipboard); } @@ -165,7 +142,7 @@ class ContactListPage extends BasePage { style: TextStyle( fontSize: 14, fontWeight: FontWeight.normal, - color: Theme.of(context).primaryTextTheme!.headline6!.color!), + color: Theme.of(context).primaryTextTheme.headline6!.color!), ), ) ) @@ -266,4 +243,34 @@ class ContactListPage extends BasePage { actionLeftButton: () => Navigator.of(context).pop(false)); }) ?? false; } + + ActionPane _actionPane(BuildContext context, ContactRecord contact) => ActionPane( + motion: const ScrollMotion(), + extentRatio: 0.4, + children: [ + SlidableAction( + onPressed: (_) async => await Navigator.of(context) + .pushNamed(Routes.addressBookAddContact, + arguments: contact), + backgroundColor: Colors.blue, + foregroundColor: Colors.white, + icon: Icons.edit, + label: S.of(context).edit, + ), + SlidableAction( + onPressed: (_) async { + final isDelete = + await showAlertDialog(context); + + if (isDelete) { + await contactListViewModel.delete(contact); + } + }, + backgroundColor: Colors.red, + foregroundColor: Colors.white, + icon: CupertinoIcons.delete, + label: S.of(context).delete, + ), + ], + ); } diff --git a/lib/src/screens/nodes/nodes_list_page.dart b/lib/src/screens/nodes/nodes_list_page.dart index 0eb79bada..556a0fd06 100644 --- a/lib/src/screens/nodes/nodes_list_page.dart +++ b/lib/src/screens/nodes/nodes_list_page.dart @@ -1,4 +1,5 @@ import 'package:cake_wallet/utils/show_pop_up.dart'; +import 'package:cw_core/node.dart'; import 'package:flutter/material.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter_mobx/flutter_mobx.dart'; @@ -26,7 +27,7 @@ class NodeListPage extends BasePage { height: 32, decoration: BoxDecoration( borderRadius: BorderRadius.all(Radius.circular(16)), - color: Theme.of(context).accentTextTheme!.caption!.color!), + color: Theme.of(context).accentTextTheme.caption!.color!), child: ButtonTheme( minWidth: double.minPositive, child: TextButton( @@ -85,7 +86,7 @@ class NodeListPage extends BasePage { final node = nodeListViewModel.nodes[index]; final isSelected = - node.keyIndex == nodeListViewModel.currentNode?.keyIndex; + node.keyIndex == nodeListViewModel.currentNode.keyIndex; final nodeListRow = NodeListRow( title: node.uriRaw, isSelected: isSelected, @@ -114,45 +115,52 @@ class NodeListPage extends BasePage { }); }); }); - // FIX-ME: Slidable - // final dismissibleRow = Slidable( - // key: Key('${node.keyIndex}'), - // actionPane: SlidableDrawerActionPane(), - // child: nodeListRow, - // secondaryActions: [ - // IconSlideAction( - // caption: S.of(context).delete, - // color: Colors.red, - // icon: CupertinoIcons.delete, - // onTap: () async { - // final confirmed = await showPopUp( - // context: context, - // builder: (BuildContext context) { - // return AlertWithTwoActions( - // alertTitle: S.of(context).remove_node, - // alertContent: - // S.of(context).remove_node_message, - // rightButtonText: S.of(context).remove, - // leftButtonText: S.of(context).cancel, - // actionRightButton: () => - // Navigator.pop(context, true), - // actionLeftButton: () => - // Navigator.pop(context, false)); - // }) ?? - // false; - // if (confirmed) { - // await nodeListViewModel.delete(node); - // } - // }, - // ), - // ]); + final dismissibleRow = Slidable( + key: Key('${node.keyIndex}'), + startActionPane: _actionPane(context, node), + endActionPane: _actionPane(context, node), + child: nodeListRow, + ); - return nodeListRow; - // return isSelected ? nodeListRow : dismissibleRow; + return isSelected ? nodeListRow : dismissibleRow; }); }, ), ); } + + ActionPane _actionPane(BuildContext context, Node node) => ActionPane( + motion: const ScrollMotion(), + extentRatio: 0.3, + children: [ + SlidableAction( + onPressed: (context) async { + final confirmed = await showPopUp( + context: context, + builder: (BuildContext context) { + return AlertWithTwoActions( + alertTitle: S.of(context).remove_node, + alertContent: + S.of(context).remove_node_message, + rightButtonText: S.of(context).remove, + leftButtonText: S.of(context).cancel, + actionRightButton: () => + Navigator.pop(context, true), + actionLeftButton: () => + Navigator.pop(context, false)); + }) ?? + false; + + if (confirmed) { + await nodeListViewModel.delete(node); + } + }, + backgroundColor: Colors.red, + foregroundColor: Colors.white, + icon: CupertinoIcons.delete, + label: S.of(context).delete, + ), + ], + ); } diff --git a/lib/src/screens/receive/widgets/address_cell.dart b/lib/src/screens/receive/widgets/address_cell.dart index c5e12a496..137db108b 100644 --- a/lib/src/screens/receive/widgets/address_cell.dart +++ b/lib/src/screens/receive/widgets/address_cell.dart @@ -57,6 +57,7 @@ class AddressCell extends StatelessWidget { final Widget cell = InkWell( onTap: () => onTap?.call(address), child: Container( + width: double.infinity, color: backgroundColor, padding: EdgeInsets.only(left: 24, right: 24, top: 28, bottom: 28), child: Text( @@ -69,20 +70,25 @@ class AddressCell extends StatelessWidget { ), ), )); - // FIX-ME: Slidable - return cell; - // return Container( - // color: backgroundColor, - // child: Slidable( - // key: Key(address), - // actionPane: SlidableDrawerActionPane(), - // child: cell, - // secondaryActions: [ - // IconSlideAction( - // caption: S.of(context).edit, - // color: Colors.blue, - // icon: Icons.edit, - // onTap: () => onEdit?.call()) - // ])); + return Slidable( + key: Key(address), + startActionPane: _actionPane(context), + endActionPane: _actionPane(context), + child: cell, + ); } + + ActionPane _actionPane(BuildContext context) => ActionPane( + motion: const ScrollMotion(), + extentRatio: 0.3, + children: [ + SlidableAction( + onPressed: (_) => onEdit?.call(), + backgroundColor: Colors.blue, + foregroundColor: Colors.white, + icon: Icons.edit, + label: S.of(context).edit, + ), + ], + ); } From ca36a425a7d627c6f346153314f9536bfc365eb2 Mon Sep 17 00:00:00 2001 From: Omar Hatem Date: Mon, 24 Oct 2022 21:23:06 +0200 Subject: [PATCH 06/44] Fix exchange provider overflow (#560) Fix splash effect style for the new Flutter button configs --- .../exchange/widgets/present_provider_picker.dart | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/lib/src/screens/exchange/widgets/present_provider_picker.dart b/lib/src/screens/exchange/widgets/present_provider_picker.dart index 15e5bb6fd..9300aaf89 100644 --- a/lib/src/screens/exchange/widgets/present_provider_picker.dart +++ b/lib/src/screens/exchange/widgets/present_provider_picker.dart @@ -20,9 +20,12 @@ class PresentProviderPicker extends StatelessWidget { return TextButton( onPressed: () => _presentProviderPicker(context), - // FIX-ME: Style - //highlightColor: Colors.transparent, - //splashColor: Colors.transparent, + style: ButtonStyle( + padding: MaterialStateProperty.all(EdgeInsets.zero), + splashFactory: NoSplash.splashFactory, + foregroundColor: MaterialStateProperty.all(Colors.transparent), + overlayColor: MaterialStateProperty.all(Colors.transparent), + ), child: Row( mainAxisSize: MainAxisSize.min, crossAxisAlignment: CrossAxisAlignment.start, @@ -46,7 +49,7 @@ class PresentProviderPicker extends StatelessWidget { style: TextStyle( fontSize: 10.0, fontWeight: FontWeight.w500, - color: Theme.of(context).textTheme!.headline5!.color!))) + color: Theme.of(context).textTheme.headline5!.color!))) ], ), SizedBox(width: 5), From fb8017a93c14fd7c8376c30e1daab8739d9baae3 Mon Sep 17 00:00:00 2001 From: Omar Hatem Date: Mon, 24 Oct 2022 21:24:20 +0200 Subject: [PATCH 07/44] Used the new barcode_scan2 package instead (#559) --- lib/entities/qr_scanner.dart | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/lib/entities/qr_scanner.dart b/lib/entities/qr_scanner.dart index 2a8e875ed..8c23f6ea1 100644 --- a/lib/entities/qr_scanner.dart +++ b/lib/entities/qr_scanner.dart @@ -1,17 +1,15 @@ -// import 'package:barcode_scan/barcode_scan.dart'; +import 'package:barcode_scan2/barcode_scan2.dart'; var isQrScannerShown = false; Future presentQRScanner() async { isQrScannerShown = true; - // FIX-ME: BarcodeScanner - throw Exception('Unimplemented'); - // try { - // final result = await BarcodeScanner.scan(); - // isQrScannerShown = false; - // return result.rawContent; - // } catch (e) { - // isQrScannerShown = false; - // rethrow; - // } + try { + final result = await BarcodeScanner.scan(); + isQrScannerShown = false; + return result.rawContent; + } catch (e) { + isQrScannerShown = false; + rethrow; + } } From d9415af4de7f7744807163639c4069fbb42c7f5b Mon Sep 17 00:00:00 2001 From: Omar Hatem Date: Mon, 24 Oct 2022 21:25:14 +0200 Subject: [PATCH 08/44] Allow null AccountListItem for create purpose not just editing (#558) --- lib/di.dart | 8 ++++---- lib/router.dart | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/di.dart b/lib/di.dart index 5a2eb7285..493fe3e1d 100644 --- a/lib/di.dart +++ b/lib/di.dart @@ -419,16 +419,16 @@ Future setup( getIt.get()));*/ getIt.registerFactoryParam( - (AccountListItem account, _) => MoneroAccountEditOrCreateViewModel( + AccountListItem?, void>( + (AccountListItem? account, _) => MoneroAccountEditOrCreateViewModel( monero!.getAccountList(getIt.get().wallet!), haven?.getAccountList(getIt.get().wallet!), wallet: getIt.get().wallet!, accountListItem: account)); - getIt.registerFactoryParam( - (AccountListItem account, _) => MoneroAccountEditOrCreatePage( + (AccountListItem? account, _) => MoneroAccountEditOrCreatePage( moneroAccountCreationViewModel: getIt.get(param1: account))); diff --git a/lib/router.dart b/lib/router.dart index 5f4618656..45459a08e 100644 --- a/lib/router.dart +++ b/lib/router.dart @@ -293,7 +293,7 @@ Route createRoute(RouteSettings settings) { case Routes.accountCreation: return CupertinoPageRoute( builder: (_) => getIt.get( - param1: settings.arguments as AccountListItem)); + param1: settings.arguments as AccountListItem?)); case Routes.addressBook: return MaterialPageRoute( From 9f187308d4a68c0fef36d881eefd096228154b74 Mon Sep 17 00:00:00 2001 From: Godwin Asuquo <41484542+godilite@users.noreply.github.com> Date: Mon, 24 Oct 2022 22:27:10 +0300 Subject: [PATCH 09/44] Fix gift card purchase (#553) * Fix gift card purchase * cast as optional bool --- lib/anypay/any_pay_payment_instruction.dart | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/anypay/any_pay_payment_instruction.dart b/lib/anypay/any_pay_payment_instruction.dart index 6477e6649..5181cad75 100644 --- a/lib/anypay/any_pay_payment_instruction.dart +++ b/lib/anypay/any_pay_payment_instruction.dart @@ -17,8 +17,8 @@ class AnyPayPaymentInstruction { return AnyPayPaymentInstruction( type: obj['type'] as String, requiredFeeRate: obj['requiredFeeRate'] as int, - txKey: obj['tx_key'] as bool, - txHash: obj['tx_hash'] as bool, + txKey: obj['tx_key'] as bool? ?? false, + txHash: obj['tx_hash'] as bool? ?? false, outputs: outputs); } From ed1dc75a3db7a98f57fb6b9fd5f94f3c74bd61ab Mon Sep 17 00:00:00 2001 From: Omar Hatem Date: Tue, 25 Oct 2022 22:33:56 +0200 Subject: [PATCH 10/44] Add nullability to amount in transaction_history.dart (#565) --- cw_monero/lib/api/transaction_history.dart | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cw_monero/lib/api/transaction_history.dart b/cw_monero/lib/api/transaction_history.dart index e9e161f42..0fc507500 100644 --- a/cw_monero/lib/api/transaction_history.dart +++ b/cw_monero/lib/api/transaction_history.dart @@ -182,7 +182,7 @@ void commitTransaction({required Pointer transactionPoint PendingTransactionDescription _createTransactionSync(Map args) { final address = args['address'] as String; final paymentId = args['paymentId'] as String; - final amount = args['amount'] as String; + final amount = args['amount'] as String?; final priorityRaw = args['priorityRaw'] as int; final accountIndex = args['accountIndex'] as int; From 95ecf4ef56b3b49a2ea1a570df6865bfb7027a88 Mon Sep 17 00:00:00 2001 From: Godwin Asuquo <41484542+godilite@users.noreply.github.com> Date: Tue, 25 Oct 2022 23:36:28 +0300 Subject: [PATCH 11/44] Cw 181 simple swap extra id fix (#532) * extra id for simple swap --- .../simpleswap/simpleswap_exchange_provider.dart | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/lib/exchange/simpleswap/simpleswap_exchange_provider.dart b/lib/exchange/simpleswap/simpleswap_exchange_provider.dart index f1183166b..c6e1baeea 100644 --- a/lib/exchange/simpleswap/simpleswap_exchange_provider.dart +++ b/lib/exchange/simpleswap/simpleswap_exchange_provider.dart @@ -35,7 +35,7 @@ class SimpleSwapExchangeProvider extends ExchangeProvider { @override ExchangeProviderDescription get description => ExchangeProviderDescription.simpleSwap; - + @override Future calculateAmount( {required CryptoCurrency from, @@ -61,7 +61,6 @@ class SimpleSwapExchangeProvider extends ExchangeProvider { if (response.body == null || response.body == "null") return 0.00; final data = json.decode(response.body) as String; - return double.parse(data); } catch (_) { return 0.00; @@ -79,7 +78,7 @@ class SimpleSwapExchangeProvider extends ExchangeProvider { @override Future createTrade({required TradeRequest request, required bool isFixedRateMode}) async { final _request = request as SimpleSwapRequest; - final headers = { + final headers = { 'Content-Type': 'application/json'}; final params = { 'api_key': apiKey, @@ -111,7 +110,7 @@ class SimpleSwapExchangeProvider extends ExchangeProvider { final id = responseJSON['id'] as String; final inputAddress = responseJSON['address_from'] as String; final settleAddress = responseJSON['user_refund_address'] as String; - + final extraId = responseJSON['extra_id_from'] as String?; return Trade( id: id, provider: description, @@ -119,6 +118,7 @@ class SimpleSwapExchangeProvider extends ExchangeProvider { to: _request.to, inputAddress: inputAddress, refundAddress: settleAddress, + extraId: extraId, state: TradeState.created, amount: _request.amount, createdAt: DateTime.now(), @@ -188,6 +188,7 @@ class SimpleSwapExchangeProvider extends ExchangeProvider { final to = CryptoCurrency.fromString(toCurrency); final inputAddress = responseJSON['address_from'] as String; final expectedSendAmount = responseJSON['expected_amount'].toString(); + final extraId = responseJSON['extra_id_from'] as String?; final status = responseJSON['status'] as String; final state = TradeState.deserialize(raw: status); @@ -195,6 +196,7 @@ class SimpleSwapExchangeProvider extends ExchangeProvider { id: id, from: from, to: to, + extraId: extraId, provider: description, inputAddress: inputAddress, amount: expectedSendAmount, From 4f2cf983decc637791dd5900119a68ec69b344af Mon Sep 17 00:00:00 2001 From: Serhii Date: Wed, 26 Oct 2022 18:05:08 +0300 Subject: [PATCH 12/44] check share plugin usage (#567) * replace share plugin with share_plus * fix share button on receive screen * add share button for btc, ltc wallets --- .../dashboard/widgets/address_page.dart | 21 +++++++++++++ lib/src/screens/receive/receive_page.dart | 30 ++++++++----------- lib/src/screens/seed/wallet_seed_page.dart | 11 ++----- pubspec_base.yaml | 4 +-- 4 files changed, 37 insertions(+), 29 deletions(-) diff --git a/lib/src/screens/dashboard/widgets/address_page.dart b/lib/src/screens/dashboard/widgets/address_page.dart index 2c7d36437..9a06dc39d 100644 --- a/lib/src/screens/dashboard/widgets/address_page.dart +++ b/lib/src/screens/dashboard/widgets/address_page.dart @@ -15,6 +15,7 @@ import 'package:cake_wallet/generated/i18n.dart'; import 'package:flutter_mobx/flutter_mobx.dart'; import 'package:keyboard_actions/keyboard_actions.dart'; import 'package:mobx/mobx.dart'; +import 'package:share_plus/share_plus.dart'; class AddressPage extends BasePage { AddressPage({ @@ -85,6 +86,26 @@ class AddressPage extends BasePage { ], begin: Alignment.topRight, end: Alignment.bottomLeft)), child: scaffold); + @override + Widget? trailing(BuildContext context) { + final shareImage = + Image.asset('assets/images/share.png', + color: Theme.of(context).accentTextTheme!.headline2!.backgroundColor!); + + return !addressListViewModel.hasAddressList ? Material( + color: Colors.transparent, + child: IconButton( + padding: EdgeInsets.zero, + constraints: BoxConstraints(), + highlightColor: Colors.transparent, + splashColor: Colors.transparent, + iconSize: 25, + onPressed: () => Share.share(addressListViewModel.address.address), + icon: shareImage, + ), + ) : null; + } + @override Widget body(BuildContext context) { autorun((_) async { diff --git a/lib/src/screens/receive/receive_page.dart b/lib/src/screens/receive/receive_page.dart index d8d4f7edb..6f6b4e31c 100644 --- a/lib/src/screens/receive/receive_page.dart +++ b/lib/src/screens/receive/receive_page.dart @@ -6,7 +6,7 @@ import 'package:cw_core/wallet_type.dart'; import 'package:flutter/material.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter_mobx/flutter_mobx.dart'; -// import 'package:esys_flutter_share/esys_flutter_share.dart'; +import 'package:share_plus/share_plus.dart'; import 'package:cake_wallet/routes.dart'; import 'package:cake_wallet/generated/i18n.dart'; import 'package:cake_wallet/di.dart'; @@ -92,23 +92,17 @@ class ReceivePage extends BasePage { Image.asset('assets/images/share.png', color: Theme.of(context).accentTextTheme!.headline2!.backgroundColor!); - return SizedBox( - height: 20.0, - width: 20.0, - child: ButtonTheme( - minWidth: double.minPositive, - child: TextButton( - // FIX-ME: Style - //highlightColor: Colors.transparent, - //splashColor: Colors.transparent, - //padding: EdgeInsets.all(0), - onPressed: () { - // FIX-ME: Share esys_flutter_share.dart - // Share.text(S.current.share_address, - // addressListViewModel.address.address, 'text/plain') - }, - child: shareImage), - ), + return Material( + color: Colors.transparent, + child: IconButton( + padding: EdgeInsets.zero, + constraints: BoxConstraints(), + highlightColor: Colors.transparent, + splashColor: Colors.transparent, + iconSize: 25, + onPressed: () => Share.share(addressListViewModel.address.address), + icon: shareImage + ) ); } diff --git a/lib/src/screens/seed/wallet_seed_page.dart b/lib/src/screens/seed/wallet_seed_page.dart index f5e206837..8de1526e8 100644 --- a/lib/src/screens/seed/wallet_seed_page.dart +++ b/lib/src/screens/seed/wallet_seed_page.dart @@ -6,7 +6,7 @@ import 'package:cake_wallet/utils/show_pop_up.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; -// import 'package:esys_flutter_share/esys_flutter_share.dart'; +import 'package:share_plus/share_plus.dart'; import 'package:flutter_mobx/flutter_mobx.dart'; import 'package:cake_wallet/generated/i18n.dart'; import 'package:cake_wallet/src/widgets/primary_button.dart'; @@ -159,13 +159,8 @@ class WalletSeedPage extends BasePage { child: Container( padding: EdgeInsets.only(right: 8.0), child: PrimaryButton( - onPressed: () { - // FIX-ME: Share esys_flutter_share - // Share.text( - // S.of(context).seed_share, - // walletSeedViewModel.seed, - // 'text/plain') - }, + onPressed: () => + Share.share(walletSeedViewModel.seed), text: S.of(context).save, color: Colors.green, textColor: Colors.white), diff --git a/pubspec_base.yaml b/pubspec_base.yaml index 3513cc4ad..2a6ebfb55 100644 --- a/pubspec_base.yaml +++ b/pubspec_base.yaml @@ -25,9 +25,7 @@ dependencies: mobx: ^2.0.7+4 flutter_mobx: ^2.0.6+1 flutter_slidable: ^2.0.0 - share: ^2.0.1 - # share_plus: ^4.0.10 - # esys_flutter_share: ^1.0.2 + share_plus: ^4.0.10 # date_range_picker: ^1.0.6 #https://api.flutter.dev/flutter/material/showDateRangePicker.html dio: ^4.0.6 From 33935c9b1d7722fb9bf90d26873fa7bcd4fc8639 Mon Sep 17 00:00:00 2001 From: Omar Hatem Date: Wed, 26 Oct 2022 20:13:44 +0200 Subject: [PATCH 13/44] Update flushbar (#568) * Replace old flushbar package with its updated version Fix flushbars throughtout the app * Fix Navigation happening all at once causing debugLocked error * Remove un-necessary async/await * Remove un-necessary future delayed * Make process text flushbar indefinite * Fix show seeds/keys popping page after being pushed instead of popping the auth route --- lib/src/screens/auth/auth_page.dart | 65 +++++----- lib/src/screens/dashboard/wallet_menu.dart | 3 +- .../new_wallet/new_wallet_type_page.dart | 15 +-- lib/src/screens/pin_code/pin_code_widget.dart | 17 ++- .../screens/wallet_list/wallet_list_page.dart | 15 +-- lib/utils/show_bar.dart | 115 ++++++++++-------- lib/view_model/auth_view_model.dart | 7 +- pubspec_base.yaml | 3 +- 8 files changed, 123 insertions(+), 117 deletions(-) diff --git a/lib/src/screens/auth/auth_page.dart b/lib/src/screens/auth/auth_page.dart index 2cd4b4d66..db5e3cd4a 100644 --- a/lib/src/screens/auth/auth_page.dart +++ b/lib/src/screens/auth/auth_page.dart @@ -1,5 +1,5 @@ +import 'package:another_flushbar/flushbar.dart'; import 'package:cake_wallet/utils/show_bar.dart'; -// import 'package:flushbar/flushbar.dart'; import 'package:mobx/mobx.dart'; import 'package:flutter/material.dart'; import 'package:flutter/cupertino.dart'; @@ -31,9 +31,8 @@ class AuthPageState extends State { final _backArrowImageDarkTheme = Image.asset('assets/images/close_button.png'); ReactionDisposer? _reaction; - // FIX-ME: replace Flushbar - // Flushbar? _authBar; - // Flushbar? _progressBar; + Flushbar? _authBar; + Flushbar? _progressBar; @override void initState() { @@ -48,39 +47,34 @@ class AuthPageState extends State { if (state is IsExecutingState) { WidgetsBinding.instance.addPostFrameCallback((_) { - // FIX-ME: Changes related to flutter upgreade. - // Could be incorrect value for duration of auth bar - // _authBar = - // createBar(S.of(context).authentication, duration: Duration()) - // ..show(context); + // null duration to make it indefinite until its disposed + _authBar = + createBar(S.of(context).authentication, duration: null) + ..show(context); }); } if (state is FailureState) { print('X'); print(state.error); - WidgetsBinding.instance.addPostFrameCallback((_) { + WidgetsBinding.instance.addPostFrameCallback((_) async { _pinCodeKey.currentState?.clear(); - // _authBar?.dismiss(); + dismissFlushBar(_authBar); showBar( context, S.of(context).failed_authentication(state.error)); - if (widget.onAuthenticationFinished != null) { - widget.onAuthenticationFinished(false, this); - } + widget.onAuthenticationFinished(false, this); }); } if (state is AuthenticationBanned) { - WidgetsBinding.instance.addPostFrameCallback((_) { + WidgetsBinding.instance.addPostFrameCallback((_) async { _pinCodeKey.currentState?.clear(); - // _authBar?.dismiss(); + dismissFlushBar(_authBar); showBar( context, S.of(context).failed_authentication(state.error)); - if (widget.onAuthenticationFinished != null) { - widget.onAuthenticationFinished(false, this); - } + widget.onAuthenticationFinished(false, this); }); } }); @@ -102,26 +96,31 @@ class AuthPageState extends State { } void changeProcessText(String text) { - // _authBar?.dismiss(); - // FIX-ME: Changes related to flutter upgreade. - // Could be incorrect value for duration of auth bar - // _progressBar = createBar(text, duration: Duration()) - // ..show(_key.currentContext); + dismissFlushBar(_authBar); + _progressBar = createBar(text, duration: null) + ..show(_key.currentContext!); } void hideProgressText() { - // _progressBar?.dismiss(); - // _progressBar = null; + dismissFlushBar(_progressBar); + _progressBar = null; } - void close() { + Future close({String? route}) async { if (_key.currentContext == null) { throw Exception('Key context is null. Should be not happened'); } - // _authBar?.dismiss(); - // _progressBar?.dismiss(); - Navigator.of(_key.currentContext!).pop(); + WidgetsBinding.instance.addPostFrameCallback((_) async { + await _authBar?.dismiss(); + await _progressBar?.dismiss(); + + if (route != null) { + Navigator.of(_key.currentContext!).pushReplacementNamed(route); + } else { + Navigator.of(_key.currentContext!).pop(); + } + }); } @override @@ -147,4 +146,10 @@ class AuthPageState extends State { body: PinCode((pin, _) => widget.authViewModel.auth(password: pin), (_) => null, widget.authViewModel.pinLength, false, _pinCodeKey)); } + + void dismissFlushBar(Flushbar? bar) { + WidgetsBinding.instance.addPostFrameCallback((_) async { + await bar?.dismiss(); + }); + } } diff --git a/lib/src/screens/dashboard/wallet_menu.dart b/lib/src/screens/dashboard/wallet_menu.dart index b7d12a190..c313eac8f 100644 --- a/lib/src/screens/dashboard/wallet_menu.dart +++ b/lib/src/screens/dashboard/wallet_menu.dart @@ -42,8 +42,7 @@ class WalletMenu { Navigator.of(context).pushNamed(Routes.auth, arguments: (bool isAuthenticatedSuccessfully, AuthPageState auth) { if (isAuthenticatedSuccessfully) { - auth.close(); - Navigator.of(auth.context).pushNamed(Routes.showKeys); + auth.close(route: Routes.showKeys); } }); }), diff --git a/lib/src/screens/new_wallet/new_wallet_type_page.dart b/lib/src/screens/new_wallet/new_wallet_type_page.dart index 23da7320a..41179f34c 100644 --- a/lib/src/screens/new_wallet/new_wallet_type_page.dart +++ b/lib/src/screens/new_wallet/new_wallet_type_page.dart @@ -1,15 +1,6 @@ -import 'package:cake_wallet/core/execution_state.dart'; -import 'package:cake_wallet/di.dart'; -import 'package:cw_core/wallet_type.dart'; -import 'package:cake_wallet/routes.dart'; -import 'package:cake_wallet/store/settings_store.dart'; -import 'package:cake_wallet/utils/show_bar.dart'; -import 'package:cake_wallet/view_model/wallet_new_vm.dart'; -// import 'package:flushbar/flushbar.dart'; import 'package:cw_core/wallet_type.dart'; import 'package:cake_wallet/themes/theme_base.dart'; import 'package:flutter/material.dart'; -import 'package:flutter/cupertino.dart'; import 'package:cake_wallet/generated/i18n.dart'; import 'package:cake_wallet/src/screens/base_page.dart'; import 'package:cake_wallet/src/widgets/primary_button.dart'; @@ -67,8 +58,6 @@ class WalletTypeFormState extends State { WalletType? selected; List types; - // FIX-ME: Replace Flushbar - // Flushbar? _progressBar; @override void initState() { @@ -97,7 +86,7 @@ class WalletTypeFormState extends State { style: TextStyle( fontSize: 16, fontWeight: FontWeight.w500, - color: Theme.of(context).primaryTextTheme!.headline6!.color!), + color: Theme.of(context).primaryTextTheme.headline6!.color!), ), ), ...types.map((type) => Padding( @@ -114,7 +103,7 @@ class WalletTypeFormState extends State { bottomSection: PrimaryButton( onPressed: () => onTypeSelected(), text: S.of(context).seed_language_next, - color: Theme.of(context).accentTextTheme!.bodyText1!.color!, + color: Theme.of(context).accentTextTheme.bodyText1!.color!, textColor: Colors.white, isDisabled: selected == null, ), diff --git a/lib/src/screens/pin_code/pin_code_widget.dart b/lib/src/screens/pin_code/pin_code_widget.dart index dd763696b..a647f3d95 100644 --- a/lib/src/screens/pin_code/pin_code_widget.dart +++ b/lib/src/screens/pin_code/pin_code_widget.dart @@ -1,7 +1,6 @@ import 'package:cake_wallet/utils/show_bar.dart'; -// import 'package:flushbar/flushbar.dart'; +import 'package:another_flushbar/flushbar.dart'; import 'package:flutter/material.dart'; -import 'package:flutter/cupertino.dart'; import 'package:cake_wallet/generated/i18n.dart'; class PinCodeWidget extends StatefulWidget { @@ -40,8 +39,7 @@ class PinCodeState extends State { String pin; String title; double _aspectRatio; - // FIX-ME: Replace Flushbar - // Flushbar? _progressBar; + Flushbar? _progressBar; int currentPinLength() => pin.length; @@ -91,19 +89,18 @@ class PinCodeState extends State { void changeProcessText(String text) { hideProgressText(); - // FIX-ME: Empty Duration, - // _progressBar = createBar(text, duration: Duration()) - // ..show(_key.currentContext); + _progressBar = createBar(text, duration: null) + ..show(_key.currentContext!); } void close() { - // _progressBar?.dismiss(); + _progressBar?.dismiss(); Navigator.of(_key.currentContext!).pop(); } void hideProgressText() { - // _progressBar?.dismiss(); - // _progressBar = null; + _progressBar?.dismiss(); + _progressBar = null; } @override diff --git a/lib/src/screens/wallet_list/wallet_list_page.dart b/lib/src/screens/wallet_list/wallet_list_page.dart index 8c0f99e67..c1a7ea953 100644 --- a/lib/src/screens/wallet_list/wallet_list_page.dart +++ b/lib/src/screens/wallet_list/wallet_list_page.dart @@ -3,7 +3,7 @@ import 'package:cake_wallet/src/widgets/alert_with_two_actions.dart'; import 'package:cake_wallet/utils/show_bar.dart'; import 'package:cake_wallet/utils/show_pop_up.dart'; import 'package:cake_wallet/view_model/wallet_list/wallet_list_item.dart'; -// import 'package:flushbar/flushbar.dart'; +import 'package:another_flushbar/flushbar.dart'; import 'package:flutter/material.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter_mobx/flutter_mobx.dart'; @@ -49,7 +49,7 @@ class WalletListBodyState extends State { Image.asset('assets/images/haven_logo.png', height: 24, width: 24); final scrollController = ScrollController(); final double tileHeight = 60; - // Flushbar? _progressBar; + Flushbar? _progressBar; @override Widget build(BuildContext context) { @@ -232,7 +232,9 @@ class WalletListBodyState extends State { await widget.walletListViewModel.loadWallet(wallet); auth.hideProgressText(); auth.close(); - Navigator.of(context).pop(); + WidgetsBinding.instance.addPostFrameCallback((_) { + Navigator.of(context).pop(); + }); } catch (e) { auth.changeProcessText(S .of(context) @@ -283,13 +285,12 @@ class WalletListBodyState extends State { } void changeProcessText(String text) { - // FIX-ME: Duration - // _progressBar = createBar(text, duration: Duration())..show(context); + _progressBar = createBar(text, duration: null)..show(context); } void hideProgressText() { - // _progressBar?.dismiss(); - // _progressBar = null; + _progressBar?.dismiss(); + _progressBar = null; } ActionPane _actionPane(WalletListItem wallet) => ActionPane( diff --git a/lib/utils/show_bar.dart b/lib/utils/show_bar.dart index 451887970..1480b58ac 100644 --- a/lib/utils/show_bar.dart +++ b/lib/utils/show_bar.dart @@ -1,58 +1,71 @@ -// import 'package:flushbar/flushbar.dart'; -import 'package:flutter/cupertino.dart'; +import 'package:another_flushbar/flushbar.dart'; import 'package:flutter/material.dart'; Future showBar(BuildContext context, String messageText, {bool isDark = false, - Duration duration = const Duration(seconds: 1), - bool isDismissible = true, - String? titleText}) async { - // FIX-ME: Unimplemented Flushbar - // final bar = Flushbar( - // boxShadows: [ - // BoxShadow( - // color: Colors.black.withOpacity(0.09), - // blurRadius: 8, - // offset: Offset(0, 2)) - // ], - // backgroundColor: isDark ? Colors.black : Colors.white, - // borderRadius: 35, - // margin: EdgeInsets.all(50), - // titleText: titleText != null - // ? Text(titleText, - // textAlign: TextAlign.center, - // style: TextStyle(color: isDark ? Colors.white : Colors.black, fontWeight: FontWeight.bold, fontSize: 24.0)) - // : null, - // messageText: Text(messageText, - // textAlign: TextAlign.center, - // style: TextStyle(color: isDark ? Colors.white : Colors.black, fontSize: 16)), - // duration: duration, - // isDismissible: isDismissible, - // flushbarPosition: FlushbarPosition.TOP, - // flushbarStyle: FlushbarStyle.FLOATING); + Duration? duration = const Duration(seconds: 1), // pass explicitly by null to make the duration indefinite + bool isDismissible = true, + String? titleText}) async { + final bar = Flushbar( + boxShadows: [ + BoxShadow( + color: Colors.black.withOpacity(0.09), + blurRadius: 8, + offset: Offset(0, 2), + ) + ], + backgroundColor: isDark ? Colors.black : Colors.white, + borderRadius: BorderRadius.circular(35), + margin: EdgeInsets.all(50), + titleText: titleText != null + ? Text( + titleText, + textAlign: TextAlign.center, + style: TextStyle( + color: isDark ? Colors.white : Colors.black, + fontWeight: FontWeight.bold, + fontSize: 24.0, + ), + ) + : null, + messageText: Text( + messageText, + textAlign: TextAlign.center, + style: TextStyle( + color: isDark ? Colors.white : Colors.black, + fontSize: 16, + ), + ), + duration: duration, + isDismissible: isDismissible, + flushbarPosition: FlushbarPosition.TOP, + flushbarStyle: FlushbarStyle.FLOATING, + ); - // return bar.show(context); - return null; + return bar.show(context); } -// FIX-ME: Unimplemented Flushbar -// Flushbar createBar(String text, - // {bool isDark = false, Duration duration = const Duration(seconds: 1), bool isDismissible = true}) { - // return Flushbar( - // boxShadows: [ - // BoxShadow( - // color: Colors.black.withOpacity(0.09), - // blurRadius: 8, - // offset: Offset(0, 2)) - // ], - // backgroundColor: isDark ? Colors.black : Colors.white, - // borderRadius: 35, - // margin: EdgeInsets.all(50), - // messageText: Text(text, - // textAlign: TextAlign.center, - // style: TextStyle(color: isDark ? Colors.white : Colors.black)), - // duration: duration, - // isDismissible: isDismissible, - // flushbarPosition: FlushbarPosition.TOP, - // flushbarStyle: FlushbarStyle.FLOATING); -// } +Flushbar createBar(String text, + {bool isDark = false, + Duration? duration = const Duration(seconds: 1), // pass explicitly by null to make the duration indefinite + bool isDismissible = true}) { + return Flushbar( + boxShadows: [ + BoxShadow( + color: Colors.black.withOpacity(0.09), + blurRadius: 8, + offset: Offset(0, 2), + ) + ], + backgroundColor: isDark ? Colors.black : Colors.white, + borderRadius: BorderRadius.circular(35), + margin: EdgeInsets.all(50), + messageText: Text(text, + textAlign: TextAlign.center, + style: TextStyle(color: isDark ? Colors.white : Colors.black)), + duration: duration, + isDismissible: isDismissible, + flushbarPosition: FlushbarPosition.TOP, + flushbarStyle: FlushbarStyle.FLOATING, + ); +} diff --git a/lib/view_model/auth_view_model.dart b/lib/view_model/auth_view_model.dart index 0003b0275..29ef46b47 100644 --- a/lib/view_model/auth_view_model.dart +++ b/lib/view_model/auth_view_model.dart @@ -1,4 +1,5 @@ import 'dart:async'; +import 'package:flutter/material.dart'; import 'package:shared_preferences/shared_preferences.dart'; import 'package:mobx/mobx.dart'; import 'package:cake_wallet/view_model/auth_state.dart'; @@ -55,8 +56,10 @@ abstract class AuthViewModelBase with Store { final isSuccessfulAuthenticated = await _authService.authenticate(password); if (isSuccessfulAuthenticated) { - state = ExecutedSuccessfullyState(); - _failureCounter = 0; + WidgetsBinding.instance.addPostFrameCallback((timeStamp) { + state = ExecutedSuccessfullyState(); + _failureCounter = 0; + }); } else { _failureCounter += 1; diff --git a/pubspec_base.yaml b/pubspec_base.yaml index 2a6ebfb55..7a3abd3bc 100644 --- a/pubspec_base.yaml +++ b/pubspec_base.yaml @@ -52,8 +52,7 @@ dependencies: connectivity: ^3.0.3 # connectivity_plus: ^2.3.5 keyboard_actions: ^4.0.1 - flushbar: ^1.10.4 - # check flushbar for replace + another_flushbar: ^1.12.29 archive: ^3.3.0 cryptography: ^2.0.5 file_picker: ^4.6.1 From acb03e55309909d6a87dac273a43fbe26374397f Mon Sep 17 00:00:00 2001 From: mkyq <53115730+mkyq@users.noreply.github.com> Date: Wed, 26 Oct 2022 15:28:27 -0400 Subject: [PATCH 14/44] Xchaha20 poly1305 integration (#569) * Integration of xchacha20-poly1305 * Remove force unwrap from _exportPreferencesJSON * Deprecate v1 export * Fix for open backup screen after auth --- lib/core/backup_service.dart | 155 +++++++++++++++------ lib/src/screens/backup/backup_page.dart | 30 ++-- lib/src/screens/dashboard/wallet_menu.dart | 15 ++ lib/view_model/backup_view_model.dart | 16 +++ pubspec_base.yaml | 5 + 5 files changed, 168 insertions(+), 53 deletions(-) diff --git a/lib/core/backup_service.dart b/lib/core/backup_service.dart index 9b2b2c7d4..999b67120 100644 --- a/lib/core/backup_service.dart +++ b/lib/core/backup_service.dart @@ -16,6 +16,7 @@ import 'package:cake_wallet/entities/secret_store_key.dart'; import 'package:cw_core/wallet_info.dart'; import 'package:cake_wallet/.secrets.g.dart' as secrets; import 'package:cake_wallet/wallet_types.g.dart'; +import 'package:cake_backup/backup.dart' as cake_backup; class BackupService { BackupService(this._flutterSecureStorage, this._walletInfoSource, @@ -23,9 +24,10 @@ class BackupService { : _cipher = Cryptography.instance.chacha20Poly1305Aead(), _correctWallets = []; - static const currentVersion = _v1; + static const currentVersion = _v2; static const _v1 = 1; + static const _v2 = 2; final Cipher _cipher; final FlutterSecureStorage _flutterSecureStorage; @@ -37,13 +39,16 @@ class BackupService { Future importBackup(Uint8List data, String password, {String nonce = secrets.backupSalt}) async { final version = getVersion(data); - final backupBytes = data.toList()..removeAt(0); - final backupData = Uint8List.fromList(backupBytes); switch (version) { case _v1: + final backupBytes = data.toList()..removeAt(0); + final backupData = Uint8List.fromList(backupBytes); await _importBackupV1(backupData, password, nonce: nonce); break; + case _v2: + await _importBackupV2(data, password); + break; default: break; } @@ -54,20 +59,26 @@ class BackupService { switch (version) { case _v1: return await _exportBackupV1(password, nonce: nonce); + case _v2: + return await _exportBackupV2(password); default: throw Exception('Incorrect version: $version for exportBackup'); } } + @Deprecated('Use v2 instead') Future _exportBackupV1(String password, - {String nonce = secrets.backupSalt}) async { + {String nonce = secrets.backupSalt}) async + => throw Exception('Deprecated. Export for backups v1 is deprecated. Please use export v2.'); + + Future _exportBackupV2(String password) async { final zipEncoder = ZipFileEncoder(); final appDir = await getApplicationDocumentsDirectory(); final now = DateTime.now(); final tmpDir = Directory('${appDir.path}/~_BACKUP_TMP'); final archivePath = '${tmpDir.path}/backup_${now.toString()}.zip'; final fileEntities = appDir.listSync(recursive: false); - final keychainDump = await _exportKeychainDump(password, nonce: nonce); + final keychainDump = await _exportKeychainDumpV2(password); final preferencesDump = await _exportPreferencesJSON(); final preferencesDumpFile = File('${tmpDir.path}/~_preferences_dump_TMP'); final keychainDumpFile = File('${tmpDir.path}/~_keychain_dump_TMP'); @@ -98,15 +109,13 @@ class BackupService { final content = File(archivePath).readAsBytesSync(); tmpDir.deleteSync(recursive: true); - final encryptedData = await _encrypt(content, password, nonce); - - return setVersion(encryptedData, currentVersion); + return await _encryptV2(content, password); } Future _importBackupV1(Uint8List data, String password, {required String nonce}) async { final appDir = await getApplicationDocumentsDirectory(); - final decryptedData = await _decrypt(data, password, nonce); + final decryptedData = await _decryptV1(data, password, nonce); final zip = ZipDecoder().decodeBytes(decryptedData); zip.files.forEach((file) { @@ -123,7 +132,30 @@ class BackupService { }); await _verifyWallets(); - await _importKeychainDump(password, nonce: nonce); + await _importKeychainDumpV1(password, nonce: nonce); + await _importPreferencesDump(); + } + + Future _importBackupV2(Uint8List data, String password) async { + final appDir = await getApplicationDocumentsDirectory(); + final decryptedData = await _decryptV2(data, password); + final zip = ZipDecoder().decodeBytes(decryptedData); + + zip.files.forEach((file) { + final filename = file.name; + + if (file.isFile) { + final content = file.content as List; + File('${appDir.path}/' + filename) + ..createSync(recursive: true) + ..writeAsBytesSync(content); + } else { + Directory('${appDir.path}/' + filename)..create(recursive: true); + } + }); + + await _verifyWallets(); + await _importKeychainDumpV2(password); await _importPreferencesDump(); } @@ -258,12 +290,12 @@ class BackupService { await preferencesFile.delete(); } - Future _importKeychainDump(String password, + Future _importKeychainDumpV1(String password, {required String nonce, String keychainSalt = secrets.backupKeychainSalt}) async { final appDir = await getApplicationDocumentsDirectory(); final keychainDumpFile = File('${appDir.path}/~_keychain_dump'); - final decryptedKeychainDumpFileData = await _decrypt( + final decryptedKeychainDumpFileData = await _decryptV1( keychainDumpFile.readAsBytesSync(), '$keychainSalt$password', nonce); final keychainJSON = json.decode(utf8.decode(decryptedKeychainDumpFileData)) as Map; @@ -288,6 +320,35 @@ class BackupService { keychainDumpFile.deleteSync(); } + Future _importKeychainDumpV2(String password, + {String keychainSalt = secrets.backupKeychainSalt}) async { + final appDir = await getApplicationDocumentsDirectory(); + final keychainDumpFile = File('${appDir.path}/~_keychain_dump'); + final decryptedKeychainDumpFileData = await _decryptV2( + keychainDumpFile.readAsBytesSync(), '$keychainSalt$password'); + final keychainJSON = json.decode(utf8.decode(decryptedKeychainDumpFileData)) + as Map; + final keychainWalletsInfo = keychainJSON['wallets'] as List; + final decodedPin = keychainJSON['pin'] as String; + final pinCodeKey = generateStoreKeyFor(key: SecretStoreKey.pinCodePassword); + final backupPasswordKey = + generateStoreKeyFor(key: SecretStoreKey.backupPassword); + final backupPassword = keychainJSON[backupPasswordKey] as String; + + await _flutterSecureStorage.write( + key: backupPasswordKey, value: backupPassword); + + keychainWalletsInfo.forEach((dynamic rawInfo) async { + final info = rawInfo as Map; + await importWalletKeychainInfo(info); + }); + + await _flutterSecureStorage.write( + key: pinCodeKey, value: encodedPinCode(pin: decodedPin)); + + keychainDumpFile.deleteSync(); + } + Future importWalletKeychainInfo(Map info) async { final name = info['name'] as String; final password = info['password'] as String; @@ -295,9 +356,14 @@ class BackupService { await _keyService.saveWalletPassword(walletName: name, password: password); } - Future _exportKeychainDump(String password, + @Deprecated('Use v2 instead') + Future _exportKeychainDumpV1(String password, {required String nonce, - String keychainSalt = secrets.backupKeychainSalt}) async { + String keychainSalt = secrets.backupKeychainSalt}) async + => throw Exception('Deprecated'); + + Future _exportKeychainDumpV2(String password, + {String keychainSalt = secrets.backupKeychainSalt}) async { final key = generateStoreKeyFor(key: SecretStoreKey.pinCodePassword); final encodedPin = await _flutterSecureStorage.read(key: key); final decodedPin = decodedPinCode(pin: encodedPin!); @@ -319,49 +385,48 @@ class BackupService { 'wallets': wallets, backupPasswordKey: backupPassword })); - final encrypted = await _encrypt( - Uint8List.fromList(data), '$keychainSalt$password', nonce); + final encrypted = await _encryptV2( + Uint8List.fromList(data), '$keychainSalt$password'); return encrypted; } Future _exportPreferencesJSON() async { - // FIX-ME: Force unwrap final preferences = { PreferencesKey.currentWalletName: - _sharedPreferences.getString(PreferencesKey.currentWalletName)!, + _sharedPreferences.getString(PreferencesKey.currentWalletName), PreferencesKey.currentNodeIdKey: - _sharedPreferences.getInt(PreferencesKey.currentNodeIdKey)!, + _sharedPreferences.getInt(PreferencesKey.currentNodeIdKey), PreferencesKey.currentBalanceDisplayModeKey: _sharedPreferences - .getInt(PreferencesKey.currentBalanceDisplayModeKey)!, + .getInt(PreferencesKey.currentBalanceDisplayModeKey), PreferencesKey.currentWalletType: - _sharedPreferences.getInt(PreferencesKey.currentWalletType)!, + _sharedPreferences.getInt(PreferencesKey.currentWalletType), PreferencesKey.currentFiatCurrencyKey: - _sharedPreferences.getString(PreferencesKey.currentFiatCurrencyKey)!, + _sharedPreferences.getString(PreferencesKey.currentFiatCurrencyKey), PreferencesKey.shouldSaveRecipientAddressKey: _sharedPreferences - .getBool(PreferencesKey.shouldSaveRecipientAddressKey)!, + .getBool(PreferencesKey.shouldSaveRecipientAddressKey), PreferencesKey.isDarkThemeLegacy: - _sharedPreferences.getBool(PreferencesKey.isDarkThemeLegacy)!, + _sharedPreferences.getBool(PreferencesKey.isDarkThemeLegacy), PreferencesKey.currentPinLength: - _sharedPreferences.getInt(PreferencesKey.currentPinLength)!, + _sharedPreferences.getInt(PreferencesKey.currentPinLength), PreferencesKey.currentTransactionPriorityKeyLegacy: _sharedPreferences - .getInt(PreferencesKey.currentTransactionPriorityKeyLegacy)!, + .getInt(PreferencesKey.currentTransactionPriorityKeyLegacy), PreferencesKey.allowBiometricalAuthenticationKey: _sharedPreferences - .getBool(PreferencesKey.allowBiometricalAuthenticationKey)!, + .getBool(PreferencesKey.allowBiometricalAuthenticationKey), PreferencesKey.currentBitcoinElectrumSererIdKey: _sharedPreferences - .getInt(PreferencesKey.currentBitcoinElectrumSererIdKey)!, + .getInt(PreferencesKey.currentBitcoinElectrumSererIdKey), PreferencesKey.currentLanguageCode: - _sharedPreferences.getString(PreferencesKey.currentLanguageCode)!, + _sharedPreferences.getString(PreferencesKey.currentLanguageCode), PreferencesKey.displayActionListModeKey: - _sharedPreferences.getInt(PreferencesKey.displayActionListModeKey)!, + _sharedPreferences.getInt(PreferencesKey.displayActionListModeKey), PreferencesKey.currentTheme: - _sharedPreferences.getInt(PreferencesKey.currentTheme)!, + _sharedPreferences.getInt(PreferencesKey.currentTheme), PreferencesKey.currentDefaultSettingsMigrationVersion: _sharedPreferences - .getInt(PreferencesKey.currentDefaultSettingsMigrationVersion)!, + .getInt(PreferencesKey.currentDefaultSettingsMigrationVersion), PreferencesKey.bitcoinTransactionPriority: - _sharedPreferences.getInt(PreferencesKey.bitcoinTransactionPriority)!, + _sharedPreferences.getInt(PreferencesKey.bitcoinTransactionPriority), PreferencesKey.moneroTransactionPriority: - _sharedPreferences.getInt(PreferencesKey.moneroTransactionPriority)!, + _sharedPreferences.getInt(PreferencesKey.moneroTransactionPriority), }; return json.encode(preferences); @@ -374,16 +439,12 @@ class BackupService { return Uint8List.fromList(bytes); } - Future _encrypt( - Uint8List data, String secretKeySource, String nonceBase64) async { - final secretKeyHash = await Cryptography.instance.sha256().hash(utf8.encode(secretKeySource)); - final secretKey = SecretKey(secretKeyHash.bytes); - final nonce = base64.decode(nonceBase64).toList(); - final box = await _cipher.encrypt(data.toList(), secretKey: secretKey, nonce: nonce); - return Uint8List.fromList(box.cipherText); - } + @Deprecated('Use v2 instead') + Future _encryptV1( + Uint8List data, String secretKeySource, String nonceBase64) async + => throw Exception('Deprecated'); - Future _decrypt( + Future _decryptV1( Uint8List data, String secretKeySource, String nonceBase64, {int macLength = 16}) async { final secretKeyHash = await Cryptography.instance.sha256().hash(utf8.encode(secretKeySource)); final secretKey = SecretKey(secretKeyHash.bytes); @@ -395,4 +456,12 @@ class BackupService { final plainData = await _cipher.decrypt(box, secretKey: secretKey); return Uint8List.fromList(plainData); } + + Future _encryptV2( + Uint8List data, String passphrase) async + => cake_backup.encrypt(passphrase, data, version: _v2); + + Future _decryptV2( + Uint8List data, String passphrase) async + => cake_backup.decrypt(passphrase, data); } diff --git a/lib/src/screens/backup/backup_page.dart b/lib/src/screens/backup/backup_page.dart index f55388943..a055066c0 100644 --- a/lib/src/screens/backup/backup_page.dart +++ b/lib/src/screens/backup/backup_page.dart @@ -1,10 +1,10 @@ import 'dart:io'; import 'package:cake_wallet/palette.dart'; import 'package:flutter/material.dart'; -import 'package:flutter/cupertino.dart'; import 'package:flutter/services.dart'; import 'package:flutter_mobx/flutter_mobx.dart'; -// import 'package:esys_flutter_share/esys_flutter_share.dart'; +import 'package:share_plus/share_plus.dart'; +import 'package:cross_file/cross_file.dart'; import 'package:cake_wallet/utils/show_bar.dart'; import 'package:cake_wallet/routes.dart'; import 'package:cake_wallet/generated/i18n.dart'; @@ -103,12 +103,14 @@ class BackupPage extends BasePage { Navigator.of(dialogContext).pop(); final backup = await backupViewModelBase.exportBackup(); + if (backup == null) { + return; + } + if (Platform.isAndroid) { - onExportAndroid(context, backup!); + onExportAndroid(context, backup); } else { - // FIX-ME: Share esys_flutter_share.dart - // await Share.file(S.of(context).backup_file, backup.name, - // backup.content, 'application/*'); + await share(backup); } }, actionLeftButton: () => Navigator.of(dialogContext).pop()); @@ -136,12 +138,20 @@ class BackupPage extends BasePage { backup.name, backup.content); Navigator.of(dialogContext).pop(); }, - actionLeftButton: () { + actionLeftButton: () async { Navigator.of(dialogContext).pop(); - // FIX-ME: Share esys_flutter_share.dart - // Share.file(S.of(context).backup_file, backup.name, - // backup.content, 'application/*'); + await share(backup); }); }); } + + Future share(BackupExportFile backup) async { + const mimeType = 'application/*'; + final path = await backupViewModelBase.saveBackupFileLocally(backup); + await Share.shareXFiles([XFile( + path, + name: backup.name, + mimeType: mimeType)]); + await backupViewModelBase.removeBackupFileLocally(backup); + } } diff --git a/lib/src/screens/dashboard/wallet_menu.dart b/lib/src/screens/dashboard/wallet_menu.dart index c313eac8f..68e7cc76d 100644 --- a/lib/src/screens/dashboard/wallet_menu.dart +++ b/lib/src/screens/dashboard/wallet_menu.dart @@ -51,6 +51,21 @@ class WalletMenu { image: Image.asset('assets/images/open_book_menu.png', height: 16, width: 16), handler: () => Navigator.of(context).pushNamed(Routes.addressBook)), + WalletMenuItem( + title: S.current.backup, + image: Image.asset('assets/images/restore_wallet.png', + height: 16, + width: 16, + color: Palette.darkBlue), + handler: () { + Navigator.of(context).pushNamed( + Routes.auth, + arguments: (bool isAuthenticatedSuccessfully, AuthPageState auth) { + if (isAuthenticatedSuccessfully) { + auth.close(route:Routes.backup); + } + }); + }), WalletMenuItem( title: S.current.settings_title, image: Image.asset('assets/images/settings_menu.png', diff --git a/lib/view_model/backup_view_model.dart b/lib/view_model/backup_view_model.dart index 2d75e2000..8cc651b17 100644 --- a/lib/view_model/backup_view_model.dart +++ b/lib/view_model/backup_view_model.dart @@ -8,6 +8,7 @@ import 'package:flutter_secure_storage/flutter_secure_storage.dart'; import 'package:mobx/mobx.dart'; import 'package:intl/intl.dart'; import 'package:cake_wallet/wallet_type_utils.dart'; +import 'package:path_provider/path_provider.dart'; part 'backup_view_model.g.dart'; @@ -71,6 +72,21 @@ abstract class BackupViewModelBase with Store { } } + Future saveBackupFileLocally(BackupExportFile backup) async { + final appDir = await getApplicationDocumentsDirectory(); + final path = '${appDir.path}/${backup.name}'; + final backupFile = File(path); + await backupFile.writeAsBytes(backup.content); + return path; + } + + Future removeBackupFileLocally(BackupExportFile backup) async { + final appDir = await getApplicationDocumentsDirectory(); + final path = '${appDir.path}/${backup.name}'; + final backupFile = File(path); + await backupFile.delete(); + } + @action void showMasterPassword() => isBackupPasswordVisible = true; diff --git a/pubspec_base.yaml b/pubspec_base.yaml index 7a3abd3bc..248a06de0 100644 --- a/pubspec_base.yaml +++ b/pubspec_base.yaml @@ -61,6 +61,11 @@ dependencies: permission_handler: ^10.0.0 device_display_brightness: ^0.0.6 platform_device_id: ^1.0.1 + cake_backup: + git: + url: https://github.com/cake-tech/cake_backup.git + ref: main + version: 1.0.0 dev_dependencies: flutter_test: From 81cec4ae20739e4a141c12a1c6dfadd1b3c0f3e0 Mon Sep 17 00:00:00 2001 From: M Date: Wed, 26 Oct 2022 15:34:56 -0400 Subject: [PATCH 15/44] Update build version --- scripts/android/app_env.sh | 2 +- scripts/ios/app_env.sh | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/android/app_env.sh b/scripts/android/app_env.sh index a5ce05d58..586005a2d 100755 --- a/scripts/android/app_env.sh +++ b/scripts/android/app_env.sh @@ -21,7 +21,7 @@ MONERO_COM_PACKAGE="com.monero.app" CAKEWALLET_NAME="Cake Wallet" CAKEWALLET_VERSION="4.4.8" -CAKEWALLET_BUILD_NUMBER=120 +CAKEWALLET_BUILD_NUMBER=121 CAKEWALLET_BUNDLE_ID="com.cakewallet.cake_wallet" CAKEWALLET_PACKAGE="com.cakewallet.cake_wallet" diff --git a/scripts/ios/app_env.sh b/scripts/ios/app_env.sh index 8fc1d7a1a..ac0561d43 100755 --- a/scripts/ios/app_env.sh +++ b/scripts/ios/app_env.sh @@ -19,7 +19,7 @@ MONERO_COM_BUNDLE_ID="com.cakewallet.monero" CAKEWALLET_NAME="Cake Wallet" CAKEWALLET_VERSION="4.4.8" -CAKEWALLET_BUILD_NUMBER=119 +CAKEWALLET_BUILD_NUMBER=120 CAKEWALLET_BUNDLE_ID="com.fotolockr.cakewallet" HAVEN_NAME="Haven" From bd5a2fa49fd751a46d243244eb26bf579f797f5a Mon Sep 17 00:00:00 2001 From: mkyq <53115730+mkyq@users.noreply.github.com> Date: Thu, 27 Oct 2022 10:28:43 -0400 Subject: [PATCH 16/44] Back EditBackupPasswordViewModel factory (#570) --- lib/di.dart | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib/di.dart b/lib/di.dart index 493fe3e1d..6a3ea37d9 100644 --- a/lib/di.dart +++ b/lib/di.dart @@ -587,6 +587,9 @@ Future setup( getIt.registerFactory(() => BackupPage(getIt.get())); + getIt.registerFactory( + () => EditBackupPasswordViewModel(getIt.get(), getIt.get())); + getIt.registerFactory( () => EditBackupPasswordPage(getIt.get())); From b2a5c66c372d17a7c8ef2ef6ff70bd8e9aeb4622 Mon Sep 17 00:00:00 2001 From: mkyq <53115730+mkyq@users.noreply.github.com> Date: Thu, 27 Oct 2022 17:33:58 -0400 Subject: [PATCH 17/44] Add onramper widget for buy screen (#571) --- lib/di.dart | 5 ++ lib/router.dart | 4 + lib/routes.dart | 1 + lib/src/screens/buy/onramper_page.dart | 82 +++++++++++++++++++ lib/src/screens/dashboard/dashboard_page.dart | 4 +- tool/utils/secret_key.dart | 3 +- 6 files changed, 96 insertions(+), 3 deletions(-) create mode 100644 lib/src/screens/buy/onramper_page.dart diff --git a/lib/di.dart b/lib/di.dart index 6a3ea37d9..c10b8de5f 100644 --- a/lib/di.dart +++ b/lib/di.dart @@ -4,6 +4,7 @@ import 'package:cake_wallet/entities/wake_lock.dart'; import 'package:cake_wallet/ionia/ionia_anypay.dart'; import 'package:cake_wallet/ionia/ionia_gift_card.dart'; import 'package:cake_wallet/ionia/ionia_tip.dart'; +import 'package:cake_wallet/src/screens/buy/onramper_page.dart'; import 'package:cake_wallet/src/screens/ionia/cards/ionia_custom_redeem_page.dart'; import 'package:cake_wallet/src/screens/ionia/cards/ionia_gift_card_detail_page.dart'; import 'package:cake_wallet/src/screens/ionia/cards/ionia_more_options_page.dart'; @@ -482,6 +483,10 @@ Future setup( getIt.registerFactory( () => NodeCreateOrEditPage(getIt.get())); + getIt.registerFactory(() => OnRamperPage( + settingsStore: getIt.get().settingsStore, + wallet: getIt.get().wallet!)); + getIt.registerFactory(() => ExchangeViewModel( getIt.get().wallet!, _tradesSource, diff --git a/lib/router.dart b/lib/router.dart index 45459a08e..b255ce8b9 100644 --- a/lib/router.dart +++ b/lib/router.dart @@ -3,6 +3,7 @@ import 'package:cake_wallet/buy/order.dart'; import 'package:cake_wallet/src/screens/backup/backup_page.dart'; import 'package:cake_wallet/src/screens/backup/edit_backup_password_page.dart'; import 'package:cake_wallet/src/screens/buy/buy_webview_page.dart'; +import 'package:cake_wallet/src/screens/buy/onramper_page.dart'; import 'package:cake_wallet/src/screens/buy/pre_order_page.dart'; import 'package:cake_wallet/src/screens/ionia/cards/ionia_account_cards_page.dart'; import 'package:cake_wallet/src/screens/ionia/cards/ionia_account_page.dart'; @@ -471,6 +472,9 @@ Route createRoute(RouteSettings settings) { param1: paymentInfo, param2: commitedInfo)); + case Routes.onramperPage: + return CupertinoPageRoute(builder: (_) => getIt.get()); + default: return MaterialPageRoute( builder: (_) => Scaffold( diff --git a/lib/routes.dart b/lib/routes.dart index 7431d71df..3a781ac3a 100644 --- a/lib/routes.dart +++ b/lib/routes.dart @@ -76,4 +76,5 @@ class Routes { static const ioniaPaymentStatusPage = '/ionia_payment_status_page'; static const ioniaMoreOptionsPage = '/ionia_more_options_page'; static const ioniaCustomRedeemPage = '/ionia_custom_redeem_page'; + static const onramperPage = '/onramper'; } diff --git a/lib/src/screens/buy/onramper_page.dart b/lib/src/screens/buy/onramper_page.dart new file mode 100644 index 000000000..1ba0dc869 --- /dev/null +++ b/lib/src/screens/buy/onramper_page.dart @@ -0,0 +1,82 @@ +import 'dart:io'; +import 'package:cake_wallet/generated/i18n.dart'; +import 'package:cake_wallet/src/screens/base_page.dart'; +import 'package:cake_wallet/store/settings_store.dart'; +import 'package:cw_core/wallet_base.dart'; +import 'package:flutter/material.dart'; +import 'package:webview_flutter/webview_flutter.dart'; +import 'package:cake_wallet/.secrets.g.dart' as secrets; + +class OnRamperPage extends BasePage { + OnRamperPage({ + required this.settingsStore, + required this.wallet}); + + final SettingsStore settingsStore; + final WalletBase wallet; + + @override + String get title => S.current.buy; + + @override + Widget body(BuildContext context) { + final darkMode = Theme.of(context).brightness == Brightness.dark; + return OnRamperPageBody( + settingsStore: settingsStore, + wallet: wallet, + darkMode: darkMode, + backgroundColor: darkMode + ? backgroundDarkColor + : backgroundLightColor, + supportSell: false); + } +} + +class OnRamperPageBody extends StatefulWidget { + OnRamperPageBody({ + required this.settingsStore, + required this.wallet, + required this.darkMode, + required this.supportSell, + required this.backgroundColor}); + + static const baseUrl = 'widget.onramper.com'; + final SettingsStore settingsStore; + final WalletBase wallet; + final Color backgroundColor; + final bool darkMode; + final bool supportSell; + + Uri get uri + => Uri.https( + baseUrl, + '', + { + 'apiKey': secrets.onramperApiKey, + 'defaultCrypto': wallet.currency.title, + 'defaultFiat': settingsStore.fiatCurrency.title, + 'wallets': '${wallet.currency.title}:${wallet.walletAddresses.address}', + 'darkMode': darkMode.toString(), + 'supportSell': supportSell.toString()}); + + @override + OnRamperPageBodyState createState() => OnRamperPageBodyState(); +} + +class OnRamperPageBodyState extends State { + OnRamperPageBodyState(); + + @override + void initState() { + super.initState(); + if (Platform.isAndroid) WebView.platform = SurfaceAndroidWebView(); + } + + @override + Widget build(BuildContext context) { + return WebView( + initialUrl: widget.uri.toString(), + backgroundColor: widget.backgroundColor, + javascriptMode: JavascriptMode.unrestricted); + } +} diff --git a/lib/src/screens/dashboard/dashboard_page.dart b/lib/src/screens/dashboard/dashboard_page.dart index c893a7df8..f3d5a21fb 100644 --- a/lib/src/screens/dashboard/dashboard_page.dart +++ b/lib/src/screens/dashboard/dashboard_page.dart @@ -271,10 +271,10 @@ class DashboardPage extends BasePage { switch (walletType) { case WalletType.bitcoin: - Navigator.of(context).pushNamed(Routes.preOrder); + Navigator.of(context).pushNamed(Routes.onramperPage); break; case WalletType.litecoin: - Navigator.of(context).pushNamed(Routes.preOrder); + Navigator.of(context).pushNamed(Routes.onramperPage); break; default: await showPopUp( diff --git a/tool/utils/secret_key.dart b/tool/utils/secret_key.dart index 9bf360017..4502bca74 100644 --- a/tool/utils/secret_key.dart +++ b/tool/utils/secret_key.dart @@ -25,7 +25,8 @@ class SecretKey { SecretKey('moonPaySecretKey', () => ''), SecretKey('sideShiftAffiliateId', () => ''), SecretKey('sideShiftApiKey', () => ''), - SecretKey('simpleSwapApiKey', () => '') + SecretKey('simpleSwapApiKey', () => ''), + SecretKey('onramperApiKey', () => ''), ]; final String name; From 906703b72feb8f25edb3d507b6924d1f897cbb0e Mon Sep 17 00:00:00 2001 From: M Date: Thu, 27 Oct 2022 17:35:35 -0400 Subject: [PATCH 18/44] Update Poidfile for share_plus --- ios/Podfile.lock | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/ios/Podfile.lock b/ios/Podfile.lock index ec8e4f2e3..f8f120bd6 100644 --- a/ios/Podfile.lock +++ b/ios/Podfile.lock @@ -119,7 +119,7 @@ PODS: - SDWebImage (5.9.1): - SDWebImage/Core (= 5.9.1) - SDWebImage/Core (5.9.1) - - share (0.0.1): + - share_plus (0.0.1): - Flutter - shared_preferences_ios (0.0.1): - Flutter @@ -153,7 +153,7 @@ DEPENDENCIES: - path_provider_ios (from `.symlinks/plugins/path_provider_ios/ios`) - permission_handler_apple (from `.symlinks/plugins/permission_handler_apple/ios`) - platform_device_id (from `.symlinks/plugins/platform_device_id/ios`) - - share (from `.symlinks/plugins/share/ios`) + - share_plus (from `.symlinks/plugins/share_plus/ios`) - shared_preferences_ios (from `.symlinks/plugins/shared_preferences_ios/ios`) - uni_links (from `.symlinks/plugins/uni_links/ios`) - UnstoppableDomainsResolution (~> 4.0.0) @@ -206,8 +206,8 @@ EXTERNAL SOURCES: :path: ".symlinks/plugins/permission_handler_apple/ios" platform_device_id: :path: ".symlinks/plugins/platform_device_id/ios" - share: - :path: ".symlinks/plugins/share/ios" + share_plus: + :path: ".symlinks/plugins/share_plus/ios" shared_preferences_ios: :path: ".symlinks/plugins/shared_preferences_ios/ios" uni_links: @@ -241,7 +241,7 @@ SPEC CHECKSUMS: platform_device_id: 81b3e2993881f87d0c82ef151dc274df4869aef5 Reachability: 33e18b67625424e47b6cde6d202dce689ad7af96 SDWebImage: a990c053fff71e388a10f3357edb0be17929c9c5 - share: 0b2c3e82132f5888bccca3351c504d0003b3b410 + share_plus: 056a1e8ac890df3e33cb503afffaf1e9b4fbae68 shared_preferences_ios: 548a61f8053b9b8a49ac19c1ffbc8b92c50d68ad SwiftProtobuf: c3c12645230d9b09c72267e0de89468c5543bd86 SwiftyGif: e466e86c660d343357ab944a819a101c4127cb40 From a4a9ca2e73e15089b75c9f800b7d7cd0060bbdab Mon Sep 17 00:00:00 2001 From: M Date: Thu, 27 Oct 2022 17:36:53 -0400 Subject: [PATCH 19/44] Update build version --- scripts/android/app_env.sh | 2 +- scripts/ios/app_env.sh | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/android/app_env.sh b/scripts/android/app_env.sh index 586005a2d..48fd9c196 100755 --- a/scripts/android/app_env.sh +++ b/scripts/android/app_env.sh @@ -21,7 +21,7 @@ MONERO_COM_PACKAGE="com.monero.app" CAKEWALLET_NAME="Cake Wallet" CAKEWALLET_VERSION="4.4.8" -CAKEWALLET_BUILD_NUMBER=121 +CAKEWALLET_BUILD_NUMBER=122 CAKEWALLET_BUNDLE_ID="com.cakewallet.cake_wallet" CAKEWALLET_PACKAGE="com.cakewallet.cake_wallet" diff --git a/scripts/ios/app_env.sh b/scripts/ios/app_env.sh index ac0561d43..d20e921a0 100755 --- a/scripts/ios/app_env.sh +++ b/scripts/ios/app_env.sh @@ -19,7 +19,7 @@ MONERO_COM_BUNDLE_ID="com.cakewallet.monero" CAKEWALLET_NAME="Cake Wallet" CAKEWALLET_VERSION="4.4.8" -CAKEWALLET_BUILD_NUMBER=120 +CAKEWALLET_BUILD_NUMBER=121 CAKEWALLET_BUNDLE_ID="com.fotolockr.cakewallet" HAVEN_NAME="Haven" From 12e7b455207a764a0b1119e794ae045270b15e8e Mon Sep 17 00:00:00 2001 From: Justin Ehrenhofer Date: Fri, 28 Oct 2022 11:21:58 -0500 Subject: [PATCH 20/44] Remove Onramper swap (#573) It's not supported here, so removing to avoid confusion --- lib/src/screens/buy/onramper_page.dart | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/lib/src/screens/buy/onramper_page.dart b/lib/src/screens/buy/onramper_page.dart index 1ba0dc869..b766fd388 100644 --- a/lib/src/screens/buy/onramper_page.dart +++ b/lib/src/screens/buy/onramper_page.dart @@ -28,7 +28,8 @@ class OnRamperPage extends BasePage { backgroundColor: darkMode ? backgroundDarkColor : backgroundLightColor, - supportSell: false); + supportSell: false, + supportSwap: false); } } @@ -38,6 +39,7 @@ class OnRamperPageBody extends StatefulWidget { required this.wallet, required this.darkMode, required this.supportSell, + required this.supportSwap, required this.backgroundColor}); static const baseUrl = 'widget.onramper.com'; @@ -46,6 +48,7 @@ class OnRamperPageBody extends StatefulWidget { final Color backgroundColor; final bool darkMode; final bool supportSell; + final bool supportSwap; Uri get uri => Uri.https( @@ -57,7 +60,8 @@ class OnRamperPageBody extends StatefulWidget { 'defaultFiat': settingsStore.fiatCurrency.title, 'wallets': '${wallet.currency.title}:${wallet.walletAddresses.address}', 'darkMode': darkMode.toString(), - 'supportSell': supportSell.toString()}); + 'supportSell': supportSell.toString(), + 'supportSwap': supportSwap.toString()}); @override OnRamperPageBodyState createState() => OnRamperPageBodyState(); From 52aabee658f8a1298c4dba98dba9b2597c56ece7 Mon Sep 17 00:00:00 2001 From: mkyq <53115730+mkyq@users.noreply.github.com> Date: Fri, 28 Oct 2022 18:09:27 -0400 Subject: [PATCH 21/44] Remove direct calls of cw_bitcoin BitcoinTransactionPriority from SendViewModel and SettingsViewModel. Add bitcoinTransactionPriorityWithLabel to bitcoin facade. (#574) --- lib/bitcoin/cw_bitcoin.dart | 4 ++++ lib/view_model/send/send_view_model.dart | 3 +-- lib/view_model/settings/settings_view_model.dart | 3 +-- tool/configure.dart | 1 + 4 files changed, 7 insertions(+), 4 deletions(-) diff --git a/lib/bitcoin/cw_bitcoin.dart b/lib/bitcoin/cw_bitcoin.dart index 9d5484b79..ff6fd7531 100644 --- a/lib/bitcoin/cw_bitcoin.dart +++ b/lib/bitcoin/cw_bitcoin.dart @@ -112,6 +112,10 @@ class CWBitcoin extends Bitcoin { int formatterStringDoubleToBitcoinAmount(String amount) => stringDoubleToBitcoinAmount(amount); + @override + String bitcoinTransactionPriorityWithLabel(TransactionPriority priority, int rate) + => (priority as BitcoinTransactionPriority).labelWithRate(rate); + @override List getUnspents(Object wallet) { final bitcoinWallet = wallet as ElectrumWallet; diff --git a/lib/view_model/send/send_view_model.dart b/lib/view_model/send/send_view_model.dart index b6bac59e0..cdef6faba 100644 --- a/lib/view_model/send/send_view_model.dart +++ b/lib/view_model/send/send_view_model.dart @@ -1,7 +1,6 @@ import 'package:cake_wallet/entities/balance_display_mode.dart'; import 'package:cake_wallet/entities/transaction_description.dart'; import 'package:cake_wallet/view_model/dashboard/balance_view_model.dart'; -import 'package:cw_bitcoin/bitcoin_transaction_priority.dart'; import 'package:cw_core/transaction_priority.dart'; import 'package:cake_wallet/view_model/send/output.dart'; import 'package:cake_wallet/view_model/send/send_template_view_model.dart'; @@ -276,7 +275,7 @@ abstract class SendViewModelBase with Store { if (isElectrumWallet) { final rate = bitcoin!.getFeeRate(wallet, _priority); - return '${(priority as BitcoinTransactionPriority).labelWithRate(rate)}'; + return bitcoin!.bitcoinTransactionPriorityWithLabel(_priority, rate); } return priority.toString(); diff --git a/lib/view_model/settings/settings_view_model.dart b/lib/view_model/settings/settings_view_model.dart index c3ca2e3b9..96b2e7bdd 100644 --- a/lib/view_model/settings/settings_view_model.dart +++ b/lib/view_model/settings/settings_view_model.dart @@ -1,7 +1,6 @@ import 'package:cake_wallet/entities/language_service.dart'; import 'package:cake_wallet/store/yat/yat_store.dart'; import 'package:cake_wallet/view_model/settings/choices_list_item.dart'; -import 'package:cw_bitcoin/bitcoin_transaction_priority.dart'; import 'package:flutter/cupertino.dart'; import 'package:mobx/mobx.dart'; import 'package:package_info/package_info.dart'; @@ -137,7 +136,7 @@ abstract class SettingsViewModelBase with Store { if (wallet.type == WalletType.bitcoin || wallet.type == WalletType.litecoin) { final rate = bitcoin!.getFeeRate(wallet, _priority); - return '${(priority as BitcoinTransactionPriority).labelWithRate(rate)}'; + return bitcoin!.bitcoinTransactionPriorityWithLabel(_priority, rate); } return priority.toString(); diff --git a/tool/configure.dart b/tool/configure.dart index 3b2414192..ca8d3c9fb 100644 --- a/tool/configure.dart +++ b/tool/configure.dart @@ -86,6 +86,7 @@ abstract class Bitcoin { String formatterBitcoinAmountToString({required int amount}); double formatterBitcoinAmountToDouble({required int amount}); int formatterStringDoubleToBitcoinAmount(String amount); + String bitcoinTransactionPriorityWithLabel(TransactionPriority priority, int rate); List getUnspents(Object wallet); void updateUnspents(Object wallet); From ef5d1f5f60a60e98a95f14677c87157f9cf66325 Mon Sep 17 00:00:00 2001 From: mkyq <53115730+mkyq@users.noreply.github.com> Date: Mon, 31 Oct 2022 12:16:46 -0400 Subject: [PATCH 22/44] Change type for yatEid and yatLastUsedAddressRaw to optional. (#580) --- cw_core/lib/wallet_info.dart | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/cw_core/lib/wallet_info.dart b/cw_core/lib/wallet_info.dart index 130b8ff5f..66ed1e932 100644 --- a/cw_core/lib/wallet_info.dart +++ b/cw_core/lib/wallet_info.dart @@ -64,15 +64,15 @@ class WalletInfo extends HiveObject { Map? addresses; @HiveField(11) - String yatEid; + String? yatEid; @HiveField(12) - String yatLastUsedAddressRaw; + String? yatLastUsedAddressRaw; @HiveField(13) bool? showIntroCakePayCard; - String get yatLastUsedAddress => yatLastUsedAddressRaw; + String get yatLastUsedAddress => yatLastUsedAddressRaw ?? ''; set yatLastUsedAddress(String address) { yatLastUsedAddressRaw = address; From 03d6701bb728e6655bcc5063a0c1420b6517407e Mon Sep 17 00:00:00 2001 From: mkyq <53115730+mkyq@users.noreply.github.com> Date: Mon, 31 Oct 2022 12:38:24 -0400 Subject: [PATCH 23/44] Add stacktrace to main error screen (#582) --- lib/main.dart | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/main.dart b/lib/main.dart index aa09b9a15..3cd5679b3 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -130,7 +130,7 @@ Future main() async { secureStorage: secureStorage, initialMigrationVersion: 17); runApp(App()); - } catch (e) { + } catch (e, stacktrace) { runApp(MaterialApp( debugShowCheckedModeBanner: true, home: Scaffold( @@ -138,7 +138,7 @@ Future main() async { margin: EdgeInsets.only(top: 50, left: 20, right: 20, bottom: 20), child: Text( - 'Error:\n${e.toString()}', + 'Error:\n${e.toString()}\nStacktrace: $stacktrace', style: TextStyle(fontSize: 22), ))))); } From b182c26ff2ed6cb97a0f7ec0843459ce6b1ed952 Mon Sep 17 00:00:00 2001 From: mkyq <53115730+mkyq@users.noreply.github.com> Date: Tue, 1 Nov 2022 17:43:39 -0400 Subject: [PATCH 24/44] Update hive types: UnspentCoinsInfo, Template, ExchangeTemplate. (#583) --- cw_bitcoin/lib/electrum_wallet.dart | 2 +- cw_core/lib/unspent_coins_info.dart | 8 +++- lib/entities/template.dart | 42 ++++++++++++------- lib/exchange/exchange_template.dart | 36 ++++++++++------ .../templates/exchange_template_store.dart | 16 +++---- lib/store/templates/send_template_store.dart | 18 ++++---- 6 files changed, 76 insertions(+), 46 deletions(-) diff --git a/cw_bitcoin/lib/electrum_wallet.dart b/cw_bitcoin/lib/electrum_wallet.dart index ffe378069..7abed8c07 100644 --- a/cw_bitcoin/lib/electrum_wallet.dart +++ b/cw_bitcoin/lib/electrum_wallet.dart @@ -495,7 +495,7 @@ abstract class ElectrumWalletBase extends WalletBase noteRaw ?? ''; + + set note(String value) => noteRaw = value; } \ No newline at end of file diff --git a/lib/entities/template.dart b/lib/entities/template.dart index e05c423fd..c26e3a501 100644 --- a/lib/entities/template.dart +++ b/lib/entities/template.dart @@ -5,36 +5,50 @@ part 'template.g.dart'; @HiveType(typeId: Template.typeId) class Template extends HiveObject { Template({ - required this.name, - required this.isCurrencySelected, - required this.address, - required this.cryptoCurrency, - required this.amount, - required this.fiatCurrency, - required this.amountFiat}); + required this.nameRaw, + required this.isCurrencySelectedRaw, + required this.addressRaw, + required this.cryptoCurrencyRaw, + required this.amountRaw, + required this.fiatCurrencyRaw, + required this.amountFiatRaw}); static const typeId = 6; static const boxName = 'Template'; @HiveField(0) - String name; + String? nameRaw; @HiveField(1) - String address; + String? addressRaw; @HiveField(2) - String cryptoCurrency; + String? cryptoCurrencyRaw; @HiveField(3) - String amount; + String? amountRaw; @HiveField(4) - String fiatCurrency; + String? fiatCurrencyRaw; @HiveField(5) - bool isCurrencySelected; + bool? isCurrencySelectedRaw; @HiveField(6) - String amountFiat; + String? amountFiatRaw; + + bool get isCurrencySelected => isCurrencySelectedRaw ?? false; + + String get fiatCurrency => fiatCurrencyRaw ?? ''; + + String get amountFiat => amountFiatRaw ?? ''; + + String get name => nameRaw ?? ''; + + String get address => addressRaw ?? ''; + + String get cryptoCurrency => cryptoCurrencyRaw ?? ''; + + String get amount => amountRaw ?? ''; } diff --git a/lib/exchange/exchange_template.dart b/lib/exchange/exchange_template.dart index 93d8b851e..26e1fa761 100644 --- a/lib/exchange/exchange_template.dart +++ b/lib/exchange/exchange_template.dart @@ -5,32 +5,44 @@ part 'exchange_template.g.dart'; @HiveType(typeId: ExchangeTemplate.typeId) class ExchangeTemplate extends HiveObject { ExchangeTemplate({ - required this.amount, - required this.depositCurrency, - required this.receiveCurrency, - required this.provider, - required this.depositAddress, - required this.receiveAddress + required this.amountRaw, + required this.depositCurrencyRaw, + required this.receiveCurrencyRaw, + required this.providerRaw, + required this.depositAddressRaw, + required this.receiveAddressRaw }); static const typeId = 7; static const boxName = 'ExchangeTemplate'; @HiveField(0) - String amount; + String? amountRaw; @HiveField(1) - String depositCurrency; + String? depositCurrencyRaw; @HiveField(2) - String receiveCurrency; + String? receiveCurrencyRaw; @HiveField(3) - String provider; + String? providerRaw; @HiveField(4) - String depositAddress; + String? depositAddressRaw; @HiveField(5) - String receiveAddress; + String? receiveAddressRaw; + + String get amount => amountRaw ?? ''; + + String get depositCurrency => depositCurrencyRaw ?? ''; + + String get receiveCurrency => receiveCurrencyRaw ?? ''; + + String get provider => providerRaw ?? ''; + + String get depositAddress => depositAddressRaw ?? ''; + + String get receiveAddress => receiveAddressRaw ?? ''; } \ No newline at end of file diff --git a/lib/store/templates/exchange_template_store.dart b/lib/store/templates/exchange_template_store.dart index 9e61dee4c..a63c2f56e 100644 --- a/lib/store/templates/exchange_template_store.dart +++ b/lib/store/templates/exchange_template_store.dart @@ -24,7 +24,7 @@ abstract class ExchangeTemplateBase with Store { templates.replaceRange(0, templates.length, templateSource.values.toList()); @action - Future addTemplate({ + Future addTemplate({ required String amount, required String depositCurrency, required String receiveCurrency, @@ -32,15 +32,15 @@ abstract class ExchangeTemplateBase with Store { required String depositAddress, required String receiveAddress}) async { final template = ExchangeTemplate( - amount: amount, - depositCurrency: depositCurrency, - receiveCurrency: receiveCurrency, - provider: provider, - depositAddress: depositAddress, - receiveAddress: receiveAddress); + amountRaw: amount, + depositCurrencyRaw: depositCurrency, + receiveCurrencyRaw: receiveCurrency, + providerRaw: provider, + depositAddressRaw: depositAddress, + receiveAddressRaw: receiveAddress); await templateSource.add(template); } @action - Future remove({required ExchangeTemplate template}) async => await template.delete(); + Future remove({required ExchangeTemplate template}) async => await template.delete(); } \ No newline at end of file diff --git a/lib/store/templates/send_template_store.dart b/lib/store/templates/send_template_store.dart index b1a5ce44b..d5181c0ce 100644 --- a/lib/store/templates/send_template_store.dart +++ b/lib/store/templates/send_template_store.dart @@ -23,7 +23,7 @@ abstract class SendTemplateBase with Store { templates.replaceRange(0, templates.length, templateSource.values.toList()); @action - Future addTemplate({ + Future addTemplate({ required String name, required bool isCurrencySelected, required String address, @@ -32,16 +32,16 @@ abstract class SendTemplateBase with Store { required String amount, required String amountFiat}) async { final template = Template( - name: name, - isCurrencySelected: isCurrencySelected, - address: address, - cryptoCurrency: cryptoCurrency, - fiatCurrency: fiatCurrency, - amount: amount, - amountFiat: amountFiat); + nameRaw: name, + isCurrencySelectedRaw: isCurrencySelected, + addressRaw: address, + cryptoCurrencyRaw: cryptoCurrency, + fiatCurrencyRaw: fiatCurrency, + amountRaw: amount, + amountFiatRaw: amountFiat); await templateSource.add(template); } @action - Future remove({required Template template}) async => await template.delete(); + Future remove({required Template template}) async => await template.delete(); } \ No newline at end of file From 65dfb83a277d6b3d12cd959f6b5cd2a081694047 Mon Sep 17 00:00:00 2001 From: Omar Hatem Date: Wed, 2 Nov 2022 19:11:07 +0200 Subject: [PATCH 25/44] Check if address is parsed then create the transaction with the parsed address not the entered address (#585) --- cw_haven/lib/haven_wallet.dart | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/cw_haven/lib/haven_wallet.dart b/cw_haven/lib/haven_wallet.dart index 0e33753d5..8cefd6b27 100644 --- a/cw_haven/lib/haven_wallet.dart +++ b/cw_haven/lib/haven_wallet.dart @@ -187,7 +187,9 @@ abstract class HavenWalletBase extends WalletBase Date: Wed, 2 Nov 2022 19:11:53 +0200 Subject: [PATCH 26/44] Fix Navigation issue where popping 2 routes at the same time (#584) --- lib/src/screens/auth/auth_page.dart | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/lib/src/screens/auth/auth_page.dart b/lib/src/screens/auth/auth_page.dart index db5e3cd4a..0b3b8511a 100644 --- a/lib/src/screens/auth/auth_page.dart +++ b/lib/src/screens/auth/auth_page.dart @@ -111,15 +111,16 @@ class AuthPageState extends State { throw Exception('Key context is null. Should be not happened'); } - WidgetsBinding.instance.addPostFrameCallback((_) async { - await _authBar?.dismiss(); - await _progressBar?.dismiss(); - - if (route != null) { - Navigator.of(_key.currentContext!).pushReplacementNamed(route); - } else { - Navigator.of(_key.currentContext!).pop(); - } + WidgetsBinding.instance.addPostFrameCallback((_) { + dismissFlushBar(_authBar); + dismissFlushBar(_progressBar); + WidgetsBinding.instance.addPostFrameCallback((_) { + if (route != null) { + Navigator.of(_key.currentContext!).pushReplacementNamed(route); + } else { + Navigator.of(_key.currentContext!).pop(); + } + }); }); } From 8e0ef694d6b6533dfd4073c4254cba2bbe18a244 Mon Sep 17 00:00:00 2001 From: Serhii Date: Wed, 2 Nov 2022 19:12:39 +0200 Subject: [PATCH 27/44] fix text color for Dark Mode (#578) --- lib/src/screens/exchange/widgets/currency_picker.dart | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/src/screens/exchange/widgets/currency_picker.dart b/lib/src/screens/exchange/widgets/currency_picker.dart index cd223a146..9f8b9e493 100644 --- a/lib/src/screens/exchange/widgets/currency_picker.dart +++ b/lib/src/screens/exchange/widgets/currency_picker.dart @@ -6,6 +6,7 @@ import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:cw_core/crypto_currency.dart'; import 'package:cake_wallet/src/widgets/alert_background.dart'; +import 'package:cake_wallet/palette.dart'; import 'currency_picker_widget.dart'; class CurrencyPicker extends StatefulWidget { @@ -104,7 +105,7 @@ class CurrencyPickerState extends State { Padding( padding: const EdgeInsets.all(16), child: TextFormField( - style: TextStyle(color: Theme.of(context).primaryTextTheme!.headline6!.color!), + style: TextStyle(color: Palette.darkBlueCraiola), decoration: InputDecoration( hintText: widget.hintText, prefixIcon: Image.asset("assets/images/search_icon.png"), From 0040bca8537466a8876ef1995eb0a343a0d5e1cc Mon Sep 17 00:00:00 2001 From: Serhii Date: Wed, 2 Nov 2022 20:11:05 +0200 Subject: [PATCH 28/44] Add partners contacts (#577) Contacts of SideShift and SimpleSwap partners added to the Support section --- .../settings/widgets/settings_link_provider_cell.dart | 2 +- lib/view_model/support_view_model.dart | 10 ++++++++++ res/values/strings_de.arb | 3 ++- res/values/strings_en.arb | 3 ++- res/values/strings_es.arb | 3 ++- res/values/strings_fr.arb | 3 ++- res/values/strings_hi.arb | 3 ++- res/values/strings_hr.arb | 3 ++- res/values/strings_it.arb | 3 ++- res/values/strings_ja.arb | 3 ++- res/values/strings_ko.arb | 3 ++- res/values/strings_nl.arb | 3 ++- res/values/strings_pl.arb | 3 ++- res/values/strings_pt.arb | 3 ++- res/values/strings_ru.arb | 3 ++- res/values/strings_uk.arb | 3 ++- res/values/strings_zh.arb | 3 ++- 17 files changed, 41 insertions(+), 16 deletions(-) diff --git a/lib/src/screens/settings/widgets/settings_link_provider_cell.dart b/lib/src/screens/settings/widgets/settings_link_provider_cell.dart index e91072ba0..51fcc16d5 100644 --- a/lib/src/screens/settings/widgets/settings_link_provider_cell.dart +++ b/lib/src/screens/settings/widgets/settings_link_provider_cell.dart @@ -20,7 +20,7 @@ class SettingsLinkProviderCell extends StandardListRow { @override Widget? buildLeading(BuildContext context) => - icon != null ? Image.asset(icon!, color: iconColor, height: 30, width: 30) : null; + icon != null ? Image.asset(icon!, color: iconColor, height: 24, width: 24) : null; @override Widget buildTrailing(BuildContext context) => Text(linkTitle, diff --git a/lib/view_model/support_view_model.dart b/lib/view_model/support_view_model.dart index 83c65bb53..5fa81b288 100644 --- a/lib/view_model/support_view_model.dart +++ b/lib/view_model/support_view_model.dart @@ -53,6 +53,16 @@ abstract class SupportViewModelBase with Store { icon: 'assets/images/change_now.png', linkTitle: 'support@changenow.io', link: 'mailto:support@changenow.io'), + LinkListItem( + title: 'SideShift', + icon: 'assets/images/sideshift.png', + linkTitle: S.current.help, + link: 'https://help.sideshift.ai/en/'), + LinkListItem( + title: 'SimpleSwap', + icon: 'assets/images/simpleSwap.png', + linkTitle: 'support@simpleswap.io', + link: 'mailto:support@simpleswap.io'), if (!isMoneroOnly) ... [ LinkListItem( title: 'Wyre', diff --git a/res/values/strings_de.arb b/res/values/strings_de.arb index 33b6be87e..babbfc022 100644 --- a/res/values/strings_de.arb +++ b/res/values/strings_de.arb @@ -645,5 +645,6 @@ "add_custom_redemption": "Benutzerdefinierte Einlösung hinzufügen", "remaining": "Rest", "delete_wallet": "Geldbörse löschen", - "delete_wallet_confirm_message" : "Sind Sie sicher, dass Sie das ${wallet_name} Wallet löschen möchten?" + "delete_wallet_confirm_message" : "Sind Sie sicher, dass Sie das ${wallet_name} Wallet löschen möchten?", + "help": "hilfe" } diff --git a/res/values/strings_en.arb b/res/values/strings_en.arb index bf9c6e3ab..373213bee 100644 --- a/res/values/strings_en.arb +++ b/res/values/strings_en.arb @@ -645,5 +645,6 @@ "add_custom_redemption": "Add Custom Redemption", "remaining": "remaining", "delete_wallet": "Delete wallet", - "delete_wallet_confirm_message" : "Are you sure that you want to delete ${wallet_name} wallet?" + "delete_wallet_confirm_message" : "Are you sure that you want to delete ${wallet_name} wallet?", + "help": "help" } diff --git a/res/values/strings_es.arb b/res/values/strings_es.arb index 1a355b0df..0e4e26ba7 100644 --- a/res/values/strings_es.arb +++ b/res/values/strings_es.arb @@ -645,5 +645,6 @@ "add_custom_redemption": "Agregar redención personalizada", "remaining": "restante", "delete_wallet": "Eliminar billetera", - "delete_wallet_confirm_message" : "¿Está seguro de que desea eliminar la billetera ${wallet_name}?" + "delete_wallet_confirm_message" : "¿Está seguro de que desea eliminar la billetera ${wallet_name}?", + "help": "ayuda" } diff --git a/res/values/strings_fr.arb b/res/values/strings_fr.arb index 4088c5d5b..17b84b7a0 100644 --- a/res/values/strings_fr.arb +++ b/res/values/strings_fr.arb @@ -643,5 +643,6 @@ "add_custom_redemption": "Ajouter un remboursement personnalisé", "remaining": "restant", "delete_wallet": "Supprimer le portefeuille", - "delete_wallet_confirm_message" : "Êtes-vous sûr de vouloir supprimer le portefeuille ${wallet_name}?" + "delete_wallet_confirm_message" : "Êtes-vous sûr de vouloir supprimer le portefeuille ${wallet_name}?", + "help": "aider" } diff --git a/res/values/strings_hi.arb b/res/values/strings_hi.arb index 779648f96..1768a7678 100644 --- a/res/values/strings_hi.arb +++ b/res/values/strings_hi.arb @@ -645,5 +645,6 @@ "add_custom_redemption": "कस्टम रिडेम्पशन जोड़ें", "remaining": "शेष", "delete_wallet": "वॉलेट हटाएं", - "delete_wallet_confirm_message" : "क्या आप वाकई ${wallet_name} वॉलेट हटाना चाहते हैं?" + "delete_wallet_confirm_message" : "क्या आप वाकई ${wallet_name} वॉलेट हटाना चाहते हैं?", + "help": "मदद करना" } diff --git a/res/values/strings_hr.arb b/res/values/strings_hr.arb index 98ed901fd..ab9de0007 100644 --- a/res/values/strings_hr.arb +++ b/res/values/strings_hr.arb @@ -645,5 +645,6 @@ "add_custom_redemption": "Dodaj prilagođeni otkup", "remaining": "preostalo", "delete_wallet": "Izbriši novčanik", - "delete_wallet_confirm_message" : "Jeste li sigurni da želite izbrisati ${wallet_name} novčanik?" + "delete_wallet_confirm_message" : "Jeste li sigurni da želite izbrisati ${wallet_name} novčanik?", + "help": "pomozite" } diff --git a/res/values/strings_it.arb b/res/values/strings_it.arb index 6247d83f7..63d8861e7 100644 --- a/res/values/strings_it.arb +++ b/res/values/strings_it.arb @@ -645,5 +645,6 @@ "add_custom_redemption": "Aggiungi riscatto personalizzato", "remaining": "rimanente", "delete_wallet": "Elimina portafoglio", - "delete_wallet_confirm_message" : "Sei sicuro di voler eliminare il portafoglio ${wallet_name}?" + "delete_wallet_confirm_message" : "Sei sicuro di voler eliminare il portafoglio ${wallet_name}?", + "help": "aiuto" } diff --git a/res/values/strings_ja.arb b/res/values/strings_ja.arb index 6b738c787..ea59a82a8 100644 --- a/res/values/strings_ja.arb +++ b/res/values/strings_ja.arb @@ -645,5 +645,6 @@ "add_custom_redemption": "カスタム引き換えを追加", "remaining": "残り", "delete_wallet": "ウォレットを削除", - "delete_wallet_confirm_message" : "${wallet_name} ウォレットを削除してもよろしいですか?" + "delete_wallet_confirm_message" : "${wallet_name} ウォレットを削除してもよろしいですか?", + "help": "ヘルプ" } diff --git a/res/values/strings_ko.arb b/res/values/strings_ko.arb index 885f569db..133208696 100644 --- a/res/values/strings_ko.arb +++ b/res/values/strings_ko.arb @@ -645,5 +645,6 @@ "add_custom_redemption": "사용자 지정 상환 추가", "remaining": "남은", "delete_wallet": "지갑 삭제", - "delete_wallet_confirm_message" : "${wallet_name} 지갑을 삭제하시겠습니까?" + "delete_wallet_confirm_message" : "${wallet_name} 지갑을 삭제하시겠습니까?", + "help": "돕다" } diff --git a/res/values/strings_nl.arb b/res/values/strings_nl.arb index 7de7cab33..f2631a15a 100644 --- a/res/values/strings_nl.arb +++ b/res/values/strings_nl.arb @@ -645,5 +645,6 @@ "add_custom_redemption": "Voeg aangepaste inwisseling toe", "remaining": "resterende", "delete_wallet": "Portemonnee verwijderen", - "delete_wallet_confirm_message" : "Weet u zeker dat u de portemonnee van ${wallet_name} wilt verwijderen?" + "delete_wallet_confirm_message" : "Weet u zeker dat u de portemonnee van ${wallet_name} wilt verwijderen?", + "help": "helpen" } diff --git a/res/values/strings_pl.arb b/res/values/strings_pl.arb index 87f2bbacb..f34e7f95e 100644 --- a/res/values/strings_pl.arb +++ b/res/values/strings_pl.arb @@ -645,5 +645,6 @@ "add_custom_redemption": "Dodaj niestandardowe wykorzystanie", "remaining": "pozostałe", "delete_wallet": "Usuń portfel", - "delete_wallet_confirm_message" : "Czy na pewno chcesz usunąć portfel ${wallet_name}?" + "delete_wallet_confirm_message" : "Czy na pewno chcesz usunąć portfel ${wallet_name}?", + "help": "pomoc" } diff --git a/res/values/strings_pt.arb b/res/values/strings_pt.arb index 7f1bed93c..4fa1b352f 100644 --- a/res/values/strings_pt.arb +++ b/res/values/strings_pt.arb @@ -645,5 +645,6 @@ "add_custom_redemption": "Adicionar resgate personalizado", "remaining": "restante", "delete_wallet": "Excluir carteira", - "delete_wallet_confirm_message" : "Tem certeza de que deseja excluir a carteira ${wallet_name}?" + "delete_wallet_confirm_message" : "Tem certeza de que deseja excluir a carteira ${wallet_name}?", + "help": "ajuda" } diff --git a/res/values/strings_ru.arb b/res/values/strings_ru.arb index 8cbf48793..6778821bb 100644 --- a/res/values/strings_ru.arb +++ b/res/values/strings_ru.arb @@ -645,5 +645,6 @@ "add_custom_redemption": "Добавить пользовательское погашение", "remaining": "осталось", "delete_wallet": "Удалить кошелек", - "delete_wallet_confirm_message" : "Вы уверены, что хотите удалить кошелек ${wallet_name}?" + "delete_wallet_confirm_message" : "Вы уверены, что хотите удалить кошелек ${wallet_name}?", + "help": "помощь" } diff --git a/res/values/strings_uk.arb b/res/values/strings_uk.arb index 2f8de2884..be37fd558 100644 --- a/res/values/strings_uk.arb +++ b/res/values/strings_uk.arb @@ -644,5 +644,6 @@ "add_custom_redemption": "Додати спеціальне погашення", "remaining": "залишилося", "delete_wallet": "Видалити гаманець", - "delete_wallet_confirm_message" : "Ви впевнені, що хочете видалити гаманець ${wallet_name}?" + "delete_wallet_confirm_message" : "Ви впевнені, що хочете видалити гаманець ${wallet_name}?", + "help": "допомога" } diff --git a/res/values/strings_zh.arb b/res/values/strings_zh.arb index 025470941..400a817d7 100644 --- a/res/values/strings_zh.arb +++ b/res/values/strings_zh.arb @@ -643,5 +643,6 @@ "add_custom_redemption": "添加自定义兑换", "remaining": "剩余", "delete_wallet": "删除钱包", - "delete_wallet_confirm_message" : "您确定要删除 ${wallet_name} 钱包吗?" + "delete_wallet_confirm_message" : "您确定要删除 ${wallet_name} 钱包吗?", + "help": "帮助" } From 3996c3de76a327a2783b1fd8ca8af180596ca9df Mon Sep 17 00:00:00 2001 From: Serhii Date: Wed, 2 Nov 2022 21:00:40 +0200 Subject: [PATCH 29/44] Change Monero "regular" fee name to "automatic" (#576) --- cw_core/lib/monero_transaction_priority.dart | 12 ++++++------ cw_haven/lib/haven_wallet.dart | 2 +- cw_monero/lib/monero_wallet.dart | 2 +- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/cw_core/lib/monero_transaction_priority.dart b/cw_core/lib/monero_transaction_priority.dart index 1aca5dd8c..cca887398 100644 --- a/cw_core/lib/monero_transaction_priority.dart +++ b/cw_core/lib/monero_transaction_priority.dart @@ -9,13 +9,13 @@ class MoneroTransactionPriority extends TransactionPriority { static const all = [ MoneroTransactionPriority.slow, - MoneroTransactionPriority.regular, + MoneroTransactionPriority.automatic, MoneroTransactionPriority.medium, MoneroTransactionPriority.fast, MoneroTransactionPriority.fastest ]; static const slow = MoneroTransactionPriority(title: 'Slow', raw: 0); - static const regular = MoneroTransactionPriority(title: 'Regular', raw: 1); + static const automatic = MoneroTransactionPriority(title: 'Automatic', raw: 1); static const medium = MoneroTransactionPriority(title: 'Medium', raw: 2); static const fast = MoneroTransactionPriority(title: 'Fast', raw: 3); static const fastest = MoneroTransactionPriority(title: 'Fastest', raw: 4); @@ -29,7 +29,7 @@ class MoneroTransactionPriority extends TransactionPriority { case WalletType.bitcoin: return [ MoneroTransactionPriority.slow, - MoneroTransactionPriority.regular, + MoneroTransactionPriority.automatic, MoneroTransactionPriority.fast ]; default: @@ -42,7 +42,7 @@ class MoneroTransactionPriority extends TransactionPriority { case 0: return slow; case 1: - return regular; + return automatic; case 2: return medium; case 3: @@ -59,8 +59,8 @@ class MoneroTransactionPriority extends TransactionPriority { switch (this) { case MoneroTransactionPriority.slow: return 'Slow'; // S.current.transaction_priority_slow; - case MoneroTransactionPriority.regular: - return 'Regular'; // S.current.transaction_priority_regular; + case MoneroTransactionPriority.automatic: + return 'Automatic'; // S.current.transaction_priority_regular; case MoneroTransactionPriority.medium: return 'Medium'; // S.current.transaction_priority_medium; case MoneroTransactionPriority.fast: diff --git a/cw_haven/lib/haven_wallet.dart b/cw_haven/lib/haven_wallet.dart index 8cefd6b27..4f360bdff 100644 --- a/cw_haven/lib/haven_wallet.dart +++ b/cw_haven/lib/haven_wallet.dart @@ -225,7 +225,7 @@ abstract class HavenWalletBase extends WalletBase Date: Wed, 2 Nov 2022 21:53:14 +0200 Subject: [PATCH 30/44] add warning text to the seed screen (#587) * Add warning text to the seed screen * fix font size --- .../screens/wallet_keys/wallet_keys_page.dart | 34 +++++++++++++++++-- res/values/strings_de.arb | 1 + res/values/strings_en.arb | 1 + res/values/strings_es.arb | 1 + res/values/strings_fr.arb | 1 + res/values/strings_hi.arb | 1 + res/values/strings_hr.arb | 1 + res/values/strings_it.arb | 1 + res/values/strings_ja.arb | 1 + res/values/strings_ko.arb | 1 + res/values/strings_nl.arb | 1 + res/values/strings_pl.arb | 1 + res/values/strings_pt.arb | 1 + res/values/strings_ru.arb | 1 + res/values/strings_uk.arb | 1 + res/values/strings_zh.arb | 1 + 16 files changed, 47 insertions(+), 2 deletions(-) diff --git a/lib/src/screens/wallet_keys/wallet_keys_page.dart b/lib/src/screens/wallet_keys/wallet_keys_page.dart index 72da07171..942809ac8 100644 --- a/lib/src/screens/wallet_keys/wallet_keys_page.dart +++ b/lib/src/screens/wallet_keys/wallet_keys_page.dart @@ -1,3 +1,4 @@ +import 'package:auto_size_text/auto_size_text.dart'; import 'package:cake_wallet/utils/show_bar.dart'; import 'package:flutter/material.dart'; import 'package:flutter/cupertino.dart'; @@ -18,7 +19,36 @@ class WalletKeysPage extends BasePage { @override Widget body(BuildContext context) { - return Container( + return Column( + children: [ + Expanded( + child: Padding( + padding: const EdgeInsets.symmetric(horizontal: 24.0), + child: Container( + width: double.infinity, + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(12.0), + color: Theme.of(context).accentTextTheme!.caption!.color!, + ), + child: Center( + child: Padding( + padding: const EdgeInsets.all(8.0), + child: AutoSizeText( + S.of(context).do_not_share_warning_text.toUpperCase(), + textAlign: TextAlign.center, + maxLines: 4, + style: TextStyle( + fontSize: 16, + fontWeight: FontWeight.w500, + color: Colors.red)), + ), + ), + ), + ), + ), + Expanded( + flex: 7, + child: Container( padding: EdgeInsets.only(top: 20.0, bottom: 20.0), child: Observer( builder: (_) { @@ -48,6 +78,6 @@ class WalletKeysPage extends BasePage { ); }); }, - )); + )))]); } } diff --git a/res/values/strings_de.arb b/res/values/strings_de.arb index babbfc022..7fb18e39b 100644 --- a/res/values/strings_de.arb +++ b/res/values/strings_de.arb @@ -646,5 +646,6 @@ "remaining": "Rest", "delete_wallet": "Geldbörse löschen", "delete_wallet_confirm_message" : "Sind Sie sicher, dass Sie das ${wallet_name} Wallet löschen möchten?", + "do_not_share_warning_text" : "Teilen Sie diese nicht mit anderen, einschließlich des Supports.\n\nSie werden Ihr Geld stehlen!", "help": "hilfe" } diff --git a/res/values/strings_en.arb b/res/values/strings_en.arb index 373213bee..bc93e5b45 100644 --- a/res/values/strings_en.arb +++ b/res/values/strings_en.arb @@ -646,5 +646,6 @@ "remaining": "remaining", "delete_wallet": "Delete wallet", "delete_wallet_confirm_message" : "Are you sure that you want to delete ${wallet_name} wallet?", + "do_not_share_warning_text" : "Do not share these with anyone else, including support.\n\nThey will steal your money!", "help": "help" } diff --git a/res/values/strings_es.arb b/res/values/strings_es.arb index 0e4e26ba7..d2201ed10 100644 --- a/res/values/strings_es.arb +++ b/res/values/strings_es.arb @@ -646,5 +646,6 @@ "remaining": "restante", "delete_wallet": "Eliminar billetera", "delete_wallet_confirm_message" : "¿Está seguro de que desea eliminar la billetera ${wallet_name}?", + "do_not_share_warning_text" : "No comparta estos con nadie más, incluido el soporte.\n\n¡Te robarán tu dinero!", "help": "ayuda" } diff --git a/res/values/strings_fr.arb b/res/values/strings_fr.arb index 17b84b7a0..0eb4cccea 100644 --- a/res/values/strings_fr.arb +++ b/res/values/strings_fr.arb @@ -644,5 +644,6 @@ "remaining": "restant", "delete_wallet": "Supprimer le portefeuille", "delete_wallet_confirm_message" : "Êtes-vous sûr de vouloir supprimer le portefeuille ${wallet_name}?", + "do_not_share_warning_text" : "Ne les partagez avec personne d'autre, y compris avec l'assistance.\n\nIls vont voler votre argent!", "help": "aider" } diff --git a/res/values/strings_hi.arb b/res/values/strings_hi.arb index 1768a7678..df0c7cb63 100644 --- a/res/values/strings_hi.arb +++ b/res/values/strings_hi.arb @@ -646,5 +646,6 @@ "remaining": "शेष", "delete_wallet": "वॉलेट हटाएं", "delete_wallet_confirm_message" : "क्या आप वाकई ${wallet_name} वॉलेट हटाना चाहते हैं?", + "do_not_share_warning_text" : "इन्हें समर्थन सहित किसी और के साथ साझा न करें।\n\nवे आपका पैसा चुरा लेंगे!", "help": "मदद करना" } diff --git a/res/values/strings_hr.arb b/res/values/strings_hr.arb index ab9de0007..27c5aaaa0 100644 --- a/res/values/strings_hr.arb +++ b/res/values/strings_hr.arb @@ -646,5 +646,6 @@ "remaining": "preostalo", "delete_wallet": "Izbriši novčanik", "delete_wallet_confirm_message" : "Jeste li sigurni da želite izbrisati ${wallet_name} novčanik?", + "do_not_share_warning_text" : "Nemojte ih dijeliti ni s kim, uključujući podršku.\n\nUkrast će vam novac!", "help": "pomozite" } diff --git a/res/values/strings_it.arb b/res/values/strings_it.arb index 63d8861e7..f4b06f9c7 100644 --- a/res/values/strings_it.arb +++ b/res/values/strings_it.arb @@ -646,5 +646,6 @@ "remaining": "rimanente", "delete_wallet": "Elimina portafoglio", "delete_wallet_confirm_message" : "Sei sicuro di voler eliminare il portafoglio ${wallet_name}?", + "do_not_share_warning_text" : "Non condividerli con nessun altro, incluso il supporto.\n\nTi ruberanno i soldi!", "help": "aiuto" } diff --git a/res/values/strings_ja.arb b/res/values/strings_ja.arb index ea59a82a8..2b43999fe 100644 --- a/res/values/strings_ja.arb +++ b/res/values/strings_ja.arb @@ -646,5 +646,6 @@ "remaining": "残り", "delete_wallet": "ウォレットを削除", "delete_wallet_confirm_message" : "${wallet_name} ウォレットを削除してもよろしいですか?", + "do_not_share_warning_text" : "サポートを含め、これらを他の誰とも共有しないでください。\n\n彼らはあなたのお金を盗みます!", "help": "ヘルプ" } diff --git a/res/values/strings_ko.arb b/res/values/strings_ko.arb index 133208696..91cef97d4 100644 --- a/res/values/strings_ko.arb +++ b/res/values/strings_ko.arb @@ -646,5 +646,6 @@ "remaining": "남은", "delete_wallet": "지갑 삭제", "delete_wallet_confirm_message" : "${wallet_name} 지갑을 삭제하시겠습니까?", + "do_not_share_warning_text" : "지원을 포함하여 다른 사람과 이러한 정보를 공유하지 마십시오.\n\n그들은 당신의 돈을 훔칠 것입니다!", "help": "돕다" } diff --git a/res/values/strings_nl.arb b/res/values/strings_nl.arb index f2631a15a..84b34cba5 100644 --- a/res/values/strings_nl.arb +++ b/res/values/strings_nl.arb @@ -646,5 +646,6 @@ "remaining": "resterende", "delete_wallet": "Portemonnee verwijderen", "delete_wallet_confirm_message" : "Weet u zeker dat u de portemonnee van ${wallet_name} wilt verwijderen?", + "do_not_share_warning_text" : "Deel deze met niemand anders, ook niet met support.\n\nZe zullen je geld stelen!", "help": "helpen" } diff --git a/res/values/strings_pl.arb b/res/values/strings_pl.arb index f34e7f95e..245d48d3e 100644 --- a/res/values/strings_pl.arb +++ b/res/values/strings_pl.arb @@ -646,5 +646,6 @@ "remaining": "pozostałe", "delete_wallet": "Usuń portfel", "delete_wallet_confirm_message" : "Czy na pewno chcesz usunąć portfel ${wallet_name}?", + "do_not_share_warning_text" : "Nie udostępniaj ich nikomu innemu, w tym wsparcia.\n\nUkradną twoje pieniądze!", "help": "pomoc" } diff --git a/res/values/strings_pt.arb b/res/values/strings_pt.arb index 4fa1b352f..e6b09a323 100644 --- a/res/values/strings_pt.arb +++ b/res/values/strings_pt.arb @@ -646,5 +646,6 @@ "remaining": "restante", "delete_wallet": "Excluir carteira", "delete_wallet_confirm_message" : "Tem certeza de que deseja excluir a carteira ${wallet_name}?", + "do_not_share_warning_text" : "Não os compartilhe com mais ninguém, incluindo suporte.\n\nEles vão roubar seu dinheiro!", "help": "ajuda" } diff --git a/res/values/strings_ru.arb b/res/values/strings_ru.arb index 6778821bb..c3c832b36 100644 --- a/res/values/strings_ru.arb +++ b/res/values/strings_ru.arb @@ -646,5 +646,6 @@ "remaining": "осталось", "delete_wallet": "Удалить кошелек", "delete_wallet_confirm_message" : "Вы уверены, что хотите удалить кошелек ${wallet_name}?", + "do_not_share_warning_text" : "Не делитесь ими с кем-либо еще, в том числе со службой поддержки.\n\nОни украдут ваши деньги!", "help": "помощь" } diff --git a/res/values/strings_uk.arb b/res/values/strings_uk.arb index be37fd558..424f2567e 100644 --- a/res/values/strings_uk.arb +++ b/res/values/strings_uk.arb @@ -645,5 +645,6 @@ "remaining": "залишилося", "delete_wallet": "Видалити гаманець", "delete_wallet_confirm_message" : "Ви впевнені, що хочете видалити гаманець ${wallet_name}?", + "do_not_share_warning_text" : "Не повідомляйте їх нікому, включно зі службою підтримки.\n\nВони вкрадуть ваші гроші!", "help": "допомога" } diff --git a/res/values/strings_zh.arb b/res/values/strings_zh.arb index 400a817d7..5aba482a4 100644 --- a/res/values/strings_zh.arb +++ b/res/values/strings_zh.arb @@ -644,5 +644,6 @@ "remaining": "剩余", "delete_wallet": "删除钱包", "delete_wallet_confirm_message" : "您确定要删除 ${wallet_name} 钱包吗?", + "do_not_share_warning_text" : "不要與其他任何人分享這些內容,包括支持。\n\n他們會偷你的錢!", "help": "帮助" } From 8e70b611d0cd3b257da14d2dbd62f32e35d00e37 Mon Sep 17 00:00:00 2001 From: mkyq <53115730+mkyq@users.noreply.github.com> Date: Thu, 3 Nov 2022 14:45:50 -0400 Subject: [PATCH 31/44] move amount_converter to cw_core (#588) Co-authored-by: Serhii --- {lib/core => cw_core/lib}/amount_converter.dart | 0 cw_haven/lib/pending_haven_transaction.dart | 14 +++++--------- cw_monero/lib/pending_monero_transaction.dart | 14 +++++--------- .../morphtoken/morphtoken_exchange_provider.dart | 2 +- 4 files changed, 11 insertions(+), 19 deletions(-) rename {lib/core => cw_core/lib}/amount_converter.dart (100%) diff --git a/lib/core/amount_converter.dart b/cw_core/lib/amount_converter.dart similarity index 100% rename from lib/core/amount_converter.dart rename to cw_core/lib/amount_converter.dart diff --git a/cw_haven/lib/pending_haven_transaction.dart b/cw_haven/lib/pending_haven_transaction.dart index b362cdf34..1d95de08c 100644 --- a/cw_haven/lib/pending_haven_transaction.dart +++ b/cw_haven/lib/pending_haven_transaction.dart @@ -2,7 +2,7 @@ import 'package:cw_haven/api/structs/pending_transaction.dart'; import 'package:cw_haven/api/transaction_history.dart' as haven_transaction_history; import 'package:cw_core/crypto_currency.dart'; -// import 'package:cake_wallet/core/amount_converter.dart'; +import 'package:cw_core/amount_converter.dart'; import 'package:cw_core/pending_transaction.dart'; class DoubleSpendException implements Exception { @@ -25,17 +25,13 @@ class PendingHavenTransaction with PendingTransaction { @override String get hex => ''; - // FIX-ME: AmountConverter @override - String get amountFormatted => ''; - // AmountConverter.amountIntToString( - // cryptoCurrency, pendingTransactionDescription.amount); + String get amountFormatted => AmountConverter.amountIntToString( + cryptoCurrency, pendingTransactionDescription.amount); - // FIX-ME: AmountConverter @override - String get feeFormatted => ''; - // AmountConverter.amountIntToString( - // cryptoCurrency, pendingTransactionDescription.fee); + String get feeFormatted => AmountConverter.amountIntToString( + cryptoCurrency, pendingTransactionDescription.fee); @override Future commit() async { diff --git a/cw_monero/lib/pending_monero_transaction.dart b/cw_monero/lib/pending_monero_transaction.dart index 7488cfc08..2a75fc26b 100644 --- a/cw_monero/lib/pending_monero_transaction.dart +++ b/cw_monero/lib/pending_monero_transaction.dart @@ -2,7 +2,7 @@ import 'package:cw_monero/api/structs/pending_transaction.dart'; import 'package:cw_monero/api/transaction_history.dart' as monero_transaction_history; import 'package:cw_core/crypto_currency.dart'; -// import 'package:cake_wallet/core/amount_converter.dart'; +import 'package:cw_core/amount_converter.dart'; import 'package:cw_core/pending_transaction.dart'; @@ -27,17 +27,13 @@ class PendingMoneroTransaction with PendingTransaction { String get txKey => pendingTransactionDescription.txKey; - // FIX-ME: AmountConverter @override - String get amountFormatted => ''; - // AmountConverter.amountIntToString( - // CryptoCurrency.xmr, pendingTransactionDescription.amount); + String get amountFormatted => AmountConverter.amountIntToString( + CryptoCurrency.xmr, pendingTransactionDescription.amount); - // FIX-ME: AmountConverter @override - String get feeFormatted => ''; - // AmountConverter.amountIntToString( - // CryptoCurrency.xmr, pendingTransactionDescription.fee); + String get feeFormatted => AmountConverter.amountIntToString( + CryptoCurrency.xmr, pendingTransactionDescription.fee); @override Future commit() async { diff --git a/lib/exchange/morphtoken/morphtoken_exchange_provider.dart b/lib/exchange/morphtoken/morphtoken_exchange_provider.dart index c90b89391..1df4fef87 100644 --- a/lib/exchange/morphtoken/morphtoken_exchange_provider.dart +++ b/lib/exchange/morphtoken/morphtoken_exchange_provider.dart @@ -1,5 +1,5 @@ import 'dart:convert'; -import 'package:cake_wallet/core/amount_converter.dart'; +import 'package:cw_core/amount_converter.dart'; import 'package:hive/hive.dart'; import 'package:cake_wallet/exchange/trade_not_found_exeption.dart'; import 'package:flutter/foundation.dart'; From a52f47220eae59fb1b86772cf3df44272433bcf0 Mon Sep 17 00:00:00 2001 From: Serhii Date: Thu, 3 Nov 2022 21:21:35 +0200 Subject: [PATCH 32/44] show warning if exchanging with slow fee (#579) * show warning if exchanging with slow fee * Update setDefaultTransactionPriority for return type void; update for use MoneroTransactionPriority.automatic instead of MoneroTransactionPriority.regular. Co-authored-by: M --- lib/di.dart | 1 + lib/src/screens/exchange/exchange_page.dart | 22 ++++++++++ .../exchange/exchange_view_model.dart | 40 ++++++++++++++++++- res/values/strings_de.arb | 4 ++ res/values/strings_en.arb | 4 ++ res/values/strings_es.arb | 4 ++ res/values/strings_fr.arb | 4 ++ res/values/strings_hi.arb | 4 ++ res/values/strings_hr.arb | 4 ++ res/values/strings_it.arb | 4 ++ res/values/strings_ja.arb | 4 ++ res/values/strings_ko.arb | 4 ++ res/values/strings_nl.arb | 4 ++ res/values/strings_pl.arb | 4 ++ res/values/strings_pt.arb | 4 ++ res/values/strings_ru.arb | 4 ++ res/values/strings_uk.arb | 4 ++ res/values/strings_zh.arb | 4 ++ 18 files changed, 122 insertions(+), 1 deletion(-) diff --git a/lib/di.dart b/lib/di.dart index c10b8de5f..7ce2ff6d9 100644 --- a/lib/di.dart +++ b/lib/di.dart @@ -494,6 +494,7 @@ Future setup( getIt.get(), getIt.get().settingsStore, getIt.get(), + getIt.get(), )); getIt.registerFactory(() => ExchangeTradeViewModel( diff --git a/lib/src/screens/exchange/exchange_page.dart b/lib/src/screens/exchange/exchange_page.dart index e9c6b4234..744848156 100644 --- a/lib/src/screens/exchange/exchange_page.dart +++ b/lib/src/screens/exchange/exchange_page.dart @@ -111,6 +111,10 @@ class ExchangePage extends BasePage { WidgetsBinding.instance .addPostFrameCallback((_) => _setReactions(context, exchangeViewModel)); + if (exchangeViewModel.isLowFee) { + _showFeeAlert(context); + } + return KeyboardActions( disableScroll: true, config: KeyboardActionsConfig( @@ -794,5 +798,23 @@ class ExchangePage extends BasePage { return address; } + void _showFeeAlert(BuildContext context) async { + await Future.delayed(Duration(seconds: 1)); + final confirmed = await showPopUp( + context: context, + builder: (dialogContext) { + return AlertWithTwoActions( + alertTitle: S.of(context).low_fee, + alertContent: S.of(context).low_fee_alert, + leftButtonText: S.of(context).ignor, + rightButtonText: S.of(context).use_suggested, + actionLeftButton: () => Navigator.of(context).pop(false), + actionRightButton: () => Navigator.of(context).pop(true)); + }) ?? false; + if (confirmed) { + exchangeViewModel.setDefaultTransactionPriority(); + } + } + void disposeBestRateSync() => exchangeViewModel.bestRateSync?.cancel(); } diff --git a/lib/view_model/exchange/exchange_view_model.dart b/lib/view_model/exchange/exchange_view_model.dart index 9af319e95..9ff690b70 100644 --- a/lib/view_model/exchange/exchange_view_model.dart +++ b/lib/view_model/exchange/exchange_view_model.dart @@ -6,6 +6,10 @@ import 'package:cake_wallet/entities/preferences_key.dart'; import 'package:cake_wallet/exchange/sideshift/sideshift_exchange_provider.dart'; import 'package:cake_wallet/exchange/sideshift/sideshift_request.dart'; import 'package:cake_wallet/exchange/simpleswap/simpleswap_exchange_provider.dart'; +import 'package:cake_wallet/view_model/settings/settings_view_model.dart'; +import 'package:cw_bitcoin/bitcoin_transaction_priority.dart'; +import 'package:cw_core/monero_transaction_priority.dart'; +import 'package:cw_core/transaction_priority.dart'; import 'package:cake_wallet/exchange/simpleswap/simpleswap_request.dart'; import 'package:cw_core/wallet_base.dart'; import 'package:cw_core/crypto_currency.dart'; @@ -40,7 +44,7 @@ class ExchangeViewModel = ExchangeViewModelBase with _$ExchangeViewModel; abstract class ExchangeViewModelBase with Store { ExchangeViewModelBase(this.wallet, this.trades, this._exchangeTemplateStore, - this.tradesStore, this._settingsStore, this.sharedPreferences) + this.tradesStore, this._settingsStore, this.sharedPreferences, this._settingsViewModel) : _cryptoNumberFormat = NumberFormat(), isReverse = false, isFixedRateMode = false, @@ -192,6 +196,20 @@ abstract class ExchangeViewModelBase with Store { bool get isMoneroWallet => wallet.type == WalletType.monero; + bool get isLowFee { + switch (wallet.type) { + case WalletType.monero: + case WalletType.haven: + return _settingsViewModel.transactionPriority == MoneroTransactionPriority.slow; + case WalletType.bitcoin: + return _settingsViewModel.transactionPriority == BitcoinTransactionPriority.slow; + case WalletType.litecoin: + return _settingsViewModel.transactionPriority == LitecoinTransactionPriority.slow; + default: + return false; + } + } + List receiveCurrencies; List depositCurrencies; @@ -204,6 +222,8 @@ abstract class ExchangeViewModelBase with Store { final SettingsStore _settingsStore; + final SettingsViewModel _settingsViewModel; + double _bestRate = 0.0; late Timer bestRateSync; @@ -611,4 +631,22 @@ abstract class ExchangeViewModelBase with Store { selectedProviders .where((provider) => providersForCurrentPair().contains(provider))); } + + @action + void setDefaultTransactionPriority() { + switch (wallet.type) { + case WalletType.monero: + case WalletType.haven: + _settingsStore.priority[wallet.type] = MoneroTransactionPriority.automatic; + break; + case WalletType.bitcoin: + _settingsStore.priority[wallet.type] = BitcoinTransactionPriority.medium; + break; + case WalletType.litecoin: + _settingsStore.priority[wallet.type] = LitecoinTransactionPriority.medium; + break; + default: + break; + } + } } diff --git a/res/values/strings_de.arb b/res/values/strings_de.arb index 7fb18e39b..a580ab90a 100644 --- a/res/values/strings_de.arb +++ b/res/values/strings_de.arb @@ -646,6 +646,10 @@ "remaining": "Rest", "delete_wallet": "Geldbörse löschen", "delete_wallet_confirm_message" : "Sind Sie sicher, dass Sie das ${wallet_name} Wallet löschen möchten?", + "low_fee": "Niedrige Gebühr", + "low_fee_alert": "Sie verwenden derzeit eine niedrige Netzwerkgebührenpriorität. Dies kann zu langen Wartezeiten, unterschiedlichen Kursen oder stornierten Trades führen. Wir empfehlen, für ein besseres Erlebnis eine höhere Gebühr festzulegen.", + "ignor": "Ignorieren", + "use_suggested": "Vorgeschlagen verwenden", "do_not_share_warning_text" : "Teilen Sie diese nicht mit anderen, einschließlich des Supports.\n\nSie werden Ihr Geld stehlen!", "help": "hilfe" } diff --git a/res/values/strings_en.arb b/res/values/strings_en.arb index bc93e5b45..877d09231 100644 --- a/res/values/strings_en.arb +++ b/res/values/strings_en.arb @@ -646,6 +646,10 @@ "remaining": "remaining", "delete_wallet": "Delete wallet", "delete_wallet_confirm_message" : "Are you sure that you want to delete ${wallet_name} wallet?", + "low_fee": "Low fee", + "low_fee_alert": "You currently are using a low network fee priority. This could cause long waits, different rates, or canceled trades. We recommend setting a higher fee for a better experience.", + "ignor": "Ignore", + "use_suggested": "Use Suggested", "do_not_share_warning_text" : "Do not share these with anyone else, including support.\n\nThey will steal your money!", "help": "help" } diff --git a/res/values/strings_es.arb b/res/values/strings_es.arb index d2201ed10..505f3ffa8 100644 --- a/res/values/strings_es.arb +++ b/res/values/strings_es.arb @@ -646,6 +646,10 @@ "remaining": "restante", "delete_wallet": "Eliminar billetera", "delete_wallet_confirm_message" : "¿Está seguro de que desea eliminar la billetera ${wallet_name}?", + "low_fee": "Tarifa baja", + "low_fee_alert": "Actualmente está utilizando una prioridad de tarifa de red baja. Esto podría causar largas esperas, tarifas diferentes o transacciones canceladas. Recomendamos establecer una tarifa más alta para una mejor experiencia.", + "ignor": "Pasar por alto", + "use_suggested": "Usar sugerido", "do_not_share_warning_text" : "No comparta estos con nadie más, incluido el soporte.\n\n¡Te robarán tu dinero!", "help": "ayuda" } diff --git a/res/values/strings_fr.arb b/res/values/strings_fr.arb index 0eb4cccea..941016c0b 100644 --- a/res/values/strings_fr.arb +++ b/res/values/strings_fr.arb @@ -644,6 +644,10 @@ "remaining": "restant", "delete_wallet": "Supprimer le portefeuille", "delete_wallet_confirm_message" : "Êtes-vous sûr de vouloir supprimer le portefeuille ${wallet_name}?", + "low_fee": "Frais modiques", + "low_fee_alert": "Vous utilisez actuellement une priorité de frais de réseau peu élevés. Cela pourrait entraîner de longues attentes, des taux différents ou des transactions annulées. Nous vous recommandons de fixer des frais plus élevés pour une meilleure expérience.", + "ignor": "Ignorer", + "use_suggested": "Utilisation suggérée", "do_not_share_warning_text" : "Ne les partagez avec personne d'autre, y compris avec l'assistance.\n\nIls vont voler votre argent!", "help": "aider" } diff --git a/res/values/strings_hi.arb b/res/values/strings_hi.arb index df0c7cb63..7faa06f7f 100644 --- a/res/values/strings_hi.arb +++ b/res/values/strings_hi.arb @@ -646,6 +646,10 @@ "remaining": "शेष", "delete_wallet": "वॉलेट हटाएं", "delete_wallet_confirm_message" : "क्या आप वाकई ${wallet_name} वॉलेट हटाना चाहते हैं?", + "low_fee": "कम शुल्क", + "low_fee_alert": "आप वर्तमान में कम नेटवर्क शुल्क प्राथमिकता का उपयोग कर रहे हैं। यह लंबे इंतजार, अलग-अलग दरों या रद्द किए गए ट्रेडों का कारण बन सकता है। हम बेहतर अनुभव के लिए अधिक शुल्क निर्धारित करने की सलाह देते हैं।", + "ignor": "नज़रअंदाज़ करना", + "use_suggested": "सुझाए गए का प्रयोग करें", "do_not_share_warning_text" : "इन्हें समर्थन सहित किसी और के साथ साझा न करें।\n\nवे आपका पैसा चुरा लेंगे!", "help": "मदद करना" } diff --git a/res/values/strings_hr.arb b/res/values/strings_hr.arb index 27c5aaaa0..4fa77948a 100644 --- a/res/values/strings_hr.arb +++ b/res/values/strings_hr.arb @@ -646,6 +646,10 @@ "remaining": "preostalo", "delete_wallet": "Izbriši novčanik", "delete_wallet_confirm_message" : "Jeste li sigurni da želite izbrisati ${wallet_name} novčanik?", + "low_fee": "Niska naknada", + "low_fee_alert": "Trenutačno koristite niski prioritet mrežne naknade. To bi moglo uzrokovati duga čekanja, različite tečajeve ili otkazane trgovine. Preporučujemo postavljanje veće naknade za bolje iskustvo.", + "ignor": "Zanemariti", + "use_suggested": "Koristite predloženo", "do_not_share_warning_text" : "Nemojte ih dijeliti ni s kim, uključujući podršku.\n\nUkrast će vam novac!", "help": "pomozite" } diff --git a/res/values/strings_it.arb b/res/values/strings_it.arb index f4b06f9c7..9a42a588b 100644 --- a/res/values/strings_it.arb +++ b/res/values/strings_it.arb @@ -646,6 +646,10 @@ "remaining": "rimanente", "delete_wallet": "Elimina portafoglio", "delete_wallet_confirm_message" : "Sei sicuro di voler eliminare il portafoglio ${wallet_name}?", + "low_fee": "Tariffa bassa", + "low_fee_alert": "Attualmente stai utilizzando una priorità a tariffa di rete bassa. Ciò potrebbe causare lunghe attese, tariffe diverse o operazioni annullate. Ti consigliamo di impostare una tariffa più alta per un'esperienza migliore.", + "ignor": "Ignorare", + "use_suggested": "Usa suggerito", "do_not_share_warning_text" : "Non condividerli con nessun altro, incluso il supporto.\n\nTi ruberanno i soldi!", "help": "aiuto" } diff --git a/res/values/strings_ja.arb b/res/values/strings_ja.arb index 2b43999fe..c1d0de4e3 100644 --- a/res/values/strings_ja.arb +++ b/res/values/strings_ja.arb @@ -646,6 +646,10 @@ "remaining": "残り", "delete_wallet": "ウォレットを削除", "delete_wallet_confirm_message" : "${wallet_name} ウォレットを削除してもよろしいですか?", + "low_fee": "低料金", + "low_fee_alert": "現在、低ネットワーク料金優先度を使用しています。これにより、長い待ち時間、異なるレート、またはキャンセルされた取引が発生する可能性があります。より良い体験のために、より高い料金を設定することをお勧めします。", + "ignor": "無視", + "use_suggested": "推奨を使用", "do_not_share_warning_text" : "サポートを含め、これらを他の誰とも共有しないでください。\n\n彼らはあなたのお金を盗みます!", "help": "ヘルプ" } diff --git a/res/values/strings_ko.arb b/res/values/strings_ko.arb index 91cef97d4..127aa949e 100644 --- a/res/values/strings_ko.arb +++ b/res/values/strings_ko.arb @@ -646,6 +646,10 @@ "remaining": "남은", "delete_wallet": "지갑 삭제", "delete_wallet_confirm_message" : "${wallet_name} 지갑을 삭제하시겠습니까?", + "low_fee": "낮은 수수료", + "low_fee_alert": "현재 낮은 네트워크 요금 우선 순위를 사용하고 있습니다. 이로 인해 긴 대기 시간, 다른 요금 또는 취소된 거래가 발생할 수 있습니다. 더 나은 경험을 위해 더 높은 요금을 설정하는 것이 좋습니다.", + "ignor": "무시하다", + "use_suggested": "추천 사용", "do_not_share_warning_text" : "지원을 포함하여 다른 사람과 이러한 정보를 공유하지 마십시오.\n\n그들은 당신의 돈을 훔칠 것입니다!", "help": "돕다" } diff --git a/res/values/strings_nl.arb b/res/values/strings_nl.arb index 84b34cba5..bc53337a8 100644 --- a/res/values/strings_nl.arb +++ b/res/values/strings_nl.arb @@ -646,6 +646,10 @@ "remaining": "resterende", "delete_wallet": "Portemonnee verwijderen", "delete_wallet_confirm_message" : "Weet u zeker dat u de portemonnee van ${wallet_name} wilt verwijderen?", + "low_fee": "Lage vergoeding", + "low_fee_alert": "U gebruikt momenteel een lage prioriteit voor netwerkkosten. Dit kan lange wachttijden, andere tarieven of geannuleerde transacties veroorzaken. We raden aan een hogere vergoeding in te stellen voor een betere ervaring.", + "ignor": "Negeren", + "use_suggested": "Gebruik aanbevolen", "do_not_share_warning_text" : "Deel deze met niemand anders, ook niet met support.\n\nZe zullen je geld stelen!", "help": "helpen" } diff --git a/res/values/strings_pl.arb b/res/values/strings_pl.arb index 245d48d3e..454fe9717 100644 --- a/res/values/strings_pl.arb +++ b/res/values/strings_pl.arb @@ -646,6 +646,10 @@ "remaining": "pozostałe", "delete_wallet": "Usuń portfel", "delete_wallet_confirm_message" : "Czy na pewno chcesz usunąć portfel ${wallet_name}?", + "low_fee": "Niska opłata", + "low_fee_alert": "Obecnie korzystasz z niskiego priorytetu opłaty sieciowej. Może to spowodować długie oczekiwanie, różne stawki lub anulowane transakcje. Zalecamy ustawienie wyższej opłaty, aby zapewnić lepsze wrażenia.", + "ignor": "Ignorować", + "use_suggested": "Użyj sugerowane", "do_not_share_warning_text" : "Nie udostępniaj ich nikomu innemu, w tym wsparcia.\n\nUkradną twoje pieniądze!", "help": "pomoc" } diff --git a/res/values/strings_pt.arb b/res/values/strings_pt.arb index e6b09a323..04a0a3ff2 100644 --- a/res/values/strings_pt.arb +++ b/res/values/strings_pt.arb @@ -646,6 +646,10 @@ "remaining": "restante", "delete_wallet": "Excluir carteira", "delete_wallet_confirm_message" : "Tem certeza de que deseja excluir a carteira ${wallet_name}?", + "low_fee": "Taxa baixa", + "low_fee_alert": "No momento, você está usando uma prioridade de taxa de rede baixa. Isso pode causar longas esperas, taxas diferentes ou negociações canceladas. Recomendamos definir uma taxa mais alta para uma melhor experiência.", + "ignor": "Ignorar", + "use_suggested": "Uso sugerido", "do_not_share_warning_text" : "Não os compartilhe com mais ninguém, incluindo suporte.\n\nEles vão roubar seu dinheiro!", "help": "ajuda" } diff --git a/res/values/strings_ru.arb b/res/values/strings_ru.arb index c3c832b36..632b0990c 100644 --- a/res/values/strings_ru.arb +++ b/res/values/strings_ru.arb @@ -646,6 +646,10 @@ "remaining": "осталось", "delete_wallet": "Удалить кошелек", "delete_wallet_confirm_message" : "Вы уверены, что хотите удалить кошелек ${wallet_name}?", + "low_fee": "Низкая комиссия", + "low_fee_alert": "В настоящее время вы используете низкий приоритет платы за сеть. Это может привести к длительному ожиданию, изменению ставок или отмене сделок. Мы рекомендуем установить более высокую плату для лучшего опыта.", + "ignor": "Игнорировать", + "use_suggested": "Использовать предложенный", "do_not_share_warning_text" : "Не делитесь ими с кем-либо еще, в том числе со службой поддержки.\n\nОни украдут ваши деньги!", "help": "помощь" } diff --git a/res/values/strings_uk.arb b/res/values/strings_uk.arb index 424f2567e..5e0f0d18a 100644 --- a/res/values/strings_uk.arb +++ b/res/values/strings_uk.arb @@ -645,6 +645,10 @@ "remaining": "залишилося", "delete_wallet": "Видалити гаманець", "delete_wallet_confirm_message" : "Ви впевнені, що хочете видалити гаманець ${wallet_name}?", + "low_fee": "Низька плата", + "low_fee_alert": "Зараз ви використовуєте низький пріоритет плати за мережу. Це може спричинити тривале очікування, інший курс або скасування угод. Ми рекомендуємо встановити вищу плату для кращого досвіду.", + "ignor": "Ігнорувати", + "use_suggested": "Використати запропоноване", "do_not_share_warning_text" : "Не повідомляйте їх нікому, включно зі службою підтримки.\n\nВони вкрадуть ваші гроші!", "help": "допомога" } diff --git a/res/values/strings_zh.arb b/res/values/strings_zh.arb index 5aba482a4..c46d07d59 100644 --- a/res/values/strings_zh.arb +++ b/res/values/strings_zh.arb @@ -644,6 +644,10 @@ "remaining": "剩余", "delete_wallet": "删除钱包", "delete_wallet_confirm_message" : "您确定要删除 ${wallet_name} 钱包吗?", + "low_fee": "费用低", + "low_fee_alert": "您当前正在使用低网络费用优先级。这可能会导致长时间等待、不同的费率或取消交易。我们建议设置更高的费用以获得更好的体验。", + "ignor": "忽视", + "use_suggested": "使用建议", "do_not_share_warning_text" : "不要與其他任何人分享這些內容,包括支持。\n\n他們會偷你的錢!", "help": "帮助" } From 0c995330e34982a650b202e6f135f947666cc1f5 Mon Sep 17 00:00:00 2001 From: mkyq <53115730+mkyq@users.noreply.github.com> Date: Thu, 3 Nov 2022 15:21:46 -0400 Subject: [PATCH 33/44] Change default transaction priorities for monero and haven to automatic. (#589) --- lib/haven/cw_haven.dart | 2 +- lib/monero/cw_monero.dart | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/haven/cw_haven.dart b/lib/haven/cw_haven.dart index d7aab48d0..6e805b0e3 100644 --- a/lib/haven/cw_haven.dart +++ b/lib/haven/cw_haven.dart @@ -166,7 +166,7 @@ class CWHaven extends Haven { @override TransactionPriority getDefaultTransactionPriority() { - return MoneroTransactionPriority.slow; + return MoneroTransactionPriority.automatic; } @override diff --git a/lib/monero/cw_monero.dart b/lib/monero/cw_monero.dart index 51ddf2688..9b10a12c9 100644 --- a/lib/monero/cw_monero.dart +++ b/lib/monero/cw_monero.dart @@ -167,7 +167,7 @@ class CWMonero extends Monero { @override TransactionPriority getDefaultTransactionPriority() { - return MoneroTransactionPriority.slow; + return MoneroTransactionPriority.automatic; } @override From 30bac3cb6c4348038e3add58eb55b9d034c0013c Mon Sep 17 00:00:00 2001 From: Justin Ehrenhofer Date: Thu, 3 Nov 2022 15:53:33 -0500 Subject: [PATCH 34/44] Add Anypay token (#518) * Add AnyPay token for interacting with the AnyPay API for Cake Pay payments * Add missing commas Co-authored-by: mkyq <53115730+mkyq@users.noreply.github.com> --- lib/anypay/anypay_api.dart | 10 ++++++++-- tool/utils/secret_key.dart | 1 + 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/lib/anypay/anypay_api.dart b/lib/anypay/anypay_api.dart index b53a3ebd1..5eb9e460b 100644 --- a/lib/anypay/anypay_api.dart +++ b/lib/anypay/anypay_api.dart @@ -5,11 +5,13 @@ import 'package:http/http.dart'; import 'package:cw_core/crypto_currency.dart'; import 'package:cake_wallet/anypay/any_pay_payment.dart'; import 'package:cake_wallet/anypay/any_pay_trasnaction.dart'; +import 'package:cake_wallet/.secrets.g.dart' as secrets; class AnyPayApi { static const contentTypePaymentRequest = 'application/payment-request'; static const contentTypePayment = 'application/payment'; static const xPayproVersion = '2'; + static const anypayToken = secrets.anypayToken; static String chainByScheme(String scheme) { switch (scheme.toLowerCase()) { @@ -44,7 +46,9 @@ class AnyPayApi { final headers = { 'Content-Type': contentTypePaymentRequest, 'X-Paypro-Version': xPayproVersion, - 'Accept': '*/*',}; + 'Accept': '*/*', + 'x-wallet': 'cake', + 'x-wallet-token': anypayToken,}; final body = { 'chain': chainByScheme(scheme), 'currency': currencyByScheme(scheme).title}; @@ -66,7 +70,9 @@ class AnyPayApi { final headers = { 'Content-Type': contentTypePayment, 'X-Paypro-Version': xPayproVersion, - 'Accept': '*/*',}; + 'Accept': '*/*', + 'x-wallet': 'cake', + 'x-wallet-token': anypayToken,}; final body = { 'chain': chain, 'currency': currency, diff --git a/tool/utils/secret_key.dart b/tool/utils/secret_key.dart index 4502bca74..64c7beefd 100644 --- a/tool/utils/secret_key.dart +++ b/tool/utils/secret_key.dart @@ -26,6 +26,7 @@ class SecretKey { SecretKey('sideShiftAffiliateId', () => ''), SecretKey('sideShiftApiKey', () => ''), SecretKey('simpleSwapApiKey', () => ''), + SecretKey('anypayToken', () => ''), SecretKey('onramperApiKey', () => ''), ]; From c9450aa0175413d9914f6459c43bf472574e2d98 Mon Sep 17 00:00:00 2001 From: Justin Ehrenhofer Date: Thu, 3 Nov 2022 16:10:05 -0500 Subject: [PATCH 35/44] Switch DE and NL strings (#591) * Switch DE and NL strings Replaces https://github.com/cake-tech/cake_wallet/pull/530, which deleted NL strings. Co-Authored-By: Edwin den Boer <22837744+ProkhorZ@users.noreply.github.com> * Fix 2 strings Co-Authored-By: Edwin den Boer <22837744+ProkhorZ@users.noreply.github.com> Co-authored-by: Edwin den Boer <22837744+ProkhorZ@users.noreply.github.com> --- res/values/strings_de.arb | 94 +++++++++++++++++++-------------------- res/values/strings_nl.arb | 94 +++++++++++++++++++-------------------- 2 files changed, 94 insertions(+), 94 deletions(-) diff --git a/res/values/strings_de.arb b/res/values/strings_de.arb index a580ab90a..685d817d5 100644 --- a/res/values/strings_de.arb +++ b/res/values/strings_de.arb @@ -579,55 +579,55 @@ "add_value": "Wert hinzufügen", "activate": "aktivieren", "get_a": "Hole ein", - "digital_and_physical_card": "digitale en fysieke prepaid debetkaart", - "get_card_note": " die u kunt herladen met digitale valuta. Geen aanvullende informatie nodig!", - "signup_for_card_accept_terms": "Meld je aan voor de kaart en accepteer de voorwaarden.", - "add_fund_to_card": "Voeg prepaid tegoed toe aan de kaarten (tot ${value})", - "use_card_info_two": "Tegoeden worden omgezet naar USD wanneer ze op de prepaid-rekening staan, niet in digitale valuta.", - "use_card_info_three": "Gebruik de digitale kaart online of met contactloze betaalmethoden.", - "optionally_order_card": "Optioneel een fysieke kaart bestellen.", - "hide_details" : "Details verbergen", - "show_details" : "Toon details", - "upto": "tot ${value}", - "discount": "Bespaar ${value}%", - "gift_card_amount": "Bedrag cadeaubon", - "bill_amount": "Bill bedrag", - "you_pay": "U betaalt", - "tip": "Tip:", - "custom": "aangepast", - "by_cake_pay": "door Cake Pay", - "expires": "Verloopt", + "digital_and_physical_card": "digitale und physische Prepaid-Debitkarte", + "get_card_note": " die Sie mit digitaler Währung aufladen können. Keine zusätzlichen Informationen erforderlich!", + "signup_for_card_accept_terms": "Melden Sie sich für die Karte an und akzeptieren Sie die Bedingungen.", + "add_fund_to_card": "Prepaid-Guthaben zu den Karten hinzufügen (bis zu ${value})", + "use_card_info_two": "Guthaben werden auf dem Prepaid-Konto in USD umgerechnet, nicht in digitale Währung.", + "use_card_info_three": "Verwenden Sie die digitale Karte online oder mit kontaktlosen Zahlungsmethoden.", + "optionally_order_card": "Optional eine physische Karte bestellen.", + "hide_details": "Details ausblenden", + "show_details": "Details anzeigen", + "upto": "bis zu ${value}", + "discount": "${value} % sparen", + "gift_card_amount": "Gutscheinbetrag", + "bill_amount": "Rechnungsbetrag", + "you_pay": "Sie bezahlen", + "tip": "Hinweis:", + "custom": "benutzerdefiniert", + "by_cake_pay": "von Cake Pay", + "expires": "Läuft ab", "mm": "MM", - "yy": "JJ", + "yy": "YY", "online": "online", - "offline": "Offline", - "gift_card_number": "Cadeaukaartnummer", - "pin_number": "PIN-nummer", - "total_saving": "Totale besparingen", - "last_30_days": "Laatste 30 dagen", - "avg_savings": "Gem. besparingen", - "view_all": "Alles bekijken", - "active_cards": "Actieve kaarten", - "delete_account": "Account verwijderen", - "cards": "Kaarten", - "active": "Actief", - "redeemed": "Verzilverd", - "gift_card_balance_note": "Cadeaukaarten met een resterend saldo verschijnen hier", - "gift_card_redeemed_note": "Cadeaubonnen die je hebt ingewisseld, verschijnen hier", - "logout": "Uitloggen", - "add_tip": "Tip toevoegen", - "percentageOf": "van ${amount}", - "is_percentage": "is", - "search_category": "Zoek categorie", - "mark_as_redeemed": "Markeer als ingewisseld", - "more_options": "Meer opties", - "waiting_payment_confirmation": "In afwachting van betalingsbevestiging", - "transaction_sent_notice": "Als het scherm na 1 minuut niet verder gaat, controleer dan een blokverkenner en je e-mail.", - "agree": "mee eens", - "in_store": "In winkel", - "generating_gift_card": "Cadeaubon genereren", - "payment_was_received": "Uw betaling is ontvangen.", - "proceed_after_one_minute": "Als het scherm na 1 minuut niet verder gaat, controleer dan uw e-mail.", + "offline": "offline", + "gift_card_number": "Geschenkkartennummer", + "pin_number": "PIN-Nummer", + "total_saving": "Gesamteinsparungen", + "last_30_days": "Letzte 30 Tage", + "avg_savings": "Durchschn. Einsparungen", + "view_all": "Alle anzeigen", + "active_cards": "Aktive Karten", + "delete_account": "Konto löschen", + "cards": "Karten", + "active": "Aktiv", + "redeemed": "Versilbert", + "gift_card_balance_note": "Geschenkkarten mit Restguthaben erscheinen hier", + "gift_card_redeemed_note": "Gutscheine, die Sie eingelöst haben, werden hier angezeigt", + "logout": "Abmelden", + "add_tip": "Tipp hinzufügen", + "percentageOf": "von ${amount}", + "is_percentage": "ist", + "search_category": "Suchkategorie", + "mark_as_redeemed": "Als eingelöst markieren", + "more_options": "Weitere Optionen", + "waiting_payment_confirmation": "Warte auf Zahlungsbestätigung", + "transaction_sent_notice": "Wenn der Bildschirm nach 1 Minute nicht weitergeht, überprüfen Sie einen Block-Explorer und Ihre E-Mail.", + "agree": "stimme zu", + "in_store": "Im Geschäft", + "generating_gift_card": "Geschenkkarte wird erstellt", + "payment_was_received": "Ihre Zahlung ist eingegangen.", + "proceed_after_one_minute": "Wenn der Bildschirm nach 1 Minute nicht weitergeht, überprüfen Sie bitte Ihre E-Mail.", "order_id": "Bestell-ID", "gift_card_is_generated": "Geschenkkarte wird generiert", "open_gift_card": "Geschenkkarte öffnen", diff --git a/res/values/strings_nl.arb b/res/values/strings_nl.arb index bc53337a8..fa748b552 100644 --- a/res/values/strings_nl.arb +++ b/res/values/strings_nl.arb @@ -579,55 +579,55 @@ "add_value": "Waarde toevoegen", "activate": "Activeren", "get_a": "Krijg een ", - "digital_and_physical_card": "digitale und physische Prepaid-Debitkarte", - "get_card_note": " die Sie mit digitaler Währung aufladen können. Keine zusätzlichen Informationen erforderlich!", - "signup_for_card_accept_terms": "Melden Sie sich für die Karte an und akzeptieren Sie die Bedingungen.", - "add_fund_to_card": "Prepaid-Guthaben zu den Karten hinzufügen (bis zu ${value})", - "use_card_info_two": "Guthaben werden auf dem Prepaid-Konto in USD umgerechnet, nicht in digitale Währung.", - "use_card_info_three": "Verwenden Sie die digitale Karte online oder mit kontaktlosen Zahlungsmethoden.", - "optional_order_card": "Optional eine physische Karte bestellen.", - "hide_details": "Details ausblenden", - "show_details": "Details anzeigen", - "upto": "bis zu ${value}", - "discount": "${value} % sparen", - "gift_card_amount": "Gutscheinbetrag", - "bill_amount": "Rechnungsbetrag", - "you_pay": "Sie bezahlen", - "tip": "Hinweis:", - "custom": "benutzerdefiniert", - "by_cake_pay": "von Cake Pay", - "expires": "Läuft ab", + "digital_and_physical_card": "digitale en fysieke prepaid debetkaart", + "get_card_note": " die u kunt herladen met digitale valuta. Geen aanvullende informatie nodig!", + "signup_for_card_accept_terms": "Meld je aan voor de kaart en accepteer de voorwaarden.", + "add_fund_to_card": "Voeg prepaid tegoed toe aan de kaarten (tot ${value})", + "use_card_info_two": "Tegoeden worden omgezet naar USD wanneer ze op de prepaid-rekening staan, niet in digitale valuta.", + "use_card_info_three": "Gebruik de digitale kaart online of met contactloze betaalmethoden.", + "optionally_order_card": "Optioneel een fysieke kaart bestellen.", + "hide_details" : "Details verbergen", + "show_details" : "Toon details", + "upto": "tot ${value}", + "discount": "Bespaar ${value}%", + "gift_card_amount": "Bedrag cadeaubon", + "bill_amount": "Bill bedrag", + "you_pay": "U betaalt", + "tip": "Tip:", + "custom": "aangepast", + "by_cake_pay": "door Cake Pay", + "expires": "Verloopt", "mm": "MM", - "yy": "YY", + "yy": "JJ", "online": "online", - "offline": "offline", - "gift_card_number": "Geschenkkartennummer", - "pin_number": "PIN-Nummer", - "total_saving": "Gesamteinsparungen", - "last_30_days": "Letzte 30 Tage", - "avg_savings": "Durchschn. Einsparungen", - "view_all": "Alle anzeigen", - "active_cards": "Aktive Karten", - "delete_account": "Konto löschen", - "cards": "Karten", - "active": "Aktiv", - "redeemed": "Versilbert", - "gift_card_balance_note": "Geschenkkarten mit Restguthaben erscheinen hier", - "gift_card_redeemed_note": "Gutscheine, die Sie eingelöst haben, werden hier angezeigt", - "abmelden": "Abmelden", - "add_tip": "Tipp hinzufügen", - "percentageOf": "von ${amount}", - "is_percentage": "ist", - "search_category": "Suchkategorie", - "mark_as_redeemed": "Als eingelöst markieren", - "more_options": "Weitere Optionen", - "waiting_payment_confirmation": "Warte auf Zahlungsbestätigung", - "transaction_sent_notice": "Wenn der Bildschirm nach 1 Minute nicht weitergeht, überprüfen Sie einen Block-Explorer und Ihre E-Mail.", - "agree": "stimme zu", - "in_store": "Im Geschäft", - "generating_gift_card": "Geschenkkarte wird erstellt", - "payment_was_received": "Ihre Zahlung ist eingegangen.", - "proceed_after_one_minute": "Wenn der Bildschirm nach 1 Minute nicht weitergeht, überprüfen Sie bitte Ihre E-Mail.", + "offline": "Offline", + "gift_card_number": "Cadeaukaartnummer", + "pin_number": "PIN-nummer", + "total_saving": "Totale besparingen", + "last_30_days": "Laatste 30 dagen", + "avg_savings": "Gem. besparingen", + "view_all": "Alles bekijken", + "active_cards": "Actieve kaarten", + "delete_account": "Account verwijderen", + "cards": "Kaarten", + "active": "Actief", + "redeemed": "Verzilverd", + "gift_card_balance_note": "Cadeaukaarten met een resterend saldo verschijnen hier", + "gift_card_redeemed_note": "Cadeaubonnen die je hebt ingewisseld, verschijnen hier", + "logout": "Uitloggen", + "add_tip": "Tip toevoegen", + "percentageOf": "van ${amount}", + "is_percentage": "is", + "search_category": "Zoek categorie", + "mark_as_redeemed": "Markeer als ingewisseld", + "more_options": "Meer opties", + "waiting_payment_confirmation": "In afwachting van betalingsbevestiging", + "transaction_sent_notice": "Als het scherm na 1 minuut niet verder gaat, controleer dan een blokverkenner en je e-mail.", + "agree": "mee eens", + "in_store": "In winkel", + "generating_gift_card": "Cadeaubon genereren", + "payment_was_received": "Uw betaling is ontvangen.", + "proceed_after_one_minute": "Als het scherm na 1 minuut niet verder gaat, controleer dan uw e-mail.", "order_id": "Order-ID", "gift_card_is_generated": "Cadeaukaart is gegenereerd", "open_gift_card": "Geschenkkaart openen", From 8683b0f435e2344dffecd573b231140179e773e6 Mon Sep 17 00:00:00 2001 From: mkyq <53115730+mkyq@users.noreply.github.com> Date: Thu, 3 Nov 2022 18:16:58 -0400 Subject: [PATCH 36/44] Update version for cake wallet to 4.5.0 and monero.com to 1.2.0 (#592) --- scripts/android/app_env.sh | 8 ++++---- scripts/ios/app_env.sh | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/scripts/android/app_env.sh b/scripts/android/app_env.sh index 48fd9c196..c0b934dae 100644 --- a/scripts/android/app_env.sh +++ b/scripts/android/app_env.sh @@ -14,14 +14,14 @@ TYPES=($MONERO_COM $CAKEWALLET $HAVEN) APP_ANDROID_TYPE=$1 MONERO_COM_NAME="Monero.com" -MONERO_COM_VERSION="1.1.2" -MONERO_COM_BUILD_NUMBER=21 +MONERO_COM_VERSION="1.2.0" +MONERO_COM_BUILD_NUMBER=24 MONERO_COM_BUNDLE_ID="com.monero.app" MONERO_COM_PACKAGE="com.monero.app" CAKEWALLET_NAME="Cake Wallet" -CAKEWALLET_VERSION="4.4.8" -CAKEWALLET_BUILD_NUMBER=122 +CAKEWALLET_VERSION="4.5.0" +CAKEWALLET_BUILD_NUMBER=127 CAKEWALLET_BUNDLE_ID="com.cakewallet.cake_wallet" CAKEWALLET_PACKAGE="com.cakewallet.cake_wallet" diff --git a/scripts/ios/app_env.sh b/scripts/ios/app_env.sh index d20e921a0..e5bed6a1a 100644 --- a/scripts/ios/app_env.sh +++ b/scripts/ios/app_env.sh @@ -13,13 +13,13 @@ TYPES=($MONERO_COM $CAKEWALLET $HAVEN) APP_IOS_TYPE=$1 MONERO_COM_NAME="Monero.com" -MONERO_COM_VERSION="1.1.2" -MONERO_COM_BUILD_NUMBER=23 +MONERO_COM_VERSION="1.2.0" +MONERO_COM_BUILD_NUMBER=24 MONERO_COM_BUNDLE_ID="com.cakewallet.monero" CAKEWALLET_NAME="Cake Wallet" -CAKEWALLET_VERSION="4.4.8" -CAKEWALLET_BUILD_NUMBER=121 +CAKEWALLET_VERSION="4.5.0" +CAKEWALLET_BUILD_NUMBER=127 CAKEWALLET_BUNDLE_ID="com.fotolockr.cakewallet" HAVEN_NAME="Haven" From 3ec414ae666c6a78f5219e967b5596c3d2b91335 Mon Sep 17 00:00:00 2001 From: mkyq <53115730+mkyq@users.noreply.github.com> Date: Thu, 3 Nov 2022 19:13:13 -0400 Subject: [PATCH 37/44] Add adapters for some of bitcoin, litecoin and monero transactions priorities. Replace direct calls of transaction priorities for exchange_view_model. (#593) --- lib/bitcoin/cw_bitcoin.dart | 16 ++++++++++++++++ lib/monero/cw_monero.dart | 8 ++++++++ lib/view_model/exchange/exchange_view_model.dart | 15 +++++++-------- tool/configure.dart | 6 ++++++ 4 files changed, 37 insertions(+), 8 deletions(-) diff --git a/lib/bitcoin/cw_bitcoin.dart b/lib/bitcoin/cw_bitcoin.dart index ff6fd7531..f224efde6 100644 --- a/lib/bitcoin/cw_bitcoin.dart +++ b/lib/bitcoin/cw_bitcoin.dart @@ -140,4 +140,20 @@ class CWBitcoin extends Bitcoin { WalletService createLitecoinWalletService(Box walletInfoSource, Box unspentCoinSource) { return LitecoinWalletService(walletInfoSource, unspentCoinSource); } + + @override + TransactionPriority getBitcoinTransactionPriorityMedium() + => BitcoinTransactionPriority.medium; + + @override + TransactionPriority getLitecoinTransactionPriorityMedium() + => LitecoinTransactionPriority.medium; + + @override + TransactionPriority getBitcoinTransactionPrioritySlow() + => BitcoinTransactionPriority.slow; + + @override + TransactionPriority getLitecoinTransactionPrioritySlow() + => LitecoinTransactionPriority.slow; } \ No newline at end of file diff --git a/lib/monero/cw_monero.dart b/lib/monero/cw_monero.dart index 9b10a12c9..48c0c51a4 100644 --- a/lib/monero/cw_monero.dart +++ b/lib/monero/cw_monero.dart @@ -170,6 +170,14 @@ class CWMonero extends Monero { return MoneroTransactionPriority.automatic; } + @override + TransactionPriority getMoneroTransactionPrioritySlow() + => MoneroTransactionPriority.slow; + + @override + TransactionPriority getMoneroTransactionPriorityAutomatic() + => MoneroTransactionPriority.automatic; + @override TransactionPriority deserializeMoneroTransactionPriority({required int raw}) { return MoneroTransactionPriority.deserialize(raw: raw); diff --git a/lib/view_model/exchange/exchange_view_model.dart b/lib/view_model/exchange/exchange_view_model.dart index 9ff690b70..e7e73855b 100644 --- a/lib/view_model/exchange/exchange_view_model.dart +++ b/lib/view_model/exchange/exchange_view_model.dart @@ -7,8 +7,6 @@ import 'package:cake_wallet/exchange/sideshift/sideshift_exchange_provider.dart' import 'package:cake_wallet/exchange/sideshift/sideshift_request.dart'; import 'package:cake_wallet/exchange/simpleswap/simpleswap_exchange_provider.dart'; import 'package:cake_wallet/view_model/settings/settings_view_model.dart'; -import 'package:cw_bitcoin/bitcoin_transaction_priority.dart'; -import 'package:cw_core/monero_transaction_priority.dart'; import 'package:cw_core/transaction_priority.dart'; import 'package:cake_wallet/exchange/simpleswap/simpleswap_request.dart'; import 'package:cw_core/wallet_base.dart'; @@ -16,6 +14,7 @@ import 'package:cw_core/crypto_currency.dart'; import 'package:cw_core/sync_status.dart'; import 'package:cw_core/wallet_type.dart'; import 'package:cake_wallet/bitcoin/bitcoin.dart'; +import 'package:cake_wallet/monero/monero.dart'; import 'package:cake_wallet/exchange/exchange_provider.dart'; import 'package:cake_wallet/exchange/limits.dart'; import 'package:cake_wallet/exchange/trade.dart'; @@ -200,11 +199,11 @@ abstract class ExchangeViewModelBase with Store { switch (wallet.type) { case WalletType.monero: case WalletType.haven: - return _settingsViewModel.transactionPriority == MoneroTransactionPriority.slow; + return _settingsViewModel.transactionPriority == monero!.getMoneroTransactionPrioritySlow(); case WalletType.bitcoin: - return _settingsViewModel.transactionPriority == BitcoinTransactionPriority.slow; + return _settingsViewModel.transactionPriority == bitcoin!.getBitcoinTransactionPrioritySlow(); case WalletType.litecoin: - return _settingsViewModel.transactionPriority == LitecoinTransactionPriority.slow; + return _settingsViewModel.transactionPriority == bitcoin!.getLitecoinTransactionPrioritySlow(); default: return false; } @@ -637,13 +636,13 @@ abstract class ExchangeViewModelBase with Store { switch (wallet.type) { case WalletType.monero: case WalletType.haven: - _settingsStore.priority[wallet.type] = MoneroTransactionPriority.automatic; + _settingsStore.priority[wallet.type] = monero!.getMoneroTransactionPriorityAutomatic(); break; case WalletType.bitcoin: - _settingsStore.priority[wallet.type] = BitcoinTransactionPriority.medium; + _settingsStore.priority[wallet.type] = bitcoin!.getBitcoinTransactionPriorityMedium(); break; case WalletType.litecoin: - _settingsStore.priority[wallet.type] = LitecoinTransactionPriority.medium; + _settingsStore.priority[wallet.type] = bitcoin!.getLitecoinTransactionPriorityMedium(); break; default: break; diff --git a/tool/configure.dart b/tool/configure.dart index ca8d3c9fb..0d3d175c4 100644 --- a/tool/configure.dart +++ b/tool/configure.dart @@ -92,6 +92,10 @@ abstract class Bitcoin { void updateUnspents(Object wallet); WalletService createBitcoinWalletService(Box walletInfoSource, Box unspentCoinSource); WalletService createLitecoinWalletService(Box walletInfoSource, Box unspentCoinSource); + TransactionPriority getBitcoinTransactionPriorityMedium(); + TransactionPriority getLitecoinTransactionPriorityMedium(); + TransactionPriority getBitcoinTransactionPrioritySlow(); + TransactionPriority getLitecoinTransactionPrioritySlow(); } """; @@ -218,6 +222,8 @@ abstract class Monero { int getHeigthByDate({required DateTime date}); TransactionPriority getDefaultTransactionPriority(); + TransactionPriority getMoneroTransactionPrioritySlow(); + TransactionPriority getMoneroTransactionPriorityAutomatic(); TransactionPriority deserializeMoneroTransactionPriority({required int raw}); List getTransactionPriorities(); List getMoneroWordList(String language); From d40cd3ebadc3135b9041f8893f61f13e349d599a Mon Sep 17 00:00:00 2001 From: mkyq <53115730+mkyq@users.noreply.github.com> Date: Thu, 3 Nov 2022 19:14:48 -0400 Subject: [PATCH 38/44] Update build version for cake wallet to 128 (#594) --- scripts/android/app_env.sh | 2 +- scripts/ios/app_env.sh | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/android/app_env.sh b/scripts/android/app_env.sh index c0b934dae..929d2b444 100644 --- a/scripts/android/app_env.sh +++ b/scripts/android/app_env.sh @@ -21,7 +21,7 @@ MONERO_COM_PACKAGE="com.monero.app" CAKEWALLET_NAME="Cake Wallet" CAKEWALLET_VERSION="4.5.0" -CAKEWALLET_BUILD_NUMBER=127 +CAKEWALLET_BUILD_NUMBER=128 CAKEWALLET_BUNDLE_ID="com.cakewallet.cake_wallet" CAKEWALLET_PACKAGE="com.cakewallet.cake_wallet" diff --git a/scripts/ios/app_env.sh b/scripts/ios/app_env.sh index e5bed6a1a..43ec68c31 100644 --- a/scripts/ios/app_env.sh +++ b/scripts/ios/app_env.sh @@ -19,7 +19,7 @@ MONERO_COM_BUNDLE_ID="com.cakewallet.monero" CAKEWALLET_NAME="Cake Wallet" CAKEWALLET_VERSION="4.5.0" -CAKEWALLET_BUILD_NUMBER=127 +CAKEWALLET_BUILD_NUMBER=128 CAKEWALLET_BUNDLE_ID="com.fotolockr.cakewallet" HAVEN_NAME="Haven" From 5d741b183f5ef0a25852f568ee93e085abea4dfd Mon Sep 17 00:00:00 2001 From: mkyq <53115730+mkyq@users.noreply.github.com> Date: Fri, 4 Nov 2022 15:55:21 -0400 Subject: [PATCH 39/44] =?UTF-8?q?Add=20default=20values=20for=20hive=20fie?= =?UTF-8?q?lds=20for=20Node,=20UnspentCoinsInfo,=20Wallet=E2=80=A6=20(#598?= =?UTF-8?q?)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Add default values for hive fields for Node, UnspentCoinsInfo, WalletInfo, Order, Contact, TransactionDescription, Trade --- cw_core/lib/node.dart | 4 ++-- cw_core/lib/unspent_coins_info.dart | 8 ++++---- cw_core/lib/wallet_info.dart | 16 ++++++++-------- lib/buy/order.dart | 14 +++++++------- lib/entities/contact.dart | 6 +++--- lib/entities/transaction_description.dart | 2 +- lib/exchange/trade.dart | 12 ++++++------ 7 files changed, 31 insertions(+), 31 deletions(-) diff --git a/cw_core/lib/node.dart b/cw_core/lib/node.dart index 1f2cfe7d2..886add3cd 100644 --- a/cw_core/lib/node.dart +++ b/cw_core/lib/node.dart @@ -36,7 +36,7 @@ class Node extends HiveObject with Keyable { static const typeId = 1; static const boxName = 'Nodes'; - @HiveField(0) + @HiveField(0, defaultValue: '') late String uriRaw; @HiveField(1) @@ -45,7 +45,7 @@ class Node extends HiveObject with Keyable { @HiveField(2) String? password; - @HiveField(3) + @HiveField(3, defaultValue: 0) late int typeRaw; @HiveField(4) diff --git a/cw_core/lib/unspent_coins_info.dart b/cw_core/lib/unspent_coins_info.dart index 420517939..d825db279 100644 --- a/cw_core/lib/unspent_coins_info.dart +++ b/cw_core/lib/unspent_coins_info.dart @@ -15,16 +15,16 @@ class UnspentCoinsInfo extends HiveObject { static const boxName = 'Unspent'; static const boxKey = 'unspentBoxKey'; - @HiveField(0) + @HiveField(0, defaultValue: '') String walletId; - @HiveField(1) + @HiveField(1, defaultValue: '') String hash; - @HiveField(2) + @HiveField(2, defaultValue: false) bool isFrozen; - @HiveField(3) + @HiveField(3, defaultValue: false) bool isSending; @HiveField(4) diff --git a/cw_core/lib/wallet_info.dart b/cw_core/lib/wallet_info.dart index 66ed1e932..a25702cf7 100644 --- a/cw_core/lib/wallet_info.dart +++ b/cw_core/lib/wallet_info.dart @@ -33,31 +33,31 @@ class WalletInfo extends HiveObject { static const typeId = 4; static const boxName = 'WalletInfo'; - @HiveField(0) + @HiveField(0, defaultValue: '') String id; - @HiveField(1) + @HiveField(1, defaultValue: '') String name; @HiveField(2) WalletType type; - @HiveField(3) + @HiveField(3, defaultValue: false) bool isRecovery; - @HiveField(4) + @HiveField(4, defaultValue: 0) int restoreHeight; - @HiveField(5) + @HiveField(5, defaultValue: 0) int timestamp; - @HiveField(6) + @HiveField(6, defaultValue: '') String dirPath; - @HiveField(7) + @HiveField(7, defaultValue: '') String path; - @HiveField(8) + @HiveField(8, defaultValue: '') String address; @HiveField(10) diff --git a/lib/buy/order.dart b/lib/buy/order.dart index 16dfbb4e0..387fbcd34 100644 --- a/lib/buy/order.dart +++ b/lib/buy/order.dart @@ -30,10 +30,10 @@ class Order extends HiveObject { static const boxName = 'Orders'; static const boxKey = 'ordersBoxKey'; - @HiveField(0) + @HiveField(0, defaultValue: '') String id; - @HiveField(1) + @HiveField(1, defaultValue: '') String transferId; @HiveField(2) @@ -42,7 +42,7 @@ class Order extends HiveObject { @HiveField(3) String? to; - @HiveField(4) + @HiveField(4, defaultValue: '') late String stateRaw; TradeState get state => TradeState.deserialize(raw: stateRaw); @@ -50,16 +50,16 @@ class Order extends HiveObject { @HiveField(5) DateTime createdAt; - @HiveField(6) + @HiveField(6, defaultValue: '') String amount; - @HiveField(7) + @HiveField(7, defaultValue: '') String receiveAddress; - @HiveField(8) + @HiveField(8, defaultValue: '') String walletId; - @HiveField(9) + @HiveField(9, defaultValue: 0) late int providerRaw; BuyProviderDescription get provider => diff --git a/lib/entities/contact.dart b/lib/entities/contact.dart index b76e4de43..e111429ca 100644 --- a/lib/entities/contact.dart +++ b/lib/entities/contact.dart @@ -17,13 +17,13 @@ class Contact extends HiveObject with Keyable { static const typeId = 0; static const boxName = 'Contacts'; - @HiveField(0) + @HiveField(0, defaultValue: '') String name; - @HiveField(1) + @HiveField(1, defaultValue: '') String address; - @HiveField(2) + @HiveField(2, defaultValue: 0) late int raw; CryptoCurrency get type => CryptoCurrency.deserialize(raw: raw); diff --git a/lib/entities/transaction_description.dart b/lib/entities/transaction_description.dart index 868077733..86d6b043a 100644 --- a/lib/entities/transaction_description.dart +++ b/lib/entities/transaction_description.dart @@ -10,7 +10,7 @@ class TransactionDescription extends HiveObject { static const boxName = 'TransactionDescriptions'; static const boxKey = 'transactionDescriptionsBoxKey'; - @HiveField(0) + @HiveField(0, defaultValue: '') String id; @HiveField(1) diff --git a/lib/exchange/trade.dart b/lib/exchange/trade.dart index 0f6425ecc..99b73e789 100644 --- a/lib/exchange/trade.dart +++ b/lib/exchange/trade.dart @@ -40,26 +40,26 @@ class Trade extends HiveObject { static const boxName = 'Trades'; static const boxKey = 'tradesBoxKey'; - @HiveField(0) + @HiveField(0, defaultValue: '') String id; - @HiveField(1) + @HiveField(1, defaultValue: 0) late int providerRaw; ExchangeProviderDescription get provider => ExchangeProviderDescription.deserialize(raw: providerRaw); - @HiveField(2) + @HiveField(2, defaultValue: 0) late int fromRaw; CryptoCurrency get from => CryptoCurrency.deserialize(raw: fromRaw); - @HiveField(3) + @HiveField(3, defaultValue: 0) late int toRaw; CryptoCurrency get to => CryptoCurrency.deserialize(raw: toRaw); - @HiveField(4) + @HiveField(4, defaultValue: '') late String stateRaw; TradeState get state => TradeState.deserialize(raw: stateRaw); @@ -70,7 +70,7 @@ class Trade extends HiveObject { @HiveField(6) DateTime? expiredAt; - @HiveField(7) + @HiveField(7, defaultValue: '') String amount; @HiveField(8) From 0a0f9e80fd01909c6a8044e6a1ad290dcb953fca Mon Sep 17 00:00:00 2001 From: mkyq <53115730+mkyq@users.noreply.github.com> Date: Fri, 4 Nov 2022 17:51:27 -0400 Subject: [PATCH 40/44] Update build version for cakewallet to 129; monero.com to 25 (#600) --- scripts/android/app_env.sh | 4 ++-- scripts/ios/app_env.sh | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/scripts/android/app_env.sh b/scripts/android/app_env.sh index 929d2b444..ea9ae40c7 100644 --- a/scripts/android/app_env.sh +++ b/scripts/android/app_env.sh @@ -15,13 +15,13 @@ APP_ANDROID_TYPE=$1 MONERO_COM_NAME="Monero.com" MONERO_COM_VERSION="1.2.0" -MONERO_COM_BUILD_NUMBER=24 +MONERO_COM_BUILD_NUMBER=25 MONERO_COM_BUNDLE_ID="com.monero.app" MONERO_COM_PACKAGE="com.monero.app" CAKEWALLET_NAME="Cake Wallet" CAKEWALLET_VERSION="4.5.0" -CAKEWALLET_BUILD_NUMBER=128 +CAKEWALLET_BUILD_NUMBER=129 CAKEWALLET_BUNDLE_ID="com.cakewallet.cake_wallet" CAKEWALLET_PACKAGE="com.cakewallet.cake_wallet" diff --git a/scripts/ios/app_env.sh b/scripts/ios/app_env.sh index 43ec68c31..81f7ba668 100644 --- a/scripts/ios/app_env.sh +++ b/scripts/ios/app_env.sh @@ -14,12 +14,12 @@ APP_IOS_TYPE=$1 MONERO_COM_NAME="Monero.com" MONERO_COM_VERSION="1.2.0" -MONERO_COM_BUILD_NUMBER=24 +MONERO_COM_BUILD_NUMBER=25 MONERO_COM_BUNDLE_ID="com.cakewallet.monero" CAKEWALLET_NAME="Cake Wallet" CAKEWALLET_VERSION="4.5.0" -CAKEWALLET_BUILD_NUMBER=128 +CAKEWALLET_BUILD_NUMBER=129 CAKEWALLET_BUNDLE_ID="com.fotolockr.cakewallet" HAVEN_NAME="Haven" From 8981ebad566ecbe62ecb2ec766d86501663444b7 Mon Sep 17 00:00:00 2001 From: mkyq <53115730+mkyq@users.noreply.github.com> Date: Mon, 7 Nov 2022 13:16:09 -0500 Subject: [PATCH 41/44] Fix parsing of json to Map for ionia api. Update sing in and verify email methods for ionia api. (#604) --- lib/ionia/ionia_api.dart | 30 +++++++++++++----------------- lib/ionia/ionia_service.dart | 6 ++---- lib/ionia/ionia_virtual_card.dart | 2 +- 3 files changed, 16 insertions(+), 22 deletions(-) diff --git a/lib/ionia/ionia_api.dart b/lib/ionia/ionia_api.dart index e9526a47e..274e557c7 100644 --- a/lib/ionia/ionia_api.dart +++ b/lib/ionia/ionia_api.dart @@ -36,8 +36,8 @@ class IoniaApi { throw Exception('Unexpected http status: ${response.statusCode}'); } - final bodyJson = json.decode(response.body) as Map; - final data = bodyJson['Data'] as Map; + final bodyJson = json.decode(response.body) as Map; + final data = bodyJson['Data'] as Map; final isSuccessful = bodyJson['Successful'] as bool; if (!isSuccessful) { @@ -50,13 +50,11 @@ class IoniaApi { // Verify email Future verifyEmail({ - required String username, required String email, required String code, required String clientId}) async { final headers = { 'clientId': clientId, - 'username': username, 'EmailAddress': email}; final query = {'verificationCode': code}; final uri = verifyEmailUri.replace(queryParameters: query); @@ -66,8 +64,8 @@ class IoniaApi { throw Exception('Unexpected http status: ${response.statusCode}'); } - final bodyJson = json.decode(response.body) as Map; - final data = bodyJson['Data'] as Map; + final bodyJson = json.decode(response.body) as Map; + final data = bodyJson['Data'] as Map; final isSuccessful = bodyJson['Successful'] as bool; if (!isSuccessful) { @@ -75,13 +73,13 @@ class IoniaApi { } final password = data['password'] as String; - username = data['username'] as String; + final username = data['username'] as String; return IoniaUserCredentials(username, password); } // Sign In - Future signIn(String email, {required String clientId}) async { + Future signIn(String email, {required String clientId}) async { final headers = {'clientId': clientId}; final query = {'emailAddress': email}; final uri = signInUri.replace(queryParameters: query); @@ -91,15 +89,13 @@ class IoniaApi { throw Exception('Unexpected http status: ${response.statusCode}'); } - final bodyJson = json.decode(response.body) as Map; - final data = bodyJson['Data'] as Map; + final bodyJson = json.decode(response.body) as Map; + final data = bodyJson['Data'] as Map; final isSuccessful = bodyJson['Successful'] as bool; if (!isSuccessful) { throw Exception(data['ErrorMessage'] as String); } - - return data['username'] as String; } // Get virtual card @@ -118,15 +114,15 @@ class IoniaApi { throw Exception('Unexpected http status: ${response.statusCode}'); } - final bodyJson = json.decode(response.body) as Map; - final data = bodyJson['Data'] as Map; + final bodyJson = json.decode(response.body) as Map; + final data = bodyJson['Data'] as Map; final isSuccessful = bodyJson['Successful'] as bool; if (!isSuccessful) { throw Exception(data['message'] as String); } - final virtualCard = data['VirtualCard'] as Map; + final virtualCard = data['VirtualCard'] as Map; return IoniaVirtualCard.fromMap(virtualCard); } @@ -146,8 +142,8 @@ class IoniaApi { throw Exception('Unexpected http status: ${response.statusCode}'); } - final bodyJson = json.decode(response.body) as Map; - final data = bodyJson['Data'] as Map; + final bodyJson = json.decode(response.body) as Map; + final data = bodyJson['Data'] as Map; final isSuccessful = bodyJson['Successful'] as bool? ?? false; if (!isSuccessful) { diff --git a/lib/ionia/ionia_service.dart b/lib/ionia/ionia_service.dart index a18cac5cb..942bc25b5 100644 --- a/lib/ionia/ionia_service.dart +++ b/lib/ionia/ionia_service.dart @@ -31,9 +31,8 @@ class IoniaService { // Verify email Future verifyEmail(String code) async { - final username = (await secureStorage.read(key: ioniaUsernameStorageKey))!; final email = (await secureStorage.read(key: ioniaEmailStorageKey))!; - final credentials = await ioniaApi.verifyEmail(email: email, username: username, code: code, clientId: clientId); + final credentials = await ioniaApi.verifyEmail(email: email, code: code, clientId: clientId); await secureStorage.write(key: ioniaPasswordStorageKey, value: credentials.password); await secureStorage.write(key: ioniaUsernameStorageKey, value: credentials.username); } @@ -41,9 +40,8 @@ class IoniaService { // Sign In Future signIn(String email) async { - final username = await ioniaApi.signIn(email, clientId: clientId); + await ioniaApi.signIn(email, clientId: clientId); await secureStorage.write(key: ioniaEmailStorageKey, value: email); - await secureStorage.write(key: ioniaUsernameStorageKey, value: username); } Future getUserEmail() async { diff --git a/lib/ionia/ionia_virtual_card.dart b/lib/ionia/ionia_virtual_card.dart index 29736c22f..ca3e35dbc 100644 --- a/lib/ionia/ionia_virtual_card.dart +++ b/lib/ionia/ionia_virtual_card.dart @@ -11,7 +11,7 @@ class IoniaVirtualCard { required this.fundsLimit, required this.spendLimit}); - factory IoniaVirtualCard.fromMap(Map source) { + factory IoniaVirtualCard.fromMap(Map source) { final created = source['created'] as String; final createdAt = DateTime.tryParse(created); From 2696c242a917793f19657e39a5d28215832473da Mon Sep 17 00:00:00 2001 From: mkyq <53115730+mkyq@users.noreply.github.com> Date: Mon, 7 Nov 2022 13:36:57 -0500 Subject: [PATCH 42/44] Removed force white background color for CupertinoDatePicker. (#605) --- lib/utils/date_picker.dart | 1 - 1 file changed, 1 deletion(-) diff --git a/lib/utils/date_picker.dart b/lib/utils/date_picker.dart index f774142bf..99274d8e0 100644 --- a/lib/utils/date_picker.dart +++ b/lib/utils/date_picker.dart @@ -45,7 +45,6 @@ Future _buildCupertinoDataPicker( initialDateTime: initialDate, minimumDate: firstDate, maximumDate: lastDate, - backgroundColor: Colors.white, ), ); } From 71444219bea2c32d0095b831ac23cbbb1a33e559 Mon Sep 17 00:00:00 2001 From: Omar Hatem Date: Mon, 7 Nov 2022 22:35:34 +0200 Subject: [PATCH 43/44] Cw 218 fix change pin using bio auth (#599) * - push change pin page as a replacement for auth page to avoid closing it once its opened - Add cool-down duration after popping flushbars and pushing new routes --- ios/Podfile.lock | 2 +- lib/src/screens/auth/auth_page.dart | 24 +++++++++---------- .../settings/settings_view_model.dart | 12 +++++----- 3 files changed, 19 insertions(+), 19 deletions(-) diff --git a/ios/Podfile.lock b/ios/Podfile.lock index f8f120bd6..3a810430d 100644 --- a/ios/Podfile.lock +++ b/ios/Podfile.lock @@ -252,4 +252,4 @@ SPEC CHECKSUMS: PODFILE CHECKSUM: ae71bdf0eb731a1ffc399c122f6aa4dea0cb5f6f -COCOAPODS: 1.11.2 +COCOAPODS: 1.11.3 diff --git a/lib/src/screens/auth/auth_page.dart b/lib/src/screens/auth/auth_page.dart index 0b3b8511a..7a1bd8420 100644 --- a/lib/src/screens/auth/auth_page.dart +++ b/lib/src/screens/auth/auth_page.dart @@ -106,22 +106,22 @@ class AuthPageState extends State { _progressBar = null; } - Future close({String? route}) async { + Future close({String? route, dynamic arguments}) async { if (_key.currentContext == null) { throw Exception('Key context is null. Should be not happened'); } - WidgetsBinding.instance.addPostFrameCallback((_) { - dismissFlushBar(_authBar); - dismissFlushBar(_progressBar); - WidgetsBinding.instance.addPostFrameCallback((_) { - if (route != null) { - Navigator.of(_key.currentContext!).pushReplacementNamed(route); - } else { - Navigator.of(_key.currentContext!).pop(); - } - }); - }); + /// not the best scenario, but WidgetsBinding is not behaving correctly on Android + await Future.delayed(Duration(milliseconds: 50)); + await _authBar?.dismiss(); + await Future.delayed(Duration(milliseconds: 50)); + await _progressBar?.dismiss(); + await Future.delayed(Duration(milliseconds: 50)); + if (route != null) { + Navigator.of(_key.currentContext!).pushReplacementNamed(route, arguments: arguments); + } else { + Navigator.of(_key.currentContext!).pop(); + } } @override diff --git a/lib/view_model/settings/settings_view_model.dart b/lib/view_model/settings/settings_view_model.dart index 96b2e7bdd..aabe51ef1 100644 --- a/lib/view_model/settings/settings_view_model.dart +++ b/lib/view_model/settings/settings_view_model.dart @@ -156,13 +156,13 @@ abstract class SettingsViewModelBase with Store { handler: (BuildContext context) { Navigator.of(context).pushNamed(Routes.auth, arguments: (bool isAuthenticatedSuccessfully, AuthPageState auth) { - auth.close(); - if (isAuthenticatedSuccessfully) { - Navigator.of(context).pushNamed(Routes.setupPin, arguments: - (PinCodeState setupPinContext, String _) { + auth.close( + route: isAuthenticatedSuccessfully ? Routes.setupPin : null, + arguments: (PinCodeState setupPinContext, + String _) { setupPinContext.close(); - }); - } + }, + ); }); }), PickerListItem( From b6a6bf88bad58afdea501bc543fda80076ed999a Mon Sep 17 00:00:00 2001 From: mkyq <53115730+mkyq@users.noreply.github.com> Date: Mon, 7 Nov 2022 15:54:50 -0500 Subject: [PATCH 44/44] Update build number for cakewallet to 130; monero.com to 26 (#606) --- scripts/android/app_env.sh | 4 ++-- scripts/ios/app_env.sh | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/scripts/android/app_env.sh b/scripts/android/app_env.sh index ea9ae40c7..b9ca9f98b 100644 --- a/scripts/android/app_env.sh +++ b/scripts/android/app_env.sh @@ -15,13 +15,13 @@ APP_ANDROID_TYPE=$1 MONERO_COM_NAME="Monero.com" MONERO_COM_VERSION="1.2.0" -MONERO_COM_BUILD_NUMBER=25 +MONERO_COM_BUILD_NUMBER=26 MONERO_COM_BUNDLE_ID="com.monero.app" MONERO_COM_PACKAGE="com.monero.app" CAKEWALLET_NAME="Cake Wallet" CAKEWALLET_VERSION="4.5.0" -CAKEWALLET_BUILD_NUMBER=129 +CAKEWALLET_BUILD_NUMBER=130 CAKEWALLET_BUNDLE_ID="com.cakewallet.cake_wallet" CAKEWALLET_PACKAGE="com.cakewallet.cake_wallet" diff --git a/scripts/ios/app_env.sh b/scripts/ios/app_env.sh index 81f7ba668..bab932345 100644 --- a/scripts/ios/app_env.sh +++ b/scripts/ios/app_env.sh @@ -14,12 +14,12 @@ APP_IOS_TYPE=$1 MONERO_COM_NAME="Monero.com" MONERO_COM_VERSION="1.2.0" -MONERO_COM_BUILD_NUMBER=25 +MONERO_COM_BUILD_NUMBER=26 MONERO_COM_BUNDLE_ID="com.cakewallet.monero" CAKEWALLET_NAME="Cake Wallet" CAKEWALLET_VERSION="4.5.0" -CAKEWALLET_BUILD_NUMBER=129 +CAKEWALLET_BUILD_NUMBER=130 CAKEWALLET_BUNDLE_ID="com.fotolockr.cakewallet" HAVEN_NAME="Haven"