From 8b8855d2d5a7d063ee74a26ecdb43cb78ec9f9ff Mon Sep 17 00:00:00 2001 From: Valere Date: Fri, 7 Aug 2020 16:51:33 +0200 Subject: [PATCH] FIx / Audio icon not shown after download --- .../detail/timeline/factory/MessageItemFactory.kt | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/vector/src/main/java/im/vector/app/features/home/room/detail/timeline/factory/MessageItemFactory.kt b/vector/src/main/java/im/vector/app/features/home/room/detail/timeline/factory/MessageItemFactory.kt index cce3248551..97bc693f26 100644 --- a/vector/src/main/java/im/vector/app/features/home/room/detail/timeline/factory/MessageItemFactory.kt +++ b/vector/src/main/java/im/vector/app/features/home/room/detail/timeline/factory/MessageItemFactory.kt @@ -187,10 +187,18 @@ class MessageItemFactory @Inject constructor( informationData: MessageInformationData, highlight: Boolean, attributes: AbsMessageItem.Attributes): MessageFileItem? { + val fileUrl = messageContent.getFileUrl()?.let { + if (informationData.sentByMe && !informationData.sendState.isSent()) { + it + } else { + it.takeIf { it.startsWith("mxc://") } + } + } ?: "" return MessageFileItem_() .attributes(attributes) - .izLocalFile(messageContent.getFileUrl().isLocalFile()) - .mxcUrl(messageContent.getFileUrl() ?: "") + .izLocalFile(fileUrl.isLocalFile()) + .izDownloaded(session.fileService().isFileInCache(fileUrl, messageContent.mimeType)) + .mxcUrl(fileUrl) .contentUploadStateTrackerBinder(contentUploadStateTrackerBinder) .contentDownloadStateTrackerBinder(contentDownloadStateTrackerBinder) .highlighted(highlight)