mirror of
https://gitlab.linphone.org/BC/public/linphone-android.git
synced 2026-01-17 11:28:06 +00:00
Update isRead flag in message model when chat room is marked as read
This commit is contained in:
parent
a00409e003
commit
c5e7b4c8a2
2 changed files with 14 additions and 3 deletions
|
|
@ -176,10 +176,9 @@ class MessageModel @WorkerThread constructor(
|
|||
downloadingFileModel = null
|
||||
}
|
||||
computeContentsList()
|
||||
} else if (messageState == ChatMessage.State.Displayed) {
|
||||
Log.i("$TAG Message was marked as read")
|
||||
isRead = true
|
||||
}
|
||||
|
||||
isRead = chatMessage.isRead
|
||||
}
|
||||
|
||||
@WorkerThread
|
||||
|
|
|
|||
|
|
@ -120,6 +120,18 @@ class ConversationViewModel @UiThread constructor() : ViewModel() {
|
|||
@WorkerThread
|
||||
override fun onChatRoomRead(chatRoom: ChatRoom) {
|
||||
unreadMessagesCount.postValue(0)
|
||||
|
||||
// Make sure message models are aware that they were read,
|
||||
// required for scroll to bottom or first unread message behaves as expected
|
||||
for (eventLog in events.value.orEmpty().reversed()) {
|
||||
if (eventLog.model is MessageModel) {
|
||||
if (!eventLog.model.isRead) {
|
||||
eventLog.model.isRead = true
|
||||
} else {
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
Log.i("$TAG Conversation was marked as read")
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue