fix(deps): update dependency org.matrix.rustcomponents:sdk-android to v25.4.7 (#4548)
* fix(deps): update dependency org.matrix.rustcomponents:sdk-android to v25.4.8 * Fix API breaks: - Add `ReplyParameters` class and parameters to send functions. - Remove outdated OIDC related values. - Stop pre-processing the timeline to add the timeline start item, this is already done by the SDK. * Use the new function to reply to messages in a quick reply from a notification, however: 1. We don't have the thread id value at the moment since the SDK does not provide it yet. 2. The replied to event id wasn't being passed from the notification info. * Remove also timeline start virtual item for DMs, since this wasn't present before either --------- Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: Jorge Martín <jorgem@element.io>
This commit is contained in:
parent
7bcfb20268
commit
b9385ce382
35 changed files with 454 additions and 296 deletions
|
|
@ -12,6 +12,7 @@ import io.element.android.libraries.core.extensions.flatMapCatching
|
|||
import io.element.android.libraries.matrix.api.core.ProgressCallback
|
||||
import io.element.android.libraries.matrix.api.media.MediaUploadHandler
|
||||
import io.element.android.libraries.matrix.api.room.MatrixRoom
|
||||
import io.element.android.libraries.matrix.api.room.message.ReplyParameters
|
||||
import io.element.android.libraries.preferences.api.store.SessionPreferencesStore
|
||||
import kotlinx.coroutines.CancellationException
|
||||
import kotlinx.coroutines.Job
|
||||
|
|
@ -46,12 +47,14 @@ class MediaSender @Inject constructor(
|
|||
caption: String?,
|
||||
formattedCaption: String?,
|
||||
progressCallback: ProgressCallback?,
|
||||
replyParameters: ReplyParameters?,
|
||||
): Result<Unit> {
|
||||
return room.sendMedia(
|
||||
uploadInfo = mediaUploadInfo,
|
||||
progressCallback = progressCallback,
|
||||
caption = caption,
|
||||
formattedCaption = formattedCaption
|
||||
formattedCaption = formattedCaption,
|
||||
replyParameters = replyParameters,
|
||||
)
|
||||
.handleSendResult()
|
||||
}
|
||||
|
|
@ -61,7 +64,8 @@ class MediaSender @Inject constructor(
|
|||
mimeType: String,
|
||||
caption: String? = null,
|
||||
formattedCaption: String? = null,
|
||||
progressCallback: ProgressCallback? = null
|
||||
progressCallback: ProgressCallback? = null,
|
||||
replyParameters: ReplyParameters? = null,
|
||||
): Result<Unit> {
|
||||
val compressIfPossible = sessionPreferencesStore.doesCompressMedia().first()
|
||||
return preProcessor
|
||||
|
|
@ -76,7 +80,8 @@ class MediaSender @Inject constructor(
|
|||
uploadInfo = info,
|
||||
progressCallback = progressCallback,
|
||||
caption = caption,
|
||||
formattedCaption = formattedCaption
|
||||
formattedCaption = formattedCaption,
|
||||
replyParameters = replyParameters,
|
||||
)
|
||||
}
|
||||
.handleSendResult()
|
||||
|
|
@ -86,7 +91,8 @@ class MediaSender @Inject constructor(
|
|||
uri: Uri,
|
||||
mimeType: String,
|
||||
waveForm: List<Float>,
|
||||
progressCallback: ProgressCallback? = null
|
||||
progressCallback: ProgressCallback? = null,
|
||||
replyParameters: ReplyParameters? = null,
|
||||
): Result<Unit> {
|
||||
return preProcessor
|
||||
.process(
|
||||
|
|
@ -106,7 +112,8 @@ class MediaSender @Inject constructor(
|
|||
uploadInfo = newInfo,
|
||||
progressCallback = progressCallback,
|
||||
caption = null,
|
||||
formattedCaption = null
|
||||
formattedCaption = null,
|
||||
replyParameters = replyParameters,
|
||||
)
|
||||
}
|
||||
.handleSendResult()
|
||||
|
|
@ -128,6 +135,7 @@ class MediaSender @Inject constructor(
|
|||
progressCallback: ProgressCallback?,
|
||||
caption: String?,
|
||||
formattedCaption: String?,
|
||||
replyParameters: ReplyParameters?,
|
||||
): Result<Unit> {
|
||||
val handler = when (uploadInfo) {
|
||||
is MediaUploadInfo.Image -> {
|
||||
|
|
@ -137,7 +145,8 @@ class MediaSender @Inject constructor(
|
|||
imageInfo = uploadInfo.imageInfo,
|
||||
caption = caption,
|
||||
formattedCaption = formattedCaption,
|
||||
progressCallback = progressCallback
|
||||
progressCallback = progressCallback,
|
||||
replyParameters = replyParameters,
|
||||
)
|
||||
}
|
||||
is MediaUploadInfo.Video -> {
|
||||
|
|
@ -147,7 +156,8 @@ class MediaSender @Inject constructor(
|
|||
videoInfo = uploadInfo.videoInfo,
|
||||
caption = caption,
|
||||
formattedCaption = formattedCaption,
|
||||
progressCallback = progressCallback
|
||||
progressCallback = progressCallback,
|
||||
replyParameters = replyParameters,
|
||||
)
|
||||
}
|
||||
is MediaUploadInfo.Audio -> {
|
||||
|
|
@ -156,7 +166,8 @@ class MediaSender @Inject constructor(
|
|||
audioInfo = uploadInfo.audioInfo,
|
||||
caption = caption,
|
||||
formattedCaption = formattedCaption,
|
||||
progressCallback = progressCallback
|
||||
progressCallback = progressCallback,
|
||||
replyParameters = replyParameters,
|
||||
)
|
||||
}
|
||||
is MediaUploadInfo.VoiceMessage -> {
|
||||
|
|
@ -164,7 +175,8 @@ class MediaSender @Inject constructor(
|
|||
file = uploadInfo.file,
|
||||
audioInfo = uploadInfo.audioInfo,
|
||||
waveform = uploadInfo.waveform,
|
||||
progressCallback = progressCallback
|
||||
progressCallback = progressCallback,
|
||||
replyParameters = replyParameters,
|
||||
)
|
||||
}
|
||||
is MediaUploadInfo.AnyFile -> {
|
||||
|
|
@ -173,7 +185,8 @@ class MediaSender @Inject constructor(
|
|||
fileInfo = uploadInfo.fileInfo,
|
||||
caption = caption,
|
||||
formattedCaption = formattedCaption,
|
||||
progressCallback = progressCallback
|
||||
progressCallback = progressCallback,
|
||||
replyParameters = replyParameters,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -14,6 +14,7 @@ import io.element.android.libraries.matrix.api.core.ProgressCallback
|
|||
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.room.MatrixRoom
|
||||
import io.element.android.libraries.matrix.api.room.message.ReplyParameters
|
||||
import io.element.android.libraries.matrix.test.media.FakeMediaUploadHandler
|
||||
import io.element.android.libraries.matrix.test.room.FakeMatrixRoom
|
||||
import io.element.android.libraries.mediaupload.test.FakeMediaPreProcessor
|
||||
|
|
@ -46,7 +47,7 @@ class MediaSenderTest {
|
|||
@Test
|
||||
fun `given an attachment when sending it the MatrixRoom will call sendMedia`() = runTest {
|
||||
val sendImageResult =
|
||||
lambdaRecorder<File, File?, ImageInfo, String?, String?, ProgressCallback?, Result<FakeMediaUploadHandler>> { _, _, _, _, _, _ ->
|
||||
lambdaRecorder { _: File, _: File?, _: ImageInfo, _: String?, _: String?, _: ProgressCallback?, _: ReplyParameters? ->
|
||||
Result.success(FakeMediaUploadHandler())
|
||||
}
|
||||
val room = FakeMatrixRoom(
|
||||
|
|
@ -74,8 +75,8 @@ class MediaSenderTest {
|
|||
@Test
|
||||
fun `given a failure in the media upload when sending the whole process fails`() = runTest {
|
||||
val sendImageResult =
|
||||
lambdaRecorder<File, File?, ImageInfo, String?, String?, ProgressCallback?, Result<FakeMediaUploadHandler>> { _, _, _, _, _, _ ->
|
||||
Result.failure(Exception())
|
||||
lambdaRecorder { _: File, _: File?, _: ImageInfo, _: String?, _: String?, _: ProgressCallback?, _: ReplyParameters? ->
|
||||
Result.failure<FakeMediaUploadHandler>(Exception())
|
||||
}
|
||||
val room = FakeMatrixRoom(
|
||||
sendImageResult = sendImageResult
|
||||
|
|
@ -91,7 +92,8 @@ class MediaSenderTest {
|
|||
@OptIn(ExperimentalCoroutinesApi::class)
|
||||
@Test
|
||||
fun `given a cancellation in the media upload when sending the job is cancelled`() = runTest(StandardTestDispatcher()) {
|
||||
val sendFileResult = lambdaRecorder<File, FileInfo, String?, String?, ProgressCallback?, Result<FakeMediaUploadHandler>> { _, _, _, _, _ ->
|
||||
val sendFileResult =
|
||||
lambdaRecorder<File, FileInfo, String?, String?, ProgressCallback?, ReplyParameters?, Result<FakeMediaUploadHandler>> { _, _, _, _, _, _ ->
|
||||
Result.success(FakeMediaUploadHandler())
|
||||
}
|
||||
val room = FakeMatrixRoom(
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue