PendingMessagesPagingSource

internal class PendingMessagesPagingSource<RowType : Any>(totalCountQuery: Query<Long>, pendingCountQuery: Query<Long>, context: CoroutineContext, pendingQueryProvider: (limit: Long, offset: Long) -> Query<RowType>, nonPendingQueryProvider: (limit: Long, offset: Long) -> Query<RowType>, initialOffset: Long = 0, postProcessor: suspend (List<RowType>) -> List<RowType>? = null) : PagingSource<Int, RowType> , Query.Listener

Paging source for conversation messages where pending messages must be exposed as a dedicated leading segment.

This is used by the conversation message pager because the chat UI uses reverseLayout = true: emitting pending messages first in data order renders them at the visual bottom of the chat, close to the composer. A regular single-query paging source cannot keep efficient pending and non-pending SQL queries while also translating Paging's global offsets across that boundary.

Constructors

Link copied to clipboard
constructor(totalCountQuery: Query<Long>, pendingCountQuery: Query<Long>, context: CoroutineContext, pendingQueryProvider: (limit: Long, offset: Long) -> Query<RowType>, nonPendingQueryProvider: (limit: Long, offset: Long) -> Query<RowType>, initialOffset: Long = 0, postProcessor: suspend (List<RowType>) -> List<RowType>? = null)

Properties

Link copied to clipboard
val invalid: Boolean
Link copied to clipboard
@get:VisibleForTesting
internal val invalidateCallbackCount: Int
Link copied to clipboard
open override val jumpingSupported: Boolean
Link copied to clipboard
open val keyReuseSupported: Boolean

Functions

Link copied to clipboard
open override fun getRefreshKey(state: PagingState<Int, RowType>): Int?
Link copied to clipboard
Link copied to clipboard
open suspend override fun load(params: PagingSource.LoadParams<Int>): PagingSource.LoadResult<Int, RowType>
Link copied to clipboard
open override fun queryResultsChanged()
Link copied to clipboard
fun registerInvalidatedCallback(onInvalidatedCallback: () -> Unit)
Link copied to clipboard
fun unregisterInvalidatedCallback(onInvalidatedCallback: () -> Unit)