fix(map, settings): allow null IDs and implement request timeout (#4851)

This commit is contained in:
James Rich 2026-03-19 12:36:14 -05:00 committed by GitHub
parent b982b145e6
commit bc08093f6c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 79 additions and 9 deletions

View file

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