From ece62b797883f42f2f4ea108f2a935d28aa5a2ac Mon Sep 17 00:00:00 2001 From: Benoit Marty Date: Mon, 18 Nov 2024 17:26:12 +0100 Subject: [PATCH] Allow caption for audio and file. Need to preview all the attachments now, to be able to type a caption. --- .../messages/impl/MessagesStateProvider.kt | 11 ----- .../features/messages/impl/MessagesView.kt | 15 ------ .../preview/AttachmentsPreviewState.kt | 8 +--- .../messagecomposer/MessageComposerEvents.kt | 1 - .../MessageComposerPresenter.kt | 46 +------------------ .../messagecomposer/MessageComposerState.kt | 4 -- .../libraries/matrix/api/room/MatrixRoom.kt | 16 ++++++- .../libraries/matrix/api/timeline/Timeline.kt | 16 ++++++- .../matrix/impl/room/RustMatrixRoom.kt | 32 +++++++++++-- .../matrix/impl/timeline/RustTimeline.kt | 29 +++++++++--- .../matrix/test/room/FakeMatrixRoom.kt | 16 +++++-- .../matrix/test/timeline/FakeTimeline.kt | 16 ++++++- .../libraries/mediaupload/api/MediaSender.kt | 4 ++ 13 files changed, 112 insertions(+), 102 deletions(-) diff --git a/features/messages/impl/src/main/kotlin/io/element/android/features/messages/impl/MessagesStateProvider.kt b/features/messages/impl/src/main/kotlin/io/element/android/features/messages/impl/MessagesStateProvider.kt index e8dc5329f4..c3daabf3ed 100644 --- a/features/messages/impl/src/main/kotlin/io/element/android/features/messages/impl/MessagesStateProvider.kt +++ b/features/messages/impl/src/main/kotlin/io/element/android/features/messages/impl/MessagesStateProvider.kt @@ -12,7 +12,6 @@ import io.element.android.features.messages.impl.actionlist.ActionListState import io.element.android.features.messages.impl.actionlist.anActionListState import io.element.android.features.messages.impl.crypto.identity.IdentityChangeState import io.element.android.features.messages.impl.crypto.identity.anIdentityChangeState -import io.element.android.features.messages.impl.messagecomposer.AttachmentsState import io.element.android.features.messages.impl.messagecomposer.MessageComposerState import io.element.android.features.messages.impl.messagecomposer.aMessageComposerState import io.element.android.features.messages.impl.pinned.banner.PinnedMessagesBannerState @@ -62,16 +61,6 @@ open class MessagesStateProvider : PreviewParameterProvider { enableVoiceMessages = true, voiceMessageComposerState = aVoiceMessageComposerState(showPermissionRationaleDialog = true), ), - aMessagesState( - composerState = aMessageComposerState( - attachmentsState = AttachmentsState.Sending.Processing(persistentListOf()) - ), - ), - aMessagesState( - composerState = aMessageComposerState( - attachmentsState = AttachmentsState.Sending.Uploading(0.33f) - ), - ), aMessagesState( roomCallState = anOngoingCallState(), ), diff --git a/features/messages/impl/src/main/kotlin/io/element/android/features/messages/impl/MessagesView.kt b/features/messages/impl/src/main/kotlin/io/element/android/features/messages/impl/MessagesView.kt index 4351dbcae9..49cbac6268 100644 --- a/features/messages/impl/src/main/kotlin/io/element/android/features/messages/impl/MessagesView.kt +++ b/features/messages/impl/src/main/kotlin/io/element/android/features/messages/impl/MessagesView.kt @@ -83,8 +83,6 @@ import io.element.android.features.networkmonitor.api.ui.ConnectivityIndicatorVi import io.element.android.features.roomcall.api.RoomCallState import io.element.android.libraries.androidutils.ui.hideKeyboard import io.element.android.libraries.designsystem.atomic.molecules.IconTitlePlaceholdersRowMolecule -import io.element.android.libraries.designsystem.components.ProgressDialog -import io.element.android.libraries.designsystem.components.ProgressDialogType import io.element.android.libraries.designsystem.components.avatar.AvatarData import io.element.android.libraries.designsystem.components.avatar.AvatarSize import io.element.android.libraries.designsystem.components.avatar.CompositeAvatar @@ -134,7 +132,6 @@ fun MessagesView( AttachmentStateView( state = state.composerState.attachmentsState, onPreviewAttachments = onPreviewAttachments, - onCancel = { state.composerState.eventSink(MessageComposerEvents.CancelSendAttachment) }, ) val snackbarHostState = rememberSnackbarHostState(snackbarMessage = state.snackbarMessage) @@ -280,7 +277,6 @@ private fun ReinviteDialog(state: MessagesState) { private fun AttachmentStateView( state: AttachmentsState, onPreviewAttachments: (ImmutableList) -> Unit, - onCancel: () -> Unit, ) { when (state) { AttachmentsState.None -> Unit @@ -290,17 +286,6 @@ private fun AttachmentStateView( latestOnPreviewAttachments(state.attachments) } } - is AttachmentsState.Sending -> { - ProgressDialog( - type = when (state) { - is AttachmentsState.Sending.Uploading -> ProgressDialogType.Determinate(state.progress) - is AttachmentsState.Sending.Processing -> ProgressDialogType.Indeterminate - }, - text = stringResource(id = CommonStrings.common_sending), - showCancelButton = true, - onDismissRequest = onCancel, - ) - } } } diff --git a/features/messages/impl/src/main/kotlin/io/element/android/features/messages/impl/attachments/preview/AttachmentsPreviewState.kt b/features/messages/impl/src/main/kotlin/io/element/android/features/messages/impl/attachments/preview/AttachmentsPreviewState.kt index 5ffe9364ff..5fed2acfb2 100644 --- a/features/messages/impl/src/main/kotlin/io/element/android/features/messages/impl/attachments/preview/AttachmentsPreviewState.kt +++ b/features/messages/impl/src/main/kotlin/io/element/android/features/messages/impl/attachments/preview/AttachmentsPreviewState.kt @@ -9,9 +9,6 @@ package io.element.android.features.messages.impl.attachments.preview import androidx.compose.runtime.Immutable import io.element.android.features.messages.impl.attachments.Attachment -import io.element.android.libraries.core.bool.orFalse -import io.element.android.libraries.core.mimetype.MimeTypes.isMimeTypeImage -import io.element.android.libraries.core.mimetype.MimeTypes.isMimeTypeVideo import io.element.android.libraries.textcomposer.model.TextEditorState data class AttachmentsPreviewState( @@ -20,9 +17,8 @@ data class AttachmentsPreviewState( val textEditorState: TextEditorState, val eventSink: (AttachmentsPreviewEvents) -> Unit ) { - val allowCaption: Boolean = (attachment as? Attachment.Media)?.localMedia?.info?.mimeType?.let { - it.isMimeTypeImage() || it.isMimeTypeVideo() - }.orFalse() + // Keep the val to eventually set to false for some mimetypes. + val allowCaption: Boolean = true } @Immutable diff --git a/features/messages/impl/src/main/kotlin/io/element/android/features/messages/impl/messagecomposer/MessageComposerEvents.kt b/features/messages/impl/src/main/kotlin/io/element/android/features/messages/impl/messagecomposer/MessageComposerEvents.kt index fca9948339..036401bb1a 100644 --- a/features/messages/impl/src/main/kotlin/io/element/android/features/messages/impl/messagecomposer/MessageComposerEvents.kt +++ b/features/messages/impl/src/main/kotlin/io/element/android/features/messages/impl/messagecomposer/MessageComposerEvents.kt @@ -31,7 +31,6 @@ sealed interface MessageComposerEvents { data object Poll : PickAttachmentSource } data class ToggleTextFormatting(val enabled: Boolean) : MessageComposerEvents - data object CancelSendAttachment : MessageComposerEvents data class Error(val error: Throwable) : MessageComposerEvents data class TypingNotice(val isTyping: Boolean) : MessageComposerEvents data class SuggestionReceived(val suggestion: Suggestion?) : MessageComposerEvents diff --git a/features/messages/impl/src/main/kotlin/io/element/android/features/messages/impl/messagecomposer/MessageComposerPresenter.kt b/features/messages/impl/src/main/kotlin/io/element/android/features/messages/impl/messagecomposer/MessageComposerPresenter.kt index 6101f48c1f..7ad64c21d0 100644 --- a/features/messages/impl/src/main/kotlin/io/element/android/features/messages/impl/messagecomposer/MessageComposerPresenter.kt +++ b/features/messages/impl/src/main/kotlin/io/element/android/features/messages/impl/messagecomposer/MessageComposerPresenter.kt @@ -42,7 +42,6 @@ import io.element.android.libraries.di.RoomScope import io.element.android.libraries.di.SingleIn import io.element.android.libraries.featureflag.api.FeatureFlagService import io.element.android.libraries.featureflag.api.FeatureFlags -import io.element.android.libraries.matrix.api.core.ProgressCallback import io.element.android.libraries.matrix.api.core.UserId import io.element.android.libraries.matrix.api.permalink.PermalinkBuilder import io.element.android.libraries.matrix.api.permalink.PermalinkData @@ -81,7 +80,6 @@ import kotlinx.collections.immutable.toPersistentList import kotlinx.coroutines.CancellationException import kotlinx.coroutines.CoroutineScope import kotlinx.coroutines.FlowPreview -import kotlinx.coroutines.Job import kotlinx.coroutines.delay import kotlinx.coroutines.flow.MutableStateFlow import kotlinx.coroutines.flow.collect @@ -89,11 +87,9 @@ import kotlinx.coroutines.flow.combine import kotlinx.coroutines.flow.debounce import kotlinx.coroutines.flow.filter import kotlinx.coroutines.flow.merge -import kotlinx.coroutines.isActive import kotlinx.coroutines.launch import timber.log.Timber import javax.inject.Inject -import kotlin.coroutines.coroutineContext import kotlin.time.Duration.Companion.seconds import io.element.android.libraries.core.mimetype.MimeTypes.Any as AnyMimeTypes @@ -180,26 +176,12 @@ class MessageComposerPresenter @Inject constructor( val isFullScreen = rememberSaveable { mutableStateOf(false) } - val ongoingSendAttachmentJob = remember { mutableStateOf(null) } - var showAttachmentSourcePicker: Boolean by remember { mutableStateOf(false) } val sendTypingNotifications by sessionPreferencesStore.isSendTypingNotificationsEnabled().collectAsState(initial = true) val roomAliasSuggestions by roomAliasSuggestionsDataSource.getAllRoomAliasSuggestions().collectAsState(initial = emptyList()) - LaunchedEffect(attachmentsState.value) { - when (val attachmentStateValue = attachmentsState.value) { - is AttachmentsState.Sending.Processing -> { - ongoingSendAttachmentJob.value = localCoroutineScope.sendAttachment( - attachmentStateValue.attachments.first(), - attachmentsState, - ) - } - else -> Unit - } - } - LaunchedEffect(cameraPermissionState.permissionGranted) { if (cameraPermissionState.permissionGranted) { when (pendingEvent) { @@ -338,12 +320,6 @@ class MessageComposerPresenter @Inject constructor( showAttachmentSourcePicker = false // Navigation to the create poll screen is done at the view layer } - is MessageComposerEvents.CancelSendAttachment -> { - ongoingSendAttachmentJob.value?.let { - it.cancel() - ongoingSendAttachmentJob.value == null - } - } is MessageComposerEvents.ToggleTextFormatting -> { showAttachmentSourcePicker = false localCoroutineScope.toggleTextFormatting(event.enabled, markdownTextEditorState, richTextEditorState) @@ -505,17 +481,7 @@ class MessageComposerPresenter @Inject constructor( formattedFileSize = null ) val mediaAttachment = Attachment.Media(localMedia) - val isPreviewable = when { - MimeTypes.isImage(localMedia.info.mimeType) -> true - MimeTypes.isVideo(localMedia.info.mimeType) -> true - MimeTypes.isAudio(localMedia.info.mimeType) -> true - else -> false - } - attachmentsState.value = if (isPreviewable) { - AttachmentsState.Previewing(persistentListOf(mediaAttachment)) - } else { - AttachmentsState.Sending.Processing(persistentListOf(mediaAttachment)) - } + attachmentsState.value = AttachmentsState.Previewing(persistentListOf(mediaAttachment)) } private suspend fun sendMedia( @@ -523,18 +489,10 @@ class MessageComposerPresenter @Inject constructor( mimeType: String, attachmentState: MutableState, ) = runCatching { - val context = coroutineContext - val progressCallback = object : ProgressCallback { - override fun onProgress(current: Long, total: Long) { - if (context.isActive) { - attachmentState.value = AttachmentsState.Sending.Uploading(current.toFloat() / total.toFloat()) - } - } - } mediaSender.sendMedia( uri = uri, mimeType = mimeType, - progressCallback = progressCallback + progressCallback = null, ).getOrThrow() } .onSuccess { diff --git a/features/messages/impl/src/main/kotlin/io/element/android/features/messages/impl/messagecomposer/MessageComposerState.kt b/features/messages/impl/src/main/kotlin/io/element/android/features/messages/impl/messagecomposer/MessageComposerState.kt index 5ca4a9c52b..d0e9528e48 100644 --- a/features/messages/impl/src/main/kotlin/io/element/android/features/messages/impl/messagecomposer/MessageComposerState.kt +++ b/features/messages/impl/src/main/kotlin/io/element/android/features/messages/impl/messagecomposer/MessageComposerState.kt @@ -35,8 +35,4 @@ data class MessageComposerState( sealed interface AttachmentsState { data object None : AttachmentsState data class Previewing(val attachments: ImmutableList) : AttachmentsState - sealed interface Sending : AttachmentsState { - data class Processing(val attachments: ImmutableList) : Sending - data class Uploading(val progress: Float) : Sending - } } diff --git a/libraries/matrix/api/src/main/kotlin/io/element/android/libraries/matrix/api/room/MatrixRoom.kt b/libraries/matrix/api/src/main/kotlin/io/element/android/libraries/matrix/api/room/MatrixRoom.kt index 8dd1c5ec5f..989c301e92 100644 --- a/libraries/matrix/api/src/main/kotlin/io/element/android/libraries/matrix/api/room/MatrixRoom.kt +++ b/libraries/matrix/api/src/main/kotlin/io/element/android/libraries/matrix/api/room/MatrixRoom.kt @@ -147,9 +147,21 @@ interface MatrixRoom : Closeable { progressCallback: ProgressCallback? ): Result - suspend fun sendAudio(file: File, audioInfo: AudioInfo, progressCallback: ProgressCallback?): Result + suspend fun sendAudio( + file: File, + audioInfo: AudioInfo, + caption: String?, + formattedCaption: String?, + progressCallback: ProgressCallback?, + ): Result - suspend fun sendFile(file: File, fileInfo: FileInfo, progressCallback: ProgressCallback?): Result + suspend fun sendFile( + file: File, + fileInfo: FileInfo, + caption: String?, + formattedCaption: String?, + progressCallback: ProgressCallback?, + ): Result suspend fun toggleReaction(emoji: String, eventOrTransactionId: EventOrTransactionId): Result diff --git a/libraries/matrix/api/src/main/kotlin/io/element/android/libraries/matrix/api/timeline/Timeline.kt b/libraries/matrix/api/src/main/kotlin/io/element/android/libraries/matrix/api/timeline/Timeline.kt index 695fe906c5..2b7c121dec 100644 --- a/libraries/matrix/api/src/main/kotlin/io/element/android/libraries/matrix/api/timeline/Timeline.kt +++ b/libraries/matrix/api/src/main/kotlin/io/element/android/libraries/matrix/api/timeline/Timeline.kt @@ -91,9 +91,21 @@ interface Timeline : AutoCloseable { suspend fun redactEvent(eventOrTransactionId: EventOrTransactionId, reason: String?): Result - suspend fun sendAudio(file: File, audioInfo: AudioInfo, progressCallback: ProgressCallback?): Result + suspend fun sendAudio( + file: File, + audioInfo: AudioInfo, + caption: String?, + formattedCaption: String?, + progressCallback: ProgressCallback?, + ): Result - suspend fun sendFile(file: File, fileInfo: FileInfo, progressCallback: ProgressCallback?): Result + suspend fun sendFile( + file: File, + fileInfo: FileInfo, + caption: String?, + formattedCaption: String?, + progressCallback: ProgressCallback?, + ): Result suspend fun toggleReaction(emoji: String, eventOrTransactionId: EventOrTransactionId): Result diff --git a/libraries/matrix/impl/src/main/kotlin/io/element/android/libraries/matrix/impl/room/RustMatrixRoom.kt b/libraries/matrix/impl/src/main/kotlin/io/element/android/libraries/matrix/impl/room/RustMatrixRoom.kt index c12fc17553..e3a7e2dfc7 100644 --- a/libraries/matrix/impl/src/main/kotlin/io/element/android/libraries/matrix/impl/room/RustMatrixRoom.kt +++ b/libraries/matrix/impl/src/main/kotlin/io/element/android/libraries/matrix/impl/room/RustMatrixRoom.kt @@ -467,12 +467,36 @@ class RustMatrixRoom( return liveTimeline.sendVideo(file, thumbnailFile, videoInfo, caption, formattedCaption, progressCallback) } - override suspend fun sendAudio(file: File, audioInfo: AudioInfo, progressCallback: ProgressCallback?): Result { - return liveTimeline.sendAudio(file, audioInfo, progressCallback) + override suspend fun sendAudio( + file: File, + audioInfo: AudioInfo, + caption: String?, + formattedCaption: String?, + progressCallback: ProgressCallback?, + ): Result { + return liveTimeline.sendAudio( + file = file, + audioInfo = audioInfo, + caption = caption, + formattedCaption = formattedCaption, + progressCallback = progressCallback, + ) } - override suspend fun sendFile(file: File, fileInfo: FileInfo, progressCallback: ProgressCallback?): Result { - return liveTimeline.sendFile(file, fileInfo, progressCallback) + override suspend fun sendFile( + file: File, + fileInfo: FileInfo, + caption: String?, + formattedCaption: String?, + progressCallback: ProgressCallback?, + ): Result { + return liveTimeline.sendFile( + file, + fileInfo, + caption, + formattedCaption, + progressCallback, + ) } override suspend fun toggleReaction(emoji: String, eventOrTransactionId: EventOrTransactionId): Result { diff --git a/libraries/matrix/impl/src/main/kotlin/io/element/android/libraries/matrix/impl/timeline/RustTimeline.kt b/libraries/matrix/impl/src/main/kotlin/io/element/android/libraries/matrix/impl/timeline/RustTimeline.kt index 2b6d8543c4..813cc9c7cb 100644 --- a/libraries/matrix/impl/src/main/kotlin/io/element/android/libraries/matrix/impl/timeline/RustTimeline.kt +++ b/libraries/matrix/impl/src/main/kotlin/io/element/android/libraries/matrix/impl/timeline/RustTimeline.kt @@ -373,29 +373,44 @@ class RustTimeline( } } - override suspend fun sendAudio(file: File, audioInfo: AudioInfo, progressCallback: ProgressCallback?): Result { + override suspend fun sendAudio( + file: File, + audioInfo: AudioInfo, + caption: String?, + formattedCaption: String?, + progressCallback: ProgressCallback?, + ): Result { val useSendQueue = featureFlagsService.isFeatureEnabled(FeatureFlags.MediaUploadOnSendQueue) return sendAttachment(listOf(file)) { inner.sendAudio( url = file.path, audioInfo = audioInfo.map(), - // Maybe allow a caption in the future? - caption = null, - formattedCaption = null, + caption = caption, + formattedCaption = formattedCaption?.let { + FormattedBody(body = it, format = MessageFormat.Html) + }, useSendQueue = useSendQueue, progressWatcher = progressCallback?.toProgressWatcher() ) } } - override suspend fun sendFile(file: File, fileInfo: FileInfo, progressCallback: ProgressCallback?): Result { + override suspend fun sendFile( + file: File, + fileInfo: FileInfo, + caption: String?, + formattedCaption: String?, + progressCallback: ProgressCallback?, + ): Result { val useSendQueue = featureFlagsService.isFeatureEnabled(FeatureFlags.MediaUploadOnSendQueue) return sendAttachment(listOf(file)) { inner.sendFile( url = file.path, fileInfo = fileInfo.map(), - caption = null, - formattedCaption = null, + caption = caption, + formattedCaption = formattedCaption?.let { + FormattedBody(body = it, format = MessageFormat.Html) + }, useSendQueue = useSendQueue, progressWatcher = progressCallback?.toProgressWatcher(), ) diff --git a/libraries/matrix/test/src/main/kotlin/io/element/android/libraries/matrix/test/room/FakeMatrixRoom.kt b/libraries/matrix/test/src/main/kotlin/io/element/android/libraries/matrix/test/room/FakeMatrixRoom.kt index 9574a2a22c..9974e36746 100644 --- a/libraries/matrix/test/src/main/kotlin/io/element/android/libraries/matrix/test/room/FakeMatrixRoom.kt +++ b/libraries/matrix/test/src/main/kotlin/io/element/android/libraries/matrix/test/room/FakeMatrixRoom.kt @@ -92,10 +92,10 @@ class FakeMatrixRoom( { _, _, _, _, _, _ -> lambdaError() }, private val sendVideoResult: (File, File?, VideoInfo, String?, String?, ProgressCallback?) -> Result = { _, _, _, _, _, _ -> lambdaError() }, - private val sendFileResult: (File, FileInfo, ProgressCallback?) -> Result = - { _, _, _ -> lambdaError() }, - private val sendAudioResult: (File, AudioInfo, ProgressCallback?) -> Result = - { _, _, _ -> lambdaError() }, + private val sendFileResult: (File, FileInfo, String?, String?, ProgressCallback?) -> Result = + { _, _, _, _, _ -> lambdaError() }, + private val sendAudioResult: (File, AudioInfo, String?, String?, ProgressCallback?) -> Result = + { _, _, _, _, _ -> lambdaError() }, private val sendVoiceMessageResult: (File, AudioInfo, List, ProgressCallback?) -> Result = { _, _, _, _ -> lambdaError() }, private val setNameResult: (String) -> Result = { lambdaError() }, @@ -354,12 +354,16 @@ class FakeMatrixRoom( override suspend fun sendAudio( file: File, audioInfo: AudioInfo, + caption: String?, + formattedCaption: String?, progressCallback: ProgressCallback? ): Result = simulateLongTask { simulateSendMediaProgress(progressCallback) sendAudioResult( file, audioInfo, + caption, + formattedCaption, progressCallback, ) } @@ -367,12 +371,16 @@ class FakeMatrixRoom( override suspend fun sendFile( file: File, fileInfo: FileInfo, + caption: String?, + formattedCaption: String?, progressCallback: ProgressCallback? ): Result = simulateLongTask { simulateSendMediaProgress(progressCallback) sendFileResult( file, fileInfo, + caption, + formattedCaption, progressCallback, ) } diff --git a/libraries/matrix/test/src/main/kotlin/io/element/android/libraries/matrix/test/timeline/FakeTimeline.kt b/libraries/matrix/test/src/main/kotlin/io/element/android/libraries/matrix/test/timeline/FakeTimeline.kt index ae40a0a51e..f96815c85a 100644 --- a/libraries/matrix/test/src/main/kotlin/io/element/android/libraries/matrix/test/timeline/FakeTimeline.kt +++ b/libraries/matrix/test/src/main/kotlin/io/element/android/libraries/matrix/test/timeline/FakeTimeline.kt @@ -173,36 +173,48 @@ class FakeTimeline( var sendAudioLambda: ( file: File, audioInfo: AudioInfo, + caption: String?, + formattedCaption: String?, progressCallback: ProgressCallback?, - ) -> Result = { _, _, _ -> + ) -> Result = { _, _, _, _, _ -> Result.success(FakeMediaUploadHandler()) } override suspend fun sendAudio( file: File, audioInfo: AudioInfo, + caption: String?, + formattedCaption: String?, progressCallback: ProgressCallback?, ): Result = sendAudioLambda( file, audioInfo, + caption, + formattedCaption, progressCallback ) var sendFileLambda: ( file: File, fileInfo: FileInfo, + caption: String?, + formattedCaption: String?, progressCallback: ProgressCallback?, - ) -> Result = { _, _, _ -> + ) -> Result = { _, _, _, _, _ -> Result.success(FakeMediaUploadHandler()) } override suspend fun sendFile( file: File, fileInfo: FileInfo, + caption: String?, + formattedCaption: String?, progressCallback: ProgressCallback?, ): Result = sendFileLambda( file, fileInfo, + caption, + formattedCaption, progressCallback ) diff --git a/libraries/mediaupload/api/src/main/kotlin/io/element/android/libraries/mediaupload/api/MediaSender.kt b/libraries/mediaupload/api/src/main/kotlin/io/element/android/libraries/mediaupload/api/MediaSender.kt index 09b8de4b41..77e6d021d5 100644 --- a/libraries/mediaupload/api/src/main/kotlin/io/element/android/libraries/mediaupload/api/MediaSender.kt +++ b/libraries/mediaupload/api/src/main/kotlin/io/element/android/libraries/mediaupload/api/MediaSender.kt @@ -125,6 +125,8 @@ class MediaSender @Inject constructor( sendAudio( file = uploadInfo.file, audioInfo = uploadInfo.audioInfo, + caption = caption, + formattedCaption = formattedCaption, progressCallback = progressCallback ) } @@ -140,6 +142,8 @@ class MediaSender @Inject constructor( sendFile( file = uploadInfo.file, fileInfo = uploadInfo.fileInfo, + caption = caption, + formattedCaption = formattedCaption, progressCallback = progressCallback ) }