From 1c8d25bc4d4231612f614a8e7ab17abb8b0bbf57 Mon Sep 17 00:00:00 2001 From: rapterjet2004 Date: Wed, 29 May 2024 07:27:26 -0500 Subject: [PATCH] fixed chat not updating Signed-off-by: rapterjet2004 --- .../com/nextcloud/talk/chat/ChatActivity.kt | 24 +++++++------------ 1 file changed, 8 insertions(+), 16 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 41a50ede0d..d978e3dc3c 100644 --- a/app/src/main/java/com/nextcloud/talk/chat/ChatActivity.kt +++ b/app/src/main/java/com/nextcloud/talk/chat/ChatActivity.kt @@ -553,14 +553,6 @@ class ChatActivity : checkShowMessageInputView() checkLobbyState() updateRoomTimerHandler() - - chatViewModel.refreshChatParams( - setupFieldsForPullChatMessages( - false, - 0, - false - ) - ) } is ChatViewModel.GetCapabilitiesInitialLoadState -> { @@ -773,15 +765,19 @@ class ChatActivity : val chatOverall = state.response.body() as ChatOverall? var chatMessageList = chatOverall?.ocs!!.data!! + val newXChatLastCommonRead = state.response.headers()["X-Chat-Last-Common-Read"]?.let { + Integer.parseInt(it) + } + processHeaderChatLastGiven(state.response, state.lookIntoFuture) chatMessageList = handleSystemMessages(chatMessageList) - if (chatMessageList.size == 0) { + if (chatMessageList.isEmpty()) { chatViewModel.refreshChatParams( setupFieldsForPullChatMessages( true, - globalLastKnownFutureMessageId, + newXChatLastCommonRead, true ) ) @@ -813,10 +809,6 @@ class ChatActivity : collapseSystemMessages() } - val newXChatLastCommonRead = state.response.headers()["X-Chat-Last-Common-Read"]?.let { - Integer.parseInt(it) - } - updateReadStatusOfAllMessages(newXChatLastCommonRead) processCallStartedMessages(chatMessageList) @@ -836,7 +828,7 @@ class ChatActivity : chatViewModel.refreshChatParams( setupFieldsForPullChatMessages( true, - globalLastKnownFutureMessageId, + globalLastKnownPastMessageId, true ) ) @@ -846,7 +838,7 @@ class ChatActivity : chatViewModel.refreshChatParams( setupFieldsForPullChatMessages( true, - globalLastKnownFutureMessageId, + globalLastKnownPastMessageId, true ) )