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,12 +2685,14 @@ class ChatActivity :
private fun isScrolledToBottom() = layoutManager?.findFirstVisibleItemPosition() == 0
private fun setUnreadMessageMarker(chatMessageList: List<ChatMessage>) {
val unreadChatMessage = ChatMessage()
unreadChatMessage.jsonMessageId = UNREAD_MESSAGES_MARKER_ID
unreadChatMessage.actorId = "-1"
unreadChatMessage.timestamp = chatMessageList[0].timestamp
unreadChatMessage.message = context.getString(R.string.nc_new_messages)
adapter?.addToStart(unreadChatMessage, false)
if (chatMessageList.isNotEmpty()) {
val unreadChatMessage = ChatMessage()
unreadChatMessage.jsonMessageId = UNREAD_MESSAGES_MARKER_ID
unreadChatMessage.actorId = "-1"
unreadChatMessage.timestamp = chatMessageList[0].timestamp
unreadChatMessage.message = context.getString(R.string.nc_new_messages)
adapter?.addToStart(unreadChatMessage, false)
}
}
private fun processMessagesNotFromTheFuture(chatMessageList: List<ChatMessage>) {