FIX: Fixed currencies in tx details and send

This commit is contained in:
Marcos Rodriguez Vélez 2018-12-22 00:12:41 -05:00
parent 06a77fc1d9
commit 3efb9ccfde
5 changed files with 27 additions and 27 deletions

1
App.js
View File

@ -30,6 +30,7 @@ export default class App extends React.Component {
return;
}
if (event.url.indexOf('bitcoin:') === 0 || event.url.indexOf('BITCOIN:') === 0) {
console.warn(event);
this.navigator &&
this.navigator.dispatch(
NavigationActions.navigate({

View File

@ -34,7 +34,7 @@
</dict>
</array>
<key>CFBundleVersion</key>
<string>155</string>
<string>156</string>
<key>LSRequiresIPhoneOS</key>
<true/>
<key>NSAppTransportSecurity</key>

View File

@ -73,31 +73,28 @@ strings.formatBalance = (balance, fromUnit, toUnit) => {
if (toUnit === undefined) {
return balance + ' ' + BitcoinUnit.BTC;
}
if (balance !== 0) {
if (fromUnit === BitcoinUnit.LOCAL_CURRENCY) {
return currency.satoshiToLocalCurrency(
BTCUnits(balance, BitcoinUnit.BTC)
.to(BitcoinUnit.SATS)
.value(),
);
}
if (toUnit === BitcoinUnit.BTC) {
return BTCUnits(balance, fromUnit)
.to(BitcoinUnit.BTC)
.format();
} else if (toUnit === BitcoinUnit.SATS) {
return BTCUnits(balance, BitcoinUnit.BTC)
if (fromUnit === BitcoinUnit.LOCAL_CURRENCY) {
return currency.satoshiToLocalCurrency(
BTCUnits(balance, BitcoinUnit.BTC)
.to(BitcoinUnit.SATS)
.format();
} else if (toUnit === BitcoinUnit.LOCAL_CURRENCY) {
return currency.satoshiToLocalCurrency(
BTCUnits(balance, BitcoinUnit.BTC)
.to(BitcoinUnit.SATS)
.value(),
);
}
.value(),
);
}
if (toUnit === BitcoinUnit.BTC) {
return BTCUnits(balance, fromUnit)
.to(BitcoinUnit.BTC)
.format();
} else if (toUnit === BitcoinUnit.SATS) {
return BTCUnits(balance, BitcoinUnit.BTC)
.to(BitcoinUnit.SATS)
.format();
} else if (toUnit === BitcoinUnit.LOCAL_CURRENCY) {
return currency.satoshiToLocalCurrency(
BTCUnits(balance, BitcoinUnit.BTC)
.to(BitcoinUnit.SATS)
.value(),
);
}
return balance + ' ' + BitcoinUnit.BTC;
};
strings.formatBalanceWithoutSuffix = (balance, fromUnit, toUnit) => {

View File

@ -445,7 +445,7 @@ export default class SendDetails extends Component {
placeholder="0"
maxLength={10}
editable={!this.state.isLoading}
value={loc.formatBalanceWithoutSuffix(this.state.amount || 0 + '', BitcoinUnit.BTC)}
// value={loc.formatBalanceWithoutSuffix(this.state.amount || 0 + '', BitcoinUnit.BTC, BitcoinUnit.BTC)}
placeholderTextColor="#0f5cc0"
style={{
color: '#0f5cc0',
@ -468,7 +468,7 @@ export default class SendDetails extends Component {
</View>
<View style={{ alignItems: 'center', marginBottom: 22, marginTop: 4 }}>
<Text style={{ fontSize: 18, color: '#d4d4d4', fontWeight: '600' }}>
{currency.satoshiToLocalCurrency(loc.formatBalanceWithoutSuffix(this.state.amount || 0, BitcoinUnit.SATS))}
{loc.formatBalance(Number(this.state.amount || 0), BitcoinUnit.BTC, BitcoinUnit.LOCAL_CURRENCY)}
</Text>
</View>
<View

View File

@ -143,7 +143,9 @@ export default class TransactionsDetails extends Component {
{this.state.tx.hasOwnProperty('fee') && (
<React.Fragment>
<BlueText style={{ fontSize: 16, fontWeight: '500', marginBottom: 4 }}>{loc.send.create.fee}</BlueText>
<BlueText style={{ marginBottom: 26, color: 'grey' }}>{loc.formatBalance(this.state.tx.fee, BitcoinUnit.BTC)}</BlueText>
<BlueText style={{ marginBottom: 26, color: 'grey' }}>
{loc.formatBalance(this.state.tx.fee, BitcoinUnit.SATS, BitcoinUnit.BTC)}
</BlueText>
</React.Fragment>
)}