From 1553640c1846979a9100c2507e95f36a623b7f7e Mon Sep 17 00:00:00 2001 From: Vitor Pamplona Date: Thu, 11 Apr 2024 16:34:34 -0400 Subject: [PATCH] Calculates hash in the IO thread from Compose's scope. --- .../amethyst/ui/components/ZoomableContentView.kt | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/com/vitorpamplona/amethyst/ui/components/ZoomableContentView.kt b/app/src/main/java/com/vitorpamplona/amethyst/ui/components/ZoomableContentView.kt index e5d6c8fde..52902c017 100644 --- a/app/src/main/java/com/vitorpamplona/amethyst/ui/components/ZoomableContentView.kt +++ b/app/src/main/java/com/vitorpamplona/amethyst/ui/components/ZoomableContentView.kt @@ -141,6 +141,7 @@ import kotlinx.coroutines.CancellationException import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.delay import kotlinx.coroutines.launch +import kotlinx.coroutines.withContext import net.engawapg.lib.zoomable.rememberZoomState import net.engawapg.lib.zoomable.zoomable @@ -542,7 +543,10 @@ fun ShowHash( if (content.hash != null) { LaunchedEffect(key1 = content.url) { - val newVerifiedHash = verifyHash(content) + val newVerifiedHash = + withContext(Dispatchers.IO) { + verifyHash(content) + } if (newVerifiedHash != verifiedHash) { verifiedHash = newVerifiedHash }