Skip to content

Commit ed1b95d

Browse files
fix(unread): Ensure unread button is also initially on-updates shown if needed
AI-assistant: Copilot 1.0.10 (Claude Sonnet 4.6) Signed-off-by: Andy Scherzinger <info@andy-scherzinger.de>
1 parent 37f73e1 commit ed1b95d

1 file changed

Lines changed: 14 additions & 0 deletions

File tree

app/src/main/java/com/nextcloud/talk/conversationlist/ui/ConversationList.kt

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ import androidx.compose.runtime.mutableIntStateOf
3333
import androidx.compose.runtime.remember
3434
import androidx.compose.runtime.setValue
3535
import androidx.compose.runtime.snapshotFlow
36+
import kotlinx.coroutines.flow.first
3637
import androidx.compose.ui.Alignment
3738
import androidx.compose.ui.Modifier
3839
import androidx.compose.ui.draw.clip
@@ -113,6 +114,19 @@ fun ConversationList(
113114
}
114115
}
115116

117+
// Unread-bubble: also trigger the check after entries are first loaded (or updated)
118+
LaunchedEffect(entries) {
119+
if (entries.isEmpty()) {
120+
onScrollStopped(0)
121+
return@LaunchedEffect
122+
}
123+
// Wait until the LazyColumn has measured visible items so the last-visible index is accurate.
124+
snapshotFlow { listState.layoutInfo.visibleItemsInfo }
125+
.first { it.isNotEmpty() }
126+
val lastVisible = listState.layoutInfo.visibleItemsInfo.lastOrNull()?.index ?: 0
127+
onScrollStopped(lastVisible)
128+
}
129+
116130
PullToRefreshBox(
117131
isRefreshing = isRefreshing,
118132
onRefresh = onRefresh,

0 commit comments

Comments
 (0)