mirror of
https://github.com/FluxaMedia/fluxa.git
synced 2026-08-06 08:48:51 +00:00
Include shared app state
This commit is contained in:
parent
cb99b2b1e8
commit
dd54966fb8
1 changed files with 32 additions and 0 deletions
|
|
@ -0,0 +1,32 @@
|
|||
package com.fluxa.app.shared
|
||||
|
||||
import androidx.compose.runtime.Stable
|
||||
import androidx.compose.runtime.getValue
|
||||
import androidx.compose.runtime.mutableStateOf
|
||||
import androidx.compose.runtime.remember
|
||||
import androidx.compose.runtime.setValue
|
||||
import androidx.compose.runtime.Composable
|
||||
import com.fluxa.app.shared.feature.catalog.CatalogHomeUiState
|
||||
|
||||
@Stable
|
||||
class FluxaAppState internal constructor(initialState: FluxaAppUiState) {
|
||||
var uiState by mutableStateOf(initialState)
|
||||
private set
|
||||
|
||||
fun selectDestination(destination: FluxaDestination) {
|
||||
uiState = uiState.copy(destination = destination)
|
||||
}
|
||||
|
||||
fun updateCatalogHome(catalogHome: CatalogHomeUiState) {
|
||||
uiState = uiState.copy(catalogHome = catalogHome)
|
||||
}
|
||||
|
||||
fun updateLanguage(language: String?) {
|
||||
uiState = uiState.copy(language = language)
|
||||
}
|
||||
}
|
||||
|
||||
@Composable
|
||||
fun rememberFluxaAppState(initialState: FluxaAppUiState = FluxaAppUiState()): FluxaAppState {
|
||||
return remember { FluxaAppState(initialState) }
|
||||
}
|
||||
Loading…
Reference in a new issue