Skip to content

Commit

Permalink
Merge pull request #4440 from nextcloud/bugfix/noid/fixUnreadMarkerCrash
Browse files Browse the repository at this point in the history
fix crash for unreadMarker
  • Loading branch information
sowjanyakch authored Nov 13, 2024
2 parents e268b77 + b766abe commit 89f3d8a
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions app/src/main/java/com/nextcloud/talk/chat/ChatActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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>) {
Expand Down

0 comments on commit 89f3d8a

Please sign in to comment.