2022-07-16 14:44:37 -04:00
|
|
|
package eu.kanade.presentation.browse
|
|
|
|
|
|
|
|
import androidx.compose.runtime.derivedStateOf
|
|
|
|
import androidx.compose.runtime.getValue
|
|
|
|
import androidx.compose.runtime.mutableStateOf
|
|
|
|
import androidx.compose.runtime.setValue
|
2022-08-29 17:18:06 -04:00
|
|
|
import eu.kanade.domain.source.interactor.SetMigrateSorting
|
2022-07-16 14:44:37 -04:00
|
|
|
import eu.kanade.domain.source.model.Source
|
|
|
|
|
|
|
|
interface MigrateSourceState {
|
|
|
|
val isLoading: Boolean
|
|
|
|
val items: List<Pair<Source, Long>>
|
|
|
|
val isEmpty: Boolean
|
2022-08-29 17:18:06 -04:00
|
|
|
val sortingMode: SetMigrateSorting.Mode
|
|
|
|
val sortingDirection: SetMigrateSorting.Direction
|
2022-07-16 14:44:37 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
fun MigrateSourceState(): MigrateSourceState {
|
|
|
|
return MigrateSourceStateImpl()
|
|
|
|
}
|
|
|
|
|
|
|
|
class MigrateSourceStateImpl : MigrateSourceState {
|
|
|
|
override var isLoading: Boolean by mutableStateOf(true)
|
|
|
|
override var items: List<Pair<Source, Long>> by mutableStateOf(emptyList())
|
|
|
|
override val isEmpty: Boolean by derivedStateOf { items.isEmpty() }
|
2022-08-29 17:18:06 -04:00
|
|
|
override var sortingMode: SetMigrateSorting.Mode by mutableStateOf(SetMigrateSorting.Mode.ALPHABETICAL)
|
|
|
|
override var sortingDirection: SetMigrateSorting.Direction by mutableStateOf(SetMigrateSorting.Direction.ASCENDING)
|
2022-07-16 14:44:37 -04:00
|
|
|
}
|