From d542e4d6a03aeed5b4f5d452405cccd4a304a1e3 Mon Sep 17 00:00:00 2001 From: davotoula Date: Tue, 20 Jan 2026 19:55:19 +0100 Subject: [PATCH] change to 2 minutes delay before cleaning up temp shared file --- .../amethyst/ui/components/ZoomableContentView.kt | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/components/ZoomableContentView.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/components/ZoomableContentView.kt index 1b4d60cd6..6e18d8342 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/components/ZoomableContentView.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/components/ZoomableContentView.kt @@ -124,6 +124,10 @@ import java.io.File import java.io.IOException import kotlin.time.Duration.Companion.seconds +// Delay before cleaning up shared video temp files. +// Allows time for receiving app to copy the file after user confirms share. +private const val SHARED_VIDEO_CLEANUP_DELAY_MS = 120_000L + @Composable fun ZoomableContentView( content: BaseMediaContent, @@ -931,10 +935,10 @@ private suspend fun shareVideoFile( } } - // Schedule cleanup after 60 seconds to allow the receiving app time to copy the file - // Launch in separate coroutine so we don't block the completion callback + // Schedule cleanup to allow the receiving app time to copy the file. + // GlobalScope is intentional: cleanup must survive after share UI is dismissed. GlobalScope.launch(Dispatchers.IO) { - delay(60_000) + delay(SHARED_VIDEO_CLEANUP_DELAY_MS) sharedFile?.delete() }