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 ) )