mirror of
https://github.com/retoaccess1/haveno-reto.git
synced 2024-12-11 20:33:32 +01:00
fix chat message listeners by returning source observable list (#830)
This commit is contained in:
parent
317aa2e72f
commit
3c7841ae28
@ -394,6 +394,7 @@ public abstract class Trade implements Tradable, Model {
|
||||
@Setter
|
||||
@Nullable
|
||||
private String counterCurrencyTxId;
|
||||
@Getter
|
||||
private final ObservableList<ChatMessage> chatMessages = FXCollections.observableArrayList();
|
||||
|
||||
// Transient
|
||||
@ -1666,12 +1667,6 @@ public abstract class Trade implements Tradable, Model {
|
||||
throw new IllegalArgumentException("Trade is not buyer, seller, or arbitrator");
|
||||
}
|
||||
|
||||
public ObservableList<ChatMessage> getChatMessages() {
|
||||
synchronized (chatMessages) {
|
||||
return FXCollections.observableArrayList(chatMessages);
|
||||
}
|
||||
}
|
||||
|
||||
public MessageState getPaymentSentMessageState() {
|
||||
if (isPaymentReceived()) return MessageState.ACKNOWLEDGED;
|
||||
if (processModel.getPaymentSentMessageStateProperty().get() == MessageState.ACKNOWLEDGED) return MessageState.ACKNOWLEDGED;
|
||||
|
@ -416,11 +416,13 @@ public class PendingTradesView extends ActivatableViewAndModel<VBox, PendingTrad
|
||||
private void updateNewChatMessagesByTradeMap() {
|
||||
model.dataModel.list.forEach(t -> {
|
||||
Trade trade = t.getTrade();
|
||||
newChatMessagesByTradeMap.put(trade.getId(),
|
||||
trade.getChatMessages().stream()
|
||||
.filter(m -> !m.isWasDisplayed())
|
||||
.filter(m -> !m.isSystemMessage())
|
||||
.count());
|
||||
synchronized (trade.getChatMessages()) {
|
||||
newChatMessagesByTradeMap.put(trade.getId(),
|
||||
trade.getChatMessages().stream()
|
||||
.filter(m -> !m.isWasDisplayed())
|
||||
.filter(m -> !m.isSystemMessage())
|
||||
.count());
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -439,7 +439,7 @@ public class ChatView extends AnchorPane {
|
||||
copyIcon.getStyleClass().addAll("icon", "copy-icon-disputes");
|
||||
|
||||
// TODO There are still some cell rendering issues on updates
|
||||
setGraphic(messageAnchorPane);
|
||||
UserThread.execute(() -> setGraphic(messageAnchorPane));
|
||||
} else {
|
||||
if (sendMsgBusyAnimation != null && sendMsgBusyAnimationListener != null)
|
||||
sendMsgBusyAnimation.isRunningProperty().removeListener(sendMsgBusyAnimationListener);
|
||||
@ -448,7 +448,7 @@ public class ChatView extends AnchorPane {
|
||||
|
||||
copyIcon.setOnMouseClicked(null);
|
||||
messageLabel.setOnMouseClicked(null);
|
||||
setGraphic(null);
|
||||
UserThread.execute(() -> setGraphic(null));
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user