From 5535bed35cd7c681c98f1be0218a0297c94009c8 Mon Sep 17 00:00:00 2001 From: Marcel Hibbe Date: Fri, 17 Jan 2025 14:09:58 +0100 Subject: [PATCH] no "unread messages" popup for invisible messages if chatMessageList is empty after handleSystemMessages it makes no sense to call the following methods. Also processMessagesFromTheFuture was executed which caused that the popup was shown. A better solution for the future should be to handle(remove) the "to-hide" system messages already in the repo or viewmodel Signed-off-by: Marcel Hibbe --- app/src/main/java/com/nextcloud/talk/chat/ChatActivity.kt | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/app/src/main/java/com/nextcloud/talk/chat/ChatActivity.kt b/app/src/main/java/com/nextcloud/talk/chat/ChatActivity.kt index 9af2aaa32..ed2ac7d4d 100644 --- a/app/src/main/java/com/nextcloud/talk/chat/ChatActivity.kt +++ b/app/src/main/java/com/nextcloud/talk/chat/ChatActivity.kt @@ -861,14 +861,15 @@ class ChatActivity : var chatMessageList = triple.third chatMessageList = handleSystemMessages(chatMessageList) + if (chatMessageList.isEmpty()) { + return@onEach + } determinePreviousMessageIds(chatMessageList) handleExpandableSystemMessages(chatMessageList) - if (chatMessageList.isNotEmpty() && - ChatMessage.SystemMessageType.CLEARED_CHAT == chatMessageList[0].systemMessageType - ) { + if (ChatMessage.SystemMessageType.CLEARED_CHAT == chatMessageList[0].systemMessageType) { adapter?.clear() adapter?.notifyDataSetChanged() }