From 730c85811eb5a5133dbf350b41e07820ec16b2fa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim=20Kr=C3=BCger?= Date: Thu, 2 Sep 2021 11:57:27 +0200 Subject: [PATCH] Hide own conversation in "forward to" selection screen MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Resolves #1567 Signed-off-by: Tim Krüger --- .../java/com/nextcloud/talk/controllers/ChatController.kt | 1 + .../talk/controllers/ConversationsListController.java | 6 ++++++ .../main/java/com/nextcloud/talk/utils/bundle/BundleKeys.kt | 1 + 3 files changed, 8 insertions(+) diff --git a/app/src/main/java/com/nextcloud/talk/controllers/ChatController.kt b/app/src/main/java/com/nextcloud/talk/controllers/ChatController.kt index dc80c46e4..5eee74f0c 100644 --- a/app/src/main/java/com/nextcloud/talk/controllers/ChatController.kt +++ b/app/src/main/java/com/nextcloud/talk/controllers/ChatController.kt @@ -2170,6 +2170,7 @@ class ChatController(args: Bundle) : val bundle = Bundle() bundle.putBoolean(BundleKeys.KEY_FORWARD_MSG_FLAG, true) bundle.putString(BundleKeys.KEY_FORWARD_MSG_TEXT, message?.text) + bundle.putString(BundleKeys.KEY_FORWARD_HIDE_SOURCE_ROOM, roomId) getRouter().pushController( RouterTransaction.with(ConversationsListController(bundle)) .pushChangeHandler(HorizontalChangeHandler()) diff --git a/app/src/main/java/com/nextcloud/talk/controllers/ConversationsListController.java b/app/src/main/java/com/nextcloud/talk/controllers/ConversationsListController.java index fd24e0c49..62eb5611d 100644 --- a/app/src/main/java/com/nextcloud/talk/controllers/ConversationsListController.java +++ b/app/src/main/java/com/nextcloud/talk/controllers/ConversationsListController.java @@ -488,6 +488,12 @@ public class ConversationsListController extends BaseController implements Searc Conversation conversation; for (int i = 0; i < roomsOverall.getOcs().getData().size(); i++) { conversation = roomsOverall.getOcs().getData().get(i); + + if (bundle.containsKey(BundleKeys.INSTANCE.getKEY_FORWARD_HIDE_SOURCE_ROOM()) && conversation.roomId.equals(bundle.getString( + BundleKeys.INSTANCE.getKEY_FORWARD_HIDE_SOURCE_ROOM()))) { + continue; + } + if (shouldUseLastMessageLayout) { if (getActivity() != null) { ConversationItem conversationItem = new ConversationItem(conversation diff --git a/app/src/main/java/com/nextcloud/talk/utils/bundle/BundleKeys.kt b/app/src/main/java/com/nextcloud/talk/utils/bundle/BundleKeys.kt index 30518a126..ff862156b 100644 --- a/app/src/main/java/com/nextcloud/talk/utils/bundle/BundleKeys.kt +++ b/app/src/main/java/com/nextcloud/talk/utils/bundle/BundleKeys.kt @@ -70,4 +70,5 @@ object BundleKeys { val KEY_META_DATA = "KEY_META_DATA" val KEY_FORWARD_MSG_FLAG = "KEY_FORWARD_MSG_FLAG" val KEY_FORWARD_MSG_TEXT = "KEY_FORWARD_MSG_TEXT" + val KEY_FORWARD_HIDE_SOURCE_ROOM = "KEY_FORWARD_HIDE_SOURCE_ROOM" }