avoid showing balance in fiat when exchange source is none

This commit is contained in:
Craig Raw 2023-11-29 09:32:01 +02:00
parent d8839763a4
commit e1fb674170
2 changed files with 4 additions and 3 deletions

View file

@ -6,9 +6,9 @@ import com.googlecode.lanterna.TerminalSize;
import com.googlecode.lanterna.gui2.*; import com.googlecode.lanterna.gui2.*;
import com.googlecode.lanterna.gui2.table.Table; import com.googlecode.lanterna.gui2.table.Table;
import com.googlecode.lanterna.gui2.table.TableModel; import com.googlecode.lanterna.gui2.table.TableModel;
import com.sparrowwallet.drongo.protocol.Transaction;
import com.sparrowwallet.sparrow.AppServices; import com.sparrowwallet.sparrow.AppServices;
import com.sparrowwallet.sparrow.event.*; import com.sparrowwallet.sparrow.event.*;
import com.sparrowwallet.sparrow.io.Config;
import com.sparrowwallet.sparrow.net.ExchangeSource; import com.sparrowwallet.sparrow.net.ExchangeSource;
import com.sparrowwallet.sparrow.terminal.SparrowTerminal; import com.sparrowwallet.sparrow.terminal.SparrowTerminal;
import com.sparrowwallet.sparrow.terminal.wallet.table.CoinTableCell; import com.sparrowwallet.sparrow.terminal.wallet.table.CoinTableCell;
@ -94,7 +94,7 @@ public class TransactionsDialog extends WalletDialog {
balance.setText(formatBitcoinValue(walletTransactionsEntry.getBalance(), true)); balance.setText(formatBitcoinValue(walletTransactionsEntry.getBalance(), true));
mempoolBalance.setText(formatBitcoinValue(walletTransactionsEntry.getMempoolBalance(), true)); mempoolBalance.setText(formatBitcoinValue(walletTransactionsEntry.getMempoolBalance(), true));
if(AppServices.getFiatCurrencyExchangeRate() != null) { if(AppServices.getFiatCurrencyExchangeRate() != null && Config.get().getExchangeSource() != ExchangeSource.NONE) {
fiatBalance.setText(formatFiatValue(getFiatValue(walletTransactionsEntry.getBalance(), AppServices.getFiatCurrencyExchangeRate()))); fiatBalance.setText(formatFiatValue(getFiatValue(walletTransactionsEntry.getBalance(), AppServices.getFiatCurrencyExchangeRate())));
fiatMempoolBalance.setText(formatFiatValue(getFiatValue(walletTransactionsEntry.getMempoolBalance(), AppServices.getFiatCurrencyExchangeRate()))); fiatMempoolBalance.setText(formatFiatValue(getFiatValue(walletTransactionsEntry.getMempoolBalance(), AppServices.getFiatCurrencyExchangeRate())));
} else { } else {

View file

@ -12,6 +12,7 @@ import com.sparrowwallet.drongo.wallet.*;
import com.sparrowwallet.sparrow.AppServices; import com.sparrowwallet.sparrow.AppServices;
import com.sparrowwallet.sparrow.EventManager; import com.sparrowwallet.sparrow.EventManager;
import com.sparrowwallet.sparrow.event.*; import com.sparrowwallet.sparrow.event.*;
import com.sparrowwallet.sparrow.io.Config;
import com.sparrowwallet.sparrow.net.ExchangeSource; import com.sparrowwallet.sparrow.net.ExchangeSource;
import com.sparrowwallet.sparrow.terminal.ModalDialog; import com.sparrowwallet.sparrow.terminal.ModalDialog;
import com.sparrowwallet.sparrow.terminal.SparrowTerminal; import com.sparrowwallet.sparrow.terminal.SparrowTerminal;
@ -233,7 +234,7 @@ public class UtxosDialog extends WalletDialog {
balance.setText(formatBitcoinValue(walletUtxosEntry.getBalance(), true)); balance.setText(formatBitcoinValue(walletUtxosEntry.getBalance(), true));
mempoolBalance.setText(formatBitcoinValue(walletUtxosEntry.getMempoolBalance(), true)); mempoolBalance.setText(formatBitcoinValue(walletUtxosEntry.getMempoolBalance(), true));
if(AppServices.getFiatCurrencyExchangeRate() != null) { if(AppServices.getFiatCurrencyExchangeRate() != null && Config.get().getExchangeSource() != ExchangeSource.NONE) {
fiatBalance.setText(formatFiatValue(getFiatValue(walletUtxosEntry.getBalance(), AppServices.getFiatCurrencyExchangeRate()))); fiatBalance.setText(formatFiatValue(getFiatValue(walletUtxosEntry.getBalance(), AppServices.getFiatCurrencyExchangeRate())));
fiatMempoolBalance.setText(formatFiatValue(getFiatValue(walletUtxosEntry.getMempoolBalance(), AppServices.getFiatCurrencyExchangeRate()))); fiatMempoolBalance.setText(formatFiatValue(getFiatValue(walletUtxosEntry.getMempoolBalance(), AppServices.getFiatCurrencyExchangeRate())));
} else { } else {