If media source for thumbnail info is not available for image, use the source image as a fallback. But if it is available, use it.

This commit is contained in:
Benoit Marty
2023-11-08 15:48:06 +01:00
parent d2483ea11a
commit ea9b222b0e
3 changed files with 3 additions and 3 deletions

View File

@@ -311,7 +311,7 @@ class MessagesPresenter @AssistedInject constructor(
val textContent = messageSummaryFormatter.format(targetEvent)
val attachmentThumbnailInfo = when (targetEvent.content) {
is TimelineItemImageContent -> AttachmentThumbnailInfo(
thumbnailSource = targetEvent.content.thumbnailSource,
thumbnailSource = targetEvent.content.thumbnailSource ?: targetEvent.content.mediaSource,
textContent = targetEvent.content.body,
type = AttachmentThumbnailType.Image,
blurHash = targetEvent.content.blurhash,

View File

@@ -260,7 +260,7 @@ private fun MessageSummary(event: TimelineItem.Event, modifier: Modifier = Modif
AttachmentThumbnail(
modifier = imageModifier,
info = AttachmentThumbnailInfo(
thumbnailSource = event.content.mediaSource,
thumbnailSource = event.content.thumbnailSource ?: event.content.mediaSource,
textContent = textContent,
type = AttachmentThumbnailType.Image,
blurHash = event.content.blurhash,

View File

@@ -595,7 +595,7 @@ private fun attachmentThumbnailInfoForInReplyTo(inReplyTo: InReplyTo.Ready): Att
val messageContent = inReplyTo.content as? MessageContent ?: return null
return when (val type = messageContent.type) {
is ImageMessageType -> AttachmentThumbnailInfo(
thumbnailSource = type.info?.thumbnailSource,
thumbnailSource = type.info?.thumbnailSource ?: type.source,
textContent = messageContent.body,
type = AttachmentThumbnailType.Image,
blurHash = type.info?.blurhash,