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)
|
||||
|
|
|
@ -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