mirror of
https://github.com/bisq-network/bisq.git
synced 2025-02-23 06:55:08 +01:00
Merge pull request #4099 from jmacxx/fix_getsupport_traderchat
Replace the Get Support button with Open Trader Chat until trade period is over
This commit is contained in:
commit
edc4df1826
5 changed files with 52 additions and 9 deletions
|
@ -804,7 +804,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?
|
||||
|
|
|
@ -260,6 +260,11 @@ public class PendingTradesView extends ActivatableViewAndModel<VBox, PendingTrad
|
|||
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 @@ public class PendingTradesView extends ActivatableViewAndModel<VBox, PendingTrad
|
|||
});
|
||||
return chatColumn;
|
||||
}
|
||||
}
|
||||
|
||||
public interface ChatCallback {
|
||||
void onOpenChat(Trade trade);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -176,7 +176,7 @@ public class TradeStepInfo {
|
|||
// 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);
|
||||
|
|
|
@ -24,6 +24,7 @@ import bisq.desktop.main.portfolio.pendingtrades.steps.TradeWizardItem;
|
|||
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 @@ public abstract class TradeSubView extends HBox {
|
|||
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 @@ public abstract class TradeSubView extends HBox {
|
|||
HBox.setHgrow(contentPane, Priority.SOMETIMES);
|
||||
getChildren().add(contentPane);
|
||||
}
|
||||
|
||||
|
||||
public interface ChatCallback {
|
||||
void onOpenChat(Trade trade);
|
||||
}
|
||||
|
||||
public void setChatCallback(PendingTradesView.ChatCallback chatCallback) {
|
||||
this.chatCallback = chatCallback;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -23,6 +23,7 @@ import bisq.desktop.components.TxIdTextField;
|
|||
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 abstract class TradeStepView extends AnchorPane {
|
|||
|
||||
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 @@ public abstract class TradeStepView extends AnchorPane {
|
|||
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 @@ public abstract class TradeStepView extends AnchorPane {
|
|||
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 @@ public abstract class TradeStepView extends AnchorPane {
|
|||
|
||||
return infoGridPane;
|
||||
}
|
||||
|
||||
public void setChatCallback(TradeSubView.ChatCallback chatCallback) {
|
||||
this.chatCallback = chatCallback;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue