From d875fc99f4bb7c7f678d1f265360b67109f069e4 Mon Sep 17 00:00:00 2001 From: Diogo Date: Fri, 1 Nov 2024 15:03:57 +0000 Subject: [PATCH] revealedItemCount while loop --- .../kotlin/chat/simplex/common/views/chat/ChatSections.kt | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/apps/multiplatform/common/src/commonMain/kotlin/chat/simplex/common/views/chat/ChatSections.kt b/apps/multiplatform/common/src/commonMain/kotlin/chat/simplex/common/views/chat/ChatSections.kt index 5590363b36..5e9bcf5dca 100644 --- a/apps/multiplatform/common/src/commonMain/kotlin/chat/simplex/common/views/chat/ChatSections.kt +++ b/apps/multiplatform/common/src/commonMain/kotlin/chat/simplex/common/views/chat/ChatSections.kt @@ -221,12 +221,15 @@ fun List.chatItemPosition(chatItemId: Long): Int? { fun List.revealedItemCount(): Int { var count = 0 for (section in this) { - for (item in section.items) { + var i = 0; + while (i < section.items.size) { + val item = section.items[i] if (item.revealed) { count += item.items.size } else { count++ } + i++ } }