From aa4d43acb69d1f75a05702eb0621ef13563166b1 Mon Sep 17 00:00:00 2001 From: Oleksandr Sobol Date: Mon, 20 Jan 2020 21:04:26 +0200 Subject: [PATCH 01/10] CWA-161 | saved recipient address by default for new users --- lib/src/domain/common/default_settings_migration.dart | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/src/domain/common/default_settings_migration.dart b/lib/src/domain/common/default_settings_migration.dart index 37fc1d5b8..bad9f69eb 100644 --- a/lib/src/domain/common/default_settings_migration.dart +++ b/lib/src/domain/common/default_settings_migration.dart @@ -33,7 +33,7 @@ Future defaultSettingsMigration( 'current_fee_priority', TransactionPriority.standart.raw); await sharedPreferences.setInt('current_balance_display_mode', BalanceDisplayMode.availableBalance.raw); - await sharedPreferences.setBool('save_recipient_address', false); + await sharedPreferences.setBool('save_recipient_address', true); await resetToDefault(nodes); await changeCurrentNodeToDefault( sharedPreferences: sharedPreferences, nodes: nodes); From 59d8ad1890417948bddd75cf75ac5c886cf264d7 Mon Sep 17 00:00:00 2001 From: Oleksandr Sobol Date: Mon, 20 Jan 2020 21:18:47 +0200 Subject: [PATCH 02/10] CWA-160 | used existing colors for new currencies --- .../address_book/address_book_page.dart | 24 ++++++++----------- 1 file changed, 10 insertions(+), 14 deletions(-) diff --git a/lib/src/screens/address_book/address_book_page.dart b/lib/src/screens/address_book/address_book_page.dart index 4f4146a47..97351f91b 100644 --- a/lib/src/screens/address_book/address_book_page.dart +++ b/lib/src/screens/address_book/address_book_page.dart @@ -178,13 +178,13 @@ class AddressBookPage extends BasePage { color = Palette.cakeGreenWithOpacity; break; case CryptoCurrency.ada: - color = Colors.blueGrey[700]; + color = Colors.blue[200]; break; case CryptoCurrency.bch: color = Colors.orangeAccent; break; case CryptoCurrency.bnb: - color = Colors.yellow; + color = Colors.blue; break; case CryptoCurrency.btc: color = Colors.orange; @@ -193,7 +193,7 @@ class AddressBookPage extends BasePage { color = Colors.blue; break; case CryptoCurrency.eos: - color = Colors.deepPurple; + color = Colors.orangeAccent; break; case CryptoCurrency.eth: color = Colors.black; @@ -202,19 +202,19 @@ class AddressBookPage extends BasePage { color = Colors.blue[200]; break; case CryptoCurrency.nano: - color = Colors.blue[900]; + color = Colors.orange; break; case CryptoCurrency.trx: - color = Colors.red; + color = Colors.black; break; case CryptoCurrency.usdt: - color = Colors.teal; + color = Colors.blue[200]; break; case CryptoCurrency.xlm: - color = Colors.grey[100]; + color = color = Colors.blue; break; case CryptoCurrency.xrp: - color = Colors.blueAccent; + color = Colors.orangeAccent; break; default: color = Colors.white; @@ -229,14 +229,10 @@ class AddressBookPage extends BasePage { color = Palette.cakeGreen; break; case CryptoCurrency.ltc: + case CryptoCurrency.ada: + case CryptoCurrency.usdt: color = Palette.lightBlue; break; - case CryptoCurrency.xlm: - color = Colors.blueAccent; - break; - case CryptoCurrency.xrp: - color = Colors.black; - break; default: color = Colors.white; } From 2a4d9a8fa6d5cc54404bac4dab1dea7f28791b53 Mon Sep 17 00:00:00 2001 From: Oleksandr Sobol Date: Tue, 21 Jan 2020 21:29:02 +0200 Subject: [PATCH 03/10] CWA-163 | added integrated address for xmr to validation --- lib/src/stores/address_book/address_book_store.dart | 6 +++--- lib/src/stores/exchange/exchange_store.dart | 6 +++--- lib/src/stores/send/send_store.dart | 6 +++--- .../stores/wallet_restoration/wallet_restoration_store.dart | 6 +++--- 4 files changed, 12 insertions(+), 12 deletions(-) diff --git a/lib/src/stores/address_book/address_book_store.dart b/lib/src/stores/address_book/address_book_store.dart index 13bd8f591..527809cbd 100644 --- a/lib/src/stores/address_book/address_book_store.dart +++ b/lib/src/stores/address_book/address_book_store.dart @@ -45,15 +45,15 @@ abstract class AddressBookStoreBase with Store { } void validateAddress(String value, {CryptoCurrency cryptoCurrency}) { - // XMR (95), ADA (59, 92, 105), BCH (42), BNB (42), BTC (34, 42), DASH (34), EOS (42), + // XMR (95, 106), ADA (59, 92, 105), BCH (42), BNB (42), BTC (34, 42), DASH (34), EOS (42), // ETH (42), LTC (34), NANO (64, 65), TRX (34), USDT (42), XLM (56), XRP (34) - const pattern = '^[0-9a-zA-Z]{95}\$|^[0-9a-zA-Z]{34}\$|^[0-9a-zA-Z]{42}\$|^[0-9a-zA-Z]{56}\$|^[0-9a-zA-Z]{59}\$|^[0-9a-zA-Z_]{64}\$|^[0-9a-zA-Z_]{65}\$|^[0-9a-zA-Z]{92}\$|^[0-9a-zA-Z]{105}\$'; + const pattern = '^[0-9a-zA-Z]{95}\$|^[0-9a-zA-Z]{34}\$|^[0-9a-zA-Z]{42}\$|^[0-9a-zA-Z]{56}\$|^[0-9a-zA-Z]{59}\$|^[0-9a-zA-Z_]{64}\$|^[0-9a-zA-Z_]{65}\$|^[0-9a-zA-Z]{92}\$|^[0-9a-zA-Z]{105}\$|^[0-9a-zA-Z]{106}\$'; final regExp = RegExp(pattern); isValid = regExp.hasMatch(value); if (isValid && cryptoCurrency != null) { switch (cryptoCurrency) { case CryptoCurrency.xmr: - isValid = (value.length == 95); + isValid = (value.length == 95)||(value.length == 106); break; case CryptoCurrency.ada: isValid = (value.length == 59)||(value.length == 92)||(value.length == 105); diff --git a/lib/src/stores/exchange/exchange_store.dart b/lib/src/stores/exchange/exchange_store.dart index 7d20fd6c8..a0cf932e4 100644 --- a/lib/src/stores/exchange/exchange_store.dart +++ b/lib/src/stores/exchange/exchange_store.dart @@ -226,15 +226,15 @@ abstract class ExchangeStoreBase with Store { } void validateAddress(String value, {CryptoCurrency cryptoCurrency}) { - // XMR (95), ADA (59, 92, 105), BCH (42), BNB (42), BTC (34, 42), DASH (34), EOS (42), + // XMR (95, 106), ADA (59, 92, 105), BCH (42), BNB (42), BTC (34, 42), DASH (34), EOS (42), // ETH (42), LTC (34), NANO (64, 65), TRX (34), USDT (42), XLM (56), XRP (34) - const pattern = '^[0-9a-zA-Z]{95}\$|^[0-9a-zA-Z]{34}\$|^[0-9a-zA-Z]{42}\$|^[0-9a-zA-Z]{56}\$|^[0-9a-zA-Z]{59}\$|^[0-9a-zA-Z_]{64}\$|^[0-9a-zA-Z_]{65}\$|^[0-9a-zA-Z]{92}\$|^[0-9a-zA-Z]{105}\$'; + const pattern = '^[0-9a-zA-Z]{95}\$|^[0-9a-zA-Z]{34}\$|^[0-9a-zA-Z]{42}\$|^[0-9a-zA-Z]{56}\$|^[0-9a-zA-Z]{59}\$|^[0-9a-zA-Z_]{64}\$|^[0-9a-zA-Z_]{65}\$|^[0-9a-zA-Z]{92}\$|^[0-9a-zA-Z]{105}\$|^[0-9a-zA-Z]{106}\$'; final regExp = RegExp(pattern); isValid = regExp.hasMatch(value); if (isValid && cryptoCurrency != null) { switch (cryptoCurrency) { case CryptoCurrency.xmr: - isValid = (value.length == 95); + isValid = (value.length == 95)||(value.length == 106); break; case CryptoCurrency.ada: isValid = (value.length == 59)||(value.length == 92)||(value.length == 105); diff --git a/lib/src/stores/send/send_store.dart b/lib/src/stores/send/send_store.dart index 494927857..dbad353c4 100644 --- a/lib/src/stores/send/send_store.dart +++ b/lib/src/stores/send/send_store.dart @@ -155,15 +155,15 @@ abstract class SendStoreBase with Store { } void validateAddress(String value, {CryptoCurrency cryptoCurrency}) { - // XMR (95), ADA (59, 92, 105), BCH (42), BNB (42), BTC (34, 42), DASH (34), EOS (42), + // XMR (95, 106), ADA (59, 92, 105), BCH (42), BNB (42), BTC (34, 42), DASH (34), EOS (42), // ETH (42), LTC (34), NANO (64, 65), TRX (34), USDT (42), XLM (56), XRP (34) - const pattern = '^[0-9a-zA-Z]{95}\$|^[0-9a-zA-Z]{34}\$|^[0-9a-zA-Z]{42}\$|^[0-9a-zA-Z]{56}\$|^[0-9a-zA-Z]{59}\$|^[0-9a-zA-Z_]{64}\$|^[0-9a-zA-Z_]{65}\$|^[0-9a-zA-Z]{92}\$|^[0-9a-zA-Z]{105}\$'; + const pattern = '^[0-9a-zA-Z]{95}\$|^[0-9a-zA-Z]{34}\$|^[0-9a-zA-Z]{42}\$|^[0-9a-zA-Z]{56}\$|^[0-9a-zA-Z]{59}\$|^[0-9a-zA-Z_]{64}\$|^[0-9a-zA-Z_]{65}\$|^[0-9a-zA-Z]{92}\$|^[0-9a-zA-Z]{105}\$|^[0-9a-zA-Z]{106}\$'; final regExp = RegExp(pattern); isValid = regExp.hasMatch(value); if (isValid && cryptoCurrency != null) { switch (cryptoCurrency) { case CryptoCurrency.xmr: - isValid = (value.length == 95); + isValid = (value.length == 95)||(value.length == 106); break; case CryptoCurrency.ada: isValid = (value.length == 59)||(value.length == 92)||(value.length == 105); diff --git a/lib/src/stores/wallet_restoration/wallet_restoration_store.dart b/lib/src/stores/wallet_restoration/wallet_restoration_store.dart index 2565bfc24..fad8f20d8 100644 --- a/lib/src/stores/wallet_restoration/wallet_restoration_store.dart +++ b/lib/src/stores/wallet_restoration/wallet_restoration_store.dart @@ -116,15 +116,15 @@ abstract class WalleRestorationStoreBase with Store { } void validateAddress(String value, {CryptoCurrency cryptoCurrency}) { - // XMR (95), ADA (59, 92, 105), BCH (42), BNB (42), BTC (34, 42), DASH (34), EOS (42), + // XMR (95, 106), ADA (59, 92, 105), BCH (42), BNB (42), BTC (34, 42), DASH (34), EOS (42), // ETH (42), LTC (34), NANO (64, 65), TRX (34), USDT (42), XLM (56), XRP (34) - const pattern = '^[0-9a-zA-Z]{95}\$|^[0-9a-zA-Z]{34}\$|^[0-9a-zA-Z]{42}\$|^[0-9a-zA-Z]{56}\$|^[0-9a-zA-Z]{59}\$|^[0-9a-zA-Z_]{64}\$|^[0-9a-zA-Z_]{65}\$|^[0-9a-zA-Z]{92}\$|^[0-9a-zA-Z]{105}\$'; + const pattern = '^[0-9a-zA-Z]{95}\$|^[0-9a-zA-Z]{34}\$|^[0-9a-zA-Z]{42}\$|^[0-9a-zA-Z]{56}\$|^[0-9a-zA-Z]{59}\$|^[0-9a-zA-Z_]{64}\$|^[0-9a-zA-Z_]{65}\$|^[0-9a-zA-Z]{92}\$|^[0-9a-zA-Z]{105}\$|^[0-9a-zA-Z]{106}\$'; final regExp = RegExp(pattern); isValid = regExp.hasMatch(value); if (isValid && cryptoCurrency != null) { switch (cryptoCurrency) { case CryptoCurrency.xmr: - isValid = (value.length == 95); + isValid = (value.length == 95)||(value.length == 106); break; case CryptoCurrency.ada: isValid = (value.length == 59)||(value.length == 92)||(value.length == 105); From 93c4f04f71b9c545bbd7b1128642272296a647bc Mon Sep 17 00:00:00 2001 From: Oleksandr Sobol Date: Wed, 22 Jan 2020 18:42:11 +0200 Subject: [PATCH 04/10] CWA-167 | changed decimal parameter of keyboard on true for exchange and send pages --- lib/src/screens/exchange/widgets/exchange_card.dart | 2 +- lib/src/screens/send/send_page.dart | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/src/screens/exchange/widgets/exchange_card.dart b/lib/src/screens/exchange/widgets/exchange_card.dart index 3791ecb90..833b18895 100644 --- a/lib/src/screens/exchange/widgets/exchange_card.dart +++ b/lib/src/screens/exchange/widgets/exchange_card.dart @@ -174,7 +174,7 @@ class ExchangeCardState extends State { enabled: _isAmountEditable, textAlign: TextAlign.right, keyboardType: TextInputType.numberWithOptions( - signed: false, decimal: false), + signed: false, decimal: true), inputFormatters: [ BlacklistingTextInputFormatter( RegExp('[\\-|\\ |\\,]')) diff --git a/lib/src/screens/send/send_page.dart b/lib/src/screens/send/send_page.dart index 9880b3459..f8fe0bbda 100644 --- a/lib/src/screens/send/send_page.dart +++ b/lib/src/screens/send/send_page.dart @@ -215,7 +215,7 @@ class SendFormState extends State { .color), controller: _cryptoAmountController, keyboardType: TextInputType.numberWithOptions( - signed: false, decimal: false), + signed: false, decimal: true), inputFormatters: [ BlacklistingTextInputFormatter( RegExp('[\\-|\\ |\\,]')) @@ -275,7 +275,7 @@ class SendFormState extends State { .color), controller: _fiatAmountController, keyboardType: TextInputType.numberWithOptions( - signed: false, decimal: false), + signed: false, decimal: true), inputFormatters: [ BlacklistingTextInputFormatter( RegExp('[\\-|\\ |\\,]')) From 50d857f23a7537befe37c8f81a78cf903d994cd0 Mon Sep 17 00:00:00 2001 From: Oleksandr Sobol Date: Tue, 28 Jan 2020 20:43:57 +0200 Subject: [PATCH 05/10] CWA-168 | added app version to settings page (added currentVersion to settings store and item to item_headers) --- lib/src/screens/settings/items/item_headers.dart | 1 + lib/src/screens/settings/settings.dart | 7 ++++++- lib/src/stores/settings/settings_store.dart | 6 +++++- 3 files changed, 12 insertions(+), 2 deletions(-) diff --git a/lib/src/screens/settings/items/item_headers.dart b/lib/src/screens/settings/items/item_headers.dart index 4ab7732c1..cc8a3b9aa 100644 --- a/lib/src/screens/settings/items/item_headers.dart +++ b/lib/src/screens/settings/items/item_headers.dart @@ -14,4 +14,5 @@ class ItemHeaders { static const support = 'Support'; static const termsAndConditions = 'Terms and conditions'; static const faq = 'FAQ'; + static const version = 'Version'; } \ No newline at end of file diff --git a/lib/src/screens/settings/settings.dart b/lib/src/screens/settings/settings.dart index 72602c4d8..906be11cd 100644 --- a/lib/src/screens/settings/settings.dart +++ b/lib/src/screens/settings/settings.dart @@ -279,7 +279,12 @@ class SettingsFormState extends State { SettingsItem( onTaped: () => Navigator.pushNamed(context, Routes.faq), title: ItemHeaders.faq, - attribute: Attributes.arrow) + attribute: Attributes.arrow), + SettingsItem( + onTaped: () {}, + title: ItemHeaders.version, + widget: null, + attribute: Attributes.widget) ]); setState(() {}); } diff --git a/lib/src/stores/settings/settings_store.dart b/lib/src/stores/settings/settings_store.dart index ef6f11236..b9a78d24f 100644 --- a/lib/src/stores/settings/settings_store.dart +++ b/lib/src/stores/settings/settings_store.dart @@ -46,6 +46,8 @@ abstract class SettingsStoreBase with Store { (dynamic _) => _sharedPreferences.setInt(displayActionListModeKey, serializeActionlistDisplayModes(actionlistDisplayMode)), fireImmediately: false); + + currentVersion = _sharedPreferences.getInt('current_default_settings_migration_version'); } static const currentNodeIdKey = 'current_node_id'; @@ -143,6 +145,7 @@ abstract class SettingsStoreBase with Store { SharedPreferences _sharedPreferences; Box _nodes; + int currentVersion; @action Future setAllowBiometricalAuthentication( @@ -264,7 +267,8 @@ abstract class SettingsStoreBase with Store { ItemHeaders.darkMode: S.current.settings_dark_mode, ItemHeaders.support: S.current.settings_support, ItemHeaders.termsAndConditions: S.current.settings_terms_and_conditions, - ItemHeaders.faq: S.current.faq + ItemHeaders.faq: S.current.faq, + ItemHeaders.version: 'Version 1.0.$currentVersion' }); } From 9355b2a1f4c0997172e616e4a6912f5f8058f87c Mon Sep 17 00:00:00 2001 From: Oleksandr Sobol Date: Wed, 29 Jan 2020 19:22:25 +0200 Subject: [PATCH 06/10] CWA-168 | app version added to list tile with background color --- lib/src/screens/settings/settings.dart | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/lib/src/screens/settings/settings.dart b/lib/src/screens/settings/settings.dart index 906be11cd..39ad3d1d4 100644 --- a/lib/src/screens/settings/settings.dart +++ b/lib/src/screens/settings/settings.dart @@ -279,12 +279,7 @@ class SettingsFormState extends State { SettingsItem( onTaped: () => Navigator.pushNamed(context, Routes.faq), title: ItemHeaders.faq, - attribute: Attributes.arrow), - SettingsItem( - onTaped: () {}, - title: ItemHeaders.version, - widget: null, - attribute: Attributes.widget) + attribute: Attributes.arrow) ]); setState(() {}); } @@ -348,9 +343,9 @@ class SettingsFormState extends State { final item = _items[index]; bool _isDrawDivider = true; - if (item.attribute == Attributes.header) { + if (item.attribute == Attributes.header || index == _items.length - 1) { _isDrawDivider = false; - } else if (index < _items.length - 1) { + } else { if (_items[index + 1].attribute == Attributes.header) { _isDrawDivider = false; } @@ -378,9 +373,13 @@ class SettingsFormState extends State { ], ); }), - Container( - height: 20.0, - color: Theme.of(context).accentTextTheme.headline.backgroundColor, + ListTile( + contentPadding: EdgeInsets.only(left: 20.0), + title: Text( + settingsStore.itemHeaders[ItemHeaders.version], + style: TextStyle( + fontSize: 14.0, color: Palette.wildDarkBlue) + ), ) ], )); From 060c35ce04f5aaa87609cd8dc0df4ffac9b7c0de Mon Sep 17 00:00:00 2001 From: Oleksandr Sobol Date: Sat, 1 Feb 2020 20:10:01 +0200 Subject: [PATCH 07/10] CWA-170 | changed transaction date format and applied the same format to trade --- lib/src/screens/dashboard/dashboard_page.dart | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/src/screens/dashboard/dashboard_page.dart b/lib/src/screens/dashboard/dashboard_page.dart index 5d2e80361..89d767418 100644 --- a/lib/src/screens/dashboard/dashboard_page.dart +++ b/lib/src/screens/dashboard/dashboard_page.dart @@ -112,7 +112,7 @@ class DashboardPageBody extends StatefulWidget { } class DashboardPageBodyState extends State { - static final transactionDateFormat = DateFormat("MMM d, yyyy HH:mm"); + static final transactionDateFormat = DateFormat("MMMM d, yyyy HH:mm"); final _connectionStatusObserverKey = GlobalKey(); final _balanceObserverKey = GlobalKey(); @@ -566,7 +566,7 @@ class DashboardPageBodyState extends State { from: trade.from, to: trade.to, createdAtFormattedDate: - DateFormat("dd.MM.yyyy, H:m").format(trade.createdAt), + transactionDateFormat.format(trade.createdAt), formattedAmount: formattedAmount); } From 6ee4ddda0910b9bda57d2f1a93569f4211e3cd73 Mon Sep 17 00:00:00 2001 From: Oleksandr Sobol Date: Mon, 3 Feb 2020 17:23:31 +0200 Subject: [PATCH 08/10] CWA-168 | added defining app current version with PackageInfo in settings store --- lib/src/stores/settings/settings_store.dart | 19 ++++++++++++++++--- pubspec.lock | 7 +++++++ pubspec.yaml | 1 + 3 files changed, 24 insertions(+), 3 deletions(-) diff --git a/lib/src/stores/settings/settings_store.dart b/lib/src/stores/settings/settings_store.dart index b9a78d24f..32ab0f9a2 100644 --- a/lib/src/stores/settings/settings_store.dart +++ b/lib/src/stores/settings/settings_store.dart @@ -12,6 +12,7 @@ import 'package:cake_wallet/src/stores/action_list/action_list_display_mode.dart import 'package:cake_wallet/src/screens/settings/items/item_headers.dart'; import 'package:cake_wallet/generated/i18n.dart'; import 'package:cake_wallet/src/domain/common/default_settings_migration.dart'; +import 'package:package_info/package_info.dart'; part 'settings_store.g.dart'; @@ -47,7 +48,19 @@ abstract class SettingsStoreBase with Store { serializeActionlistDisplayModes(actionlistDisplayMode)), fireImmediately: false); - currentVersion = _sharedPreferences.getInt('current_default_settings_migration_version'); + PackageInfo.fromPlatform().then((PackageInfo packageInfo) { + final version = packageInfo.version; + final buildNumber = packageInfo.buildNumber; + final List versionList = version.split(RegExp("\\.")); + currentVersion = ""; + + for (int i = 0; i < versionList.length - 1; i++) { + currentVersion += versionList[ i ] + "."; + } + + currentVersion += buildNumber; + }); + } static const currentNodeIdKey = 'current_node_id'; @@ -145,7 +158,7 @@ abstract class SettingsStoreBase with Store { SharedPreferences _sharedPreferences; Box _nodes; - int currentVersion; + String currentVersion; @action Future setAllowBiometricalAuthentication( @@ -268,7 +281,7 @@ abstract class SettingsStoreBase with Store { ItemHeaders.support: S.current.settings_support, ItemHeaders.termsAndConditions: S.current.settings_terms_and_conditions, ItemHeaders.faq: S.current.faq, - ItemHeaders.version: 'Version 1.0.$currentVersion' + ItemHeaders.version: 'Version $currentVersion' }); } diff --git a/pubspec.lock b/pubspec.lock index a8b5c8ba7..d4adb3dbb 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -469,6 +469,13 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "1.1.0" + package_info: + dependency: "direct main" + description: + name: package_info + url: "https://pub.dartlang.org" + source: hosted + version: "0.4.0+13" package_resolver: dependency: transitive description: diff --git a/pubspec.yaml b/pubspec.yaml index 306c34298..e20521171 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -45,6 +45,7 @@ dependencies: path: ./cw_monero hive: ^1.2.0 hive_flutter: ^0.2.1 + package_info: ^0.4.0+13 # The following adds the Cupertino Icons font to your application. # Use with the CupertinoIcons class for iOS style icons. From 524f23b1db6eccb303d3ac20cdc9bb2d63c3818f Mon Sep 17 00:00:00 2001 From: Oleksandr Sobol Date: Mon, 3 Feb 2020 21:41:58 +0200 Subject: [PATCH 09/10] CWA-168 | changed current version in settings store --- lib/src/stores/settings/settings_store.dart | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/lib/src/stores/settings/settings_store.dart b/lib/src/stores/settings/settings_store.dart index 32ab0f9a2..57136d06f 100644 --- a/lib/src/stores/settings/settings_store.dart +++ b/lib/src/stores/settings/settings_store.dart @@ -49,16 +49,7 @@ abstract class SettingsStoreBase with Store { fireImmediately: false); PackageInfo.fromPlatform().then((PackageInfo packageInfo) { - final version = packageInfo.version; - final buildNumber = packageInfo.buildNumber; - final List versionList = version.split(RegExp("\\.")); - currentVersion = ""; - - for (int i = 0; i < versionList.length - 1; i++) { - currentVersion += versionList[ i ] + "."; - } - - currentVersion += buildNumber; + currentVersion = packageInfo.version; }); } From 8c5c5636e916c7483c24b42eb6d71884effaeb3b Mon Sep 17 00:00:00 2001 From: Oleksandr Sobol Date: Tue, 4 Feb 2020 19:47:35 +0200 Subject: [PATCH 10/10] CWA-168 | added translation for "Version", used arrow function in the callback, used collection.last for setting items --- lib/generated/i18n.dart | 21 +++++++++++++++++++++ lib/src/screens/settings/settings.dart | 2 +- lib/src/stores/settings/settings_store.dart | 6 ++---- res/values/strings_de.arb | 4 +++- res/values/strings_en.arb | 4 +++- res/values/strings_es.arb | 4 +++- res/values/strings_hi.arb | 4 +++- res/values/strings_ja.arb | 4 +++- res/values/strings_ko.arb | 4 +++- res/values/strings_nl.arb | 4 +++- res/values/strings_pl.arb | 4 +++- res/values/strings_pt.arb | 4 +++- res/values/strings_ru.arb | 4 +++- res/values/strings_zh.arb | 4 +++- 14 files changed, 57 insertions(+), 16 deletions(-) diff --git a/lib/generated/i18n.dart b/lib/generated/i18n.dart index 9e8e43bd9..c47b8cb4e 100644 --- a/lib/generated/i18n.dart +++ b/lib/generated/i18n.dart @@ -286,6 +286,7 @@ class S implements WidgetsLocalizations { String trade_id_not_found(String tradeId, String title) => "Trade ${tradeId} of ${title} not found."; String trade_is_powered_by(String provider) => "This trade is powered by ${provider}"; String transaction_details_copied(String title) => "${title} copied to Clipboard"; + String version(String currentVersion) => "Version ${currentVersion}"; String wallet_list_failed_to_load(String wallet_name, String error) => "Failed to load ${wallet_name} wallet. ${error}"; 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"; @@ -797,6 +798,8 @@ class $de extends S { @override String wallet_list_loading_wallet(String wallet_name) => "Wird geladen ${wallet_name} Wallet"; @override + String version(String currentVersion) => "Ausführung ${currentVersion}"; + @override String router_no_route(String name) => "Keine Route definiert für ${name}"; @override String trade_id_not_found(String tradeId, String title) => "Handel ${tradeId} von ${title} nicht gefunden."; @@ -1343,6 +1346,8 @@ class $hi extends S { @override String wallet_list_loading_wallet(String wallet_name) => "लोड हो रहा है ${wallet_name} बटुआ"; @override + String version(String currentVersion) => "संस्करण ${currentVersion}"; + @override String router_no_route(String name) => "के लिए कोई मार्ग निर्धारित नहीं है ${name}"; @override String trade_id_not_found(String tradeId, String title) => "व्यापार ${tradeId} of ${title} नहीं मिला."; @@ -1889,6 +1894,8 @@ class $ru extends S { @override String wallet_list_loading_wallet(String wallet_name) => "Загрузка ${wallet_name} кошелька"; @override + String version(String currentVersion) => "Версия ${currentVersion}"; + @override String router_no_route(String name) => "Экран не найден ${name}"; @override String trade_id_not_found(String tradeId, String title) => "Сделка ${tradeId} ${title} не найдена."; @@ -2435,6 +2442,8 @@ class $ko extends S { @override String wallet_list_loading_wallet(String wallet_name) => "로딩 ${wallet_name} 지갑"; @override + String version(String currentVersion) => "버전 ${currentVersion}"; + @override String router_no_route(String name) => "에 정의 된 경로가 없습니다 ${name}"; @override String trade_id_not_found(String tradeId, String title) => "무역 ${tradeId} 의 ${title} 찾을 수 없습니다."; @@ -2981,6 +2990,8 @@ class $pt extends S { @override String wallet_list_loading_wallet(String wallet_name) => "Abrindo a carteira ${wallet_name}"; @override + String version(String currentVersion) => "Versão ${currentVersion}"; + @override String router_no_route(String name) => "Nenhuma rota definida para ${name}"; @override String trade_id_not_found(String tradeId, String title) => "A troca ${tradeId} de ${title} não foi encontrada."; @@ -3527,6 +3538,8 @@ class $ja extends S { @override String wallet_list_loading_wallet(String wallet_name) => "読み込み中 ${wallet_name} 財布"; @override + String version(String currentVersion) => "バージョン ${currentVersion}"; + @override String router_no_route(String name) => "ルートが定義されていません ${name}"; @override String trade_id_not_found(String tradeId, String title) => "トレード ${tradeId} of ${title} 見つかりません"; @@ -4077,6 +4090,8 @@ class $pl extends S { @override String wallet_list_loading_wallet(String wallet_name) => "Ładuję ${wallet_name} portfel"; @override + String version(String currentVersion) => "Wersja ${currentVersion}"; + @override String router_no_route(String name) => "Brak zdefiniowanej trasy dla ${name}"; @override String trade_id_not_found(String tradeId, String title) => "Handel ${tradeId} of ${title} nie znaleziono."; @@ -4623,6 +4638,8 @@ class $es extends S { @override String wallet_list_loading_wallet(String wallet_name) => "Billetera ${wallet_name} de carga"; @override + String version(String currentVersion) => "Versión ${currentVersion}"; + @override String router_no_route(String name) => "No hay ruta definida para ${name}"; @override String trade_id_not_found(String tradeId, String title) => "Comercio ${tradeId} de ${title} no encontrado."; @@ -5169,6 +5186,8 @@ class $nl extends S { @override String wallet_list_loading_wallet(String wallet_name) => "Bezig met laden ${wallet_name} portemonnee"; @override + String version(String currentVersion) => "Versie ${currentVersion}"; + @override String router_no_route(String name) => "Geen route gedefinieerd voor ${name}"; @override String trade_id_not_found(String tradeId, String title) => "Handel ${tradeId} van ${title} niet gevonden."; @@ -5715,6 +5734,8 @@ class $zh extends S { @override String wallet_list_loading_wallet(String wallet_name) => "载入中 ${wallet_name} 钱包"; @override + String version(String currentVersion) => "版 ${currentVersion}"; + @override String router_no_route(String name) => "未定义路线 ${name}"; @override String trade_id_not_found(String tradeId, String title) => "贸易方式 ${tradeId} 的 ${title} 未找到."; diff --git a/lib/src/screens/settings/settings.dart b/lib/src/screens/settings/settings.dart index 39ad3d1d4..0a6eb5d99 100644 --- a/lib/src/screens/settings/settings.dart +++ b/lib/src/screens/settings/settings.dart @@ -343,7 +343,7 @@ class SettingsFormState extends State { final item = _items[index]; bool _isDrawDivider = true; - if (item.attribute == Attributes.header || index == _items.length - 1) { + if (item.attribute == Attributes.header || item == _items.last) { _isDrawDivider = false; } else { if (_items[index + 1].attribute == Attributes.header) { diff --git a/lib/src/stores/settings/settings_store.dart b/lib/src/stores/settings/settings_store.dart index 57136d06f..786d4083e 100644 --- a/lib/src/stores/settings/settings_store.dart +++ b/lib/src/stores/settings/settings_store.dart @@ -48,9 +48,7 @@ abstract class SettingsStoreBase with Store { serializeActionlistDisplayModes(actionlistDisplayMode)), fireImmediately: false); - PackageInfo.fromPlatform().then((PackageInfo packageInfo) { - currentVersion = packageInfo.version; - }); + PackageInfo.fromPlatform().then((PackageInfo packageInfo) => currentVersion = packageInfo.version); } @@ -272,7 +270,7 @@ abstract class SettingsStoreBase with Store { ItemHeaders.support: S.current.settings_support, ItemHeaders.termsAndConditions: S.current.settings_terms_and_conditions, ItemHeaders.faq: S.current.faq, - ItemHeaders.version: 'Version $currentVersion' + ItemHeaders.version: S.current.version(currentVersion) }); } diff --git a/res/values/strings_de.arb b/res/values/strings_de.arb index eeb48b405..8dd44f7b6 100644 --- a/res/values/strings_de.arb +++ b/res/values/strings_de.arb @@ -336,5 +336,7 @@ "paste" : "Einfügen", "restore_from_seed_placeholder" : "Bitte geben Sie hier Ihren Code ein", "add_new_word" : "Neues Wort hinzufügen", - "incorrect_seed" : "Der eingegebene Text ist ungültig." + "incorrect_seed" : "Der eingegebene Text ist ungültig.", + + "version" : "Ausführung ${currentVersion}" } \ No newline at end of file diff --git a/res/values/strings_en.arb b/res/values/strings_en.arb index e107a4a9e..3e878bbc3 100644 --- a/res/values/strings_en.arb +++ b/res/values/strings_en.arb @@ -336,5 +336,7 @@ "paste" : "Paste", "restore_from_seed_placeholder" : "Please enter or paste your seed here", "add_new_word" : "Add new word", - "incorrect_seed" : "The text entered is not valid." + "incorrect_seed" : "The text entered is not valid.", + + "version" : "Version ${currentVersion}" } \ No newline at end of file diff --git a/res/values/strings_es.arb b/res/values/strings_es.arb index fa46ee111..3d8e9472d 100644 --- a/res/values/strings_es.arb +++ b/res/values/strings_es.arb @@ -336,5 +336,7 @@ "paste" : "Pegar", "restore_from_seed_placeholder" : "Ingrese o pegue su frase de código aquí", "add_new_word" : "Agregar palabra nueva", - "incorrect_seed" : "El texto ingresado no es válido." + "incorrect_seed" : "El texto ingresado no es válido.", + + "version" : "Versión ${currentVersion}" } \ No newline at end of file diff --git a/res/values/strings_hi.arb b/res/values/strings_hi.arb index b6343da7d..712bc9082 100644 --- a/res/values/strings_hi.arb +++ b/res/values/strings_hi.arb @@ -336,5 +336,7 @@ "paste" : "पेस्ट करें", "restore_from_seed_placeholder" : "कृपया अपना कोड वाक्यांश यहां दर्ज करें या पेस्ट करें", "add_new_word" : "नया शब्द जोड़ें", - "incorrect_seed" : "दर्ज किया गया पाठ मान्य नहीं है।" + "incorrect_seed" : "दर्ज किया गया पाठ मान्य नहीं है।", + + "version" : "संस्करण ${currentVersion}" } \ No newline at end of file diff --git a/res/values/strings_ja.arb b/res/values/strings_ja.arb index e40aaa2b1..0dd826a09 100644 --- a/res/values/strings_ja.arb +++ b/res/values/strings_ja.arb @@ -336,5 +336,7 @@ "paste" : "ペースト", "restore_from_seed_placeholder" : "ここにコードフレーズを入力または貼り付けてください", "add_new_word" : "新しい単語を追加", - "incorrect_seed" : "入力されたテキストは無効です。" + "incorrect_seed" : "入力されたテキストは無効です。", + + "version" : "バージョン ${currentVersion}" } \ No newline at end of file diff --git a/res/values/strings_ko.arb b/res/values/strings_ko.arb index 6c594ea13..1be04579d 100644 --- a/res/values/strings_ko.arb +++ b/res/values/strings_ko.arb @@ -336,5 +336,7 @@ "paste" : "풀", "restore_from_seed_placeholder" : "여기에 코드 문구를 입력하거나 붙여 넣으십시오.", "add_new_word" : "새로운 단어 추가", - "incorrect_seed" : "입력하신 텍스트가 유효하지 않습니다." + "incorrect_seed" : "입력하신 텍스트가 유효하지 않습니다.", + + "version" : "버전 ${currentVersion}" } \ No newline at end of file diff --git a/res/values/strings_nl.arb b/res/values/strings_nl.arb index 986ebfa8e..7690fd275 100644 --- a/res/values/strings_nl.arb +++ b/res/values/strings_nl.arb @@ -336,5 +336,7 @@ "paste" : "Plakken", "restore_from_seed_placeholder" : "Voer hier uw codefrase in of plak deze", "add_new_word" : "Nieuw woord toevoegen", - "incorrect_seed" : "De ingevoerde tekst is niet geldig." + "incorrect_seed" : "De ingevoerde tekst is niet geldig.", + + "version" : "Versie ${currentVersion}" } \ No newline at end of file diff --git a/res/values/strings_pl.arb b/res/values/strings_pl.arb index bcfcffe1b..fdbd6df3f 100644 --- a/res/values/strings_pl.arb +++ b/res/values/strings_pl.arb @@ -336,5 +336,7 @@ "paste" : "Pasta", "restore_from_seed_placeholder" : "Wpisz lub wklej tutaj swoją frazę kodową", "add_new_word" : "Dodaj nowe słowo", - "incorrect_seed" : "Wprowadzony tekst jest nieprawidłowy." + "incorrect_seed" : "Wprowadzony tekst jest nieprawidłowy.", + + "version" : "Wersja ${currentVersion}" } \ No newline at end of file diff --git a/res/values/strings_pt.arb b/res/values/strings_pt.arb index 8a6d6d4c8..366ec1e81 100644 --- a/res/values/strings_pt.arb +++ b/res/values/strings_pt.arb @@ -336,5 +336,7 @@ "paste" : "Colar", "restore_from_seed_placeholder" : "Digite ou cole sua frase de código aqui", "add_new_word" : "Adicionar nova palavra", - "incorrect_seed" : "O texto digitado não é válido." + "incorrect_seed" : "O texto digitado não é válido.", + + "version" : "Versão ${currentVersion}" } diff --git a/res/values/strings_ru.arb b/res/values/strings_ru.arb index 5ca7c9bcb..3e5ededb0 100644 --- a/res/values/strings_ru.arb +++ b/res/values/strings_ru.arb @@ -336,5 +336,7 @@ "paste" : "Вставить", "restore_from_seed_placeholder" : "Введите или вставте код фразу вашего кошелька", "add_new_word" : "Добавить новое слово", - "incorrect_seed" : "Введенный текст некорректный." + "incorrect_seed" : "Введенный текст некорректный.", + + "version" : "Версия ${currentVersion}" } \ No newline at end of file diff --git a/res/values/strings_zh.arb b/res/values/strings_zh.arb index 69c5e886f..451168f6b 100644 --- a/res/values/strings_zh.arb +++ b/res/values/strings_zh.arb @@ -336,5 +336,7 @@ "paste" : "糊", "restore_from_seed_placeholder" : "请在此处输入或粘贴您的代码短语", "add_new_word" : "添加新词", - "incorrect_seed" : "输入的文字无效。" + "incorrect_seed" : "输入的文字无效。", + + "version" : "版 ${currentVersion}" } \ No newline at end of file