Created
August 14, 2022 14:28
-
-
Save motorro/e65022b6323c894dea9ca43ae3481028 to your computer and use it in GitHub Desktop.
Application master view
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fun WelcomeScreen(onTerminate: @Composable () -> Unit) { | |
val model = hiltViewModel<WelcomeViewModel>() | |
val state = model.state.collectAsState(WelcomeUiState.Loading) | |
BackHandler(onBack = { model.process(Back) }) | |
when (val uiState = state.value) { | |
// Native ui-state rendering... | |
// Render login screens | |
is WelcomeUiState.Login -> LoginScreen( | |
state = uiState.value, | |
onGesture = { model.process(Login(it)) } | |
) | |
// Render registration screens | |
is WelcomeUiState.Register -> RegistrationScreen( | |
state = uiState.value, | |
onGesture = { model.process(Register(it))} | |
) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment