mirror of
https://github.com/smyalygames/checklist-tester.git
synced 2025-05-18 06:24:12 +02:00
feat(connector): add ScreenModel for SimulatorTest
This commit is contained in:
parent
878b4f6a0c
commit
c5e20d6363
@ -151,6 +151,7 @@ class ListProcedures (
|
||||
DropdownMenuItem(
|
||||
text = { Text("Run Test") },
|
||||
onClick = {
|
||||
viewModel.procedureId = procedure.id
|
||||
tabNavigator.current = SimulatorTest
|
||||
},
|
||||
leadingIcon = {
|
||||
|
@ -1,7 +1,8 @@
|
||||
package tab.test
|
||||
import androidx.compose.material3.Text
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.runtime.remember
|
||||
import cafe.adriel.voyager.navigator.CurrentScreen
|
||||
import cafe.adriel.voyager.navigator.Navigator
|
||||
import cafe.adriel.voyager.navigator.tab.Tab
|
||||
import cafe.adriel.voyager.navigator.tab.TabOptions
|
||||
import connector.composeapp.generated.resources.Res
|
||||
@ -30,6 +31,8 @@ object SimulatorTest : Tab {
|
||||
|
||||
@Composable
|
||||
override fun Content() {
|
||||
Text("Simulator Test")
|
||||
Navigator(TestContent()) {
|
||||
CurrentScreen()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,26 @@
|
||||
package tab.test
|
||||
|
||||
import androidx.compose.runtime.*
|
||||
import cafe.adriel.voyager.core.screen.Screen
|
||||
import cafe.adriel.voyager.koin.getScreenModel
|
||||
import tab.LoadingScreen
|
||||
import tab.procedure.ActionsScreenModel
|
||||
import tab.procedure.ActionsState
|
||||
|
||||
class TestContent : Screen {
|
||||
@Composable
|
||||
override fun Content() {
|
||||
val screenModel = getScreenModel<ActionsScreenModel>()
|
||||
val state by screenModel.state.collectAsState()
|
||||
|
||||
when (val s = state) {
|
||||
is ActionsState.Loading -> LoadingScreen("Simulator Test")
|
||||
is ActionsState.Idle -> { /* TODO implement error? */ }
|
||||
is ActionsState.Result -> TODO("Not yet implemented")
|
||||
}
|
||||
|
||||
LaunchedEffect(currentCompositeKeyHash) {
|
||||
screenModel.getActions()
|
||||
}
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user