fix: instant refresh for hide amounts toggle

This commit is contained in:
Kyle 🐆 2025-10-18 09:27:21 -04:00 committed by Kyle Santiago
parent 2220769b03
commit 4bd622bcfc
4 changed files with 18 additions and 0 deletions

View file

@ -572,6 +572,9 @@ public class TransactionDiagram extends GridPane {
} }
String getSatsValue(long amount) { String getSatsValue(long amount) {
if(Config.get().isHideAmounts()) {
return "*****";
}
UnitFormat format = Config.get().getUnitFormat() == null ? UnitFormat.DOT : Config.get().getUnitFormat(); UnitFormat format = Config.get().getUnitFormat() == null ? UnitFormat.DOT : Config.get().getUnitFormat();
return format.formatSatsValue(amount); return format.formatSatsValue(amount);
} }

View file

@ -48,6 +48,10 @@ public class NewWalletTransactionsEvent {
} }
public String getValueAsText(long value) { public String getValueAsText(long value) {
if(Config.get().isHideAmounts()) {
return "*****";
}
UnitFormat format = Config.get().getUnitFormat(); UnitFormat format = Config.get().getUnitFormat();
if(format == null) { if(format == null) {
format = UnitFormat.DOT; format = UnitFormat.DOT;

View file

@ -405,6 +405,7 @@ public class PaymentController extends WalletFormController implements Initializ
DecimalFormat df = new DecimalFormat("#.#", unitFormat.getDecimalFormatSymbols()); DecimalFormat df = new DecimalFormat("#.#", unitFormat.getDecimalFormatSymbols());
df.setMaximumFractionDigits(8); df.setMaximumFractionDigits(8);
amount.setText(df.format(newValue.getValue(value))); amount.setText(df.format(newValue.getValue(value)));
setFiatAmount(AppServices.getFiatCurrencyExchangeRate(), value);
} }
}); });
@ -923,6 +924,11 @@ public class PaymentController extends WalletFormController implements Initializ
updateOpenWallets(event.getWallets()); updateOpenWallets(event.getWallets());
} }
@Subscribe
public void hideAmountsStatusChanged(HideAmountsStatusEvent event) {
fiatAmount.refresh(Config.get().getUnitFormat());
}
private static class DnsPaymentService extends Service<Optional<DnsPayment>> { private static class DnsPaymentService extends Service<Optional<DnsPayment>> {
private final String hrn; private final String hrn;

View file

@ -1635,6 +1635,11 @@ public class SendController extends WalletFormController implements Initializabl
} }
} }
@Subscribe
public void hideAmountsStatusChanged(HideAmountsStatusEvent event) {
updateTransaction();
}
private class PrivacyAnalysisTooltip extends VBox { private class PrivacyAnalysisTooltip extends VBox {
private final List<Label> analysisLabels = new ArrayList<>(); private final List<Label> analysisLabels = new ArrayList<>();