mirror of
https://gitlab.linphone.org/BC/public/linphone-android.git
synced 2026-01-17 11:28:06 +00:00
Fixed crash when loading more data in conversation
This commit is contained in:
parent
578b372335
commit
b0f5141e7d
1 changed files with 19 additions and 3 deletions
|
|
@ -453,9 +453,25 @@ class ConversationViewModel @UiThread constructor() : AbstractConversationViewMo
|
|||
|
||||
val history = chatRoom.getHistoryRangeEvents(totalItemsCount, upperBound)
|
||||
val list = getEventsListFromHistory(history, searchFilter.value.orEmpty())
|
||||
val array = arrayOf<EventLog>()
|
||||
list.toArray(array)
|
||||
addEvents(array)
|
||||
|
||||
val lastEvent = list.lastOrNull()
|
||||
val newEvent = eventsList.firstOrNull()
|
||||
if (lastEvent != null && newEvent != null && shouldWeGroupTwoEvents(
|
||||
newEvent.eventLog,
|
||||
lastEvent.eventLog
|
||||
)
|
||||
) {
|
||||
if (lastEvent.model is MessageModel) {
|
||||
lastEvent.model.groupedWithNextMessage.postValue(true)
|
||||
}
|
||||
if (newEvent.model is MessageModel) {
|
||||
newEvent.model.groupedWithPreviousMessage.postValue(true)
|
||||
}
|
||||
}
|
||||
|
||||
list.addAll(eventsList)
|
||||
eventsList = list
|
||||
events.postValue(eventsList)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue