From 707a4712fc3a94252dd3703c50624a4e4dc54e16 Mon Sep 17 00:00:00 2001 From: Benoit Marty <benoit.marty@gmail.com> Date: Fri, 21 Jun 2019 15:08:09 +0200 Subject: [PATCH] Add some javadoc from Matrix spec and add EncryptedFileInfo where necessary --- .../session/room/model/message/AudioInfo.kt | 11 ++++++ .../session/room/model/message/FileInfo.kt | 23 ++++++++++- .../session/room/model/message/ImageInfo.kt | 39 ++++++++++++++++++- .../room/model/message/LocationInfo.kt | 15 ++++++- .../room/model/message/MessageAudioContent.kt | 28 +++++++++++-- .../model/message/MessageEncyptedContent.kt | 27 +++++++++++++ .../room/model/message/MessageFileContent.kt | 27 ++++++++++++- .../room/model/message/MessageImageContent.kt | 27 ++++++++++++- .../model/message/MessageLocationContent.kt | 18 ++++++++- .../room/model/message/MessageVideoContent.kt | 28 +++++++++++-- .../room/model/message/ThumbnailInfo.kt | 15 +++++++ .../session/room/model/message/VideoInfo.kt | 35 ++++++++++++++++- .../crypto/model/rest/EncryptedFileInfo.kt | 34 ++++++++++++++++ .../crypto/model/rest/EncryptedFileKey.kt | 25 ++++++++++++ .../session/content/UploadContentWorker.kt | 2 +- .../room/send/LocalEchoEventFactory.kt | 4 +- .../timeline/factory/MessageItemFactory.kt | 6 +-- 17 files changed, 343 insertions(+), 21 deletions(-) create mode 100644 matrix-sdk-android/src/main/java/im/vector/matrix/android/api/session/room/model/message/MessageEncyptedContent.kt diff --git a/matrix-sdk-android/src/main/java/im/vector/matrix/android/api/session/room/model/message/AudioInfo.kt b/matrix-sdk-android/src/main/java/im/vector/matrix/android/api/session/room/model/message/AudioInfo.kt index 6a28a1b349..de30d46024 100644 --- a/matrix-sdk-android/src/main/java/im/vector/matrix/android/api/session/room/model/message/AudioInfo.kt +++ b/matrix-sdk-android/src/main/java/im/vector/matrix/android/api/session/room/model/message/AudioInfo.kt @@ -21,7 +21,18 @@ import com.squareup.moshi.JsonClass @JsonClass(generateAdapter = true) data class AudioInfo( + /** + * The mimetype of the audio e.g. "audio/aac". + */ @Json(name = "mimetype") val mimeType: String, + + /** + * The size of the audio clip in bytes. + */ @Json(name = "size") val size: Long = 0, + + /** + * The duration of the audio in milliseconds. + */ @Json(name = "duration") val duration: Int = 0 ) \ No newline at end of file diff --git a/matrix-sdk-android/src/main/java/im/vector/matrix/android/api/session/room/model/message/FileInfo.kt b/matrix-sdk-android/src/main/java/im/vector/matrix/android/api/session/room/model/message/FileInfo.kt index 16dc4d23f1..d5dfb04f19 100644 --- a/matrix-sdk-android/src/main/java/im/vector/matrix/android/api/session/room/model/message/FileInfo.kt +++ b/matrix-sdk-android/src/main/java/im/vector/matrix/android/api/session/room/model/message/FileInfo.kt @@ -18,11 +18,32 @@ package im.vector.matrix.android.api.session.room.model.message import com.squareup.moshi.Json import com.squareup.moshi.JsonClass +import im.vector.matrix.android.internal.crypto.model.rest.EncryptedFileInfo @JsonClass(generateAdapter = true) data class FileInfo( + /** + * The mimetype of the file e.g. application/msword. + */ @Json(name = "mimetype") val mimeType: String?, + + /** + * The size of the file in bytes. + */ @Json(name = "size") val size: Long = 0, + + /** + * Metadata about the image referred to in thumbnail_url. + */ @Json(name = "thumbnail_info") val thumbnailInfo: ThumbnailInfo? = null, - @Json(name = "thumbnail_url") val thumbnailUrl: String? = null + + /** + * The URL to the thumbnail of the file. Only present if the thumbnail is unencrypted. + */ + @Json(name = "thumbnail_url") val thumbnailUrl: String? = null, + + /** + * Information on the encrypted thumbnail file, as specified in End-to-end encryption. Only present if the thumbnail is encrypted. + */ + @Json(name = "thumbnail_file") val thumbnailFile: EncryptedFileInfo? = null ) \ No newline at end of file diff --git a/matrix-sdk-android/src/main/java/im/vector/matrix/android/api/session/room/model/message/ImageInfo.kt b/matrix-sdk-android/src/main/java/im/vector/matrix/android/api/session/room/model/message/ImageInfo.kt index 69e88e052c..729bc604c1 100644 --- a/matrix-sdk-android/src/main/java/im/vector/matrix/android/api/session/room/model/message/ImageInfo.kt +++ b/matrix-sdk-android/src/main/java/im/vector/matrix/android/api/session/room/model/message/ImageInfo.kt @@ -18,15 +18,52 @@ package im.vector.matrix.android.api.session.room.model.message import com.squareup.moshi.Json import com.squareup.moshi.JsonClass +import im.vector.matrix.android.internal.crypto.model.rest.EncryptedFileInfo @JsonClass(generateAdapter = true) data class ImageInfo( + /** + * The mimetype of the image, e.g. "image/jpeg". + */ @Json(name = "mimetype") val mimeType: String?, + + /** + * The intended display width of the image in pixels. This may differ from the intrinsic dimensions of the image file. + */ @Json(name = "w") val width: Int = 0, + + /** + * The intended display height of the image in pixels. This may differ from the intrinsic dimensions of the image file. + */ @Json(name = "h") val height: Int = 0, + + /** + * Size of the image in bytes. + */ @Json(name = "size") val size: Int = 0, + + /** + * Not documented + */ @Json(name = "rotation") val rotation: Int = 0, + + /** + * Not documented + */ @Json(name = "orientation") val orientation: Int = 0, + + /** + * Metadata about the image referred to in thumbnail_url. + */ @Json(name = "thumbnail_info") val thumbnailInfo: ThumbnailInfo? = null, - @Json(name = "thumbnail_url") val thumbnailUrl: String? = null + + /** + * The URL (typically MXC URI) to a thumbnail of the image. Only present if the thumbnail is unencrypted. + */ + @Json(name = "thumbnail_url") val thumbnailUrl: String? = null, + + /** + * Information on the encrypted thumbnail file, as specified in End-to-end encryption. Only present if the thumbnail is encrypted. + */ + @Json(name = "thumbnail_file") val thumbnailFile: EncryptedFileInfo? = null ) \ No newline at end of file diff --git a/matrix-sdk-android/src/main/java/im/vector/matrix/android/api/session/room/model/message/LocationInfo.kt b/matrix-sdk-android/src/main/java/im/vector/matrix/android/api/session/room/model/message/LocationInfo.kt index 0f911a9bcd..f00d48826b 100644 --- a/matrix-sdk-android/src/main/java/im/vector/matrix/android/api/session/room/model/message/LocationInfo.kt +++ b/matrix-sdk-android/src/main/java/im/vector/matrix/android/api/session/room/model/message/LocationInfo.kt @@ -18,9 +18,22 @@ package im.vector.matrix.android.api.session.room.model.message import com.squareup.moshi.Json import com.squareup.moshi.JsonClass +import im.vector.matrix.android.internal.crypto.model.rest.EncryptedFileInfo @JsonClass(generateAdapter = true) data class LocationInfo( + /** + * The URL to the thumbnail of the file. Only present if the thumbnail is unencrypted. + */ @Json(name = "thumbnail_url") val thumbnailUrl: String? = null, - @Json(name = "thumbnail_info") val thumbnailInfo: ThumbnailInfo? = null + + /** + * Metadata about the image referred to in thumbnail_url. + */ + @Json(name = "thumbnail_info") val thumbnailInfo: ThumbnailInfo? = null, + + /** + * Information on the encrypted thumbnail file, as specified in End-to-end encryption. Only present if the thumbnail is encrypted. + */ + @Json(name = "thumbnail_file") val thumbnailFile: EncryptedFileInfo? = null ) \ No newline at end of file diff --git a/matrix-sdk-android/src/main/java/im/vector/matrix/android/api/session/room/model/message/MessageAudioContent.kt b/matrix-sdk-android/src/main/java/im/vector/matrix/android/api/session/room/model/message/MessageAudioContent.kt index 9b33b00758..7a9ccf7ace 100644 --- a/matrix-sdk-android/src/main/java/im/vector/matrix/android/api/session/room/model/message/MessageAudioContent.kt +++ b/matrix-sdk-android/src/main/java/im/vector/matrix/android/api/session/room/model/message/MessageAudioContent.kt @@ -20,13 +20,35 @@ import com.squareup.moshi.Json import com.squareup.moshi.JsonClass import im.vector.matrix.android.api.session.events.model.Content import im.vector.matrix.android.api.session.room.model.relation.RelationDefaultContent +import im.vector.matrix.android.internal.crypto.model.rest.EncryptedFileInfo @JsonClass(generateAdapter = true) data class MessageAudioContent( + /** + * Not documented + */ @Json(name = "msgtype") override val type: String, + + /** + * Required. A description of the audio e.g. 'Bee Gees - Stayin' Alive', or some kind of content description for accessibility e.g. 'audio attachment'. + */ @Json(name = "body") override val body: String, - @Json(name = "info") val info: AudioInfo? = null, + + /** + * Metadata for the audio clip referred to in url. + */ + @Json(name = "info") val audioInfo: AudioInfo? = null, + + /** + * Required. Required if the file is not encrypted. The URL (typically MXC URI) to the audio clip. + */ @Json(name = "url") val url: String? = null, + @Json(name = "m.relates_to") override val relatesTo: RelationDefaultContent? = null, - @Json(name = "m.new_content") override val newContent: Content? = null -) : MessageContent \ No newline at end of file + @Json(name = "m.new_content") override val newContent: Content? = null, + + /** + * Required if the file is encrypted. Information on the encrypted file, as specified in End-to-end encryption. + */ + @Json(name = "file") override val encryptedFileInfo: EncryptedFileInfo? = null +) : MessageEncyptedContent \ No newline at end of file diff --git a/matrix-sdk-android/src/main/java/im/vector/matrix/android/api/session/room/model/message/MessageEncyptedContent.kt b/matrix-sdk-android/src/main/java/im/vector/matrix/android/api/session/room/model/message/MessageEncyptedContent.kt new file mode 100644 index 0000000000..3a98701c2f --- /dev/null +++ b/matrix-sdk-android/src/main/java/im/vector/matrix/android/api/session/room/model/message/MessageEncyptedContent.kt @@ -0,0 +1,27 @@ +/* + * Copyright 2019 New Vector Ltd + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package im.vector.matrix.android.api.session.room.model.message + +import im.vector.matrix.android.internal.crypto.model.rest.EncryptedFileInfo + + +/** + * Interface for message which can contains encrypted data + */ +interface MessageEncyptedContent : MessageContent { + val encryptedFileInfo: EncryptedFileInfo? +} \ No newline at end of file diff --git a/matrix-sdk-android/src/main/java/im/vector/matrix/android/api/session/room/model/message/MessageFileContent.kt b/matrix-sdk-android/src/main/java/im/vector/matrix/android/api/session/room/model/message/MessageFileContent.kt index 8f58294ca9..1b7f179885 100644 --- a/matrix-sdk-android/src/main/java/im/vector/matrix/android/api/session/room/model/message/MessageFileContent.kt +++ b/matrix-sdk-android/src/main/java/im/vector/matrix/android/api/session/room/model/message/MessageFileContent.kt @@ -20,14 +20,37 @@ import com.squareup.moshi.Json import com.squareup.moshi.JsonClass import im.vector.matrix.android.api.session.events.model.Content import im.vector.matrix.android.api.session.room.model.relation.RelationDefaultContent +import im.vector.matrix.android.internal.crypto.model.rest.EncryptedFileInfo @JsonClass(generateAdapter = true) data class MessageFileContent( + /** + * Not documented + */ @Json(name = "msgtype") override val type: String, + + /** + * Required. A human-readable description of the file. This is recommended to be the filename of the original upload. + */ @Json(name = "body") override val body: String, + + /** + * The original filename of the uploaded file. + */ @Json(name = "filename") val filename: String? = null, + + /** + * Information about the file referred to in url. + */ @Json(name = "info") val info: FileInfo? = null, + + /** + * Required. Required if the file is unencrypted. The URL (typically MXC URI) to the file. + */ @Json(name = "url") val url: String? = null, + @Json(name = "m.relates_to") override val relatesTo: RelationDefaultContent? = null, - @Json(name = "m.new_content") override val newContent: Content? = null -) : MessageContent \ No newline at end of file + @Json(name = "m.new_content") override val newContent: Content? = null, + + @Json(name = "file") override val encryptedFileInfo: EncryptedFileInfo? = null +) : MessageEncyptedContent \ No newline at end of file diff --git a/matrix-sdk-android/src/main/java/im/vector/matrix/android/api/session/room/model/message/MessageImageContent.kt b/matrix-sdk-android/src/main/java/im/vector/matrix/android/api/session/room/model/message/MessageImageContent.kt index 2c978b97b4..50feb4841f 100644 --- a/matrix-sdk-android/src/main/java/im/vector/matrix/android/api/session/room/model/message/MessageImageContent.kt +++ b/matrix-sdk-android/src/main/java/im/vector/matrix/android/api/session/room/model/message/MessageImageContent.kt @@ -20,13 +20,36 @@ import com.squareup.moshi.Json import com.squareup.moshi.JsonClass import im.vector.matrix.android.api.session.events.model.Content import im.vector.matrix.android.api.session.room.model.relation.RelationDefaultContent +import im.vector.matrix.android.internal.crypto.model.rest.EncryptedFileInfo @JsonClass(generateAdapter = true) data class MessageImageContent( + /** + * Required. Must be 'm.image'. + */ @Json(name = "msgtype") override val type: String, + + /** + * Required. A textual representation of the image. This could be the alt text of the image, the filename of the image, + * or some kind of content description for accessibility e.g. 'image attachment'. + */ @Json(name = "body") override val body: String, + + /** + * Metadata about the image referred to in url. + */ @Json(name = "info") val info: ImageInfo? = null, + + /** + * Required. Required if the file is unencrypted. The URL (typically MXC URI) to the image. + */ @Json(name = "url") val url: String? = null, + @Json(name = "m.relates_to") override val relatesTo: RelationDefaultContent? = null, - @Json(name = "m.new_content") override val newContent: Content? = null -) : MessageContent \ No newline at end of file + @Json(name = "m.new_content") override val newContent: Content? = null, + + /** + * Required if the file is encrypted. Information on the encrypted file, as specified in End-to-end encryption. + */ + @Json(name = "file") override val encryptedFileInfo: EncryptedFileInfo? = null +) : MessageEncyptedContent \ No newline at end of file diff --git a/matrix-sdk-android/src/main/java/im/vector/matrix/android/api/session/room/model/message/MessageLocationContent.kt b/matrix-sdk-android/src/main/java/im/vector/matrix/android/api/session/room/model/message/MessageLocationContent.kt index ddd67af9e4..deddec12a5 100644 --- a/matrix-sdk-android/src/main/java/im/vector/matrix/android/api/session/room/model/message/MessageLocationContent.kt +++ b/matrix-sdk-android/src/main/java/im/vector/matrix/android/api/session/room/model/message/MessageLocationContent.kt @@ -23,10 +23,26 @@ import im.vector.matrix.android.api.session.room.model.relation.RelationDefaultC @JsonClass(generateAdapter = true) data class MessageLocationContent( + /** + * Not documented + */ @Json(name = "msgtype") override val type: String, + + /** + * Required. A description of the location e.g. 'Big Ben, London, UK', or some kind of content description for accessibility e.g. 'location attachment'. + */ @Json(name = "body") override val body: String, + + /** + * Required. A geo URI representing this location. + */ @Json(name = "geo_uri") val geoUri: String, - @Json(name = "info") val info: LocationInfo? = null, + + /** + * + */ + @Json(name = "info") val locationInfo: LocationInfo? = null, + @Json(name = "m.relates_to") override val relatesTo: RelationDefaultContent? = null, @Json(name = "m.new_content") override val newContent: Content? = null ) : MessageContent \ No newline at end of file diff --git a/matrix-sdk-android/src/main/java/im/vector/matrix/android/api/session/room/model/message/MessageVideoContent.kt b/matrix-sdk-android/src/main/java/im/vector/matrix/android/api/session/room/model/message/MessageVideoContent.kt index 40c2994245..11845d4df7 100644 --- a/matrix-sdk-android/src/main/java/im/vector/matrix/android/api/session/room/model/message/MessageVideoContent.kt +++ b/matrix-sdk-android/src/main/java/im/vector/matrix/android/api/session/room/model/message/MessageVideoContent.kt @@ -20,13 +20,35 @@ import com.squareup.moshi.Json import com.squareup.moshi.JsonClass import im.vector.matrix.android.api.session.events.model.Content import im.vector.matrix.android.api.session.room.model.relation.RelationDefaultContent +import im.vector.matrix.android.internal.crypto.model.rest.EncryptedFileInfo @JsonClass(generateAdapter = true) data class MessageVideoContent( + /** + * Required. Must be 'm.video'. + */ @Json(name = "msgtype") override val type: String, + + /** + * Required. A description of the video e.g. 'Gangnam style', or some kind of content description for accessibility e.g. 'video attachment'. + */ @Json(name = "body") override val body: String, - @Json(name = "info") val info: VideoInfo? = null, + + /** + * Metadata about the video clip referred to in url. + */ + @Json(name = "info") val videoInfo: VideoInfo? = null, + + /** + * Required. Required if the file is unencrypted. The URL (typically MXC URI) to the video clip. + */ @Json(name = "url") val url: String? = null, + @Json(name = "m.relates_to") override val relatesTo: RelationDefaultContent? = null, - @Json(name = "m.new_content") override val newContent: Content? = null -) : MessageContent \ No newline at end of file + @Json(name = "m.new_content") override val newContent: Content? = null, + + /** + * Required if the file is encrypted. Information on the encrypted file, as specified in End-to-end encryption. + */ + @Json(name = "file") override val encryptedFileInfo: EncryptedFileInfo? = null +) : MessageEncyptedContent \ No newline at end of file diff --git a/matrix-sdk-android/src/main/java/im/vector/matrix/android/api/session/room/model/message/ThumbnailInfo.kt b/matrix-sdk-android/src/main/java/im/vector/matrix/android/api/session/room/model/message/ThumbnailInfo.kt index aa68d8f037..1e308d79fa 100644 --- a/matrix-sdk-android/src/main/java/im/vector/matrix/android/api/session/room/model/message/ThumbnailInfo.kt +++ b/matrix-sdk-android/src/main/java/im/vector/matrix/android/api/session/room/model/message/ThumbnailInfo.kt @@ -21,8 +21,23 @@ import com.squareup.moshi.JsonClass @JsonClass(generateAdapter = true) data class ThumbnailInfo( + /** + * The intended display width of the image in pixels. This may differ from the intrinsic dimensions of the image file. + */ @Json(name = "w") val width: Int = 0, + + /** + * The intended display height of the image in pixels. This may differ from the intrinsic dimensions of the image file. + */ @Json(name = "h") val height: Int = 0, + + /** + * Size of the image in bytes. + */ @Json(name = "size") val size: Long = 0, + + /** + * The mimetype of the image, e.g. "image/jpeg". + */ @Json(name = "mimetype") val mimeType: String ) \ No newline at end of file diff --git a/matrix-sdk-android/src/main/java/im/vector/matrix/android/api/session/room/model/message/VideoInfo.kt b/matrix-sdk-android/src/main/java/im/vector/matrix/android/api/session/room/model/message/VideoInfo.kt index 701a62728b..0622037896 100644 --- a/matrix-sdk-android/src/main/java/im/vector/matrix/android/api/session/room/model/message/VideoInfo.kt +++ b/matrix-sdk-android/src/main/java/im/vector/matrix/android/api/session/room/model/message/VideoInfo.kt @@ -18,14 +18,47 @@ package im.vector.matrix.android.api.session.room.model.message import com.squareup.moshi.Json import com.squareup.moshi.JsonClass +import im.vector.matrix.android.internal.crypto.model.rest.EncryptedFileInfo @JsonClass(generateAdapter = true) data class VideoInfo( + /** + * The mimetype of the video e.g. "video/mp4". + */ @Json(name = "mimetype") val mimeType: String, + + /** + * The width of the video in pixels. + */ @Json(name = "w") val width: Int = 0, + + /** + * The height of the video in pixels. + */ @Json(name = "h") val height: Int = 0, + + /** + * The size of the video in bytes. + */ @Json(name = "size") val size: Long = 0, + + /** + * The duration of the video in milliseconds. + */ @Json(name = "duration") val duration: Int = 0, + + /** + * Metadata about the image referred to in thumbnail_url. + */ @Json(name = "thumbnail_info") val thumbnailInfo: ThumbnailInfo? = null, - @Json(name = "thumbnail_url") val thumbnailUrl: String? = null + + /** + * The URL (typically MXC URI) to an image thumbnail of the video clip. Only present if the thumbnail is unencrypted. + */ + @Json(name = "thumbnail_url") val thumbnailUrl: String? = null, + + /** + * Information on the encrypted thumbnail file, as specified in End-to-end encryption. Only present if the thumbnail is encrypted. + */ + @Json(name = "thumbnail_file") val thumbnailFile: EncryptedFileInfo? = null ) \ No newline at end of file diff --git a/matrix-sdk-android/src/main/java/im/vector/matrix/android/internal/crypto/model/rest/EncryptedFileInfo.kt b/matrix-sdk-android/src/main/java/im/vector/matrix/android/internal/crypto/model/rest/EncryptedFileInfo.kt index 3e0d912f64..f483ba392d 100644 --- a/matrix-sdk-android/src/main/java/im/vector/matrix/android/internal/crypto/model/rest/EncryptedFileInfo.kt +++ b/matrix-sdk-android/src/main/java/im/vector/matrix/android/internal/crypto/model/rest/EncryptedFileInfo.kt @@ -15,14 +15,48 @@ */ package im.vector.matrix.android.internal.crypto.model.rest +import com.squareup.moshi.Json import com.squareup.moshi.JsonClass +/** + * In Matrix specs: EncryptedFile + */ @JsonClass(generateAdapter = true) data class EncryptedFileInfo( + /** + * Required. The URL to the file. + */ + @Json(name = "url") var url: String? = null, + + /** + * Not documented + */ + @Json(name = "mimetype") var mimetype: String, + + /** + * Required. A JSON Web Key object. + */ + @Json(name = "key") var key: EncryptedFileKey? = null, + + /** + * Required. The Initialisation Vector used by AES-CTR, encoded as unpadded base64. + */ + @Json(name = "iv") var iv: String, + + /** + * Required. A map from an algorithm name to a hash of the ciphertext, encoded as unpadded base64. + * Clients should support the SHA-256 hash, which uses the key "sha256". + */ + @Json(name = "hashes") var hashes: Map<String, String>, + + /** + * Required. Version of the encrypted attachments protocol. Must be "v2". + */ + @Json(name = "v") var v: String? = null ) diff --git a/matrix-sdk-android/src/main/java/im/vector/matrix/android/internal/crypto/model/rest/EncryptedFileKey.kt b/matrix-sdk-android/src/main/java/im/vector/matrix/android/internal/crypto/model/rest/EncryptedFileKey.kt index 433a3619d5..3ea603c0d2 100644 --- a/matrix-sdk-android/src/main/java/im/vector/matrix/android/internal/crypto/model/rest/EncryptedFileKey.kt +++ b/matrix-sdk-android/src/main/java/im/vector/matrix/android/internal/crypto/model/rest/EncryptedFileKey.kt @@ -15,14 +15,39 @@ */ package im.vector.matrix.android.internal.crypto.model.rest +import com.squareup.moshi.Json import com.squareup.moshi.JsonClass @JsonClass(generateAdapter = true) data class EncryptedFileKey( + /** + * Required. Algorithm. Must be "A256CTR". + */ + @Json(name = "alg") var alg: String, + + /** + * Required. Extractable. Must be true. This is a W3C extension. + */ + @Json(name = "ext") var ext: Boolean? = null, + + /** + * Required. Key operations. Must at least contain "encrypt" and "decrypt". + */ + @Json(name = "key_ops") var key_ops: List<String>, + + /** + * Required. Key type. Must be "oct". + */ + @Json(name = "kty") var kty: String, + + /** + * Required. The key, encoded as urlsafe unpadded base64. + */ + @Json(name = "k") var k: String ) diff --git a/matrix-sdk-android/src/main/java/im/vector/matrix/android/internal/session/content/UploadContentWorker.kt b/matrix-sdk-android/src/main/java/im/vector/matrix/android/internal/session/content/UploadContentWorker.kt index 4c3235e150..b459d28856 100644 --- a/matrix-sdk-android/src/main/java/im/vector/matrix/android/internal/session/content/UploadContentWorker.kt +++ b/matrix-sdk-android/src/main/java/im/vector/matrix/android/internal/session/content/UploadContentWorker.kt @@ -124,7 +124,7 @@ internal class UploadContentWorker(context: Context, params: WorkerParameters) : } private fun MessageVideoContent.update(url: String, thumbnailUrl: String?): MessageVideoContent { - return copy(url = url, info = info?.copy(thumbnailUrl = thumbnailUrl)) + return copy(url = url, videoInfo = videoInfo?.copy(thumbnailUrl = thumbnailUrl)) } private fun MessageFileContent.update(url: String): MessageFileContent { diff --git a/matrix-sdk-android/src/main/java/im/vector/matrix/android/internal/session/room/send/LocalEchoEventFactory.kt b/matrix-sdk-android/src/main/java/im/vector/matrix/android/internal/session/room/send/LocalEchoEventFactory.kt index 6e80e7c65c..a5437d1f4c 100644 --- a/matrix-sdk-android/src/main/java/im/vector/matrix/android/internal/session/room/send/LocalEchoEventFactory.kt +++ b/matrix-sdk-android/src/main/java/im/vector/matrix/android/internal/session/room/send/LocalEchoEventFactory.kt @@ -179,7 +179,7 @@ internal class LocalEchoEventFactory @Inject constructor(private val credentials val content = MessageVideoContent( type = MessageType.MSGTYPE_VIDEO, body = attachment.name ?: "video", - info = VideoInfo( + videoInfo = VideoInfo( mimeType = attachment.mimeType, width = width, height = height, @@ -198,7 +198,7 @@ internal class LocalEchoEventFactory @Inject constructor(private val credentials val content = MessageAudioContent( type = MessageType.MSGTYPE_AUDIO, body = attachment.name ?: "audio", - info = AudioInfo( + audioInfo = AudioInfo( mimeType = attachment.mimeType ?: "audio/mpeg", size = attachment.size ), diff --git a/vector/src/main/java/im/vector/riotredesign/features/home/room/detail/timeline/factory/MessageItemFactory.kt b/vector/src/main/java/im/vector/riotredesign/features/home/room/detail/timeline/factory/MessageItemFactory.kt index f3d40bc642..7eda1dacc2 100644 --- a/vector/src/main/java/im/vector/riotredesign/features/home/room/detail/timeline/factory/MessageItemFactory.kt +++ b/vector/src/main/java/im/vector/riotredesign/features/home/room/detail/timeline/factory/MessageItemFactory.kt @@ -220,10 +220,10 @@ class MessageItemFactory @Inject constructor( val (maxWidth, maxHeight) = timelineMediaSizeProvider.getMaxSize() val thumbnailData = ImageContentRenderer.Data( filename = messageContent.body, - url = messageContent.info?.thumbnailUrl, - height = messageContent.info?.height, + url = messageContent.videoInfo?.thumbnailUrl, + height = messageContent.videoInfo?.height, maxHeight = maxHeight, - width = messageContent.info?.width, + width = messageContent.videoInfo?.width, maxWidth = maxWidth )