From 3cbc4fcec6d191df6ef5f3fc5042e088139ed6a1 Mon Sep 17 00:00:00 2001 From: davotoula Date: Sat, 9 May 2026 12:03:29 +0200 Subject: [PATCH] fix(gallery): forward thumbhash when adding media to gallery --- .../amethyst/ui/components/ZoomableContentView.kt | 5 ++++- .../amethyst/ui/screen/loggedIn/AccountViewModel.kt | 3 ++- 2 files changed, 6 insertions(+), 2 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 64889c829..6666d7d19 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 @@ -961,7 +961,10 @@ fun ShareMediaAction( // still — the .m3u8 URL itself is a text manifest. Only // MediaUrlVideo carries an artworkUri. val posterUrl = (content as? MediaUrlVideo)?.artworkUri - accountViewModel.addMediaToGallery(n19.hex, videoUri, n19.relay.getOrNull(0), blurhash, dim, hash, mimeType, image = posterUrl) + val thumbhashFromContent = + (content as? MediaUrlVideo)?.thumbhash + ?: (content as? MediaUrlImage)?.thumbhash + accountViewModel.addMediaToGallery(n19.hex, videoUri, n19.relay.getOrNull(0), blurhash, dim, hash, mimeType, thumbhash = thumbhashFromContent, image = posterUrl) accountViewModel.toastManager.toast(R.string.media_added, R.string.media_added_to_profile_gallery) } } diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/AccountViewModel.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/AccountViewModel.kt index af02c9f5d..a45ab3186 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/AccountViewModel.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/AccountViewModel.kt @@ -896,8 +896,9 @@ class AccountViewModel( dim: DimensionTag?, hash: String?, mimeType: String?, + thumbhash: String? = null, image: String? = null, - ) = launchSigner { account.addToGallery(hex, url, relay, blurhash, dim, hash, mimeType, image = image) } + ) = launchSigner { account.addToGallery(hex, url, relay, blurhash, dim, hash, mimeType, thumbhash = thumbhash, image = image) } fun removeFromMediaGallery(note: Note) = launchSigner { account.removeFromGallery(note) }