mirror of
https://github.com/boldsuck/haveno.git
synced 2024-12-23 04:29:22 +00:00
disable payment sent button on click
This commit is contained in:
parent
567ef6784d
commit
2b7a461411
2 changed files with 11 additions and 4 deletions
|
@ -422,11 +422,17 @@ public class BuyerStep2View extends TradeStepView {
|
||||||
HBox hBox = tuple3.fourth;
|
HBox hBox = tuple3.fourth;
|
||||||
GridPane.setColumnSpan(hBox, 2);
|
GridPane.setColumnSpan(hBox, 2);
|
||||||
confirmButton = tuple3.first;
|
confirmButton = tuple3.first;
|
||||||
|
confirmButton.setDisable(!confirmPaymentSentPermitted());
|
||||||
confirmButton.setOnAction(e -> onPaymentSent());
|
confirmButton.setOnAction(e -> onPaymentSent());
|
||||||
busyAnimation = tuple3.second;
|
busyAnimation = tuple3.second;
|
||||||
statusLabel = tuple3.third;
|
statusLabel = tuple3.third;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private boolean confirmPaymentSentPermitted() {
|
||||||
|
if (!trade.confirmPermitted()) return false;
|
||||||
|
return trade.isDepositsUnlocked() && trade.getState().ordinal() < Trade.State.BUYER_SENT_PAYMENT_SENT_MSG.ordinal();
|
||||||
|
}
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////////////////
|
||||||
// Warning
|
// Warning
|
||||||
///////////////////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
@ -454,8 +460,7 @@ public class BuyerStep2View extends TradeStepView {
|
||||||
@Override
|
@Override
|
||||||
protected void updateDisputeState(Trade.DisputeState disputeState) {
|
protected void updateDisputeState(Trade.DisputeState disputeState) {
|
||||||
super.updateDisputeState(disputeState);
|
super.updateDisputeState(disputeState);
|
||||||
|
confirmButton.setDisable(!confirmPaymentSentPermitted());
|
||||||
confirmButton.setDisable(!trade.confirmPermitted());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -596,11 +601,14 @@ public class BuyerStep2View extends TradeStepView {
|
||||||
private void confirmPaymentSent() {
|
private void confirmPaymentSent() {
|
||||||
busyAnimation.play();
|
busyAnimation.play();
|
||||||
statusLabel.setText(Res.get("shared.sendingConfirmation"));
|
statusLabel.setText(Res.get("shared.sendingConfirmation"));
|
||||||
|
confirmButton.setDisable(true);
|
||||||
|
|
||||||
model.dataModel.onPaymentSent(() -> {
|
model.dataModel.onPaymentSent(() -> {
|
||||||
}, errorMessage -> {
|
}, errorMessage -> {
|
||||||
busyAnimation.stop();
|
busyAnimation.stop();
|
||||||
new Popup().warning(Res.get("popup.warning.sendMsgFailed")).show();
|
new Popup().warning(Res.get("popup.warning.sendMsgFailed")).show();
|
||||||
|
confirmButton.setDisable(!confirmPaymentSentPermitted());
|
||||||
|
UserThread.execute(() -> statusLabel.setText("Error confirming payment sent."));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -307,7 +307,7 @@ public class SellerStep3View extends TradeStepView {
|
||||||
|
|
||||||
private boolean confirmPaymentReceivedPermitted() {
|
private boolean confirmPaymentReceivedPermitted() {
|
||||||
if (!trade.confirmPermitted()) return false;
|
if (!trade.confirmPermitted()) return false;
|
||||||
return trade.getState().ordinal() >= Trade.State.BUYER_SENT_PAYMENT_SENT_MSG.ordinal() && trade.getState().ordinal() < Trade.State.SELLER_SENT_PAYMENT_RECEIVED_MSG.ordinal(); // TODO: test that can resen with same payout tx hex if delivery failed
|
return trade.getState().ordinal() >= Trade.State.BUYER_SENT_PAYMENT_SENT_MSG.ordinal() && trade.getState().ordinal() < Trade.State.SELLER_SENT_PAYMENT_RECEIVED_MSG.ordinal();
|
||||||
}
|
}
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
@ -354,7 +354,6 @@ public class SellerStep3View extends TradeStepView {
|
||||||
@Override
|
@Override
|
||||||
protected void updateDisputeState(Trade.DisputeState disputeState) {
|
protected void updateDisputeState(Trade.DisputeState disputeState) {
|
||||||
super.updateDisputeState(disputeState);
|
super.updateDisputeState(disputeState);
|
||||||
|
|
||||||
confirmButton.setDisable(!confirmPaymentReceivedPermitted());
|
confirmButton.setDisable(!confirmPaymentReceivedPermitted());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue