mirror of
https://github.com/simplex-chat/simplex-chat.git
synced 2026-08-28 21:58:24 +00:00
fix
This commit is contained in:
@@ -2309,6 +2309,10 @@ fun <T> MutableState<SnapshotStateList<T>>.removeAt(index: Int): T {
|
||||
return res
|
||||
}
|
||||
|
||||
fun <T> MutableState<SnapshotStateList<T>>.removeRange(fromIndex: Int, toIndex: Int) {
|
||||
value = SnapshotStateList<T>().apply { addAll(value); removeRange(fromIndex, toIndex) }
|
||||
}
|
||||
|
||||
fun <T> MutableState<SnapshotStateList<T>>.removeLast() {
|
||||
value = SnapshotStateList<T>().apply { addAll(value); removeLast() }
|
||||
}
|
||||
|
||||
+1
-1
@@ -218,7 +218,7 @@ fun List<ChatSection>.dropTemporarySections() {
|
||||
if (bottomSection != null) {
|
||||
val items = chatModel.chatItems.value
|
||||
val itemsOutsideOfSection = items.size - 1 - bottomSection.boundary.maxIndex
|
||||
chatModel.chatItems.value.removeRange(fromIndex = 0, toIndex = itemsOutsideOfSection + bottomSection.excessItemCount())
|
||||
chatModel.chatItems.removeRange(fromIndex = 0, toIndex = itemsOutsideOfSection + bottomSection.excessItemCount())
|
||||
chatModel.chatItemsSectionArea = mutableMapOf<Long, ChatSectionArea>().also { it.putAll(items.associate { it.id to ChatSectionArea.Bottom }) }
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -1072,7 +1072,7 @@ fun BoxScope.ChatItemsList(
|
||||
itemsToDrop.forEach {
|
||||
chatModel.chatItemsSectionArea.remove(it.id)
|
||||
}
|
||||
chatModel.chatItems.value.removeIf { chatModel.chatItemsSectionArea[it.id] == null }
|
||||
chatModel.chatItems.removeAll { chatModel.chatItemsSectionArea[it.id] == null }
|
||||
val newIdx = reversedChatItems.value.indexOfFirst { it.id == itemId }
|
||||
listState.scrollToItem(scrollPosition.value(newIdx), -maxHeight.value)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user