From e4f88bef1502b58c36197f3ee79df3ae26c187a1 Mon Sep 17 00:00:00 2001 From: jmacxx <47253594+jmacxx@users.noreply.github.com> Date: Tue, 1 Jun 2021 12:38:53 -0500 Subject: [PATCH 1/2] ChatMessage show error if no ACK received --- .../java/bisq/core/support/messages/ChatMessage.java | 12 ++++++++++++ .../main/resources/i18n/displayStrings.properties | 2 ++ .../main/java/bisq/desktop/main/shared/ChatView.java | 6 ++++-- 3 files changed, 18 insertions(+), 2 deletions(-) diff --git a/core/src/main/java/bisq/core/support/messages/ChatMessage.java b/core/src/main/java/bisq/core/support/messages/ChatMessage.java index 8171caeec4a..ff457a50541 100644 --- a/core/src/main/java/bisq/core/support/messages/ChatMessage.java +++ b/core/src/main/java/bisq/core/support/messages/ChatMessage.java @@ -17,6 +17,7 @@ package bisq.core.support.messages; +import bisq.core.locale.Res; import bisq.core.support.SupportType; import bisq.core.support.dispute.Attachment; import bisq.core.support.dispute.Dispute; @@ -24,6 +25,7 @@ import bisq.network.p2p.NodeAddress; +import bisq.common.UserThread; import bisq.common.app.Version; import bisq.common.util.Utilities; @@ -297,6 +299,16 @@ public void setAcknowledged(boolean acknowledged) { notifyChangeListener(); } + // each chat message notifies the user if an ACK is not received in time + public void startAckTimer() { + UserThread.runAfter(() -> { + if (!this.getAcknowledgedProperty().get()) { + this.setArrived(false); + this.setAckError(Res.get("support.errorTimeout")); + } + }, 5, TimeUnit.SECONDS); + } + public ReadOnlyBooleanProperty acknowledgedProperty() { return acknowledgedProperty; } diff --git a/core/src/main/resources/i18n/displayStrings.properties b/core/src/main/resources/i18n/displayStrings.properties index b1c83ed06e9..67f7c29dbf1 100644 --- a/core/src/main/resources/i18n/displayStrings.properties +++ b/core/src/main/resources/i18n/displayStrings.properties @@ -1137,8 +1137,10 @@ support.closeTicket=Close ticket support.attachments=Attachments: support.savedInMailbox=Message saved in receiver's mailbox support.arrived=Message arrived at receiver +support.transient=Message is on its way to receiver support.acknowledged=Message arrival confirmed by receiver support.error=Receiver could not process message. Error: {0} +support.errorTimeout=Timed-out waiting for ACK, try again support.buyerAddress=BTC buyer address support.sellerAddress=BTC seller address support.role=Role diff --git a/desktop/src/main/java/bisq/desktop/main/shared/ChatView.java b/desktop/src/main/java/bisq/desktop/main/shared/ChatView.java index 278b6650595..344de0ae8d7 100644 --- a/desktop/src/main/java/bisq/desktop/main/shared/ChatView.java +++ b/desktop/src/main/java/bisq/desktop/main/shared/ChatView.java @@ -491,8 +491,8 @@ private void updateMsgState(ChatMessage message) { statusInfoLabel.getStyleClass().add("error-text"); } else if (message.arrivedProperty().get()) { visible = true; - icon = AwesomeIcon.OK; - text = Res.get("support.arrived"); + icon = AwesomeIcon.MAIL_REPLY; + text = Res.get("support.transient"); } else if (message.storedInMailboxProperty().get()) { visible = true; icon = AwesomeIcon.ENVELOPE; @@ -610,6 +610,8 @@ private void onSendMessage(String inputText) { inputTextArea.setDisable(true); inputTextArea.clear(); + chatMessage.startAckTimer(); + Timer timer = UserThread.runAfter(() -> { sendMsgInfoLabel.setVisible(true); sendMsgInfoLabel.setManaged(true); From e75a4ef0de8bb7ea1c6dc0c628aa4b89a51595c4 Mon Sep 17 00:00:00 2001 From: jmacxx <47253594+jmacxx@users.noreply.github.com> Date: Wed, 16 Jun 2021 08:43:14 -0500 Subject: [PATCH 2/2] Update core/src/main/resources/i18n/displayStrings.properties Co-authored-by: m52go <735155+m52go@users.noreply.github.com> --- core/src/main/resources/i18n/displayStrings.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/src/main/resources/i18n/displayStrings.properties b/core/src/main/resources/i18n/displayStrings.properties index 67f7c29dbf1..55aedceebbe 100644 --- a/core/src/main/resources/i18n/displayStrings.properties +++ b/core/src/main/resources/i18n/displayStrings.properties @@ -1140,7 +1140,7 @@ support.arrived=Message arrived at receiver support.transient=Message is on its way to receiver support.acknowledged=Message arrival confirmed by receiver support.error=Receiver could not process message. Error: {0} -support.errorTimeout=Timed-out waiting for ACK, try again +support.errorTimeout=timed out. Try sending message again. support.buyerAddress=BTC buyer address support.sellerAddress=BTC seller address support.role=Role