File tree Expand file tree Collapse file tree
app/src/main/java/com/nextcloud/talk/conversationlist/ui Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -33,6 +33,7 @@ import androidx.compose.runtime.mutableIntStateOf
3333import androidx.compose.runtime.remember
3434import androidx.compose.runtime.setValue
3535import androidx.compose.runtime.snapshotFlow
36+ import kotlinx.coroutines.flow.first
3637import androidx.compose.ui.Alignment
3738import androidx.compose.ui.Modifier
3839import 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,
You can’t perform that action at this time.
0 commit comments