Refactoring #55
@ -222,6 +222,11 @@ public final class LocalDB implements EventListener {
|
|||||||
this.<GroupMessage>getMessage(evt.getID()).ifPresent(msg -> msg.getMemberStatuses().replace(evt.getMemberID(), evt.get()));
|
this.<GroupMessage>getMessage(evt.getID()).ifPresent(msg -> msg.getMemberStatuses().replace(evt.getMemberID(), evt.get()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Event(priority = 150)
|
||||||
|
private void onUserStatusChange(UserStatusChange evt) {
|
||||||
|
this.getChat(evt.getID()).map(Chat::getRecipient).map(User.class::cast).ifPresent(u -> u.setStatus(evt.get()));
|
||||||
|
}
|
||||||
|
|
||||||
@Event(priority = 150)
|
@Event(priority = 150)
|
||||||
private void onGroupResize(GroupResize evt) { getChat(evt.getGroupID()).map(Chat::getRecipient).map(Group.class::cast).ifPresent(evt::apply); }
|
private void onGroupResize(GroupResize evt) { getChat(evt.getGroupID()).map(Chat::getRecipient).map(Group.class::cast).ifPresent(evt::apply); }
|
||||||
|
|
||||||
|
@ -253,15 +253,8 @@ public final class ChatScene implements EventListener, Restorable {
|
|||||||
.ifPresent(msg -> Platform.runLater(messageList::refresh));
|
.ifPresent(msg -> Platform.runLater(messageList::refresh));
|
||||||
kske marked this conversation as resolved
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Event
|
@Event(eventType = UserStatusChange.class)
|
||||||
private void onUserStatusChange(UserStatusChange evt) {
|
private void onUserStatusChange() { Platform.runLater(chatList::refresh); }
|
||||||
chats.getSource()
|
|
||||||
.stream()
|
|
||||||
.filter(c -> c.getRecipient().getID() == evt.getID())
|
|
||||||
.findAny()
|
|
||||||
.map(Chat::getRecipient)
|
|
||||||
.ifPresent(u -> ((User) u).setStatus(evt.get()));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Event
|
@Event
|
||||||
private void onContactOperation(ContactOperation operation) {
|
private void onContactOperation(ContactOperation operation) {
|
||||||
|
Reference in New Issue
Block a user
Did you test this? Is the normal refresh enough?
Yes, it is, as the
refresh
method refreshed all objects inside the list that might have changed.