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)