mirror of
https://github.com/meshtastic/Meshtastic-Android.git
synced 2026-04-20 22:23:37 +00:00
refactor(navigation): Simplify adaptive back nav and state (#3860)
Signed-off-by: James Rich <2199651+jamesarich@users.noreply.github.com>
This commit is contained in:
parent
1d17f4074d
commit
ebab2ee9ad
5 changed files with 30 additions and 80 deletions
|
|
@ -43,19 +43,15 @@ import org.meshtastic.feature.node.model.NodeDetailAction
|
|||
@Suppress("LongMethod")
|
||||
@Composable
|
||||
fun NodeDetailScreen(
|
||||
nodeId: Int,
|
||||
modifier: Modifier = Modifier,
|
||||
viewModel: MetricsViewModel = hiltViewModel(),
|
||||
nodeDetailViewModel: NodeDetailViewModel = hiltViewModel(),
|
||||
navigateToMessages: (String) -> Unit = {},
|
||||
onNavigate: (Route) -> Unit = {},
|
||||
onNavigateUp: () -> Unit = {},
|
||||
overrideNodeId: Int? = null,
|
||||
) {
|
||||
LaunchedEffect(overrideNodeId) {
|
||||
if (overrideNodeId != null) {
|
||||
viewModel.setNodeId(overrideNodeId)
|
||||
}
|
||||
}
|
||||
LaunchedEffect(nodeId) { viewModel.setNodeId(nodeId) }
|
||||
|
||||
val state by viewModel.state.collectAsStateWithLifecycle()
|
||||
val environmentState by viewModel.environmentState.collectAsStateWithLifecycle()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue