mirror of
https://github.com/element-hq/element-android
synced 2024-11-28 05:31:21 +03:00
Add some javadoc from Matrix spec and add EncryptedFileInfo where necessary
This commit is contained in:
parent
8e76700c8d
commit
707a4712fc
17 changed files with 343 additions and 21 deletions
|
@ -21,7 +21,18 @@ import com.squareup.moshi.JsonClass
|
||||||
|
|
||||||
@JsonClass(generateAdapter = true)
|
@JsonClass(generateAdapter = true)
|
||||||
data class AudioInfo(
|
data class AudioInfo(
|
||||||
|
/**
|
||||||
|
* The mimetype of the audio e.g. "audio/aac".
|
||||||
|
*/
|
||||||
@Json(name = "mimetype") val mimeType: String,
|
@Json(name = "mimetype") val mimeType: String,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The size of the audio clip in bytes.
|
||||||
|
*/
|
||||||
@Json(name = "size") val size: Long = 0,
|
@Json(name = "size") val size: Long = 0,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The duration of the audio in milliseconds.
|
||||||
|
*/
|
||||||
@Json(name = "duration") val duration: Int = 0
|
@Json(name = "duration") val duration: Int = 0
|
||||||
)
|
)
|
|
@ -18,11 +18,32 @@ package im.vector.matrix.android.api.session.room.model.message
|
||||||
|
|
||||||
import com.squareup.moshi.Json
|
import com.squareup.moshi.Json
|
||||||
import com.squareup.moshi.JsonClass
|
import com.squareup.moshi.JsonClass
|
||||||
|
import im.vector.matrix.android.internal.crypto.model.rest.EncryptedFileInfo
|
||||||
|
|
||||||
@JsonClass(generateAdapter = true)
|
@JsonClass(generateAdapter = true)
|
||||||
data class FileInfo(
|
data class FileInfo(
|
||||||
|
/**
|
||||||
|
* The mimetype of the file e.g. application/msword.
|
||||||
|
*/
|
||||||
@Json(name = "mimetype") val mimeType: String?,
|
@Json(name = "mimetype") val mimeType: String?,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The size of the file in bytes.
|
||||||
|
*/
|
||||||
@Json(name = "size") val size: Long = 0,
|
@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_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
|
||||||
)
|
)
|
|
@ -18,15 +18,52 @@ package im.vector.matrix.android.api.session.room.model.message
|
||||||
|
|
||||||
import com.squareup.moshi.Json
|
import com.squareup.moshi.Json
|
||||||
import com.squareup.moshi.JsonClass
|
import com.squareup.moshi.JsonClass
|
||||||
|
import im.vector.matrix.android.internal.crypto.model.rest.EncryptedFileInfo
|
||||||
|
|
||||||
@JsonClass(generateAdapter = true)
|
@JsonClass(generateAdapter = true)
|
||||||
data class ImageInfo(
|
data class ImageInfo(
|
||||||
|
/**
|
||||||
|
* The mimetype of the image, e.g. "image/jpeg".
|
||||||
|
*/
|
||||||
@Json(name = "mimetype") val mimeType: String?,
|
@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,
|
@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,
|
@Json(name = "h") val height: Int = 0,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Size of the image in bytes.
|
||||||
|
*/
|
||||||
@Json(name = "size") val size: Int = 0,
|
@Json(name = "size") val size: Int = 0,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Not documented
|
||||||
|
*/
|
||||||
@Json(name = "rotation") val rotation: Int = 0,
|
@Json(name = "rotation") val rotation: Int = 0,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Not documented
|
||||||
|
*/
|
||||||
@Json(name = "orientation") val orientation: Int = 0,
|
@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_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
|
||||||
)
|
)
|
|
@ -18,9 +18,22 @@ package im.vector.matrix.android.api.session.room.model.message
|
||||||
|
|
||||||
import com.squareup.moshi.Json
|
import com.squareup.moshi.Json
|
||||||
import com.squareup.moshi.JsonClass
|
import com.squareup.moshi.JsonClass
|
||||||
|
import im.vector.matrix.android.internal.crypto.model.rest.EncryptedFileInfo
|
||||||
|
|
||||||
@JsonClass(generateAdapter = true)
|
@JsonClass(generateAdapter = true)
|
||||||
data class LocationInfo(
|
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_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
|
||||||
)
|
)
|
|
@ -20,13 +20,35 @@ import com.squareup.moshi.Json
|
||||||
import com.squareup.moshi.JsonClass
|
import com.squareup.moshi.JsonClass
|
||||||
import im.vector.matrix.android.api.session.events.model.Content
|
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.api.session.room.model.relation.RelationDefaultContent
|
||||||
|
import im.vector.matrix.android.internal.crypto.model.rest.EncryptedFileInfo
|
||||||
|
|
||||||
@JsonClass(generateAdapter = true)
|
@JsonClass(generateAdapter = true)
|
||||||
data class MessageAudioContent(
|
data class MessageAudioContent(
|
||||||
|
/**
|
||||||
|
* Not documented
|
||||||
|
*/
|
||||||
@Json(name = "msgtype") override val type: String,
|
@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 = "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 = "url") val url: String? = null,
|
||||||
|
|
||||||
@Json(name = "m.relates_to") override val relatesTo: RelationDefaultContent? = null,
|
@Json(name = "m.relates_to") override val relatesTo: RelationDefaultContent? = null,
|
||||||
@Json(name = "m.new_content") override val newContent: Content? = null
|
@Json(name = "m.new_content") override val newContent: Content? = null,
|
||||||
) : MessageContent
|
|
||||||
|
/**
|
||||||
|
* 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
|
|
@ -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?
|
||||||
|
}
|
|
@ -20,14 +20,37 @@ import com.squareup.moshi.Json
|
||||||
import com.squareup.moshi.JsonClass
|
import com.squareup.moshi.JsonClass
|
||||||
import im.vector.matrix.android.api.session.events.model.Content
|
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.api.session.room.model.relation.RelationDefaultContent
|
||||||
|
import im.vector.matrix.android.internal.crypto.model.rest.EncryptedFileInfo
|
||||||
|
|
||||||
@JsonClass(generateAdapter = true)
|
@JsonClass(generateAdapter = true)
|
||||||
data class MessageFileContent(
|
data class MessageFileContent(
|
||||||
|
/**
|
||||||
|
* Not documented
|
||||||
|
*/
|
||||||
@Json(name = "msgtype") override val type: String,
|
@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,
|
@Json(name = "body") override val body: String,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The original filename of the uploaded file.
|
||||||
|
*/
|
||||||
@Json(name = "filename") val filename: String? = null,
|
@Json(name = "filename") val filename: String? = null,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Information about the file referred to in url.
|
||||||
|
*/
|
||||||
@Json(name = "info") val info: FileInfo? = null,
|
@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 = "url") val url: String? = null,
|
||||||
|
|
||||||
@Json(name = "m.relates_to") override val relatesTo: RelationDefaultContent? = null,
|
@Json(name = "m.relates_to") override val relatesTo: RelationDefaultContent? = null,
|
||||||
@Json(name = "m.new_content") override val newContent: Content? = null
|
@Json(name = "m.new_content") override val newContent: Content? = null,
|
||||||
) : MessageContent
|
|
||||||
|
@Json(name = "file") override val encryptedFileInfo: EncryptedFileInfo? = null
|
||||||
|
) : MessageEncyptedContent
|
|
@ -20,13 +20,36 @@ import com.squareup.moshi.Json
|
||||||
import com.squareup.moshi.JsonClass
|
import com.squareup.moshi.JsonClass
|
||||||
import im.vector.matrix.android.api.session.events.model.Content
|
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.api.session.room.model.relation.RelationDefaultContent
|
||||||
|
import im.vector.matrix.android.internal.crypto.model.rest.EncryptedFileInfo
|
||||||
|
|
||||||
@JsonClass(generateAdapter = true)
|
@JsonClass(generateAdapter = true)
|
||||||
data class MessageImageContent(
|
data class MessageImageContent(
|
||||||
|
/**
|
||||||
|
* Required. Must be 'm.image'.
|
||||||
|
*/
|
||||||
@Json(name = "msgtype") override val type: String,
|
@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,
|
@Json(name = "body") override val body: String,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Metadata about the image referred to in url.
|
||||||
|
*/
|
||||||
@Json(name = "info") val info: ImageInfo? = null,
|
@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 = "url") val url: String? = null,
|
||||||
|
|
||||||
@Json(name = "m.relates_to") override val relatesTo: RelationDefaultContent? = null,
|
@Json(name = "m.relates_to") override val relatesTo: RelationDefaultContent? = null,
|
||||||
@Json(name = "m.new_content") override val newContent: Content? = null
|
@Json(name = "m.new_content") override val newContent: Content? = null,
|
||||||
) : MessageContent
|
|
||||||
|
/**
|
||||||
|
* 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
|
|
@ -23,10 +23,26 @@ import im.vector.matrix.android.api.session.room.model.relation.RelationDefaultC
|
||||||
|
|
||||||
@JsonClass(generateAdapter = true)
|
@JsonClass(generateAdapter = true)
|
||||||
data class MessageLocationContent(
|
data class MessageLocationContent(
|
||||||
|
/**
|
||||||
|
* Not documented
|
||||||
|
*/
|
||||||
@Json(name = "msgtype") override val type: String,
|
@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,
|
@Json(name = "body") override val body: String,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Required. A geo URI representing this location.
|
||||||
|
*/
|
||||||
@Json(name = "geo_uri") val geoUri: String,
|
@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.relates_to") override val relatesTo: RelationDefaultContent? = null,
|
||||||
@Json(name = "m.new_content") override val newContent: Content? = null
|
@Json(name = "m.new_content") override val newContent: Content? = null
|
||||||
) : MessageContent
|
) : MessageContent
|
|
@ -20,13 +20,35 @@ import com.squareup.moshi.Json
|
||||||
import com.squareup.moshi.JsonClass
|
import com.squareup.moshi.JsonClass
|
||||||
import im.vector.matrix.android.api.session.events.model.Content
|
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.api.session.room.model.relation.RelationDefaultContent
|
||||||
|
import im.vector.matrix.android.internal.crypto.model.rest.EncryptedFileInfo
|
||||||
|
|
||||||
@JsonClass(generateAdapter = true)
|
@JsonClass(generateAdapter = true)
|
||||||
data class MessageVideoContent(
|
data class MessageVideoContent(
|
||||||
|
/**
|
||||||
|
* Required. Must be 'm.video'.
|
||||||
|
*/
|
||||||
@Json(name = "msgtype") override val type: String,
|
@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 = "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 = "url") val url: String? = null,
|
||||||
|
|
||||||
@Json(name = "m.relates_to") override val relatesTo: RelationDefaultContent? = null,
|
@Json(name = "m.relates_to") override val relatesTo: RelationDefaultContent? = null,
|
||||||
@Json(name = "m.new_content") override val newContent: Content? = null
|
@Json(name = "m.new_content") override val newContent: Content? = null,
|
||||||
) : MessageContent
|
|
||||||
|
/**
|
||||||
|
* 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
|
|
@ -21,8 +21,23 @@ import com.squareup.moshi.JsonClass
|
||||||
|
|
||||||
@JsonClass(generateAdapter = true)
|
@JsonClass(generateAdapter = true)
|
||||||
data class ThumbnailInfo(
|
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,
|
@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,
|
@Json(name = "h") val height: Int = 0,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Size of the image in bytes.
|
||||||
|
*/
|
||||||
@Json(name = "size") val size: Long = 0,
|
@Json(name = "size") val size: Long = 0,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The mimetype of the image, e.g. "image/jpeg".
|
||||||
|
*/
|
||||||
@Json(name = "mimetype") val mimeType: String
|
@Json(name = "mimetype") val mimeType: String
|
||||||
)
|
)
|
|
@ -18,14 +18,47 @@ package im.vector.matrix.android.api.session.room.model.message
|
||||||
|
|
||||||
import com.squareup.moshi.Json
|
import com.squareup.moshi.Json
|
||||||
import com.squareup.moshi.JsonClass
|
import com.squareup.moshi.JsonClass
|
||||||
|
import im.vector.matrix.android.internal.crypto.model.rest.EncryptedFileInfo
|
||||||
|
|
||||||
@JsonClass(generateAdapter = true)
|
@JsonClass(generateAdapter = true)
|
||||||
data class VideoInfo(
|
data class VideoInfo(
|
||||||
|
/**
|
||||||
|
* The mimetype of the video e.g. "video/mp4".
|
||||||
|
*/
|
||||||
@Json(name = "mimetype") val mimeType: String,
|
@Json(name = "mimetype") val mimeType: String,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The width of the video in pixels.
|
||||||
|
*/
|
||||||
@Json(name = "w") val width: Int = 0,
|
@Json(name = "w") val width: Int = 0,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The height of the video in pixels.
|
||||||
|
*/
|
||||||
@Json(name = "h") val height: Int = 0,
|
@Json(name = "h") val height: Int = 0,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The size of the video in bytes.
|
||||||
|
*/
|
||||||
@Json(name = "size") val size: Long = 0,
|
@Json(name = "size") val size: Long = 0,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The duration of the video in milliseconds.
|
||||||
|
*/
|
||||||
@Json(name = "duration") val duration: Int = 0,
|
@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_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
|
||||||
)
|
)
|
|
@ -15,14 +15,48 @@
|
||||||
*/
|
*/
|
||||||
package im.vector.matrix.android.internal.crypto.model.rest
|
package im.vector.matrix.android.internal.crypto.model.rest
|
||||||
|
|
||||||
|
import com.squareup.moshi.Json
|
||||||
import com.squareup.moshi.JsonClass
|
import com.squareup.moshi.JsonClass
|
||||||
|
|
||||||
|
/**
|
||||||
|
* In Matrix specs: EncryptedFile
|
||||||
|
*/
|
||||||
@JsonClass(generateAdapter = true)
|
@JsonClass(generateAdapter = true)
|
||||||
data class EncryptedFileInfo(
|
data class EncryptedFileInfo(
|
||||||
|
/**
|
||||||
|
* Required. The URL to the file.
|
||||||
|
*/
|
||||||
|
@Json(name = "url")
|
||||||
var url: String? = null,
|
var url: String? = null,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Not documented
|
||||||
|
*/
|
||||||
|
@Json(name = "mimetype")
|
||||||
var mimetype: String,
|
var mimetype: String,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Required. A JSON Web Key object.
|
||||||
|
*/
|
||||||
|
@Json(name = "key")
|
||||||
var key: EncryptedFileKey? = null,
|
var key: EncryptedFileKey? = null,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Required. The Initialisation Vector used by AES-CTR, encoded as unpadded base64.
|
||||||
|
*/
|
||||||
|
@Json(name = "iv")
|
||||||
var iv: String,
|
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>,
|
var hashes: Map<String, String>,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Required. Version of the encrypted attachments protocol. Must be "v2".
|
||||||
|
*/
|
||||||
|
@Json(name = "v")
|
||||||
var v: String? = null
|
var v: String? = null
|
||||||
)
|
)
|
||||||
|
|
|
@ -15,14 +15,39 @@
|
||||||
*/
|
*/
|
||||||
package im.vector.matrix.android.internal.crypto.model.rest
|
package im.vector.matrix.android.internal.crypto.model.rest
|
||||||
|
|
||||||
|
import com.squareup.moshi.Json
|
||||||
import com.squareup.moshi.JsonClass
|
import com.squareup.moshi.JsonClass
|
||||||
|
|
||||||
@JsonClass(generateAdapter = true)
|
@JsonClass(generateAdapter = true)
|
||||||
data class EncryptedFileKey(
|
data class EncryptedFileKey(
|
||||||
|
/**
|
||||||
|
* Required. Algorithm. Must be "A256CTR".
|
||||||
|
*/
|
||||||
|
@Json(name = "alg")
|
||||||
var alg: String,
|
var alg: String,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Required. Extractable. Must be true. This is a W3C extension.
|
||||||
|
*/
|
||||||
|
@Json(name = "ext")
|
||||||
var ext: Boolean? = null,
|
var ext: Boolean? = null,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Required. Key operations. Must at least contain "encrypt" and "decrypt".
|
||||||
|
*/
|
||||||
|
@Json(name = "key_ops")
|
||||||
var key_ops: List<String>,
|
var key_ops: List<String>,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Required. Key type. Must be "oct".
|
||||||
|
*/
|
||||||
|
@Json(name = "kty")
|
||||||
var kty: String,
|
var kty: String,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Required. The key, encoded as urlsafe unpadded base64.
|
||||||
|
*/
|
||||||
|
@Json(name = "k")
|
||||||
var k: String
|
var k: String
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
@ -124,7 +124,7 @@ internal class UploadContentWorker(context: Context, params: WorkerParameters) :
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun MessageVideoContent.update(url: String, thumbnailUrl: String?): MessageVideoContent {
|
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 {
|
private fun MessageFileContent.update(url: String): MessageFileContent {
|
||||||
|
|
|
@ -179,7 +179,7 @@ internal class LocalEchoEventFactory @Inject constructor(private val credentials
|
||||||
val content = MessageVideoContent(
|
val content = MessageVideoContent(
|
||||||
type = MessageType.MSGTYPE_VIDEO,
|
type = MessageType.MSGTYPE_VIDEO,
|
||||||
body = attachment.name ?: "video",
|
body = attachment.name ?: "video",
|
||||||
info = VideoInfo(
|
videoInfo = VideoInfo(
|
||||||
mimeType = attachment.mimeType,
|
mimeType = attachment.mimeType,
|
||||||
width = width,
|
width = width,
|
||||||
height = height,
|
height = height,
|
||||||
|
@ -198,7 +198,7 @@ internal class LocalEchoEventFactory @Inject constructor(private val credentials
|
||||||
val content = MessageAudioContent(
|
val content = MessageAudioContent(
|
||||||
type = MessageType.MSGTYPE_AUDIO,
|
type = MessageType.MSGTYPE_AUDIO,
|
||||||
body = attachment.name ?: "audio",
|
body = attachment.name ?: "audio",
|
||||||
info = AudioInfo(
|
audioInfo = AudioInfo(
|
||||||
mimeType = attachment.mimeType ?: "audio/mpeg",
|
mimeType = attachment.mimeType ?: "audio/mpeg",
|
||||||
size = attachment.size
|
size = attachment.size
|
||||||
),
|
),
|
||||||
|
|
|
@ -220,10 +220,10 @@ class MessageItemFactory @Inject constructor(
|
||||||
val (maxWidth, maxHeight) = timelineMediaSizeProvider.getMaxSize()
|
val (maxWidth, maxHeight) = timelineMediaSizeProvider.getMaxSize()
|
||||||
val thumbnailData = ImageContentRenderer.Data(
|
val thumbnailData = ImageContentRenderer.Data(
|
||||||
filename = messageContent.body,
|
filename = messageContent.body,
|
||||||
url = messageContent.info?.thumbnailUrl,
|
url = messageContent.videoInfo?.thumbnailUrl,
|
||||||
height = messageContent.info?.height,
|
height = messageContent.videoInfo?.height,
|
||||||
maxHeight = maxHeight,
|
maxHeight = maxHeight,
|
||||||
width = messageContent.info?.width,
|
width = messageContent.videoInfo?.width,
|
||||||
maxWidth = maxWidth
|
maxWidth = maxWidth
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue