mirror of
https://github.com/sparrowwallet/sparrow.git
synced 2026-10-06 11:38:25 +00:00
clear the max selection and revalidate the amount when a payment uri sets the send amount
This commit is contained in:
@@ -119,14 +119,7 @@ public class PaymentController extends WalletFormController implements Initializ
|
||||
private final ChangeListener<String> amountListener = new ChangeListener<>() {
|
||||
@Override
|
||||
public void changed(ObservableValue<? extends String> observable, String oldValue, String newValue) {
|
||||
if(sendController.getUtxoSelector() instanceof MaxUtxoSelector) {
|
||||
sendController.utxoSelectorProperty().setValue(null);
|
||||
}
|
||||
|
||||
for(Tab tab : sendController.getPaymentTabs().getTabs()) {
|
||||
PaymentController controller = (PaymentController) tab.getUserData();
|
||||
controller.setSendMax(false);
|
||||
}
|
||||
clearSendMax();
|
||||
|
||||
Long recipientValueSats = getRecipientValueSats();
|
||||
if(recipientValueSats != null) {
|
||||
@@ -840,8 +833,10 @@ public class PaymentController extends WalletFormController implements Initializ
|
||||
label.setText(bitcoinURI.getLabel());
|
||||
}
|
||||
if(bitcoinURI.getAmount() != null) {
|
||||
clearSendMax();
|
||||
setRecipientValueSats(bitcoinURI.getAmount());
|
||||
setFiatAmount(AppServices.getFiatCurrencyExchangeRate(), bitcoinURI.getAmount());
|
||||
revalidateAmount();
|
||||
}
|
||||
setPayjoinURI(bitcoinURI);
|
||||
sendController.updateTransaction();
|
||||
@@ -881,6 +876,17 @@ public class PaymentController extends WalletFormController implements Initializ
|
||||
return maxButton.isSelected();
|
||||
}
|
||||
|
||||
private void clearSendMax() {
|
||||
if(sendController.getUtxoSelector() instanceof MaxUtxoSelector) {
|
||||
sendController.utxoSelectorProperty().setValue(null);
|
||||
}
|
||||
|
||||
for(Tab tab : sendController.getPaymentTabs().getTabs()) {
|
||||
PaymentController controller = (PaymentController)tab.getUserData();
|
||||
controller.setSendMax(false);
|
||||
}
|
||||
}
|
||||
|
||||
public void setSendMax(boolean sendMax) {
|
||||
maxButton.setSelected(sendMax);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user