From a03941817e2519240312933783be33d1ab760364 Mon Sep 17 00:00:00 2001 From: woodser Date: Sat, 1 Apr 2023 21:35:58 -0400 Subject: [PATCH] update buyer seller step view even if error --- .../steps/buyer/BuyerStep2View.java | 69 ++++++++---------- .../steps/seller/SellerStep3View.java | 73 +++++++++---------- 2 files changed, 66 insertions(+), 76 deletions(-) diff --git a/desktop/src/main/java/haveno/desktop/main/portfolio/pendingtrades/steps/buyer/BuyerStep2View.java b/desktop/src/main/java/haveno/desktop/main/portfolio/pendingtrades/steps/buyer/BuyerStep2View.java index f858b80a..298974c6 100644 --- a/desktop/src/main/java/haveno/desktop/main/portfolio/pendingtrades/steps/buyer/BuyerStep2View.java +++ b/desktop/src/main/java/haveno/desktop/main/portfolio/pendingtrades/steps/buyer/BuyerStep2View.java @@ -150,46 +150,41 @@ public class BuyerStep2View extends TradeStepView { if (trade.isDepositsUnlocked() && !trade.isPaymentSent()) { showPopup(); } else if (state.ordinal() <= Trade.State.BUYER_SEND_FAILED_PAYMENT_SENT_MSG.ordinal()) { - if (!trade.hasFailed()) { - switch (state) { - case BUYER_CONFIRMED_IN_UI_PAYMENT_SENT: - busyAnimation.play(); - statusLabel.setText(Res.get("shared.preparingConfirmation")); - break; - case BUYER_SENT_PAYMENT_SENT_MSG: - busyAnimation.play(); - statusLabel.setText(Res.get("shared.sendingConfirmation")); - model.setMessageStateProperty(MessageState.SENT); - timeoutTimer = UserThread.runAfter(() -> { - busyAnimation.stop(); - statusLabel.setText(Res.get("shared.sendingConfirmationAgain")); - }, 10); - break; - case BUYER_SAW_ARRIVED_PAYMENT_SENT_MSG: - busyAnimation.stop(); - statusLabel.setText(Res.get("shared.messageArrived")); - model.setMessageStateProperty(MessageState.ARRIVED); - break; - case BUYER_STORED_IN_MAILBOX_PAYMENT_SENT_MSG: - busyAnimation.stop(); - statusLabel.setText(Res.get("shared.messageStoredInMailbox")); - model.setMessageStateProperty(MessageState.STORED_IN_MAILBOX); - break; - case BUYER_SEND_FAILED_PAYMENT_SENT_MSG: - // We get a popup and the trade closed, so we dont need to show anything here - busyAnimation.stop(); - statusLabel.setText(""); - model.setMessageStateProperty(MessageState.FAILED); - break; - default: - log.warn("Unexpected case: State={}, tradeId={} ", state.name(), trade.getId()); + switch (state) { + case BUYER_CONFIRMED_IN_UI_PAYMENT_SENT: + busyAnimation.play(); + statusLabel.setText(Res.get("shared.preparingConfirmation")); + break; + case BUYER_SENT_PAYMENT_SENT_MSG: + busyAnimation.play(); + statusLabel.setText(Res.get("shared.sendingConfirmation")); + model.setMessageStateProperty(MessageState.SENT); + timeoutTimer = UserThread.runAfter(() -> { busyAnimation.stop(); statusLabel.setText(Res.get("shared.sendingConfirmationAgain")); - break; - } - } else { - log.warn("Trade contains error message {}", trade.getErrorMessage()); + }, 10); + break; + case BUYER_SAW_ARRIVED_PAYMENT_SENT_MSG: + busyAnimation.stop(); + statusLabel.setText(Res.get("shared.messageArrived")); + model.setMessageStateProperty(MessageState.ARRIVED); + break; + case BUYER_STORED_IN_MAILBOX_PAYMENT_SENT_MSG: + busyAnimation.stop(); + statusLabel.setText(Res.get("shared.messageStoredInMailbox")); + model.setMessageStateProperty(MessageState.STORED_IN_MAILBOX); + break; + case BUYER_SEND_FAILED_PAYMENT_SENT_MSG: + // We get a popup and the trade closed, so we dont need to show anything here + busyAnimation.stop(); statusLabel.setText(""); + model.setMessageStateProperty(MessageState.FAILED); + break; + default: + log.warn("Unexpected case: State={}, tradeId={} ", state.name(), trade.getId()); + busyAnimation.stop(); + statusLabel.setText(Res.get("shared.sendingConfirmationAgain")); + break; } } }); diff --git a/desktop/src/main/java/haveno/desktop/main/portfolio/pendingtrades/steps/seller/SellerStep3View.java b/desktop/src/main/java/haveno/desktop/main/portfolio/pendingtrades/steps/seller/SellerStep3View.java index 7a8ec664..5229aacb 100644 --- a/desktop/src/main/java/haveno/desktop/main/portfolio/pendingtrades/steps/seller/SellerStep3View.java +++ b/desktop/src/main/java/haveno/desktop/main/portfolio/pendingtrades/steps/seller/SellerStep3View.java @@ -114,48 +114,43 @@ public class SellerStep3View extends TradeStepView { if (trade.isPaymentSent() && !trade.isPaymentReceived()) { showPopup(); } else if (trade.isPaymentReceived()) { - if (!trade.hasFailed()) { - switch (state) { - case SELLER_CONFIRMED_IN_UI_PAYMENT_RECEIPT: - busyAnimation.play(); - statusLabel.setText(Res.get("shared.preparingConfirmation")); - break; - case SELLER_SENT_PAYMENT_RECEIVED_MSG: - busyAnimation.play(); - statusLabel.setText(Res.get("shared.sendingConfirmation")); + switch (state) { + case SELLER_CONFIRMED_IN_UI_PAYMENT_RECEIPT: + busyAnimation.play(); + statusLabel.setText(Res.get("shared.preparingConfirmation")); + break; + case SELLER_SENT_PAYMENT_RECEIVED_MSG: + busyAnimation.play(); + statusLabel.setText(Res.get("shared.sendingConfirmation")); - timeoutTimer = UserThread.runAfter(() -> { - busyAnimation.stop(); - statusLabel.setText(Res.get("shared.sendingConfirmationAgain")); - }, 10); - break; - case SELLER_SAW_ARRIVED_PAYMENT_RECEIVED_MSG: - busyAnimation.stop(); - statusLabel.setText(Res.get("shared.messageArrived")); - break; - case SELLER_STORED_IN_MAILBOX_PAYMENT_RECEIVED_MSG: - busyAnimation.stop(); - statusLabel.setText(Res.get("shared.messageStoredInMailbox")); - break; - case SELLER_SEND_FAILED_PAYMENT_RECEIVED_MSG: - // We get a popup and the trade closed, so we dont need to show anything here - busyAnimation.stop(); - statusLabel.setText(""); - break; - case TRADE_COMPLETED: - if (!trade.isPayoutPublished()) log.warn("Payout is expected to be published for {} {} state {}", trade.getClass().getSimpleName(), trade.getId(), trade.getState()); - busyAnimation.stop(); - statusLabel.setText(""); - break; - default: - log.warn("Unexpected case: State={}, tradeId={} " + state.name(), trade.getId()); + timeoutTimer = UserThread.runAfter(() -> { busyAnimation.stop(); statusLabel.setText(Res.get("shared.sendingConfirmationAgain")); - break; - } - } else { - log.warn("Trade contains error message {}", trade.getErrorMessage()); - statusLabel.setText(""); + }, 10); + break; + case SELLER_SAW_ARRIVED_PAYMENT_RECEIVED_MSG: + busyAnimation.stop(); + statusLabel.setText(Res.get("shared.messageArrived")); + break; + case SELLER_STORED_IN_MAILBOX_PAYMENT_RECEIVED_MSG: + busyAnimation.stop(); + statusLabel.setText(Res.get("shared.messageStoredInMailbox")); + break; + case SELLER_SEND_FAILED_PAYMENT_RECEIVED_MSG: + // We get a popup and the trade closed, so we dont need to show anything here + busyAnimation.stop(); + statusLabel.setText(""); + break; + case TRADE_COMPLETED: + if (!trade.isPayoutPublished()) log.warn("Payout is expected to be published for {} {} state {}", trade.getClass().getSimpleName(), trade.getId(), trade.getState()); + busyAnimation.stop(); + statusLabel.setText(""); + break; + default: + log.warn("Unexpected case: State={}, tradeId={} " + state.name(), trade.getId()); + busyAnimation.stop(); + statusLabel.setText(Res.get("shared.sendingConfirmationAgain")); + break; } } });