FIx / Audio icon not shown after download

This commit is contained in:
Valere 2020-08-07 16:51:33 +02:00
parent de53166193
commit 8b8855d2d5
1 changed files with 10 additions and 2 deletions

View File

@ -187,10 +187,18 @@ class MessageItemFactory @Inject constructor(
informationData: MessageInformationData, informationData: MessageInformationData,
highlight: Boolean, highlight: Boolean,
attributes: AbsMessageItem.Attributes): MessageFileItem? { attributes: AbsMessageItem.Attributes): MessageFileItem? {
val fileUrl = messageContent.getFileUrl()?.let {
if (informationData.sentByMe && !informationData.sendState.isSent()) {
it
} else {
it.takeIf { it.startsWith("mxc://") }
}
} ?: ""
return MessageFileItem_() return MessageFileItem_()
.attributes(attributes) .attributes(attributes)
.izLocalFile(messageContent.getFileUrl().isLocalFile()) .izLocalFile(fileUrl.isLocalFile())
.mxcUrl(messageContent.getFileUrl() ?: "") .izDownloaded(session.fileService().isFileInCache(fileUrl, messageContent.mimeType))
.mxcUrl(fileUrl)
.contentUploadStateTrackerBinder(contentUploadStateTrackerBinder) .contentUploadStateTrackerBinder(contentUploadStateTrackerBinder)
.contentDownloadStateTrackerBinder(contentDownloadStateTrackerBinder) .contentDownloadStateTrackerBinder(contentDownloadStateTrackerBinder)
.highlighted(highlight) .highlighted(highlight)