Merge pull request #4440 from nextcloud/bugfix/noid/fixUnreadMarkerCrash

fix crash for unreadMarker
This commit is contained in:
Sowjanya Kota 2024-11-13 15:05:54 +01:00 committed by GitHub
commit 89f3d8a768
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -2685,6 +2685,7 @@ class ChatActivity :
private fun isScrolledToBottom() = layoutManager?.findFirstVisibleItemPosition() == 0
private fun setUnreadMessageMarker(chatMessageList: List<ChatMessage>) {
if (chatMessageList.isNotEmpty()) {
val unreadChatMessage = ChatMessage()
unreadChatMessage.jsonMessageId = UNREAD_MESSAGES_MARKER_ID
unreadChatMessage.actorId = "-1"
@ -2692,6 +2693,7 @@ class ChatActivity :
unreadChatMessage.message = context.getString(R.string.nc_new_messages)
adapter?.addToStart(unreadChatMessage, false)
}
}
private fun processMessagesNotFromTheFuture(chatMessageList: List<ChatMessage>) {
for (i in chatMessageList.indices) {