Klottr v0.2.4.1, lite bättre hantering av okänt klotter.
This commit is contained in:
@@ -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."
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user