mirror of
https://github.com/haveno-dex/haveno.git
synced 2024-12-22 19:49:32 +00:00
fix warning about multiple acks on payment sent
This commit is contained in:
parent
7383ece7b3
commit
1f90ef1c88
2 changed files with 10 additions and 8 deletions
|
@ -194,16 +194,17 @@ public class PendingTradesViewModel extends ActivatableWithDataModel<PendingTrad
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setMessageStateProperty(MessageState messageState) {
|
public void setMessageStatePropertyIfNotAcked(MessageState messageState) {
|
||||||
|
|
||||||
|
// skip if already acked
|
||||||
if (messageStateProperty.get() == MessageState.ACKNOWLEDGED) {
|
if (messageStateProperty.get() == MessageState.ACKNOWLEDGED) {
|
||||||
log.warn("We have already an ACKNOWLEDGED message received. " +
|
|
||||||
"We would not expect any other message after that. Received messageState={}", messageState);
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (trade != null)
|
if (trade != null) {
|
||||||
trade.getProcessModel().setPaymentSentMessageState(messageState);
|
trade.getProcessModel().setPaymentSentMessageState(messageState);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private void onMessageStateChanged(MessageState messageState) {
|
private void onMessageStateChanged(MessageState messageState) {
|
||||||
messageStateProperty.set(messageState);
|
messageStateProperty.set(messageState);
|
||||||
|
|
|
@ -22,6 +22,7 @@ import haveno.common.UserThread;
|
||||||
import haveno.common.app.DevEnv;
|
import haveno.common.app.DevEnv;
|
||||||
import haveno.common.util.Tuple4;
|
import haveno.common.util.Tuple4;
|
||||||
import haveno.core.locale.Res;
|
import haveno.core.locale.Res;
|
||||||
|
import haveno.core.network.MessageState;
|
||||||
import haveno.core.offer.Offer;
|
import haveno.core.offer.Offer;
|
||||||
import haveno.core.payment.PaymentAccount;
|
import haveno.core.payment.PaymentAccount;
|
||||||
import haveno.core.payment.PaymentAccountUtil;
|
import haveno.core.payment.PaymentAccountUtil;
|
||||||
|
@ -157,7 +158,7 @@ public class BuyerStep2View extends TradeStepView {
|
||||||
case BUYER_SAW_ARRIVED_PAYMENT_SENT_MSG:
|
case BUYER_SAW_ARRIVED_PAYMENT_SENT_MSG:
|
||||||
busyAnimation.play();
|
busyAnimation.play();
|
||||||
statusLabel.setText(Res.get("shared.sendingConfirmation"));
|
statusLabel.setText(Res.get("shared.sendingConfirmation"));
|
||||||
model.setMessageStateProperty(trade.getPaymentSentMessageState());
|
model.setMessageStatePropertyIfNotAcked(MessageState.SENT);
|
||||||
timeoutTimer = UserThread.runAfter(() -> {
|
timeoutTimer = UserThread.runAfter(() -> {
|
||||||
busyAnimation.stop();
|
busyAnimation.stop();
|
||||||
statusLabel.setText(Res.get("shared.sendingConfirmationAgain"));
|
statusLabel.setText(Res.get("shared.sendingConfirmationAgain"));
|
||||||
|
@ -166,18 +167,18 @@ public class BuyerStep2View extends TradeStepView {
|
||||||
case BUYER_STORED_IN_MAILBOX_PAYMENT_SENT_MSG:
|
case BUYER_STORED_IN_MAILBOX_PAYMENT_SENT_MSG:
|
||||||
busyAnimation.stop();
|
busyAnimation.stop();
|
||||||
statusLabel.setText(Res.get("shared.messageStoredInMailbox"));
|
statusLabel.setText(Res.get("shared.messageStoredInMailbox"));
|
||||||
model.setMessageStateProperty(trade.getPaymentSentMessageState());
|
model.setMessageStatePropertyIfNotAcked(MessageState.STORED_IN_MAILBOX);
|
||||||
break;
|
break;
|
||||||
case SELLER_RECEIVED_PAYMENT_SENT_MSG:
|
case SELLER_RECEIVED_PAYMENT_SENT_MSG:
|
||||||
busyAnimation.stop();
|
busyAnimation.stop();
|
||||||
statusLabel.setText(Res.get("shared.messageArrived"));
|
statusLabel.setText(Res.get("shared.messageArrived"));
|
||||||
model.setMessageStateProperty(trade.getPaymentSentMessageState());
|
model.setMessageStatePropertyIfNotAcked(MessageState.ARRIVED);
|
||||||
break;
|
break;
|
||||||
case BUYER_SEND_FAILED_PAYMENT_SENT_MSG:
|
case BUYER_SEND_FAILED_PAYMENT_SENT_MSG:
|
||||||
// We get a popup and the trade closed, so we dont need to show anything here
|
// We get a popup and the trade closed, so we dont need to show anything here
|
||||||
busyAnimation.stop();
|
busyAnimation.stop();
|
||||||
statusLabel.setText("");
|
statusLabel.setText("");
|
||||||
model.setMessageStateProperty(trade.getPaymentSentMessageState());
|
model.setMessageStatePropertyIfNotAcked(MessageState.FAILED);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
log.warn("Unexpected case: State={}, tradeId={} ", state.name(), trade.getId());
|
log.warn("Unexpected case: State={}, tradeId={} ", state.name(), trade.getId());
|
||||||
|
|
Loading…
Reference in a new issue