shared(location): add expect/actual LastLocationStore (GeoPoint)
app(util): adapt LastLocationStore to delegate to shared store while keeping android.location.Location API
This commit is contained in:
@@ -25,5 +25,19 @@ object MatchBus {
|
||||
}
|
||||
|
||||
object LastLocationStore {
|
||||
@Volatile var lastKnownLocation: Location? = null
|
||||
// Adapter som låter befintlig Android-kod använda android.location.Location,
|
||||
// men under huven lagras värdet i KMP-store (GeoPoint) i :shared.
|
||||
var lastKnownLocation: Location?
|
||||
get() {
|
||||
val gp = app.klottr.location.LastLocationStore.lastKnown // Hämta från delad store
|
||||
return gp?.let {
|
||||
Location("klottr").apply { latitude = it.lat; longitude = it.lon }
|
||||
}
|
||||
}
|
||||
set(value) {
|
||||
app.klottr.location.LastLocationStore.lastKnown = value?.let {
|
||||
app.klottr.location.GeoPoint(it.latitude, it.longitude)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user