From d370c912bb94bca3f0c4bb1cd726c159959e53bc Mon Sep 17 00:00:00 2001 From: OleksandrSobol Date: Wed, 16 Dec 2020 20:39:53 +0200 Subject: [PATCH 01/39] CAKE-208 | added current balance display mode saving to shared preferences (settings_store.dart); added moneroBalance property, reactions and _onWalletChange() method to balance_view_model.dart --- lib/store/settings_store.dart | 5 ++ .../dashboard/balance_view_model.dart | 49 +++++++++++++++++-- 2 files changed, 50 insertions(+), 4 deletions(-) diff --git a/lib/store/settings_store.dart b/lib/store/settings_store.dart index b4b76bb8d..321bbe23e 100644 --- a/lib/store/settings_store.dart +++ b/lib/store/settings_store.dart @@ -87,6 +87,11 @@ abstract class SettingsStoreBase with Store { (_) => languageCode, (String languageCode) => sharedPreferences.setString( PreferencesKey.currentLanguageCode, languageCode)); + + reaction((_) => balanceDisplayMode, + (BalanceDisplayMode mode) => sharedPreferences.setInt( + PreferencesKey.currentBalanceDisplayModeKey, + mode.serialize())); } static const defaultPinLength = 4; diff --git a/lib/view_model/dashboard/balance_view_model.dart b/lib/view_model/dashboard/balance_view_model.dart index 37f6e5247..ace6a470b 100644 --- a/lib/view_model/dashboard/balance_view_model.dart +++ b/lib/view_model/dashboard/balance_view_model.dart @@ -1,5 +1,7 @@ import 'package:cake_wallet/bitcoin/bitcoin_wallet.dart'; +import 'package:cake_wallet/core/wallet_base.dart'; import 'package:cake_wallet/entities/crypto_currency.dart'; +import 'package:cake_wallet/monero/monero_balance.dart'; import 'package:cake_wallet/monero/monero_wallet.dart'; import 'package:cake_wallet/entities/balance_display_mode.dart'; import 'package:cake_wallet/entities/calculate_fiat_amount.dart'; @@ -19,7 +21,22 @@ abstract class BalanceViewModelBase with Store { @required this.appStore, @required this.settingsStore, @required this.fiatConvertationStore - }) : isReversing = false; + }) { + isReversing = false; + + wallet ??= appStore.wallet; + + _reaction = reaction((_) => appStore.wallet, _onWalletChange); + + final _wallet = wallet; + + if (_wallet is MoneroWallet) { + moneroBalance = _wallet.balance; + + _onMoneroBalanceChangeReaction = reaction((_) => _wallet.balance, + (MoneroBalance balance) => moneroBalance = balance); + } + } final AppStore appStore; final SettingsStore settingsStore; @@ -28,6 +45,12 @@ abstract class BalanceViewModelBase with Store { @observable bool isReversing; + @observable + MoneroBalance moneroBalance; + + @observable + WalletBase wallet; + @computed BalanceDisplayMode get savedDisplayMode => settingsStore.balanceDisplayMode; @@ -86,12 +109,12 @@ abstract class BalanceViewModelBase with Store { @computed WalletBalance get _walletBalance { - final _wallet = appStore.wallet; + final _wallet = wallet; if (_wallet is MoneroWallet) { return WalletBalance( - unlockedBalance: _wallet.balance.formattedUnlockedBalance, - totalBalance: _wallet.balance.formattedFullBalance); + unlockedBalance: moneroBalance.formattedUnlockedBalance, + totalBalance: moneroBalance.formattedFullBalance); } if (_wallet is BitcoinWallet) { @@ -106,6 +129,24 @@ abstract class BalanceViewModelBase with Store { @computed CryptoCurrency get currency => appStore.wallet.currency; + @action + void _onWalletChange(WalletBase wallet) { + this.wallet = wallet; + + if (wallet is MoneroWallet) { + moneroBalance = wallet.balance; + + _onMoneroBalanceChangeReaction?.reaction?.dispose(); + + _onMoneroBalanceChangeReaction = reaction((_) => wallet.balance, + (MoneroBalance balance) => moneroBalance = balance); + } + } + + ReactionDisposer _onMoneroBalanceChangeReaction; + + ReactionDisposer _reaction; + String _getFiatBalance({double price, String cryptoAmount}) { if (cryptoAmount == null) { return '0.00'; From 837f639129b31741baea3126c33de1386c55c4ec Mon Sep 17 00:00:00 2001 From: OleksandrSobol Date: Fri, 18 Dec 2020 14:42:53 +0200 Subject: [PATCH 02/39] CAKE-216 | added trade_details_view_model.dart to the app; applied TradeDetailsViewModel to the trade_details_page.dart; added _updateItems() method to the exchange_trade_view_model.dart; reworked content in the exchange_trade_page.dart --- lib/di.dart | 8 ++ lib/router.dart | 3 +- .../exchange_trade/exchange_trade_page.dart | 36 ++---- .../trade_details/trade_details_page.dart | 44 ++------ .../exchange/exchange_trade_view_model.dart | 34 ++++-- lib/view_model/trade_details_view_model.dart | 105 ++++++++++++++++++ 6 files changed, 151 insertions(+), 79 deletions(-) create mode 100644 lib/view_model/trade_details_view_model.dart diff --git a/lib/di.dart b/lib/di.dart index fd73da8fc..4dc9a0f2f 100644 --- a/lib/di.dart +++ b/lib/di.dart @@ -27,6 +27,7 @@ import 'package:cake_wallet/src/screens/send/send_template_page.dart'; import 'package:cake_wallet/src/screens/settings/change_language.dart'; import 'package:cake_wallet/src/screens/settings/settings.dart'; import 'package:cake_wallet/src/screens/setup_pin_code/setup_pin_code.dart'; +import 'package:cake_wallet/src/screens/trade_details/trade_details_page.dart'; import 'package:cake_wallet/src/screens/transaction_details/transaction_details_page.dart'; import 'package:cake_wallet/src/screens/wallet_keys/wallet_keys_page.dart'; import 'package:cake_wallet/src/screens/exchange/exchange_page.dart'; @@ -54,6 +55,7 @@ import 'package:cake_wallet/view_model/node_list/node_list_view_model.dart'; import 'package:cake_wallet/view_model/node_list/node_create_or_edit_view_model.dart'; import 'package:cake_wallet/view_model/rescan_view_model.dart'; import 'package:cake_wallet/view_model/setup_pin_code_view_model.dart'; +import 'package:cake_wallet/view_model/trade_details_view_model.dart'; import 'package:cake_wallet/view_model/wallet_address_list/wallet_address_edit_or_create_view_model.dart'; import 'package:cake_wallet/view_model/auth_view_model.dart'; import 'package:cake_wallet/view_model/dashboard/dashboard_view_model.dart'; @@ -422,4 +424,10 @@ Future setup( transactionDescriptionBox)); getIt.registerFactory(() => PreSeedPage()); + + getIt.registerFactoryParam((trade, _) => + TradeDetailsViewModel(tradeForDetails: trade, trades: tradesSource)); + + getIt.registerFactoryParam((Trade trade, _) => + TradeDetailsPage(getIt.get(param1: trade))); } diff --git a/lib/router.dart b/lib/router.dart index ef38c97f8..3f2c1e420 100644 --- a/lib/router.dart +++ b/lib/router.dart @@ -293,7 +293,8 @@ Route createRoute(RouteSettings settings) { case Routes.tradeDetails: return MaterialPageRoute( - builder: (_) => TradeDetailsPage(settings.arguments as Trade)); + builder: (_) => + getIt.get(param1: settings.arguments as Trade)); case Routes.restoreWalletFromSeedDetails: final args = settings.arguments as List; diff --git a/lib/src/screens/exchange_trade/exchange_trade_page.dart b/lib/src/screens/exchange_trade/exchange_trade_page.dart index aced6304a..9e42f0ac1 100644 --- a/lib/src/screens/exchange_trade/exchange_trade_page.dart +++ b/lib/src/screens/exchange_trade/exchange_trade_page.dart @@ -172,36 +172,14 @@ class ExchangeTradeState extends State { ), itemBuilder: (context, index) { final item = widget.exchangeTradeViewModel.items[index]; - String value; + final value = item.data ?? fetchingLabel; - final content = Observer(builder: (_) { - switch (index) { - case 0: - value = - '${widget.exchangeTradeViewModel.trade.id ?? fetchingLabel}'; - break; - case 1: - value = - '${widget.exchangeTradeViewModel.trade.amount ?? fetchingLabel}'; - break; - case 2: - value = - '${widget.exchangeTradeViewModel.trade.state ?? fetchingLabel}'; - break; - case 3: - value = widget.exchangeTradeViewModel.trade - .inputAddress ?? - fetchingLabel; - break; - } - - return StandartListRow( - title: item.title, - value: value, - valueFontSize: 14, - image: item.isCopied ? copyImage : null, - ); - }); + final content = StandartListRow( + title: item.title, + value: value, + valueFontSize: 14, + image: item.isCopied ? copyImage : null, + ); return item.isCopied ? Builder( diff --git a/lib/src/screens/trade_details/trade_details_page.dart b/lib/src/screens/trade_details/trade_details_page.dart index 30b29d115..f108e85bd 100644 --- a/lib/src/screens/trade_details/trade_details_page.dart +++ b/lib/src/screens/trade_details/trade_details_page.dart @@ -1,51 +1,20 @@ import 'package:cake_wallet/utils/show_bar.dart'; +import 'package:cake_wallet/view_model/trade_details_view_model.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:cake_wallet/exchange/trade.dart'; import 'package:cake_wallet/generated/i18n.dart'; -import 'package:cake_wallet/utils/date_formatter.dart'; import 'package:cake_wallet/src/screens/base_page.dart'; -import 'package:cake_wallet/src/screens/transaction_details/standart_list_item.dart'; import 'package:cake_wallet/src/widgets/standart_list_row.dart'; class TradeDetailsPage extends BasePage { - TradeDetailsPage(this.trade) : _items = [] { - final dateFormat = DateFormatter.withCurrentLocal(); - _items.addAll([ - StandartListItem(title: S.current.trade_details_id, value: trade.id), - StandartListItem( - title: S.current.trade_details_state, - value: trade.state != null - ? trade.state.toString() - : S.current.trade_details_fetching) - ]); - - if (trade.provider != null) { - _items.add(StandartListItem( - title: S.current.trade_details_provider, - value: trade.provider.toString())); - } - - if (trade.createdAt != null) { - _items.add(StandartListItem( - title: S.current.trade_details_created_at, - value: dateFormat.format(trade.createdAt).toString())); - } - - if (trade.from != null && trade.to != null) { - _items.add(StandartListItem( - title: S.current.trade_details_pair, - value: '${trade.from.toString()} → ${trade.to.toString()}')); - } - } + TradeDetailsPage(this.tradeDetailsViewModel); @override String get title => S.current.trade_details_title; - final Trade trade; - final List _items; + final TradeDetailsViewModel tradeDetailsViewModel; @override Widget body(BuildContext context) { @@ -61,10 +30,11 @@ class TradeDetailsPage extends BasePage { .primaryTextTheme .title .backgroundColor)), - itemCount: _items.length, + itemCount: tradeDetailsViewModel.items.length, itemBuilder: (BuildContext context, int index) { - final item = _items[index]; - final isDrawBottom = index == _items.length - 1 ? true : false; + final item = tradeDetailsViewModel.items[index]; + final isDrawBottom = + index == tradeDetailsViewModel.items.length - 1 ? true : false; return GestureDetector( onTap: () { diff --git a/lib/view_model/exchange/exchange_trade_view_model.dart b/lib/view_model/exchange/exchange_trade_view_model.dart index dedb2c559..100445bc0 100644 --- a/lib/view_model/exchange/exchange_trade_view_model.dart +++ b/lib/view_model/exchange/exchange_trade_view_model.dart @@ -39,20 +39,11 @@ abstract class ExchangeTradeViewModelBase with Store { } items = ObservableList(); - items.addAll([ - ExchangeTradeItem( - title: S.current.id, data: '${trade.id}', isCopied: true), - ExchangeTradeItem( - title: S.current.amount, data: '${trade.amount}', isCopied: false), - ExchangeTradeItem( - title: S.current.status, data: '${trade.state}', isCopied: false), - ExchangeTradeItem( - title: S.current.widgets_address + ':', - data: trade.inputAddress, - isCopied: true), - ]); + + _updateItems(); _updateTrade(); + _timer = Timer.periodic(Duration(seconds: 20), (_) async => _updateTrade()); } @@ -95,8 +86,27 @@ abstract class ExchangeTradeViewModelBase with Store { } trade = updatedTrade; + + _updateItems(); } catch (e) { print(e.toString()); } } + + void _updateItems() { + items?.clear(); + + items.addAll([ + ExchangeTradeItem( + title: S.current.id, data: '${trade.id}', isCopied: true), + ExchangeTradeItem( + title: S.current.amount, data: '${trade.amount}', isCopied: false), + ExchangeTradeItem( + title: S.current.status, data: '${trade.state}', isCopied: false), + ExchangeTradeItem( + title: S.current.widgets_address + ':', + data: trade.inputAddress, + isCopied: true), + ]); + } } diff --git a/lib/view_model/trade_details_view_model.dart b/lib/view_model/trade_details_view_model.dart new file mode 100644 index 000000000..63cb5f323 --- /dev/null +++ b/lib/view_model/trade_details_view_model.dart @@ -0,0 +1,105 @@ +import 'dart:async'; +import 'package:cake_wallet/exchange/changenow/changenow_exchange_provider.dart'; +import 'package:cake_wallet/exchange/exchange_provider.dart'; +import 'package:cake_wallet/exchange/exchange_provider_description.dart'; +import 'package:cake_wallet/exchange/morphtoken/morphtoken_exchange_provider.dart'; +import 'package:cake_wallet/exchange/trade.dart'; +import 'package:cake_wallet/exchange/xmrto/xmrto_exchange_provider.dart'; +import 'package:cake_wallet/utils/date_formatter.dart'; +import 'package:hive/hive.dart'; +import 'package:mobx/mobx.dart'; +import 'package:cake_wallet/generated/i18n.dart'; +import 'package:cake_wallet/src/screens/transaction_details/standart_list_item.dart'; + +part 'trade_details_view_model.g.dart'; + +class TradeDetailsViewModel = TradeDetailsViewModelBase + with _$TradeDetailsViewModel; + +abstract class TradeDetailsViewModelBase with Store { + TradeDetailsViewModelBase({Trade tradeForDetails, this.trades}) { + trade = tradeForDetails; + + switch (trade.provider) { + case ExchangeProviderDescription.xmrto: + _provider = XMRTOExchangeProvider(); + break; + case ExchangeProviderDescription.changeNow: + _provider = ChangeNowExchangeProvider(); + break; + case ExchangeProviderDescription.morphToken: + _provider = MorphTokenExchangeProvider(trades: trades); + break; + } + + items = ObservableList(); + + _updateItems(); + + _updateTrade(); + + _timer = Timer.periodic(Duration(seconds: 20), (_) async => _updateTrade()); + } + + final Box trades; + + @observable + Trade trade; + + @observable + ObservableList items; + + ExchangeProvider _provider; + + Timer _timer; + + @action + Future _updateTrade() async { + try { + final updatedTrade = await _provider.findTradeById(id: trade.id); + + if (updatedTrade.createdAt == null && trade.createdAt != null) { + updatedTrade.createdAt = trade.createdAt; + } + + trade = updatedTrade; + + _updateItems(); + } catch (e) { + print(e.toString()); + } + } + + void _updateItems() { + final dateFormat = DateFormatter.withCurrentLocal(); + + items?.clear(); + + items.addAll([ + StandartListItem(title: S.current.trade_details_id, value: trade.id), + StandartListItem( + title: S.current.trade_details_state, + value: trade.state != null + ? trade.state.toString() + : S.current.trade_details_fetching) + ]); + + if (trade.provider != null) { + items.add(StandartListItem( + title: S.current.trade_details_provider, + value: trade.provider.toString())); + } + + if (trade.createdAt != null) { + items.add(StandartListItem( + title: S.current.trade_details_created_at, + value: dateFormat.format(trade.createdAt).toString())); + } + + if (trade.from != null && trade.to != null) { + items.add(StandartListItem( + title: S.current.trade_details_pair, + value: '${trade.from.toString()} → ${trade.to.toString()}')); + } + } +} \ No newline at end of file From b1e0bf0edd56ce364eec325cdd30c75fe71c449f Mon Sep 17 00:00:00 2001 From: OleksandrSobol Date: Fri, 18 Dec 2020 21:42:00 +0200 Subject: [PATCH 03/39] CAKE-208 | merged 4.1.0 branch into current and resolved problems --- lib/store/settings_store.dart | 10 +++++----- lib/view_model/dashboard/balance_view_model.dart | 4 ++-- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/lib/store/settings_store.dart b/lib/store/settings_store.dart index f4c80b883..cc8f8acce 100644 --- a/lib/store/settings_store.dart +++ b/lib/store/settings_store.dart @@ -85,14 +85,14 @@ abstract class SettingsStoreBase with Store { (String languageCode) => sharedPreferences.setString( PreferencesKey.currentLanguageCode, languageCode)); + reaction((_) => balanceDisplayMode, + (BalanceDisplayMode mode) => sharedPreferences.setInt( + PreferencesKey.currentBalanceDisplayModeKey, + mode.serialize())); + this .nodes .observe((change) => _saveCurrentNode(change.newValue, change.key)); - - reaction((_) => balanceDisplayMode, - (BalanceDisplayMode mode) => sharedPreferences.setInt( - PreferencesKey.currentBalanceDisplayModeKey, - mode.serialize())); } static const defaultPinLength = 4; diff --git a/lib/view_model/dashboard/balance_view_model.dart b/lib/view_model/dashboard/balance_view_model.dart index 66d719771..a7bc575bd 100644 --- a/lib/view_model/dashboard/balance_view_model.dart +++ b/lib/view_model/dashboard/balance_view_model.dart @@ -20,8 +20,8 @@ abstract class BalanceViewModelBase with Store { BalanceViewModelBase( {@required this.appStore, @required this.settingsStore, - @required this.fiatConvertationStore}){ - + @required this.fiatConvertationStore + }){ isReversing = false; wallet ??= appStore.wallet; From 8067c07e9410ae13561f2b8d8930906a3ece226f Mon Sep 17 00:00:00 2001 From: M Date: Mon, 21 Dec 2020 22:21:41 +0200 Subject: [PATCH 04/39] Changed iOS project version to 4.1.0 (9). --- ios/Runner.xcodeproj/project.pbxproj | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/ios/Runner.xcodeproj/project.pbxproj b/ios/Runner.xcodeproj/project.pbxproj index ab6767c8d..b89f48572 100644 --- a/ios/Runner.xcodeproj/project.pbxproj +++ b/ios/Runner.xcodeproj/project.pbxproj @@ -354,7 +354,7 @@ buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CLANG_ENABLE_MODULES = YES; - CURRENT_PROJECT_VERSION = 7; + CURRENT_PROJECT_VERSION = 9; DEVELOPMENT_TEAM = 32J6BB6VUS; ENABLE_BITCODE = NO; FRAMEWORK_SEARCH_PATHS = ( @@ -494,7 +494,7 @@ buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CLANG_ENABLE_MODULES = YES; - CURRENT_PROJECT_VERSION = 7; + CURRENT_PROJECT_VERSION = 9; DEVELOPMENT_TEAM = 32J6BB6VUS; ENABLE_BITCODE = NO; FRAMEWORK_SEARCH_PATHS = ( @@ -528,7 +528,7 @@ buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CLANG_ENABLE_MODULES = YES; - CURRENT_PROJECT_VERSION = 7; + CURRENT_PROJECT_VERSION = 9; DEVELOPMENT_TEAM = 32J6BB6VUS; ENABLE_BITCODE = NO; FRAMEWORK_SEARCH_PATHS = ( From 023336d46026d88db5add907797eba02038eef66 Mon Sep 17 00:00:00 2001 From: OleksandrSobol Date: Tue, 22 Dec 2020 20:42:30 +0200 Subject: [PATCH 05/39] CAKE-198 | applied ability to make a note with some details about transaction; added transactionNote property and note getter to transaction_description.dart; added multiline textfield for notes (send_page.dart); added transaction_details_list_item.dart, textfield_list_item.dart, textfield_list_row.dart, transaction_details_view_model.dart to the app --- lib/di.dart | 13 +- lib/entities/transaction_description.dart | 7 +- lib/src/screens/send/send_page.dart | 40 ++++++ .../standart_list_item.dart | 8 +- .../textfield_list_item.dart | 8 ++ .../transaction_details_list_item.dart | 6 + .../transaction_details_page.dart | 119 +++++------------- .../widgets/textfield_list_row.dart | 91 ++++++++++++++ lib/src/widgets/base_text_form_field.dart | 2 +- lib/view_model/send/send_view_model.dart | 8 +- .../transaction_details_view_model.dart | 105 ++++++++++++++++ 11 files changed, 312 insertions(+), 95 deletions(-) create mode 100644 lib/src/screens/transaction_details/textfield_list_item.dart create mode 100644 lib/src/screens/transaction_details/transaction_details_list_item.dart create mode 100644 lib/src/screens/transaction_details/widgets/textfield_list_row.dart create mode 100644 lib/view_model/transaction_details_view_model.dart diff --git a/lib/di.dart b/lib/di.dart index 12828300d..e08748171 100644 --- a/lib/di.dart +++ b/lib/di.dart @@ -55,6 +55,7 @@ import 'package:cake_wallet/view_model/node_list/node_list_view_model.dart'; import 'package:cake_wallet/view_model/node_list/node_create_or_edit_view_model.dart'; import 'package:cake_wallet/view_model/rescan_view_model.dart'; import 'package:cake_wallet/view_model/setup_pin_code_view_model.dart'; +import 'package:cake_wallet/view_model/transaction_details_view_model.dart'; import 'package:cake_wallet/view_model/wallet_address_list/wallet_address_edit_or_create_view_model.dart'; import 'package:cake_wallet/view_model/auth_view_model.dart'; import 'package:cake_wallet/view_model/dashboard/dashboard_view_model.dart'; @@ -415,11 +416,17 @@ Future setup( getIt.registerFactoryParam((type, _) => WalletRestorePage(getIt.get(param1: type))); + getIt.registerFactoryParam + ((TransactionInfo transactionInfo, _) => TransactionDetailsViewModel( + transactionInfo: transactionInfo, + transactionDescriptionBox: transactionDescriptionBox, + settingsStore: getIt.get() + )); + getIt.registerFactoryParam( (TransactionInfo transactionInfo, _) => TransactionDetailsPage( - transactionInfo, - getIt.get().shouldSaveRecipientAddress, - transactionDescriptionBox)); + transactionDetailsViewModel: getIt + .get(param1: transactionInfo))); getIt.registerFactoryParam( diff --git a/lib/entities/transaction_description.dart b/lib/entities/transaction_description.dart index 3f817fe4f..65f9d4263 100644 --- a/lib/entities/transaction_description.dart +++ b/lib/entities/transaction_description.dart @@ -4,7 +4,7 @@ part 'transaction_description.g.dart'; @HiveType(typeId: 2) class TransactionDescription extends HiveObject { - TransactionDescription({this.id, this.recipientAddress}); + TransactionDescription({this.id, this.recipientAddress, this.transactionNote}); static const boxName = 'TransactionDescriptions'; static const boxKey = 'transactionDescriptionsBoxKey'; @@ -14,4 +14,9 @@ class TransactionDescription extends HiveObject { @HiveField(1) String recipientAddress; + + @HiveField(2) + String transactionNote; + + String get note => transactionNote ?? ''; } diff --git a/lib/src/screens/send/send_page.dart b/lib/src/screens/send/send_page.dart index 1a18b5ba6..db943148d 100644 --- a/lib/src/screens/send/send_page.dart +++ b/lib/src/screens/send/send_page.dart @@ -31,6 +31,7 @@ class SendPage extends BasePage { : _addressController = TextEditingController(), _cryptoAmountController = TextEditingController(), _fiatAmountController = TextEditingController(), + _noteController = TextEditingController(), _formKey = GlobalKey(), _cryptoAmountFocus = FocusNode(), _fiatAmountFocus = FocusNode(), @@ -46,6 +47,7 @@ class SendPage extends BasePage { final TextEditingController _addressController; final TextEditingController _cryptoAmountController; final TextEditingController _fiatAmountController; + final TextEditingController _noteController; final GlobalKey _formKey; final FocusNode _cryptoAmountFocus; final FocusNode _fiatAmountFocus; @@ -304,6 +306,30 @@ class SendPage extends BasePage { fontWeight: FontWeight.w500, fontSize: 14), )), + Padding( + padding: EdgeInsets.only(top: 20), + child: BaseTextFormField( + controller: _noteController, + keyboardType: TextInputType.multiline, + maxLines: null, + borderColor: Theme.of(context) + .primaryTextTheme + .headline + .color, + textStyle: TextStyle( + fontSize: 14, + fontWeight: FontWeight.w500, + color: Colors.white), + hintText: 'Note (optional)', + placeholderTextStyle: TextStyle( + fontSize: 14, + fontWeight: FontWeight.w500, + color: Theme.of(context) + .primaryTextTheme + .headline + .decorationColor), + ), + ), Observer( builder: (_) => GestureDetector( onTap: () => @@ -534,6 +560,14 @@ class SendPage extends BasePage { } }); + _noteController.addListener(() { + final note = _noteController.text ?? ''; + + if (note != sendViewModel.note) { + sendViewModel.note = note; + } + }); + reaction((_) => sendViewModel.sendAll, (bool all) { if (all) { _cryptoAmountController.text = S.current.all; @@ -571,6 +605,12 @@ class SendPage extends BasePage { } }); + reaction((_) => sendViewModel.note, (String note) { + if (note != _noteController.text) { + _noteController.text = note; + } + }); + reaction((_) => sendViewModel.state, (ExecutionState state) { if (state is FailureState) { WidgetsBinding.instance.addPostFrameCallback((_) { diff --git a/lib/src/screens/transaction_details/standart_list_item.dart b/lib/src/screens/transaction_details/standart_list_item.dart index 9cf23eeb5..728ec5cc0 100644 --- a/lib/src/screens/transaction_details/standart_list_item.dart +++ b/lib/src/screens/transaction_details/standart_list_item.dart @@ -1,6 +1,6 @@ -class StandartListItem { - StandartListItem({this.title, this.value}); +import 'package:cake_wallet/src/screens/transaction_details/transaction_details_list_item.dart'; - final String title; - final String value; +class StandartListItem extends TransactionDetailsListItem { + StandartListItem({String title, String value}) + : super(title: title, value: value); } diff --git a/lib/src/screens/transaction_details/textfield_list_item.dart b/lib/src/screens/transaction_details/textfield_list_item.dart new file mode 100644 index 000000000..2bc6010c0 --- /dev/null +++ b/lib/src/screens/transaction_details/textfield_list_item.dart @@ -0,0 +1,8 @@ +import 'package:cake_wallet/src/screens/transaction_details/transaction_details_list_item.dart'; + +class TextFieldListItem extends TransactionDetailsListItem { + TextFieldListItem({String title, String value, this.onSubmitted}) + : super(title: title, value: value); + + final Function(String value) onSubmitted; +} \ No newline at end of file diff --git a/lib/src/screens/transaction_details/transaction_details_list_item.dart b/lib/src/screens/transaction_details/transaction_details_list_item.dart new file mode 100644 index 000000000..3f666ea34 --- /dev/null +++ b/lib/src/screens/transaction_details/transaction_details_list_item.dart @@ -0,0 +1,6 @@ +abstract class TransactionDetailsListItem { + TransactionDetailsListItem({this.title, this.value}); + + final String title; + final String value; +} \ No newline at end of file diff --git a/lib/src/screens/transaction_details/transaction_details_page.dart b/lib/src/screens/transaction_details/transaction_details_page.dart index 3a7c7e591..a0e1b3c7a 100644 --- a/lib/src/screens/transaction_details/transaction_details_page.dart +++ b/lib/src/screens/transaction_details/transaction_details_page.dart @@ -1,87 +1,21 @@ -import 'package:cake_wallet/entities/transaction_description.dart'; +import 'package:cake_wallet/src/screens/transaction_details/textfield_list_item.dart'; +import 'package:cake_wallet/src/screens/transaction_details/widgets/textfield_list_row.dart'; import 'package:cake_wallet/utils/show_bar.dart'; +import 'package:cake_wallet/view_model/transaction_details_view_model.dart'; import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; import 'package:cake_wallet/generated/i18n.dart'; -import 'package:cake_wallet/bitcoin/bitcoin_transaction_info.dart'; -import 'package:cake_wallet/monero/monero_transaction_info.dart'; -import 'package:cake_wallet/entities/transaction_info.dart'; import 'package:cake_wallet/src/widgets/standart_list_row.dart'; import 'package:cake_wallet/src/screens/transaction_details/standart_list_item.dart'; import 'package:cake_wallet/src/screens/base_page.dart'; -import 'package:cake_wallet/utils/date_formatter.dart'; -import 'package:hive/hive.dart'; class TransactionDetailsPage extends BasePage { - TransactionDetailsPage(this.transactionInfo, bool showRecipientAddress, - Box transactionDescriptionBox) - : _items = [] { - final dateFormat = DateFormatter.withCurrentLocal(); - final tx = transactionInfo; - - if (tx is MoneroTransactionInfo) { - final items = [ - StandartListItem( - title: S.current.transaction_details_transaction_id, value: tx.id), - StandartListItem( - title: S.current.transaction_details_date, - value: dateFormat.format(tx.date)), - StandartListItem( - title: S.current.transaction_details_height, value: '${tx.height}'), - StandartListItem( - title: S.current.transaction_details_amount, - value: tx.amountFormatted()), - StandartListItem(title: S.current.send_fee, value: tx.feeFormatted()) - ]; - - if (tx.key?.isNotEmpty ?? null) { - // FIXME: add translation - items.add(StandartListItem(title: 'Transaction Key', value: tx.key)); - } - - _items.addAll(items); - } - - if (tx is BitcoinTransactionInfo) { - final items = [ - StandartListItem( - title: S.current.transaction_details_transaction_id, value: tx.id), - StandartListItem( - title: S.current.transaction_details_date, - value: dateFormat.format(tx.date)), - StandartListItem( - title: 'Confirmations', value: tx.confirmations?.toString()), - StandartListItem( - title: S.current.transaction_details_height, value: '${tx.height}'), - StandartListItem( - title: S.current.transaction_details_amount, - value: tx.amountFormatted()), - if (tx.feeFormatted()?.isNotEmpty) - StandartListItem(title: S.current.send_fee, value: tx.feeFormatted()) - ]; - - _items.addAll(items); - } - - if (showRecipientAddress) { - final recipientAddress = transactionDescriptionBox.values - .firstWhere((val) => val.id == transactionInfo.id, orElse: () => null) - ?.recipientAddress; - - if (recipientAddress?.isNotEmpty ?? false) { - _items.add(StandartListItem( - title: S.current.transaction_details_recipient_address, - value: recipientAddress)); - } - } - } + TransactionDetailsPage({this.transactionDetailsViewModel}); @override String get title => S.current.transaction_details_title; - final TransactionInfo transactionInfo; - - final List _items; + final TransactionDetailsViewModel transactionDetailsViewModel; @override Widget body(BuildContext context) { @@ -97,22 +31,37 @@ class TransactionDetailsPage extends BasePage { Theme.of(context).primaryTextTheme.title.backgroundColor, ), ), - itemCount: _items.length, + itemCount: transactionDetailsViewModel.items.length, itemBuilder: (context, index) { - final item = _items[index]; - final isDrawBottom = index == _items.length - 1 ? true : false; + final item = transactionDetailsViewModel.items[index]; + final isDrawBottom = + index == transactionDetailsViewModel.items.length - 1 + ? true : false; - return GestureDetector( - onTap: () { - Clipboard.setData(ClipboardData(text: item.value)); - showBar(context, - S.of(context).transaction_details_copied(item.title)); - }, - child: StandartListRow( - title: '${item.title}:', - value: item.value, - isDrawBottom: isDrawBottom), - ); + if (item is StandartListItem) { + return GestureDetector( + onTap: () { + Clipboard.setData(ClipboardData(text: item.value)); + showBar(context, + S.of(context).transaction_details_copied(item.title)); + }, + child: StandartListRow( + title: '${item.title}:', + value: item.value, + isDrawBottom: isDrawBottom), + ); + } + + if (item is TextFieldListItem) { + return TextFieldListRow( + title: item.title, + value: item.value, + onSubmitted: item.onSubmitted, + isDrawBottom: isDrawBottom, + ); + } + + return null; }), ); } diff --git a/lib/src/screens/transaction_details/widgets/textfield_list_row.dart b/lib/src/screens/transaction_details/widgets/textfield_list_row.dart new file mode 100644 index 000000000..3f2f2d877 --- /dev/null +++ b/lib/src/screens/transaction_details/widgets/textfield_list_row.dart @@ -0,0 +1,91 @@ +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; + +class TextFieldListRow extends StatelessWidget { + TextFieldListRow( + {this.title, + this.value, + this.titleFontSize = 14, + this.valueFontSize = 16, + this.onSubmitted, + this.isDrawBottom = false}) { + + _textController = TextEditingController(); + _textController.text = value; + } + + final String title; + final String value; + final double titleFontSize; + final double valueFontSize; + final Function(String value) onSubmitted; + final bool isDrawBottom; + + TextEditingController _textController; + + @override + Widget build(BuildContext context) { + return Column( + children: [ + Container( + width: double.infinity, + color: Theme.of(context).backgroundColor, + child: Padding( + padding: + const EdgeInsets.only(left: 24, top: 16, bottom: 16, right: 24), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text(title, + style: TextStyle( + fontSize: titleFontSize, + fontWeight: FontWeight.w500, + color: + Theme.of(context).primaryTextTheme.overline.color), + textAlign: TextAlign.left), + TextField( + controller: _textController, + keyboardType: TextInputType.multiline, + textInputAction: TextInputAction.done, + maxLines: null, + textAlign: TextAlign.start, + style: TextStyle( + fontSize: valueFontSize, + fontWeight: FontWeight.w500, + color: Theme.of(context) + .primaryTextTheme + .title + .color), + decoration: InputDecoration( + isDense: true, + contentPadding: EdgeInsets.only(top: 12, bottom: 0), + hintText: 'Note', + hintStyle: TextStyle( + fontSize: valueFontSize, + fontWeight: FontWeight.w500, + color: Theme.of(context) + .primaryTextTheme + .title + .color), + border: InputBorder.none + ), + onSubmitted: (value) => onSubmitted.call(value), + ) + ]), + ), + ), + isDrawBottom + ? Container( + height: 1, + padding: EdgeInsets.only(left: 24), + color: Theme.of(context).backgroundColor, + child: Container( + height: 1, + color: Theme.of(context).primaryTextTheme.title.backgroundColor, + ), + ) + : Offstage(), + ], + ); + } +} diff --git a/lib/src/widgets/base_text_form_field.dart b/lib/src/widgets/base_text_form_field.dart index 2c296df25..b9148bf2c 100644 --- a/lib/src/widgets/base_text_form_field.dart +++ b/lib/src/widgets/base_text_form_field.dart @@ -51,7 +51,7 @@ class BaseTextFormField extends StatelessWidget { final FocusNode focusNode; final bool readOnly; final bool enableInteractiveSelection; - String initialValue; + final String initialValue; @override Widget build(BuildContext context) { diff --git a/lib/view_model/send/send_view_model.dart b/lib/view_model/send/send_view_model.dart index f3d46ccb3..c56230c59 100644 --- a/lib/view_model/send/send_view_model.dart +++ b/lib/view_model/send/send_view_model.dart @@ -37,6 +37,7 @@ abstract class SendViewModelBase with Store { this._fiatConversationStore, this.transactionDescriptionBox) : state = InitialExecutionState(), _cryptoNumberFormat = NumberFormat(), + note = '', sendAll = false { _setCryptoNumMaximumFractionDigits(); } @@ -53,6 +54,9 @@ abstract class SendViewModelBase with Store { @observable String address; + @observable + String note; + @observable bool sendAll; @@ -105,6 +109,7 @@ abstract class SendViewModelBase with Store { cryptoAmount = ''; fiatAmount = ''; address = ''; + note = ''; } @action @@ -127,7 +132,8 @@ abstract class SendViewModelBase with Store { if (_settingsStore.shouldSaveRecipientAddress && (pendingTransaction.id?.isNotEmpty ?? false)) { await transactionDescriptionBox.add(TransactionDescription( - id: pendingTransaction.id, recipientAddress: address)); + id: pendingTransaction.id, recipientAddress: address, + transactionNote: note)); } state = TransactionCommitted(); diff --git a/lib/view_model/transaction_details_view_model.dart b/lib/view_model/transaction_details_view_model.dart new file mode 100644 index 000000000..e3f57c9a3 --- /dev/null +++ b/lib/view_model/transaction_details_view_model.dart @@ -0,0 +1,105 @@ +import 'package:cake_wallet/bitcoin/bitcoin_transaction_info.dart'; +import 'package:cake_wallet/entities/transaction_info.dart'; +import 'package:cake_wallet/monero/monero_transaction_info.dart'; +import 'package:cake_wallet/src/screens/transaction_details/standart_list_item.dart'; +import 'package:cake_wallet/src/screens/transaction_details/textfield_list_item.dart'; +import 'package:cake_wallet/src/screens/transaction_details/transaction_details_list_item.dart'; +import 'package:cake_wallet/utils/date_formatter.dart'; +import 'package:cake_wallet/entities/transaction_description.dart'; +import 'package:hive/hive.dart'; +import 'package:mobx/mobx.dart'; +import 'package:cake_wallet/store/settings_store.dart'; +import 'package:cake_wallet/generated/i18n.dart'; + +part 'transaction_details_view_model.g.dart'; + +class TransactionDetailsViewModel = TransactionDetailsViewModelBase with _$TransactionDetailsViewModel; + +abstract class TransactionDetailsViewModelBase with Store { + TransactionDetailsViewModelBase({ + this.transactionInfo, + this.transactionDescriptionBox, + this.settingsStore}) : items = [] { + + showRecipientAddress = settingsStore?.shouldSaveRecipientAddress ?? false; + + final dateFormat = DateFormatter.withCurrentLocal(); + final tx = transactionInfo; + + if (tx is MoneroTransactionInfo) { + final _items = [ + StandartListItem( + title: S.current.transaction_details_transaction_id, value: tx.id), + StandartListItem( + title: S.current.transaction_details_date, + value: dateFormat.format(tx.date)), + StandartListItem( + title: S.current.transaction_details_height, value: '${tx.height}'), + StandartListItem( + title: S.current.transaction_details_amount, + value: tx.amountFormatted()), + StandartListItem(title: S.current.send_fee, value: tx.feeFormatted()), + ]; + + if (tx.key?.isNotEmpty ?? null) { + // FIXME: add translation + _items.add(StandartListItem(title: 'Transaction Key', value: tx.key)); + } + + items.addAll(_items); + } + + if (tx is BitcoinTransactionInfo) { + final _items = [ + StandartListItem( + title: S.current.transaction_details_transaction_id, value: tx.id), + StandartListItem( + title: S.current.transaction_details_date, + value: dateFormat.format(tx.date)), + // FIXME: add translation + StandartListItem( + title: 'Confirmations', value: tx.confirmations?.toString()), + StandartListItem( + title: S.current.transaction_details_height, value: '${tx.height}'), + StandartListItem( + title: S.current.transaction_details_amount, + value: tx.amountFormatted()), + if (tx.feeFormatted()?.isNotEmpty) + StandartListItem(title: S.current.send_fee, value: tx.feeFormatted()) + ]; + + items.addAll(_items); + } + + if (showRecipientAddress) { + final recipientAddress = transactionDescriptionBox.values + .firstWhere((val) => val.id == transactionInfo.id, orElse: () => null) + ?.recipientAddress; + + if (recipientAddress?.isNotEmpty ?? false) { + items.add(StandartListItem( + title: S.current.transaction_details_recipient_address, + value: recipientAddress)); + } + } + + final description = transactionDescriptionBox.values.firstWhere( + (val) => val.id == transactionInfo.id, orElse: () => null); + + if (description != null) { + // FIXME: add translation + items.add(TextFieldListItem(title: 'Note (tap to change)', + value: description.note, onSubmitted: (value) { + description.transactionNote = value; + description.save(); + })); + } + } + + final TransactionInfo transactionInfo; + final Box transactionDescriptionBox; + final SettingsStore settingsStore; + + final List items; + bool showRecipientAddress; +} \ No newline at end of file From 139f223de85ae1022738c88dbe8f89bec9f69b68 Mon Sep 17 00:00:00 2001 From: Oleksandr Sobol Date: Wed, 23 Dec 2020 10:39:59 +0200 Subject: [PATCH 06/39] CAKE-198 | fixed string resources --- lib/generated/i18n.dart | 161 +++++++++++++++--- .../exchange_trade/exchange_trade_page.dart | 6 +- lib/src/screens/send/send_page.dart | 6 +- .../widgets/textfield_list_row.dart | 3 +- .../transaction_details_view_model.dart | 15 +- res/values/strings_de.arb | 8 +- res/values/strings_en.arb | 8 +- res/values/strings_es.arb | 8 +- res/values/strings_hi.arb | 8 +- res/values/strings_ja.arb | 8 +- res/values/strings_ko.arb | 8 +- res/values/strings_nl.arb | 8 +- res/values/strings_pl.arb | 8 +- res/values/strings_pt.arb | 8 +- res/values/strings_ru.arb | 8 +- res/values/strings_uk.arb | 8 +- res/values/strings_zh.arb | 8 +- 17 files changed, 235 insertions(+), 52 deletions(-) diff --git a/lib/generated/i18n.dart b/lib/generated/i18n.dart index 2abfd2a18..be5d653c9 100644 --- a/lib/generated/i18n.dart +++ b/lib/generated/i18n.dart @@ -63,6 +63,7 @@ class S implements WidgetsLocalizations { String get confirm_delete_template => "This action will delete this template. Do you wish to continue?"; String get confirm_delete_wallet => "This action will delete this wallet. Do you wish to continue?"; String get confirm_sending => "Confirm sending"; + String get confirmations => "Confirmations"; String get contact => "Contact"; String get contact_name => "Contact Name"; String get continue_text => "Continue"; @@ -127,6 +128,9 @@ class S implements WidgetsLocalizations { String get node_test => "Test"; String get nodes => "Nodes"; String get nodes_list_reset_to_default_message => "Are you sure that you want to reset settings to default?"; + String get note => "Note"; + String get note_optional => "Note (optional)"; + String get note_tap_to_change => "Note (tap to change)"; String get offer_expires_in => "Offer expires in: "; String get ok => "OK"; String get openalias_alert_title => "XMR Recipient Detected"; @@ -212,13 +216,13 @@ class S implements WidgetsLocalizations { String get send_error_currency => "Currency can only contain numbers"; String get send_error_minimum_value => "Minimum value of amount is 0.01"; String get send_estimated_fee => "Estimated fee:"; - String get send_fee => "Fee"; + String get send_fee => "Fee:"; String get send_got_it => "Got it"; String get send_name => "Name"; String get send_new => "New"; String get send_payment_id => "Payment ID (optional)"; String get send_sending => "Sending..."; - String send_success(String crypto) => "Your ${crypto} was successfully sent"; + String get send_success => "Your Monero was successfully sent"; String get send_templates => "Templates"; String get send_title => "Send"; String get send_xmr => "Send XMR"; @@ -298,6 +302,7 @@ class S implements WidgetsLocalizations { String get transaction_details_recipient_address => "Recipient address"; String get transaction_details_title => "Transaction Details"; String get transaction_details_transaction_id => "Transaction ID"; + String get transaction_key => "Transaction Key"; String get transaction_priority_fast => "Fast"; String get transaction_priority_fastest => "Fastest"; String get transaction_priority_medium => "Medium"; @@ -402,7 +407,7 @@ class $de extends S { @override String get transaction_sent => "Transaktion gesendet!"; @override - String get send_fee => "Gebühr"; + String get send_fee => "Gebühr:"; @override String get password => "Passwort"; @override @@ -446,6 +451,8 @@ class $de extends S { @override String get placeholder_contacts => "Ihre Kontakte werden hier angezeigt"; @override + String get transaction_key => "Transaktionsschlüssel"; + @override String get card_address => "Adresse:"; @override String get seed_language_portuguese => "Portugiesisch"; @@ -518,6 +525,8 @@ class $de extends S { @override String get node_connection_successful => "Die Verbindung war erfolgreich"; @override + String get confirmations => "Bestätigungen"; + @override String get confirm => "Bestätigen"; @override String get settings_display_balance_as => "Kontostand anzeigen als"; @@ -554,6 +563,8 @@ class $de extends S { @override String get address_book_menu => "Adressbuch"; @override + String get note_optional => "Hinweis (optional)"; + @override String get wallet_restoration_store_incorrect_seed_length => "Falsche Samenlänge"; @override String get seed_language_spanish => "Spanisch"; @@ -642,7 +653,7 @@ class $de extends S { @override String get trade_details_created_at => "Hergestellt in"; @override - String send_success(String crypto) => "Ihr ${crypto} wurde erfolgreich gesendet"; + String get send_success => "Ihr Monero wurde erfolgreich gesendet"; @override String get settings_wallets => "Brieftaschen"; @override @@ -684,6 +695,8 @@ class $de extends S { @override String get transaction_details_date => "Datum"; @override + String get note_tap_to_change => "Hinweis (zum Ändern tippen)"; + @override String get show_seed => "Seed zeigen"; @override String get send_error_currency => "Die Währung kann nur Zahlen enthalten"; @@ -906,6 +919,8 @@ class $de extends S { @override String get settings_save_recipient_address => "Empfängeradresse speichern"; @override + String get note => "Hinweis"; + @override String get change_exchange_provider => "Wechseln Sie den Exchange-Anbieter"; @override String get send_payment_id => "Zahlungs ID (wahlweise)"; @@ -1146,6 +1161,8 @@ class $hi extends S { @override String get placeholder_contacts => "आपके संपर्क यहां प्रदर्शित होंगे"; @override + String get transaction_key => "लेन-देन की"; + @override String get card_address => "पता:"; @override String get seed_language_portuguese => "पुर्तगाली"; @@ -1218,6 +1235,8 @@ class $hi extends S { @override String get node_connection_successful => "कनेक्शन सफल रहा"; @override + String get confirmations => "पुष्टिकरण"; + @override String get confirm => "की पुष्टि करें"; @override String get settings_display_balance_as => "के रूप में संतुलन प्रदर्शित करें"; @@ -1254,6 +1273,8 @@ class $hi extends S { @override String get address_book_menu => "पता पुस्तिका"; @override + String get note_optional => "नोट (वैकल्पिक)"; + @override String get wallet_restoration_store_incorrect_seed_length => "गलत बीज की लंबाई"; @override String get seed_language_spanish => "स्पेनिश"; @@ -1342,7 +1363,7 @@ class $hi extends S { @override String get trade_details_created_at => "पर बनाया गया"; @override - String send_success(String crypto) => "आपका ${crypto} सफलतापूर्वक भेजा गया"; + String get send_success => "आपका Monero सफलतापूर्वक भेजा गया"; @override String get settings_wallets => "पर्स"; @override @@ -1384,6 +1405,8 @@ class $hi extends S { @override String get transaction_details_date => "तारीख"; @override + String get note_tap_to_change => "नोट (टैप टू चेंज)"; + @override String get show_seed => "बीज दिखाओ"; @override String get send_error_currency => "मुद्रा में केवल संख्याएँ हो सकती हैं"; @@ -1606,6 +1629,8 @@ class $hi extends S { @override String get settings_save_recipient_address => "प्राप्तकर्ता का पता सहेजें"; @override + String get note => "नोट"; + @override String get change_exchange_provider => "एक्सचेंज प्रदाता बदलें"; @override String get send_payment_id => "भुगतान ID (ऐच्छिक)"; @@ -1802,7 +1827,7 @@ class $ru extends S { @override String get transaction_sent => "Tранзакция отправлена!"; @override - String get send_fee => "Комиссия"; + String get send_fee => "Комиссия:"; @override String get password => "Пароль"; @override @@ -1846,6 +1871,8 @@ class $ru extends S { @override String get placeholder_contacts => "Ваши контакты будут отображаться здесь"; @override + String get transaction_key => "Ключ транзакции"; + @override String get card_address => "Адрес:"; @override String get seed_language_portuguese => "Португальский"; @@ -1918,6 +1945,8 @@ class $ru extends S { @override String get node_connection_successful => "Подключение прошло успешно"; @override + String get confirmations => "Подтверждения"; + @override String get confirm => "Подтвердить"; @override String get settings_display_balance_as => "Отображать баланс как"; @@ -1954,6 +1983,8 @@ class $ru extends S { @override String get address_book_menu => "Адресная книга"; @override + String get note_optional => "Примечание (необязательно)"; + @override String get wallet_restoration_store_incorrect_seed_length => "Неверная длина мнемонической фразы"; @override String get seed_language_spanish => "Испанский"; @@ -2042,7 +2073,7 @@ class $ru extends S { @override String get trade_details_created_at => "Создано"; @override - String send_success(String crypto) => "Ваш ${crypto} был успешно отправлен"; + String get send_success => "Ваш Monero был успешно отправлен"; @override String get settings_wallets => "Кошельки"; @override @@ -2084,6 +2115,8 @@ class $ru extends S { @override String get transaction_details_date => "Дата"; @override + String get note_tap_to_change => "Примечание (нажмите для изменения)"; + @override String get show_seed => "Показать мнемоническую фразу"; @override String get send_error_currency => "Валюта может содержать только цифры"; @@ -2306,6 +2339,8 @@ class $ru extends S { @override String get settings_save_recipient_address => "Сохранять адрес получателя"; @override + String get note => "Примечание"; + @override String get change_exchange_provider => "Изменить провайдера обмена"; @override String get send_payment_id => "ID платежа (опционально)"; @@ -2502,7 +2537,7 @@ class $ko extends S { @override String get transaction_sent => "거래가 전송되었습니다!"; @override - String get send_fee => "회비"; + String get send_fee => "회비:"; @override String get password => "암호"; @override @@ -2546,6 +2581,8 @@ class $ko extends S { @override String get placeholder_contacts => "연락처가 여기에 표시됩니다"; @override + String get transaction_key => "거래 키"; + @override String get card_address => "주소:"; @override String get seed_language_portuguese => "포르투갈 인"; @@ -2618,6 +2655,8 @@ class $ko extends S { @override String get node_connection_successful => "성공적으로 연결되었습니다."; @override + String get confirmations => "확인"; + @override String get confirm => "확인"; @override String get settings_display_balance_as => "잔액 표시"; @@ -2654,6 +2693,8 @@ class $ko extends S { @override String get address_book_menu => "주소록"; @override + String get note_optional => "참고 (선택 사항)"; + @override String get wallet_restoration_store_incorrect_seed_length => "시드 길이가 잘못되었습니다"; @override String get seed_language_spanish => "스페인의"; @@ -2742,7 +2783,7 @@ class $ko extends S { @override String get trade_details_created_at => "에 작성"; @override - String send_success(String crypto) => "${crypto}가 성공적으로 전송되었습니다"; + String get send_success => "Monero가 성공적으로 전송되었습니다"; @override String get settings_wallets => "지갑"; @override @@ -2784,6 +2825,8 @@ class $ko extends S { @override String get transaction_details_date => "날짜"; @override + String get note_tap_to_change => "메모 (변경하려면 탭하세요)"; + @override String get show_seed => "종자 표시"; @override String get send_error_currency => "통화는 숫자 만 포함 할 수 있습니다"; @@ -3006,6 +3049,8 @@ class $ko extends S { @override String get settings_save_recipient_address => "수신자 주소 저장"; @override + String get note => "노트"; + @override String get change_exchange_provider => "교환 공급자 변경"; @override String get send_payment_id => "지불 ID (optional)"; @@ -3202,7 +3247,7 @@ class $pt extends S { @override String get transaction_sent => "Transação enviada!"; @override - String get send_fee => "Taxa"; + String get send_fee => "Taxa:"; @override String get password => "Senha"; @override @@ -3246,6 +3291,8 @@ class $pt extends S { @override String get placeholder_contacts => "Seus contatos serão exibidos aqui"; @override + String get transaction_key => "Chave de transação"; + @override String get card_address => "Endereço:"; @override String get seed_language_portuguese => "Português"; @@ -3318,6 +3365,8 @@ class $pt extends S { @override String get node_connection_successful => "A conexão foi bem sucedida"; @override + String get confirmations => "Confirmações"; + @override String get confirm => "Confirmar"; @override String get settings_display_balance_as => "Saldo a exibir"; @@ -3354,6 +3403,8 @@ class $pt extends S { @override String get address_book_menu => "Livro de endereços"; @override + String get note_optional => "Nota (opcional)"; + @override String get wallet_restoration_store_incorrect_seed_length => "Comprimento de semente incorreto"; @override String get seed_language_spanish => "Espanhola"; @@ -3442,7 +3493,7 @@ class $pt extends S { @override String get trade_details_created_at => "Criada em"; @override - String send_success(String crypto) => "Seu ${crypto} foi enviado com sucesso"; + String get send_success => "Seu Monero foi enviado com sucesso"; @override String get settings_wallets => "Carteiras"; @override @@ -3484,6 +3535,8 @@ class $pt extends S { @override String get transaction_details_date => "Data"; @override + String get note_tap_to_change => "Nota (toque para alterar)"; + @override String get show_seed => "Mostrar semente"; @override String get send_error_currency => "A moeda só pode conter números"; @@ -3706,6 +3759,8 @@ class $pt extends S { @override String get settings_save_recipient_address => "Salvar endereço do destinatário"; @override + String get note => "Nota"; + @override String get change_exchange_provider => "Alterar o provedor de troca"; @override String get send_payment_id => "ID de pagamento (opcional)"; @@ -3902,7 +3957,7 @@ class $uk extends S { @override String get transaction_sent => "Tранзакцію відправлено!"; @override - String get send_fee => "Комісія"; + String get send_fee => "Комісія:"; @override String get password => "Пароль"; @override @@ -3946,6 +4001,8 @@ class $uk extends S { @override String get placeholder_contacts => "Тут будуть показані ваші контакти"; @override + String get transaction_key => "Ключ транзакції"; + @override String get card_address => "Адреса:"; @override String get seed_language_portuguese => "Португальська"; @@ -4018,6 +4075,8 @@ class $uk extends S { @override String get node_connection_successful => "З'єднання було успішним"; @override + String get confirmations => "Підтвердження"; + @override String get confirm => "Підтвердити"; @override String get settings_display_balance_as => "Відображати баланс як"; @@ -4054,6 +4113,8 @@ class $uk extends S { @override String get address_book_menu => "Адресна книга"; @override + String get note_optional => "Примітка (необов’язково)"; + @override String get wallet_restoration_store_incorrect_seed_length => "Невірна довжина мнемонічної фрази"; @override String get seed_language_spanish => "Іспанська"; @@ -4142,7 +4203,7 @@ class $uk extends S { @override String get trade_details_created_at => "Створено"; @override - String send_success(String crypto) => "Ваш ${crypto} успішно надісланий"; + String get send_success => "Ваш Monero успішно надісланий"; @override String get settings_wallets => "Гаманці"; @override @@ -4184,6 +4245,8 @@ class $uk extends S { @override String get transaction_details_date => "Дата"; @override + String get note_tap_to_change => "Примітка (натисніть для зміни)"; + @override String get show_seed => "Показати мнемонічну фразу"; @override String get send_error_currency => "Валюта може містити тільки цифри"; @@ -4406,6 +4469,8 @@ class $uk extends S { @override String get settings_save_recipient_address => "Зберігати адресу отримувача"; @override + String get note => "Примітка"; + @override String get change_exchange_provider => "Змінити провайдера обміну"; @override String get send_payment_id => "ID платежу (опційно)"; @@ -4602,7 +4667,7 @@ class $ja extends S { @override String get transaction_sent => "トランザクションが送信されました!"; @override - String get send_fee => "費用"; + String get send_fee => "費用:"; @override String get password => "パスワード"; @override @@ -4646,6 +4711,8 @@ class $ja extends S { @override String get placeholder_contacts => "連絡先はここに表示されます"; @override + String get transaction_key => "トランザクションキー"; + @override String get card_address => "住所:"; @override String get seed_language_portuguese => "ポルトガル語"; @@ -4718,6 +4785,8 @@ class $ja extends S { @override String get node_connection_successful => "接続に成功しました"; @override + String get confirmations => "確認"; + @override String get confirm => "確認する"; @override String get settings_display_balance_as => "残高を表示"; @@ -4754,6 +4823,8 @@ class $ja extends S { @override String get address_book_menu => "住所録"; @override + String get note_optional => "注(オプション)"; + @override String get wallet_restoration_store_incorrect_seed_length => "誤ったシード長s"; @override String get seed_language_spanish => "スペイン語"; @@ -4842,7 +4913,7 @@ class $ja extends S { @override String get trade_details_created_at => "で作成"; @override - String send_success(String crypto) => "${crypto}が送信されました"; + String get send_success => "Moneroが送信されました"; @override String get settings_wallets => "財布"; @override @@ -4884,6 +4955,8 @@ class $ja extends S { @override String get transaction_details_date => "日付"; @override + String get note_tap_to_change => "注(タップして変更)"; + @override String get show_seed => "シードを表示"; @override String get send_error_currency => "通貨には数字のみを含めることができます"; @@ -5106,6 +5179,8 @@ class $ja extends S { @override String get settings_save_recipient_address => "受信者のアドレスを保存"; @override + String get note => "注意"; + @override String get change_exchange_provider => "Exchangeプロバイダーの変更"; @override String get send_payment_id => "支払いID (オプショナル)"; @@ -5306,7 +5381,7 @@ class $pl extends S { @override String get transaction_sent => "Transakcja wysłana!"; @override - String get send_fee => "Opłata"; + String get send_fee => "Opłata:"; @override String get password => "Hasło"; @override @@ -5350,6 +5425,8 @@ class $pl extends S { @override String get placeholder_contacts => "Twoje kontakty zostaną wyświetlone tutaj"; @override + String get transaction_key => "Klucz transakcji"; + @override String get card_address => "Adres:"; @override String get seed_language_portuguese => "Portugalski"; @@ -5422,6 +5499,8 @@ class $pl extends S { @override String get node_connection_successful => "Połączenie powiodło się"; @override + String get confirmations => "Potwierdzenia"; + @override String get confirm => "Potwierdzać"; @override String get settings_display_balance_as => "Wyświetl saldo jako"; @@ -5458,6 +5537,8 @@ class $pl extends S { @override String get address_book_menu => "Książka adresowa"; @override + String get note_optional => "Notatka (opcjonalnie)"; + @override String get wallet_restoration_store_incorrect_seed_length => "Nieprawidłowa długość nasion"; @override String get seed_language_spanish => "Hiszpański"; @@ -5546,7 +5627,7 @@ class $pl extends S { @override String get trade_details_created_at => "Utworzono w"; @override - String send_success(String crypto) => "Twoje ${crypto} zostało pomyślnie wysłane"; + String get send_success => "Twoje Monero zostało pomyślnie wysłane"; @override String get settings_wallets => "Portfele"; @override @@ -5588,6 +5669,8 @@ class $pl extends S { @override String get transaction_details_date => "Data"; @override + String get note_tap_to_change => "Notatka (dotknij, aby zmienić)"; + @override String get show_seed => "Pokaż nasiona"; @override String get send_error_currency => "Waluta może zawierać tylko cyfry"; @@ -5810,6 +5893,8 @@ class $pl extends S { @override String get settings_save_recipient_address => "Zapisz adres odbiorcy"; @override + String get note => "Notatka"; + @override String get change_exchange_provider => "Zmień dostawcę programu Exchange"; @override String get send_payment_id => "Identyfikator płatności (opcjonalny)"; @@ -6006,7 +6091,7 @@ class $es extends S { @override String get transaction_sent => "Transacción enviada!"; @override - String get send_fee => "Cuota"; + String get send_fee => "Cuota:"; @override String get password => "Contraseña"; @override @@ -6050,6 +6135,8 @@ class $es extends S { @override String get placeholder_contacts => "Tus contactos se mostrarán aquí"; @override + String get transaction_key => "Clave de transacción"; + @override String get card_address => "Dirección:"; @override String get seed_language_portuguese => "Portugués"; @@ -6122,6 +6209,8 @@ class $es extends S { @override String get node_connection_successful => "La conexión fue exitosa"; @override + String get confirmations => "Confirmaciones"; + @override String get confirm => "Confirmar"; @override String get settings_display_balance_as => "Mostrar saldo como"; @@ -6158,6 +6247,8 @@ class $es extends S { @override String get address_book_menu => "Libreta de direcciones"; @override + String get note_optional => "Nota (opcional)"; + @override String get wallet_restoration_store_incorrect_seed_length => "Longitud de semilla incorrecta"; @override String get seed_language_spanish => "Español"; @@ -6246,7 +6337,7 @@ class $es extends S { @override String get trade_details_created_at => "Creado en"; @override - String send_success(String crypto) => "Su ${crypto} fue enviado con éxito"; + String get send_success => "Su Monero fue enviado con éxito"; @override String get settings_wallets => "Carteras"; @override @@ -6288,6 +6379,8 @@ class $es extends S { @override String get transaction_details_date => "Fecha"; @override + String get note_tap_to_change => "Nota (toque para cambiar)"; + @override String get show_seed => "Mostrar semilla"; @override String get send_error_currency => "La moneda solo puede contener números"; @@ -6510,6 +6603,8 @@ class $es extends S { @override String get settings_save_recipient_address => "Guardar dirección del destinatario"; @override + String get note => "Nota"; + @override String get change_exchange_provider => "Cambiar proveedor de intercambio"; @override String get send_payment_id => "ID de pago (opcional)"; @@ -6706,7 +6801,7 @@ class $nl extends S { @override String get transaction_sent => "Transactie verzonden!"; @override - String get send_fee => "Vergoeding"; + String get send_fee => "Vergoeding:"; @override String get password => "Wachtwoord"; @override @@ -6750,6 +6845,8 @@ class $nl extends S { @override String get placeholder_contacts => "Je contacten worden hier weergegeven"; @override + String get transaction_key => "Transactiesleutel"; + @override String get card_address => "Adres:"; @override String get seed_language_portuguese => "Portugees"; @@ -6822,6 +6919,8 @@ class $nl extends S { @override String get node_connection_successful => "Verbinding is gelukt"; @override + String get confirmations => "Bevestigingen"; + @override String get confirm => "Bevestigen"; @override String get settings_display_balance_as => "Toon saldo als"; @@ -6858,6 +6957,8 @@ class $nl extends S { @override String get address_book_menu => "Adresboek"; @override + String get note_optional => "Opmerking (optioneel)"; + @override String get wallet_restoration_store_incorrect_seed_length => "Onjuiste zaadlengte"; @override String get seed_language_spanish => "Spaans"; @@ -6946,7 +7047,7 @@ class $nl extends S { @override String get trade_details_created_at => "Gemaakt bij"; @override - String send_success(String crypto) => "Uw ${crypto} is succesvol verzonden"; + String get send_success => "Uw Monero is succesvol verzonden"; @override String get settings_wallets => "Portemonnee"; @override @@ -6988,6 +7089,8 @@ class $nl extends S { @override String get transaction_details_date => "Datum"; @override + String get note_tap_to_change => "Opmerking (tik om te wijzigen)"; + @override String get show_seed => "Toon zaad"; @override String get send_error_currency => "Valuta kan alleen cijfers bevatten"; @@ -7210,6 +7313,8 @@ class $nl extends S { @override String get settings_save_recipient_address => "Adres ontvanger opslaan"; @override + String get note => "Opmerking"; + @override String get change_exchange_provider => "Wijzig Exchange Provider"; @override String get send_payment_id => "Betaling ID (facultatief)"; @@ -7406,7 +7511,7 @@ class $zh extends S { @override String get transaction_sent => "交易已发送"; @override - String get send_fee => "費用"; + String get send_fee => "費用:"; @override String get password => "密码"; @override @@ -7450,6 +7555,8 @@ class $zh extends S { @override String get placeholder_contacts => "您的聯繫人將顯示在這裡"; @override + String get transaction_key => "交易密碼"; + @override String get card_address => "地址:"; @override String get seed_language_portuguese => "葡萄牙語"; @@ -7522,6 +7629,8 @@ class $zh extends S { @override String get node_connection_successful => "連接成功"; @override + String get confirmations => "確認書"; + @override String get confirm => "确认"; @override String get settings_display_balance_as => "将余额显示为"; @@ -7558,6 +7667,8 @@ class $zh extends S { @override String get address_book_menu => "地址簿"; @override + String get note_optional => "注意(可選)"; + @override String get wallet_restoration_store_incorrect_seed_length => "种子长度错误"; @override String get seed_language_spanish => "西班牙文"; @@ -7646,7 +7757,7 @@ class $zh extends S { @override String get trade_details_created_at => "创建于"; @override - String send_success(String crypto) => "你${crypto}已成功發送"; + String get send_success => "你Monero已成功發送"; @override String get settings_wallets => "皮夹"; @override @@ -7688,6 +7799,8 @@ class $zh extends S { @override String get transaction_details_date => "日期"; @override + String get note_tap_to_change => "注意(輕按即可更改)"; + @override String get show_seed => "显示种子"; @override String get send_error_currency => "货币只能包含数字"; @@ -7910,6 +8023,8 @@ class $zh extends S { @override String get settings_save_recipient_address => "保存收件人地址"; @override + String get note => "注意"; + @override String get change_exchange_provider => "更改交易所提供商"; @override String get send_payment_id => "付款编号 (可选的)"; diff --git a/lib/src/screens/exchange_trade/exchange_trade_page.dart b/lib/src/screens/exchange_trade/exchange_trade_page.dart index e43b8d8f1..64ff65972 100644 --- a/lib/src/screens/exchange_trade/exchange_trade_page.dart +++ b/lib/src/screens/exchange_trade/exchange_trade_page.dart @@ -305,11 +305,7 @@ class ExchangeTradeState extends State { padding: EdgeInsets.only( top: 220, left: 24, right: 24), child: Text( - S.of(context).send_success(widget - .exchangeTradeViewModel - .wallet - .currency - .toString()), + S.of(context).send_success, textAlign: TextAlign.center, style: TextStyle( fontSize: 22, diff --git a/lib/src/screens/send/send_page.dart b/lib/src/screens/send/send_page.dart index db943148d..54bfd4a24 100644 --- a/lib/src/screens/send/send_page.dart +++ b/lib/src/screens/send/send_page.dart @@ -320,7 +320,7 @@ class SendPage extends BasePage { fontSize: 14, fontWeight: FontWeight.w500, color: Colors.white), - hintText: 'Note (optional)', + hintText: S.of(context).note_optional, placeholderTextStyle: TextStyle( fontSize: 14, fontWeight: FontWeight.w500, @@ -668,9 +668,7 @@ class SendPage extends BasePage { padding: EdgeInsets.only( top: 220, left: 24, right: 24), child: Text( - S.of(context).send_success( - sendViewModel.currency - .toString()), + S.of(context).send_success, textAlign: TextAlign.center, style: TextStyle( fontSize: 22, diff --git a/lib/src/screens/transaction_details/widgets/textfield_list_row.dart b/lib/src/screens/transaction_details/widgets/textfield_list_row.dart index 3f2f2d877..560428ff9 100644 --- a/lib/src/screens/transaction_details/widgets/textfield_list_row.dart +++ b/lib/src/screens/transaction_details/widgets/textfield_list_row.dart @@ -1,5 +1,6 @@ import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; +import 'package:cake_wallet/generated/i18n.dart'; class TextFieldListRow extends StatelessWidget { TextFieldListRow( @@ -59,7 +60,7 @@ class TextFieldListRow extends StatelessWidget { decoration: InputDecoration( isDense: true, contentPadding: EdgeInsets.only(top: 12, bottom: 0), - hintText: 'Note', + hintText: S.of(context).note, hintStyle: TextStyle( fontSize: valueFontSize, fontWeight: FontWeight.w500, diff --git a/lib/view_model/transaction_details_view_model.dart b/lib/view_model/transaction_details_view_model.dart index e3f57c9a3..b27e6816e 100644 --- a/lib/view_model/transaction_details_view_model.dart +++ b/lib/view_model/transaction_details_view_model.dart @@ -42,8 +42,9 @@ abstract class TransactionDetailsViewModelBase with Store { ]; if (tx.key?.isNotEmpty ?? null) { - // FIXME: add translation - _items.add(StandartListItem(title: 'Transaction Key', value: tx.key)); + _items.add(StandartListItem( + title: S.current.transaction_key, + value: tx.key)); } items.addAll(_items); @@ -56,9 +57,8 @@ abstract class TransactionDetailsViewModelBase with Store { StandartListItem( title: S.current.transaction_details_date, value: dateFormat.format(tx.date)), - // FIXME: add translation StandartListItem( - title: 'Confirmations', value: tx.confirmations?.toString()), + title: S.current.confirmations, value: tx.confirmations?.toString()), StandartListItem( title: S.current.transaction_details_height, value: '${tx.height}'), StandartListItem( @@ -87,9 +87,10 @@ abstract class TransactionDetailsViewModelBase with Store { (val) => val.id == transactionInfo.id, orElse: () => null); if (description != null) { - // FIXME: add translation - items.add(TextFieldListItem(title: 'Note (tap to change)', - value: description.note, onSubmitted: (value) { + items.add(TextFieldListItem( + title: S.current.note_tap_to_change, + value: description.note, + onSubmitted: (value) { description.transactionNote = value; description.save(); })); diff --git a/res/values/strings_de.arb b/res/values/strings_de.arb index ee47ace4c..8e08be734 100644 --- a/res/values/strings_de.arb +++ b/res/values/strings_de.arb @@ -428,5 +428,11 @@ "color_theme" : "Farbthema", "light_theme" : "Licht", "bright_theme" : "Hell", - "dark_theme" : "Dunkel" + "dark_theme" : "Dunkel", + + "note" : "Hinweis", + "note_optional" : "Hinweis (optional)", + "note_tap_to_change" : "Hinweis (zum Ändern tippen)", + "transaction_key" : "Transaktionsschlüssel", + "confirmations" : "Bestätigungen" } \ No newline at end of file diff --git a/res/values/strings_en.arb b/res/values/strings_en.arb index ee6925cc0..9ce7a6c81 100644 --- a/res/values/strings_en.arb +++ b/res/values/strings_en.arb @@ -428,5 +428,11 @@ "color_theme" : "Color theme", "light_theme" : "Light", "bright_theme" : "Bright", - "dark_theme" : "Dark" + "dark_theme" : "Dark", + + "note" : "Note", + "note_optional" : "Note (optional)", + "note_tap_to_change" : "Note (tap to change)", + "transaction_key" : "Transaction Key", + "confirmations" : "Confirmations" } \ No newline at end of file diff --git a/res/values/strings_es.arb b/res/values/strings_es.arb index 7483b75e0..bf049df8d 100644 --- a/res/values/strings_es.arb +++ b/res/values/strings_es.arb @@ -428,5 +428,11 @@ "color_theme" : "Tema de color", "light_theme" : "Ligera", "bright_theme" : "Brillante", - "dark_theme" : "Oscura" + "dark_theme" : "Oscura", + + "note" : "Nota", + "note_optional" : "Nota (opcional)", + "note_tap_to_change" : "Nota (toque para cambiar)", + "transaction_key" : "Clave de transacción", + "confirmations" : "Confirmaciones" } \ No newline at end of file diff --git a/res/values/strings_hi.arb b/res/values/strings_hi.arb index 21caa7c77..3933f1001 100644 --- a/res/values/strings_hi.arb +++ b/res/values/strings_hi.arb @@ -428,5 +428,11 @@ "color_theme" : "रंग विषय", "light_theme" : "रोशनी", "bright_theme" : "उज्ज्वल", - "dark_theme" : "अंधेरा" + "dark_theme" : "अंधेरा", + + "note" : "नोट", + "note_optional" : "नोट (वैकल्पिक)", + "note_tap_to_change" : "नोट (टैप टू चेंज)", + "transaction_key" : "लेन-देन की", + "confirmations" : "पुष्टिकरण" } \ No newline at end of file diff --git a/res/values/strings_ja.arb b/res/values/strings_ja.arb index eff9adf68..752af90a2 100644 --- a/res/values/strings_ja.arb +++ b/res/values/strings_ja.arb @@ -428,5 +428,11 @@ "color_theme" : "カラーテーマ", "light_theme" : "光", "bright_theme" : "明るい", - "dark_theme" : "闇" + "dark_theme" : "闇", + + "note" : "注意", + "note_optional" : "注(オプション)", + "note_tap_to_change" : "注(タップして変更)", + "transaction_key" : "トランザクションキー", + "confirmations" : "確認" } \ No newline at end of file diff --git a/res/values/strings_ko.arb b/res/values/strings_ko.arb index ed0e78da6..7a4707c6f 100644 --- a/res/values/strings_ko.arb +++ b/res/values/strings_ko.arb @@ -428,5 +428,11 @@ "color_theme" : "색상 테마", "light_theme" : "빛", "bright_theme" : "선명한", - "dark_theme" : "어두운" + "dark_theme" : "어두운", + + "note" : "노트", + "note_optional" : "참고 (선택 사항)", + "note_tap_to_change" : "메모 (변경하려면 탭하세요)", + "transaction_key" : "거래 키", + "confirmations" : "확인" } \ No newline at end of file diff --git a/res/values/strings_nl.arb b/res/values/strings_nl.arb index b8d6a9ab4..9d03ea080 100644 --- a/res/values/strings_nl.arb +++ b/res/values/strings_nl.arb @@ -428,5 +428,11 @@ "color_theme" : "Kleur thema", "light_theme" : "Licht", "bright_theme" : "Helder", - "dark_theme" : "Donker" + "dark_theme" : "Donker", + + "note" : "Opmerking", + "note_optional" : "Opmerking (optioneel)", + "note_tap_to_change" : "Opmerking (tik om te wijzigen)", + "transaction_key" : "Transactiesleutel", + "confirmations" : "Bevestigingen" } \ No newline at end of file diff --git a/res/values/strings_pl.arb b/res/values/strings_pl.arb index 1fe58d723..7abca0b1d 100644 --- a/res/values/strings_pl.arb +++ b/res/values/strings_pl.arb @@ -428,5 +428,11 @@ "color_theme" : "Motyw kolorystyczny", "light_theme" : "Lekki", "bright_theme" : "Jasny", - "dark_theme" : "Ciemny" + "dark_theme" : "Ciemny", + + "note" : "Notatka", + "note_optional" : "Notatka (opcjonalnie)", + "note_tap_to_change" : "Notatka (dotknij, aby zmienić)", + "transaction_key" : "Klucz transakcji", + "confirmations" : "Potwierdzenia" } \ No newline at end of file diff --git a/res/values/strings_pt.arb b/res/values/strings_pt.arb index 9049b824e..1e68ea62a 100644 --- a/res/values/strings_pt.arb +++ b/res/values/strings_pt.arb @@ -428,5 +428,11 @@ "color_theme" : "Tema de cor", "light_theme" : "Luz", "bright_theme" : "Brilhante", - "dark_theme" : "Sombria" + "dark_theme" : "Sombria", + + "note" : "Nota", + "note_optional" : "Nota (opcional)", + "note_tap_to_change" : "Nota (toque para alterar)", + "transaction_key" : "Chave de transação", + "confirmations" : "Confirmações" } diff --git a/res/values/strings_ru.arb b/res/values/strings_ru.arb index f3e633512..66a8efad6 100644 --- a/res/values/strings_ru.arb +++ b/res/values/strings_ru.arb @@ -428,5 +428,11 @@ "color_theme" : "Цветовая тема", "light_theme" : "Светлая", "bright_theme" : "Яркая", - "dark_theme" : "Темная" + "dark_theme" : "Темная", + + "note" : "Примечание", + "note_optional" : "Примечание (необязательно)", + "note_tap_to_change" : "Примечание (нажмите для изменения)", + "transaction_key" : "Ключ транзакции", + "confirmations" : "Подтверждения" } \ No newline at end of file diff --git a/res/values/strings_uk.arb b/res/values/strings_uk.arb index d0906da4b..28171cef9 100644 --- a/res/values/strings_uk.arb +++ b/res/values/strings_uk.arb @@ -428,5 +428,11 @@ "color_theme" : "Кольорова тема", "light_theme" : "Світла", "bright_theme" : "Яскрава", - "dark_theme" : "Темна" + "dark_theme" : "Темна", + + "note" : "Примітка", + "note_optional" : "Примітка (необов’язково)", + "note_tap_to_change" : "Примітка (натисніть для зміни)", + "transaction_key" : "Ключ транзакції", + "confirmations" : "Підтвердження" } \ No newline at end of file diff --git a/res/values/strings_zh.arb b/res/values/strings_zh.arb index 890a3b502..7ab6221aa 100644 --- a/res/values/strings_zh.arb +++ b/res/values/strings_zh.arb @@ -428,5 +428,11 @@ "color_theme" : "顏色主題", "light_theme" : "光", "bright_theme" : "亮", - "dark_theme" : "黑暗" + "dark_theme" : "黑暗", + + "note" : "注意", + "note_optional" : "注意(可選)", + "note_tap_to_change" : "注意(輕按即可更改)", + "transaction_key" : "交易密碼", + "confirmations" : "確認書" } \ No newline at end of file From fd4efd46ea00a247759f2dcb6cd86555b57f79fd Mon Sep 17 00:00:00 2001 From: M Date: Wed, 23 Dec 2020 14:48:04 +0200 Subject: [PATCH 07/39] Fixes for 'std::bad_alloc' issue. --- cw_monero/ios/Classes/monero_api.cpp | 16 ++++++++++++++-- .../exceptions/wallet_loading_exception.dart | 8 ++++++++ cw_monero/lib/signatures.dart | 4 +++- cw_monero/lib/types.dart | 4 +++- cw_monero/lib/wallet_manager.dart | 13 +++++++++++-- ios/Runner.xcodeproj/project.pbxproj | 6 +++--- lib/monero/monero_wallet_service.dart | 17 ++++++++++++++++- 7 files changed, 58 insertions(+), 10 deletions(-) create mode 100644 cw_monero/lib/exceptions/wallet_loading_exception.dart diff --git a/cw_monero/ios/Classes/monero_api.cpp b/cw_monero/ios/Classes/monero_api.cpp index 2dfd8a0ae..efe8c49f1 100644 --- a/cw_monero/ios/Classes/monero_api.cpp +++ b/cw_monero/ios/Classes/monero_api.cpp @@ -294,14 +294,26 @@ extern "C" return true; } - void load_wallet(char *path, char *password, int32_t nettype) + bool load_wallet(char *path, char *password, int32_t nettype) { nice(19); Monero::NetworkType networkType = static_cast(nettype); - Monero::Wallet *wallet = Monero::WalletManagerFactory::getWalletManager()->openWallet(std::string(path), std::string(password), networkType); + Monero::WalletManager *walletManager = Monero::WalletManagerFactory::getWalletManager(); + Monero::Wallet *wallet = walletManager->openWallet(std::string(path), std::string(password), networkType); + int status; + std::string errorString; + + wallet->statusWithErrorString(status, errorString); change_current_wallet(wallet); + + return !(status != Monero::Wallet::Status_Ok || !errorString.empty()); } + char *error_string() { + return strdup(get_current_wallet()->errorString().c_str()); + } + + bool is_wallet_exist(char *path) { return Monero::WalletManagerFactory::getWalletManager()->walletExists(std::string(path)); diff --git a/cw_monero/lib/exceptions/wallet_loading_exception.dart b/cw_monero/lib/exceptions/wallet_loading_exception.dart new file mode 100644 index 000000000..b0594c6e5 --- /dev/null +++ b/cw_monero/lib/exceptions/wallet_loading_exception.dart @@ -0,0 +1,8 @@ +class WalletLoadingException implements Exception { + WalletLoadingException({this.message}); + + final String message; + + @override + String toString() => message; +} \ No newline at end of file diff --git a/cw_monero/lib/signatures.dart b/cw_monero/lib/signatures.dart index 5e9c4fa9d..0f75288e7 100644 --- a/cw_monero/lib/signatures.dart +++ b/cw_monero/lib/signatures.dart @@ -14,7 +14,9 @@ typedef restore_wallet_from_keys = Int8 Function(Pointer, Pointer, typedef is_wallet_exist = Int8 Function(Pointer); -typedef load_wallet = Void Function(Pointer, Pointer, Int8); +typedef load_wallet = Int8 Function(Pointer, Pointer, Int8); + +typedef error_string = Pointer Function(); typedef get_filename = Pointer Function(); diff --git a/cw_monero/lib/types.dart b/cw_monero/lib/types.dart index 602a33572..1cc1a6055 100644 --- a/cw_monero/lib/types.dart +++ b/cw_monero/lib/types.dart @@ -14,7 +14,9 @@ typedef RestoreWalletFromKeys = int Function(Pointer, Pointer, typedef IsWalletExist = int Function(Pointer); -typedef LoadWallet = void Function(Pointer, Pointer, int); +typedef LoadWallet = int Function(Pointer, Pointer, int); + +typedef ErrorString = Pointer Function(); typedef GetFilename = Pointer Function(); diff --git a/cw_monero/lib/wallet_manager.dart b/cw_monero/lib/wallet_manager.dart index 07f534c97..ad2087361 100644 --- a/cw_monero/lib/wallet_manager.dart +++ b/cw_monero/lib/wallet_manager.dart @@ -7,6 +7,7 @@ import 'package:cw_monero/signatures.dart'; import 'package:cw_monero/types.dart'; import 'package:cw_monero/monero_api.dart'; import 'package:cw_monero/exceptions/wallet_creation_exception.dart'; +import 'package:cw_monero/exceptions/wallet_loading_exception.dart'; import 'package:cw_monero/exceptions/wallet_restore_from_keys_exception.dart'; import 'package:cw_monero/exceptions/wallet_restore_from_seed_exception.dart'; @@ -32,6 +33,10 @@ final loadWalletNative = moneroApi .lookup>('load_wallet') .asFunction(); +final errorStringNative = moneroApi + .lookup>('error_string') + .asFunction(); + void createWalletSync( {String path, String password, String language, int nettype = 0}) { final pathPointer = Utf8.toUtf8(path); @@ -136,10 +141,14 @@ void restoreWalletFromKeysSync( void loadWallet({String path, String password, int nettype = 0}) { final pathPointer = Utf8.toUtf8(path); final passwordPointer = Utf8.toUtf8(password); - - loadWalletNative(pathPointer, passwordPointer, nettype); + final loaded = loadWalletNative(pathPointer, passwordPointer, nettype) != 0; free(pathPointer); free(passwordPointer); + + if (!loaded) { + throw WalletLoadingException( + message: convertUTF8ToString(pointer: errorStringNative())); + } } void _createWallet(Map args) { diff --git a/ios/Runner.xcodeproj/project.pbxproj b/ios/Runner.xcodeproj/project.pbxproj index 99a1c5f3c..a77e4e4c8 100644 --- a/ios/Runner.xcodeproj/project.pbxproj +++ b/ios/Runner.xcodeproj/project.pbxproj @@ -371,7 +371,7 @@ "$(inherited)", "$(PROJECT_DIR)/Flutter", ); - MARKETING_VERSION = 4.0.91; + MARKETING_VERSION = 4.0.92; PRODUCT_BUNDLE_IDENTIFIER = com.fotolockr.cakewallet; PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; @@ -511,7 +511,7 @@ "$(inherited)", "$(PROJECT_DIR)/Flutter", ); - MARKETING_VERSION = 4.0.91; + MARKETING_VERSION = 4.0.92; PRODUCT_BUNDLE_IDENTIFIER = com.fotolockr.cakewallet; PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; @@ -545,7 +545,7 @@ "$(inherited)", "$(PROJECT_DIR)/Flutter", ); - MARKETING_VERSION = 4.0.91; + MARKETING_VERSION = 4.0.92; PRODUCT_BUNDLE_IDENTIFIER = com.fotolockr.cakewallet; PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; diff --git a/lib/monero/monero_wallet_service.dart b/lib/monero/monero_wallet_service.dart index 191b340e4..fb1bdb4c4 100644 --- a/lib/monero/monero_wallet_service.dart +++ b/lib/monero/monero_wallet_service.dart @@ -3,6 +3,7 @@ import 'package:cake_wallet/core/wallet_base.dart'; import 'package:hive/hive.dart'; import 'package:cw_monero/wallet_manager.dart' as monero_wallet_manager; import 'package:cw_monero/wallet.dart' as monero_wallet; +import 'package:cw_monero/exceptions/wallet_loading_exception.dart'; import 'package:cake_wallet/monero/monero_wallet.dart'; import 'package:cake_wallet/core/wallet_credentials.dart'; import 'package:cake_wallet/core/wallet_service.dart'; @@ -55,6 +56,15 @@ class MoneroWalletService extends WalletService< final Box walletInfoSource; + static void _removeCache(String name) async { + final path = await pathForWallet(name: name, type: WalletType.monero); + final cacheFile = File(path); + + if (cacheFile.existsSync()) { + cacheFile.deleteSync(); + } + } + @override Future create(MoneroNewWalletCredentials credentials) async { try { @@ -126,7 +136,12 @@ class MoneroWalletService extends WalletService< return wallet; } catch (e) { // TODO: Implement Exception for wallet list service. - print('MoneroWalletsManager Error: $e'); + + if (e.message == 'std::bad_alloc') { + _removeCache(name); + return openWallet(name, password); + } + rethrow; } } From 647577497d819fddeffa8b1834fa067ffd399e61 Mon Sep 17 00:00:00 2001 From: M Date: Wed, 23 Dec 2020 14:51:58 +0200 Subject: [PATCH 08/39] Changed android project version to 4.0.92 (23). --- pubspec.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pubspec.yaml b/pubspec.yaml index 656f9b6b2..3e680b605 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -11,7 +11,7 @@ description: Cake Wallet. # In iOS, build-name is used as CFBundleShortVersionString while build-number used as CFBundleVersion. # Read more about iOS versioning at # https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html -version: 4.0.91+22 +version: 4.0.92+23 environment: sdk: ">=2.7.0 <3.0.0" From cf5f212f337c992a511d50c1e1cdd80e8c849743 Mon Sep 17 00:00:00 2001 From: Oleksandr Sobol Date: Wed, 23 Dec 2020 15:04:57 +0200 Subject: [PATCH 09/39] CAKE-198 | fixed string resources --- lib/generated/i18n.dart | 23 +++++++++++++++++++ .../transaction_details_view_model.dart | 8 +++++-- res/values/strings_de.arb | 1 + res/values/strings_en.arb | 1 + res/values/strings_es.arb | 1 + res/values/strings_hi.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 + 14 files changed, 41 insertions(+), 2 deletions(-) diff --git a/lib/generated/i18n.dart b/lib/generated/i18n.dart index be5d653c9..4157b47b7 100644 --- a/lib/generated/i18n.dart +++ b/lib/generated/i18n.dart @@ -298,6 +298,7 @@ class S implements WidgetsLocalizations { String get trades => "Trades"; String get transaction_details_amount => "Amount"; String get transaction_details_date => "Date"; + String get transaction_details_fee => "Fee"; String get transaction_details_height => "Height"; String get transaction_details_recipient_address => "Recipient address"; String get transaction_details_title => "Transaction Details"; @@ -479,6 +480,8 @@ class $de extends S { @override String get send_your_wallet => "Deine Geldbörse"; @override + String get transaction_details_fee => "Gebühr"; + @override String get remove_node_message => "Möchten Sie den ausgewählten Knoten wirklich entfernen?"; @override String get error_text_account_name => "Der Kontoname darf nur Wallet und Zahlen enthalten\nund muss zwischen 1 und 15 Zeichen lang sein"; @@ -1189,6 +1192,8 @@ class $hi extends S { @override String get send_your_wallet => "आपका बटुआ"; @override + String get transaction_details_fee => "शुल्क"; + @override String get remove_node_message => "क्या आप वाकई चयनित नोड को निकालना चाहते हैं?"; @override String get error_text_account_name => "खाता नाम में केवल अक्षर, संख्याएं हो सकती हैं\nऔर 1 और 15 वर्णों के बीच लंबा होना चाहिए"; @@ -1899,6 +1904,8 @@ class $ru extends S { @override String get send_your_wallet => "Ваш кошелёк"; @override + String get transaction_details_fee => "Комиссия"; + @override String get remove_node_message => "Вы уверены, что хотите удалить текущую ноду?"; @override String get error_text_account_name => "Имя аккаунта может содержать только буквы, цифры\nи должно быть от 1 до 15 символов в длину"; @@ -2609,6 +2616,8 @@ class $ko extends S { @override String get send_your_wallet => "지갑"; @override + String get transaction_details_fee => "회비"; + @override String get remove_node_message => "선택한 노드를 제거 하시겠습니까?"; @override String get error_text_account_name => "계정 이름은 문자, 숫자 만 포함 할 수 있습니다\n1 ~ 15 자 사이 여야합니다"; @@ -3319,6 +3328,8 @@ class $pt extends S { @override String get send_your_wallet => "Sua carteira"; @override + String get transaction_details_fee => "Taxa"; + @override String get remove_node_message => "Você realmente deseja remover o nó selecionado?"; @override String get error_text_account_name => "O nome da conta só pode conter letras, números\ne deve ter entre 1 e 15 caracteres"; @@ -4029,6 +4040,8 @@ class $uk extends S { @override String get send_your_wallet => "Ваш гаманець"; @override + String get transaction_details_fee => "Комісія"; + @override String get remove_node_message => "Ви впевнені, що хочете видалити поточний вузол?"; @override String get error_text_account_name => "Ім'я акаунту може містити тільки букви, цифри\nі повинно бути від 1 до 15 символів в довжину"; @@ -4739,6 +4752,8 @@ class $ja extends S { @override String get send_your_wallet => "あなたの財布"; @override + String get transaction_details_fee => "費用"; + @override String get remove_node_message => "選択したノードを削除してもよろしいですか?"; @override String get error_text_account_name => "アカウント名には文字のみを含めることができます \n1〜15文字である必要があります"; @@ -5453,6 +5468,8 @@ class $pl extends S { @override String get send_your_wallet => "Twój portfel"; @override + String get transaction_details_fee => "Opłata"; + @override String get remove_node_message => "Czy na pewno chcesz usunąć wybrany węzeł?"; @override String get error_text_account_name => "Nazwa konta może zawierać tylko litery, cyfry\ni musi mieć od 1 do 15 znaków"; @@ -6163,6 +6180,8 @@ class $es extends S { @override String get send_your_wallet => "Tu billetera"; @override + String get transaction_details_fee => "Cuota"; + @override String get remove_node_message => "¿Está seguro de que desea eliminar el nodo seleccionado?"; @override String get error_text_account_name => "El nombre de la cuenta solo puede contener letras, números \ny debe tener entre 1 y 15 caracteres de longitud"; @@ -6873,6 +6892,8 @@ class $nl extends S { @override String get send_your_wallet => "Uw portemonnee"; @override + String get transaction_details_fee => "Vergoeding"; + @override String get remove_node_message => "Weet u zeker dat u het geselecteerde knooppunt wilt verwijderen?"; @override String get error_text_account_name => "Accountnaam mag alleen letters, cijfers bevatten\nen moet tussen de 1 en 15 tekens lang zijn"; @@ -7583,6 +7604,8 @@ class $zh extends S { @override String get send_your_wallet => "你的钱包"; @override + String get transaction_details_fee => "費用"; + @override String get remove_node_message => "您确定要删除所选节点吗?"; @override String get error_text_account_name => "帐户名称只能包含字母数字\n且必须介于1到15个字符之间"; diff --git a/lib/view_model/transaction_details_view_model.dart b/lib/view_model/transaction_details_view_model.dart index b27e6816e..701071e6a 100644 --- a/lib/view_model/transaction_details_view_model.dart +++ b/lib/view_model/transaction_details_view_model.dart @@ -38,7 +38,9 @@ abstract class TransactionDetailsViewModelBase with Store { StandartListItem( title: S.current.transaction_details_amount, value: tx.amountFormatted()), - StandartListItem(title: S.current.send_fee, value: tx.feeFormatted()), + StandartListItem( + title: S.current.transaction_details_fee, + value: tx.feeFormatted()), ]; if (tx.key?.isNotEmpty ?? null) { @@ -65,7 +67,9 @@ abstract class TransactionDetailsViewModelBase with Store { title: S.current.transaction_details_amount, value: tx.amountFormatted()), if (tx.feeFormatted()?.isNotEmpty) - StandartListItem(title: S.current.send_fee, value: tx.feeFormatted()) + StandartListItem( + title: S.current.transaction_details_fee, + value: tx.feeFormatted()) ]; items.addAll(_items); diff --git a/res/values/strings_de.arb b/res/values/strings_de.arb index 8e08be734..20bdffedd 100644 --- a/res/values/strings_de.arb +++ b/res/values/strings_de.arb @@ -282,6 +282,7 @@ "transaction_details_date" : "Datum", "transaction_details_height" : "Höhe", "transaction_details_amount" : "Menge", + "transaction_details_fee" : "Gebühr", "transaction_details_copied" : "${title} in die Zwischenablage kopiert", "transaction_details_recipient_address" : "Empfängeradresse", diff --git a/res/values/strings_en.arb b/res/values/strings_en.arb index 9ce7a6c81..fbedfb6af 100644 --- a/res/values/strings_en.arb +++ b/res/values/strings_en.arb @@ -282,6 +282,7 @@ "transaction_details_date" : "Date", "transaction_details_height" : "Height", "transaction_details_amount" : "Amount", + "transaction_details_fee" : "Fee", "transaction_details_copied" : "${title} copied to Clipboard", "transaction_details_recipient_address" : "Recipient address", diff --git a/res/values/strings_es.arb b/res/values/strings_es.arb index bf049df8d..aa0d5836b 100644 --- a/res/values/strings_es.arb +++ b/res/values/strings_es.arb @@ -282,6 +282,7 @@ "transaction_details_date" : "Fecha", "transaction_details_height" : "Altura", "transaction_details_amount" : "Cantidad", + "transaction_details_fee" : "Cuota", "transaction_details_copied" : "${title} Copiado al portapapeles", "transaction_details_recipient_address" : "Dirección del receptor", diff --git a/res/values/strings_hi.arb b/res/values/strings_hi.arb index 3933f1001..8cb9229a3 100644 --- a/res/values/strings_hi.arb +++ b/res/values/strings_hi.arb @@ -282,6 +282,7 @@ "transaction_details_date" : "तारीख", "transaction_details_height" : "ऊंचाई", "transaction_details_amount" : "रकम", + "transaction_details_fee" : "शुल्क", "transaction_details_copied" : "${title} क्लिपबोर्ड पर नकल", "transaction_details_recipient_address" : "प्राप्तकर्ता का पता", diff --git a/res/values/strings_ja.arb b/res/values/strings_ja.arb index 752af90a2..f04e90ab2 100644 --- a/res/values/strings_ja.arb +++ b/res/values/strings_ja.arb @@ -282,6 +282,7 @@ "transaction_details_date" : "日付", "transaction_details_height" : "高さ", "transaction_details_amount" : "量", + "transaction_details_fee" : "費用", "transaction_details_copied" : "${title} クリップボードにコピーしました", "transaction_details_recipient_address" : "受取人の住所", diff --git a/res/values/strings_ko.arb b/res/values/strings_ko.arb index 7a4707c6f..a6b4098a2 100644 --- a/res/values/strings_ko.arb +++ b/res/values/strings_ko.arb @@ -282,6 +282,7 @@ "transaction_details_date" : "날짜", "transaction_details_height" : "신장", "transaction_details_amount" : "양", + "transaction_details_fee" : "회비", "transaction_details_copied" : "${title} 클립 보드에 복사", "transaction_details_recipient_address" : "받는 사람 주소", diff --git a/res/values/strings_nl.arb b/res/values/strings_nl.arb index 9d03ea080..a6385c366 100644 --- a/res/values/strings_nl.arb +++ b/res/values/strings_nl.arb @@ -282,6 +282,7 @@ "transaction_details_date" : "Datum", "transaction_details_height" : "Hoogte", "transaction_details_amount" : "Bedrag", + "transaction_details_fee" : "Vergoeding", "transaction_details_copied" : "${title} gekopieerd naar het klembord", "transaction_details_recipient_address" : "Adres van de ontvanger", diff --git a/res/values/strings_pl.arb b/res/values/strings_pl.arb index 7abca0b1d..4cf9ea031 100644 --- a/res/values/strings_pl.arb +++ b/res/values/strings_pl.arb @@ -282,6 +282,7 @@ "transaction_details_date" : "Data", "transaction_details_height" : "Wysokość", "transaction_details_amount" : "Ilość", + "transaction_details_fee" : "Opłata", "transaction_details_copied" : "${title} skopiowane do schowka", "transaction_details_recipient_address" : "Adres odbiorcy", diff --git a/res/values/strings_pt.arb b/res/values/strings_pt.arb index 1e68ea62a..345bb9d6b 100644 --- a/res/values/strings_pt.arb +++ b/res/values/strings_pt.arb @@ -282,6 +282,7 @@ "transaction_details_date" : "Data", "transaction_details_height" : "Altura", "transaction_details_amount" : "Quantia", + "transaction_details_fee" : "Taxa", "transaction_details_copied" : "${title} copiados para a área de transferência", "transaction_details_recipient_address" : "Endereço do destinatário", diff --git a/res/values/strings_ru.arb b/res/values/strings_ru.arb index 66a8efad6..ca1e8af12 100644 --- a/res/values/strings_ru.arb +++ b/res/values/strings_ru.arb @@ -282,6 +282,7 @@ "transaction_details_date" : "Дата", "transaction_details_height" : "Высота", "transaction_details_amount" : "Сумма", + "transaction_details_fee" : "Комиссия", "transaction_details_copied" : "${title} скопировано в буфер обмена", "transaction_details_recipient_address" : "Адрес получателя", diff --git a/res/values/strings_uk.arb b/res/values/strings_uk.arb index 28171cef9..15f5d48da 100644 --- a/res/values/strings_uk.arb +++ b/res/values/strings_uk.arb @@ -282,6 +282,7 @@ "transaction_details_date" : "Дата", "transaction_details_height" : "Висота", "transaction_details_amount" : "Сума", + "transaction_details_fee" : "Комісія", "transaction_details_copied" : "${title} скопійовано в буфер обміну", "transaction_details_recipient_address" : "Адреса отримувача", diff --git a/res/values/strings_zh.arb b/res/values/strings_zh.arb index 7ab6221aa..a63342b75 100644 --- a/res/values/strings_zh.arb +++ b/res/values/strings_zh.arb @@ -282,6 +282,7 @@ "transaction_details_date" : "日期", "transaction_details_height" : "高度", "transaction_details_amount" : "量", + "transaction_details_fee" : "費用", "transaction_details_copied" : "${title} 复制到剪贴板", "transaction_details_recipient_address" : "收件人地址", From d7cc595179a70ab6513d23844463af0caba9e61b Mon Sep 17 00:00:00 2001 From: Oleksandr Sobol Date: Wed, 23 Dec 2020 19:14:11 +0200 Subject: [PATCH 10/39] CAKE-198 | changed hint text from "Note" to "Enter your note..."; changed color of the hint text in textfield_list_row --- lib/generated/i18n.dart | 46 +++++++++---------- .../widgets/textfield_list_row.dart | 14 ++---- res/values/strings_de.arb | 2 +- res/values/strings_en.arb | 2 +- res/values/strings_es.arb | 2 +- res/values/strings_hi.arb | 2 +- res/values/strings_ja.arb | 2 +- res/values/strings_ko.arb | 2 +- res/values/strings_nl.arb | 2 +- res/values/strings_pl.arb | 2 +- res/values/strings_pt.arb | 2 +- res/values/strings_ru.arb | 2 +- res/values/strings_uk.arb | 2 +- res/values/strings_zh.arb | 2 +- 14 files changed, 40 insertions(+), 44 deletions(-) diff --git a/lib/generated/i18n.dart b/lib/generated/i18n.dart index 4157b47b7..0aea9f9c9 100644 --- a/lib/generated/i18n.dart +++ b/lib/generated/i18n.dart @@ -78,6 +78,7 @@ class S implements WidgetsLocalizations { String get delete => "Delete"; String get digit_pin => "-digit PIN"; String get edit => "Edit"; + String get enter_your_note => "Enter your note…"; String get enter_your_pin => "Enter your PIN"; String get enter_your_pin_again => "Enter your pin again"; String get error => "Error"; @@ -128,7 +129,6 @@ class S implements WidgetsLocalizations { String get node_test => "Test"; String get nodes => "Nodes"; String get nodes_list_reset_to_default_message => "Are you sure that you want to reset settings to default?"; - String get note => "Note"; String get note_optional => "Note (optional)"; String get note_tap_to_change => "Note (tap to change)"; String get offer_expires_in => "Offer expires in: "; @@ -780,6 +780,8 @@ class $de extends S { @override String get template => "Vorlage"; @override + String get enter_your_note => "Geben Sie Ihre Notiz ein…"; + @override String get transaction_priority_medium => "Mittel"; @override String get transaction_details_transaction_id => "Transaktions-ID"; @@ -922,8 +924,6 @@ class $de extends S { @override String get settings_save_recipient_address => "Empfängeradresse speichern"; @override - String get note => "Hinweis"; - @override String get change_exchange_provider => "Wechseln Sie den Exchange-Anbieter"; @override String get send_payment_id => "Zahlungs ID (wahlweise)"; @@ -1492,6 +1492,8 @@ class $hi extends S { @override String get template => "खाका"; @override + String get enter_your_note => "अपना नोट दर्ज करें ..."; + @override String get transaction_priority_medium => "मध्यम"; @override String get transaction_details_transaction_id => "लेनदेन आईडी"; @@ -1634,8 +1636,6 @@ class $hi extends S { @override String get settings_save_recipient_address => "प्राप्तकर्ता का पता सहेजें"; @override - String get note => "नोट"; - @override String get change_exchange_provider => "एक्सचेंज प्रदाता बदलें"; @override String get send_payment_id => "भुगतान ID (ऐच्छिक)"; @@ -2204,6 +2204,8 @@ class $ru extends S { @override String get template => "Шаблон"; @override + String get enter_your_note => "Введите примечание…"; + @override String get transaction_priority_medium => "Средний"; @override String get transaction_details_transaction_id => "ID транзакции"; @@ -2346,8 +2348,6 @@ class $ru extends S { @override String get settings_save_recipient_address => "Сохранять адрес получателя"; @override - String get note => "Примечание"; - @override String get change_exchange_provider => "Изменить провайдера обмена"; @override String get send_payment_id => "ID платежа (опционально)"; @@ -2916,6 +2916,8 @@ class $ko extends S { @override String get template => "주형"; @override + String get enter_your_note => "메모를 입력하세요…"; + @override String get transaction_priority_medium => "매질"; @override String get transaction_details_transaction_id => "트랜잭션 ID"; @@ -3058,8 +3060,6 @@ class $ko extends S { @override String get settings_save_recipient_address => "수신자 주소 저장"; @override - String get note => "노트"; - @override String get change_exchange_provider => "교환 공급자 변경"; @override String get send_payment_id => "지불 ID (optional)"; @@ -3628,6 +3628,8 @@ class $pt extends S { @override String get template => "Modelo"; @override + String get enter_your_note => "Insira sua nota ..."; + @override String get transaction_priority_medium => "Média"; @override String get transaction_details_transaction_id => "ID da transação"; @@ -3770,8 +3772,6 @@ class $pt extends S { @override String get settings_save_recipient_address => "Salvar endereço do destinatário"; @override - String get note => "Nota"; - @override String get change_exchange_provider => "Alterar o provedor de troca"; @override String get send_payment_id => "ID de pagamento (opcional)"; @@ -4340,6 +4340,8 @@ class $uk extends S { @override String get template => "Шаблон"; @override + String get enter_your_note => "Введіть примітку…"; + @override String get transaction_priority_medium => "Середній"; @override String get transaction_details_transaction_id => "ID транзакції"; @@ -4482,8 +4484,6 @@ class $uk extends S { @override String get settings_save_recipient_address => "Зберігати адресу отримувача"; @override - String get note => "Примітка"; - @override String get change_exchange_provider => "Змінити провайдера обміну"; @override String get send_payment_id => "ID платежу (опційно)"; @@ -5052,6 +5052,8 @@ class $ja extends S { @override String get template => "テンプレート"; @override + String get enter_your_note => "メモを入力してください…"; + @override String get transaction_priority_medium => "中"; @override String get transaction_details_transaction_id => "トランザクションID"; @@ -5194,8 +5196,6 @@ class $ja extends S { @override String get settings_save_recipient_address => "受信者のアドレスを保存"; @override - String get note => "注意"; - @override String get change_exchange_provider => "Exchangeプロバイダーの変更"; @override String get send_payment_id => "支払いID (オプショナル)"; @@ -5768,6 +5768,8 @@ class $pl extends S { @override String get template => "Szablon"; @override + String get enter_your_note => "Wpisz notatkę…"; + @override String get transaction_priority_medium => "Średni"; @override String get transaction_details_transaction_id => "Transakcja ID"; @@ -5910,8 +5912,6 @@ class $pl extends S { @override String get settings_save_recipient_address => "Zapisz adres odbiorcy"; @override - String get note => "Notatka"; - @override String get change_exchange_provider => "Zmień dostawcę programu Exchange"; @override String get send_payment_id => "Identyfikator płatności (opcjonalny)"; @@ -6480,6 +6480,8 @@ class $es extends S { @override String get template => "Plantilla"; @override + String get enter_your_note => "Ingresa tu nota…"; + @override String get transaction_priority_medium => "Medio"; @override String get transaction_details_transaction_id => "ID de transacción"; @@ -6622,8 +6624,6 @@ class $es extends S { @override String get settings_save_recipient_address => "Guardar dirección del destinatario"; @override - String get note => "Nota"; - @override String get change_exchange_provider => "Cambiar proveedor de intercambio"; @override String get send_payment_id => "ID de pago (opcional)"; @@ -7192,6 +7192,8 @@ class $nl extends S { @override String get template => "Sjabloon"; @override + String get enter_your_note => "Voer uw notitie in ..."; + @override String get transaction_priority_medium => "Medium"; @override String get transaction_details_transaction_id => "Transactie ID"; @@ -7334,8 +7336,6 @@ class $nl extends S { @override String get settings_save_recipient_address => "Adres ontvanger opslaan"; @override - String get note => "Opmerking"; - @override String get change_exchange_provider => "Wijzig Exchange Provider"; @override String get send_payment_id => "Betaling ID (facultatief)"; @@ -7904,6 +7904,8 @@ class $zh extends S { @override String get template => "模板"; @override + String get enter_your_note => "輸入您的筆記..."; + @override String get transaction_priority_medium => "介质"; @override String get transaction_details_transaction_id => "交易编号"; @@ -8046,8 +8048,6 @@ class $zh extends S { @override String get settings_save_recipient_address => "保存收件人地址"; @override - String get note => "注意"; - @override String get change_exchange_provider => "更改交易所提供商"; @override String get send_payment_id => "付款编号 (可选的)"; diff --git a/lib/src/screens/transaction_details/widgets/textfield_list_row.dart b/lib/src/screens/transaction_details/widgets/textfield_list_row.dart index 560428ff9..92e1fb601 100644 --- a/lib/src/screens/transaction_details/widgets/textfield_list_row.dart +++ b/lib/src/screens/transaction_details/widgets/textfield_list_row.dart @@ -41,8 +41,8 @@ class TextFieldListRow extends StatelessWidget { style: TextStyle( fontSize: titleFontSize, fontWeight: FontWeight.w500, - color: - Theme.of(context).primaryTextTheme.overline.color), + color: Theme.of(context) + .primaryTextTheme.overline.color), textAlign: TextAlign.left), TextField( controller: _textController, @@ -54,20 +54,16 @@ class TextFieldListRow extends StatelessWidget { fontSize: valueFontSize, fontWeight: FontWeight.w500, color: Theme.of(context) - .primaryTextTheme - .title - .color), + .primaryTextTheme.title.color), decoration: InputDecoration( isDense: true, contentPadding: EdgeInsets.only(top: 12, bottom: 0), - hintText: S.of(context).note, + hintText: S.of(context).enter_your_note, hintStyle: TextStyle( fontSize: valueFontSize, fontWeight: FontWeight.w500, color: Theme.of(context) - .primaryTextTheme - .title - .color), + .primaryTextTheme.overline.color), border: InputBorder.none ), onSubmitted: (value) => onSubmitted.call(value), diff --git a/res/values/strings_de.arb b/res/values/strings_de.arb index 20bdffedd..de7794eed 100644 --- a/res/values/strings_de.arb +++ b/res/values/strings_de.arb @@ -431,7 +431,7 @@ "bright_theme" : "Hell", "dark_theme" : "Dunkel", - "note" : "Hinweis", + "enter_your_note" : "Geben Sie Ihre Notiz ein…", "note_optional" : "Hinweis (optional)", "note_tap_to_change" : "Hinweis (zum Ändern tippen)", "transaction_key" : "Transaktionsschlüssel", diff --git a/res/values/strings_en.arb b/res/values/strings_en.arb index fbedfb6af..7906de59e 100644 --- a/res/values/strings_en.arb +++ b/res/values/strings_en.arb @@ -431,7 +431,7 @@ "bright_theme" : "Bright", "dark_theme" : "Dark", - "note" : "Note", + "enter_your_note" : "Enter your note…", "note_optional" : "Note (optional)", "note_tap_to_change" : "Note (tap to change)", "transaction_key" : "Transaction Key", diff --git a/res/values/strings_es.arb b/res/values/strings_es.arb index aa0d5836b..714dcebf8 100644 --- a/res/values/strings_es.arb +++ b/res/values/strings_es.arb @@ -431,7 +431,7 @@ "bright_theme" : "Brillante", "dark_theme" : "Oscura", - "note" : "Nota", + "enter_your_note" : "Ingresa tu nota…", "note_optional" : "Nota (opcional)", "note_tap_to_change" : "Nota (toque para cambiar)", "transaction_key" : "Clave de transacción", diff --git a/res/values/strings_hi.arb b/res/values/strings_hi.arb index 8cb9229a3..c8517f18c 100644 --- a/res/values/strings_hi.arb +++ b/res/values/strings_hi.arb @@ -431,7 +431,7 @@ "bright_theme" : "उज्ज्वल", "dark_theme" : "अंधेरा", - "note" : "नोट", + "enter_your_note" : "अपना नोट दर्ज करें ...", "note_optional" : "नोट (वैकल्पिक)", "note_tap_to_change" : "नोट (टैप टू चेंज)", "transaction_key" : "लेन-देन की", diff --git a/res/values/strings_ja.arb b/res/values/strings_ja.arb index f04e90ab2..0cfa01abf 100644 --- a/res/values/strings_ja.arb +++ b/res/values/strings_ja.arb @@ -431,7 +431,7 @@ "bright_theme" : "明るい", "dark_theme" : "闇", - "note" : "注意", + "enter_your_note" : "メモを入力してください…", "note_optional" : "注(オプション)", "note_tap_to_change" : "注(タップして変更)", "transaction_key" : "トランザクションキー", diff --git a/res/values/strings_ko.arb b/res/values/strings_ko.arb index a6b4098a2..d69ecec08 100644 --- a/res/values/strings_ko.arb +++ b/res/values/strings_ko.arb @@ -431,7 +431,7 @@ "bright_theme" : "선명한", "dark_theme" : "어두운", - "note" : "노트", + "enter_your_note" : "메모를 입력하세요…", "note_optional" : "참고 (선택 사항)", "note_tap_to_change" : "메모 (변경하려면 탭하세요)", "transaction_key" : "거래 키", diff --git a/res/values/strings_nl.arb b/res/values/strings_nl.arb index a6385c366..1129e3c88 100644 --- a/res/values/strings_nl.arb +++ b/res/values/strings_nl.arb @@ -431,7 +431,7 @@ "bright_theme" : "Helder", "dark_theme" : "Donker", - "note" : "Opmerking", + "enter_your_note" : "Voer uw notitie in ...", "note_optional" : "Opmerking (optioneel)", "note_tap_to_change" : "Opmerking (tik om te wijzigen)", "transaction_key" : "Transactiesleutel", diff --git a/res/values/strings_pl.arb b/res/values/strings_pl.arb index 4cf9ea031..657aaf53c 100644 --- a/res/values/strings_pl.arb +++ b/res/values/strings_pl.arb @@ -431,7 +431,7 @@ "bright_theme" : "Jasny", "dark_theme" : "Ciemny", - "note" : "Notatka", + "enter_your_note" : "Wpisz notatkę…", "note_optional" : "Notatka (opcjonalnie)", "note_tap_to_change" : "Notatka (dotknij, aby zmienić)", "transaction_key" : "Klucz transakcji", diff --git a/res/values/strings_pt.arb b/res/values/strings_pt.arb index 345bb9d6b..4598ca8f4 100644 --- a/res/values/strings_pt.arb +++ b/res/values/strings_pt.arb @@ -431,7 +431,7 @@ "bright_theme" : "Brilhante", "dark_theme" : "Sombria", - "note" : "Nota", + "enter_your_note" : "Insira sua nota ...", "note_optional" : "Nota (opcional)", "note_tap_to_change" : "Nota (toque para alterar)", "transaction_key" : "Chave de transação", diff --git a/res/values/strings_ru.arb b/res/values/strings_ru.arb index ca1e8af12..9c5e90809 100644 --- a/res/values/strings_ru.arb +++ b/res/values/strings_ru.arb @@ -431,7 +431,7 @@ "bright_theme" : "Яркая", "dark_theme" : "Темная", - "note" : "Примечание", + "enter_your_note" : "Введите примечание…", "note_optional" : "Примечание (необязательно)", "note_tap_to_change" : "Примечание (нажмите для изменения)", "transaction_key" : "Ключ транзакции", diff --git a/res/values/strings_uk.arb b/res/values/strings_uk.arb index 15f5d48da..a2168daba 100644 --- a/res/values/strings_uk.arb +++ b/res/values/strings_uk.arb @@ -431,7 +431,7 @@ "bright_theme" : "Яскрава", "dark_theme" : "Темна", - "note" : "Примітка", + "enter_your_note" : "Введіть примітку…", "note_optional" : "Примітка (необов’язково)", "note_tap_to_change" : "Примітка (натисніть для зміни)", "transaction_key" : "Ключ транзакції", diff --git a/res/values/strings_zh.arb b/res/values/strings_zh.arb index a63342b75..71ad80264 100644 --- a/res/values/strings_zh.arb +++ b/res/values/strings_zh.arb @@ -431,7 +431,7 @@ "bright_theme" : "亮", "dark_theme" : "黑暗", - "note" : "注意", + "enter_your_note" : "輸入您的筆記...", "note_optional" : "注意(可選)", "note_tap_to_change" : "注意(輕按即可更改)", "transaction_key" : "交易密碼", From 44536a82318f5be082cdd284f593d55bdc73d2b6 Mon Sep 17 00:00:00 2001 From: Oleksandr Sobol Date: Thu, 24 Dec 2020 10:33:11 +0200 Subject: [PATCH 11/39] CAKE-198 | fixed string resources (send_success) --- lib/generated/i18n.dart | 46 +++++++++---------- .../exchange_trade/exchange_trade_page.dart | 6 ++- lib/src/screens/send/send_page.dart | 4 +- res/values/strings_de.arb | 2 +- res/values/strings_en.arb | 2 +- res/values/strings_es.arb | 2 +- res/values/strings_hi.arb | 2 +- res/values/strings_ja.arb | 2 +- res/values/strings_ko.arb | 2 +- res/values/strings_nl.arb | 2 +- res/values/strings_pl.arb | 2 +- res/values/strings_pt.arb | 2 +- res/values/strings_ru.arb | 2 +- res/values/strings_uk.arb | 2 +- res/values/strings_zh.arb | 2 +- 15 files changed, 43 insertions(+), 37 deletions(-) diff --git a/lib/generated/i18n.dart b/lib/generated/i18n.dart index 0aea9f9c9..05ab83fbb 100644 --- a/lib/generated/i18n.dart +++ b/lib/generated/i18n.dart @@ -222,7 +222,6 @@ class S implements WidgetsLocalizations { String get send_new => "New"; String get send_payment_id => "Payment ID (optional)"; String get send_sending => "Sending..."; - String get send_success => "Your Monero was successfully sent"; String get send_templates => "Templates"; String get send_title => "Send"; String get send_xmr => "Send XMR"; @@ -362,6 +361,7 @@ class S implements WidgetsLocalizations { String router_no_route(String name) => "No route defined for ${name}"; String send_address(String cryptoCurrency) => "${cryptoCurrency} address"; String send_priority(String transactionPriority) => "Currently the fee is set at ${transactionPriority} priority.\nTransaction priority can be adjusted in the settings"; + String send_success(String crypto) => "Your ${crypto} was successfully sent"; String time(String minutes, String seconds) => "${minutes}m ${seconds}s"; String trade_details_copied(String title) => "${title} copied to Clipboard"; String trade_for_not_created(String title) => "Trade for ${title} is not created."; @@ -656,8 +656,6 @@ class $de extends S { @override String get trade_details_created_at => "Hergestellt in"; @override - String get send_success => "Ihr Monero wurde erfolgreich gesendet"; - @override String get settings_wallets => "Brieftaschen"; @override String get settings_only_transactions => "Nur Transaktionen"; @@ -1050,6 +1048,8 @@ class $de extends S { @override String change_wallet_alert_content(String wallet_name) => "Möchten Sie die aktuelle Brieftasche in ändern ${wallet_name}?"; @override + String send_success(String crypto) => "Ihr ${crypto} wurde erfolgreich gesendet"; + @override String time(String minutes, String seconds) => "${minutes}m ${seconds}s"; @override String max_value(String value, String currency) => "Max: ${value} ${currency}"; @@ -1368,8 +1368,6 @@ class $hi extends S { @override String get trade_details_created_at => "पर बनाया गया"; @override - String get send_success => "आपका Monero सफलतापूर्वक भेजा गया"; - @override String get settings_wallets => "पर्स"; @override String get settings_only_transactions => "केवल लेन-देन"; @@ -1762,6 +1760,8 @@ class $hi extends S { @override String change_wallet_alert_content(String wallet_name) => "क्या आप करंट वॉलेट को बदलना चाहते हैं ${wallet_name}?"; @override + String send_success(String crypto) => "आपका ${crypto} सफलतापूर्वक भेजा गया"; + @override String time(String minutes, String seconds) => "${minutes}m ${seconds}s"; @override String max_value(String value, String currency) => "मैक्स: ${value} ${currency}"; @@ -2080,8 +2080,6 @@ class $ru extends S { @override String get trade_details_created_at => "Создано"; @override - String get send_success => "Ваш Monero был успешно отправлен"; - @override String get settings_wallets => "Кошельки"; @override String get settings_only_transactions => "Транзакции"; @@ -2474,6 +2472,8 @@ class $ru extends S { @override String change_wallet_alert_content(String wallet_name) => "Вы хотите изменить текущий кошелек на ${wallet_name}?"; @override + String send_success(String crypto) => "Ваш ${crypto} был успешно отправлен"; + @override String time(String minutes, String seconds) => "${minutes}мин ${seconds}сек"; @override String max_value(String value, String currency) => "Макс: ${value} ${currency}"; @@ -2792,8 +2792,6 @@ class $ko extends S { @override String get trade_details_created_at => "에 작성"; @override - String get send_success => "Monero가 성공적으로 전송되었습니다"; - @override String get settings_wallets => "지갑"; @override String get settings_only_transactions => "거래 만"; @@ -3186,6 +3184,8 @@ class $ko extends S { @override String change_wallet_alert_content(String wallet_name) => "현재 지갑을 다음으로 변경 하시겠습니까 ${wallet_name}?"; @override + String send_success(String crypto) => "${crypto}가 성공적으로 전송되었습니다"; + @override String time(String minutes, String seconds) => "${minutes}m ${seconds}s"; @override String max_value(String value, String currency) => "맥스: ${value} ${currency}"; @@ -3504,8 +3504,6 @@ class $pt extends S { @override String get trade_details_created_at => "Criada em"; @override - String get send_success => "Seu Monero foi enviado com sucesso"; - @override String get settings_wallets => "Carteiras"; @override String get settings_only_transactions => "Somente transações"; @@ -3898,6 +3896,8 @@ class $pt extends S { @override String change_wallet_alert_content(String wallet_name) => "Quer mudar a carteira atual para ${wallet_name}?"; @override + String send_success(String crypto) => "Seu ${crypto} foi enviado com sucesso"; + @override String time(String minutes, String seconds) => "${minutes}m ${seconds}s"; @override String max_value(String value, String currency) => "Máx: ${value} ${currency}"; @@ -4216,8 +4216,6 @@ class $uk extends S { @override String get trade_details_created_at => "Створено"; @override - String get send_success => "Ваш Monero успішно надісланий"; - @override String get settings_wallets => "Гаманці"; @override String get settings_only_transactions => "Транзакції"; @@ -4610,6 +4608,8 @@ class $uk extends S { @override String change_wallet_alert_content(String wallet_name) => "Ви хочете змінити поточний гаманець на ${wallet_name}?"; @override + String send_success(String crypto) => "Ваш ${crypto} успішно надісланий"; + @override String time(String minutes, String seconds) => "${minutes}хв ${seconds}сек"; @override String max_value(String value, String currency) => "Макс: ${value} ${currency}"; @@ -4928,8 +4928,6 @@ class $ja extends S { @override String get trade_details_created_at => "で作成"; @override - String get send_success => "Moneroが送信されました"; - @override String get settings_wallets => "財布"; @override String get settings_only_transactions => "トランザクションのみ"; @@ -5322,6 +5320,8 @@ class $ja extends S { @override String change_wallet_alert_content(String wallet_name) => "現在のウォレットをに変更しますか ${wallet_name}?"; @override + String send_success(String crypto) => "${crypto}が送信されました"; + @override String time(String minutes, String seconds) => "${minutes}m ${seconds}s"; @override String max_value(String value, String currency) => "マックス: ${value} ${currency}"; @@ -5644,8 +5644,6 @@ class $pl extends S { @override String get trade_details_created_at => "Utworzono w"; @override - String get send_success => "Twoje Monero zostało pomyślnie wysłane"; - @override String get settings_wallets => "Portfele"; @override String get settings_only_transactions => "Tylko transakcje"; @@ -6038,6 +6036,8 @@ class $pl extends S { @override String change_wallet_alert_content(String wallet_name) => "Czy chcesz zmienić obecny portfel na ${wallet_name}?"; @override + String send_success(String crypto) => "Twoje ${crypto} zostało pomyślnie wysłane"; + @override String time(String minutes, String seconds) => "${minutes}m ${seconds}s"; @override String max_value(String value, String currency) => "Max: ${value} ${currency}"; @@ -6356,8 +6356,6 @@ class $es extends S { @override String get trade_details_created_at => "Creado en"; @override - String get send_success => "Su Monero fue enviado con éxito"; - @override String get settings_wallets => "Carteras"; @override String get settings_only_transactions => "Solo transacciones"; @@ -6750,6 +6748,8 @@ class $es extends S { @override String change_wallet_alert_content(String wallet_name) => "¿Quieres cambiar la billetera actual a ${wallet_name}?"; @override + String send_success(String crypto) => "Su ${crypto} fue enviado con éxito"; + @override String time(String minutes, String seconds) => "${minutes}m ${seconds}s"; @override String max_value(String value, String currency) => "Max: ${value} ${currency}"; @@ -7068,8 +7068,6 @@ class $nl extends S { @override String get trade_details_created_at => "Gemaakt bij"; @override - String get send_success => "Uw Monero is succesvol verzonden"; - @override String get settings_wallets => "Portemonnee"; @override String get settings_only_transactions => "Alleen transacties"; @@ -7462,6 +7460,8 @@ class $nl extends S { @override String change_wallet_alert_content(String wallet_name) => "Wilt u de huidige portemonnee wijzigen in ${wallet_name}?"; @override + String send_success(String crypto) => "Uw ${crypto} is succesvol verzonden"; + @override String time(String minutes, String seconds) => "${minutes}m ${seconds}s"; @override String max_value(String value, String currency) => "Max: ${value} ${currency}"; @@ -7780,8 +7780,6 @@ class $zh extends S { @override String get trade_details_created_at => "创建于"; @override - String get send_success => "你Monero已成功發送"; - @override String get settings_wallets => "皮夹"; @override String get settings_only_transactions => "仅交易"; @@ -8174,6 +8172,8 @@ class $zh extends S { @override String change_wallet_alert_content(String wallet_name) => "您要將當前的錢包更改為 ${wallet_name}?"; @override + String send_success(String crypto) => "你${crypto}已成功發送"; + @override String time(String minutes, String seconds) => "${minutes}m ${seconds}s"; @override String max_value(String value, String currency) => "最高: ${value} ${currency}"; diff --git a/lib/src/screens/exchange_trade/exchange_trade_page.dart b/lib/src/screens/exchange_trade/exchange_trade_page.dart index 64ff65972..e43b8d8f1 100644 --- a/lib/src/screens/exchange_trade/exchange_trade_page.dart +++ b/lib/src/screens/exchange_trade/exchange_trade_page.dart @@ -305,7 +305,11 @@ class ExchangeTradeState extends State { padding: EdgeInsets.only( top: 220, left: 24, right: 24), child: Text( - S.of(context).send_success, + S.of(context).send_success(widget + .exchangeTradeViewModel + .wallet + .currency + .toString()), textAlign: TextAlign.center, style: TextStyle( fontSize: 22, diff --git a/lib/src/screens/send/send_page.dart b/lib/src/screens/send/send_page.dart index 54bfd4a24..4ee195e16 100644 --- a/lib/src/screens/send/send_page.dart +++ b/lib/src/screens/send/send_page.dart @@ -668,7 +668,9 @@ class SendPage extends BasePage { padding: EdgeInsets.only( top: 220, left: 24, right: 24), child: Text( - S.of(context).send_success, + S.of(context).send_success( + sendViewModel.currency + .toString()), textAlign: TextAlign.center, style: TextStyle( fontSize: 22, diff --git a/res/values/strings_de.arb b/res/values/strings_de.arb index de7794eed..a77793b8e 100644 --- a/res/values/strings_de.arb +++ b/res/values/strings_de.arb @@ -212,7 +212,7 @@ "send_name" : "Name", "send_got_it" : "Ich habs", "send_sending" : "Senden...", - "send_success" : "Ihr Monero wurde erfolgreich gesendet", + "send_success" : "Ihr ${crypto} wurde erfolgreich gesendet", "settings_title" : "die Einstellungen", diff --git a/res/values/strings_en.arb b/res/values/strings_en.arb index 7906de59e..2581192d7 100644 --- a/res/values/strings_en.arb +++ b/res/values/strings_en.arb @@ -212,7 +212,7 @@ "send_name" : "Name", "send_got_it" : "Got it", "send_sending" : "Sending...", - "send_success" : "Your Monero was successfully sent", + "send_success" : "Your ${crypto} was successfully sent", "settings_title" : "Settings", diff --git a/res/values/strings_es.arb b/res/values/strings_es.arb index 714dcebf8..c504cdcdd 100644 --- a/res/values/strings_es.arb +++ b/res/values/strings_es.arb @@ -212,7 +212,7 @@ "send_name" : "Nombre", "send_got_it" : "Entendido", "send_sending" : "Enviando...", - "send_success" : "Su Monero fue enviado con éxito", + "send_success" : "Su ${crypto} fue enviado con éxito", "settings_title" : "Configuraciones", diff --git a/res/values/strings_hi.arb b/res/values/strings_hi.arb index c8517f18c..897dc46a6 100644 --- a/res/values/strings_hi.arb +++ b/res/values/strings_hi.arb @@ -212,7 +212,7 @@ "send_name" : "नाम", "send_got_it" : "समझ गया", "send_sending" : "भेजना...", - "send_success" : "आपका Monero सफलतापूर्वक भेजा गया", + "send_success" : "आपका ${crypto} सफलतापूर्वक भेजा गया", "settings_title" : "सेटिंग्स", diff --git a/res/values/strings_ja.arb b/res/values/strings_ja.arb index 0cfa01abf..5d8e9b446 100644 --- a/res/values/strings_ja.arb +++ b/res/values/strings_ja.arb @@ -212,7 +212,7 @@ "send_name" : "名前", "send_got_it" : "とった", "send_sending" : "送信...", - "send_success" : "Moneroが送信されました", + "send_success" : "${crypto}が送信されました", "settings_title" : "設定", diff --git a/res/values/strings_ko.arb b/res/values/strings_ko.arb index d69ecec08..083e8b7d3 100644 --- a/res/values/strings_ko.arb +++ b/res/values/strings_ko.arb @@ -212,7 +212,7 @@ "send_name" : "이름", "send_got_it" : "알았다", "send_sending" : "배상...", - "send_success" : "Monero가 성공적으로 전송되었습니다", + "send_success" : "${crypto}가 성공적으로 전송되었습니다", "settings_title" : "설정", diff --git a/res/values/strings_nl.arb b/res/values/strings_nl.arb index 1129e3c88..35177bcd0 100644 --- a/res/values/strings_nl.arb +++ b/res/values/strings_nl.arb @@ -212,7 +212,7 @@ "send_name" : "Naam", "send_got_it" : "Ik snap het", "send_sending" : "Bezig met verzenden...", - "send_success" : "Uw Monero is succesvol verzonden", + "send_success" : "Uw ${crypto} is succesvol verzonden", "settings_title" : "Instellingen", diff --git a/res/values/strings_pl.arb b/res/values/strings_pl.arb index 657aaf53c..1b60656a7 100644 --- a/res/values/strings_pl.arb +++ b/res/values/strings_pl.arb @@ -212,7 +212,7 @@ "send_name" : "Imię", "send_got_it" : "Rozumiem", "send_sending" : "Wysyłanie...", - "send_success" : "Twoje Monero zostało pomyślnie wysłane", + "send_success" : "Twoje ${crypto} zostało pomyślnie wysłane", "settings_title" : "Ustawienia", diff --git a/res/values/strings_pt.arb b/res/values/strings_pt.arb index 4598ca8f4..229bf3171 100644 --- a/res/values/strings_pt.arb +++ b/res/values/strings_pt.arb @@ -212,7 +212,7 @@ "send_name" : "Nome", "send_got_it" : "Entendi", "send_sending" : "Enviando...", - "send_success" : "Seu Monero foi enviado com sucesso", + "send_success" : "Seu ${crypto} foi enviado com sucesso", "settings_title" : "Configurações", diff --git a/res/values/strings_ru.arb b/res/values/strings_ru.arb index 9c5e90809..6f8a6a6bf 100644 --- a/res/values/strings_ru.arb +++ b/res/values/strings_ru.arb @@ -212,7 +212,7 @@ "send_name" : "Имя", "send_got_it" : "Понял", "send_sending" : "Отправка...", - "send_success" : "Ваш Monero был успешно отправлен", + "send_success" : "Ваш ${crypto} был успешно отправлен", "settings_title" : "Настройки", diff --git a/res/values/strings_uk.arb b/res/values/strings_uk.arb index a2168daba..feea0f34d 100644 --- a/res/values/strings_uk.arb +++ b/res/values/strings_uk.arb @@ -212,7 +212,7 @@ "send_name" : "Ім'я", "send_got_it" : "Зрозумів", "send_sending" : "Відправлення...", - "send_success" : "Ваш Monero успішно надісланий", + "send_success" : "Ваш ${crypto} успішно надісланий", "settings_title" : "Налаштування", diff --git a/res/values/strings_zh.arb b/res/values/strings_zh.arb index 71ad80264..bec7f068b 100644 --- a/res/values/strings_zh.arb +++ b/res/values/strings_zh.arb @@ -212,7 +212,7 @@ "send_name" : "名稱", "send_got_it" : "得到它了", "send_sending" : "正在發送...", - "send_success" : "你Monero已成功發送", + "send_success" : "你${crypto}已成功發送", "settings_title" : "设定值", From ac883f3b16833a423809de5a3d137980851f8069 Mon Sep 17 00:00:00 2001 From: OleksandrSobol Date: Thu, 24 Dec 2020 11:01:27 +0200 Subject: [PATCH 12/39] CAKE-198 | fixed saving transaction description in the send_view_model.dart --- lib/view_model/send/send_view_model.dart | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/lib/view_model/send/send_view_model.dart b/lib/view_model/send/send_view_model.dart index c56230c59..d61ac3f96 100644 --- a/lib/view_model/send/send_view_model.dart +++ b/lib/view_model/send/send_view_model.dart @@ -129,8 +129,7 @@ abstract class SendViewModelBase with Store { state = TransactionCommitting(); await pendingTransaction.commit(); - if (_settingsStore.shouldSaveRecipientAddress && - (pendingTransaction.id?.isNotEmpty ?? false)) { + if (pendingTransaction.id?.isNotEmpty ?? false) { await transactionDescriptionBox.add(TransactionDescription( id: pendingTransaction.id, recipientAddress: address, transactionNote: note)); From 2d49d4f093b1a900e95dc15a92d6d59a1238770d Mon Sep 17 00:00:00 2001 From: OleksandrSobol Date: Thu, 24 Dec 2020 12:04:23 +0200 Subject: [PATCH 13/39] CAKE-198 | fixed saving transaction description in the send_view_model.dart --- lib/view_model/send/send_view_model.dart | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/lib/view_model/send/send_view_model.dart b/lib/view_model/send/send_view_model.dart index d61ac3f96..a3f84fcd4 100644 --- a/lib/view_model/send/send_view_model.dart +++ b/lib/view_model/send/send_view_model.dart @@ -130,9 +130,12 @@ abstract class SendViewModelBase with Store { await pendingTransaction.commit(); if (pendingTransaction.id?.isNotEmpty ?? false) { - await transactionDescriptionBox.add(TransactionDescription( + _settingsStore.shouldSaveRecipientAddress + ? await transactionDescriptionBox.add(TransactionDescription( id: pendingTransaction.id, recipientAddress: address, - transactionNote: note)); + transactionNote: note)) + : await transactionDescriptionBox.add(TransactionDescription( + id: pendingTransaction.id, transactionNote: note)); } state = TransactionCommitted(); From bf98c72f6726c59faed4f35ae999fe4ce2e5d35b Mon Sep 17 00:00:00 2001 From: OleksandrSobol Date: Thu, 24 Dec 2020 22:22:29 +0200 Subject: [PATCH 14/39] CAKE-216 | merged 4.1.0 branch into current and resolved problems --- lib/src/screens/exchange_trade/exchange_trade_page.dart | 2 -- 1 file changed, 2 deletions(-) diff --git a/lib/src/screens/exchange_trade/exchange_trade_page.dart b/lib/src/screens/exchange_trade/exchange_trade_page.dart index 0a73556fb..81449fb0e 100644 --- a/lib/src/screens/exchange_trade/exchange_trade_page.dart +++ b/lib/src/screens/exchange_trade/exchange_trade_page.dart @@ -6,8 +6,6 @@ import 'package:flutter/cupertino.dart'; import 'package:flutter/services.dart'; import 'package:cake_wallet/generated/i18n.dart'; import 'package:cake_wallet/core/execution_state.dart'; -import 'package:cake_wallet/entities/crypto_currency.dart'; -import 'package:cake_wallet/exchange/exchange_provider_description.dart'; import 'package:cake_wallet/src/screens/exchange_trade/information_page.dart'; import 'package:cake_wallet/src/screens/send/widgets/confirm_sending_alert.dart'; import 'package:cake_wallet/src/widgets/standart_list_row.dart'; From d93c706997031ac9b18a3be4ccc0c00bb77e5664 Mon Sep 17 00:00:00 2001 From: OleksandrSobol Date: Thu, 24 Dec 2020 22:57:32 +0200 Subject: [PATCH 15/39] CAKE-208 | changed MoneroBalance to Balance property and handled BitcoinBalance case in the balance_view_model.dart --- .../dashboard/balance_view_model.dart | 60 ++++++++++++------- 1 file changed, 39 insertions(+), 21 deletions(-) diff --git a/lib/view_model/dashboard/balance_view_model.dart b/lib/view_model/dashboard/balance_view_model.dart index a7bc575bd..0c4272343 100644 --- a/lib/view_model/dashboard/balance_view_model.dart +++ b/lib/view_model/dashboard/balance_view_model.dart @@ -1,5 +1,7 @@ +import 'package:cake_wallet/bitcoin/bitcoin_balance.dart'; import 'package:cake_wallet/bitcoin/bitcoin_wallet.dart'; import 'package:cake_wallet/core/wallet_base.dart'; +import 'package:cake_wallet/entities/balance.dart'; import 'package:cake_wallet/entities/crypto_currency.dart'; import 'package:cake_wallet/monero/monero_balance.dart'; import 'package:cake_wallet/monero/monero_wallet.dart'; @@ -31,10 +33,17 @@ abstract class BalanceViewModelBase with Store { final _wallet = wallet; if (_wallet is MoneroWallet) { - moneroBalance = _wallet.balance; + balance = _wallet.balance; _onMoneroBalanceChangeReaction = reaction((_) => _wallet.balance, - (MoneroBalance balance) => moneroBalance = balance); + (MoneroBalance moneroBalance) => balance = moneroBalance); + } + + if (_wallet is BitcoinWallet) { + balance = _wallet.balance; + + _onBitcoinBalanceChangeReaction = reaction((_) => _wallet.balance, + (BitcoinBalance bitcoinBalance) => balance = bitcoinBalance); } } @@ -49,7 +58,7 @@ abstract class BalanceViewModelBase with Store { bool isReversing; @observable - MoneroBalance moneroBalance; + Balance balance; @observable WalletBase wallet; @@ -70,24 +79,24 @@ abstract class BalanceViewModelBase with Store { @computed String get cryptoBalance { final walletBalance = _walletBalance; - var balance = '---'; + var _balance = '---'; if (displayMode == BalanceDisplayMode.availableBalance) { - balance = walletBalance.unlockedBalance ?? '0.0'; + _balance = walletBalance.unlockedBalance ?? '0.0'; } if (displayMode == BalanceDisplayMode.fullBalance) { - balance = walletBalance.totalBalance ?? '0.0'; + _balance = walletBalance.totalBalance ?? '0.0'; } - return balance; + return _balance; } @computed String get fiatBalance { final walletBalance = _walletBalance; final fiatCurrency = settingsStore.fiatCurrency; - var balance = '---'; + var _balance = '---'; final totalBalance = _getFiatBalance(price: price, cryptoAmount: walletBalance.totalBalance); @@ -96,30 +105,30 @@ abstract class BalanceViewModelBase with Store { price: price, cryptoAmount: walletBalance.unlockedBalance); if (displayMode == BalanceDisplayMode.availableBalance) { - balance = fiatCurrency.toString() + ' ' + unlockedBalance ?? '0.00'; + _balance = fiatCurrency.toString() + ' ' + unlockedBalance ?? '0.00'; } if (displayMode == BalanceDisplayMode.fullBalance) { - balance = fiatCurrency.toString() + ' ' + totalBalance ?? '0.00'; + _balance = fiatCurrency.toString() + ' ' + totalBalance ?? '0.00'; } - return balance; + return _balance; } @computed WalletBalance get _walletBalance { - final _wallet = wallet; + final _balance = balance; - if (_wallet is MoneroWallet) { + if (_balance is MoneroBalance) { return WalletBalance( - unlockedBalance: moneroBalance.formattedUnlockedBalance, - totalBalance: moneroBalance.formattedFullBalance); + unlockedBalance: _balance.formattedUnlockedBalance, + totalBalance: _balance.formattedFullBalance); } - if (_wallet is BitcoinWallet) { + if (_balance is BitcoinBalance) { return WalletBalance( - unlockedBalance: _wallet.balance.availableBalanceFormatted, - totalBalance: _wallet.balance.totalFormatted); + unlockedBalance: _balance.availableBalanceFormatted, + totalBalance: _balance.totalFormatted); } return null; @@ -133,17 +142,26 @@ abstract class BalanceViewModelBase with Store { this.wallet = wallet; if (wallet is MoneroWallet) { - moneroBalance = wallet.balance; + balance = wallet.balance; _onMoneroBalanceChangeReaction?.reaction?.dispose(); _onMoneroBalanceChangeReaction = reaction((_) => wallet.balance, - (MoneroBalance balance) => moneroBalance = balance); + (MoneroBalance moneroBalance) => balance = moneroBalance); + } + + if (wallet is BitcoinWallet) { + balance = wallet.balance; + + _onBitcoinBalanceChangeReaction?.reaction?.dispose(); + + _onBitcoinBalanceChangeReaction = reaction((_) => wallet.balance, + (BitcoinBalance bitcoinBalance) => balance = bitcoinBalance); } } ReactionDisposer _onMoneroBalanceChangeReaction; - + ReactionDisposer _onBitcoinBalanceChangeReaction; ReactionDisposer _reaction; String _getFiatBalance({double price, String cryptoAmount}) { From 84ad97c0b01b1da850d43f0f87edc11ee9ac2448 Mon Sep 17 00:00:00 2001 From: M Date: Tue, 29 Dec 2020 18:55:58 +0200 Subject: [PATCH 16/39] Fixes for 4.0.94. Changed version for 4.0.94. --- .../exceptions/wallet_loading_exception.dart | 8 ----- .../exceptions/wallet_opening_exception.dart | 8 +++++ cw_monero/lib/wallet_manager.dart | 4 +-- lib/monero/monero_wallet_service.dart | 33 +++++++++---------- pubspec.yaml | 2 +- 5 files changed, 26 insertions(+), 29 deletions(-) delete mode 100644 cw_monero/lib/exceptions/wallet_loading_exception.dart create mode 100644 cw_monero/lib/exceptions/wallet_opening_exception.dart diff --git a/cw_monero/lib/exceptions/wallet_loading_exception.dart b/cw_monero/lib/exceptions/wallet_loading_exception.dart deleted file mode 100644 index b0594c6e5..000000000 --- a/cw_monero/lib/exceptions/wallet_loading_exception.dart +++ /dev/null @@ -1,8 +0,0 @@ -class WalletLoadingException implements Exception { - WalletLoadingException({this.message}); - - final String message; - - @override - String toString() => message; -} \ No newline at end of file diff --git a/cw_monero/lib/exceptions/wallet_opening_exception.dart b/cw_monero/lib/exceptions/wallet_opening_exception.dart new file mode 100644 index 000000000..8d84b0f7e --- /dev/null +++ b/cw_monero/lib/exceptions/wallet_opening_exception.dart @@ -0,0 +1,8 @@ +class WalletOpeningException implements Exception { + WalletOpeningException({this.message}); + + final String message; + + @override + String toString() => message; +} \ No newline at end of file diff --git a/cw_monero/lib/wallet_manager.dart b/cw_monero/lib/wallet_manager.dart index ad2087361..e48055cf9 100644 --- a/cw_monero/lib/wallet_manager.dart +++ b/cw_monero/lib/wallet_manager.dart @@ -1,4 +1,5 @@ import 'dart:ffi'; +import 'package:cw_monero/exceptions/wallet_opening_exception.dart'; import 'package:cw_monero/wallet.dart'; import 'package:ffi/ffi.dart'; import 'package:flutter/foundation.dart'; @@ -7,7 +8,6 @@ import 'package:cw_monero/signatures.dart'; import 'package:cw_monero/types.dart'; import 'package:cw_monero/monero_api.dart'; import 'package:cw_monero/exceptions/wallet_creation_exception.dart'; -import 'package:cw_monero/exceptions/wallet_loading_exception.dart'; import 'package:cw_monero/exceptions/wallet_restore_from_keys_exception.dart'; import 'package:cw_monero/exceptions/wallet_restore_from_seed_exception.dart'; @@ -146,7 +146,7 @@ void loadWallet({String path, String password, int nettype = 0}) { free(passwordPointer); if (!loaded) { - throw WalletLoadingException( + throw WalletOpeningException( message: convertUTF8ToString(pointer: errorStringNative())); } } diff --git a/lib/monero/monero_wallet_service.dart b/lib/monero/monero_wallet_service.dart index fb1bdb4c4..d964f0232 100644 --- a/lib/monero/monero_wallet_service.dart +++ b/lib/monero/monero_wallet_service.dart @@ -3,7 +3,7 @@ import 'package:cake_wallet/core/wallet_base.dart'; import 'package:hive/hive.dart'; import 'package:cw_monero/wallet_manager.dart' as monero_wallet_manager; import 'package:cw_monero/wallet.dart' as monero_wallet; -import 'package:cw_monero/exceptions/wallet_loading_exception.dart'; +import 'package:cw_monero/exceptions/wallet_opening_exception.dart'; import 'package:cake_wallet/monero/monero_wallet.dart'; import 'package:cake_wallet/core/wallet_credentials.dart'; import 'package:cake_wallet/core/wallet_service.dart'; @@ -56,7 +56,7 @@ class MoneroWalletService extends WalletService< final Box walletInfoSource; - static void _removeCache(String name) async { + static Future _removeCache(String name) async { final path = await pathForWallet(name: name, type: WalletType.monero); final cacheFile = File(path); @@ -65,6 +65,9 @@ class MoneroWalletService extends WalletService< } } + static bool walletFilesExist(String path) => + !File(path).existsSync() && !File('$path.keys').existsSync(); + @override Future create(MoneroNewWalletCredentials credentials) async { try { @@ -104,7 +107,7 @@ class MoneroWalletService extends WalletService< try { final path = await pathForWallet(name: name, type: WalletType.monero); - if (!File(path).existsSync()) { + if (walletFilesExist(path)) { await repairOldAndroidWallet(name); } @@ -118,17 +121,9 @@ class MoneroWalletService extends WalletService< final isValid = wallet.validate(); if (!isValid) { - // if (wallet.seed?.isNotEmpty ?? false) { - // let restore from seed in this case; - // final seed = wallet.seed; - // final credentials = MoneroRestoreWalletFromSeedCredentials( - // name: name, password: password, mnemonic: seed, height: 2000000) - // ..walletInfo = walletInfo; - // await remove(name); - // return restoreFromSeed(credentials); - // } - - throw MoneroWalletLoadingException(); + await _removeCache(name); + wallet.close(); + return openWallet(name, password); } await wallet.init(); @@ -137,8 +132,11 @@ class MoneroWalletService extends WalletService< } catch (e) { // TODO: Implement Exception for wallet list service. - if (e.message == 'std::bad_alloc') { - _removeCache(name); + if (e.toString().contains('bad_alloc') || + (e is WalletOpeningException && + (e.message == 'std::bad_alloc' || + e.message.contains('bad_alloc')))) { + await _removeCache(name); return openWallet(name, password); } @@ -219,7 +217,7 @@ class MoneroWalletService extends WalletService< final dir = Directory(oldAndroidWalletDirPath); if (!dir.existsSync()) { - throw MoneroWalletLoadingException(); + return; } final newWalletDirPath = @@ -238,7 +236,6 @@ class MoneroWalletService extends WalletService< }); } catch (e) { print(e.toString()); - throw MoneroWalletLoadingException(); } } } diff --git a/pubspec.yaml b/pubspec.yaml index 3e680b605..851dec206 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -11,7 +11,7 @@ description: Cake Wallet. # In iOS, build-name is used as CFBundleShortVersionString while build-number used as CFBundleVersion. # Read more about iOS versioning at # https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html -version: 4.0.92+23 +version: 4.0.94+25 environment: sdk: ">=2.7.0 <3.0.0" From 1c2b8c20236db078d7e953e78cebb061b4b5ff5b Mon Sep 17 00:00:00 2001 From: M Date: Tue, 29 Dec 2020 19:22:22 +0200 Subject: [PATCH 17/39] Changed iOS project version to 4.0.94. --- ios/Runner.xcodeproj/project.pbxproj | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/ios/Runner.xcodeproj/project.pbxproj b/ios/Runner.xcodeproj/project.pbxproj index a77e4e4c8..4d74d0752 100644 --- a/ios/Runner.xcodeproj/project.pbxproj +++ b/ios/Runner.xcodeproj/project.pbxproj @@ -371,7 +371,7 @@ "$(inherited)", "$(PROJECT_DIR)/Flutter", ); - MARKETING_VERSION = 4.0.92; + MARKETING_VERSION = 4.0.94; PRODUCT_BUNDLE_IDENTIFIER = com.fotolockr.cakewallet; PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; @@ -511,7 +511,7 @@ "$(inherited)", "$(PROJECT_DIR)/Flutter", ); - MARKETING_VERSION = 4.0.92; + MARKETING_VERSION = 4.0.94; PRODUCT_BUNDLE_IDENTIFIER = com.fotolockr.cakewallet; PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; @@ -545,7 +545,7 @@ "$(inherited)", "$(PROJECT_DIR)/Flutter", ); - MARKETING_VERSION = 4.0.92; + MARKETING_VERSION = 4.0.94; PRODUCT_BUNDLE_IDENTIFIER = com.fotolockr.cakewallet; PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; From ac1709bffb1d700318984d801ad9291b1def1ab4 Mon Sep 17 00:00:00 2001 From: OleksandrSobol Date: Tue, 29 Dec 2020 20:48:57 +0200 Subject: [PATCH 18/39] CAKE-221 | added fiat amount to estimated fee; reworked confirm_sending_alert.dart; applied alert when transaction was committed --- lib/src/screens/send/send_page.dart | 149 ++++++----------- .../send/widgets/confirm_sending_alert.dart | 150 ++++++++++++++---- lib/src/widgets/base_alert_dialog.dart | 31 ++-- lib/view_model/send/send_view_model.dart | 29 ++++ 4 files changed, 215 insertions(+), 144 deletions(-) diff --git a/lib/src/screens/send/send_page.dart b/lib/src/screens/send/send_page.dart index 1a18b5ba6..2ca9372a5 100644 --- a/lib/src/screens/send/send_page.dart +++ b/lib/src/screens/send/send_page.dart @@ -313,6 +313,7 @@ class SendPage extends BasePage { child: Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, + crossAxisAlignment: CrossAxisAlignment.start, children: [ Text( S @@ -326,23 +327,50 @@ class SendPage extends BasePage { color: Colors.white)), Container( child: Row( + crossAxisAlignment: CrossAxisAlignment.start, children: [ - Text( - sendViewModel + Column( + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.end, + children: [ + Text( + sendViewModel .estimatedFee .toString() + - ' ' + - sendViewModel + ' ' + + sendViewModel .currency.title, - style: TextStyle( - fontSize: 12, - fontWeight: + style: TextStyle( + fontSize: 12, + fontWeight: FontWeight.w600, - //color: Theme.of(context).primaryTextTheme.display2.color, - color: + //color: Theme.of(context).primaryTextTheme.display2.color, + color: Colors.white)), + Padding( + padding: + EdgeInsets.only(top: 5), + child: Text( + sendViewModel + .estimatedFeeFiatAmount + + ' ' + + sendViewModel + .fiat.title, + style: TextStyle( + fontSize: 12, + fontWeight: + FontWeight.w600, + color: Theme + .of(context) + .primaryTextTheme + .headline + .decorationColor)) + ), + ], + ), Padding( padding: EdgeInsets.only( + top: 2, left: 5), child: Icon( Icons.arrow_forward_ios, @@ -596,8 +624,14 @@ class SendPage extends BasePage { amount: S.of(context).send_amount, amountValue: sendViewModel.pendingTransaction.amountFormatted, + fiatAmountValue: sendViewModel.pendingTransactionFiatAmount + + ' ' + sendViewModel.fiat.title, fee: S.of(context).send_fee, feeValue: sendViewModel.pendingTransaction.feeFormatted, + transactionPriority: sendViewModel + .transactionPriority.toString(), + recipientTitle: 'Recipient address', + recipientAddress: sendViewModel.address, rightButtonText: S.of(context).ok, leftButtonText: S.of(context).cancel, actionRightButton: () { @@ -614,96 +648,17 @@ class SendPage extends BasePage { } if (state is TransactionCommitted) { - return Stack( - children: [ - Container( - color: Theme.of(context).backgroundColor, - child: Center( - child: Image.asset( - 'assets/images/birthday_cake.png'), - ), - ), - Center( - child: Padding( - padding: EdgeInsets.only( - top: 220, left: 24, right: 24), - child: Text( - S.of(context).send_success( - sendViewModel.currency - .toString()), - textAlign: TextAlign.center, - style: TextStyle( - fontSize: 22, - fontWeight: FontWeight.bold, - color: Theme.of(context) - .primaryTextTheme - .title - .color, - decoration: TextDecoration.none, - ), - ), - ), - ), - Positioned( - left: 24, - right: 24, - bottom: 24, - child: PrimaryButton( - onPressed: () => - Navigator.of(context).pop(), - text: S.of(context).send_got_it, - color: Theme.of(context) - .accentTextTheme - .body2 - .color, - textColor: Colors.white)) - ], - ); + return AlertWithOneAction( + alertTitle: '', + alertContent: S.of(context).send_success( + sendViewModel.currency + .toString()), + buttonText: S.of(context).ok, + buttonAction: () => + Navigator.of(context).pop()); } - if (state is TransactionCommitting) { - return Stack( - children: [ - Container( - color: Theme.of(context).backgroundColor, - child: Center( - child: Image.asset( - 'assets/images/birthday_cake.png'), - ), - ), - BackdropFilter( - filter: ImageFilter.blur( - sigmaX: 3.0, sigmaY: 3.0), - child: Container( - decoration: BoxDecoration( - color: Theme.of(context) - .backgroundColor - .withOpacity(0.25)), - child: Center( - child: Padding( - padding: EdgeInsets.only(top: 220), - child: Text( - S.of(context).send_sending, - textAlign: TextAlign.center, - style: TextStyle( - fontSize: 22, - fontWeight: FontWeight.bold, - color: Theme.of(context) - .primaryTextTheme - .title - .color, - decoration: TextDecoration.none, - ), - ), - ), - ), - ), - ) - ], - ); - } - - return Container(); + return Offstage(); }); }); }, diff --git a/lib/src/screens/send/widgets/confirm_sending_alert.dart b/lib/src/screens/send/widgets/confirm_sending_alert.dart index 07976ce12..3d0c8bf0a 100644 --- a/lib/src/screens/send/widgets/confirm_sending_alert.dart +++ b/lib/src/screens/send/widgets/confirm_sending_alert.dart @@ -1,3 +1,4 @@ +import 'package:cake_wallet/palette.dart'; import 'package:flutter/material.dart'; import 'package:cake_wallet/src/widgets/base_alert_dialog.dart'; @@ -6,8 +7,12 @@ class ConfirmSendingAlert extends BaseAlertDialog { @required this.alertTitle, @required this.amount, @required this.amountValue, + @required this.fiatAmountValue, @required this.fee, @required this.feeValue, + @required this.transactionPriority, + @required this.recipientTitle, + @required this.recipientAddress, @required this.leftButtonText, @required this.rightButtonText, @required this.actionLeftButton, @@ -18,8 +23,12 @@ class ConfirmSendingAlert extends BaseAlertDialog { final String alertTitle; final String amount; final String amountValue; + final String fiatAmountValue; final String fee; final String feeValue; + final String transactionPriority; + final String recipientTitle; + final String recipientAddress; final String leftButtonText; final String rightButtonText; final VoidCallback actionLeftButton; @@ -29,74 +38,145 @@ class ConfirmSendingAlert extends BaseAlertDialog { @override String get titleText => alertTitle; + @override + bool get isDividerExists => true; + @override String get leftActionButtonText => leftButtonText; + @override String get rightActionButtonText => rightButtonText; + @override VoidCallback get actionLeft => actionLeftButton; + @override VoidCallback get actionRight => actionRightButton; + @override bool get barrierDismissible => alertBarrierDismissible; @override Widget content(BuildContext context) { return Column( - mainAxisSize: MainAxisSize.max, - mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ Row( mainAxisSize: MainAxisSize.max, mainAxisAlignment: MainAxisAlignment.spaceBetween, + crossAxisAlignment: CrossAxisAlignment.start, children: [ Text( amount, style: TextStyle( fontSize: 16, - fontWeight: FontWeight.w600, + fontWeight: FontWeight.normal, fontFamily: 'Lato', color: Theme.of(context).primaryTextTheme.title.color, decoration: TextDecoration.none, ), ), - Text( - amountValue, - style: TextStyle( - fontSize: 16, - fontWeight: FontWeight.w600, - fontFamily: 'Lato', - color: Theme.of(context).primaryTextTheme.title.color, - decoration: TextDecoration.none, - ), + Column( + crossAxisAlignment: CrossAxisAlignment.end, + children: [ + Text( + amountValue, + style: TextStyle( + fontSize: 18, + fontWeight: FontWeight.w600, + fontFamily: 'Lato', + color: Theme.of(context).primaryTextTheme.title.color, + decoration: TextDecoration.none, + ), + ), + Text( + fiatAmountValue, + style: TextStyle( + fontSize: 12, + fontWeight: FontWeight.w600, + fontFamily: 'Lato', + color: PaletteDark.pigeonBlue, + decoration: TextDecoration.none, + ), + ) + ], ) ], ), - Row( - mainAxisSize: MainAxisSize.max, - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Text( - fee, - style: TextStyle( - fontSize: 16, - fontWeight: FontWeight.w600, - fontFamily: 'Lato', - color: Theme.of(context).primaryTextTheme.title.color, - decoration: TextDecoration.none, + Padding( + padding: EdgeInsets.only(top: 16), + child: Row( + mainAxisSize: MainAxisSize.max, + mainAxisAlignment: MainAxisAlignment.spaceBetween, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + fee, + style: TextStyle( + fontSize: 16, + fontWeight: FontWeight.normal, + fontFamily: 'Lato', + color: Theme.of(context).primaryTextTheme.title.color, + decoration: TextDecoration.none, + ), ), - ), - Text( - feeValue, - style: TextStyle( - fontSize: 16, - fontWeight: FontWeight.w600, - fontFamily: 'Lato', - color: Theme.of(context).primaryTextTheme.title.color, - decoration: TextDecoration.none, + Column( + crossAxisAlignment: CrossAxisAlignment.end, + children: [ + Text( + feeValue, + style: TextStyle( + fontSize: 18, + fontWeight: FontWeight.w600, + fontFamily: 'Lato', + color: Theme.of(context).primaryTextTheme.title.color, + decoration: TextDecoration.none, + ), + ), + Text( + transactionPriority, + style: TextStyle( + fontSize: 12, + fontWeight: FontWeight.w600, + fontFamily: 'Lato', + color: PaletteDark.pigeonBlue, + decoration: TextDecoration.none, + ), + ) + ], + ) + ], + ) + ), + Padding( + padding: EdgeInsets.fromLTRB(8, 16, 8, 0), + child: Column( + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + Text( + recipientTitle, + style: TextStyle( + fontSize: 16, + fontWeight: FontWeight.normal, + fontFamily: 'Lato', + color: Theme.of(context).primaryTextTheme.title.color, + decoration: TextDecoration.none, + ), ), - ) - ], + Padding( + padding: EdgeInsets.only(top: 8), + child: Text( + recipientAddress, + style: TextStyle( + fontSize: 12, + fontWeight: FontWeight.w600, + fontFamily: 'Lato', + color: PaletteDark.pigeonBlue, + decoration: TextDecoration.none, + ), + ) + ) + ], + ), ) ], ); diff --git a/lib/src/widgets/base_alert_dialog.dart b/lib/src/widgets/base_alert_dialog.dart index 19c00ca43..b51eb0d69 100644 --- a/lib/src/widgets/base_alert_dialog.dart +++ b/lib/src/widgets/base_alert_dialog.dart @@ -7,6 +7,7 @@ class BaseAlertDialog extends StatelessWidget { String get contentText => ''; String get leftActionButtonText => ''; String get rightActionButtonText => ''; + bool get isDividerExists => false; VoidCallback get actionLeft => () {}; VoidCallback get actionRight => () {}; bool get barrierDismissible => true; @@ -127,18 +128,24 @@ class BaseAlertDialog extends StatelessWidget { child: Column( mainAxisSize: MainAxisSize.min, children: [ - Container( - padding: EdgeInsets.fromLTRB(24, 32, 24, 32), - child: Column( - crossAxisAlignment: CrossAxisAlignment.center, - children: [ - title(context), - Padding( - padding: EdgeInsets.only(top: 8), - child: content(context), - ) - ], - ), + Column( + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + Padding( + padding: EdgeInsets.fromLTRB(24, 32, 24, 16), + child: title(context), + ), + isDividerExists + ? Container( + height: 1, + color: Theme.of(context).dividerColor, + ) + : Offstage(), + Padding( + padding: EdgeInsets.fromLTRB(24, 16, 24, 32), + child: content(context), + ) + ], ), Container( height: 1, diff --git a/lib/view_model/send/send_view_model.dart b/lib/view_model/send/send_view_model.dart index f3d46ccb3..363c42d17 100644 --- a/lib/view_model/send/send_view_model.dart +++ b/lib/view_model/send/send_view_model.dart @@ -1,4 +1,5 @@ import 'package:cake_wallet/entities/balance_display_mode.dart'; +import 'package:cake_wallet/entities/calculate_fiat_amount_raw.dart'; import 'package:cake_wallet/entities/transaction_description.dart'; import 'package:hive/hive.dart'; import 'package:intl/intl.dart'; @@ -60,6 +61,34 @@ abstract class SendViewModelBase with Store { double get estimatedFee => _wallet.calculateEstimatedFee(_settingsStore.transactionPriority); + @computed + String get estimatedFeeFiatAmount { + try { + final fiat = calculateFiatAmountRaw( + price: _fiatConversationStore.prices[_wallet.currency], + cryptoAmount: estimatedFee); + return fiat; + } catch (_) { + return '0.00'; + } + } + + @computed + String get pendingTransactionFiatAmount { + try { + if (pendingTransaction != null) { + final fiat = calculateFiatAmount( + price: _fiatConversationStore.prices[_wallet.currency], + cryptoAmount: pendingTransaction.amountFormatted); + return fiat; + } else { + return '0.00'; + } + } catch (_) { + return '0.00'; + } + } + FiatCurrency get fiat => _settingsStore.fiatCurrency; TransactionPriority get transactionPriority => From 823e9d11ae631c526d08aac8a5e13dabf234f5a3 Mon Sep 17 00:00:00 2001 From: OleksandrSobol Date: Wed, 30 Dec 2020 16:54:55 +0200 Subject: [PATCH 19/39] CAKE-221 | added pendingTransactionFeeFiatAmount getter to send_view_model.dart; applied feeFiatAmount property instead transactionPriority in the confirm_sending_alert.dart; fixed base_alert_dialog.dart --- lib/src/screens/send/send_page.dart | 4 ++-- .../send/widgets/confirm_sending_alert.dart | 6 +++--- lib/src/widgets/base_alert_dialog.dart | 13 ++++++++----- lib/view_model/send/send_view_model.dart | 16 ++++++++++++++++ 4 files changed, 29 insertions(+), 10 deletions(-) diff --git a/lib/src/screens/send/send_page.dart b/lib/src/screens/send/send_page.dart index 2ca9372a5..cdcbb726f 100644 --- a/lib/src/screens/send/send_page.dart +++ b/lib/src/screens/send/send_page.dart @@ -628,8 +628,8 @@ class SendPage extends BasePage { + ' ' + sendViewModel.fiat.title, fee: S.of(context).send_fee, feeValue: sendViewModel.pendingTransaction.feeFormatted, - transactionPriority: sendViewModel - .transactionPriority.toString(), + feeFiatAmount: sendViewModel.pendingTransactionFeeFiatAmount + + ' ' + sendViewModel.fiat.title, recipientTitle: 'Recipient address', recipientAddress: sendViewModel.address, rightButtonText: S.of(context).ok, diff --git a/lib/src/screens/send/widgets/confirm_sending_alert.dart b/lib/src/screens/send/widgets/confirm_sending_alert.dart index 3d0c8bf0a..458c34432 100644 --- a/lib/src/screens/send/widgets/confirm_sending_alert.dart +++ b/lib/src/screens/send/widgets/confirm_sending_alert.dart @@ -10,7 +10,7 @@ class ConfirmSendingAlert extends BaseAlertDialog { @required this.fiatAmountValue, @required this.fee, @required this.feeValue, - @required this.transactionPriority, + @required this.feeFiatAmount, @required this.recipientTitle, @required this.recipientAddress, @required this.leftButtonText, @@ -26,7 +26,7 @@ class ConfirmSendingAlert extends BaseAlertDialog { final String fiatAmountValue; final String fee; final String feeValue; - final String transactionPriority; + final String feeFiatAmount; final String recipientTitle; final String recipientAddress; final String leftButtonText; @@ -133,7 +133,7 @@ class ConfirmSendingAlert extends BaseAlertDialog { ), ), Text( - transactionPriority, + feeFiatAmount, style: TextStyle( fontSize: 12, fontWeight: FontWeight.w600, diff --git a/lib/src/widgets/base_alert_dialog.dart b/lib/src/widgets/base_alert_dialog.dart index b51eb0d69..7d1551100 100644 --- a/lib/src/widgets/base_alert_dialog.dart +++ b/lib/src/widgets/base_alert_dialog.dart @@ -132,17 +132,20 @@ class BaseAlertDialog extends StatelessWidget { crossAxisAlignment: CrossAxisAlignment.center, children: [ Padding( - padding: EdgeInsets.fromLTRB(24, 32, 24, 16), + padding: EdgeInsets.fromLTRB(24, 32, 24, 0), child: title(context), ), isDividerExists - ? Container( - height: 1, - color: Theme.of(context).dividerColor, + ? Padding( + padding: EdgeInsets.only(top: 16, bottom: 8), + child: Container( + height: 1, + color: Theme.of(context).dividerColor, + ), ) : Offstage(), Padding( - padding: EdgeInsets.fromLTRB(24, 16, 24, 32), + padding: EdgeInsets.fromLTRB(24, 8, 24, 32), child: content(context), ) ], diff --git a/lib/view_model/send/send_view_model.dart b/lib/view_model/send/send_view_model.dart index 363c42d17..b644dc618 100644 --- a/lib/view_model/send/send_view_model.dart +++ b/lib/view_model/send/send_view_model.dart @@ -89,6 +89,22 @@ abstract class SendViewModelBase with Store { } } + @computed + String get pendingTransactionFeeFiatAmount { + try { + if (pendingTransaction != null) { + final fiat = calculateFiatAmount( + price: _fiatConversationStore.prices[_wallet.currency], + cryptoAmount: pendingTransaction.feeFormatted); + return fiat; + } else { + return '0.00'; + } + } catch (_) { + return '0.00'; + } + } + FiatCurrency get fiat => _settingsStore.fiatCurrency; TransactionPriority get transactionPriority => From 18ba208e445fe17874c573b64ab34823903ce90f Mon Sep 17 00:00:00 2001 From: Oleksandr Sobol Date: Wed, 30 Dec 2020 18:19:16 +0200 Subject: [PATCH 20/39] CAKE-221 | fixed string resources --- lib/generated/i18n.dart | 137 ++++++++++++++---------- lib/src/screens/seed/pre_seed_page.dart | 2 +- lib/src/screens/send/send_page.dart | 2 +- res/values/strings_de.arb | 8 +- res/values/strings_en.arb | 8 +- res/values/strings_es.arb | 8 +- res/values/strings_hi.arb | 8 +- res/values/strings_ja.arb | 8 +- res/values/strings_ko.arb | 8 +- res/values/strings_nl.arb | 8 +- res/values/strings_pl.arb | 8 +- res/values/strings_pt.arb | 8 +- res/values/strings_ru.arb | 8 +- res/values/strings_uk.arb | 8 +- res/values/strings_zh.arb | 8 +- 15 files changed, 142 insertions(+), 95 deletions(-) diff --git a/lib/generated/i18n.dart b/lib/generated/i18n.dart index 59799342b..131831347 100644 --- a/lib/generated/i18n.dart +++ b/lib/generated/i18n.dart @@ -143,13 +143,13 @@ class S implements WidgetsLocalizations { String get please_select => "Please select:"; String get please_try_to_connect_to_another_node => "Please try to connect to another node"; String get pre_seed_button_text => "I understand. Show me my seed"; - String pre_seed_description(int words) => "On the next page you will see a series of ${words} words. This is your unique and private seed and it is the ONLY way to recover your wallet in case of loss or malfunction. It is YOUR responsibility to write it down and store it in a safe place outside of the Cake Wallet app."; String get pre_seed_title => "IMPORTANT"; String get private_key => "Private key"; String get public_key => "Public key"; String get receive => "Receive"; String get receive_amount => "Amount"; String get received => "Received"; + String get recipient_address => "Recipient address"; String get reconnect => "Reconnect"; String get reconnect_alert_text => "Are you sure you want to reconnect?"; String get reconnection => "Reconnection"; @@ -212,13 +212,12 @@ class S implements WidgetsLocalizations { String get send_error_currency => "Currency can only contain numbers"; String get send_error_minimum_value => "Minimum value of amount is 0.01"; String get send_estimated_fee => "Estimated fee:"; - String get send_fee => "Fee"; + String get send_fee => "Fee:"; String get send_got_it => "Got it"; String get send_name => "Name"; String get send_new => "New"; String get send_payment_id => "Payment ID (optional)"; String get send_sending => "Sending..."; - String send_success(String crypto) => "Your ${crypto} was successfully sent"; String get send_templates => "Templates"; String get send_title => "Send"; String get send_xmr => "Send XMR"; @@ -352,10 +351,12 @@ class S implements WidgetsLocalizations { String min_value(String value, String currency) => "Min: ${value} ${currency}"; String openalias_alert_content(String recipient_name) => "You will be sending funds to\n${recipient_name}"; String powered_by(String title) => "Powered by ${title}"; + String pre_seed_description(String words) => "On the next page you will see a series of ${words} words. This is your unique and private seed and it is the ONLY way to recover your wallet in case of loss or malfunction. It is YOUR responsibility to write it down and store it in a safe place outside of the Cake Wallet app."; String provider_error(String provider) => "${provider} error"; String router_no_route(String name) => "No route defined for ${name}"; String send_address(String cryptoCurrency) => "${cryptoCurrency} address"; String send_priority(String transactionPriority) => "Currently the fee is set at ${transactionPriority} priority.\nTransaction priority can be adjusted in the settings"; + String send_success(String crypto) => "Your ${crypto} was successfully sent"; String time(String minutes, String seconds) => "${minutes}m ${seconds}s"; String trade_details_copied(String title) => "${title} copied to Clipboard"; String trade_for_not_created(String title) => "Trade for ${title} is not created."; @@ -402,7 +403,7 @@ class $de extends S { @override String get transaction_sent => "Transaktion gesendet!"; @override - String get send_fee => "Gebühr"; + String get send_fee => "Gebühr:"; @override String get password => "Passwort"; @override @@ -514,8 +515,6 @@ class $de extends S { @override String get choose_wallet_currency => "Bitte wählen Sie die Brieftaschenwährung:"; @override - String pre_seed_description(int words) => "Auf der nächsten Seite sehen Sie eine Reihe von ${words} Wörtern. Dies ist Ihr einzigartiger und privater Samen und der EINZIGE Weg, um Ihren Geldbeutel im Falle eines Verlusts oder einer Fehlfunktion wiederherzustellen. Es liegt in IHRER Verantwortung, es aufzuschreiben und an einem sicheren Ort außerhalb der Cake Wallet App aufzubewahren."; - @override String get node_connection_successful => "Die Verbindung war erfolgreich"; @override String get confirm => "Bestätigen"; @@ -642,8 +641,6 @@ class $de extends S { @override String get trade_details_created_at => "Hergestellt in"; @override - String send_success(String crypto) => "Ihr ${crypto} wurde erfolgreich gesendet"; - @override String get settings_wallets => "Brieftaschen"; @override String get settings_only_transactions => "Nur Transaktionen"; @@ -976,6 +973,8 @@ class $de extends S { @override String get trade_state_btc_sent => "geschickt"; @override + String get recipient_address => "Empfängeradresse"; + @override String get address_book => "Adressbuch"; @override String get enter_your_pin => "PIN eingeben"; @@ -1016,6 +1015,8 @@ class $de extends S { @override String error_text_minimal_limit(String provider, String min, String currency) => "Handel für ${provider} wird nicht erstellt. Menge ist weniger als minimal: ${min} ${currency}"; @override + String pre_seed_description(String words) => "Auf der nächsten Seite sehen Sie eine Reihe von ${words} Wörtern. Dies ist Ihr einzigartiger und privater Samen und der EINZIGE Weg, um Ihren Geldbeutel im Falle eines Verlusts oder einer Fehlfunktion wiederherzustellen. Es liegt in IHRER Verantwortung, es aufzuschreiben und an einem sicheren Ort außerhalb der Cake Wallet App aufzubewahren."; + @override String trade_id_not_found(String tradeId, String title) => "Handel ${tradeId} von ${title} nicht gefunden."; @override String transaction_details_copied(String title) => "${title} in die Zwischenablage kopiert"; @@ -1032,6 +1033,8 @@ class $de extends S { @override String change_wallet_alert_content(String wallet_name) => "Möchten Sie die aktuelle Brieftasche in ändern ${wallet_name}?"; @override + String send_success(String crypto) => "Ihr ${crypto} wurde erfolgreich gesendet"; + @override String time(String minutes, String seconds) => "${minutes}m ${seconds}s"; @override String max_value(String value, String currency) => "Max: ${value} ${currency}"; @@ -1214,8 +1217,6 @@ class $hi extends S { @override String get choose_wallet_currency => "कृपया बटुआ मुद्रा चुनें:"; @override - String pre_seed_description(int words) => "अगले पेज पर आपको ${words} शब्दों की एक श्रृंखला दिखाई देगी। यह आपका अद्वितीय और निजी बीज है और नुकसान या खराबी के मामले में अपने बटुए को पुनर्प्राप्त करने का एकमात्र तरीका है। यह आपकी जिम्मेदारी है कि इसे नीचे लिखें और इसे Cake Wallet ऐप के बाहर सुरक्षित स्थान पर संग्रहीत करें।"; - @override String get node_connection_successful => "कनेक्शन सफल रहा"; @override String get confirm => "की पुष्टि करें"; @@ -1342,8 +1343,6 @@ class $hi extends S { @override String get trade_details_created_at => "पर बनाया गया"; @override - String send_success(String crypto) => "आपका ${crypto} सफलतापूर्वक भेजा गया"; - @override String get settings_wallets => "पर्स"; @override String get settings_only_transactions => "केवल लेन-देन"; @@ -1676,6 +1675,8 @@ class $hi extends S { @override String get trade_state_btc_sent => "भेज दिया"; @override + String get recipient_address => "प्राप्तकर्ता का पता"; + @override String get address_book => "पता पुस्तिका"; @override String get enter_your_pin => "अपना पिन दर्ज करो"; @@ -1716,6 +1717,8 @@ class $hi extends S { @override String error_text_minimal_limit(String provider, String min, String currency) => "व्यापार ${provider} के लिए नहीं बनाया गया है। राशि कम है तो न्यूनतम: ${min} ${currency}"; @override + String pre_seed_description(String words) => "अगले पेज पर आपको ${words} शब्दों की एक श्रृंखला दिखाई देगी। यह आपका अद्वितीय और निजी बीज है और नुकसान या खराबी के मामले में अपने बटुए को पुनर्प्राप्त करने का एकमात्र तरीका है। यह आपकी जिम्मेदारी है कि इसे नीचे लिखें और इसे Cake Wallet ऐप के बाहर सुरक्षित स्थान पर संग्रहीत करें।"; + @override String trade_id_not_found(String tradeId, String title) => "व्यापार ${tradeId} of ${title} नहीं मिला."; @override String transaction_details_copied(String title) => "${title} क्लिपबोर्ड पर नकल"; @@ -1732,6 +1735,8 @@ class $hi extends S { @override String change_wallet_alert_content(String wallet_name) => "क्या आप करंट वॉलेट को बदलना चाहते हैं ${wallet_name}?"; @override + String send_success(String crypto) => "आपका ${crypto} सफलतापूर्वक भेजा गया"; + @override String time(String minutes, String seconds) => "${minutes}m ${seconds}s"; @override String max_value(String value, String currency) => "मैक्स: ${value} ${currency}"; @@ -1802,7 +1807,7 @@ class $ru extends S { @override String get transaction_sent => "Tранзакция отправлена!"; @override - String get send_fee => "Комиссия"; + String get send_fee => "Комиссия:"; @override String get password => "Пароль"; @override @@ -1914,8 +1919,6 @@ class $ru extends S { @override String get choose_wallet_currency => "Пожалуйста, выберите валюту кошелька:"; @override - String pre_seed_description(int words) => "На следующей странице вы увидите серию из ${words} слов. Это ваша уникальная и личная мнемоническая фраза, и это ЕДИНСТВЕННЫЙ способ восстановить свой кошелек в случае потери или неисправности. ВАМ необходимо записать ее и хранить в надежном месте вне приложения Cake Wallet."; - @override String get node_connection_successful => "Подключение прошло успешно"; @override String get confirm => "Подтвердить"; @@ -2042,8 +2045,6 @@ class $ru extends S { @override String get trade_details_created_at => "Создано"; @override - String send_success(String crypto) => "Ваш ${crypto} был успешно отправлен"; - @override String get settings_wallets => "Кошельки"; @override String get settings_only_transactions => "Транзакции"; @@ -2376,6 +2377,8 @@ class $ru extends S { @override String get trade_state_btc_sent => "BTC отправлены"; @override + String get recipient_address => "Адрес получателя"; + @override String get address_book => "Адресная книга"; @override String get enter_your_pin => "Введите ваш PIN"; @@ -2416,6 +2419,8 @@ class $ru extends S { @override String error_text_minimal_limit(String provider, String min, String currency) => "Сделка для ${provider} не создана. Сумма меньше минимальной: ${min} ${currency}"; @override + String pre_seed_description(String words) => "На следующей странице вы увидите серию из ${words} слов. Это ваша уникальная и личная мнемоническая фраза, и это ЕДИНСТВЕННЫЙ способ восстановить свой кошелек в случае потери или неисправности. ВАМ необходимо записать ее и хранить в надежном месте вне приложения Cake Wallet."; + @override String trade_id_not_found(String tradeId, String title) => "Сделка ${tradeId} ${title} не найдена."; @override String transaction_details_copied(String title) => "${title} скопировано в буфер обмена"; @@ -2432,6 +2437,8 @@ class $ru extends S { @override String change_wallet_alert_content(String wallet_name) => "Вы хотите изменить текущий кошелек на ${wallet_name}?"; @override + String send_success(String crypto) => "Ваш ${crypto} был успешно отправлен"; + @override String time(String minutes, String seconds) => "${minutes}мин ${seconds}сек"; @override String max_value(String value, String currency) => "Макс: ${value} ${currency}"; @@ -2502,7 +2509,7 @@ class $ko extends S { @override String get transaction_sent => "거래가 전송되었습니다!"; @override - String get send_fee => "회비"; + String get send_fee => "회비:"; @override String get password => "암호"; @override @@ -2614,8 +2621,6 @@ class $ko extends S { @override String get choose_wallet_currency => "지갑 통화를 선택하십시오:"; @override - String pre_seed_description(int words) => "다음 페이지에서 ${words} 개의 단어를 볼 수 있습니다. 이것은 귀하의 고유하고 개인적인 시드이며 분실 또는 오작동시 지갑을 복구하는 유일한 방법입니다. 기록해두고 Cake Wallet 앱 외부의 안전한 장소에 보관하는 것은 귀하의 책임입니다."; - @override String get node_connection_successful => "성공적으로 연결되었습니다."; @override String get confirm => "확인"; @@ -2742,8 +2747,6 @@ class $ko extends S { @override String get trade_details_created_at => "에 작성"; @override - String send_success(String crypto) => "${crypto}가 성공적으로 전송되었습니다"; - @override String get settings_wallets => "지갑"; @override String get settings_only_transactions => "거래 만"; @@ -3076,6 +3079,8 @@ class $ko extends S { @override String get trade_state_btc_sent => "보냄"; @override + String get recipient_address => "받는 사람 주소"; + @override String get address_book => "주소록"; @override String get enter_your_pin => "PIN을 입력하십시오"; @@ -3116,6 +3121,8 @@ class $ko extends S { @override String error_text_minimal_limit(String provider, String min, String currency) => "거래 ${provider} 가 생성되지 않습니다. 금액이 최소보다 적습니다. ${min} ${currency}"; @override + String pre_seed_description(String words) => "다음 페이지에서 ${words} 개의 단어를 볼 수 있습니다. 이것은 귀하의 고유하고 개인적인 시드이며 분실 또는 오작동시 지갑을 복구하는 유일한 방법입니다. 기록해두고 Cake Wallet 앱 외부의 안전한 장소에 보관하는 것은 귀하의 책임입니다."; + @override String trade_id_not_found(String tradeId, String title) => "무역 ${tradeId} 의 ${title} 찾을 수 없습니다."; @override String transaction_details_copied(String title) => "${title} 클립 보드에 복사"; @@ -3132,6 +3139,8 @@ class $ko extends S { @override String change_wallet_alert_content(String wallet_name) => "현재 지갑을 다음으로 변경 하시겠습니까 ${wallet_name}?"; @override + String send_success(String crypto) => "${crypto}가 성공적으로 전송되었습니다"; + @override String time(String minutes, String seconds) => "${minutes}m ${seconds}s"; @override String max_value(String value, String currency) => "맥스: ${value} ${currency}"; @@ -3202,7 +3211,7 @@ class $pt extends S { @override String get transaction_sent => "Transação enviada!"; @override - String get send_fee => "Taxa"; + String get send_fee => "Taxa:"; @override String get password => "Senha"; @override @@ -3314,8 +3323,6 @@ class $pt extends S { @override String get choose_wallet_currency => "Escolha a moeda da carteira:"; @override - String pre_seed_description(int words) => "Na próxima página, você verá uma série de ${words} palavras. Esta é a sua semente única e privada e é a ÚNICA maneira de recuperar sua carteira em caso de perda ou mau funcionamento. É SUA responsabilidade anotá-lo e armazená-lo em um local seguro fora do aplicativo Cake Wallet."; - @override String get node_connection_successful => "A conexão foi bem sucedida"; @override String get confirm => "Confirmar"; @@ -3442,8 +3449,6 @@ class $pt extends S { @override String get trade_details_created_at => "Criada em"; @override - String send_success(String crypto) => "Seu ${crypto} foi enviado com sucesso"; - @override String get settings_wallets => "Carteiras"; @override String get settings_only_transactions => "Somente transações"; @@ -3776,6 +3781,8 @@ class $pt extends S { @override String get trade_state_btc_sent => "BTC enviado"; @override + String get recipient_address => "Endereço do destinatário"; + @override String get address_book => "Livro de endereços"; @override String get enter_your_pin => "Insira seu PIN"; @@ -3816,6 +3823,8 @@ class $pt extends S { @override String error_text_minimal_limit(String provider, String min, String currency) => "A troca por ${provider} não é criada. O valor é menor que o mínimo: ${min} ${currency}"; @override + String pre_seed_description(String words) => "Na próxima página, você verá uma série de ${words} palavras. Esta é a sua semente única e privada e é a ÚNICA maneira de recuperar sua carteira em caso de perda ou mau funcionamento. É SUA responsabilidade anotá-lo e armazená-lo em um local seguro fora do aplicativo Cake Wallet."; + @override String trade_id_not_found(String tradeId, String title) => "A troca ${tradeId} de ${title} não foi encontrada."; @override String transaction_details_copied(String title) => "${title} copiados para a área de transferência"; @@ -3832,6 +3841,8 @@ class $pt extends S { @override String change_wallet_alert_content(String wallet_name) => "Quer mudar a carteira atual para ${wallet_name}?"; @override + String send_success(String crypto) => "Seu ${crypto} foi enviado com sucesso"; + @override String time(String minutes, String seconds) => "${minutes}m ${seconds}s"; @override String max_value(String value, String currency) => "Máx: ${value} ${currency}"; @@ -3902,7 +3913,7 @@ class $uk extends S { @override String get transaction_sent => "Tранзакцію відправлено!"; @override - String get send_fee => "Комісія"; + String get send_fee => "Комісія:"; @override String get password => "Пароль"; @override @@ -4014,8 +4025,6 @@ class $uk extends S { @override String get choose_wallet_currency => "Будь ласка, виберіть валюту гаманця:"; @override - String pre_seed_description(int words) => "На наступній сторінці ви побачите серію з ${words} слів. Це ваша унікальна та приватна мнемонічна фраза, і це ЄДИНИЙ спосіб відновити ваш гаманець на випадок втрати або несправності. ВАМ необхідно записати її та зберігати в безпечному місці поза програмою Cake Wallet."; - @override String get node_connection_successful => "З'єднання було успішним"; @override String get confirm => "Підтвердити"; @@ -4142,8 +4151,6 @@ class $uk extends S { @override String get trade_details_created_at => "Створено"; @override - String send_success(String crypto) => "Ваш ${crypto} успішно надісланий"; - @override String get settings_wallets => "Гаманці"; @override String get settings_only_transactions => "Транзакції"; @@ -4476,6 +4483,8 @@ class $uk extends S { @override String get trade_state_btc_sent => "BTC надіслано"; @override + String get recipient_address => "Адреса одержувача"; + @override String get address_book => "Адресна книга"; @override String get enter_your_pin => "Введіть ваш PIN"; @@ -4516,6 +4525,8 @@ class $uk extends S { @override String error_text_minimal_limit(String provider, String min, String currency) => "Операція для ${provider} не створена. Сума менша мінімальної: ${min} ${currency}"; @override + String pre_seed_description(String words) => "На наступній сторінці ви побачите серію з ${words} слів. Це ваша унікальна та приватна мнемонічна фраза, і це ЄДИНИЙ спосіб відновити ваш гаманець на випадок втрати або несправності. ВАМ необхідно записати її та зберігати в безпечному місці поза програмою Cake Wallet."; + @override String trade_id_not_found(String tradeId, String title) => "Операція ${tradeId} ${title} не знайдена."; @override String transaction_details_copied(String title) => "${title} скопійовано в буфер обміну"; @@ -4532,6 +4543,8 @@ class $uk extends S { @override String change_wallet_alert_content(String wallet_name) => "Ви хочете змінити поточний гаманець на ${wallet_name}?"; @override + String send_success(String crypto) => "Ваш ${crypto} успішно надісланий"; + @override String time(String minutes, String seconds) => "${minutes}хв ${seconds}сек"; @override String max_value(String value, String currency) => "Макс: ${value} ${currency}"; @@ -4602,7 +4615,7 @@ class $ja extends S { @override String get transaction_sent => "トランザクションが送信されました!"; @override - String get send_fee => "費用"; + String get send_fee => "費用:"; @override String get password => "パスワード"; @override @@ -4714,8 +4727,6 @@ class $ja extends S { @override String get choose_wallet_currency => "ウォレット通貨を選択してください:"; @override - String pre_seed_description(int words) => "次のページでは、一連の${words}語が表示されます。 これはあなたのユニークでプライベートなシードであり、紛失や誤動作が発生した場合にウォレットを回復する唯一の方法です。 それを書き留めて、Cake Wallet アプリの外の安全な場所に保管するのはあなたの責任です。"; - @override String get node_connection_successful => "接続に成功しました"; @override String get confirm => "確認する"; @@ -4842,8 +4853,6 @@ class $ja extends S { @override String get trade_details_created_at => "で作成"; @override - String send_success(String crypto) => "${crypto}が送信されました"; - @override String get settings_wallets => "財布"; @override String get settings_only_transactions => "トランザクションのみ"; @@ -5176,6 +5185,8 @@ class $ja extends S { @override String get trade_state_btc_sent => "送った"; @override + String get recipient_address => "受信者のアドレス"; + @override String get address_book => "住所録"; @override String get enter_your_pin => "PINを入力してください"; @@ -5216,6 +5227,8 @@ class $ja extends S { @override String error_text_minimal_limit(String provider, String min, String currency) => "${provider} の取引は作成されません。 金額は最小額より少ない: ${min} ${currency}"; @override + String pre_seed_description(String words) => "次のページでは、一連の${words}語が表示されます。 これはあなたのユニークでプライベートなシードであり、紛失や誤動作が発生した場合にウォレットを回復する唯一の方法です。 それを書き留めて、Cake Wallet アプリの外の安全な場所に保管するのはあなたの責任です。"; + @override String trade_id_not_found(String tradeId, String title) => "トレード ${tradeId} of ${title} 見つかりません"; @override String transaction_details_copied(String title) => "${title} クリップボードにコピーしました"; @@ -5232,6 +5245,8 @@ class $ja extends S { @override String change_wallet_alert_content(String wallet_name) => "現在のウォレットをに変更しますか ${wallet_name}?"; @override + String send_success(String crypto) => "${crypto}が送信されました"; + @override String time(String minutes, String seconds) => "${minutes}m ${seconds}s"; @override String max_value(String value, String currency) => "マックス: ${value} ${currency}"; @@ -5306,7 +5321,7 @@ class $pl extends S { @override String get transaction_sent => "Transakcja wysłana!"; @override - String get send_fee => "Opłata"; + String get send_fee => "Opłata:"; @override String get password => "Hasło"; @override @@ -5418,8 +5433,6 @@ class $pl extends S { @override String get choose_wallet_currency => "Wybierz walutę portfela:"; @override - String pre_seed_description(int words) => "Na następnej stronie zobaczysz serię ${words} słów. To jest Twoje unikalne i prywatne ziarno i jest to JEDYNY sposób na odzyskanie portfela w przypadku utraty lub awarii. Twoim obowiązkiem jest zapisanie go i przechowywanie w bezpiecznym miejscu poza aplikacją Cake Wallet."; - @override String get node_connection_successful => "Połączenie powiodło się"; @override String get confirm => "Potwierdzać"; @@ -5546,8 +5559,6 @@ class $pl extends S { @override String get trade_details_created_at => "Utworzono w"; @override - String send_success(String crypto) => "Twoje ${crypto} zostało pomyślnie wysłane"; - @override String get settings_wallets => "Portfele"; @override String get settings_only_transactions => "Tylko transakcje"; @@ -5880,6 +5891,8 @@ class $pl extends S { @override String get trade_state_btc_sent => "Wysłane"; @override + String get recipient_address => "Adres odbiorcy"; + @override String get address_book => "Książka adresowa"; @override String get enter_your_pin => "Wpisz Twój kod PIN"; @@ -5920,6 +5933,8 @@ class $pl extends S { @override String error_text_minimal_limit(String provider, String min, String currency) => "Wymiana dla ${provider} nie została utworzona. Kwota jest mniejsza niż minimalna: ${min} ${currency}"; @override + String pre_seed_description(String words) => "Na następnej stronie zobaczysz serię ${words} słów. To jest Twoje unikalne i prywatne ziarno i jest to JEDYNY sposób na odzyskanie portfela w przypadku utraty lub awarii. Twoim obowiązkiem jest zapisanie go i przechowywanie w bezpiecznym miejscu poza aplikacją Cake Wallet."; + @override String trade_id_not_found(String tradeId, String title) => "Handel ${tradeId} of ${title} nie znaleziono."; @override String transaction_details_copied(String title) => "${title} skopiowane do schowka"; @@ -5936,6 +5951,8 @@ class $pl extends S { @override String change_wallet_alert_content(String wallet_name) => "Czy chcesz zmienić obecny portfel na ${wallet_name}?"; @override + String send_success(String crypto) => "Twoje ${crypto} zostało pomyślnie wysłane"; + @override String time(String minutes, String seconds) => "${minutes}m ${seconds}s"; @override String max_value(String value, String currency) => "Max: ${value} ${currency}"; @@ -6006,7 +6023,7 @@ class $es extends S { @override String get transaction_sent => "Transacción enviada!"; @override - String get send_fee => "Cuota"; + String get send_fee => "Cuota:"; @override String get password => "Contraseña"; @override @@ -6118,8 +6135,6 @@ class $es extends S { @override String get choose_wallet_currency => "Por favor, elija la moneda de la billetera:"; @override - String pre_seed_description(int words) => "En la página siguiente verá una serie de ${words} palabras. Esta es su semilla única y privada y es la ÚNICA forma de recuperar su billetera en caso de pérdida o mal funcionamiento. Es SU responsabilidad escribirlo y guardarlo en un lugar seguro fuera de la aplicación Cake Wallet."; - @override String get node_connection_successful => "La conexión fue exitosa"; @override String get confirm => "Confirmar"; @@ -6246,8 +6261,6 @@ class $es extends S { @override String get trade_details_created_at => "Creado en"; @override - String send_success(String crypto) => "Su ${crypto} fue enviado con éxito"; - @override String get settings_wallets => "Carteras"; @override String get settings_only_transactions => "Solo transacciones"; @@ -6580,6 +6593,8 @@ class $es extends S { @override String get trade_state_btc_sent => "Btc expedido"; @override + String get recipient_address => "Dirección del receptor"; + @override String get address_book => "Libreta de direcciones"; @override String get enter_your_pin => "Introduce tu PIN"; @@ -6620,6 +6635,8 @@ class $es extends S { @override String error_text_minimal_limit(String provider, String min, String currency) => "El comercio por ${provider} no se crea. La cantidad es menos que mínima: ${min} ${currency}"; @override + String pre_seed_description(String words) => "En la página siguiente verá una serie de ${words} palabras. Esta es su semilla única y privada y es la ÚNICA forma de recuperar su billetera en caso de pérdida o mal funcionamiento. Es SU responsabilidad escribirlo y guardarlo en un lugar seguro fuera de la aplicación Cake Wallet."; + @override String trade_id_not_found(String tradeId, String title) => "Comercio ${tradeId} de ${title} no encontrado."; @override String transaction_details_copied(String title) => "${title} Copiado al portapapeles"; @@ -6636,6 +6653,8 @@ class $es extends S { @override String change_wallet_alert_content(String wallet_name) => "¿Quieres cambiar la billetera actual a ${wallet_name}?"; @override + String send_success(String crypto) => "Su ${crypto} fue enviado con éxito"; + @override String time(String minutes, String seconds) => "${minutes}m ${seconds}s"; @override String max_value(String value, String currency) => "Max: ${value} ${currency}"; @@ -6706,7 +6725,7 @@ class $nl extends S { @override String get transaction_sent => "Transactie verzonden!"; @override - String get send_fee => "Vergoeding"; + String get send_fee => "Vergoeding:"; @override String get password => "Wachtwoord"; @override @@ -6818,8 +6837,6 @@ class $nl extends S { @override String get choose_wallet_currency => "Kies een portemonnee-valuta:"; @override - String pre_seed_description(int words) => "Op de volgende pagina ziet u een reeks van ${words} woorden. Dit is uw unieke en persoonlijke zaadje en het is de ENIGE manier om uw portemonnee te herstellen in geval van verlies of storing. Het is JOUW verantwoordelijkheid om het op te schrijven en op een veilige plaats op te slaan buiten de Cake Wallet app."; - @override String get node_connection_successful => "Verbinding is gelukt"; @override String get confirm => "Bevestigen"; @@ -6946,8 +6963,6 @@ class $nl extends S { @override String get trade_details_created_at => "Gemaakt bij"; @override - String send_success(String crypto) => "Uw ${crypto} is succesvol verzonden"; - @override String get settings_wallets => "Portemonnee"; @override String get settings_only_transactions => "Alleen transacties"; @@ -7280,6 +7295,8 @@ class $nl extends S { @override String get trade_state_btc_sent => "Verzonden"; @override + String get recipient_address => "Adres ontvanger"; + @override String get address_book => "Adresboek"; @override String get enter_your_pin => "Voer uw pincode in"; @@ -7320,6 +7337,8 @@ class $nl extends S { @override String error_text_minimal_limit(String provider, String min, String currency) => "Ruil voor ${provider} is niet gemaakt. Bedrag is minder dan minimaal: ${min} ${currency}"; @override + String pre_seed_description(String words) => "Op de volgende pagina ziet u een reeks van ${words} woorden. Dit is uw unieke en persoonlijke zaadje en het is de ENIGE manier om uw portemonnee te herstellen in geval van verlies of storing. Het is JOUW verantwoordelijkheid om het op te schrijven en op een veilige plaats op te slaan buiten de Cake Wallet app."; + @override String trade_id_not_found(String tradeId, String title) => "Handel ${tradeId} van ${title} niet gevonden."; @override String transaction_details_copied(String title) => "${title} gekopieerd naar het klembord"; @@ -7336,6 +7355,8 @@ class $nl extends S { @override String change_wallet_alert_content(String wallet_name) => "Wilt u de huidige portemonnee wijzigen in ${wallet_name}?"; @override + String send_success(String crypto) => "Uw ${crypto} is succesvol verzonden"; + @override String time(String minutes, String seconds) => "${minutes}m ${seconds}s"; @override String max_value(String value, String currency) => "Max: ${value} ${currency}"; @@ -7406,7 +7427,7 @@ class $zh extends S { @override String get transaction_sent => "交易已发送"; @override - String get send_fee => "費用"; + String get send_fee => "費用:"; @override String get password => "密码"; @override @@ -7518,8 +7539,6 @@ class $zh extends S { @override String get choose_wallet_currency => "請選擇錢包貨幣:"; @override - String pre_seed_description(int words) => "在下一頁上,您將看到一系列${words}個單詞。 這是您獨特的私人種子,是丟失或出現故障時恢復錢包的唯一方法。 您有責任將其寫下並存儲在Cake Wallet應用程序外部的安全地方。"; - @override String get node_connection_successful => "連接成功"; @override String get confirm => "确认"; @@ -7646,8 +7665,6 @@ class $zh extends S { @override String get trade_details_created_at => "创建于"; @override - String send_success(String crypto) => "你${crypto}已成功發送"; - @override String get settings_wallets => "皮夹"; @override String get settings_only_transactions => "仅交易"; @@ -7980,6 +7997,8 @@ class $zh extends S { @override String get trade_state_btc_sent => "已发送"; @override + String get recipient_address => "收件人地址"; + @override String get address_book => "地址簿"; @override String get enter_your_pin => "输入密码"; @@ -8020,6 +8039,8 @@ class $zh extends S { @override String error_text_minimal_limit(String provider, String min, String currency) => "未創建 ${provider} 交易。 金額少於最小值:${min} ${currency}"; @override + String pre_seed_description(String words) => "在下一頁上,您將看到一系列${words}個單詞。 這是您獨特的私人種子,是丟失或出現故障時恢復錢包的唯一方法。 您有責任將其寫下並存儲在Cake Wallet應用程序外部的安全地方。"; + @override String trade_id_not_found(String tradeId, String title) => "贸易方式 ${tradeId} 的 ${title} 未找到."; @override String transaction_details_copied(String title) => "${title} 复制到剪贴板"; @@ -8036,6 +8057,8 @@ class $zh extends S { @override String change_wallet_alert_content(String wallet_name) => "您要將當前的錢包更改為 ${wallet_name}?"; @override + String send_success(String crypto) => "你${crypto}已成功發送"; + @override String time(String minutes, String seconds) => "${minutes}m ${seconds}s"; @override String max_value(String value, String currency) => "最高: ${value} ${currency}"; diff --git a/lib/src/screens/seed/pre_seed_page.dart b/lib/src/screens/seed/pre_seed_page.dart index babbf33ec..03fc17425 100644 --- a/lib/src/screens/seed/pre_seed_page.dart +++ b/lib/src/screens/seed/pre_seed_page.dart @@ -49,7 +49,7 @@ class PreSeedPage extends BasePage { Padding( padding: EdgeInsets.only(top: 70, left: 16, right: 16), child: Text( - S.of(context).pre_seed_description(wordsCount), + S.of(context).pre_seed_description(wordsCount.toString()), textAlign: TextAlign.center, style: TextStyle( fontSize: 14, diff --git a/lib/src/screens/send/send_page.dart b/lib/src/screens/send/send_page.dart index cdcbb726f..dccbe8aab 100644 --- a/lib/src/screens/send/send_page.dart +++ b/lib/src/screens/send/send_page.dart @@ -630,7 +630,7 @@ class SendPage extends BasePage { feeValue: sendViewModel.pendingTransaction.feeFormatted, feeFiatAmount: sendViewModel.pendingTransactionFeeFiatAmount + ' ' + sendViewModel.fiat.title, - recipientTitle: 'Recipient address', + recipientTitle: S.of(context).recipient_address, recipientAddress: sendViewModel.address, rightButtonText: S.of(context).ok, leftButtonText: S.of(context).cancel, diff --git a/res/values/strings_de.arb b/res/values/strings_de.arb index ee47ace4c..0136da28b 100644 --- a/res/values/strings_de.arb +++ b/res/values/strings_de.arb @@ -212,7 +212,7 @@ "send_name" : "Name", "send_got_it" : "Ich habs", "send_sending" : "Senden...", - "send_success" : "Ihr Monero wurde erfolgreich gesendet", + "send_success" : "Ihr ${crypto} wurde erfolgreich gesendet", "settings_title" : "die Einstellungen", @@ -415,7 +415,7 @@ "exchange_sync_alert_content" : "Bitte warten Sie, bis Ihre Brieftasche synchronisiert ist", "pre_seed_title" : "WICHTIG", - "pre_seed_description" : "Auf der nächsten Seite sehen Sie eine Reihe von 25 Wörtern. Dies ist Ihr einzigartiger und privater Samen und der EINZIGE Weg, um Ihren Geldbeutel im Falle eines Verlusts oder einer Fehlfunktion wiederherzustellen. Es liegt in IHRER Verantwortung, es aufzuschreiben und an einem sicheren Ort außerhalb der Cake Wallet App aufzubewahren.", + "pre_seed_description" : "Auf der nächsten Seite sehen Sie eine Reihe von ${words} Wörtern. Dies ist Ihr einzigartiger und privater Samen und der EINZIGE Weg, um Ihren Geldbeutel im Falle eines Verlusts oder einer Fehlfunktion wiederherzustellen. Es liegt in IHRER Verantwortung, es aufzuschreiben und an einem sicheren Ort außerhalb der Cake Wallet App aufzubewahren.", "pre_seed_button_text" : "Ich verstehe. Zeig mir meinen Samen", "xmr_to_error" : "XMR.TO-Fehler", @@ -428,5 +428,7 @@ "color_theme" : "Farbthema", "light_theme" : "Licht", "bright_theme" : "Hell", - "dark_theme" : "Dunkel" + "dark_theme" : "Dunkel", + + "recipient_address" : "Empfängeradresse" } \ No newline at end of file diff --git a/res/values/strings_en.arb b/res/values/strings_en.arb index ee6925cc0..94dc0a842 100644 --- a/res/values/strings_en.arb +++ b/res/values/strings_en.arb @@ -212,7 +212,7 @@ "send_name" : "Name", "send_got_it" : "Got it", "send_sending" : "Sending...", - "send_success" : "Your Monero was successfully sent", + "send_success" : "Your ${crypto} was successfully sent", "settings_title" : "Settings", @@ -415,7 +415,7 @@ "exchange_sync_alert_content" : "Please wait until your wallet is synchronized", "pre_seed_title" : "IMPORTANT", - "pre_seed_description" : "On the next page you will see a series of 25 words. This is your unique and private seed and it is the ONLY way to recover your wallet in case of loss or malfunction. It is YOUR responsibility to write it down and store it in a safe place outside of the Cake Wallet app.", + "pre_seed_description" : "On the next page you will see a series of ${words} words. This is your unique and private seed and it is the ONLY way to recover your wallet in case of loss or malfunction. It is YOUR responsibility to write it down and store it in a safe place outside of the Cake Wallet app.", "pre_seed_button_text" : "I understand. Show me my seed", "xmr_to_error" : "XMR.TO error", @@ -428,5 +428,7 @@ "color_theme" : "Color theme", "light_theme" : "Light", "bright_theme" : "Bright", - "dark_theme" : "Dark" + "dark_theme" : "Dark", + + "recipient_address" : "Recipient address" } \ No newline at end of file diff --git a/res/values/strings_es.arb b/res/values/strings_es.arb index 7483b75e0..7cb5da26f 100644 --- a/res/values/strings_es.arb +++ b/res/values/strings_es.arb @@ -212,7 +212,7 @@ "send_name" : "Nombre", "send_got_it" : "Entendido", "send_sending" : "Enviando...", - "send_success" : "Su Monero fue enviado con éxito", + "send_success" : "Su ${crypto} fue enviado con éxito", "settings_title" : "Configuraciones", @@ -415,7 +415,7 @@ "exchange_sync_alert_content" : "Espere hasta que su billetera esté sincronizada", "pre_seed_title" : "IMPORTANTE", - "pre_seed_description" : "En la página siguiente verá una serie de 25 palabras. Esta es su semilla única y privada y es la ÚNICA forma de recuperar su billetera en caso de pérdida o mal funcionamiento. Es SU responsabilidad escribirlo y guardarlo en un lugar seguro fuera de la aplicación Cake Wallet.", + "pre_seed_description" : "En la página siguiente verá una serie de ${words} palabras. Esta es su semilla única y privada y es la ÚNICA forma de recuperar su billetera en caso de pérdida o mal funcionamiento. Es SU responsabilidad escribirlo y guardarlo en un lugar seguro fuera de la aplicación Cake Wallet.", "pre_seed_button_text" : "Entiendo. Muéstrame mi semilla", "xmr_to_error" : "Error de XMR.TO", @@ -428,5 +428,7 @@ "color_theme" : "Tema de color", "light_theme" : "Ligera", "bright_theme" : "Brillante", - "dark_theme" : "Oscura" + "dark_theme" : "Oscura", + + "recipient_address" : "Dirección del receptor" } \ No newline at end of file diff --git a/res/values/strings_hi.arb b/res/values/strings_hi.arb index 21caa7c77..ef84307ba 100644 --- a/res/values/strings_hi.arb +++ b/res/values/strings_hi.arb @@ -212,7 +212,7 @@ "send_name" : "नाम", "send_got_it" : "समझ गया", "send_sending" : "भेजना...", - "send_success" : "आपका Monero सफलतापूर्वक भेजा गया", + "send_success" : "आपका ${crypto} सफलतापूर्वक भेजा गया", "settings_title" : "सेटिंग्स", @@ -415,7 +415,7 @@ "exchange_sync_alert_content" : "कृपया प्रतीक्षा करें जब तक आपका बटुआ सिंक्रनाइज़ नहीं किया जाता है", "pre_seed_title" : "महत्वपूर्ण", - "pre_seed_description" : "अगले पेज पर आपको 25 शब्दों की एक श्रृंखला दिखाई देगी। यह आपका अद्वितीय और निजी बीज है और नुकसान या खराबी के मामले में अपने बटुए को पुनर्प्राप्त करने का एकमात्र तरीका है। यह आपकी जिम्मेदारी है कि इसे नीचे लिखें और इसे Cake Wallet ऐप के बाहर सुरक्षित स्थान पर संग्रहीत करें।", + "pre_seed_description" : "अगले पेज पर आपको ${words} शब्दों की एक श्रृंखला दिखाई देगी। यह आपका अद्वितीय और निजी बीज है और नुकसान या खराबी के मामले में अपने बटुए को पुनर्प्राप्त करने का एकमात्र तरीका है। यह आपकी जिम्मेदारी है कि इसे नीचे लिखें और इसे Cake Wallet ऐप के बाहर सुरक्षित स्थान पर संग्रहीत करें।", "pre_seed_button_text" : "मै समझता हुँ। मुझे अपना बीज दिखाओ", "xmr_to_error" : "XMR.TO त्रुटि", @@ -428,5 +428,7 @@ "color_theme" : "रंग विषय", "light_theme" : "रोशनी", "bright_theme" : "उज्ज्वल", - "dark_theme" : "अंधेरा" + "dark_theme" : "अंधेरा", + + "recipient_address" : "प्राप्तकर्ता का पता" } \ No newline at end of file diff --git a/res/values/strings_ja.arb b/res/values/strings_ja.arb index eff9adf68..f5dae8b59 100644 --- a/res/values/strings_ja.arb +++ b/res/values/strings_ja.arb @@ -212,7 +212,7 @@ "send_name" : "名前", "send_got_it" : "とった", "send_sending" : "送信...", - "send_success" : "Moneroが送信されました", + "send_success" : "${crypto}が送信されました", "settings_title" : "設定", @@ -415,7 +415,7 @@ "exchange_sync_alert_content" : "ウォレットが同期されるまでお待ちください", "pre_seed_title" : "重要", - "pre_seed_description" : "次のページでは、一連の25語が表示されます。 これはあなたのユニークでプライベートなシードであり、紛失や誤動作が発生した場合にウォレットを回復する唯一の方法です。 それを書き留めて、Cake Wallet アプリの外の安全な場所に保管するのはあなたの責任です。", + "pre_seed_description" : "次のページでは、一連の${words}語が表示されます。 これはあなたのユニークでプライベートなシードであり、紛失や誤動作が発生した場合にウォレットを回復する唯一の方法です。 それを書き留めて、Cake Wallet アプリの外の安全な場所に保管するのはあなたの責任です。", "pre_seed_button_text" : "わかります。 種を見せて", "xmr_to_error" : "XMR.TOエラー", @@ -428,5 +428,7 @@ "color_theme" : "カラーテーマ", "light_theme" : "光", "bright_theme" : "明るい", - "dark_theme" : "闇" + "dark_theme" : "闇", + + "recipient_address" : "受信者のアドレス" } \ No newline at end of file diff --git a/res/values/strings_ko.arb b/res/values/strings_ko.arb index ed0e78da6..ca274f677 100644 --- a/res/values/strings_ko.arb +++ b/res/values/strings_ko.arb @@ -212,7 +212,7 @@ "send_name" : "이름", "send_got_it" : "알았다", "send_sending" : "배상...", - "send_success" : "Monero가 성공적으로 전송되었습니다", + "send_success" : "${crypto}가 성공적으로 전송되었습니다", "settings_title" : "설정", @@ -415,7 +415,7 @@ "exchange_sync_alert_content" : "지갑이 동기화 될 때까지 기다리십시오", "pre_seed_title" : "중대한", - "pre_seed_description" : "다음 페이지에서 25 개의 단어를 볼 수 있습니다. 이것은 귀하의 고유하고 개인적인 시드이며 분실 또는 오작동시 지갑을 복구하는 유일한 방법입니다. 기록해두고 Cake Wallet 앱 외부의 안전한 장소에 보관하는 것은 귀하의 책임입니다.", + "pre_seed_description" : "다음 페이지에서 ${words} 개의 단어를 볼 수 있습니다. 이것은 귀하의 고유하고 개인적인 시드이며 분실 또는 오작동시 지갑을 복구하는 유일한 방법입니다. 기록해두고 Cake Wallet 앱 외부의 안전한 장소에 보관하는 것은 귀하의 책임입니다.", "pre_seed_button_text" : "이해 했어요. 내 씨앗을 보여줘", "xmr_to_error" : "XMR.TO 오류", @@ -428,5 +428,7 @@ "color_theme" : "색상 테마", "light_theme" : "빛", "bright_theme" : "선명한", - "dark_theme" : "어두운" + "dark_theme" : "어두운", + + "recipient_address" : "받는 사람 주소" } \ No newline at end of file diff --git a/res/values/strings_nl.arb b/res/values/strings_nl.arb index b8d6a9ab4..bdab4452c 100644 --- a/res/values/strings_nl.arb +++ b/res/values/strings_nl.arb @@ -212,7 +212,7 @@ "send_name" : "Naam", "send_got_it" : "Ik snap het", "send_sending" : "Bezig met verzenden...", - "send_success" : "Uw Monero is succesvol verzonden", + "send_success" : "Uw ${crypto} is succesvol verzonden", "settings_title" : "Instellingen", @@ -415,7 +415,7 @@ "exchange_sync_alert_content" : "Wacht tot uw portemonnee is gesynchroniseerd", "pre_seed_title" : "BELANGRIJK", - "pre_seed_description" : "Op de volgende pagina ziet u een reeks van 25 woorden. Dit is uw unieke en persoonlijke zaadje en het is de ENIGE manier om uw portemonnee te herstellen in geval van verlies of storing. Het is JOUW verantwoordelijkheid om het op te schrijven en op een veilige plaats op te slaan buiten de Cake Wallet app.", + "pre_seed_description" : "Op de volgende pagina ziet u een reeks van ${words} woorden. Dit is uw unieke en persoonlijke zaadje en het is de ENIGE manier om uw portemonnee te herstellen in geval van verlies of storing. Het is JOUW verantwoordelijkheid om het op te schrijven en op een veilige plaats op te slaan buiten de Cake Wallet app.", "pre_seed_button_text" : "Ik begrijp het. Laat me mijn zaad zien", "xmr_to_error" : "XMR.TO-fout", @@ -428,5 +428,7 @@ "color_theme" : "Kleur thema", "light_theme" : "Licht", "bright_theme" : "Helder", - "dark_theme" : "Donker" + "dark_theme" : "Donker", + + "recipient_address" : "Adres ontvanger" } \ No newline at end of file diff --git a/res/values/strings_pl.arb b/res/values/strings_pl.arb index 1fe58d723..99873614c 100644 --- a/res/values/strings_pl.arb +++ b/res/values/strings_pl.arb @@ -212,7 +212,7 @@ "send_name" : "Imię", "send_got_it" : "Rozumiem", "send_sending" : "Wysyłanie...", - "send_success" : "Twoje Monero zostało pomyślnie wysłane", + "send_success" : "Twoje ${crypto} zostało pomyślnie wysłane", "settings_title" : "Ustawienia", @@ -415,7 +415,7 @@ "exchange_sync_alert_content" : "Poczekaj, aż portfel zostanie zsynchronizowany", "pre_seed_title" : "WAŻNY", - "pre_seed_description" : "Na następnej stronie zobaczysz serię 25 słów. To jest Twoje unikalne i prywatne ziarno i jest to JEDYNY sposób na odzyskanie portfela w przypadku utraty lub awarii. Twoim obowiązkiem jest zapisanie go i przechowywanie w bezpiecznym miejscu poza aplikacją Cake Wallet.", + "pre_seed_description" : "Na następnej stronie zobaczysz serię ${words} słów. To jest Twoje unikalne i prywatne ziarno i jest to JEDYNY sposób na odzyskanie portfela w przypadku utraty lub awarii. Twoim obowiązkiem jest zapisanie go i przechowywanie w bezpiecznym miejscu poza aplikacją Cake Wallet.", "pre_seed_button_text" : "Rozumiem. Pokaż mi moje nasienie", "xmr_to_error" : "Pomyłka XMR.TO", @@ -428,5 +428,7 @@ "color_theme" : "Motyw kolorystyczny", "light_theme" : "Lekki", "bright_theme" : "Jasny", - "dark_theme" : "Ciemny" + "dark_theme" : "Ciemny", + + "recipient_address" : "Adres odbiorcy" } \ No newline at end of file diff --git a/res/values/strings_pt.arb b/res/values/strings_pt.arb index 9049b824e..b8d3ba99d 100644 --- a/res/values/strings_pt.arb +++ b/res/values/strings_pt.arb @@ -212,7 +212,7 @@ "send_name" : "Nome", "send_got_it" : "Entendi", "send_sending" : "Enviando...", - "send_success" : "Seu Monero foi enviado com sucesso", + "send_success" : "Seu ${crypto} foi enviado com sucesso", "settings_title" : "Configurações", @@ -415,7 +415,7 @@ "exchange_sync_alert_content" : "Por favor, espere até que sua carteira seja sincronizada", "pre_seed_title" : "IMPORTANTE", - "pre_seed_description" : "Na próxima página, você verá uma série de 25 palavras. Esta é a sua semente única e privada e é a ÚNICA maneira de recuperar sua carteira em caso de perda ou mau funcionamento. É SUA responsabilidade anotá-lo e armazená-lo em um local seguro fora do aplicativo Cake Wallet.", + "pre_seed_description" : "Na próxima página, você verá uma série de ${words} palavras. Esta é a sua semente única e privada e é a ÚNICA maneira de recuperar sua carteira em caso de perda ou mau funcionamento. É SUA responsabilidade anotá-lo e armazená-lo em um local seguro fora do aplicativo Cake Wallet.", "pre_seed_button_text" : "Compreendo. Me mostre minha semente", "xmr_to_error" : "Erro XMR.TO", @@ -428,5 +428,7 @@ "color_theme" : "Tema de cor", "light_theme" : "Luz", "bright_theme" : "Brilhante", - "dark_theme" : "Sombria" + "dark_theme" : "Sombria", + + "recipient_address" : "Endereço do destinatário" } diff --git a/res/values/strings_ru.arb b/res/values/strings_ru.arb index f3e633512..120bcd3ab 100644 --- a/res/values/strings_ru.arb +++ b/res/values/strings_ru.arb @@ -212,7 +212,7 @@ "send_name" : "Имя", "send_got_it" : "Понял", "send_sending" : "Отправка...", - "send_success" : "Ваш Monero был успешно отправлен", + "send_success" : "Ваш ${crypto} был успешно отправлен", "settings_title" : "Настройки", @@ -415,7 +415,7 @@ "exchange_sync_alert_content" : "Подождите, пока ваш кошелек синхронизируется", "pre_seed_title" : "ВАЖНО", - "pre_seed_description" : "На следующей странице вы увидите серию из 25 слов. Это ваша уникальная и личная мнемоническая фраза, и это ЕДИНСТВЕННЫЙ способ восстановить свой кошелек в случае потери или неисправности. ВАМ необходимо записать ее и хранить в надежном месте вне приложения Cake Wallet.", + "pre_seed_description" : "На следующей странице вы увидите серию из ${words} слов. Это ваша уникальная и личная мнемоническая фраза, и это ЕДИНСТВЕННЫЙ способ восстановить свой кошелек в случае потери или неисправности. ВАМ необходимо записать ее и хранить в надежном месте вне приложения Cake Wallet.", "pre_seed_button_text" : "Понятно. Покажите мнемоническую фразу", "xmr_to_error" : "Ошибка XMR.TO", @@ -428,5 +428,7 @@ "color_theme" : "Цветовая тема", "light_theme" : "Светлая", "bright_theme" : "Яркая", - "dark_theme" : "Темная" + "dark_theme" : "Темная", + + "recipient_address" : "Адрес получателя" } \ No newline at end of file diff --git a/res/values/strings_uk.arb b/res/values/strings_uk.arb index d0906da4b..37b6b7e20 100644 --- a/res/values/strings_uk.arb +++ b/res/values/strings_uk.arb @@ -212,7 +212,7 @@ "send_name" : "Ім'я", "send_got_it" : "Зрозумів", "send_sending" : "Відправлення...", - "send_success" : "Ваш Monero успішно надісланий", + "send_success" : "Ваш ${crypto} успішно надісланий", "settings_title" : "Налаштування", @@ -415,7 +415,7 @@ "exchange_sync_alert_content" : "Зачекайте, поки ваш гаманець не синхронізується", "pre_seed_title" : "ВАЖЛИВО", - "pre_seed_description" : "На наступній сторінці ви побачите серію з 25 слів. Це ваша унікальна та приватна мнемонічна фраза, і це ЄДИНИЙ спосіб відновити ваш гаманець на випадок втрати або несправності. ВАМ необхідно записати її та зберігати в безпечному місці поза програмою Cake Wallet.", + "pre_seed_description" : "На наступній сторінці ви побачите серію з ${words} слів. Це ваша унікальна та приватна мнемонічна фраза, і це ЄДИНИЙ спосіб відновити ваш гаманець на випадок втрати або несправності. ВАМ необхідно записати її та зберігати в безпечному місці поза програмою Cake Wallet.", "pre_seed_button_text" : "Зрозуміло. Покажіть мнемонічну фразу", "xmr_to_error" : "Помилка XMR.TO", @@ -428,5 +428,7 @@ "color_theme" : "Кольорова тема", "light_theme" : "Світла", "bright_theme" : "Яскрава", - "dark_theme" : "Темна" + "dark_theme" : "Темна", + + "recipient_address" : "Адреса одержувача" } \ No newline at end of file diff --git a/res/values/strings_zh.arb b/res/values/strings_zh.arb index 890a3b502..30b1c2c27 100644 --- a/res/values/strings_zh.arb +++ b/res/values/strings_zh.arb @@ -212,7 +212,7 @@ "send_name" : "名稱", "send_got_it" : "得到它了", "send_sending" : "正在發送...", - "send_success" : "你Monero已成功發送", + "send_success" : "你${crypto}已成功發送", "settings_title" : "设定值", @@ -415,7 +415,7 @@ "exchange_sync_alert_content" : "請等待,直到您的錢包同步", "pre_seed_title" : "重要", - "pre_seed_description" : "在下一頁上,您將看到一系列25個單詞。 這是您獨特的私人種子,是丟失或出現故障時恢復錢包的唯一方法。 您有責任將其寫下並存儲在Cake Wallet應用程序外部的安全地方。", + "pre_seed_description" : "在下一頁上,您將看到一系列${words}個單詞。 這是您獨特的私人種子,是丟失或出現故障時恢復錢包的唯一方法。 您有責任將其寫下並存儲在Cake Wallet應用程序外部的安全地方。", "pre_seed_button_text" : "我明白。 給我看我的種子", "xmr_to_error" : "XMR.TO錯誤", @@ -428,5 +428,7 @@ "color_theme" : "顏色主題", "light_theme" : "光", "bright_theme" : "亮", - "dark_theme" : "黑暗" + "dark_theme" : "黑暗", + + "recipient_address" : "收件人地址" } \ No newline at end of file From 74cdf7cd7fed7d80b99ef6cc5d965ed58effbe08 Mon Sep 17 00:00:00 2001 From: M Date: Wed, 30 Dec 2020 20:35:34 +0200 Subject: [PATCH 21/39] Changed of electrum servers list. Changed default electrum server. --- assets/electrum_server_list.yml | 2 +- lib/entities/default_settings_migration.dart | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/assets/electrum_server_list.yml b/assets/electrum_server_list.yml index 661cadc9c..2b6649271 100644 --- a/assets/electrum_server_list.yml +++ b/assets/electrum_server_list.yml @@ -1,2 +1,2 @@ - - uri: electrumx.cakewallet.com:50002 \ No newline at end of file + uri: electrum.cakewallet.com:50002 \ No newline at end of file diff --git a/lib/entities/default_settings_migration.dart b/lib/entities/default_settings_migration.dart index 11e9fa863..94860d661 100644 --- a/lib/entities/default_settings_migration.dart +++ b/lib/entities/default_settings_migration.dart @@ -120,7 +120,7 @@ Future changeMoneroCurrentNodeToDefault( } Node getBitcoinDefaultElectrumServer({@required Box nodes}) { - final uri = 'electrumx.cakewallet.com:50002'; + final uri = 'electrum.cakewallet.com:50002'; return nodes.values .firstWhere((Node node) => node.uri == uri, orElse: () => null) ?? From 6288d8e05f16dde5283ba40e1b744ca9b4624bf4 Mon Sep 17 00:00:00 2001 From: M Date: Wed, 30 Dec 2020 20:49:40 +0200 Subject: [PATCH 22/39] Changed iOS project version to 4.1. --- ios/Runner.xcodeproj/project.pbxproj | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/ios/Runner.xcodeproj/project.pbxproj b/ios/Runner.xcodeproj/project.pbxproj index 1992353af..5ce246e34 100644 --- a/ios/Runner.xcodeproj/project.pbxproj +++ b/ios/Runner.xcodeproj/project.pbxproj @@ -17,7 +17,7 @@ 97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */; }; /* End PBXBuildFile section */ - /* Begin PBXFileReference section */ +/* Begin PBXFileReference section */ 0C44A7192518EF8000B570ED /* decrypt.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = decrypt.swift; sourceTree = ""; }; 0C9986A3251A932F00D566FD /* CryptoSwift.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; path = CryptoSwift.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GeneratedPluginRegistrant.h; sourceTree = ""; }; @@ -354,7 +354,7 @@ buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CLANG_ENABLE_MODULES = YES; - CURRENT_PROJECT_VERSION = 9; + CURRENT_PROJECT_VERSION = 10; DEVELOPMENT_TEAM = 32J6BB6VUS; ENABLE_BITCODE = NO; FRAMEWORK_SEARCH_PATHS = ( @@ -494,7 +494,7 @@ buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CLANG_ENABLE_MODULES = YES; - CURRENT_PROJECT_VERSION = 9; + CURRENT_PROJECT_VERSION = 10; DEVELOPMENT_TEAM = 32J6BB6VUS; ENABLE_BITCODE = NO; FRAMEWORK_SEARCH_PATHS = ( @@ -528,7 +528,7 @@ buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CLANG_ENABLE_MODULES = YES; - CURRENT_PROJECT_VERSION = 9; + CURRENT_PROJECT_VERSION = 10; DEVELOPMENT_TEAM = 32J6BB6VUS; ENABLE_BITCODE = NO; FRAMEWORK_SEARCH_PATHS = ( From 2dc5489a8e27f8890a68134ecca05976ef06ed9b Mon Sep 17 00:00:00 2001 From: M Date: Fri, 1 Jan 2021 10:57:12 +0200 Subject: [PATCH 23/39] Changed project version to 4.1.0 + 26. --- pubspec.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pubspec.yaml b/pubspec.yaml index 25dd08953..8c94d2272 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -11,7 +11,7 @@ description: Cake Wallet. # In iOS, build-name is used as CFBundleShortVersionString while build-number used as CFBundleVersion. # Read more about iOS versioning at # https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html -version: 4.0.94+25 +version: 4.1.0+26 environment: sdk: ">=2.7.0 <3.0.0" From 9b041dbe1ead0f66eb7bd51ccd5456888ace00f0 Mon Sep 17 00:00:00 2001 From: OleksandrSobol Date: Mon, 4 Jan 2021 17:13:37 +0200 Subject: [PATCH 24/39] CAKE-222 | fixed transaction priority picker on the settings screen; added check of priority for wallet type --- lib/view_model/settings/settings_view_model.dart | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/lib/view_model/settings/settings_view_model.dart b/lib/view_model/settings/settings_view_model.dart index 983438b6c..4f43d528a 100644 --- a/lib/view_model/settings/settings_view_model.dart +++ b/lib/view_model/settings/settings_view_model.dart @@ -35,6 +35,14 @@ abstract class SettingsViewModelBase with Store { currentVersion = ''; PackageInfo.fromPlatform().then( (PackageInfo packageInfo) => currentVersion = packageInfo.version); + + final priority = _settingsStore.transactionPriority; + + if (!TransactionPriority.forWalletType(_walletType).contains(priority)) { + _settingsStore.transactionPriority = + TransactionPriority.forWalletType(_walletType).first; + } + sections = [ [ if ((wallet.balance.availableModes as List).length > 1) @@ -55,7 +63,8 @@ abstract class SettingsViewModelBase with Store { title: S.current.settings_fee_priority, items: TransactionPriority.forWalletType(wallet.type), selectedItem: () => transactionPriority, - isAlwaysShowScrollThumb: true, + isAlwaysShowScrollThumb: + TransactionPriority.forWalletType(wallet.type).length > 3, onItemSelected: (TransactionPriority priority) => _settingsStore.transactionPriority = priority), SwitcherListItem( From 798d9a1edf24af6cfd60c22f5370c47306ecc19f Mon Sep 17 00:00:00 2001 From: M Date: Tue, 5 Jan 2021 20:31:03 +0200 Subject: [PATCH 25/39] Fixes --- lib/bitcoin/bitcoin_amount_format.dart | 34 +++++++-- .../bitcoin_transaction_credentials.dart | 2 +- lib/bitcoin/bitcoin_transaction_info.dart | 4 +- lib/bitcoin/bitcoin_wallet.dart | 40 ++++++----- lib/di.dart | 3 +- lib/main.dart | 1 + lib/src/screens/exchange/exchange_page.dart | 67 ++++++++++-------- .../exchange/widgets/exchange_card.dart | 70 ++++++++++++++----- lib/store/settings_store.dart | 2 +- .../exchange/exchange_view_model.dart | 41 ++++++++--- lib/view_model/send/send_view_model.dart | 2 +- 11 files changed, 181 insertions(+), 85 deletions(-) diff --git a/lib/bitcoin/bitcoin_amount_format.dart b/lib/bitcoin/bitcoin_amount_format.dart index 75db6c314..fa00387f1 100644 --- a/lib/bitcoin/bitcoin_amount_format.dart +++ b/lib/bitcoin/bitcoin_amount_format.dart @@ -1,3 +1,5 @@ +import 'dart:math'; + import 'package:intl/intl.dart'; import 'package:cake_wallet/entities/crypto_amount_format.dart'; @@ -7,10 +9,32 @@ final bitcoinAmountFormat = NumberFormat() ..maximumFractionDigits = bitcoinAmountLength ..minimumFractionDigits = 1; -String bitcoinAmountToString({int amount}) => - bitcoinAmountFormat.format(cryptoAmountToDouble(amount: amount, divider: bitcoinAmountDivider)); +String bitcoinAmountToString({int amount}) => bitcoinAmountFormat.format( + cryptoAmountToDouble(amount: amount, divider: bitcoinAmountDivider)); -double bitcoinAmountToDouble({int amount}) => cryptoAmountToDouble(amount: amount, divider: bitcoinAmountDivider); +double bitcoinAmountToDouble({int amount}) => + cryptoAmountToDouble(amount: amount, divider: bitcoinAmountDivider); -int doubleToBitcoinAmount(double amount) => - (amount * bitcoinAmountDivider).toInt(); \ No newline at end of file +int stringDoubleToBitcoinAmount(String amount) { + final splitted = amount.split(''); + final dotIndex = amount.indexOf('.'); + int result = 0; + + + for (var i = 0; i < splitted.length; i++) { + try { + if (dotIndex == i) { + continue; + } + + final char = splitted[i]; + final multiplier = dotIndex < i + ? bitcoinAmountDivider ~/ pow(10, (i - dotIndex)) + : (bitcoinAmountDivider * pow(10, (dotIndex - i -1))).toInt(); + final num = int.parse(char) * multiplier; + result += num; + } catch (_) {} + } + + return result; +} diff --git a/lib/bitcoin/bitcoin_transaction_credentials.dart b/lib/bitcoin/bitcoin_transaction_credentials.dart index 9e64634b3..40f7a7aa7 100644 --- a/lib/bitcoin/bitcoin_transaction_credentials.dart +++ b/lib/bitcoin/bitcoin_transaction_credentials.dart @@ -4,6 +4,6 @@ class BitcoinTransactionCredentials { BitcoinTransactionCredentials(this.address, this.amount, this.priority); final String address; - final double amount; + final String amount; TransactionPriority priority; } diff --git a/lib/bitcoin/bitcoin_transaction_info.dart b/lib/bitcoin/bitcoin_transaction_info.dart index f9051a5e0..fb1400c5e 100644 --- a/lib/bitcoin/bitcoin_transaction_info.dart +++ b/lib/bitcoin/bitcoin_transaction_info.dart @@ -47,7 +47,7 @@ class BitcoinTransactionInfo extends TransactionInfo { final out = vin['tx']['vout'][vout] as Map; final outAddresses = (out['scriptPubKey']['addresses'] as List)?.toSet(); - inputsAmount += doubleToBitcoinAmount(out['value'] as double ?? 0); + inputsAmount += stringDoubleToBitcoinAmount((out['value'] as double ?? 0).toString()); if (outAddresses?.intersection(addressesSet)?.isNotEmpty ?? false) { direction = TransactionDirection.outgoing; @@ -58,7 +58,7 @@ class BitcoinTransactionInfo extends TransactionInfo { final outAddresses = out['scriptPubKey']['addresses'] as List ?? []; final ntrs = outAddresses.toSet().intersection(addressesSet); - final value = doubleToBitcoinAmount(out['value'] as double ?? 0.0); + final value = stringDoubleToBitcoinAmount((out['value'] as double ?? 0.0).toString()); totalOutAmount += value; if ((direction == TransactionDirection.incoming && ntrs.isNotEmpty) || diff --git a/lib/bitcoin/bitcoin_wallet.dart b/lib/bitcoin/bitcoin_wallet.dart index 052440f1e..de5ef2119 100644 --- a/lib/bitcoin/bitcoin_wallet.dart +++ b/lib/bitcoin/bitcoin_wallet.dart @@ -116,6 +116,19 @@ abstract class BitcoinWalletBase extends WalletBase with Store { walletInfo: walletInfo); } + static int feeAmountForPriority(TransactionPriority priority) { + switch (priority) { + case TransactionPriority.slow: + return 6000; + case TransactionPriority.regular: + return 22080; + case TransactionPriority.fast: + return 24000; + default: + return 0; + } + } + @override final BitcoinTransactionHistory transactionHistory; final String path; @@ -243,16 +256,20 @@ abstract class BitcoinWalletBase extends WalletBase with Store { Object credentials) async { final transactionCredentials = credentials as BitcoinTransactionCredentials; final inputs = []; - final fee = _feeMultiplier(transactionCredentials.priority); + final fee = feeAmountForPriority(transactionCredentials.priority); final amount = transactionCredentials.amount != null - ? doubleToBitcoinAmount(transactionCredentials.amount) - : balance.total - fee; + ? stringDoubleToBitcoinAmount(transactionCredentials.amount) + : balance.availableBalance - fee; final totalAmount = amount + fee; final txb = bitcoin.TransactionBuilder(network: bitcoin.bitcoin); - var leftAmount = totalAmount; final changeAddress = address; + var leftAmount = totalAmount; var totalInputAmount = 0; + if (totalAmount > balance.availableBalance) { + throw BitcoinTransactionWrongBalanceException(); + } + final unspent = addresses.map((address) => eclient .getListUnspentWithAddress(address.address) .then((unspent) => unspent @@ -334,7 +351,7 @@ abstract class BitcoinWalletBase extends WalletBase with Store { @override double calculateEstimatedFee(TransactionPriority priority) => - bitcoinAmountToDouble(amount: _feeMultiplier(priority)); + bitcoinAmountToDouble(amount: feeAmountForPriority(priority)); @override Future save() async { @@ -386,17 +403,4 @@ abstract class BitcoinWalletBase extends WalletBase with Store { String _getAddress({@required int index}) => generateAddress(hd: hd, index: index); - - int _feeMultiplier(TransactionPriority priority) { - switch (priority) { - case TransactionPriority.slow: - return 6000; - case TransactionPriority.regular: - return 22080; - case TransactionPriority.fast: - return 24000; - default: - return 0; - } - } } diff --git a/lib/di.dart b/lib/di.dart index 0a6646e5d..03038f8c5 100644 --- a/lib/di.dart +++ b/lib/di.dart @@ -355,7 +355,8 @@ Future setup( getIt.get().wallet, tradesSource, getIt.get(), - getIt.get())); + getIt.get(), + getIt.get().settingsStore)); getIt.registerFactory(() => ExchangeTradeViewModel( wallet: getIt.get().wallet, diff --git a/lib/main.dart b/lib/main.dart index 38460fcca..6c1c3127a 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -1,3 +1,4 @@ +import 'package:cake_wallet/bitcoin/bitcoin_amount_format.dart'; import 'package:cake_wallet/themes/theme_base.dart'; import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; diff --git a/lib/src/screens/exchange/exchange_page.dart b/lib/src/screens/exchange/exchange_page.dart index e085d7880..8cedc8c7e 100644 --- a/lib/src/screens/exchange/exchange_page.dart +++ b/lib/src/screens/exchange/exchange_page.dart @@ -62,10 +62,11 @@ class ExchangePage extends BasePage { @override Widget trailing(BuildContext context) => TrailButton( - caption: S.of(context).reset, onPressed: () { + caption: S.of(context).reset, + onPressed: () { _formKey.currentState.reset(); exchangeViewModel.reset(); - }); + }); @override Widget body(BuildContext context) { @@ -95,8 +96,8 @@ class ExchangePage extends BasePage { return KeyboardActions( config: KeyboardActionsConfig( keyboardActionsPlatform: KeyboardActionsPlatform.IOS, - keyboardBarColor: Theme.of(context).accentTextTheme.body2 - .backgroundColor, + keyboardBarColor: + Theme.of(context).accentTextTheme.body2.backgroundColor, nextFocus: false, actions: [ KeyboardActionsItem( @@ -160,6 +161,11 @@ class ExchangePage extends BasePage { padding: EdgeInsets.fromLTRB(24, 100, 24, 32), child: Observer( builder: (_) => ExchangeCard( + hasAllAmount: exchangeViewModel.hasAllAmount, + allAmount: exchangeViewModel.hasAllAmount + ? () => exchangeViewModel + .calculateDepositAllAmount() + : null, amountFocusNode: _depositAmountFocus, key: depositKey, title: S.of(context).you_will_send, @@ -394,30 +400,35 @@ class ExchangePage extends BasePage { }), ), Observer( - builder: (_) => LoadingPrimaryButton( - text: S.of(context).exchange, - onPressed: () { - if (_formKey.currentState.validate()) { - if ((exchangeViewModel.depositCurrency == CryptoCurrency.xmr) - &&(!(exchangeViewModel.status is SyncedSyncStatus))) { - showPopUp( - context: context, - builder: (BuildContext context) { - return AlertWithOneAction( - alertTitle: S.of(context).exchange, - alertContent: S.of(context).exchange_sync_alert_content, - buttonText: S.of(context).ok, - buttonAction: () => Navigator.of(context).pop()); - }); - } else { - exchangeViewModel.createTrade(); - } - } - }, - color: Theme.of(context).accentTextTheme.body2.color, - textColor: Colors.white, - isLoading: exchangeViewModel.tradeState - is TradeIsCreating)), + builder: (_) => LoadingPrimaryButton( + text: S.of(context).exchange, + onPressed: () { + if (_formKey.currentState.validate()) { + if ((exchangeViewModel.depositCurrency == + CryptoCurrency.xmr) && + (!(exchangeViewModel.status + is SyncedSyncStatus))) { + showPopUp( + context: context, + builder: (BuildContext context) { + return AlertWithOneAction( + alertTitle: S.of(context).exchange, + alertContent: S + .of(context) + .exchange_sync_alert_content, + buttonText: S.of(context).ok, + buttonAction: () => + Navigator.of(context).pop()); + }); + } else { + exchangeViewModel.createTrade(); + } + } + }, + color: Theme.of(context).accentTextTheme.body2.color, + textColor: Colors.white, + isLoading: + exchangeViewModel.tradeState is TradeIsCreating)), ]), )), )); diff --git a/lib/src/screens/exchange/widgets/exchange_card.dart b/lib/src/screens/exchange/widgets/exchange_card.dart index 45f6f475c..062e5a1c3 100644 --- a/lib/src/screens/exchange/widgets/exchange_card.dart +++ b/lib/src/screens/exchange/widgets/exchange_card.dart @@ -27,7 +27,9 @@ class ExchangeCard extends StatefulWidget { this.borderColor = Colors.transparent, this.currencyValueValidator, this.addressTextFieldValidator, - this.amountFocusNode}) + this.amountFocusNode, + this.hasAllAmount = false, + this.allAmount}) : super(key: key); final List currencies; @@ -47,6 +49,8 @@ class ExchangeCard extends StatefulWidget { final FormFieldValidator currencyValueValidator; final FormFieldValidator addressTextFieldValidator; final FocusNode amountFocusNode; + final bool hasAllAmount; + Function allAmount; @override ExchangeCardState createState() => ExchangeCardState(); @@ -197,7 +201,36 @@ class ExchangeCardState extends State { ]), ), ), - ) + ), + if (widget.hasAllAmount) + Positioned( + top: 5, + right: 55, + child: Container( + height: 32, + width: 32, + margin: EdgeInsets.only(left: 14, top: 4, bottom: 10), + decoration: BoxDecoration( + color: Theme.of(context) + .primaryTextTheme + .display1 + .color, + borderRadius: BorderRadius.all(Radius.circular(6))), + child: InkWell( + onTap: () => widget.allAmount?.call(), + child: Center( + child: Text(S.of(context).all, + textAlign: TextAlign.center, + style: TextStyle( + fontSize: 12, + fontWeight: FontWeight.bold, + color: Theme.of(context) + .primaryTextTheme + .display1 + .decorationColor)), + ), + ), + )) ], )), Padding( @@ -232,18 +265,17 @@ class ExchangeCardState extends State { ), !_isAddressEditable && widget.hasRefundAddress ? Padding( - padding: EdgeInsets.only(top: 20), - child: Text( - S.of(context).refund_address, - style: TextStyle( - fontSize: 14, - fontWeight: FontWeight.w500, - color: - Theme.of(context) - .accentTextTheme - .display4 - .decorationColor), - )) + padding: EdgeInsets.only(top: 20), + child: Text( + S.of(context).refund_address, + style: TextStyle( + fontSize: 14, + fontWeight: FontWeight.w500, + color: Theme.of(context) + .accentTextTheme + .display4 + .decorationColor), + )) : Offstage(), _isAddressEditable ? Padding( @@ -251,7 +283,8 @@ class ExchangeCardState extends State { child: AddressTextField( controller: addressController, placeholder: widget.hasRefundAddress - ? S.of(context).refund_address : null, + ? S.of(context).refund_address + : null, options: [ AddressTextFieldOption.paste, AddressTextFieldOption.qrCode, @@ -265,8 +298,7 @@ class ExchangeCardState extends State { hintStyle: TextStyle( fontSize: 16, fontWeight: FontWeight.w600, - color: - Theme.of(context) + color: Theme.of(context) .accentTextTheme .display4 .decorationColor), @@ -281,8 +313,8 @@ class ExchangeCardState extends State { onTap: () { Clipboard.setData( ClipboardData(text: addressController.text)); - showBar(context, - S.of(context).copied_to_clipboard); + showBar( + context, S.of(context).copied_to_clipboard); }, child: Row( mainAxisSize: MainAxisSize.max, diff --git a/lib/store/settings_store.dart b/lib/store/settings_store.dart index 30cf4f238..4d535228b 100644 --- a/lib/store/settings_store.dart +++ b/lib/store/settings_store.dart @@ -153,7 +153,7 @@ abstract class SettingsStoreBase with Store { .getBool(PreferencesKey.allowBiometricalAuthenticationKey) ?? false; final legacyTheme = - sharedPreferences.getBool(PreferencesKey.isDarkThemeLegacy) + (sharedPreferences.getBool(PreferencesKey.isDarkThemeLegacy) ?? false) ? ThemeType.dark.index : ThemeType.bright.index; final savedTheme = ThemeList.deserialize( diff --git a/lib/view_model/exchange/exchange_view_model.dart b/lib/view_model/exchange/exchange_view_model.dart index e533e1e93..d2ac05048 100644 --- a/lib/view_model/exchange/exchange_view_model.dart +++ b/lib/view_model/exchange/exchange_view_model.dart @@ -1,3 +1,5 @@ +import 'package:cake_wallet/bitcoin/bitcoin_amount_format.dart'; +import 'package:cake_wallet/bitcoin/bitcoin_wallet.dart'; import 'package:cake_wallet/core/wallet_base.dart'; import 'package:cake_wallet/entities/crypto_currency.dart'; import 'package:cake_wallet/entities/sync_status.dart'; @@ -7,6 +9,7 @@ import 'package:cake_wallet/exchange/limits.dart'; import 'package:cake_wallet/exchange/trade.dart'; import 'package:cake_wallet/exchange/limits_state.dart'; import 'package:cake_wallet/store/dashboard/trades_store.dart'; +import 'package:cake_wallet/store/settings_store.dart'; import 'package:intl/intl.dart'; import 'package:mobx/mobx.dart'; import 'package:cake_wallet/generated/i18n.dart'; @@ -27,8 +30,8 @@ part 'exchange_view_model.g.dart'; class ExchangeViewModel = ExchangeViewModelBase with _$ExchangeViewModel; abstract class ExchangeViewModelBase with Store { - ExchangeViewModelBase( - this.wallet, this.trades, this._exchangeTemplateStore, this.tradesStore) { + ExchangeViewModelBase(this.wallet, this.trades, this._exchangeTemplateStore, + this.tradesStore, this._settingsStore) { providerList = [ XMRTOExchangeProvider(), ChangeNowExchangeProvider(), @@ -104,10 +107,6 @@ abstract class ExchangeViewModelBase with Store { @observable bool isReceiveAmountEntered; - Limits limits; - - NumberFormat _cryptoNumberFormat; - @computed SyncStatus get status => wallet.syncStatus; @@ -115,6 +114,15 @@ abstract class ExchangeViewModelBase with Store { ObservableList get templates => _exchangeTemplateStore.templates; + bool get hasAllAmount => + wallet.type == WalletType.bitcoin && depositCurrency == wallet.currency; + + Limits limits; + + NumberFormat _cryptoNumberFormat; + + SettingsStore _settingsStore; + @action void changeProvider({ExchangeProvider provider}) { this.provider = provider; @@ -264,9 +272,8 @@ abstract class ExchangeViewModelBase with Store { await trades.add(trade); tradeState = TradeIsCreatedSuccessfully(trade: trade); } catch (e) { - tradeState = TradeIsCreatedFailure( - title: provider.title, - error: e.toString()); + tradeState = + TradeIsCreatedFailure(title: provider.title, error: e.toString()); } } } else { @@ -291,6 +298,22 @@ abstract class ExchangeViewModelBase with Store { _onPairChange(); } + @action + void calculateDepositAllAmount() { + if (wallet is BitcoinWallet) { + final availableBalance = wallet.balance.availableBalance as int; + final fee = BitcoinWalletBase.feeAmountForPriority( + _settingsStore.transactionPriority); + + if (availableBalance < fee || availableBalance == 0) { + return; + } + + final amount = availableBalance - fee; + depositAmount = bitcoinAmountToString(amount: amount); + } + } + void updateTemplate() => _exchangeTemplateStore.update(); void addTemplate( diff --git a/lib/view_model/send/send_view_model.dart b/lib/view_model/send/send_view_model.dart index f3d46ccb3..4fec6aade 100644 --- a/lib/view_model/send/send_view_model.dart +++ b/lib/view_model/send/send_view_model.dart @@ -197,7 +197,7 @@ abstract class SendViewModelBase with Store { switch (_wallet.type) { case WalletType.bitcoin: - final amount = !sendAll ? double.parse(_amount) : null; + final amount = !sendAll ? _amount : null; return BitcoinTransactionCredentials( address, amount, _settingsStore.transactionPriority); From 83dd4d9264198bd83adbb69ad4261341c722bcef Mon Sep 17 00:00:00 2001 From: M Date: Tue, 5 Jan 2021 21:49:14 +0200 Subject: [PATCH 26/39] Fixes --- .../dashboard/balance_view_model.dart | 45 +++++++++---------- 1 file changed, 21 insertions(+), 24 deletions(-) diff --git a/lib/view_model/dashboard/balance_view_model.dart b/lib/view_model/dashboard/balance_view_model.dart index 0c4272343..dad9aa2e9 100644 --- a/lib/view_model/dashboard/balance_view_model.dart +++ b/lib/view_model/dashboard/balance_view_model.dart @@ -22,8 +22,7 @@ abstract class BalanceViewModelBase with Store { BalanceViewModelBase( {@required this.appStore, @required this.settingsStore, - @required this.fiatConvertationStore - }){ + @required this.fiatConvertationStore}) { isReversing = false; wallet ??= appStore.wallet; @@ -34,17 +33,18 @@ abstract class BalanceViewModelBase with Store { if (_wallet is MoneroWallet) { balance = _wallet.balance; - - _onMoneroBalanceChangeReaction = reaction((_) => _wallet.balance, - (MoneroBalance moneroBalance) => balance = moneroBalance); } if (_wallet is BitcoinWallet) { balance = _wallet.balance; - - _onBitcoinBalanceChangeReaction = reaction((_) => _wallet.balance, - (BitcoinBalance bitcoinBalance) => balance = bitcoinBalance); } + + _onCurrentWalletChangeReaction = + reaction((_) => wallet.balance, (dynamic balance) { + if (balance is Balance) { + this.balance = balance; + } + }); } final AppStore appStore; @@ -120,7 +120,7 @@ abstract class BalanceViewModelBase with Store { final _balance = balance; if (_balance is MoneroBalance) { - return WalletBalance( + return WalletBalance( unlockedBalance: _balance.formattedUnlockedBalance, totalBalance: _balance.formattedFullBalance); } @@ -137,32 +137,29 @@ abstract class BalanceViewModelBase with Store { @computed CryptoCurrency get currency => appStore.wallet.currency; + ReactionDisposer _onCurrentWalletChangeReaction; + ReactionDisposer _reaction; + @action void _onWalletChange(WalletBase wallet) { this.wallet = wallet; if (wallet is MoneroWallet) { balance = wallet.balance; - - _onMoneroBalanceChangeReaction?.reaction?.dispose(); - - _onMoneroBalanceChangeReaction = reaction((_) => wallet.balance, - (MoneroBalance moneroBalance) => balance = moneroBalance); } if (wallet is BitcoinWallet) { balance = wallet.balance; - - _onBitcoinBalanceChangeReaction?.reaction?.dispose(); - - _onBitcoinBalanceChangeReaction = reaction((_) => wallet.balance, - (BitcoinBalance bitcoinBalance) => balance = bitcoinBalance); } - } - ReactionDisposer _onMoneroBalanceChangeReaction; - ReactionDisposer _onBitcoinBalanceChangeReaction; - ReactionDisposer _reaction; + _onCurrentWalletChangeReaction?.reaction?.dispose(); + _onCurrentWalletChangeReaction = + reaction((_) => wallet.balance, (dynamic balance) { + if (balance is Balance) { + this.balance = balance; + } + }); + } String _getFiatBalance({double price, String cryptoAmount}) { if (cryptoAmount == null) { @@ -171,4 +168,4 @@ abstract class BalanceViewModelBase with Store { return calculateFiatAmount(price: price, cryptoAmount: cryptoAmount); } -} \ No newline at end of file +} From 5fa0a9c912393db878a411028d2765210f56b786 Mon Sep 17 00:00:00 2001 From: M Date: Tue, 5 Jan 2021 22:37:25 +0200 Subject: [PATCH 27/39] Fixes --- .../transaction_details_view_model.dart | 48 ++++++++++--------- 1 file changed, 26 insertions(+), 22 deletions(-) diff --git a/lib/view_model/transaction_details_view_model.dart b/lib/view_model/transaction_details_view_model.dart index 701071e6a..f83f23527 100644 --- a/lib/view_model/transaction_details_view_model.dart +++ b/lib/view_model/transaction_details_view_model.dart @@ -13,14 +13,15 @@ import 'package:cake_wallet/generated/i18n.dart'; part 'transaction_details_view_model.g.dart'; -class TransactionDetailsViewModel = TransactionDetailsViewModelBase with _$TransactionDetailsViewModel; +class TransactionDetailsViewModel = TransactionDetailsViewModelBase + with _$TransactionDetailsViewModel; abstract class TransactionDetailsViewModelBase with Store { - TransactionDetailsViewModelBase({ - this.transactionInfo, - this.transactionDescriptionBox, - this.settingsStore}) : items = [] { - + TransactionDetailsViewModelBase( + {this.transactionInfo, + this.transactionDescriptionBox, + this.settingsStore}) + : items = [] { showRecipientAddress = settingsStore?.shouldSaveRecipientAddress ?? false; final dateFormat = DateFormatter.withCurrentLocal(); @@ -39,14 +40,12 @@ abstract class TransactionDetailsViewModelBase with Store { title: S.current.transaction_details_amount, value: tx.amountFormatted()), StandartListItem( - title: S.current.transaction_details_fee, - value: tx.feeFormatted()), + title: S.current.transaction_details_fee, value: tx.feeFormatted()), ]; if (tx.key?.isNotEmpty ?? null) { - _items.add(StandartListItem( - title: S.current.transaction_key, - value: tx.key)); + _items.add( + StandartListItem(title: S.current.transaction_key, value: tx.key)); } items.addAll(_items); @@ -60,7 +59,8 @@ abstract class TransactionDetailsViewModelBase with Store { title: S.current.transaction_details_date, value: dateFormat.format(tx.date)), StandartListItem( - title: S.current.confirmations, value: tx.confirmations?.toString()), + title: S.current.confirmations, + value: tx.confirmations?.toString()), StandartListItem( title: S.current.transaction_details_height, value: '${tx.height}'), StandartListItem( @@ -88,17 +88,21 @@ abstract class TransactionDetailsViewModelBase with Store { } final description = transactionDescriptionBox.values.firstWhere( - (val) => val.id == transactionInfo.id, orElse: () => null); + (val) => val.id == transactionInfo.id, + orElse: () => TransactionDescription(id: transactionInfo.id)); - if (description != null) { - items.add(TextFieldListItem( - title: S.current.note_tap_to_change, - value: description.note, - onSubmitted: (value) { - description.transactionNote = value; + items.add(TextFieldListItem( + title: S.current.note_tap_to_change, + value: description.note, + onSubmitted: (value) { + description.transactionNote = value; + + if (description.isInBox) { description.save(); - })); - } + } else { + transactionDescriptionBox.add(description); + } + })); } final TransactionInfo transactionInfo; @@ -107,4 +111,4 @@ abstract class TransactionDetailsViewModelBase with Store { final List items; bool showRecipientAddress; -} \ No newline at end of file +} From 3722d7e05a7ab3c06dd1b0431893d3aed2c5b6d6 Mon Sep 17 00:00:00 2001 From: M Date: Tue, 5 Jan 2021 22:58:53 +0200 Subject: [PATCH 28/39] Changed build versions for ios and android projects. --- ios/Runner.xcodeproj/project.pbxproj | 6 +++--- pubspec.yaml | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/ios/Runner.xcodeproj/project.pbxproj b/ios/Runner.xcodeproj/project.pbxproj index 5ce246e34..54f1ecb6f 100644 --- a/ios/Runner.xcodeproj/project.pbxproj +++ b/ios/Runner.xcodeproj/project.pbxproj @@ -354,7 +354,7 @@ buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CLANG_ENABLE_MODULES = YES; - CURRENT_PROJECT_VERSION = 10; + CURRENT_PROJECT_VERSION = 11; DEVELOPMENT_TEAM = 32J6BB6VUS; ENABLE_BITCODE = NO; FRAMEWORK_SEARCH_PATHS = ( @@ -494,7 +494,7 @@ buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CLANG_ENABLE_MODULES = YES; - CURRENT_PROJECT_VERSION = 10; + CURRENT_PROJECT_VERSION = 11; DEVELOPMENT_TEAM = 32J6BB6VUS; ENABLE_BITCODE = NO; FRAMEWORK_SEARCH_PATHS = ( @@ -528,7 +528,7 @@ buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CLANG_ENABLE_MODULES = YES; - CURRENT_PROJECT_VERSION = 10; + CURRENT_PROJECT_VERSION = 11; DEVELOPMENT_TEAM = 32J6BB6VUS; ENABLE_BITCODE = NO; FRAMEWORK_SEARCH_PATHS = ( diff --git a/pubspec.yaml b/pubspec.yaml index 8c94d2272..8be2f91a7 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -11,7 +11,7 @@ description: Cake Wallet. # In iOS, build-name is used as CFBundleShortVersionString while build-number used as CFBundleVersion. # Read more about iOS versioning at # https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html -version: 4.1.0+26 +version: 4.1.0+27 environment: sdk: ">=2.7.0 <3.0.0" From 68a39bdcfc65b1b8dc7fd0aea734b467c626c66c Mon Sep 17 00:00:00 2001 From: OleksandrSobol Date: Wed, 6 Jan 2021 10:42:21 +0200 Subject: [PATCH 29/39] CAKE-222 | fixed transaction priority picker on the send page --- lib/src/screens/send/send_page.dart | 3 ++- lib/view_model/send/send_view_model.dart | 7 +++++++ lib/view_model/settings/settings_view_model.dart | 4 ++-- 3 files changed, 11 insertions(+), 3 deletions(-) diff --git a/lib/src/screens/send/send_page.dart b/lib/src/screens/send/send_page.dart index 1a18b5ba6..c4a350d82 100644 --- a/lib/src/screens/send/send_page.dart +++ b/lib/src/screens/send/send_page.dart @@ -746,6 +746,7 @@ class SendPage extends BasePage { Future _setTransactionPriority(BuildContext context) async { final items = TransactionPriority.forWalletType(sendViewModel.walletType); final selectedItem = items.indexOf(sendViewModel.transactionPriority); + final isShowScrollThumb = items.length > 3; await showPopUp( builder: (_) => Picker( @@ -755,7 +756,7 @@ class SendPage extends BasePage { mainAxisAlignment: MainAxisAlignment.center, onItemSelected: (TransactionPriority priority) => sendViewModel.setTransactionPriority(priority), - isAlwaysShowScrollThumb: true, + isAlwaysShowScrollThumb: isShowScrollThumb, ), context: context); } diff --git a/lib/view_model/send/send_view_model.dart b/lib/view_model/send/send_view_model.dart index f3d46ccb3..6b04de21c 100644 --- a/lib/view_model/send/send_view_model.dart +++ b/lib/view_model/send/send_view_model.dart @@ -38,6 +38,13 @@ abstract class SendViewModelBase with Store { : state = InitialExecutionState(), _cryptoNumberFormat = NumberFormat(), sendAll = false { + final _priority = _settingsStore.transactionPriority; + + if (!TransactionPriority.forWalletType(walletType).contains(_priority)) { + _settingsStore.transactionPriority = + TransactionPriority.forWalletType(walletType).first; + } + _setCryptoNumMaximumFractionDigits(); } diff --git a/lib/view_model/settings/settings_view_model.dart b/lib/view_model/settings/settings_view_model.dart index 4f43d528a..49ae9557f 100644 --- a/lib/view_model/settings/settings_view_model.dart +++ b/lib/view_model/settings/settings_view_model.dart @@ -36,9 +36,9 @@ abstract class SettingsViewModelBase with Store { PackageInfo.fromPlatform().then( (PackageInfo packageInfo) => currentVersion = packageInfo.version); - final priority = _settingsStore.transactionPriority; + final _priority = _settingsStore.transactionPriority; - if (!TransactionPriority.forWalletType(_walletType).contains(priority)) { + if (!TransactionPriority.forWalletType(_walletType).contains(_priority)) { _settingsStore.transactionPriority = TransactionPriority.forWalletType(_walletType).first; } From 53c12d7bc098cbeb1a452d09c20de0c825bf8076 Mon Sep 17 00:00:00 2001 From: OleksandrSobol Date: Wed, 6 Jan 2021 15:34:04 +0200 Subject: [PATCH 30/39] CAKE-227 | applied null to subname for btc wallet in the dashboard_view_model.dart; deleted isDrawBottom from trade_details_page.dart, transaction_details_page.dart, standart_list_row.dart, textfield_list_row.dart; applied SectionStandardList to trade_details_page.dart and transaction_details_page.dart --- .../trade_details/trade_details_page.dart | 35 +++--- .../transaction_details_page.dart | 69 +++++------- .../widgets/textfield_list_row.dart | 97 +++++++--------- lib/src/widgets/standart_list_row.dart | 105 ++++++++---------- .../dashboard/dashboard_view_model.dart | 2 + 5 files changed, 126 insertions(+), 182 deletions(-) diff --git a/lib/src/screens/trade_details/trade_details_page.dart b/lib/src/screens/trade_details/trade_details_page.dart index f108e85bd..e4cad6547 100644 --- a/lib/src/screens/trade_details/trade_details_page.dart +++ b/lib/src/screens/trade_details/trade_details_page.dart @@ -1,3 +1,4 @@ +import 'package:cake_wallet/src/widgets/standard_list.dart'; import 'package:cake_wallet/utils/show_bar.dart'; import 'package:cake_wallet/view_model/trade_details_view_model.dart'; import 'package:flutter/material.dart'; @@ -18,35 +19,25 @@ class TradeDetailsPage extends BasePage { @override Widget body(BuildContext context) { - return Container(child: Observer(builder: (_) { - return ListView.separated( - separatorBuilder: (_, __) => Container( - height: 1, - padding: EdgeInsets.only(left: 24), - color: Theme.of(context).backgroundColor, - child: Container( - height: 1, - color: Theme.of(context) - .primaryTextTheme - .title - .backgroundColor)), - itemCount: tradeDetailsViewModel.items.length, - itemBuilder: (BuildContext context, int index) { + return Observer(builder: (_) { + return SectionStandardList( + sectionCount: 1, + itemCounter: (int _) => tradeDetailsViewModel.items.length, + itemBuilder: (_, __, index) { final item = tradeDetailsViewModel.items[index]; - final isDrawBottom = - index == tradeDetailsViewModel.items.length - 1 ? true : false; return GestureDetector( onTap: () { Clipboard.setData(ClipboardData(text: '${item.value}')); - showBar(context, S.of(context).copied_to_clipboard); + showBar(context, S + .of(context) + .copied_to_clipboard); }, child: StandartListRow( - title: '${item.title}', - value: '${item.value}', - isDrawBottom: isDrawBottom, + title: '${item.title}', + value: '${item.value}' )); }); - })); + }); } -} +} \ No newline at end of file diff --git a/lib/src/screens/transaction_details/transaction_details_page.dart b/lib/src/screens/transaction_details/transaction_details_page.dart index a0e1b3c7a..d7a265a9a 100644 --- a/lib/src/screens/transaction_details/transaction_details_page.dart +++ b/lib/src/screens/transaction_details/transaction_details_page.dart @@ -1,5 +1,6 @@ import 'package:cake_wallet/src/screens/transaction_details/textfield_list_item.dart'; import 'package:cake_wallet/src/screens/transaction_details/widgets/textfield_list_row.dart'; +import 'package:cake_wallet/src/widgets/standard_list.dart'; import 'package:cake_wallet/utils/show_bar.dart'; import 'package:cake_wallet/view_model/transaction_details_view_model.dart'; import 'package:flutter/material.dart'; @@ -19,50 +20,34 @@ class TransactionDetailsPage extends BasePage { @override Widget body(BuildContext context) { - return Container( - child: ListView.separated( - separatorBuilder: (context, index) => Container( - height: 1, - padding: EdgeInsets.only(left: 24), - color: Theme.of(context).backgroundColor, - child: Container( - height: 1, - color: - Theme.of(context).primaryTextTheme.title.backgroundColor, - ), - ), - itemCount: transactionDetailsViewModel.items.length, - itemBuilder: (context, index) { - final item = transactionDetailsViewModel.items[index]; - final isDrawBottom = - index == transactionDetailsViewModel.items.length - 1 - ? true : false; + return SectionStandardList( + sectionCount: 1, + itemCounter: (int _) => transactionDetailsViewModel.items.length, + itemBuilder: (_, __, index) { + final item = transactionDetailsViewModel.items[index]; - if (item is StandartListItem) { - return GestureDetector( - onTap: () { - Clipboard.setData(ClipboardData(text: item.value)); - showBar(context, - S.of(context).transaction_details_copied(item.title)); - }, - child: StandartListRow( - title: '${item.title}:', - value: item.value, - isDrawBottom: isDrawBottom), - ); - } + if (item is StandartListItem) { + return GestureDetector( + onTap: () { + Clipboard.setData(ClipboardData(text: item.value)); + showBar(context, + S.of(context).transaction_details_copied(item.title)); + }, + child: StandartListRow( + title: '${item.title}:', + value: item.value), + ); + } - if (item is TextFieldListItem) { - return TextFieldListRow( - title: item.title, - value: item.value, - onSubmitted: item.onSubmitted, - isDrawBottom: isDrawBottom, - ); - } + if (item is TextFieldListItem) { + return TextFieldListRow( + title: item.title, + value: item.value, + onSubmitted: item.onSubmitted, + ); + } - return null; - }), - ); + return null; + }); } } diff --git a/lib/src/screens/transaction_details/widgets/textfield_list_row.dart b/lib/src/screens/transaction_details/widgets/textfield_list_row.dart index 92e1fb601..777f9bbfa 100644 --- a/lib/src/screens/transaction_details/widgets/textfield_list_row.dart +++ b/lib/src/screens/transaction_details/widgets/textfield_list_row.dart @@ -8,8 +8,7 @@ class TextFieldListRow extends StatelessWidget { this.value, this.titleFontSize = 14, this.valueFontSize = 16, - this.onSubmitted, - this.isDrawBottom = false}) { + this.onSubmitted}) { _textController = TextEditingController(); _textController.text = value; @@ -20,69 +19,53 @@ class TextFieldListRow extends StatelessWidget { final double titleFontSize; final double valueFontSize; final Function(String value) onSubmitted; - final bool isDrawBottom; TextEditingController _textController; @override Widget build(BuildContext context) { - return Column( - children: [ - Container( - width: double.infinity, - color: Theme.of(context).backgroundColor, - child: Padding( - padding: - const EdgeInsets.only(left: 24, top: 16, bottom: 16, right: 24), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Text(title, - style: TextStyle( - fontSize: titleFontSize, - fontWeight: FontWeight.w500, - color: Theme.of(context) - .primaryTextTheme.overline.color), - textAlign: TextAlign.left), - TextField( - controller: _textController, - keyboardType: TextInputType.multiline, - textInputAction: TextInputAction.done, - maxLines: null, - textAlign: TextAlign.start, - style: TextStyle( + return Container( + width: double.infinity, + color: Theme.of(context).backgroundColor, + child: Padding( + padding: + const EdgeInsets.only(left: 24, top: 16, bottom: 16, right: 24), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text(title, + style: TextStyle( + fontSize: titleFontSize, + fontWeight: FontWeight.w500, + color: Theme.of(context) + .primaryTextTheme.overline.color), + textAlign: TextAlign.left), + TextField( + controller: _textController, + keyboardType: TextInputType.multiline, + textInputAction: TextInputAction.done, + maxLines: null, + textAlign: TextAlign.start, + style: TextStyle( + fontSize: valueFontSize, + fontWeight: FontWeight.w500, + color: Theme.of(context) + .primaryTextTheme.title.color), + decoration: InputDecoration( + isDense: true, + contentPadding: EdgeInsets.only(top: 12, bottom: 0), + hintText: S.of(context).enter_your_note, + hintStyle: TextStyle( fontSize: valueFontSize, fontWeight: FontWeight.w500, color: Theme.of(context) - .primaryTextTheme.title.color), - decoration: InputDecoration( - isDense: true, - contentPadding: EdgeInsets.only(top: 12, bottom: 0), - hintText: S.of(context).enter_your_note, - hintStyle: TextStyle( - fontSize: valueFontSize, - fontWeight: FontWeight.w500, - color: Theme.of(context) - .primaryTextTheme.overline.color), - border: InputBorder.none - ), - onSubmitted: (value) => onSubmitted.call(value), - ) - ]), - ), - ), - isDrawBottom - ? Container( - height: 1, - padding: EdgeInsets.only(left: 24), - color: Theme.of(context).backgroundColor, - child: Container( - height: 1, - color: Theme.of(context).primaryTextTheme.title.backgroundColor, - ), - ) - : Offstage(), - ], + .primaryTextTheme.overline.color), + border: InputBorder.none + ), + onSubmitted: (value) => onSubmitted.call(value), + ) + ]), + ), ); } } diff --git a/lib/src/widgets/standart_list_row.dart b/lib/src/widgets/standart_list_row.dart index d29e84065..4ed0ac4c9 100644 --- a/lib/src/widgets/standart_list_row.dart +++ b/lib/src/widgets/standart_list_row.dart @@ -7,77 +7,60 @@ class StandartListRow extends StatelessWidget { this.value, this.titleFontSize = 14, this.valueFontSize = 16, - this.image, - this.isDrawBottom = false}); + this.image}); final String title; final String value; final double titleFontSize; final double valueFontSize; final Image image; - final bool isDrawBottom; @override Widget build(BuildContext context) { - return Column( - children: [ - Container( - width: double.infinity, - color: Theme.of(context).backgroundColor, - child: Padding( - padding: - const EdgeInsets.only(left: 24, top: 16, bottom: 16, right: 24), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Text(title, - style: TextStyle( - fontSize: titleFontSize, - fontWeight: FontWeight.w500, - color: - Theme.of(context).primaryTextTheme.overline.color), - textAlign: TextAlign.left), - Padding( - padding: const EdgeInsets.only(top: 12), - child: Row( - mainAxisSize: MainAxisSize.max, - mainAxisAlignment: MainAxisAlignment.spaceBetween, - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Expanded( - child: Text(value, - style: TextStyle( - fontSize: valueFontSize, - fontWeight: FontWeight.w500, - color: Theme.of(context) - .primaryTextTheme - .title - .color)), - ), - image != null - ? Padding( - padding: EdgeInsets.only(left: 24), - child: image, - ) - : Offstage() - ], + return Container( + width: double.infinity, + color: Theme.of(context).backgroundColor, + child: Padding( + padding: + const EdgeInsets.only(left: 24, top: 16, bottom: 16, right: 24), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text(title, + style: TextStyle( + fontSize: titleFontSize, + fontWeight: FontWeight.w500, + color: + Theme.of(context).primaryTextTheme.overline.color), + textAlign: TextAlign.left), + Padding( + padding: const EdgeInsets.only(top: 12), + child: Row( + mainAxisSize: MainAxisSize.max, + mainAxisAlignment: MainAxisAlignment.spaceBetween, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Expanded( + child: Text(value, + style: TextStyle( + fontSize: valueFontSize, + fontWeight: FontWeight.w500, + color: Theme.of(context) + .primaryTextTheme + .title + .color)), ), - ) - ]), - ), - ), - isDrawBottom - ? Container( - height: 1, - padding: EdgeInsets.only(left: 24), - color: Theme.of(context).backgroundColor, - child: Container( - height: 1, - color: Theme.of(context).primaryTextTheme.title.backgroundColor, - ), - ) - : Offstage(), - ], + image != null + ? Padding( + padding: EdgeInsets.only(left: 24), + child: image, + ) + : Offstage() + ], + ), + ) + ]), + ), ); } } diff --git a/lib/view_model/dashboard/dashboard_view_model.dart b/lib/view_model/dashboard/dashboard_view_model.dart index 420586997..37177311f 100644 --- a/lib/view_model/dashboard/dashboard_view_model.dart +++ b/lib/view_model/dashboard/dashboard_view_model.dart @@ -231,6 +231,8 @@ abstract class DashboardViewModelBase with Store { _onMoneroTransactionsUpdate(wallet); } else { + subname = null; + transactions.clear(); transactions.addAll(wallet.transactionHistory.transactions.values.map( From 5f287709a0cd21ff6f9057c5f71ad554a50cc9b7 Mon Sep 17 00:00:00 2001 From: OleksandrSobol Date: Wed, 6 Jan 2021 17:15:34 +0200 Subject: [PATCH 31/39] CAKE-229 | changed welcome screen text --- lib/generated/i18n.dart | 26 +++++++++++++------------- res/values/strings_de.arb | 2 +- res/values/strings_en.arb | 4 ++-- res/values/strings_es.arb | 2 +- res/values/strings_hi.arb | 2 +- res/values/strings_ja.arb | 2 +- res/values/strings_ko.arb | 2 +- res/values/strings_nl.arb | 2 +- res/values/strings_pl.arb | 2 +- res/values/strings_pt.arb | 2 +- res/values/strings_ru.arb | 2 +- res/values/strings_uk.arb | 2 +- res/values/strings_zh.arb | 2 +- 13 files changed, 26 insertions(+), 26 deletions(-) diff --git a/lib/generated/i18n.dart b/lib/generated/i18n.dart index 156b036e9..1b19e3e7d 100644 --- a/lib/generated/i18n.dart +++ b/lib/generated/i18n.dart @@ -106,7 +106,7 @@ class S implements WidgetsLocalizations { String get faq => "FAQ"; String get fetching => "Fetching"; String get filters => "Filter"; - String get first_wallet_text => "Awesome wallet for Monero"; + String get first_wallet_text => "Awesome wallet for Monero and Bitcoin"; String get full_balance => "Full Balance"; String get hidden_balance => "Hidden Balance"; String get id => "ID: "; @@ -143,7 +143,7 @@ class S implements WidgetsLocalizations { String get pin_is_incorrect => "PIN is incorrect"; String get placeholder_contacts => "Your contacts will be displayed here"; String get placeholder_transactions => "Your transactions will be displayed here"; - String get please_make_selection => "Please make selection below to create or recover your wallet."; + String get please_make_selection => "Please make a selection below to create or recover your wallet."; String get please_select => "Please select:"; String get please_try_to_connect_to_another_node => "Please try to connect to another node"; String get pre_seed_button_text => "I understand. Show me my seed"; @@ -1015,7 +1015,7 @@ class $de extends S { @override String get digit_pin => "-stelliger PIN"; @override - String get first_wallet_text => "tolle Brieftasche zum Monero"; + String get first_wallet_text => "tolle Brieftasche zum Monero und Bitcoin"; @override String get settings_trades => "Handel"; @override @@ -1729,7 +1729,7 @@ class $hi extends S { @override String get digit_pin => "-अंक पिन"; @override - String get first_wallet_text => "बहुत बढ़िया बटुआ के लिये Monero"; + String get first_wallet_text => "Monero और Bitcoin के लिए बहुत बढ़िया बटुआ"; @override String get settings_trades => "ट्रेडों"; @override @@ -2443,7 +2443,7 @@ class $ru extends S { @override String get digit_pin => "-значный PIN"; @override - String get first_wallet_text => "В самом удобном кошельке для Monero"; + String get first_wallet_text => "В самом удобном кошельке для Monero и Bitcoin"; @override String get settings_trades => "Сделки"; @override @@ -3157,7 +3157,7 @@ class $ko extends S { @override String get digit_pin => "숫자 PIN"; @override - String get first_wallet_text => "멋진 지갑 에 대한 Monero"; + String get first_wallet_text => "Monero 및 Bitcoin을위한 멋진 지갑"; @override String get settings_trades => "거래"; @override @@ -3871,7 +3871,7 @@ class $pt extends S { @override String get digit_pin => "dígitos"; @override - String get first_wallet_text => "Uma fantástica carteira para Monero"; + String get first_wallet_text => "Uma fantástica carteira para Monero e Bitcoin"; @override String get settings_trades => "Trocas"; @override @@ -4585,7 +4585,7 @@ class $uk extends S { @override String get digit_pin => "-значний PIN"; @override - String get first_wallet_text => "В самому зручному гаманці для Monero"; + String get first_wallet_text => "В самому зручному гаманці для Monero та Bitcoin"; @override String get settings_trades => "Операції"; @override @@ -5299,7 +5299,7 @@ class $ja extends S { @override String get digit_pin => "桁ピン"; @override - String get first_wallet_text => "素晴らしい財布 ために Monero"; + String get first_wallet_text => "Moneroとビットコインのための素晴らしい財布"; @override String get settings_trades => "取引"; @override @@ -6017,7 +6017,7 @@ class $pl extends S { @override String get digit_pin => "-znak PIN"; @override - String get first_wallet_text => "Niesamowity portfel dla Monero"; + String get first_wallet_text => "Niesamowity portfel dla Monero i Bitcoin"; @override String get settings_trades => "Transakcje"; @override @@ -6731,7 +6731,7 @@ class $es extends S { @override String get digit_pin => "-dígito PIN"; @override - String get first_wallet_text => "Impresionante billetera para Monero"; + String get first_wallet_text => "Impresionante billetera para Monero y Bitcoin"; @override String get settings_trades => "Comercia"; @override @@ -7445,7 +7445,7 @@ class $nl extends S { @override String get digit_pin => "-cijferige PIN"; @override - String get first_wallet_text => "Geweldige portemonnee fvoor Monero"; + String get first_wallet_text => "Geweldige portemonnee voor Monero en Bitcoin"; @override String get settings_trades => "Trades"; @override @@ -8159,7 +8159,7 @@ class $zh extends S { @override String get digit_pin => "数字别针"; @override - String get first_wallet_text => "很棒的钱包 对于 Monero"; + String get first_wallet_text => "很棒的Monero和比特幣錢包"; @override String get settings_trades => "交易"; @override diff --git a/res/values/strings_de.arb b/res/values/strings_de.arb index 24d83ad19..bd3ea3641 100644 --- a/res/values/strings_de.arb +++ b/res/values/strings_de.arb @@ -1,7 +1,7 @@ { "welcome" : "Willkommen zu", "cake_wallet" : "Cake Wallet", - "first_wallet_text" : "tolle Brieftasche zum Monero", + "first_wallet_text" : "tolle Brieftasche zum Monero und Bitcoin", "please_make_selection" : "Bitte treffen Sie unten eine Auswahl zu Erstellen oder Wiederherstellen Ihrer Brieftasche.", "create_new" : "Neue Wallet erstellen", "restore_wallet" : "Wallet wiederherstellen", diff --git a/res/values/strings_en.arb b/res/values/strings_en.arb index 564f66afe..6570d79e8 100644 --- a/res/values/strings_en.arb +++ b/res/values/strings_en.arb @@ -1,8 +1,8 @@ { "welcome" : "Welcome to", "cake_wallet" : "Cake Wallet", - "first_wallet_text" : "Awesome wallet for Monero", - "please_make_selection" : "Please make selection below to create or recover your wallet.", + "first_wallet_text" : "Awesome wallet for Monero and Bitcoin", + "please_make_selection" : "Please make a selection below to create or recover your wallet.", "create_new" : "Create New Wallet", "restore_wallet" : "Restore Wallet", diff --git a/res/values/strings_es.arb b/res/values/strings_es.arb index 6c5602e83..1f77d14de 100644 --- a/res/values/strings_es.arb +++ b/res/values/strings_es.arb @@ -1,7 +1,7 @@ { "welcome" : "Bienvenido", "cake_wallet" : "Cake Wallet", - "first_wallet_text" : "Impresionante billetera para Monero", + "first_wallet_text" : "Impresionante billetera para Monero y Bitcoin", "please_make_selection" : "Seleccione a continuación para crear o recuperar su billetera.", "create_new" : "Crear nueva billetera", "restore_wallet" : "Restaurar billetera", diff --git a/res/values/strings_hi.arb b/res/values/strings_hi.arb index fee94b031..af34f66b8 100644 --- a/res/values/strings_hi.arb +++ b/res/values/strings_hi.arb @@ -1,7 +1,7 @@ { "welcome" : "स्वागत हे सेवा मेरे", "cake_wallet" : "Cake Wallet", - "first_wallet_text" : "बहुत बढ़िया बटुआ के लिये Monero", + "first_wallet_text" : "Monero और Bitcoin के लिए बहुत बढ़िया बटुआ", "please_make_selection" : "कृपया नीचे चयन करें अपना बटुआ बनाएं या पुनर्प्राप्त करें.", "create_new" : "नया बटुआ बनाएँ", "restore_wallet" : "वॉलेट को पुनर्स्थापित करें", diff --git a/res/values/strings_ja.arb b/res/values/strings_ja.arb index 0d1d2b5fe..6bc0dc5c4 100644 --- a/res/values/strings_ja.arb +++ b/res/values/strings_ja.arb @@ -1,7 +1,7 @@ { "welcome" : "ようこそ に", "cake_wallet" : "Cake Wallet", - "first_wallet_text" : "素晴らしい財布 ために Monero", + "first_wallet_text" : "Moneroとビットコインのための素晴らしい財布", "please_make_selection" : "以下を選択してください ウォレットを作成または回復する.", "create_new" : "新しいウォレットを作成", "restore_wallet" : "ウォレットを復元", diff --git a/res/values/strings_ko.arb b/res/values/strings_ko.arb index cbc90a298..f71eac28e 100644 --- a/res/values/strings_ko.arb +++ b/res/values/strings_ko.arb @@ -1,7 +1,7 @@ { "welcome" : "환영 에", "cake_wallet" : "Cake Wallet", - "first_wallet_text" : "멋진 지갑 에 대한 Monero", + "first_wallet_text" : "Monero 및 Bitcoin을위한 멋진 지갑", "please_make_selection" : "아래에서 선택하십시오 지갑 만들기 또는 복구.", "create_new" : "새 월렛 만들기", "restore_wallet" : "월렛 복원", diff --git a/res/values/strings_nl.arb b/res/values/strings_nl.arb index b88edf38b..ca7671e1b 100644 --- a/res/values/strings_nl.arb +++ b/res/values/strings_nl.arb @@ -1,7 +1,7 @@ { "welcome" : "Welkom bij", "cake_wallet" : "Cake Wallet", - "first_wallet_text" : "Geweldige portemonnee fvoor Monero", + "first_wallet_text" : "Geweldige portemonnee voor Monero en Bitcoin", "please_make_selection" : "Maak hieronder uw keuze tot maak of herstel je portemonnee.", "create_new" : "Maak een nieuwe portemonnee", "restore_wallet" : "Portemonnee herstellen", diff --git a/res/values/strings_pl.arb b/res/values/strings_pl.arb index 0861aeb93..0c6decbae 100644 --- a/res/values/strings_pl.arb +++ b/res/values/strings_pl.arb @@ -1,7 +1,7 @@ { "welcome" : "Witamy w", "cake_wallet" : "Cake Wallet", - "first_wallet_text" : "Niesamowity portfel dla Monero", + "first_wallet_text" : "Niesamowity portfel dla Monero i Bitcoin", "please_make_selection" : "Wybierz poniżej, aby cutwórz lub odzyskaj swój portfel.", "create_new" : "Utwórz nowy portfel", "restore_wallet" : "Przywróć portfel", diff --git a/res/values/strings_pt.arb b/res/values/strings_pt.arb index 075822128..4537fa7ac 100644 --- a/res/values/strings_pt.arb +++ b/res/values/strings_pt.arb @@ -1,7 +1,7 @@ { "welcome" : "Bem-vindo ao", "cake_wallet" : "Cake Wallet", - "first_wallet_text" : "Uma fantástica carteira para Monero", + "first_wallet_text" : "Uma fantástica carteira para Monero e Bitcoin", "please_make_selection" : "Escolha se quer criar uma carteira nova ou restaurar uma antiga.", "create_new" : "Criar nova carteira", "restore_wallet" : "Restaurar carteira", diff --git a/res/values/strings_ru.arb b/res/values/strings_ru.arb index 0be294115..5a7bbd69e 100644 --- a/res/values/strings_ru.arb +++ b/res/values/strings_ru.arb @@ -1,7 +1,7 @@ { "welcome" : "Приветствуем в", "cake_wallet" : "Cake Wallet", - "first_wallet_text" : "В самом удобном кошельке для Monero", + "first_wallet_text" : "В самом удобном кошельке для Monero и Bitcoin", "please_make_selection" : "Выберите способ создания кошелька: создать новый или восстановить ваш существующий.", "create_new" : "Создать новый кошелёк", "restore_wallet" : "Восстановить кошелёк", diff --git a/res/values/strings_uk.arb b/res/values/strings_uk.arb index 288ec0728..2d7f06d62 100644 --- a/res/values/strings_uk.arb +++ b/res/values/strings_uk.arb @@ -1,7 +1,7 @@ { "welcome" : "Вітаємо в", "cake_wallet" : "Cake Wallet", - "first_wallet_text" : "В самому зручному гаманці для Monero", + "first_wallet_text" : "В самому зручному гаманці для Monero та Bitcoin", "please_make_selection" : "Оберіть спосіб створення гаманця: створити новий чи відновити ваш існуючий.", "create_new" : "Створити новий гаманець", "restore_wallet" : "Відновити гаманець", diff --git a/res/values/strings_zh.arb b/res/values/strings_zh.arb index 780fb4ad9..03cc79c2e 100644 --- a/res/values/strings_zh.arb +++ b/res/values/strings_zh.arb @@ -1,7 +1,7 @@ { "welcome" : "歡迎來到", "cake_wallet" : "Cake Wallet", - "first_wallet_text" : "很棒的钱包 对于 Monero", + "first_wallet_text" : "很棒的Monero和比特幣錢包", "please_make_selection" : "请在下面进行选择 创建或恢复您的钱包.", "create_new" : "创建新钱包", "restore_wallet" : "恢复钱包", From 6a9720d5d64f23de352b9fac101d26c0060bcbbb Mon Sep 17 00:00:00 2001 From: M Date: Wed, 6 Jan 2021 22:53:59 +0200 Subject: [PATCH 32/39] Fixes and changed build versions for ios and android projects. --- ios/Runner.xcodeproj/project.pbxproj | 6 +- lib/bitcoin/bitcoin_balance.dart | 6 +- lib/bitcoin/electrum.dart | 79 ++++++++++++------- lib/main.dart | 1 - .../exchange_trade/exchange_trade_page.dart | 11 ++- .../exchange/exchange_view_model.dart | 2 +- pubspec.yaml | 2 +- 7 files changed, 68 insertions(+), 39 deletions(-) diff --git a/ios/Runner.xcodeproj/project.pbxproj b/ios/Runner.xcodeproj/project.pbxproj index 54f1ecb6f..8a1bb7be5 100644 --- a/ios/Runner.xcodeproj/project.pbxproj +++ b/ios/Runner.xcodeproj/project.pbxproj @@ -354,7 +354,7 @@ buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CLANG_ENABLE_MODULES = YES; - CURRENT_PROJECT_VERSION = 11; + CURRENT_PROJECT_VERSION = 12; DEVELOPMENT_TEAM = 32J6BB6VUS; ENABLE_BITCODE = NO; FRAMEWORK_SEARCH_PATHS = ( @@ -494,7 +494,7 @@ buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CLANG_ENABLE_MODULES = YES; - CURRENT_PROJECT_VERSION = 11; + CURRENT_PROJECT_VERSION = 12; DEVELOPMENT_TEAM = 32J6BB6VUS; ENABLE_BITCODE = NO; FRAMEWORK_SEARCH_PATHS = ( @@ -528,7 +528,7 @@ buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CLANG_ENABLE_MODULES = YES; - CURRENT_PROJECT_VERSION = 11; + CURRENT_PROJECT_VERSION = 12; DEVELOPMENT_TEAM = 32J6BB6VUS; ENABLE_BITCODE = NO; FRAMEWORK_SEARCH_PATHS = ( diff --git a/lib/bitcoin/bitcoin_balance.dart b/lib/bitcoin/bitcoin_balance.dart index 3cc66bfe8..5081616ea 100644 --- a/lib/bitcoin/bitcoin_balance.dart +++ b/lib/bitcoin/bitcoin_balance.dart @@ -27,10 +27,10 @@ class BitcoinBalance extends Balance { final int confirmed; final int unconfirmed; - int get total => - confirmed + (unconfirmed < 0 ? unconfirmed * -1 : unconfirmed); + int get total => confirmed + unconfirmed; - int get availableBalance => confirmed + (unconfirmed < 0 ? unconfirmed : 0); + int get availableBalance => + (confirmed ?? 0) + (unconfirmed < 0 ? unconfirmed : 0); String get confirmedFormatted => bitcoinAmountToString(amount: confirmed); diff --git a/lib/bitcoin/electrum.dart b/lib/bitcoin/electrum.dart index 20dc29688..be1aba92e 100644 --- a/lib/bitcoin/electrum.dart +++ b/lib/bitcoin/electrum.dart @@ -22,9 +22,8 @@ String jsonrpcparams(List params) { } String jsonrpc( - {String method, List params, int id, double version = 2.0}) => - '{"jsonrpc": "$version", "method": "$method", "id": "$id", "params": ${json - .encode(params)}}\n'; + {String method, List params, int id, double version = 2.0}) => + '{"jsonrpc": "$version", "method": "$method", "id": "$id", "params": ${json.encode(params)}}\n'; class SocketTask { SocketTask({this.completer, this.isSubscription, this.subject}); @@ -75,7 +74,9 @@ class ElectrumClient { socket.listen((Uint8List event) { try { - _handleResponse(utf8.decode(event.toList())); + final response = + json.decode(utf8.decode(event.toList())) as Map; + _handleResponse(response); } on FormatException catch (e) { final msg = e.message.toLowerCase(); @@ -87,12 +88,33 @@ class ElectrumClient { unterminatedString += e.source as String; } + if (msg.contains("not a subtype of type")) { + unterminatedString += e.source as String; + return; + } + if (isJSONStringCorrect(unterminatedString)) { - _handleResponse(unterminatedString); + final response = + json.decode(unterminatedString) as Map; + _handleResponse(response); + unterminatedString = null; + } + } on TypeError catch (e) { + if (!e.toString().contains('Map')) { + return; + } + + final source = utf8.decode(event.toList()); + unterminatedString += source; + + if (isJSONStringCorrect(unterminatedString)) { + final response = + json.decode(unterminatedString) as Map; + _handleResponse(response); unterminatedString = null; } } catch (e) { - print(e); + print(e.toString()); } }, onError: (Object error) { print(error.toString()); @@ -153,7 +175,7 @@ class ElectrumClient { }); Future>> getListUnspentWithAddress( - String address) => + String address) => call( method: 'blockchain.scripthash.listunspent', params: [scriptHash(address)]).then((dynamic result) { @@ -204,7 +226,7 @@ class ElectrumClient { }); Future> getTransactionRaw( - {@required String hash}) async => + {@required String hash}) async => call(method: 'blockchain.transaction.get', params: [hash, true]) .then((dynamic result) { if (result is Map) { @@ -233,25 +255,25 @@ class ElectrumClient { } Future broadcastTransaction( - {@required String transactionRaw}) async => + {@required String transactionRaw}) async => call(method: 'blockchain.transaction.broadcast', params: [transactionRaw]) .then((dynamic result) { if (result is String) { return result; } - + print(result); return ''; }); Future> getMerkle( - {@required String hash, @required int height}) async => + {@required String hash, @required int height}) async => await call( method: 'blockchain.transaction.get_merkle', params: [hash, height]) as Map; Future> getHeader({@required int height}) async => await call(method: 'blockchain.block.get_header', params: [height]) - as Map; + as Map; Future estimatefee({@required int p}) => call(method: 'blockchain.estimatefee', params: [p]) @@ -275,9 +297,10 @@ class ElectrumClient { params: [scripthash]); } - BehaviorSubject subscribe({@required String id, - @required String method, - List params = const []}) { + BehaviorSubject subscribe( + {@required String id, + @required String method, + List params = const []}) { final subscription = BehaviorSubject(); _regisrySubscription(id, subscription); socket.write(jsonrpc(method: method, id: _id, params: params)); @@ -296,9 +319,10 @@ class ElectrumClient { return completer.future; } - Future callWithTimeout({String method, - List params = const [], - int timeout = 2000}) async { + Future callWithTimeout( + {String method, + List params = const [], + int timeout = 2000}) async { final completer = Completer(); _id += 1; final id = _id; @@ -325,9 +349,8 @@ class ElectrumClient { onConnectionStatusChange = null; } - void _regisryTask(int id, Completer completer) => - _tasks[id.toString()] = - SocketTask(completer: completer, isSubscription: false); + void _regisryTask(int id, Completer completer) => _tasks[id.toString()] = + SocketTask(completer: completer, isSubscription: false); void _regisrySubscription(String id, BehaviorSubject subject) => _tasks[id] = SocketTask(subject: subject, isSubscription: true); @@ -371,22 +394,20 @@ class ElectrumClient { _isConnected = isConnected; } - void _handleResponse(String response) { - print('Response: $response'); - final jsoned = json.decode(response) as Map; - // print(jsoned); - final method = jsoned['method']; - final id = jsoned['id'] as String; - final result = jsoned['result']; + void _handleResponse(Map response) { + final method = response['method']; + final id = response['id'] as String; + final result = response['result']; if (method is String) { - _methodHandler(method: method, request: jsoned); + _methodHandler(method: method, request: response); return; } _finish(id, result); } } + // FIXME: move me bool isJSONStringCorrect(String source) { try { diff --git a/lib/main.dart b/lib/main.dart index 6c1c3127a..38460fcca 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -1,4 +1,3 @@ -import 'package:cake_wallet/bitcoin/bitcoin_amount_format.dart'; import 'package:cake_wallet/themes/theme_base.dart'; import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; diff --git a/lib/src/screens/exchange_trade/exchange_trade_page.dart b/lib/src/screens/exchange_trade/exchange_trade_page.dart index 81449fb0e..36e84544d 100644 --- a/lib/src/screens/exchange_trade/exchange_trade_page.dart +++ b/lib/src/screens/exchange_trade/exchange_trade_page.dart @@ -358,7 +358,16 @@ class ExchangeTradeState extends State { }); }); }, - actionLeftButton: () => Navigator.of(context).pop()); + actionLeftButton: () => Navigator.of(context).pop(), + feeFiatAmount: widget.exchangeTradeViewModel.sendViewModel + .pendingTransaction.feeFormatted, + fiatAmountValue: widget.exchangeTradeViewModel.sendViewModel + .pendingTransactionFeeFiatAmount + + ' ' + + widget.exchangeTradeViewModel.sendViewModel.fiat.title, + recipientTitle: S.of(context).recipient_address, + recipientAddress: + widget.exchangeTradeViewModel.sendViewModel.address); }); }); } diff --git a/lib/view_model/exchange/exchange_view_model.dart b/lib/view_model/exchange/exchange_view_model.dart index d2ac05048..1257ebf07 100644 --- a/lib/view_model/exchange/exchange_view_model.dart +++ b/lib/view_model/exchange/exchange_view_model.dart @@ -310,7 +310,7 @@ abstract class ExchangeViewModelBase with Store { } final amount = availableBalance - fee; - depositAmount = bitcoinAmountToString(amount: amount); + changeDepositAmount(amount: bitcoinAmountToString(amount: amount)); } } diff --git a/pubspec.yaml b/pubspec.yaml index 8be2f91a7..adfdf3db9 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -11,7 +11,7 @@ description: Cake Wallet. # In iOS, build-name is used as CFBundleShortVersionString while build-number used as CFBundleVersion. # Read more about iOS versioning at # https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html -version: 4.1.0+27 +version: 4.1.0+28 environment: sdk: ">=2.7.0 <3.0.0" From 26a30a62f031655910bbcc196c78ebb1c399e480 Mon Sep 17 00:00:00 2001 From: M Date: Thu, 7 Jan 2021 14:19:21 +0200 Subject: [PATCH 33/39] Changed address list for btc wallet type. Changed android and ios projects version. --- ios/Runner.xcodeproj/project.pbxproj | 6 +- lib/bitcoin/bitcoin_address_record.dart | 8 +- lib/bitcoin/bitcoin_wallet.dart | 38 +++-- .../dashboard/widgets/address_page.dart | 139 +++++++++++------- ...let_address_edit_or_create_view_model.dart | 4 +- .../wallet_address_list_view_model.dart | 32 ++-- pubspec.yaml | 2 +- 7 files changed, 140 insertions(+), 89 deletions(-) diff --git a/ios/Runner.xcodeproj/project.pbxproj b/ios/Runner.xcodeproj/project.pbxproj index 8a1bb7be5..040935cee 100644 --- a/ios/Runner.xcodeproj/project.pbxproj +++ b/ios/Runner.xcodeproj/project.pbxproj @@ -354,7 +354,7 @@ buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CLANG_ENABLE_MODULES = YES; - CURRENT_PROJECT_VERSION = 12; + CURRENT_PROJECT_VERSION = 13; DEVELOPMENT_TEAM = 32J6BB6VUS; ENABLE_BITCODE = NO; FRAMEWORK_SEARCH_PATHS = ( @@ -494,7 +494,7 @@ buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CLANG_ENABLE_MODULES = YES; - CURRENT_PROJECT_VERSION = 12; + CURRENT_PROJECT_VERSION = 13; DEVELOPMENT_TEAM = 32J6BB6VUS; ENABLE_BITCODE = NO; FRAMEWORK_SEARCH_PATHS = ( @@ -528,7 +528,7 @@ buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CLANG_ENABLE_MODULES = YES; - CURRENT_PROJECT_VERSION = 12; + CURRENT_PROJECT_VERSION = 13; DEVELOPMENT_TEAM = 32J6BB6VUS; ENABLE_BITCODE = NO; FRAMEWORK_SEARCH_PATHS = ( diff --git a/lib/bitcoin/bitcoin_address_record.dart b/lib/bitcoin/bitcoin_address_record.dart index 98cd1c9da..80ab750cf 100644 --- a/lib/bitcoin/bitcoin_address_record.dart +++ b/lib/bitcoin/bitcoin_address_record.dart @@ -1,19 +1,17 @@ import 'dart:convert'; class BitcoinAddressRecord { - BitcoinAddressRecord(this.address, {this.label, this.index}); + BitcoinAddressRecord(this.address, {this.index}); factory BitcoinAddressRecord.fromJSON(String jsonSource) { final decoded = json.decode(jsonSource) as Map; return BitcoinAddressRecord(decoded['address'] as String, - label: decoded['label'] as String, index: decoded['index'] as int); + index: decoded['index'] as int); } final String address; int index; - String label; - String toJSON() => - json.encode({'label': label, 'address': address, 'index': index}); + String toJSON() => json.encode({'address': address, 'index': index}); } diff --git a/lib/bitcoin/bitcoin_wallet.dart b/lib/bitcoin/bitcoin_wallet.dart index de5ef2119..223fb697b 100644 --- a/lib/bitcoin/bitcoin_wallet.dart +++ b/lib/bitcoin/bitcoin_wallet.dart @@ -167,21 +167,31 @@ abstract class BitcoinWalletBase extends WalletBase with Store { Map> _scripthashesUpdateSubject; Future init() async { - if (addresses.isEmpty) { - final index = 0; - addresses - .add(BitcoinAddressRecord(_getAddress(index: index), index: index)); + if (addresses.isEmpty || addresses.length < 33) { + final addressesCount = 33 - addresses.length; + await generateNewAddresses(addressesCount, startIndex: _accountIndex); } - address = addresses.first.address; + address = addresses[_accountIndex].address; transactionHistory.wallet = this; await transactionHistory.init(); } - Future generateNewAddress({String label}) async { + @action + void nextAddress() { + _accountIndex += 1; + + if (_accountIndex >= addresses.length) { + _accountIndex = 0; + } + + address = addresses[_accountIndex].address; + } + + Future generateNewAddress() async { _accountIndex += 1; final address = BitcoinAddressRecord(_getAddress(index: _accountIndex), - index: _accountIndex, label: label); + index: _accountIndex); addresses.add(address); await save(); @@ -189,13 +199,12 @@ abstract class BitcoinWalletBase extends WalletBase with Store { return address; } - Future> generateNewAddresses(int count) async { + Future> generateNewAddresses(int count, + {int startIndex = 0}) async { final list = []; - for (var i = 0; i < count; i++) { - _accountIndex += 1; - final address = BitcoinAddressRecord(_getAddress(index: _accountIndex), - index: _accountIndex, label: null); + for (var i = startIndex; i < count + startIndex; i++) { + final address = BitcoinAddressRecord(_getAddress(index: i), index: i); list.add(address); } @@ -205,10 +214,9 @@ abstract class BitcoinWalletBase extends WalletBase with Store { return list; } - Future updateAddress(String address, {String label}) async { + Future updateAddress(String address) async { for (final addr in addresses) { if (addr.address == address) { - addr.label = label; await save(); break; } @@ -368,7 +376,7 @@ abstract class BitcoinWalletBase extends WalletBase with Store { } @override - void close() async{ + void close() async { await eclient.close(); } diff --git a/lib/src/screens/dashboard/widgets/address_page.dart b/lib/src/screens/dashboard/widgets/address_page.dart index c3fb5ae7c..a14f485c9 100644 --- a/lib/src/screens/dashboard/widgets/address_page.dart +++ b/lib/src/screens/dashboard/widgets/address_page.dart @@ -1,68 +1,101 @@ +import 'package:cake_wallet/src/widgets/keyboard_done_button.dart'; +import 'package:cake_wallet/src/widgets/primary_button.dart'; import 'package:flutter/material.dart'; import 'package:cake_wallet/view_model/wallet_address_list/wallet_address_list_view_model.dart'; import 'package:cake_wallet/src/screens/receive/widgets/qr_widget.dart'; import 'package:cake_wallet/routes.dart'; import 'package:cake_wallet/generated/i18n.dart'; import 'package:flutter_mobx/flutter_mobx.dart'; +import 'package:keyboard_actions/keyboard_actions.dart'; class AddressPage extends StatelessWidget { - AddressPage({@required this.addressListViewModel}); + AddressPage({@required this.addressListViewModel}) + : _cryptoAmountFocus = FocusNode(); final WalletAddressListViewModel addressListViewModel; + final FocusNode _cryptoAmountFocus; + @override Widget build(BuildContext context) { - return Container( - padding: EdgeInsets.fromLTRB(24, 24, 24, 32), - child: Column( - children: [ - Expanded( - child: Center( - child: QRWidget(addressListViewModel: addressListViewModel), - )), - GestureDetector( - onTap: () => Navigator.of(context).pushNamed(Routes.receive), - child: Container( - height: 50, - padding: EdgeInsets.only(left: 24, right: 12), - alignment: Alignment.center, - decoration: BoxDecoration( - borderRadius: BorderRadius.all(Radius.circular(25)), - border: Border.all( - color: Theme.of(context).textTheme.subhead.color, - width: 1), - color: Theme.of(context).buttonColor), - child: Row( - mainAxisSize: MainAxisSize.max, - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Observer( - builder: (_) => Text( - addressListViewModel.hasAccounts - ? S.of(context).accounts_subaddresses - : S.of(context).addresses, - style: TextStyle( - fontSize: 14, - fontWeight: FontWeight.w500, - color: Theme.of(context) - .accentTextTheme - .display3 - .backgroundColor), - )), - Icon( - Icons.arrow_forward_ios, - size: 14, - color: Theme.of(context) - .accentTextTheme - .display3 - .backgroundColor, - ) - ], - ), - ), - ) - ], - ), - ); + return KeyboardActions( + config: KeyboardActionsConfig( + keyboardActionsPlatform: KeyboardActionsPlatform.IOS, + keyboardBarColor: + Theme.of(context).accentTextTheme.body2.backgroundColor, + nextFocus: false, + actions: [ + KeyboardActionsItem( + focusNode: _cryptoAmountFocus, + toolbarButtons: [(_) => KeyboardDoneButton()], + ) + ]), + child: Container( + height: 1, + padding: EdgeInsets.fromLTRB(24, 24, 24, 32), + child: Column( + children: [ + Expanded( + child: Center( + child: QRWidget( + addressListViewModel: addressListViewModel, + amountTextFieldFocusNode: _cryptoAmountFocus, + isAmountFieldShow: !addressListViewModel.hasAccounts), + )), + addressListViewModel.hasAddressList + ? GestureDetector( + onTap: () => + Navigator.of(context).pushNamed(Routes.receive), + child: Container( + height: 50, + padding: EdgeInsets.only(left: 24, right: 12), + alignment: Alignment.center, + decoration: BoxDecoration( + borderRadius: BorderRadius.all(Radius.circular(25)), + border: Border.all( + color: + Theme.of(context).textTheme.subhead.color, + width: 1), + color: Theme.of(context).buttonColor), + child: Row( + mainAxisSize: MainAxisSize.max, + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Observer( + builder: (_) => Text( + addressListViewModel.hasAccounts + ? S.of(context).accounts_subaddresses + : S.of(context).addresses, + style: TextStyle( + fontSize: 14, + fontWeight: FontWeight.w500, + color: Theme.of(context) + .accentTextTheme + .display3 + .backgroundColor), + )), + Icon( + Icons.arrow_forward_ios, + size: 14, + color: Theme.of(context) + .accentTextTheme + .display3 + .backgroundColor, + ) + ], + ), + ), + ) + : PrimaryButton( + onPressed: () => addressListViewModel.nextAddress(), + text: 'Next address', + color: Theme.of(context).buttonColor, + textColor: Theme.of(context) + .accentTextTheme + .display3 + .backgroundColor) + ], + ), + )); } } diff --git a/lib/view_model/wallet_address_list/wallet_address_edit_or_create_view_model.dart b/lib/view_model/wallet_address_list/wallet_address_edit_or_create_view_model.dart index dfec65d9a..b06a00e99 100644 --- a/lib/view_model/wallet_address_list/wallet_address_edit_or_create_view_model.dart +++ b/lib/view_model/wallet_address_list/wallet_address_edit_or_create_view_model.dart @@ -63,7 +63,7 @@ abstract class WalletAddressEditOrCreateViewModelBase with Store { final wallet = _wallet; if (wallet is BitcoinWallet) { - await wallet.generateNewAddress(label: label); + await wallet.generateNewAddress(); } if (wallet is MoneroWallet) { @@ -77,7 +77,7 @@ abstract class WalletAddressEditOrCreateViewModelBase with Store { final wallet = _wallet; if (wallet is BitcoinWallet) { - await wallet.updateAddress(_item.address as String, label: label); + await wallet.updateAddress(_item.address as String); } if (wallet is MoneroWallet) { diff --git a/lib/view_model/wallet_address_list/wallet_address_list_view_model.dart b/lib/view_model/wallet_address_list/wallet_address_list_view_model.dart index 4fc9a45b1..d9fd6f312 100644 --- a/lib/view_model/wallet_address_list/wallet_address_list_view_model.dart +++ b/lib/view_model/wallet_address_list/wallet_address_list_view_model.dart @@ -119,7 +119,7 @@ abstract class WalletAddressListViewModelBase with Store { return WalletAddressListItem( isPrimary: isPrimary, - name: addr.label, + name: null, address: addr.address); }); addressList.addAll(bitcoinAddresses); @@ -131,15 +131,6 @@ abstract class WalletAddressListViewModelBase with Store { @observable bool hasAccounts; - @observable - WalletBase _wallet; - - List _baseItems; - - AppStore _appStore; - - ReactionDisposer _onWalletChangeReaction; - @computed String get accountLabel { final wallet = _wallet; @@ -151,6 +142,18 @@ abstract class WalletAddressListViewModelBase with Store { return null; } + bool get hasAddressList => _wallet.type == WalletType.monero; + + @observable + WalletBase _wallet; + + List _baseItems; + + AppStore _appStore; + + ReactionDisposer _onWalletChangeReaction; + + @action void setAddress(WalletAddressListItem address) => _wallet.address = address.address; @@ -164,4 +167,13 @@ abstract class WalletAddressListViewModelBase with Store { _baseItems.add(WalletAddressListHeader()); } + + @action + void nextAddress() { + final wallet = _wallet; + + if (wallet is BitcoinWallet) { + wallet.nextAddress(); + } + } } diff --git a/pubspec.yaml b/pubspec.yaml index adfdf3db9..2a619159f 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -11,7 +11,7 @@ description: Cake Wallet. # In iOS, build-name is used as CFBundleShortVersionString while build-number used as CFBundleVersion. # Read more about iOS versioning at # https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html -version: 4.1.0+28 +version: 4.1.0+29 environment: sdk: ">=2.7.0 <3.0.0" From 39e91c74cda4abaf90ca59011a5263597782d729 Mon Sep 17 00:00:00 2001 From: OleksandrSobol Date: Fri, 8 Jan 2021 18:49:28 +0200 Subject: [PATCH 34/39] CAKE-222 | applied adaptive picker to send and settings pages --- lib/src/screens/send/send_page.dart | 1 - lib/src/screens/settings/settings.dart | 1 - .../screens/settings/widgets/settings_picker_cell.dart | 5 +---- lib/src/widgets/picker.dart | 10 +++++----- lib/view_model/settings/picker_list_item.dart | 4 +--- lib/view_model/settings/settings_view_model.dart | 3 --- 6 files changed, 7 insertions(+), 17 deletions(-) diff --git a/lib/src/screens/send/send_page.dart b/lib/src/screens/send/send_page.dart index a4eec09bd..e8d9f3e2a 100644 --- a/lib/src/screens/send/send_page.dart +++ b/lib/src/screens/send/send_page.dart @@ -751,7 +751,6 @@ class SendPage extends BasePage { mainAxisAlignment: MainAxisAlignment.center, onItemSelected: (TransactionPriority priority) => sendViewModel.setTransactionPriority(priority), - isAlwaysShowScrollThumb: isShowScrollThumb, ), context: context); } diff --git a/lib/src/screens/settings/settings.dart b/lib/src/screens/settings/settings.dart index 2ee3b94ff..d4e70aecb 100644 --- a/lib/src/screens/settings/settings.dart +++ b/lib/src/screens/settings/settings.dart @@ -43,7 +43,6 @@ class SettingsPage extends BasePage { return SettingsPickerCell( title: item.title, selectedItem: item.selectedItem(), - isAlwaysShowScrollThumb: item.isAlwaysShowScrollThumb, items: item.items, onItemSelected: (dynamic value) => item.onItemSelected(value), ); diff --git a/lib/src/screens/settings/widgets/settings_picker_cell.dart b/lib/src/screens/settings/widgets/settings_picker_cell.dart index e2c949683..c27ea753d 100644 --- a/lib/src/screens/settings/widgets/settings_picker_cell.dart +++ b/lib/src/screens/settings/widgets/settings_picker_cell.dart @@ -9,8 +9,7 @@ class SettingsPickerCell extends StandardListRow { {@required String title, this.selectedItem, this.items, - this.onItemSelected, - this.isAlwaysShowScrollThumb}) + this.onItemSelected}) : super( title: title, isSelected: false, @@ -24,7 +23,6 @@ class SettingsPickerCell extends StandardListRow { selectedAtIndex: selectedAtIndex, title: S.current.please_select, mainAxisAlignment: MainAxisAlignment.center, - isAlwaysShowScrollThumb: isAlwaysShowScrollThumb, onItemSelected: (ItemType item) => onItemSelected?.call(item))); }); @@ -32,7 +30,6 @@ class SettingsPickerCell extends StandardListRow { final ItemType selectedItem; final List items; final void Function(ItemType item) onItemSelected; - final bool isAlwaysShowScrollThumb; @override Widget buildTrailing(BuildContext context) { diff --git a/lib/src/widgets/picker.dart b/lib/src/widgets/picker.dart index 7223fe4fb..c157c3dc1 100644 --- a/lib/src/widgets/picker.dart +++ b/lib/src/widgets/picker.dart @@ -15,7 +15,6 @@ class Picker extends StatefulWidget { this.description, @required this.onItemSelected, this.mainAxisAlignment = MainAxisAlignment.start, - this.isAlwaysShowScrollThumb = false }); final int selectedAtIndex; @@ -25,7 +24,6 @@ class Picker extends StatefulWidget { final String description; final Function(Item) onItemSelected; final MainAxisAlignment mainAxisAlignment; - final bool isAlwaysShowScrollThumb; @override PickerState createState() => PickerState(items, images, onItemSelected); @@ -56,6 +54,8 @@ class PickerState extends State { setState(() {}); }); + final isShowScrollThumb = items != null ? items.length > 3 : false; + return AlertBackground( child: Stack( alignment: Alignment.center, @@ -168,13 +168,13 @@ class PickerState extends State { ) ) : Offstage(), - widget.isAlwaysShowScrollThumb - ? CakeScrollbar( + isShowScrollThumb + ? CakeScrollbar( backgroundHeight: backgroundHeight, thumbHeight: thumbHeight, fromTop: fromTop ) - : Offstage(), + : Offstage(), ], ) ), diff --git a/lib/view_model/settings/picker_list_item.dart b/lib/view_model/settings/picker_list_item.dart index 13d502d7e..1dfc9c06d 100644 --- a/lib/view_model/settings/picker_list_item.dart +++ b/lib/view_model/settings/picker_list_item.dart @@ -6,15 +6,13 @@ class PickerListItem extends SettingsListItem { {@required String title, @required this.selectedItem, @required this.items, - void Function(ItemType item) onItemSelected, - this.isAlwaysShowScrollThumb = false}) + void Function(ItemType item) onItemSelected}) : _onItemSelected = onItemSelected, super(title); final ItemType Function() selectedItem; final List items; final void Function(ItemType item) _onItemSelected; - final bool isAlwaysShowScrollThumb; void onItemSelected(dynamic item) { if (item is ItemType) { diff --git a/lib/view_model/settings/settings_view_model.dart b/lib/view_model/settings/settings_view_model.dart index 49ae9557f..93968e8a7 100644 --- a/lib/view_model/settings/settings_view_model.dart +++ b/lib/view_model/settings/settings_view_model.dart @@ -55,7 +55,6 @@ abstract class SettingsViewModelBase with Store { PickerListItem( title: S.current.settings_currency, items: FiatCurrency.all, - isAlwaysShowScrollThumb: true, selectedItem: () => fiatCurrency, onItemSelected: (FiatCurrency currency) => setFiatCurrency(currency)), @@ -63,8 +62,6 @@ abstract class SettingsViewModelBase with Store { title: S.current.settings_fee_priority, items: TransactionPriority.forWalletType(wallet.type), selectedItem: () => transactionPriority, - isAlwaysShowScrollThumb: - TransactionPriority.forWalletType(wallet.type).length > 3, onItemSelected: (TransactionPriority priority) => _settingsStore.transactionPriority = priority), SwitcherListItem( From bef18de7a6d50c08f1938888cd393119b0d3aa75 Mon Sep 17 00:00:00 2001 From: M Date: Fri, 8 Jan 2021 20:10:37 +0200 Subject: [PATCH 35/39] Added auto saving of wallet address to wallet info. Added users wallet addresses into address book. --- lib/bitcoin/bitcoin_wallet_service.dart | 1 - lib/di.dart | 19 +- lib/entities/contact_base.dart | 9 + lib/entities/contact_record.dart | 8 +- lib/entities/default_settings_migration.dart | 33 ++- lib/entities/wallet_contact.dart | 15 ++ lib/entities/wallet_info.dart | 10 +- lib/entities/wallet_type.dart | 12 ++ lib/main.dart | 2 +- .../on_authentication_state_change.dart | 4 +- lib/reactions/on_current_wallet_change.dart | 13 +- .../screens/contact/contact_list_page.dart | 193 +++++++++--------- lib/src/widgets/address_text_field.dart | 6 +- lib/src/widgets/standard_list.dart | 15 +- .../contact_list/contact_list_view_model.dart | 14 +- lib/view_model/wallet_creation_vm.dart | 1 + 16 files changed, 234 insertions(+), 121 deletions(-) create mode 100644 lib/entities/contact_base.dart create mode 100644 lib/entities/wallet_contact.dart diff --git a/lib/bitcoin/bitcoin_wallet_service.dart b/lib/bitcoin/bitcoin_wallet_service.dart index 205abdcca..8e3035a2c 100644 --- a/lib/bitcoin/bitcoin_wallet_service.dart +++ b/lib/bitcoin/bitcoin_wallet_service.dart @@ -89,7 +89,6 @@ class BitcoinWalletService extends WalletService< walletInfo: credentials.walletInfo); await wallet.save(); await wallet.init(); - await wallet.generateNewAddresses(32); return wallet; } diff --git a/lib/di.dart b/lib/di.dart index a37f6fabe..2b337b59b 100644 --- a/lib/di.dart +++ b/lib/di.dart @@ -330,7 +330,8 @@ Future setup( (ContactRecord contact, _) => ContactViewModel(contactSource, contact: contact)); - getIt.registerFactory(() => ContactListViewModel(contactSource)); + getIt.registerFactory( + () => ContactListViewModel(contactSource, walletInfoSource)); getIt.registerFactoryParam( (bool isEditable, _) => ContactListPage(getIt.get(), @@ -419,17 +420,17 @@ Future setup( getIt.registerFactoryParam((type, _) => WalletRestorePage(getIt.get(param1: type))); - getIt.registerFactoryParam - ((TransactionInfo transactionInfo, _) => TransactionDetailsViewModel( - transactionInfo: transactionInfo, - transactionDescriptionBox: transactionDescriptionBox, - settingsStore: getIt.get() - )); + getIt + .registerFactoryParam( + (TransactionInfo transactionInfo, _) => TransactionDetailsViewModel( + transactionInfo: transactionInfo, + transactionDescriptionBox: transactionDescriptionBox, + settingsStore: getIt.get())); getIt.registerFactoryParam( (TransactionInfo transactionInfo, _) => TransactionDetailsPage( - transactionDetailsViewModel: getIt - .get(param1: transactionInfo))); + transactionDetailsViewModel: + getIt.get(param1: transactionInfo))); getIt.registerFactoryParam( diff --git a/lib/entities/contact_base.dart b/lib/entities/contact_base.dart new file mode 100644 index 000000000..a80fd1c21 --- /dev/null +++ b/lib/entities/contact_base.dart @@ -0,0 +1,9 @@ +import 'package:cake_wallet/entities/crypto_currency.dart'; + +abstract class ContactBase { + String name; + + String address; + + CryptoCurrency type; +} \ No newline at end of file diff --git a/lib/entities/contact_record.dart b/lib/entities/contact_record.dart index c4f55cc5a..ff535ecb0 100644 --- a/lib/entities/contact_record.dart +++ b/lib/entities/contact_record.dart @@ -3,21 +3,27 @@ import 'package:mobx/mobx.dart'; import 'package:cake_wallet/entities/contact.dart'; import 'package:cake_wallet/entities/crypto_currency.dart'; import 'package:cake_wallet/entities/record.dart'; +import 'package:cake_wallet/entities/contact_base.dart'; part 'contact_record.g.dart'; class ContactRecord = ContactRecordBase with _$ContactRecord; -abstract class ContactRecordBase extends Record with Store { +abstract class ContactRecordBase extends Record + with Store + implements ContactBase { ContactRecordBase(Box source, Contact original) : super(source, original); + @override @observable String name; + @override @observable String address; + @override @observable CryptoCurrency type; diff --git a/lib/entities/default_settings_migration.dart b/lib/entities/default_settings_migration.dart index 94860d661..7a2eb210f 100644 --- a/lib/entities/default_settings_migration.dart +++ b/lib/entities/default_settings_migration.dart @@ -1,4 +1,8 @@ -import 'dart:io' show Platform; +import 'dart:io' show File, Platform; +import 'package:cake_wallet/core/key_service.dart'; +import 'package:cake_wallet/di.dart'; +import 'package:cake_wallet/entities/pathForWallet.dart'; +import 'package:cake_wallet/monero/monero_wallet_service.dart'; import 'package:flutter/foundation.dart'; import 'package:hive/hive.dart'; import 'package:shared_preferences/shared_preferences.dart'; @@ -73,6 +77,9 @@ Future defaultSettingsMigration( sharedPreferences: sharedPreferences, nodes: nodes); break; + case 5: + await addAddressesForMoneroWallets(walletInfoSource); + break; default: break; } @@ -189,3 +196,27 @@ Future addBitcoinElectrumServerList({@required Box nodes}) async { final serverList = await loadElectrumServerList(); await nodes.addAll(serverList); } + +Future addAddressesForMoneroWallets( + Box walletInfoSource) async { + final moneroWalletsInfo = + walletInfoSource.values.where((info) => info.type == WalletType.monero); + moneroWalletsInfo.forEach((info) async { + try { + final walletPath = + await pathForWallet(name: info.name, type: WalletType.monero); + final addressFilePath = '$walletPath.address.txt'; + final addressFile = File(addressFilePath); + + if (!addressFile.existsSync()) { + return; + } + + final addressText = await addressFile.readAsString(); + info.address = addressText; + await info.save(); + } catch (e) { + print(e.toString()); + } + }); +} diff --git a/lib/entities/wallet_contact.dart b/lib/entities/wallet_contact.dart new file mode 100644 index 000000000..97edf2ac6 --- /dev/null +++ b/lib/entities/wallet_contact.dart @@ -0,0 +1,15 @@ +import 'package:cake_wallet/entities/contact_base.dart'; +import 'package:cake_wallet/entities/crypto_currency.dart'; + +class WalletContact implements ContactBase { + WalletContact(this.address, this.name, this.type); + + @override + String address; + + @override + String name; + + @override + CryptoCurrency type; +} diff --git a/lib/entities/wallet_info.dart b/lib/entities/wallet_info.dart index 97ae9f326..50c9bdcce 100644 --- a/lib/entities/wallet_info.dart +++ b/lib/entities/wallet_info.dart @@ -7,7 +7,7 @@ part 'wallet_info.g.dart'; @HiveType(typeId: 4) class WalletInfo extends HiveObject { WalletInfo(this.id, this.name, this.type, this.isRecovery, this.restoreHeight, - this.timestamp, this.dirPath, this.path); + this.timestamp, this.dirPath, this.path, this.address); factory WalletInfo.external( {@required String id, @@ -17,9 +17,10 @@ class WalletInfo extends HiveObject { @required int restoreHeight, @required DateTime date, @required String dirPath, - @required String path}) { + @required String path, + @required String address}) { return WalletInfo(id, name, type, isRecovery, restoreHeight, - date.millisecondsSinceEpoch ?? 0, dirPath, path); + date.millisecondsSinceEpoch ?? 0, dirPath, path, address); } static const boxName = 'WalletInfo'; @@ -48,5 +49,8 @@ class WalletInfo extends HiveObject { @HiveField(7) String path; + @HiveField(8) + String address; + DateTime get date => DateTime.fromMillisecondsSinceEpoch(timestamp); } diff --git a/lib/entities/wallet_type.dart b/lib/entities/wallet_type.dart index ef4027a54..3f4d5c884 100644 --- a/lib/entities/wallet_type.dart +++ b/lib/entities/wallet_type.dart @@ -1,3 +1,4 @@ +import 'package:cake_wallet/entities/crypto_currency.dart'; import 'package:hive/hive.dart'; part 'wallet_type.g.dart'; @@ -59,3 +60,14 @@ String walletTypeToDisplayName(WalletType type) { return ''; } } + +CryptoCurrency walletTypeToCryptoCurrency(WalletType type) { + switch (type) { + case WalletType.monero: + return CryptoCurrency.xmr; + case WalletType.bitcoin: + return CryptoCurrency.btc; + default: + return null; + } +} diff --git a/lib/main.dart b/lib/main.dart index 38460fcca..9885c45f8 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -69,7 +69,7 @@ void main() async { templates: templates, exchangeTemplates: exchangeTemplates, transactionDescriptions: transactionDescriptions, - initialMigrationVersion: 4); + initialMigrationVersion: 5); runApp(App()); } catch (e) { runApp(MaterialApp( diff --git a/lib/reactions/on_authentication_state_change.dart b/lib/reactions/on_authentication_state_change.dart index 20325cf5d..11ced88bd 100644 --- a/lib/reactions/on_authentication_state_change.dart +++ b/lib/reactions/on_authentication_state_change.dart @@ -10,14 +10,14 @@ ReactionDisposer _onAuthenticationStateChange; dynamic loginError; void startAuthenticationStateChange(AuthenticationStore authenticationStore, - @required GlobalKey navigatorKey) { + GlobalKey navigatorKey) { _onAuthenticationStateChange ??= autorun((_) async { final state = authenticationStore.state; if (state == AuthenticationState.installed) { try { await loadCurrentWallet(); - } catch(e) { + } catch (e) { loginError = e; } return; diff --git a/lib/reactions/on_current_wallet_change.dart b/lib/reactions/on_current_wallet_change.dart index 117eafd33..ff47f0c69 100644 --- a/lib/reactions/on_current_wallet_change.dart +++ b/lib/reactions/on_current_wallet_change.dart @@ -30,6 +30,14 @@ void startCurrentWalletChangeReaction(AppStore appStore, await getIt.get().setInt( PreferencesKey.currentWalletType, serializeToInt(wallet.type)); await wallet.connectToNode(node: node); + + if (wallet.walletInfo.address?.isEmpty ?? true) { + wallet.walletInfo.address = wallet.address; + + if (wallet.walletInfo.isInBox) { + await wallet.walletInfo.save(); + } + } } catch (e) { print(e.toString()); } @@ -39,8 +47,9 @@ void startCurrentWalletChangeReaction(AppStore appStore, reaction((_) => appStore.wallet, (WalletBase wallet) async { try { fiatConversionStore.prices[wallet.currency] = 0; - fiatConversionStore.prices[wallet.currency] = await FiatConversionService.fetchPrice( - wallet.currency, settingsStore.fiatCurrency); + fiatConversionStore.prices[wallet.currency] = + await FiatConversionService.fetchPrice( + wallet.currency, settingsStore.fiatCurrency); } catch (e) { print(e.toString()); } diff --git a/lib/src/screens/contact/contact_list_page.dart b/lib/src/screens/contact/contact_list_page.dart index 548544679..bf2b593ee 100644 --- a/lib/src/screens/contact/contact_list_page.dart +++ b/lib/src/screens/contact/contact_list_page.dart @@ -1,3 +1,4 @@ +import 'package:cake_wallet/entities/contact_base.dart'; import 'package:cake_wallet/utils/show_bar.dart'; import 'package:cake_wallet/utils/show_pop_up.dart'; import 'package:flutter/material.dart'; @@ -61,107 +62,113 @@ class ContactListPage extends BasePage { padding: EdgeInsets.only(top: 20.0, bottom: 20.0), child: Observer( builder: (_) { - return contactListViewModel.contacts.isNotEmpty - ? SectionStandardList( - sectionCount: 1, - context: context, - itemCounter: (int sectionIndex) => - contactListViewModel.contacts.length, - itemBuilder: (_, sectionIndex, index) { - final contact = contactListViewModel.contacts[index]; - final image = _getCurrencyImage(contact.type); - final content = GestureDetector( - onTap: () async { - if (!isEditable) { - Navigator.of(context).pop(contact); - return; - } + return SectionStandardList( + context: context, + sectionCount: 2, + sectionTitleBuilder: (_, int sectionIndex) { + var title = 'Contacts'; - final isCopied = await showNameAndAddressDialog( - context, contact.name, contact.address); + if (sectionIndex == 0) { + title = 'My wallets'; + } - if (isCopied != null && isCopied) { - await Clipboard.setData( - ClipboardData(text: contact.address)); - await showBar( - context, S.of(context).copied_to_clipboard); - } - }, - child: Container( - color: Colors.transparent, - padding: const EdgeInsets.only( - left: 24, top: 16, bottom: 16, right: 24), - child: Row( - mainAxisSize: MainAxisSize.min, - mainAxisAlignment: MainAxisAlignment.start, - crossAxisAlignment: CrossAxisAlignment.center, - children: [ - image ?? Offstage(), - Padding( - padding: image != null - ? EdgeInsets.only(left: 12) - : EdgeInsets.only(left: 0), - child: Text( - contact.name, - style: TextStyle( - fontSize: 14, - fontWeight: FontWeight.normal, - color: Theme.of(context) - .primaryTextTheme - .title - .color), - ), - ) - ], - ), - ), - ); + return Container( + padding: EdgeInsets.only(left: 24, bottom: 20), + child: Text(title, style: TextStyle(fontSize: 36))); + }, + itemCounter: (int sectionIndex) => sectionIndex == 0 + ? contactListViewModel.walletContacts.length + : contactListViewModel.contacts.length, + itemBuilder: (_, sectionIndex, index) { + if (sectionIndex == 0) { + final walletInfo = contactListViewModel.walletContacts[index]; + return generateRaw(context, walletInfo); + } - 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; + final contact = contactListViewModel.contacts[index]; + final content = generateRaw(context, contact); - if (isDelete) { - await contactListViewModel - .delete(contact); - } - }, - ), - ]); - }, - ) - : Center( - child: Text( - S.of(context).placeholder_contacts, - textAlign: TextAlign.center, - style: TextStyle(color: Colors.grey, fontSize: 14), - ), - ); + 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); + } + }, + ), + ]); + }, + ); }, )); } + Widget generateRaw(BuildContext context, ContactBase contact) { + final image = _getCurrencyImage(contact.type); + + return GestureDetector( + onTap: () async { + if (!isEditable) { + Navigator.of(context).pop(contact); + return; + } + + final isCopied = await showNameAndAddressDialog( + context, contact.name, contact.address); + + if (isCopied != null && isCopied) { + await Clipboard.setData(ClipboardData(text: contact.address)); + await showBar(context, S.of(context).copied_to_clipboard); + } + }, + child: Container( + color: Colors.transparent, + padding: + const EdgeInsets.only(left: 24, top: 16, bottom: 16, right: 24), + child: Row( + mainAxisSize: MainAxisSize.min, + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + image ?? Offstage(), + Padding( + padding: image != null + ? EdgeInsets.only(left: 12) + : EdgeInsets.only(left: 0), + child: Text( + contact.name, + style: TextStyle( + fontSize: 14, + fontWeight: FontWeight.normal, + color: Theme.of(context).primaryTextTheme.title.color), + ), + ) + ], + ), + ), + ); + } + Image _getCurrencyImage(CryptoCurrency currency) { Image image; switch (currency) { diff --git a/lib/src/widgets/address_text_field.dart b/lib/src/widgets/address_text_field.dart index 8c18d84a1..8e2c069f1 100644 --- a/lib/src/widgets/address_text_field.dart +++ b/lib/src/widgets/address_text_field.dart @@ -2,8 +2,8 @@ import 'package:flutter/services.dart'; import 'package:flutter/material.dart'; import 'package:cake_wallet/routes.dart'; import 'package:cake_wallet/generated/i18n.dart'; -import 'package:cake_wallet/entities/contact_record.dart'; import 'package:cake_wallet/entities/qr_scanner.dart'; +import 'package:cake_wallet/entities/contact_base.dart'; enum AddressTextFieldOption { paste, qrCode, addressBook } @@ -42,7 +42,7 @@ class AddressTextField extends StatelessWidget { final Color iconColor; final TextStyle textStyle; final TextStyle hintStyle; - FocusNode focusNode; + final FocusNode focusNode; @override Widget build(BuildContext context) { @@ -212,7 +212,7 @@ class AddressTextField extends StatelessWidget { final contact = await Navigator.of(context, rootNavigator: true) .pushNamed(Routes.pickerAddressBook); - if (contact is ContactRecord && contact.address != null) { + if (contact is ContactBase && contact.address != null) { controller.text = contact.address; } } diff --git a/lib/src/widgets/standard_list.dart b/lib/src/widgets/standard_list.dart index e4f82a877..9d8e117ac 100644 --- a/lib/src/widgets/standard_list.dart +++ b/lib/src/widgets/standard_list.dart @@ -113,16 +113,19 @@ class SectionStandardList extends StatelessWidget { {@required this.itemCounter, @required this.itemBuilder, @required this.sectionCount, + this.sectionTitleBuilder, this.hasTopSeparator = false, BuildContext context}) : totalRows = transform(hasTopSeparator, context, sectionCount, - itemCounter, itemBuilder); + itemCounter, itemBuilder, sectionTitleBuilder); final int sectionCount; final bool hasTopSeparator; final int Function(int sectionIndex) itemCounter; final Widget Function(BuildContext context, int sectionIndex, int itemIndex) itemBuilder; + final Widget Function(BuildContext context, int sectionIndex) + sectionTitleBuilder; final List totalRows; static List transform( @@ -131,14 +134,20 @@ class SectionStandardList extends StatelessWidget { int sectionCount, int Function(int sectionIndex) itemCounter, Widget Function(BuildContext context, int sectionIndex, int itemIndex) - itemBuilder) { + itemBuilder, + Widget Function(BuildContext context, int sectionIndex) + sectionTitleBuilder) { final items = []; for (var sectionIndex = 0; sectionIndex < sectionCount; sectionIndex++) { - if ((sectionIndex == 0)&&(hasTopSeparator)) { + if ((sectionIndex == 0) && (hasTopSeparator)) { items.add(StandardListSeparator(padding: EdgeInsets.only(left: 24))); } + if (sectionTitleBuilder != null) { + items.add(sectionTitleBuilder(context, sectionIndex)); + } + final itemCount = itemCounter(sectionIndex); for (var itemIndex = 0; itemIndex < itemCount; itemIndex++) { diff --git a/lib/view_model/contact_list/contact_list_view_model.dart b/lib/view_model/contact_list/contact_list_view_model.dart index 8a59a0589..17083efe2 100644 --- a/lib/view_model/contact_list/contact_list_view_model.dart +++ b/lib/view_model/contact_list/contact_list_view_model.dart @@ -1,4 +1,7 @@ import 'dart:async'; +import 'package:cake_wallet/entities/wallet_contact.dart'; +import 'package:cake_wallet/entities/wallet_info.dart'; +import 'package:cake_wallet/entities/wallet_type.dart'; import 'package:hive/hive.dart'; import 'package:mobx/mobx.dart'; import 'package:cake_wallet/entities/contact_record.dart'; @@ -11,15 +14,22 @@ class ContactListViewModel = ContactListViewModelBase with _$ContactListViewModel; abstract class ContactListViewModelBase with Store { - ContactListViewModelBase(this.contactSource) - : contacts = ObservableList() { + ContactListViewModelBase(this.contactSource, this.walletInfoSource) + : contacts = ObservableList(), + walletContacts = walletInfoSource.values + .where((info) => info.address?.isNotEmpty ?? false) + .map((info) => WalletContact( + info.address, info.name, walletTypeToCryptoCurrency(info.type))) + .toList() { _subscription = contactSource.bindToListWithTransform( contacts, (Contact contact) => ContactRecord(contactSource, contact), initialFire: true); } final Box contactSource; + final Box walletInfoSource; final ObservableList contacts; + final List walletContacts; StreamSubscription _subscription; Future delete(ContactRecord contact) async => contact.original.delete(); diff --git a/lib/view_model/wallet_creation_vm.dart b/lib/view_model/wallet_creation_vm.dart index b236fe151..58ee24087 100644 --- a/lib/view_model/wallet_creation_vm.dart +++ b/lib/view_model/wallet_creation_vm.dart @@ -50,6 +50,7 @@ abstract class WalletCreationVMBase with Store { dirPath: dirPath); credentials.walletInfo = walletInfo; final wallet = await process(credentials); + walletInfo.address = wallet.address; await _walletInfoSource.add(walletInfo); _appStore.changeCurrentWallet(wallet); _appStore.authenticationStore.allowed(); From 41b436d9d4fc7343b8a51a77361f87d9c5ef8599 Mon Sep 17 00:00:00 2001 From: M Date: Mon, 11 Jan 2021 11:02:33 +0200 Subject: [PATCH 36/39] Changed android project version to 4.1.0 (30) and iOS project version to 4.1.0 (14). --- ios/Runner.xcodeproj/project.pbxproj | 6 +++--- pubspec.yaml | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/ios/Runner.xcodeproj/project.pbxproj b/ios/Runner.xcodeproj/project.pbxproj index 040935cee..74fd9ca99 100644 --- a/ios/Runner.xcodeproj/project.pbxproj +++ b/ios/Runner.xcodeproj/project.pbxproj @@ -354,7 +354,7 @@ buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CLANG_ENABLE_MODULES = YES; - CURRENT_PROJECT_VERSION = 13; + CURRENT_PROJECT_VERSION = 14; DEVELOPMENT_TEAM = 32J6BB6VUS; ENABLE_BITCODE = NO; FRAMEWORK_SEARCH_PATHS = ( @@ -494,7 +494,7 @@ buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CLANG_ENABLE_MODULES = YES; - CURRENT_PROJECT_VERSION = 13; + CURRENT_PROJECT_VERSION = 14; DEVELOPMENT_TEAM = 32J6BB6VUS; ENABLE_BITCODE = NO; FRAMEWORK_SEARCH_PATHS = ( @@ -528,7 +528,7 @@ buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CLANG_ENABLE_MODULES = YES; - CURRENT_PROJECT_VERSION = 13; + CURRENT_PROJECT_VERSION = 14; DEVELOPMENT_TEAM = 32J6BB6VUS; ENABLE_BITCODE = NO; FRAMEWORK_SEARCH_PATHS = ( diff --git a/pubspec.yaml b/pubspec.yaml index 2a619159f..b2018cebe 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -11,7 +11,7 @@ description: Cake Wallet. # In iOS, build-name is used as CFBundleShortVersionString while build-number used as CFBundleVersion. # Read more about iOS versioning at # https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html -version: 4.1.0+29 +version: 4.1.0+30 environment: sdk: ">=2.7.0 <3.0.0" From 9db6e233c713cecf570dafff648ccf8f3dd02a31 Mon Sep 17 00:00:00 2001 From: M Date: Mon, 11 Jan 2021 19:15:27 +0200 Subject: [PATCH 37/39] Another beautiful day changes --- lib/bitcoin/bitcoin_address_record.dart | 8 + lib/bitcoin/bitcoin_balance.dart | 33 +--- lib/bitcoin/bitcoin_wallet.dart | 6 +- lib/core/wallet_base.dart | 3 +- lib/entities/balance.dart | 12 +- lib/entities/balance_display_mode.dart | 11 +- lib/entities/default_settings_migration.dart | 12 ++ lib/generated/i18n.dart | 92 +++++++++++ lib/main.dart | 41 ++--- lib/monero/monero_balance.dart | 25 +-- lib/reactions/on_current_wallet_change.dart | 5 +- .../on_wallet_sync_status_change.dart | 3 +- .../dashboard/widgets/address_page.dart | 3 + .../dashboard/widgets/balance_page.dart | 155 ++++++++++-------- lib/src/screens/exchange/exchange_page.dart | 28 +++- .../exchange/widgets/exchange_card.dart | 61 ++++--- .../screens/receive/widgets/qr_widget.dart | 2 +- lib/store/app_store.dart | 3 +- .../dashboard/balance_view_model.dart | 123 +++++++------- .../dashboard/dashboard_view_model.dart | 5 +- .../exchange/exchange_view_model.dart | 2 +- lib/view_model/send/send_view_model.dart | 15 +- .../settings/settings_view_model.dart | 18 +- .../wallet_address_list_view_model.dart | 5 +- 24 files changed, 406 insertions(+), 265 deletions(-) diff --git a/lib/bitcoin/bitcoin_address_record.dart b/lib/bitcoin/bitcoin_address_record.dart index 80ab750cf..af492de2d 100644 --- a/lib/bitcoin/bitcoin_address_record.dart +++ b/lib/bitcoin/bitcoin_address_record.dart @@ -1,4 +1,5 @@ import 'dart:convert'; +import 'package:quiver/core.dart'; class BitcoinAddressRecord { BitcoinAddressRecord(this.address, {this.index}); @@ -10,8 +11,15 @@ class BitcoinAddressRecord { index: decoded['index'] as int); } + @override + bool operator ==(Object o) => + o is BitcoinAddressRecord && address == o.address; + final String address; int index; + @override + int get hashCode => address.hashCode; + String toJSON() => json.encode({'address': address, 'index': index}); } diff --git a/lib/bitcoin/bitcoin_balance.dart b/lib/bitcoin/bitcoin_balance.dart index 5081616ea..7d8441250 100644 --- a/lib/bitcoin/bitcoin_balance.dart +++ b/lib/bitcoin/bitcoin_balance.dart @@ -1,16 +1,12 @@ import 'dart:convert'; -import 'package:cake_wallet/entities/balance_display_mode.dart'; import 'package:flutter/foundation.dart'; import 'package:cake_wallet/bitcoin/bitcoin_amount_format.dart'; import 'package:cake_wallet/entities/balance.dart'; class BitcoinBalance extends Balance { const BitcoinBalance({@required this.confirmed, @required this.unconfirmed}) - : super(const [ - BalanceDisplayMode.availableBalance, - BalanceDisplayMode.fullBalance - ]); + : super(confirmed, unconfirmed); factory BitcoinBalance.fromJSON(String jsonSource) { if (jsonSource == null) { @@ -27,31 +23,12 @@ class BitcoinBalance extends Balance { final int confirmed; final int unconfirmed; - int get total => confirmed + unconfirmed; - - int get availableBalance => - (confirmed ?? 0) + (unconfirmed < 0 ? unconfirmed : 0); - - String get confirmedFormatted => bitcoinAmountToString(amount: confirmed); - - String get unconfirmedFormatted => bitcoinAmountToString(amount: unconfirmed); - - String get totalFormatted => bitcoinAmountToString(amount: total); - - String get availableBalanceFormatted => - bitcoinAmountToString(amount: availableBalance); + @override + String get formattedAvailableBalance => bitcoinAmountToString(amount: confirmed); @override - String formattedBalance(BalanceDisplayMode mode) { - switch (mode) { - case BalanceDisplayMode.fullBalance: - return totalFormatted; - case BalanceDisplayMode.availableBalance: - return availableBalanceFormatted; - default: - return null; - } - } + String get formattedAdditionalBalance => + bitcoinAmountToString(amount: unconfirmed); String toJSON() => json.encode({'confirmed': confirmed, 'unconfirmed': unconfirmed}); diff --git a/lib/bitcoin/bitcoin_wallet.dart b/lib/bitcoin/bitcoin_wallet.dart index 223fb697b..8ee012e75 100644 --- a/lib/bitcoin/bitcoin_wallet.dart +++ b/lib/bitcoin/bitcoin_wallet.dart @@ -47,7 +47,7 @@ abstract class BitcoinWalletBase extends WalletBase with Store { network: bitcoin.bitcoin) .derivePath("m/0'/0"), addresses = initialAddresses != null - ? ObservableList.of(initialAddresses) + ? ObservableList.of(initialAddresses.toSet()) : ObservableList(), syncStatus = NotConnectedSyncStatus(), _password = password, @@ -267,14 +267,14 @@ abstract class BitcoinWalletBase extends WalletBase with Store { final fee = feeAmountForPriority(transactionCredentials.priority); final amount = transactionCredentials.amount != null ? stringDoubleToBitcoinAmount(transactionCredentials.amount) - : balance.availableBalance - fee; + : balance.confirmed - fee; final totalAmount = amount + fee; final txb = bitcoin.TransactionBuilder(network: bitcoin.bitcoin); final changeAddress = address; var leftAmount = totalAmount; var totalInputAmount = 0; - if (totalAmount > balance.availableBalance) { + if (totalAmount > balance.confirmed) { throw BitcoinTransactionWrongBalanceException(); } diff --git a/lib/core/wallet_base.dart b/lib/core/wallet_base.dart index d08eff0ef..fe187b4c7 100644 --- a/lib/core/wallet_base.dart +++ b/lib/core/wallet_base.dart @@ -1,3 +1,4 @@ +import 'package:cake_wallet/entities/balance.dart'; import 'package:flutter/foundation.dart'; import 'package:cake_wallet/entities/wallet_info.dart'; import 'package:cake_wallet/core/pending_transaction.dart'; @@ -9,7 +10,7 @@ import 'package:cake_wallet/entities/sync_status.dart'; import 'package:cake_wallet/entities/node.dart'; import 'package:cake_wallet/entities/wallet_type.dart'; -abstract class WalletBase { +abstract class WalletBase { WalletBase(this.walletInfo); static String idFor(String name, WalletType type) => diff --git a/lib/entities/balance.dart b/lib/entities/balance.dart index 89f3cd725..cf98f9e0f 100644 --- a/lib/entities/balance.dart +++ b/lib/entities/balance.dart @@ -1,9 +1,11 @@ -import 'package:cake_wallet/entities/balance_display_mode.dart'; - abstract class Balance { - const Balance(this.availableModes); + const Balance(this.available, this.additional); - final List availableModes; + final int available; - String formattedBalance(BalanceDisplayMode mode); + final int additional; + + String get formattedAvailableBalance; + + String get formattedAdditionalBalance; } diff --git a/lib/entities/balance_display_mode.dart b/lib/entities/balance_display_mode.dart index 57197e57b..8b11bf385 100644 --- a/lib/entities/balance_display_mode.dart +++ b/lib/entities/balance_display_mode.dart @@ -7,15 +7,16 @@ class BalanceDisplayMode extends EnumerableItem with Serializable { : super(title: title, raw: raw); static const all = [ - BalanceDisplayMode.fullBalance, - BalanceDisplayMode.availableBalance, - BalanceDisplayMode.hiddenBalance + BalanceDisplayMode.hiddenBalance, + BalanceDisplayMode.displayableBalance, ]; static const fullBalance = BalanceDisplayMode(raw: 0, title: 'Full Balance'); static const availableBalance = BalanceDisplayMode(raw: 1, title: 'Available Balance'); static const hiddenBalance = BalanceDisplayMode(raw: 2, title: 'Hidden Balance'); + static const displayableBalance = + BalanceDisplayMode(raw: 3, title: 'Displayable Balance'); static BalanceDisplayMode deserialize({int raw}) { switch (raw) { @@ -25,6 +26,8 @@ class BalanceDisplayMode extends EnumerableItem with Serializable { return availableBalance; case 2: return hiddenBalance; + case 3: + return displayableBalance; default: return null; } @@ -39,6 +42,8 @@ class BalanceDisplayMode extends EnumerableItem with Serializable { return S.current.xmr_available_balance; case BalanceDisplayMode.hiddenBalance: return S.current.xmr_hidden; + case BalanceDisplayMode.displayableBalance: + return S.current.displayable; default: return ''; } diff --git a/lib/entities/default_settings_migration.dart b/lib/entities/default_settings_migration.dart index 7a2eb210f..4859ffd05 100644 --- a/lib/entities/default_settings_migration.dart +++ b/lib/entities/default_settings_migration.dart @@ -80,6 +80,11 @@ Future defaultSettingsMigration( case 5: await addAddressesForMoneroWallets(walletInfoSource); break; + + case 6: + await updateDisplayModes(sharedPreferences); + break; + default: break; } @@ -220,3 +225,10 @@ Future addAddressesForMoneroWallets( } }); } + +Future updateDisplayModes(SharedPreferences sharedPreferences) async { + final currentBalanceDisplayMode = + sharedPreferences.getInt(PreferencesKey.currentBalanceDisplayModeKey); + final balanceDisplayMode = currentBalanceDisplayMode < 2 ? 3 : 2; + await sharedPreferences.setInt(PreferencesKey.currentBalanceDisplayModeKey, balanceDisplayMode); +} diff --git a/lib/generated/i18n.dart b/lib/generated/i18n.dart index 1b19e3e7d..2d312f92a 100644 --- a/lib/generated/i18n.dart +++ b/lib/generated/i18n.dart @@ -374,6 +374,10 @@ class S implements WidgetsLocalizations { String wallet_list_failed_to_remove(String wallet_name, String error) => "Failed to remove ${wallet_name} wallet. ${error}"; String wallet_list_loading_wallet(String wallet_name) => "Loading ${wallet_name} wallet"; String wallet_list_removing_wallet(String wallet_name) => "Removing ${wallet_name} wallet"; + String get exchange_incorrect_current_wallet_for_xmr => "If you want to exchange XMR from your Cake Wallet Monero balance, please switch to your Monero wallet first."; + String get confirmed => 'Confirmed'; + String get unconfirmed => 'Unconfirmed'; + String get displayable => 'Displayable'; } class $de extends S { @@ -1088,6 +1092,14 @@ class $de extends S { String wallet_list_failed_to_load(String wallet_name, String error) => "Laden fehlgeschlagen ${wallet_name} Wallet. ${error}"; @override String wallet_list_removing_wallet(String wallet_name) => "Entfernen ${wallet_name} Wallet"; + @override + String get exchange_incorrect_current_wallet_for_xmr => "Wenn Sie XMR von Ihrem Cake Wallet Monero-Guthaben austauschen möchten, wechseln Sie bitte zuerst zu Ihrem Monero Wallet."; + @override + String get confirmed => 'Bestätigt'; + @override + String get unconfirmed => 'Unbestätigt'; + @override + String get displayable => 'Anzeigebar'; } class $hi extends S { @@ -1802,6 +1814,14 @@ class $hi extends S { String wallet_list_failed_to_load(String wallet_name, String error) => "लोड करने में विफल ${wallet_name} बटुआ. ${error}"; @override String wallet_list_removing_wallet(String wallet_name) => "निकाला जा रहा है ${wallet_name} बटुआ"; + @override + String get exchange_incorrect_current_wallet_for_xmr => "यदि आप अपने केक वॉलेट मोनेरो बैलेंस से एक्सएमआर का आदान-प्रदान करना चाहते हैं, तो कृपया अपने मोनेरो वॉलेट में जाएं।"; + @override + String get confirmed => 'की पुष्टि की'; + @override + String get unconfirmed => 'अपुष्ट'; + @override + String get displayable => 'प्रदर्शन योग्य'; } class $ru extends S { @@ -2516,6 +2536,14 @@ class $ru extends S { String wallet_list_failed_to_load(String wallet_name, String error) => "Ошибка при загрузке ${wallet_name} кошелька. ${error}"; @override String wallet_list_removing_wallet(String wallet_name) => "Удаление ${wallet_name} кошелька"; + @override + String get exchange_incorrect_current_wallet_for_xmr => "Если вы хотите обменять XMR со своего баланса Monero в Cake Wallet, сначала переключитесь на свой кошелек Monero."; + @override + String get confirmed => 'Подтверждено'; + @override + String get unconfirmed => 'Неподтвержденный'; + @override + String get displayable => 'Отображаемый'; } class $ko extends S { @@ -3230,6 +3258,14 @@ class $ko extends S { String wallet_list_failed_to_load(String wallet_name, String error) => "불러 오지 못했습니다 ${wallet_name} 지갑. ${error}"; @override String wallet_list_removing_wallet(String wallet_name) => "풀이 ${wallet_name} 지갑"; + @override + String get exchange_incorrect_current_wallet_for_xmr => "Cake Wallet Monero 잔액에서 XMR을 교환하려면 먼저 Monero 지갑으로 전환하십시오."; + @override + String get confirmed => '확인'; + @override + String get unconfirmed => '미확인'; + @override + String get displayable => '표시 가능'; } class $pt extends S { @@ -3944,6 +3980,14 @@ class $pt extends S { String wallet_list_failed_to_load(String wallet_name, String error) => "Falha ao abrir a carteira ${wallet_name}. ${error}"; @override String wallet_list_removing_wallet(String wallet_name) => "Removendo a carteira ${wallet_name}"; + @override + String get exchange_incorrect_current_wallet_for_xmr => "Se você deseja trocar o XMR de seu saldo da Carteira Monero Cake, troque primeiro para sua carteira Monero."; + @override + String get confirmed => 'Confirmada'; + @override + String get unconfirmed => 'Não confirmado'; + @override + String get displayable => 'Exibível'; } class $uk extends S { @@ -4658,6 +4702,14 @@ class $uk extends S { String wallet_list_failed_to_load(String wallet_name, String error) => "Помилка при завантаженні ${wallet_name} гаманця. ${error}"; @override String wallet_list_removing_wallet(String wallet_name) => "Видалення ${wallet_name} гаманця"; + @override + String get exchange_incorrect_current_wallet_for_xmr => "Якщо ви хочете обміняти XMR із вашого балансу Cake Wallet Monero, спочатку перейдіть на свій гаманець Monero."; + @override + String get confirmed => 'Підтверджено'; + @override + String get unconfirmed => 'Непідтверджений'; + @override + String get displayable => 'Відображуваний'; } class $ja extends S { @@ -5372,6 +5424,14 @@ class $ja extends S { String wallet_list_failed_to_load(String wallet_name, String error) => "読み込みに失敗しました ${wallet_name} 財布. ${error}"; @override String wallet_list_removing_wallet(String wallet_name) => "取りはずし ${wallet_name} 財布"; + @override + String get exchange_incorrect_current_wallet_for_xmr => "Cake Wallet Moneroの残高からXMRを交換する場合は、最初にMoneroウォレットに切り替えてください。"; + @override + String get confirmed => '確認済み'; + @override + String get unconfirmed => '未確認'; + @override + String get displayable => '表示可能'; } class $en extends S { @@ -6090,6 +6150,14 @@ class $pl extends S { String wallet_list_failed_to_load(String wallet_name, String error) => "Nie udało się załadować ${wallet_name} portfel. ${error}"; @override String wallet_list_removing_wallet(String wallet_name) => "Usuwanie ${wallet_name} portfel"; + @override + String get exchange_incorrect_current_wallet_for_xmr => "Jeśli chcesz wymienić XMR z salda Cake Wallet Monero, najpierw przełącz się na portfel Monero."; + @override + String get confirmed => 'Potwierdzony'; + @override + String get unconfirmed => 'niepotwierdzony'; + @override + String get displayable => 'Wyświetlane'; } class $es extends S { @@ -6804,6 +6872,14 @@ class $es extends S { String wallet_list_failed_to_load(String wallet_name, String error) => "No se pudo cargar ${wallet_name} la billetera. ${error}"; @override String wallet_list_removing_wallet(String wallet_name) => "Retirar ${wallet_name} billetera"; + @override + String get exchange_incorrect_current_wallet_for_xmr => "Si desea intercambiar XMR de su saldo de Cake Wallet Monero, primero cambie a su billetera Monero."; + @override + String get confirmed => 'Confirmada'; + @override + String get unconfirmed => 'inconfirmado'; + @override + String get displayable => 'Visualizable'; } class $nl extends S { @@ -7518,6 +7594,14 @@ class $nl extends S { String wallet_list_failed_to_load(String wallet_name, String error) => "Laden mislukt ${wallet_name} portemonnee. ${error}"; @override String wallet_list_removing_wallet(String wallet_name) => "Verwijderen ${wallet_name} portemonnee"; + @override + String get exchange_incorrect_current_wallet_for_xmr => "Als u XMR wilt omwisselen van uw Cake Wallet Monero-saldo, moet u eerst overschakelen naar uw Monero-portemonnee."; + @override + String get confirmed => 'bevestigd'; + @override + String get unconfirmed => 'niet bevestigd'; + @override + String get displayable => 'Weer te geven'; } class $zh extends S { @@ -8232,6 +8316,14 @@ class $zh extends S { String wallet_list_failed_to_load(String wallet_name, String error) => "加载失败 ${wallet_name} 钱包. ${error}"; @override String wallet_list_removing_wallet(String wallet_name) => "拆下 ${wallet_name} 钱包"; + @override + String get exchange_incorrect_current_wallet_for_xmr => "如果要从Cake Wallet Monero余额中兑换XMR,请先切换到Monero钱包。"; + @override + String get confirmed => '已确认'; + @override + String get unconfirmed => '未经证实'; + @override + String get displayable => '可显示'; } class GeneratedLocalizationsDelegate extends LocalizationsDelegate { diff --git a/lib/main.dart b/lib/main.dart index 9885c45f8..d16e67faa 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -1,3 +1,4 @@ +import 'package:cake_wallet/bitcoin/bitcoin_address_record.dart'; import 'package:cake_wallet/themes/theme_base.dart'; import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; @@ -54,11 +55,11 @@ void main() async { TransactionDescription.boxName, encryptionKey: transactionDescriptionsBoxKey); final trades = - await Hive.openBox(Trade.boxName, encryptionKey: tradesBoxKey); + await Hive.openBox(Trade.boxName, encryptionKey: tradesBoxKey); final walletInfoSource = await Hive.openBox(WalletInfo.boxName); final templates = await Hive.openBox