mirror of
https://github.com/BlueWallet/BlueWallet.git
synced 2025-03-26 08:55:56 +01:00
Lets see if this works
This commit is contained in:
parent
3ebc79624c
commit
06a77fc1d9
3 changed files with 17 additions and 8 deletions
19
loc/index.js
19
loc/index.js
|
@ -70,23 +70,30 @@ strings.transactionTimeToReadable = function(time) {
|
|||
* @returns {string}
|
||||
*/
|
||||
strings.formatBalance = (balance, fromUnit, toUnit) => {
|
||||
if (toUnit === undefined || 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, fromUnit)
|
||||
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)
|
||||
.toString(),
|
||||
.value(),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -98,8 +105,10 @@ strings.formatBalanceWithoutSuffix = (balance, fromUnit, toUnit) => {
|
|||
return balance;
|
||||
}
|
||||
if (balance !== 0) {
|
||||
if (fromUnit === BitcoinUnit.LOCAL_CURRENCY || toUnit === BitcoinUnit.LOCAL_CURRENCY) {
|
||||
BTCUnits.setFiat(BitcoinUnit.LOCAL_CURRENCY, 3600);
|
||||
if (fromUnit === BitcoinUnit.LOCAL_CURRENCY) {
|
||||
return BTCUnits(balance, BitcoinUnit.SATS)
|
||||
.to(BitcoinUnit.SATS)
|
||||
.toString();
|
||||
}
|
||||
if (toUnit === BitcoinUnit.BTC || toUnit === undefined) {
|
||||
return BTCUnits(balance, fromUnit)
|
||||
|
|
|
@ -4,7 +4,7 @@ import { ActivityIndicator, Image, View, TouchableOpacity } from 'react-native';
|
|||
import { BlueText, SafeBlueArea, BlueButton } from '../../BlueComponents';
|
||||
import Camera from 'react-native-camera';
|
||||
import Permissions from 'react-native-permissions';
|
||||
import {SegwitP2SHWallet, LegacyWallet, WatchOnlyWallet, HDLegacyP2PKHWallet} from '../../class';
|
||||
import { SegwitP2SHWallet, LegacyWallet, WatchOnlyWallet, HDLegacyP2PKHWallet } from '../../class';
|
||||
import PropTypes from 'prop-types';
|
||||
import { HDSegwitP2SHWallet } from '../../class/hd-segwit-p2sh-wallet';
|
||||
import { LightningCustodianWallet } from '../../class/lightning-custodian-wallet';
|
||||
|
|
|
@ -183,13 +183,13 @@ export default class WalletTransactions extends Component {
|
|||
walletPreviousPreferredUnit = BitcoinUnit.SATS;
|
||||
} else if (walletPreviousPreferredUnit === BitcoinUnit.LOCAL_CURRENCY) {
|
||||
wallet.preferredBalanceUnit = BitcoinUnit.BTC;
|
||||
walletPreviousPreferredUnit = BitcoinUnit.LOCAL_CURRENCY;
|
||||
walletPreviousPreferredUnit = BitcoinUnit.BTC;
|
||||
} else {
|
||||
wallet.preferredBalanceUnit = BitcoinUnit.BTC;
|
||||
walletPreviousPreferredUnit = BitcoinUnit.BTC;
|
||||
}
|
||||
|
||||
this.setState({ wallet: wallet, walletPreviousPreferredUnit: walletPreviousPreferredUnit });
|
||||
this.setState({ wallet: wallet, walletPreviousPreferredUnit: walletPreviousPreferredUnit }, () => BlueApp.saveToDisk());
|
||||
}
|
||||
|
||||
renderWalletHeader = () => {
|
||||
|
|
Loading…
Add table
Reference in a new issue