Use shared NearbyBundle for Nearby results; replace Triple in Android
This commit is contained in:
@@ -94,6 +94,7 @@ import app.klottr.data.AppDatabase
|
||||
import app.klottr.data.NoteRepository
|
||||
import app.klottr.location.AndroidLocationProvider
|
||||
import app.klottr.nearby.FoundOpenAction // Delat åtgärds-ADT
|
||||
import app.klottr.nearby.NearbyBundleShared
|
||||
import app.klottr.nearby.NearbyEntryShared // Delad radmodell
|
||||
import app.klottr.nearby.OpenFornsok
|
||||
import app.klottr.nearby.OpenKlotter
|
||||
@@ -319,9 +320,12 @@ private fun KlottrAppShell(
|
||||
var showUsernameDialog by remember { mutableStateOf(false) }
|
||||
|
||||
// Nearby-data
|
||||
|
||||
// Ändrad: Triple -> NearbyBundleShared
|
||||
var nearbyBundle by remember {
|
||||
mutableStateOf<Triple<List<NearbyEntryShared>, List<DigitaltMuseumItem>, List<FornsokItem>>?>(null) // Ny: bundel som Triple
|
||||
mutableStateOf<NearbyBundleShared?>(null)
|
||||
}
|
||||
|
||||
var nearbyLoading by remember { mutableStateOf(false) }
|
||||
var nearbyError by remember { mutableStateOf<String?>(null) }
|
||||
var lastKnownLat by remember { mutableStateOf<Double?>(null) }
|
||||
@@ -662,7 +666,7 @@ private fun KlottrAppShell(
|
||||
fornFetcher = { la, lo, r -> Fornsok.getNearby(la, lo, radiusMeters = r) }
|
||||
)
|
||||
}
|
||||
nearbyBundle = Triple(bundle.entries, bundle.dm, bundle.forn) // Spara som Triple
|
||||
nearbyBundle = bundle
|
||||
|
||||
val nowMillis = System.currentTimeMillis()
|
||||
app.klottr.nearby.markNewFinds(
|
||||
@@ -700,9 +704,11 @@ private fun KlottrAppShell(
|
||||
error = nearbyError,
|
||||
lat = lastKnownLat,
|
||||
lon = lastKnownLon,
|
||||
entries = nearbyBundle?.first.orEmpty(), // Ändrad: Triple.first
|
||||
dm = nearbyBundle?.second.orEmpty(), // Ändrad: Triple.second
|
||||
forn = nearbyBundle?.third.orEmpty(), // Ändrad: Triple.third
|
||||
// Använd namngivna fält från NearbyBundleShared
|
||||
entries = nearbyBundle?.entries.orEmpty(), // Ändrad
|
||||
dm = nearbyBundle?.dm.orEmpty(), // Ändrad
|
||||
forn = nearbyBundle?.forn.orEmpty(), // Ändrad
|
||||
|
||||
onOpenAction = { action ->
|
||||
when (action) {
|
||||
is FoundOpenAction.Klotter ->
|
||||
|
||||
Reference in New Issue
Block a user