From d4bb3609022c087320cd60f099186c1db2174815 Mon Sep 17 00:00:00 2001 From: Thibault Deckers Date: Tue, 29 Oct 2024 18:37:50 +0100 Subject: [PATCH] fixed shortcut thumbnail for content URI --- .../thibault/aves/channel/calls/MediaFetchBytesHandler.kt | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/android/app/src/main/kotlin/deckers/thibault/aves/channel/calls/MediaFetchBytesHandler.kt b/android/app/src/main/kotlin/deckers/thibault/aves/channel/calls/MediaFetchBytesHandler.kt index 232fa09cd..8012e7d7a 100644 --- a/android/app/src/main/kotlin/deckers/thibault/aves/channel/calls/MediaFetchBytesHandler.kt +++ b/android/app/src/main/kotlin/deckers/thibault/aves/channel/calls/MediaFetchBytesHandler.kt @@ -16,6 +16,7 @@ import kotlinx.coroutines.CoroutineScope import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.SupervisorJob import kotlinx.coroutines.launch +import java.util.Date import kotlin.math.roundToInt class MediaFetchBytesHandler(private val context: Context) : MethodCallHandler { @@ -44,7 +45,7 @@ class MediaFetchBytesHandler(private val context: Context) : MethodCallHandler { val defaultSizeDip = call.argument("defaultSizeDip")?.toDouble() val quality = call.argument("quality") - if (uri == null || mimeType == null || dateModifiedSecs == null || rotationDegrees == null || isFlipped == null || widthDip == null || heightDip == null || defaultSizeDip == null || quality == null) { + if (uri == null || mimeType == null || rotationDegrees == null || isFlipped == null || widthDip == null || heightDip == null || defaultSizeDip == null || quality == null) { result.error("getThumbnail-args", "missing arguments", null) return } @@ -54,7 +55,7 @@ class MediaFetchBytesHandler(private val context: Context) : MethodCallHandler { context = context, uri = uri, mimeType = mimeType, - dateModifiedSecs = dateModifiedSecs, + dateModifiedSecs = dateModifiedSecs ?: (Date().time / 1000), rotationDegrees = rotationDegrees, isFlipped = isFlipped, width = (widthDip * density).roundToInt(),