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
|
|
|
|
import eu.kanade.tachiyomi.ui.browse.extension.ExtensionUiModel
|
|
|
|
|
|
|
|
interface ExtensionsState {
|
|
|
|
val isLoading: Boolean
|
|
|
|
val isRefreshing: Boolean
|
|
|
|
val items: List<ExtensionUiModel>
|
2022-08-29 17:18:06 -04:00
|
|
|
val updates: Int
|
2022-07-16 14:44:37 -04:00
|
|
|
val isEmpty: Boolean
|
|
|
|
}
|
|
|
|
|
|
|
|
fun ExtensionState(): ExtensionsState {
|
|
|
|
return ExtensionsStateImpl()
|
|
|
|
}
|
|
|
|
|
|
|
|
class ExtensionsStateImpl : ExtensionsState {
|
|
|
|
override var isLoading: Boolean by mutableStateOf(true)
|
|
|
|
override var isRefreshing: Boolean by mutableStateOf(false)
|
|
|
|
override var items: List<ExtensionUiModel> by mutableStateOf(emptyList())
|
2022-08-29 17:18:06 -04:00
|
|
|
override var updates: Int by mutableStateOf(0)
|
2022-07-16 14:44:37 -04:00
|
|
|
override val isEmpty: Boolean by derivedStateOf { items.isEmpty() }
|
|
|
|
}
|