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:
James Rich 2025-11-29 19:28:44 -06:00 committed by GitHub
parent 1d17f4074d
commit ebab2ee9ad
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 30 additions and 80 deletions

View file

@ -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()