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()));
|
||||
}
|
||||
|
||||
@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)
|
||||
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));
|
||||
kske marked this conversation as resolved
|
||||
}
|
||||
|
||||
@Event
|
||||
private void onUserStatusChange(UserStatusChange evt) {
|
||||
chats.getSource()
|
||||
.stream()
|
||||
.filter(c -> c.getRecipient().getID() == evt.getID())
|
||||
.findAny()
|
||||
.map(Chat::getRecipient)
|
||||
.ifPresent(u -> ((User) u).setStatus(evt.get()));
|
||||
}
|
||||
@Event(eventType = UserStatusChange.class)
|
||||
private void onUserStatusChange() { Platform.runLater(chatList::refresh); }
|
||||
|
||||
@Event
|
||||
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.