Cleanup Nearby: remove legacy states/imports and avoid entries shadowing in NearbyDialog
This commit is contained in:
@@ -116,13 +116,10 @@ import app.klottr.location.AndroidLocationProvider
|
||||
import app.klottr.nearby.FoundOpenAction // Delat åtgärds-ADT
|
||||
import app.klottr.nearby.NearbyEntryShared // Delad radmodell
|
||||
import app.klottr.nearby.ScanConfig
|
||||
import app.klottr.nearby.buildNearbyEntries // Delad builder för “Närliggande”
|
||||
import app.klottr.nearby.enrichKlotterLabels // Delad etikett-berikning
|
||||
import app.klottr.nearby.fetchNearbyData // KMP-hjälpare som hämtar alla lager
|
||||
import app.klottr.nearby.getNearbyBundle // Delad use-case
|
||||
import app.klottr.nearby.resolveFoundOpenAction // Delad öppna-resolver
|
||||
import app.klottr.nearby.scanAndMarkFound
|
||||
import app.klottr.nearby.subtitleFor // Delad formatterare för undertexter
|
||||
import app.klottr.net.Api
|
||||
import app.klottr.net.DigitaltMuseum
|
||||
import app.klottr.net.DigitaltMuseumItem
|
||||
@@ -142,8 +139,6 @@ import app.klottr.theme.KlottrTheme
|
||||
import app.klottr.ui.FoundList // Delad, material-fri listkomponent för "Hittat"
|
||||
import app.klottr.ui.FoundContent // Delat innehåll för “Hittat”
|
||||
import app.klottr.ui.NearbyContent // Delat material-fritt innehåll för Närliggande
|
||||
import app.klottr.ui.NearbyEntryRow
|
||||
import app.klottr.ui.NearbyList // Delad material-fri listkomponent
|
||||
import app.klottr.ui.MapPanelShell
|
||||
import app.klottr.ui.SettingsContent // Delad material-fri UI för inställningar
|
||||
import app.klottr.ui.WriteDocContent // Använd delad, material-fri formulär-UI
|
||||
@@ -415,8 +410,6 @@ private fun KlottrApp(
|
||||
var loadingMe by remember { mutableStateOf(false) }
|
||||
|
||||
// Nearby-data
|
||||
var nearbyKlotter by remember { mutableStateOf<List<NoteDTO>>(emptyList()) }
|
||||
var nearbyWiki by remember { mutableStateOf<List<WikipediaPage>>(emptyList()) }
|
||||
var nearbyDm by remember { mutableStateOf<List<DigitaltMuseumItem>>(emptyList()) }
|
||||
var nearbyFornsok by remember { mutableStateOf<List<FornsokItem>>(emptyList()) }
|
||||
// Håller färdigbyggda rader för dialogen
|
||||
@@ -1332,22 +1325,12 @@ private fun NearbyDialog(
|
||||
onClose: () -> Unit
|
||||
) {
|
||||
val ctx = LocalContext.current
|
||||
val now = remember { System.currentTimeMillis() }
|
||||
|
||||
AlertDialog(
|
||||
onDismissRequest = onClose,
|
||||
title = { Text("Närliggande") },
|
||||
text = {
|
||||
val hasLocation = (lat != null && lon != null)
|
||||
val knownKlotterLabels = FoundStore.getAll(ctx)
|
||||
.asSequence()
|
||||
.filter { it.layer == FoundStore.LAYER_KLOTTER }
|
||||
.associate { it.id to it.label }
|
||||
|
||||
val entries: List<NearbyEntryShared> =
|
||||
if (hasLocation) {
|
||||
entries
|
||||
} else emptyList()
|
||||
|
||||
// Dialogens innehåll i delat skal med rimlig höjd (max ~80% av skärmen)
|
||||
val cfg = LocalConfiguration.current
|
||||
@@ -1366,7 +1349,7 @@ private fun NearbyDialog(
|
||||
loading = loading,
|
||||
error = error,
|
||||
hasLocation = hasLocation,
|
||||
entries = entries,
|
||||
entries = if (hasLocation) entries else emptyList(), // Filtrera direkt i anropet, ingen skuggning
|
||||
dm = dm,
|
||||
forn = forn,
|
||||
onOpenAction = onOpenAction, // Ny enhetlig callback
|
||||
|
||||
Reference in New Issue
Block a user