File tree Expand file tree Collapse file tree 2 files changed +24
-4
lines changed
data/common/src/main/kotlin/com/edricchan/studybuddy/domain/common/paging
features/tasks/domain/src/main/kotlin/com/edricchan/studybuddy/features/tasks/domain/repo Expand file tree Collapse file tree 2 files changed +24
-4
lines changed Original file line number Diff line number Diff line change 1+ package com.edricchan.studybuddy.domain.common.paging
2+
3+ import com.edricchan.studybuddy.domain.common.sorting.OrderSpec
4+ import kotlinx.coroutines.CoroutineScope
5+
6+ /* *
7+ * Interface holding shared pagination options.
8+ * @param OS Desired subclass [OrderSpec] generic for [orderByFields].
9+ */
10+ interface CommonPagingConfig <OS : OrderSpec <* >> {
11+ /* * Desired [CoroutineScope] to cache the paging data in (see [androidx.paging.cachedIn] for more info). */
12+ val cachedCoroutineScope: CoroutineScope
13+
14+ /* * Number of items to be shown per page. */
15+ val pageSize: Int
16+
17+ /* * The set of [OS] configurations to order the resulting data by, */
18+ val orderByFields: Set <OS >
19+ }
Original file line number Diff line number Diff line change 11package com.edricchan.studybuddy.features.tasks.domain.repo
22
3+ import com.edricchan.studybuddy.domain.common.paging.CommonPagingConfig
34import com.edricchan.studybuddy.domain.common.sorting.OrderSpec
45import com.edricchan.studybuddy.domain.common.sorting.SortDirection
56import com.edricchan.studybuddy.features.tasks.domain.model.TaskItem
@@ -16,12 +17,12 @@ import kotlinx.coroutines.CoroutineScope
1617 * applied sequentially in-order.
1718 */
1819data class TasksPaginationConfig (
19- val cachedCoroutineScope : CoroutineScope ,
20+ override val cachedCoroutineScope : CoroutineScope ,
2021 val includeArchived : Boolean = false ,
2122 val excludeCompleted : Boolean = false ,
22- val pageSize : Int = 30 ,
23- val orderByFields : Set <TaskOrderSpec > = setOf(TaskOrderSpec ())
24- ) {
23+ override val pageSize : Int = 30 ,
24+ override val orderByFields : Set <TaskOrderSpec > = setOf(TaskOrderSpec ())
25+ ) : CommonPagingConfig<TasksPaginationConfig.TaskOrderSpec> {
2526 data class TaskOrderSpec (
2627 override val field : TaskItem .Field = TaskItem .Field .CreatedAt ,
2728 override val direction : SortDirection = SortDirection .Descending
You can’t perform that action at this time.
0 commit comments