mirror of
https://github.com/simplex-chat/simplex-chat.git
synced 2026-05-25 16:24:27 +00:00
refactor
This commit is contained in:
+2
-2
@@ -249,8 +249,8 @@ fun List<ChatSection>.dropTemporarySections() {
|
||||
}
|
||||
}
|
||||
|
||||
fun ChatSection.excessItemCount(): Int {
|
||||
return max(boundary.maxIndex.minus(boundary.minIndex) + 1 - MAX_SECTION_SIZE, 0)
|
||||
private fun ChatSection.excessItemCount(): Int {
|
||||
return max(boundary.maxIndex - boundary.minIndex + 1 - MAX_SECTION_SIZE, 0)
|
||||
}
|
||||
|
||||
fun landingSectionToArea(chatLandingSection: ChatLandingSection) = when (chatLandingSection) {
|
||||
|
||||
+6
-8
@@ -1066,15 +1066,13 @@ fun BoxScope.ChatItemsList(
|
||||
scope.launch {
|
||||
if (idx != null) {
|
||||
listState.animateScrollToItem(scrollPosition.value(idx), -maxHeight.value)
|
||||
withContext(Dispatchers.Main) {
|
||||
if (!itemsToDrop.isNullOrEmpty()) {
|
||||
itemsToDrop.forEach {
|
||||
chatModel.chatItemsSectionArea.remove(it.id)
|
||||
}
|
||||
chatModel.chatItems.removeAll { chatModel.chatItemsSectionArea[it.id] == null }
|
||||
val newIdx = reversedChatItems.value.indexOfFirst { it.id == itemId }
|
||||
listState.scrollToItem(scrollPosition.value(newIdx), -maxHeight.value)
|
||||
if (!itemsToDrop.isNullOrEmpty()) {
|
||||
itemsToDrop.forEach {
|
||||
chatModel.chatItemsSectionArea.remove(it.id)
|
||||
}
|
||||
chatModel.chatItems.removeAll { chatModel.chatItemsSectionArea[it.id] == null }
|
||||
val newIdx = reversedChatItems.value.indexOfFirst { it.id == itemId }
|
||||
listState.scrollToItem(scrollPosition.value(newIdx), -maxHeight.value)
|
||||
}
|
||||
}
|
||||
preloadItemsEnabled.value = true
|
||||
|
||||
Reference in New Issue
Block a user