mirror of
https://github.com/simplex-chat/simplex-chat.git
synced 2026-04-26 17:27:57 +00:00
fix dropTemporarySections
This commit is contained in:
@@ -220,10 +220,9 @@ fun List<ChatSection>.revealedItemCount(): Int {
|
||||
fun List<ChatSection>.dropTemporarySections() {
|
||||
val bottomSection = this.find { it.boundary.area == ChatSectionArea.Bottom }
|
||||
if (bottomSection != null) {
|
||||
val items = chatModel.chatItems.value
|
||||
val itemsOutsideOfSection = items.size - 1 - bottomSection.boundary.maxIndex
|
||||
val itemsOutsideOfSection = chatModel.chatItems.value.size - 1 - bottomSection.boundary.maxIndex
|
||||
chatModel.chatItems.removeRange(fromIndex = 0, toIndex = itemsOutsideOfSection + bottomSection.excessItemCount())
|
||||
chatModel.chatItemsSectionArea = mutableMapOf<Long, ChatSectionArea>().also { it.putAll(items.associate { it.id to ChatSectionArea.Bottom }) }
|
||||
chatModel.chatItemsSectionArea = mutableMapOf<Long, ChatSectionArea>().also { it.putAll(chatModel.chatItems.value.associate { it.id to ChatSectionArea.Bottom }) }
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user