From f5704a98329c0c570495c086051a32a8c8e59486 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcos=20Rodriguez=20Ve=CC=81lez?= Date: Thu, 3 Jan 2019 20:46:40 -0500 Subject: [PATCH 1/5] FIX: Fixed an issue in currency settings where the checkmark wouldn't be in the correct preference ADD: Added AUD, VEF, and ZAR fiats. --- currency.js | 23 ++++++++++++++++++----- models/fiatUnit.js | 3 +++ screen/lnd/lndViewInvoice.js | 1 - screen/settings/currency.js | 7 +++++-- 4 files changed, 26 insertions(+), 8 deletions(-) diff --git a/currency.js b/currency.js index c9fe565a0..60bc1981f 100644 --- a/currency.js +++ b/currency.js @@ -78,11 +78,24 @@ function satoshiToLocalCurrency(satoshi) { .toString(10); b = parseFloat(b).toFixed(2); - const formatter = new Intl.NumberFormat(preferredFiatCurrency.locale, { - style: 'currency', - currency: preferredFiatCurrency.endPointKey, - minimumFractionDigits: 2, - }); + let formatter; + + try { + formatter = new Intl.NumberFormat(preferredFiatCurrency.locale, { + style: 'currency', + currency: preferredFiatCurrency.endPointKey, + minimumFractionDigits: 2, + }); + } catch (error) { + console.warn(error); + console.log(error); + formatter = new Intl.NumberFormat(FiatUnit.USD.locale, { + style: 'currency', + currency: preferredFiatCurrency.endPointKey, + minimumFractionDigits: 2, + }); + } + return formatter.format(b); } diff --git a/models/fiatUnit.js b/models/fiatUnit.js index 0da32431d..3267e6a0e 100644 --- a/models/fiatUnit.js +++ b/models/fiatUnit.js @@ -1,5 +1,6 @@ export const FiatUnit = Object.freeze({ USD: { endPointKey: 'USD', symbol: '$', locale: 'en-US' }, + AUD: { endPointKey: 'AUD', symbol: '$', locale: 'en-AU' }, EUR: { endPointKey: 'EUR', symbol: '€', locale: 'en-EN' }, GBP: { endPointKey: 'GBP', symbol: '£', locale: 'en-GB' }, RUB: { endPointKey: 'RUB', symbol: '₽', locale: 'ru-RU' }, @@ -7,4 +8,6 @@ export const FiatUnit = Object.freeze({ CNY: { endPointKey: 'CNY', symbol: '¥', locale: 'zh-CN' }, JPY: { endPointKey: 'JPY', symbol: '¥', locale: 'ja-JP' }, INR: { endPointKey: 'INR', symbol: '₹', locale: 'hi-HN' }, + VEF: { endPointKey: 'VEF', symbol: 'Bs.', locale: 'es-VE' }, + ZAR: { endPointKey: 'ZAR', symbol: 'R', locale: 'en-ZA' }, }); diff --git a/screen/lnd/lndViewInvoice.js b/screen/lnd/lndViewInvoice.js index cd42231c7..7345d744e 100644 --- a/screen/lnd/lndViewInvoice.js +++ b/screen/lnd/lndViewInvoice.js @@ -166,7 +166,6 @@ export default class LNDViewInvoice extends Component { + + Prices are obtained from CoinDesk + ); } From f37363a9a5a4ade508b4ed00697673b5607bbda5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcos=20Rodriguez=20Ve=CC=81lez?= Date: Thu, 3 Jan 2019 21:06:02 -0500 Subject: [PATCH 2/5] FIX: Made amount tap area larger --- BlueComponents.js | 3 +++ ios/BlueWallet/Info.plist | 4 ++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/BlueComponents.js b/BlueComponents.js index d015e6dc3..e9425c97d 100644 --- a/BlueComponents.js +++ b/BlueComponents.js @@ -1127,6 +1127,7 @@ export class BlueBitcoinAmount extends Component { const amount = typeof this.props.amount === 'number' ? this.props.amount.toString() : this.props.amount; return ( + this.textInput.focus()}> this.props.onChangeText(text.replace(',', '.'))} placeholder="0" maxLength={10} + ref={(textInput) => this.textInput = textInput} editable={!this.props.isLoading && !this.props.disabled} value={amount} placeholderTextColor={this.props.disabled ? '#99a0ab' : '#0f5cc0'} @@ -1162,6 +1164,7 @@ export class BlueBitcoinAmount extends Component { + ); } } diff --git a/ios/BlueWallet/Info.plist b/ios/BlueWallet/Info.plist index 73b3dd459..afaa1a85d 100644 --- a/ios/BlueWallet/Info.plist +++ b/ios/BlueWallet/Info.plist @@ -17,7 +17,7 @@ CFBundlePackageType APPL CFBundleShortVersionString - 3.5.1 + 3.5.2 CFBundleSignature ???? CFBundleURLTypes @@ -33,7 +33,7 @@ CFBundleVersion - 201 + 204 ITSAppUsesNonExemptEncryption LSRequiresIPhoneOS From d453059ee16825cee025e67824388621feee4e79 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcos=20Rodriguez=20Ve=CC=81lez?= Date: Thu, 3 Jan 2019 22:28:15 -0500 Subject: [PATCH 3/5] FIX: Changed language selection screen to FlatList --- BlueComponents.js | 70 ++++++++++++++++++------------------- ios/BlueWallet/Info.plist | 2 +- screen/settings/language.js | 66 ++++++++++++++++++++++------------ 3 files changed, 79 insertions(+), 59 deletions(-) diff --git a/BlueComponents.js b/BlueComponents.js index e9425c97d..cc407197e 100644 --- a/BlueComponents.js +++ b/BlueComponents.js @@ -1128,42 +1128,42 @@ export class BlueBitcoinAmount extends Component { return ( this.textInput.focus()}> - - - this.props.onChangeText(text.replace(',', '.'))} - placeholder="0" - maxLength={10} - ref={(textInput) => this.textInput = textInput} - editable={!this.props.isLoading && !this.props.disabled} - value={amount} - placeholderTextColor={this.props.disabled ? '#99a0ab' : '#0f5cc0'} - style={{ - color: this.props.disabled ? '#99a0ab' : '#0f5cc0', - fontSize: 36, - fontWeight: '600', - }} - /> - - {' ' + BitcoinUnit.BTC} - + + + this.props.onChangeText(text.replace(',', '.'))} + placeholder="0" + maxLength={10} + ref={textInput => (this.textInput = textInput)} + editable={!this.props.isLoading && !this.props.disabled} + value={amount} + placeholderTextColor={this.props.disabled ? '#99a0ab' : '#0f5cc0'} + style={{ + color: this.props.disabled ? '#99a0ab' : '#0f5cc0', + fontSize: 36, + fontWeight: '600', + }} + /> + + {' ' + BitcoinUnit.BTC} + + + + + {loc.formatBalance(amount || 0, BitcoinUnit.LOCAL_CURRENCY)} + + - - - {loc.formatBalance(amount || 0, BitcoinUnit.LOCAL_CURRENCY)} - - - ); } diff --git a/ios/BlueWallet/Info.plist b/ios/BlueWallet/Info.plist index afaa1a85d..4974a2e21 100644 --- a/ios/BlueWallet/Info.plist +++ b/ios/BlueWallet/Info.plist @@ -33,7 +33,7 @@ CFBundleVersion - 204 + 205 ITSAppUsesNonExemptEncryption LSRequiresIPhoneOS diff --git a/screen/settings/language.js b/screen/settings/language.js index f988bea63..40f5da537 100644 --- a/screen/settings/language.js +++ b/screen/settings/language.js @@ -1,9 +1,8 @@ import React, { Component } from 'react'; -import { Picker } from 'react-native'; -import { BlueLoading, SafeBlueArea, BlueCard, BlueNavigationStyle } from '../../BlueComponents'; +import { FlatList, TouchableOpacity } from 'react-native'; +import { BlueLoading, BlueText, SafeBlueArea, BlueListItem, BlueCard, BlueNavigationStyle } from '../../BlueComponents'; import PropTypes from 'prop-types'; -/** @type {AppStorage} */ -let BlueApp = require('../../BlueApp'); +import { Icon } from 'react-native-elements'; let loc = require('../../loc'); export default class Language extends Component { @@ -17,16 +16,47 @@ export default class Language extends Component { this.state = { isLoading: true, language: loc.getLanguage(), + availableLanguages: [ + { label: 'English', value: 'en' }, + { label: 'Русский', value: 'ru' }, + { label: 'Українська', value: 'ua' }, + { label: 'Spanish', value: 'es' }, + { label: 'Portuguese (BR)', value: 'pt_br' }, + { label: 'Portuguese (PT)', value: 'pt_pt' }, + { label: 'Deutsch (DE)', value: 'de_de' }, + { label: 'Česky (CZ)', value: 'cs_cz' }, + ], }; } async componentDidMount() { this.setState({ isLoading: false, - storageIsEncrypted: await BlueApp.storageIsEncrypted(), }); } + renderItem = ({ item }) => { + return ( + { + console.log('setLanguage', item.value); + loc.setLanguage(item.value); + loc.saveLanguage(item.value); + return this.setState({ language: item.value }); + }} + > + , + } + : { hideChevron: true })} + /> + + ); + }; + render() { if (this.state.isLoading) { return ; @@ -34,25 +64,15 @@ export default class Language extends Component { return ( + `${index}`} + data={this.state.availableLanguages} + extraData={this.state.availableLanguages} + renderItem={this.renderItem} + /> - { - console.log('setLanguage', itemValue); - loc.setLanguage(itemValue); - loc.saveLanguage(itemValue); - return this.setState({ language: itemValue }); - }} - > - - - - - - - - - + When selecting a new language, restarting Blue Wallet may be required for the change to take effect. ); From 292d4fc46cf12010a8bd9e74df9e91f063bacc96 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcos=20Rodriguez=20Ve=CC=81lez?= Date: Thu, 3 Jan 2019 23:28:12 -0500 Subject: [PATCH 4/5] FIX: If. balance was not a string, app would crash. --- ios/BlueWallet/Info.plist | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ios/BlueWallet/Info.plist b/ios/BlueWallet/Info.plist index 4974a2e21..ff02f3829 100644 --- a/ios/BlueWallet/Info.plist +++ b/ios/BlueWallet/Info.plist @@ -33,7 +33,7 @@ CFBundleVersion - 205 + 206 ITSAppUsesNonExemptEncryption LSRequiresIPhoneOS From 5e895ce4b89bcb7a4f3b470874e52cc213a21e90 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcos=20Rodriguez=20Ve=CC=81lez?= Date: Thu, 3 Jan 2019 23:28:22 -0500 Subject: [PATCH 5/5] no message --- loc/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/loc/index.js b/loc/index.js index 52e5323c7..662b9c84c 100644 --- a/loc/index.js +++ b/loc/index.js @@ -126,7 +126,7 @@ strings.formatBalanceWithoutSuffix = (balance, toUnit) => { return currency.satoshiToLocalCurrency(balance); } } - return balance; + return balance.toString(); }; module.exports = strings;