diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/model/Account.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/model/Account.kt index 612a2cbaf..826b8e079 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/model/Account.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/model/Account.kt @@ -135,6 +135,7 @@ import com.vitorpamplona.quartz.experimental.profileGallery.blurhash import com.vitorpamplona.quartz.experimental.profileGallery.dimension import com.vitorpamplona.quartz.experimental.profileGallery.fromEvent import com.vitorpamplona.quartz.experimental.profileGallery.hash +import com.vitorpamplona.quartz.experimental.profileGallery.image import com.vitorpamplona.quartz.experimental.profileGallery.mimeType import com.vitorpamplona.quartz.marmot.mip00KeyPackages.KeyPackageEvent import com.vitorpamplona.quartz.marmot.mls.group.MlsGroupStateStore @@ -2547,6 +2548,7 @@ class Account( hash: String?, mimeType: String?, thumbhash: String? = null, + image: String? = null, ) { val template = ProfileGalleryEntryEvent.build(url) { @@ -2556,6 +2558,7 @@ class Account( dim?.let { dimension(it) } blurhash?.let { blurhash(it) } thumbhash?.let { galleryThumbhash(it) } + image?.let { image(it) } } val event = signer.sign(template) 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 1244e6a62..e530ec028 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 @@ -940,7 +940,12 @@ fun ShareMediaAction( if (videoUri != null) { val n19 = Nip19Parser.uriToRoute(postNostrUri)?.entity as? NEvent if (n19 != null) { - accountViewModel.addMediaToGallery(n19.hex, videoUri, n19.relay.getOrNull(0), blurhash, dim, hash, mimeType) + // Forward the imeta poster (only MediaUrlVideo carries it) so HLS + // gallery entries have a still to render — without this, a video + // event whose imeta only contains a .m3u8 URL renders as a black + // play-icon tile in the gallery. + val posterUrl = (content as? MediaUrlVideo)?.artworkUri + accountViewModel.addMediaToGallery(n19.hex, videoUri, n19.relay.getOrNull(0), blurhash, dim, hash, mimeType, 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 216b5bcce..4036bb3ba 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 @@ -856,7 +856,8 @@ class AccountViewModel( dim: DimensionTag?, hash: String?, mimeType: String?, - ) = launchSigner { account.addToGallery(hex, url, relay, blurhash, dim, hash, mimeType) } + image: String? = null, + ) = launchSigner { account.addToGallery(hex, url, relay, blurhash, dim, hash, mimeType, image = image) } fun removeFromMediaGallery(note: Note) = launchSigner { account.removeFromGallery(note) }