feat: enhance map navigation and waypoint handling (#4814)

Signed-off-by: James Rich <2199651+jamesarich@users.noreply.github.com>
This commit is contained in:
James Rich 2026-03-16 08:48:00 -05:00 committed by GitHub
parent 802aa09aab
commit 5edb8abd05
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
15 changed files with 95 additions and 16 deletions

View file

@ -17,6 +17,7 @@
package org.meshtastic.app.map
import androidx.compose.runtime.Composable
import androidx.compose.runtime.LaunchedEffect
import androidx.compose.ui.Modifier
import org.koin.compose.viewmodel.koinViewModel
import org.koin.core.annotation.Single
@ -34,8 +35,10 @@ class FdroidMapViewProvider : MapViewProvider {
tracerouteOverlay: Any?,
tracerouteNodePositions: Map<Int, Any>,
onTracerouteMappableCountChanged: (Int, Int) -> Unit,
waypointId: Int?,
) {
val mapViewModel: MapViewModel = koinViewModel()
LaunchedEffect(waypointId) { mapViewModel.setWaypointId(waypointId) }
org.meshtastic.app.map.MapView(
modifier = modifier,
mapViewModel = mapViewModel,

View file

@ -47,6 +47,12 @@ class MapViewModel(
private val _selectedWaypointId = MutableStateFlow(savedStateHandle.get<Int>("waypointId"))
val selectedWaypointId: StateFlow<Int?> = _selectedWaypointId.asStateFlow()
fun setWaypointId(id: Int?) {
if (id != null) {
_selectedWaypointId.value = id
}
}
var mapStyleId: Int
get() = mapPrefs.mapStyle.value
set(value) {