mirror of
https://github.com/meshtastic/Meshtastic-Android.git
synced 2026-04-20 22:23:37 +00:00
fix(map, settings): allow null IDs and implement request timeout (#4851)
This commit is contained in:
parent
b982b145e6
commit
bc08093f6c
5 changed files with 79 additions and 9 deletions
|
|
@ -92,14 +92,16 @@ class MapViewModel(
|
|||
val selectedWaypointId: StateFlow<Int?> = _selectedWaypointId.asStateFlow()
|
||||
|
||||
fun setWaypointId(id: Int?) {
|
||||
if (id != null && _selectedWaypointId.value != id) {
|
||||
if (_selectedWaypointId.value != id) {
|
||||
_selectedWaypointId.value = id
|
||||
viewModelScope.launch {
|
||||
val wpMap = waypoints.first { it.containsKey(id) }
|
||||
wpMap[id]?.let { packet ->
|
||||
val waypoint = packet.waypoint!!
|
||||
val latLng = LatLng((waypoint.latitude_i ?: 0) / 1e7, (waypoint.longitude_i ?: 0) / 1e7)
|
||||
cameraPositionState.position = CameraPosition.fromLatLngZoom(latLng, 15f)
|
||||
if (id != null) {
|
||||
viewModelScope.launch {
|
||||
val wpMap = waypoints.first { it.containsKey(id) }
|
||||
wpMap[id]?.let { packet ->
|
||||
val waypoint = packet.waypoint!!
|
||||
val latLng = LatLng((waypoint.latitude_i ?: 0) / 1e7, (waypoint.longitude_i ?: 0) / 1e7)
|
||||
cameraPositionState.position = CameraPosition.fromLatLngZoom(latLng, 15f)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue