mirror of
https://github.com/Novaloop-AG/element-x-android.git
synced 2026-11-02 12:07:28 +00:00
Merge pull request #7112 from element-hq/feature/bma/galleryMessages
Support gallery messages
This commit is contained in:
+36
@@ -0,0 +1,36 @@
|
||||
/*
|
||||
* Copyright (c) 2026 Element Creations Ltd.
|
||||
*
|
||||
* SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial.
|
||||
* Please see LICENSE files in the repository root for full details.
|
||||
*/
|
||||
|
||||
package io.element.android.libraries.matrix.api.media
|
||||
|
||||
import java.io.File
|
||||
|
||||
sealed interface GalleryItemInfo {
|
||||
val file: File
|
||||
|
||||
data class Image(
|
||||
override val file: File,
|
||||
val imageInfo: ImageInfo,
|
||||
val thumbnailFile: File?,
|
||||
) : GalleryItemInfo
|
||||
|
||||
data class Video(
|
||||
override val file: File,
|
||||
val videoInfo: VideoInfo,
|
||||
val thumbnailFile: File?,
|
||||
) : GalleryItemInfo
|
||||
|
||||
data class Audio(
|
||||
override val file: File,
|
||||
val audioInfo: AudioInfo,
|
||||
) : GalleryItemInfo
|
||||
|
||||
data class MediaFile(
|
||||
override val file: File,
|
||||
val fileInfo: FileInfo,
|
||||
) : GalleryItemInfo
|
||||
}
|
||||
+8
@@ -16,6 +16,7 @@ import io.element.android.libraries.matrix.api.core.ThreadId
|
||||
import io.element.android.libraries.matrix.api.core.TransactionId
|
||||
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.GalleryItemInfo
|
||||
import io.element.android.libraries.matrix.api.media.ImageInfo
|
||||
import io.element.android.libraries.matrix.api.media.MediaUploadHandler
|
||||
import io.element.android.libraries.matrix.api.media.VideoInfo
|
||||
@@ -157,6 +158,13 @@ interface Timeline : AutoCloseable {
|
||||
inReplyToEventId: EventId?,
|
||||
): Result<MediaUploadHandler>
|
||||
|
||||
suspend fun sendGallery(
|
||||
items: List<GalleryItemInfo>,
|
||||
caption: String?,
|
||||
formattedCaption: String?,
|
||||
inReplyToEventId: EventId?,
|
||||
): Result<MediaUploadHandler>
|
||||
|
||||
suspend fun redactEvent(eventOrTransactionId: EventOrTransactionId, reason: String?): Result<Unit>
|
||||
|
||||
suspend fun toggleReaction(emoji: String, eventOrTransactionId: EventOrTransactionId): Result<Boolean>
|
||||
|
||||
+15
@@ -102,6 +102,21 @@ data class TextMessageType(
|
||||
val formatted: FormattedBody?
|
||||
) : MessageType
|
||||
|
||||
data class GalleryMessageType(
|
||||
val body: String,
|
||||
val formatted: FormattedBody?,
|
||||
val items: List<GalleryItemType>,
|
||||
) : MessageType
|
||||
|
||||
@Immutable
|
||||
sealed interface GalleryItemType {
|
||||
data class Image(val content: ImageMessageType) : GalleryItemType
|
||||
data class Audio(val content: AudioMessageType) : GalleryItemType
|
||||
data class Video(val content: VideoMessageType) : GalleryItemType
|
||||
data class File(val content: FileMessageType) : GalleryItemType
|
||||
data class Other(val itemType: String, val body: String) : GalleryItemType
|
||||
}
|
||||
|
||||
data class OtherMessageType(
|
||||
val msgType: String,
|
||||
val body: String,
|
||||
|
||||
Reference in New Issue
Block a user