Fixed a few easy-to-fix issues in KlottrAppShell

This commit is contained in:
Olof Hedman
2025-09-24 18:47:57 +02:00
parent 59bbba8f6b
commit a42070e36b

View File

@@ -1,6 +1,5 @@
package app.klottr
import android.content.Intent
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Row
import androidx.compose.material.icons.Icons
@@ -28,7 +27,7 @@ import androidx.compose.runtime.rememberCoroutineScope
import androidx.compose.runtime.setValue
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.asImageBitmap
import androidx.compose.ui.graphics.decodeToImageBitmap
import androidx.compose.ui.platform.LocalContext
import androidx.compose.ui.unit.dp
import app.klottr.auth.AuthPlatform
@@ -92,6 +91,7 @@ import coil3.request.ImageRequest
import coil3.request.SuccessResult
import coil3.toBitmap
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.IO
import kotlinx.coroutines.launch
import kotlinx.coroutines.withContext
import java.io.File
@@ -101,8 +101,10 @@ import kotlin.collections.component2
import kotlin.collections.iterator
import kotlin.collections.orEmpty
import kotlin.collections.set
import kotlin.time.Clock
import kotlin.time.ExperimentalTime
@OptIn(ExperimentalMaterial3Api::class)
@OptIn(ExperimentalMaterial3Api::class, ExperimentalTime::class)
@Composable
fun KlottrAppShell(
onRequestPerms: () -> Unit,
@@ -304,15 +306,7 @@ fun KlottrAppShell(
noteId = detail.id,
lat = f.lat,
lon = f.lon
)?.let { bytes ->
val req = ImageRequest.Builder(context)
.data(bytes)
.build()
val res = ImageLoader(context).execute(req)
if (res is SuccessResult) {
ImageBitmapCache.put(img.id, res.image.toBitmap().asImageBitmap())
}
}
)?.decodeToImageBitmap()
}
}
}
@@ -450,7 +444,7 @@ fun KlottrAppShell(
}
nearbyBundle = bundle
val nowMillis = System.currentTimeMillis()
val nowMillis = Clock.System.now().toEpochMilliseconds()
app.klottr.nearby.markNewFinds(
entries = bundle.entries, // Använd direkt från bundle
nowMillis = nowMillis,
@@ -672,7 +666,7 @@ fun KlottrAppShell(
UiFeedback.showMessage("Du måste logga in för att kunna klottra.", UiFeedbackDuration.SHORT)
return@WriteDocDialog
}
val created = System.currentTimeMillis()
val created = Clock.System.now().toEpochMilliseconds()
val requestId = UUID.randomUUID().toString()
if (isSavingDoc) return@WriteDocDialog
@@ -747,7 +741,7 @@ fun KlottrAppShell(
label = labelTitle,
lat = match.a,
lon = match.o,
timeMillis = System.currentTimeMillis()
timeMillis = Clock.System.now().toEpochMilliseconds()
)
withContext(Dispatchers.Main) {
// TODO: OH: Nog renare om foundstore är ansvarig för att skicka FoundEvents.