From b5d43ab8b13b70e3bbb7cf5f297693e72f7ae674 Mon Sep 17 00:00:00 2001 From: jmacxx <47253594+jmacxx@users.noreply.github.com> Date: Thu, 22 Jul 2021 23:20:22 -0500 Subject: [PATCH] keep chatview listener open until ack, mailbox, or error --- .../core/support/messages/ChatMessage.java | 2 +- .../bisq/desktop/main/shared/ChatView.java | 21 ++++++++++--------- 2 files changed, 12 insertions(+), 11 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 8dbbd4be36..cf3af61abc 100644 --- a/core/src/main/java/bisq/core/support/messages/ChatMessage.java +++ b/core/src/main/java/bisq/core/support/messages/ChatMessage.java @@ -306,7 +306,7 @@ public final class ChatMessage extends SupportMessage { this.setArrived(false); this.setAckError(Res.get("support.errorTimeout")); } - }, 5, TimeUnit.SECONDS); + }, 60, TimeUnit.SECONDS); } public ReadOnlyBooleanProperty acknowledgedProperty() { 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 344de0ae8d..07a24889b7 100644 --- a/desktop/src/main/java/bisq/desktop/main/shared/ChatView.java +++ b/desktop/src/main/java/bisq/desktop/main/shared/ChatView.java @@ -130,7 +130,7 @@ public class ChatView extends AnchorPane { private ListChangeListener disputeDirectMessageListListener; private Subscription inputTextAreaTextSubscription; private final List tempAttachments = new ArrayList<>(); - private ChangeListener storedInMailboxPropertyListener, arrivedPropertyListener; + private ChangeListener storedInMailboxPropertyListener, acknowledgedPropertyListener; private ChangeListener sendMessageErrorPropertyListener; protected final CoinFormatter formatter; @@ -483,6 +483,10 @@ public class ChatView extends AnchorPane { visible = true; icon = AwesomeIcon.OK_SIGN; text = Res.get("support.acknowledged"); + } else if (message.storedInMailboxProperty().get()) { + visible = true; + icon = AwesomeIcon.ENVELOPE; + text = Res.get("support.savedInMailbox"); } else if (message.ackErrorProperty().get() != null) { visible = true; icon = AwesomeIcon.EXCLAMATION_SIGN; @@ -493,10 +497,6 @@ public class ChatView extends AnchorPane { visible = true; icon = AwesomeIcon.MAIL_REPLY; text = Res.get("support.transient"); - } else if (message.storedInMailboxProperty().get()) { - visible = true; - icon = AwesomeIcon.ENVELOPE; - text = Res.get("support.savedInMailbox"); } else { visible = false; log.debug("updateMsgState called but no msg state available. message={}", message); @@ -598,7 +598,7 @@ public class ChatView extends AnchorPane { private void onSendMessage(String inputText) { if (chatMessage != null) { - chatMessage.arrivedProperty().removeListener(arrivedPropertyListener); + chatMessage.acknowledgedProperty().removeListener(acknowledgedPropertyListener); chatMessage.storedInMailboxProperty().removeListener(storedInMailboxPropertyListener); chatMessage.sendMessageErrorProperty().removeListener(sendMessageErrorPropertyListener); } @@ -620,8 +620,9 @@ public class ChatView extends AnchorPane { sendMsgBusyAnimation.play(); }, 500, TimeUnit.MILLISECONDS); - arrivedPropertyListener = (observable, oldValue, newValue) -> { + acknowledgedPropertyListener = (observable, oldValue, newValue) -> { if (newValue) { + sendMsgInfoLabel.setVisible(false); hideSendMsgInfo(timer); } }; @@ -642,7 +643,7 @@ public class ChatView extends AnchorPane { } }; if (chatMessage != null) { - chatMessage.arrivedProperty().addListener(arrivedPropertyListener); + chatMessage.acknowledgedProperty().addListener(acknowledgedPropertyListener); chatMessage.storedInMailboxProperty().addListener(storedInMailboxPropertyListener); chatMessage.sendMessageErrorProperty().addListener(sendMessageErrorPropertyListener); } @@ -715,8 +716,8 @@ public class ChatView extends AnchorPane { chatMessages.removeListener(disputeDirectMessageListListener); if (chatMessage != null) { - if (arrivedPropertyListener != null) - chatMessage.arrivedProperty().removeListener(arrivedPropertyListener); + if (acknowledgedPropertyListener != null) + chatMessage.arrivedProperty().removeListener(acknowledgedPropertyListener); if (storedInMailboxPropertyListener != null) chatMessage.storedInMailboxProperty().removeListener(storedInMailboxPropertyListener); }