Media: fix encrypted media
This commit is contained in:
parent
e3ad4ee06f
commit
5176499195
20 changed files with 73 additions and 54 deletions
|
|
@ -20,5 +20,5 @@ data class FileInfo(
|
|||
val mimetype: String?,
|
||||
val size: Long?,
|
||||
val thumbnailInfo: ThumbnailInfo?,
|
||||
val thumbnailSource: MatrixMediaSource?
|
||||
val thumbnailSource: MediaSource?
|
||||
)
|
||||
|
|
|
|||
|
|
@ -22,6 +22,6 @@ data class ImageInfo(
|
|||
val mimetype: String?,
|
||||
val size: Long?,
|
||||
val thumbnailInfo: ThumbnailInfo?,
|
||||
val thumbnailSource: MatrixMediaSource?,
|
||||
val thumbnailSource: MediaSource?,
|
||||
val blurhash: String?
|
||||
)
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@ interface MatrixMediaLoader {
|
|||
* @param url to fetch the content for.
|
||||
* @return a [Result] of ByteArray. It contains the binary data for the media.
|
||||
*/
|
||||
suspend fun loadMediaContent(source: MatrixMediaSource): Result<ByteArray>
|
||||
suspend fun loadMediaContent(source: MediaSource): Result<ByteArray>
|
||||
|
||||
/**
|
||||
* @param url to fetch the data for.
|
||||
|
|
@ -29,12 +29,12 @@ interface MatrixMediaLoader {
|
|||
* @param height: the desired height for rescaling the media as thumbnail
|
||||
* @return a [Result] of ByteArray. It contains the binary data for the media.
|
||||
*/
|
||||
suspend fun loadMediaThumbnail(source: MatrixMediaSource, width: Long, height: Long): Result<ByteArray>
|
||||
suspend fun loadMediaThumbnail(source: MediaSource, width: Long, height: Long): Result<ByteArray>
|
||||
|
||||
/**
|
||||
* @param url to fetch the data for.
|
||||
* @param mimeType: optional mime type
|
||||
* @return a [Result] of [MediaFile]
|
||||
*/
|
||||
suspend fun loadMediaFile(source: MatrixMediaSource, mimeType: String?): Result<MediaFile>
|
||||
suspend fun loadMediaFile(source: MediaSource, mimeType: String?): Result<MediaFile>
|
||||
}
|
||||
|
|
|
|||
|
|
@ -20,6 +20,13 @@ import android.os.Parcelable
|
|||
import kotlinx.parcelize.Parcelize
|
||||
|
||||
@Parcelize
|
||||
data class MatrixMediaSource(
|
||||
val url: String
|
||||
data class MediaSource(
|
||||
/**
|
||||
* Url of the media
|
||||
*/
|
||||
val url: String,
|
||||
/**
|
||||
* This is used to hold data for encrypted media
|
||||
*/
|
||||
val json: String? = null,
|
||||
) : Parcelable
|
||||
|
|
@ -23,6 +23,6 @@ data class VideoInfo(
|
|||
val mimetype: String?,
|
||||
val size: Long?,
|
||||
val thumbnailInfo: ThumbnailInfo?,
|
||||
val thumbnailSource: MatrixMediaSource?,
|
||||
val thumbnailSource: MediaSource?,
|
||||
val blurhash: String?
|
||||
)
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@ import io.element.android.libraries.matrix.api.core.UserId
|
|||
import io.element.android.libraries.matrix.api.media.AudioInfo
|
||||
import io.element.android.libraries.matrix.api.media.FileInfo
|
||||
import io.element.android.libraries.matrix.api.media.ImageInfo
|
||||
import io.element.android.libraries.matrix.api.media.MatrixMediaSource
|
||||
import io.element.android.libraries.matrix.api.media.MediaSource
|
||||
import io.element.android.libraries.matrix.api.media.VideoInfo
|
||||
|
||||
sealed interface EventContent
|
||||
|
|
@ -107,25 +107,25 @@ data class EmoteMessageType(
|
|||
|
||||
data class ImageMessageType(
|
||||
val body: String,
|
||||
val source: MatrixMediaSource,
|
||||
val source: MediaSource,
|
||||
val info: ImageInfo?
|
||||
) : MessageType
|
||||
|
||||
data class AudioMessageType(
|
||||
val body: String,
|
||||
val source: MatrixMediaSource,
|
||||
val source: MediaSource,
|
||||
val info: AudioInfo?
|
||||
) : MessageType
|
||||
|
||||
data class VideoMessageType(
|
||||
val body: String,
|
||||
val source: MatrixMediaSource,
|
||||
val source: MediaSource,
|
||||
val info: VideoInfo?
|
||||
) : MessageType
|
||||
|
||||
data class FileMessageType(
|
||||
val body: String,
|
||||
val source: MatrixMediaSource,
|
||||
val source: MediaSource,
|
||||
val info: FileInfo?
|
||||
) : MessageType
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue