conversationsPaged

abstract fun conversationsPaged(pageSize: Int): Flow<Result<PagingData<Conversation>>>

Retrieves conversations available to the local participant with pagination support.

Use this method with the AndroidX Paging library to efficiently load and display large lists of conversations.

Return

A Flow emitting Result containing PagingData of conversations.

Parameters

pageSize

The maximum number of conversations per page.

Samples

val lazyPagingItems = remember {
    coreClient.conversationsPaged(pageSize = 20)
        .filterIsInstance<Result.Success<PagingData<Conversation>>>()
        .map { it.data }
}.collectAsLazyPagingItems()

LazyColumn {
    if (lazyPagingItems.loadState.refresh == LoadState.Loading) {
        item {
            Text(
                text = "Loading conversations...",
                modifier = Modifier.fillMaxWidth()
                    .wrapContentWidth(Alignment.CenterHorizontally)
            )
        }
    }

    items(count = lazyPagingItems.itemCount) { index ->
        val conversation = lazyPagingItems[index]
        Text("Conversation: $conversation", fontSize = 16.sp)
    }

    if (lazyPagingItems.loadState.append == LoadState.Loading) {
        item {
            CircularProgressIndicator(
                modifier = Modifier.fillMaxWidth()
                    .wrapContentWidth(Alignment.CenterHorizontally)
            )
        }
    }
}

abstract fun conversationsPaged(pageSize: Int, sortedByActivityDescending: Boolean = true): Flow<Result<PagingData<Conversation>>>

Retrieves conversations from the local cache sorted by latest activity with pagination support.

Results are based on locally cached data and may not reflect the real-time state of conversations if the client has not yet retrieved the latest activity from the server. The activity data used for sorting must already exist in local device storage — populate it first by calling conversations with forceRefresh = true or conversationsFlow.

Use this method with the AndroidX Paging library to efficiently load and display large lists of conversations.

Return

A Flow emitting Result containing PagingData of conversations.

Parameters

pageSize

The maximum number of conversations per page.

sortedByActivityDescending

When true, returns conversations with the most recent activity first. Default value is true.