diff --git a/attachment-viewer/src/main/java/im/vector/lib/attachmentviewer/VideoLoaderTarget.kt b/attachment-viewer/src/main/java/im/vector/lib/attachmentviewer/VideoLoaderTarget.kt index 9936ae3cba..996c4c65f4 100644 --- a/attachment-viewer/src/main/java/im/vector/lib/attachmentviewer/VideoLoaderTarget.kt +++ b/attachment-viewer/src/main/java/im/vector/lib/attachmentviewer/VideoLoaderTarget.kt @@ -34,7 +34,7 @@ interface VideoLoaderTarget { fun onVideoFileLoading(uid: String) fun onVideoFileLoadFailed(uid: String) - fun onVideoURLReady(uid: String, file: File) + fun onVideoFileReady(uid: String, file: File) fun onVideoURLReady(uid: String, path: String) } @@ -67,16 +67,16 @@ internal class DefaultVideoLoaderTarget(val holder: VideoViewHolder, private val holder.videoFileLoadError() } - override fun onVideoURLReady(uid: String, file: File) { + override fun onVideoFileReady(uid: String, file: File) { if (holder.boundResourceUid != uid) return arrangeForVideoReady() holder.videoReady(file) } - override fun onVideoURLReady(uid: String, contentPath: String) { + override fun onVideoURLReady(uid: String, path: String) { if (holder.boundResourceUid != uid) return arrangeForVideoReady() - holder.videoReady(contentPath) + holder.videoReady(path) } private fun arrangeForVideoReady() { diff --git a/matrix-sdk-android/src/androidTest/java/org/matrix/android/sdk/internal/crypto/AttachmentEncryptionTest.kt b/matrix-sdk-android/src/androidTest/java/org/matrix/android/sdk/internal/crypto/AttachmentEncryptionTest.kt index f4a48eb367..1e109f11ae 100644 --- a/matrix-sdk-android/src/androidTest/java/org/matrix/android/sdk/internal/crypto/AttachmentEncryptionTest.kt +++ b/matrix-sdk-android/src/androidTest/java/org/matrix/android/sdk/internal/crypto/AttachmentEncryptionTest.kt @@ -21,7 +21,6 @@ import android.util.Base64 import androidx.test.ext.junit.runners.AndroidJUnit4 import org.junit.Assert.assertEquals import org.junit.Assert.assertNotEquals -import org.junit.Assert.assertNotNull import org.junit.FixMethodOrder import org.junit.Test import org.junit.runner.RunWith diff --git a/vector/src/main/java/im/vector/app/features/home/room/detail/RoomDetailViewModel.kt b/vector/src/main/java/im/vector/app/features/home/room/detail/RoomDetailViewModel.kt index cbf57a86f1..0120cbb2bb 100644 --- a/vector/src/main/java/im/vector/app/features/home/room/detail/RoomDetailViewModel.kt +++ b/vector/src/main/java/im/vector/app/features/home/room/detail/RoomDetailViewModel.kt @@ -992,7 +992,7 @@ class RoomDetailViewModel @AssistedInject constructor( private fun handleOpenOrDownloadFile(action: RoomDetailAction.DownloadOrOpen) { val mxcUrl = action.messageFileContent.getFileUrl() val isLocalSendingFile = action.senderId == session.myUserId - && action.messageFileContent.getFileUrl()?.startsWith("content://") ?: false + && mxcUrl?.startsWith("content://") ?: false val isDownloaded = mxcUrl?.let { session.fileService().isFileInCache(it, action.messageFileContent.mimeType) } ?: false if (isLocalSendingFile) { tryThis { Uri.parse(mxcUrl) }?.let { diff --git a/vector/src/main/java/im/vector/app/features/media/BaseAttachmentProvider.kt b/vector/src/main/java/im/vector/app/features/media/BaseAttachmentProvider.kt index c3516308c6..3846e56ecf 100644 --- a/vector/src/main/java/im/vector/app/features/media/BaseAttachmentProvider.kt +++ b/vector/src/main/java/im/vector/app/features/media/BaseAttachmentProvider.kt @@ -27,7 +27,6 @@ import im.vector.lib.attachmentviewer.AttachmentSourceProvider import im.vector.lib.attachmentviewer.ImageLoaderTarget import im.vector.lib.attachmentviewer.VideoLoaderTarget import org.matrix.android.sdk.api.MatrixCallback -import org.matrix.android.sdk.api.extensions.orFalse import org.matrix.android.sdk.api.session.file.FileService import java.io.File @@ -117,8 +116,8 @@ abstract class BaseAttachmentProvider(val imageContentRenderer: ImageContentRend } }) - if (data.url?.startsWith("content://").orFalse() && data.allowNonMxcUrls) { - target.onVideoURLReady(info.uid, data.url!!) + if (data.url?.startsWith("content://") == true && data.allowNonMxcUrls) { + target.onVideoURLReady(info.uid, data.url) } else { target.onVideoFileLoading(info.uid) fileService.downloadFile( @@ -130,7 +129,7 @@ abstract class BaseAttachmentProvider(val imageContentRenderer: ImageContentRend url = data.url, callback = object : MatrixCallback { override fun onSuccess(data: File) { - target.onVideoURLReady(info.uid, data) + target.onVideoFileReady(info.uid, data) } override fun onFailure(failure: Throwable) { diff --git a/vector/src/main/java/im/vector/app/features/media/ImageContentRenderer.kt b/vector/src/main/java/im/vector/app/features/media/ImageContentRenderer.kt index 28cead29df..968f02a065 100644 --- a/vector/src/main/java/im/vector/app/features/media/ImageContentRenderer.kt +++ b/vector/src/main/java/im/vector/app/features/media/ImageContentRenderer.kt @@ -51,7 +51,7 @@ interface AttachmentData : Parcelable { val mimeType: String? val url: String? val elementToDecrypt: ElementToDecrypt? - // If true will load non mxc url, be careful to set it only for images sent by you + // If true will load non mxc url, be careful to set it only for attachments sent by you val allowNonMxcUrls: Boolean }