From d03bbb6f5ef21d7b4d258793abe0ac1e53d915ee Mon Sep 17 00:00:00 2001 From: CyB3RC0nN0R Date: Tue, 9 Jun 2020 14:21:11 +0200 Subject: [PATCH] Implemented contact removal operation (untested) --- src/main/java/envoy/client/ui/controller/ChatScene.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/main/java/envoy/client/ui/controller/ChatScene.java b/src/main/java/envoy/client/ui/controller/ChatScene.java index ec00b2c..7074774 100644 --- a/src/main/java/envoy/client/ui/controller/ChatScene.java +++ b/src/main/java/envoy/client/ui/controller/ChatScene.java @@ -109,10 +109,12 @@ public final class ChatScene { case ADD: localDB.getUsers().put(contact.getName(), contact); localDB.getChats().add(new Chat(contact)); - userList.getItems().add(contact);// TODO might cause contact duplication + userList.getItems().add(contact); break; case REMOVE: - // TODO add deletion capability + localDB.getUsers().remove(contact.getName()); + localDB.getChats().removeIf(c -> c.getRecipient().getID() == contact.getID()); + userList.getItems().removeIf(c -> c.getID() == contact.getID()); break; } });