diff --git a/core/src/main/resources/i18n/displayStrings.properties b/core/src/main/resources/i18n/displayStrings.properties index 6b5d131672f..11b8d5b4e11 100644 --- a/core/src/main/resources/i18n/displayStrings.properties +++ b/core/src/main/resources/i18n/displayStrings.properties @@ -796,7 +796,7 @@ portfolio.pending.support.text.getHelp=If you have any problems you can try to c portfolio.pending.support.text.getHelp.arbitrator=If you have any problems you can try to contact the trade peer in the trade \ chat or ask the Bisq community at https://bisq.community. \ If your issue still isn't resolved, you can request more help from an arbitrator. -portfolio.pending.support.button.getHelp=Get support +portfolio.pending.support.button.getHelp=Open Trader Chat portfolio.pending.support.popup.info=If your issue with the trade remains unsolved, you can open a support \ ticket to request help from a mediator. If you have not received the payment, please wait until the trade period is over.\n\n\ Are you sure you want to open a support ticket? diff --git a/desktop/src/main/java/bisq/desktop/main/portfolio/pendingtrades/PendingTradesView.java b/desktop/src/main/java/bisq/desktop/main/portfolio/pendingtrades/PendingTradesView.java index 1fa685f9049..4f896caf334 100644 --- a/desktop/src/main/java/bisq/desktop/main/portfolio/pendingtrades/PendingTradesView.java +++ b/desktop/src/main/java/bisq/desktop/main/portfolio/pendingtrades/PendingTradesView.java @@ -260,6 +260,11 @@ protected void activate() { root.getChildren().add(selectedSubView); else if (root.getChildren().size() == 2) root.getChildren().set(1, selectedSubView); + + // create and register a callback so we can be notified when the subview + // wants to open the chat window + ChatCallback chatCallback = this::openChat; + selectedSubView.setChatCallback(chatCallback); } updateTableSelection(); @@ -764,5 +769,9 @@ private void update(Trade trade, JFXBadge badge) { }); return chatColumn; } -} + public interface ChatCallback { + void onOpenChat(Trade trade); + } + +} diff --git a/desktop/src/main/java/bisq/desktop/main/portfolio/pendingtrades/TradeStepInfo.java b/desktop/src/main/java/bisq/desktop/main/portfolio/pendingtrades/TradeStepInfo.java index 1b3f1f1c349..61508824984 100644 --- a/desktop/src/main/java/bisq/desktop/main/portfolio/pendingtrades/TradeStepInfo.java +++ b/desktop/src/main/java/bisq/desktop/main/portfolio/pendingtrades/TradeStepInfo.java @@ -176,7 +176,7 @@ public void setState(State state) { // orange button titledGroupBg.setText(Res.get("portfolio.pending.support.headline.halfPeriodOver")); label.setText(firstHalfOverWarnTextSupplier.get()); - button.setText(Res.get("portfolio.pending.openSupport").toUpperCase()); + button.setText(Res.get("portfolio.pending.support.button.getHelp").toUpperCase()); button.setId(null); button.getStyleClass().remove("action-button"); button.setDisable(false); diff --git a/desktop/src/main/java/bisq/desktop/main/portfolio/pendingtrades/TradeSubView.java b/desktop/src/main/java/bisq/desktop/main/portfolio/pendingtrades/TradeSubView.java index 84b6b81aa7b..8f0f9d76aee 100644 --- a/desktop/src/main/java/bisq/desktop/main/portfolio/pendingtrades/TradeSubView.java +++ b/desktop/src/main/java/bisq/desktop/main/portfolio/pendingtrades/TradeSubView.java @@ -24,6 +24,7 @@ import bisq.desktop.util.Layout; import bisq.core.locale.Res; +import bisq.core.trade.Trade; import javafx.scene.control.Label; import javafx.scene.control.Separator; @@ -56,6 +57,7 @@ public abstract class TradeSubView extends HBox { private TitledGroupBg tradeProcessTitledGroupBg; private int leftGridPaneRowIndex = 0; Subscription viewStateSubscription; + private PendingTradesView.ChatCallback chatCallback; /////////////////////////////////////////////////////////////////////////////////////////// @@ -144,6 +146,13 @@ private void createAndAddTradeStepView(Class viewClass) tradeStepView = viewClass.getDeclaredConstructor(PendingTradesViewModel.class).newInstance(model); contentPane.getChildren().setAll(tradeStepView); tradeStepView.setTradeStepInfo(tradeStepInfo); + ChatCallback chatCallback = trade -> { + // call up the chain to open chat + if (this.chatCallback != null) { + this.chatCallback.onOpenChat(trade); + } + }; + tradeStepView.setChatCallback(chatCallback); tradeStepView.activate(); } catch (Exception e) { log.error("Creating viewClass {} caused an error {}", viewClass, e.getMessage()); @@ -163,7 +172,15 @@ private void addContentPane() { HBox.setHgrow(contentPane, Priority.SOMETIMES); getChildren().add(contentPane); } -} + public interface ChatCallback { + void onOpenChat(Trade trade); + } + + public void setChatCallback(PendingTradesView.ChatCallback chatCallback) { + this.chatCallback = chatCallback; + } +} + diff --git a/desktop/src/main/java/bisq/desktop/main/portfolio/pendingtrades/steps/TradeStepView.java b/desktop/src/main/java/bisq/desktop/main/portfolio/pendingtrades/steps/TradeStepView.java index ef82e67448d..b277e58cce7 100644 --- a/desktop/src/main/java/bisq/desktop/main/portfolio/pendingtrades/steps/TradeStepView.java +++ b/desktop/src/main/java/bisq/desktop/main/portfolio/pendingtrades/steps/TradeStepView.java @@ -23,6 +23,7 @@ import bisq.desktop.main.overlays.popups.Popup; import bisq.desktop.main.portfolio.pendingtrades.PendingTradesViewModel; import bisq.desktop.main.portfolio.pendingtrades.TradeStepInfo; +import bisq.desktop.main.portfolio.pendingtrades.TradeSubView; import bisq.desktop.util.Layout; import bisq.core.locale.Res; @@ -94,6 +95,7 @@ public abstract class TradeStepView extends AnchorPane { protected Label infoLabel; private Popup acceptMediationResultPopup; private BootstrapListener bootstrapListener; + private TradeSubView.ChatCallback chatCallback; /////////////////////////////////////////////////////////////////////////////////////////// @@ -173,11 +175,11 @@ public void activate() { if (!isMediationClosedState()) { tradeStepInfo.setOnAction(e -> { - new Popup().attention(Res.get("portfolio.pending.support.popup.info")) - .actionButtonText(Res.get("portfolio.pending.support.popup.button")) - .onAction(this::openSupportTicket) - .closeButtonText(Res.get("shared.cancel")) - .show(); + if (this.isTradePeriodOver()) { + openSupportTicket(); + } else { + openChat(); + } }); } @@ -228,6 +230,13 @@ private void openSupportTicket() { model.dataModel.onOpenDispute(); } + private void openChat() { + // call up the chain to open chat + if (this.chatCallback != null) { + this.chatCallback.onOpenChat(this.trade); + } + } + public void deactivate() { if (txIdSubscription != null) txIdSubscription.unsubscribe(); @@ -500,6 +509,10 @@ private boolean isMediationClosedState() { return trade.getDisputeState() == Trade.DisputeState.MEDIATION_CLOSED; } + private boolean isTradePeriodOver() { + return Trade.TradePeriodState.TRADE_PERIOD_OVER == trade.tradePeriodStateProperty().get(); + } + private boolean hasSelfAccepted() { return trade.getProcessModel().getMediatedPayoutTxSignature() != null; } @@ -654,4 +667,8 @@ private GridPane createInfoPopover() { return infoGridPane; } + + public void setChatCallback(TradeSubView.ChatCallback chatCallback) { + this.chatCallback = chatCallback; + } }