mirror of
https://gitlab.linphone.org/BC/public/linphone-android.git
synced 2026-01-17 11:28:06 +00:00
When scrolling to first unread message of many, remove 1 from counter
This commit is contained in:
parent
00d14feded
commit
349167868f
2 changed files with 15 additions and 2 deletions
|
|
@ -971,6 +971,10 @@ open class ConversationFragment : SlidingPaneChildFragment() {
|
|||
viewModel.isUserScrollingUp.value = !bottomReached
|
||||
if (bottomReached) {
|
||||
viewModel.markAsRead()
|
||||
} else {
|
||||
val firstUnread = adapter.currentList[firstUnreadMessagePosition]
|
||||
(firstUnread.model as MessageModel).isRead = true
|
||||
viewModel.markFirstUnreadMessageAsRead()
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -178,9 +178,8 @@ class ConversationViewModel @UiThread constructor() : AbstractConversationViewMo
|
|||
Log.i("$TAG Received [${eventLogs.size}] new message(s)")
|
||||
computeComposingLabel()
|
||||
|
||||
addEvents(eventLogs)
|
||||
|
||||
unreadMessagesCount.postValue(chatRoom.unreadMessagesCount)
|
||||
addEvents(eventLogs)
|
||||
}
|
||||
|
||||
@WorkerThread
|
||||
|
|
@ -410,6 +409,16 @@ class ConversationViewModel @UiThread constructor() : AbstractConversationViewMo
|
|||
}
|
||||
}
|
||||
|
||||
@UiThread
|
||||
fun markFirstUnreadMessageAsRead() {
|
||||
// As we can't mark a single message as read in our SDK, small workaround
|
||||
// TODO FIXME: when SDK will support chatMessage.markAsRead(), use it
|
||||
val unreadCount = unreadMessagesCount.value ?: 0
|
||||
if (unreadCount > 1) {
|
||||
unreadMessagesCount.value = unreadCount - 1
|
||||
}
|
||||
}
|
||||
|
||||
@UiThread
|
||||
fun applyFilter() {
|
||||
coreContext.postOnCoreThread {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue