mirror of
https://github.com/meshtastic/Meshtastic-Android.git
synced 2026-04-20 22:23:37 +00:00
fix: resolve crashes and debug filter issues in Metrics and MapView (#4824)
Signed-off-by: James Rich <2199651+jamesarich@users.noreply.github.com>
This commit is contained in:
parent
9ad28e924f
commit
a10fe61d0f
6 changed files with 27 additions and 26 deletions
|
|
@ -34,6 +34,7 @@ import androidx.navigation3.runtime.NavKey
|
|||
import kotlinx.coroutines.flow.Flow
|
||||
import org.jetbrains.compose.resources.StringResource
|
||||
import org.koin.compose.viewmodel.koinViewModel
|
||||
import org.koin.core.parameter.parametersOf
|
||||
import org.meshtastic.app.map.node.NodeMapScreen
|
||||
import org.meshtastic.app.ui.node.AdaptiveNodeListScreen
|
||||
import org.meshtastic.core.navigation.ContactsRoutes
|
||||
|
|
@ -115,7 +116,8 @@ fun EntryProviderScope<NavKey>.nodeDetailGraph(
|
|||
}
|
||||
|
||||
entry<NodeDetailRoutes.TracerouteLog> { args ->
|
||||
val metricsViewModel = koinViewModel<MetricsViewModel>()
|
||||
val metricsViewModel =
|
||||
koinViewModel<MetricsViewModel>(key = "metrics-${args.destNum}") { parametersOf(args.destNum) }
|
||||
metricsViewModel.setNodeId(args.destNum)
|
||||
|
||||
TracerouteLogScreen(
|
||||
|
|
@ -134,7 +136,8 @@ fun EntryProviderScope<NavKey>.nodeDetailGraph(
|
|||
}
|
||||
|
||||
entry<NodeDetailRoutes.TracerouteMap> { args ->
|
||||
val metricsViewModel = koinViewModel<MetricsViewModel>()
|
||||
val metricsViewModel =
|
||||
koinViewModel<MetricsViewModel>(key = "metrics-${args.destNum}") { parametersOf(args.destNum) }
|
||||
metricsViewModel.setNodeId(args.destNum)
|
||||
|
||||
TracerouteMapScreen(
|
||||
|
|
@ -176,8 +179,8 @@ private inline fun <reified R : Route> EntryProviderScope<NavKey>.addNodeDetailS
|
|||
crossinline getDestNum: (R) -> Int,
|
||||
) {
|
||||
entry<R> { args ->
|
||||
val metricsViewModel = koinViewModel<MetricsViewModel>()
|
||||
val destNum = getDestNum(args)
|
||||
val metricsViewModel = koinViewModel<MetricsViewModel>(key = "metrics-$destNum") { parametersOf(destNum) }
|
||||
metricsViewModel.setNodeId(destNum)
|
||||
|
||||
routeInfo.screenComposable(metricsViewModel) { backStack.removeLastOrNull() }
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue