Use cached nearby results in "Nära" tab to show list immediately and refresh seamlessly in background
This commit is contained in:
@@ -3,6 +3,7 @@ package app.klottr.ui
|
||||
import androidx.compose.foundation.layout.*
|
||||
import androidx.compose.runtime.*
|
||||
import androidx.compose.ui.Modifier
|
||||
import app.klottr.location.LastLocationStore
|
||||
import app.klottr.location.LocationServiceProvider
|
||||
import app.klottr.maps.*
|
||||
import app.klottr.net.*
|
||||
@@ -134,20 +135,28 @@ fun MapContent(
|
||||
return out
|
||||
}
|
||||
|
||||
val lastKnown = LastLocationStore.lastKnownLocation.value
|
||||
val startLat = initialLat ?: lastKnown?.lat ?: 59.2974 // Årsta Torg
|
||||
val startLon = initialLon ?: lastKnown?.lon ?: 18.0520
|
||||
|
||||
val mapState = remember {
|
||||
MapState(
|
||||
initialCamera = CameraPosition(
|
||||
target = LatLng(startLat, startLon),
|
||||
zoom = 16f
|
||||
),
|
||||
initialUi = MapUiSettings(
|
||||
compassEnabled = true,
|
||||
zoomControlsEnabled = false,
|
||||
myLocationButtonEnabled = hasFgLocationPerms(),
|
||||
mapType = if (satellite) MapType.SATELLITE else MapType.NORMAL
|
||||
)
|
||||
)
|
||||
}
|
||||
|
||||
Box(modifier = modifier) {
|
||||
MapContainer(
|
||||
state = MapState(
|
||||
initialCamera = CameraPosition(
|
||||
target = LatLng(initialLat ?: 59.3293, initialLon ?: 18.0686),
|
||||
zoom = 16f
|
||||
),
|
||||
initialUi = MapUiSettings(
|
||||
compassEnabled = true,
|
||||
zoomControlsEnabled = false,
|
||||
myLocationButtonEnabled = hasFgLocationPerms(),
|
||||
mapType = if (satellite) MapType.SATELLITE else MapType.NORMAL
|
||||
)
|
||||
),
|
||||
state = mapState,
|
||||
onMapClick = { /* inget extra här */ },
|
||||
onMarkerClick = { id ->
|
||||
when {
|
||||
|
||||
Reference in New Issue
Block a user