From f3a10435f79811e25f81e1ec42bd55f5459f8e38 Mon Sep 17 00:00:00 2001 From: Fabian Norlin Date: Sat, 30 Aug 2025 00:32:17 +0200 Subject: [PATCH] =?UTF-8?q?Klottr=20v0.2.4.1,=20lite=20b=C3=A4ttre=20hante?= =?UTF-8?q?ring=20av=20ok=C3=A4nt=20klotter.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/build.gradle.kts | 2 +- app/src/main/java/app/klottr/MainActivity.kt | 22 +++++++++----------- 2 files changed, 11 insertions(+), 13 deletions(-) diff --git a/app/build.gradle.kts b/app/build.gradle.kts index c6df312..8750e52 100644 --- a/app/build.gradle.kts +++ b/app/build.gradle.kts @@ -47,7 +47,7 @@ android { minSdk = 26 targetSdk = 35 versionCode = 11 - versionName = "0.2.4" + versionName = "0.2.4.1" // Byggtid i UTC (ISO 8601) genereras vid build-konfiguration val buildTimeUtc = Instant.now().toString() diff --git a/app/src/main/java/app/klottr/MainActivity.kt b/app/src/main/java/app/klottr/MainActivity.kt index 07983bb..c735003 100644 --- a/app/src/main/java/app/klottr/MainActivity.kt +++ b/app/src/main/java/app/klottr/MainActivity.kt @@ -2053,10 +2053,6 @@ private fun KlotterDialog( LaunchedEffect(id, lat, lon, label) { loading = !prefilledFromCache - val baseLabel = label.trim() - val isKnown = baseLabel.isNotBlank() && baseLabel != "Okänt klotter" - app.klottr.util.AppLog.d { "KlotterDialog start id=$id isKnown=$isKnown label='${baseLabel.take(40)}'"} - // Hämta ev. färsk plats (fallback LastLocationStore) val my = LastLocationStore.lastKnownLocation val fused = GmsLocationServices.getFusedLocationProviderClient(context) @@ -2074,14 +2070,16 @@ private fun KlotterDialog( distanceMeters(qLat, qLon, lat, lon) <= Config.DEFAULT_KLOTTER_RADIUS_M.toDouble() } else false - // Försök hämta detalj/bild om posten är känd (Hittat) ELLER vi är inom radien - val canAttempt = isKnown || withinRadius - app.klottr.util.AppLog.d { "KlotterDialog canAttempt=$canAttempt withinRadius=$withinRadius"} + + // Försök hämta detalj/bild om posten har besökts tidigare ELLER vi är inom radien + val canAttempt = wasFoundBefore || withinRadius + app.klottr.util.AppLog.d { "KlotterDialog canAttempt=$canAttempt withinRadius=$withinRadius wasFoundBefore=$wasFoundBefore" } if (canAttempt) { - // get_note.php ska få: Hittat => NOTISENS coords, annars besökarens (fallback notisens) - val reqLat = if (isKnown) lat else (qLat ?: lat) - val reqLon = if (isKnown) lon else (qLon ?: lon) + // get_note.php ska få: Besökt tidigare => NOTISENS coords, annars besökarens (fallback notisens) + val reqLat = if (wasFoundBefore) lat else (qLat ?: lat) + val reqLon = if (wasFoundBefore) lon else (qLon ?: lon) + val detail = withContext(Dispatchers.IO) { try { @@ -2130,8 +2128,8 @@ private fun KlotterDialog( } } } else { - // Kunde inte få detalj – behåll ev. fallback (endast om ej känd och långt bort) - if (!isKnown && !withinRadius) { + // Kunde inte få detalj – behåll fallback (endast om aldrig funnen och utanför radie) + if (!wasFoundBefore && !withinRadius) { titleText = "Okänt klotter" text = "Du måste vara inom ${Config.DEFAULT_KLOTTER_RADIUS_M}\u00A0m för att se det." }