Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve Chat message reliability #5551

Merged
merged 2 commits into from Jun 17, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions core/src/main/java/bisq/core/support/messages/ChatMessage.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,15 @@

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;
import bisq.core.support.dispute.DisputeResult;

import bisq.network.p2p.NodeAddress;

import bisq.common.UserThread;
import bisq.common.app.Version;
import bisq.common.util.Utilities;

Expand Down Expand Up @@ -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;
}
Expand Down
2 changes: 2 additions & 0 deletions core/src/main/resources/i18n/displayStrings.properties
Original file line number Diff line number Diff line change
Expand Up @@ -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
This conversation was marked as resolved.
Show resolved Hide resolved
support.buyerAddress=BTC buyer address
support.sellerAddress=BTC seller address
support.role=Role
Expand Down
6 changes: 4 additions & 2 deletions desktop/src/main/java/bisq/desktop/main/shared/ChatView.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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);
Expand Down