diff --git a/core/src/main/java/bisq/core/presentation/SupportTicketsPresentation.java b/core/src/main/java/bisq/core/presentation/SupportTicketsPresentation.java index 7dea87cb6ed..8e1764f635e 100644 --- a/core/src/main/java/bisq/core/presentation/SupportTicketsPresentation.java +++ b/core/src/main/java/bisq/core/presentation/SupportTicketsPresentation.java @@ -28,35 +28,20 @@ import javafx.beans.property.SimpleStringProperty; import javafx.beans.property.StringProperty; -import java.util.concurrent.atomic.AtomicInteger; - import lombok.Getter; public class SupportTicketsPresentation { - @Getter - private final StringProperty numOpenArbitrationTickets = new SimpleStringProperty(); - @Getter - private final BooleanProperty showOpenArbitrationTicketsNotification = new SimpleBooleanProperty(); - - @Getter - private final StringProperty numOpenMediationTickets = new SimpleStringProperty(); - @Getter - private final BooleanProperty showOpenMediationTicketsNotification = new SimpleBooleanProperty(); - - @Getter - private final StringProperty numOpenRefundTickets = new SimpleStringProperty(); - @Getter - private final BooleanProperty showOpenRefundTicketsNotification = new SimpleBooleanProperty(); - @Getter private final StringProperty numOpenSupportTickets = new SimpleStringProperty(); @Getter private final BooleanProperty showOpenSupportTicketsNotification = new SimpleBooleanProperty(); + @org.jetbrains.annotations.NotNull private final ArbitrationManager arbitrationManager; @org.jetbrains.annotations.NotNull private final MediationManager mediationManager; - private RefundManager refundManager; + @org.jetbrains.annotations.NotNull + private final RefundManager refundManager; @Inject public SupportTicketsPresentation(ArbitrationManager arbitrationManager, @@ -72,22 +57,10 @@ public SupportTicketsPresentation(ArbitrationManager arbitrationManager, } private void onChange() { - AtomicInteger openArbitrationDisputes = new AtomicInteger(arbitrationManager.getNumOpenDisputes().get()); - int arbitrationTickets = openArbitrationDisputes.get(); - numOpenArbitrationTickets.set(String.valueOf(arbitrationTickets)); - showOpenArbitrationTicketsNotification.set(arbitrationTickets > 0); - - AtomicInteger openMediationDisputes = new AtomicInteger(mediationManager.getNumOpenDisputes().get()); - int mediationTickets = openMediationDisputes.get(); - numOpenMediationTickets.set(String.valueOf(mediationTickets)); - showOpenMediationTicketsNotification.set(mediationTickets > 0); - - AtomicInteger openRefundDisputes = new AtomicInteger(refundManager.getNumOpenDisputes().get()); - int refundTickets = openRefundDisputes.get(); - numOpenRefundTickets.set(String.valueOf(refundTickets)); - showOpenRefundTicketsNotification.set(refundTickets > 0); + int supportTickets = arbitrationManager.getNumOpenDisputes().get() + + mediationManager.getNumOpenDisputes().get() + + refundManager.getNumOpenDisputes().get(); - int supportTickets = arbitrationTickets + mediationTickets + refundTickets; numOpenSupportTickets.set(String.valueOf(supportTickets)); showOpenSupportTicketsNotification.set(supportTickets > 0); } diff --git a/core/src/main/java/bisq/core/support/dispute/DisputeManager.java b/core/src/main/java/bisq/core/support/dispute/DisputeManager.java index 8c4964b3d45..ca61751a4ed 100644 --- a/core/src/main/java/bisq/core/support/dispute/DisputeManager.java +++ b/core/src/main/java/bisq/core/support/dispute/DisputeManager.java @@ -168,6 +168,10 @@ public void addAndPersistChatMessage(ChatMessage message) { protected abstract String getDisputeInfo(Dispute dispute); + protected abstract String getDisputeIntroForPeer(String disputeInfo); + + protected abstract String getDisputeIntroForDisputeCreator(String disputeInfo); + /////////////////////////////////////////////////////////////////////////////////////////// // Delegates for disputeListService @@ -365,9 +369,10 @@ public void sendOpenNewDisputeMessage(Dispute dispute, Optional storedDisputeOptional = findDispute(dispute); if (!storedDisputeOptional.isPresent() || reOpen) { String disputeInfo = getDisputeInfo(dispute); + String disputeMessage = getDisputeIntroForDisputeCreator(disputeInfo); String sysMsg = dispute.isSupportTicket() ? Res.get("support.youOpenedTicket", disputeInfo, Version.VERSION) - : Res.get("support.youOpenedDispute", disputeInfo, Version.VERSION); + : disputeMessage; String message = Res.get("support.systemMsg", sysMsg); ChatMessage chatMessage = new ChatMessage( @@ -493,9 +498,10 @@ private String sendPeerOpenedDisputeMessage(Dispute disputeFromOpener, Optional storedDisputeOptional = findDispute(dispute); if (!storedDisputeOptional.isPresent()) { String disputeInfo = getDisputeInfo(dispute); + String disputeMessage = getDisputeIntroForPeer(disputeInfo); String sysMsg = dispute.isSupportTicket() ? - Res.get("support.peerOpenedTicket", disputeInfo) - : Res.get("support.peerOpenedDispute", disputeInfo); + Res.get("support.peerOpenedTicket", disputeInfo, Version.VERSION) + : disputeMessage; ChatMessage chatMessage = new ChatMessage( getSupportType(), dispute.getTradeId(), diff --git a/core/src/main/java/bisq/core/support/dispute/arbitration/ArbitrationManager.java b/core/src/main/java/bisq/core/support/dispute/arbitration/ArbitrationManager.java index 4d2ef168436..233955cfbf2 100644 --- a/core/src/main/java/bisq/core/support/dispute/arbitration/ArbitrationManager.java +++ b/core/src/main/java/bisq/core/support/dispute/arbitration/ArbitrationManager.java @@ -51,6 +51,7 @@ import bisq.common.Timer; import bisq.common.UserThread; +import bisq.common.app.Version; import bisq.common.crypto.PubKeyRing; import org.bitcoinj.core.AddressFormatException; @@ -152,6 +153,15 @@ protected String getDisputeInfo(Dispute dispute) { return Res.get("support.initialInfo", role, role, link); } + @Override + protected String getDisputeIntroForPeer(String disputeInfo) { + return Res.get("support.peerOpenedDispute", disputeInfo, Version.VERSION); + } + + @Override + protected String getDisputeIntroForDisputeCreator(String disputeInfo) { + return Res.get("support.youOpenedDispute", disputeInfo, Version.VERSION); + } /////////////////////////////////////////////////////////////////////////////////////////// // Message handler diff --git a/core/src/main/java/bisq/core/support/dispute/mediation/MediationManager.java b/core/src/main/java/bisq/core/support/dispute/mediation/MediationManager.java index 506c881a9e6..ea6b12bd997 100644 --- a/core/src/main/java/bisq/core/support/dispute/mediation/MediationManager.java +++ b/core/src/main/java/bisq/core/support/dispute/mediation/MediationManager.java @@ -44,6 +44,7 @@ import bisq.common.Timer; import bisq.common.UserThread; +import bisq.common.app.Version; import bisq.common.crypto.PubKeyRing; import bisq.common.handlers.ErrorMessageHandler; import bisq.common.handlers.ResultHandler; @@ -140,6 +141,15 @@ protected String getDisputeInfo(Dispute dispute) { return Res.get("support.initialInfo", role, role, link); } + @Override + protected String getDisputeIntroForPeer(String disputeInfo) { + return Res.get("support.peerOpenedDisputeForMediation", disputeInfo, Version.VERSION); + } + + @Override + protected String getDisputeIntroForDisputeCreator(String disputeInfo) { + return Res.get("support.youOpenedDisputeForMediation", disputeInfo, Version.VERSION); + } /////////////////////////////////////////////////////////////////////////////////////////// // Message handler diff --git a/core/src/main/java/bisq/core/support/dispute/refund/RefundManager.java b/core/src/main/java/bisq/core/support/dispute/refund/RefundManager.java index 622306c0eb7..139832a1c16 100644 --- a/core/src/main/java/bisq/core/support/dispute/refund/RefundManager.java +++ b/core/src/main/java/bisq/core/support/dispute/refund/RefundManager.java @@ -42,6 +42,7 @@ import bisq.common.Timer; import bisq.common.UserThread; +import bisq.common.app.Version; import bisq.common.crypto.PubKeyRing; import com.google.inject.Inject; @@ -129,6 +130,15 @@ protected String getDisputeInfo(Dispute dispute) { return Res.get("support.initialInfo", role, role, link); } + @Override + protected String getDisputeIntroForPeer(String disputeInfo) { + return Res.get("support.peerOpenedDispute", disputeInfo, Version.VERSION); + } + + @Override + protected String getDisputeIntroForDisputeCreator(String disputeInfo) { + return Res.get("support.youOpenedDispute", disputeInfo, Version.VERSION); + } /////////////////////////////////////////////////////////////////////////////////////////// // Message handler diff --git a/core/src/main/resources/i18n/displayStrings.properties b/core/src/main/resources/i18n/displayStrings.properties index 8404980cbad..4da7a436608 100644 --- a/core/src/main/resources/i18n/displayStrings.properties +++ b/core/src/main/resources/i18n/displayStrings.properties @@ -152,6 +152,7 @@ shared.save=Save shared.onionAddress=Onion address shared.supportTicket=support ticket shared.dispute=dispute +shared.mediationCase=mediation case shared.seller=seller shared.buyer=buyer shared.allEuroCountries=All Euro countries @@ -994,8 +995,10 @@ You can read more about the dispute process at: {2} support.systemMsg=System message: {0} support.youOpenedTicket=You opened a request for support.\n\n{0}\n\nBisq version: {1} support.youOpenedDispute=You opened a request for a dispute.\n\n{0}\n\nBisq version: {1} -support.peerOpenedTicket=Your trading peer has requested support due to technical problems.\n\n{0} -support.peerOpenedDispute=Your trading peer has requested a dispute.\n\n{0} +support.youOpenedDisputeForMediation=You asked for mediation.\n\n{0}\n\nBisq version: {1} +support.peerOpenedTicket=Your trading peer has requested support due to technical problems.\n\n{0}\n\nBisq version: {1} +support.peerOpenedDispute=Your trading peer has requested a dispute.\n\n{0}\n\nBisq version: {1} +support.peerOpenedDisputeForMediation=Your trading peer has asked for mediation.\n\n{0}\n\nBisq version: {1} support.mediatorsDisputeSummary=System message:\nMediator''s dispute summary:\n{0} support.mediatorsAddress=Mediator''s node address: {0} diff --git a/desktop/src/main/java/bisq/desktop/main/overlays/notifications/NotificationCenter.java b/desktop/src/main/java/bisq/desktop/main/overlays/notifications/NotificationCenter.java index 24f04b304e3..01bb8b768e9 100644 --- a/desktop/src/main/java/bisq/desktop/main/overlays/notifications/NotificationCenter.java +++ b/desktop/src/main/java/bisq/desktop/main/overlays/notifications/NotificationCenter.java @@ -23,8 +23,8 @@ import bisq.desktop.main.portfolio.pendingtrades.PendingTradesView; import bisq.desktop.main.support.SupportView; import bisq.desktop.main.support.dispute.client.DisputeClientView; -import bisq.desktop.main.support.dispute.client.arbitration.ArbitrationClientView; import bisq.desktop.main.support.dispute.client.mediation.MediationClientView; +import bisq.desktop.main.support.dispute.client.refund.RefundClientView; import bisq.core.locale.Res; import bisq.core.support.dispute.mediation.MediationManager; @@ -254,11 +254,10 @@ private void onDisputeStateChanged(Trade trade, Trade.DisputeState disputeState) if (message != null) { goToSupport(trade, message, false); } - } - if (mediationManager.findOwnDispute(trade.getId()).isPresent()) { + } else if (mediationManager.findOwnDispute(trade.getId()).isPresent()) { String disputeOrTicket = mediationManager.findOwnDispute(trade.getId()).get().isSupportTicket() ? Res.get("shared.supportTicket") : - Res.get("shared.dispute"); + Res.get("shared.mediationCase"); switch (disputeState) { // TODO case MEDIATION_REQUESTED: @@ -286,7 +285,7 @@ private void goToSupport(Trade trade, String message, boolean isMediation) { Notification notification = new Notification().disputeHeadLine(trade.getShortId()).message(message); Class viewClass = isMediation ? MediationClientView.class : - ArbitrationClientView.class; + RefundClientView.class; if (navigation.getCurrentPath() != null && !navigation.getCurrentPath().contains(viewClass)) { notification.actionButtonTextWithGoTo("navigation.support") .onAction(() -> navigation.navigateTo(MainView.class, SupportView.class, viewClass))