From 2e317b134c7488954d9b5c384eb7f4895ef8804c Mon Sep 17 00:00:00 2001 From: Marcel Hibbe Date: Wed, 13 Mar 2024 11:23:05 +0100 Subject: [PATCH] use X-Chat-Last-Common-Read to fix read status Without this commit, the read status was broken as X-Chat-Last-Common-Read was not used. It was removed by https://github.com/nextcloud/talk-android/pull/3630 As a result all messages were marked as unread after waiting for 30 seconds. With this commit the X-Chat-Last-Common-Read is used again. Messages are marked as read again also after 30 seconds. Signed-off-by: Marcel Hibbe --- app/src/main/java/com/nextcloud/talk/chat/ChatActivity.kt | 8 ++++++-- 1 file changed, 6 insertions(+), 2 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 f43fec947..8e53e0edb 100644 --- a/app/src/main/java/com/nextcloud/talk/chat/ChatActivity.kt +++ b/app/src/main/java/com/nextcloud/talk/chat/ChatActivity.kt @@ -918,7 +918,11 @@ class ChatActivity : collapseSystemMessages() } - updateReadStatusOfAllMessages(chatMessageList[0].jsonMessageId) + val newXChatLastCommonRead = state.response.headers()["X-Chat-Last-Common-Read"]?.let { + Integer.parseInt(it) + } + + updateReadStatusOfAllMessages(newXChatLastCommonRead) processCallStartedMessages(chatMessageList) @@ -927,7 +931,7 @@ class ChatActivity : chatViewModel.refreshChatParams( setupFieldsForPullChatMessages( true, - chatMessageList[0].jsonMessageId, + newXChatLastCommonRead, true ) )