Update dependency org.matrix.rustcomponents:sdk-android to v25.7.23 (#5073)

* Update dependency org.matrix.rustcomponents:sdk-android to v25.7.23

* Adapt to SDK changes:

- Add 'creator' role, adapt existing logic to it.
- Remove `ReplyParameters`, replace with `EventId` where possible.
- Fix changes in OIDC auth methods.
- Add more join rules.

* Make sure both creators and users with power level >= 150 are displayed as 'owners' in the room member list.

* Don't close the roles and permissions screen if the user is a creator

* Use `MediaPreviewValue.DEFAULT` for `MediaPreviewConfig.DEFAULT` too

* Improve APIs around checking roles and power levels:
    - Ensure `RoomInfo.RoomPowerLevels.users` can't be directly used to check power levels since it can't check the power levels for creators.
    - Add a few helper functions to handle actions that relied on the previous `users` property, and docs to explain their usages.

---------

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:
renovate[bot] 2025-07-24 11:58:30 +02:00 committed by GitHub
parent 33aa7a914f
commit 040fde7f22
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
57 changed files with 264 additions and 227 deletions

View file

@ -9,10 +9,10 @@ package io.element.android.libraries.mediaupload.api
import android.net.Uri
import io.element.android.libraries.core.extensions.flatMapCatching
import io.element.android.libraries.matrix.api.core.EventId
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.JoinedRoom
import io.element.android.libraries.matrix.api.room.message.ReplyParameters
import io.element.android.libraries.matrix.api.timeline.Timeline
import io.element.android.libraries.preferences.api.store.SessionPreferencesStore
import kotlinx.coroutines.CancellationException
@ -48,14 +48,14 @@ class MediaSender @Inject constructor(
caption: String?,
formattedCaption: String?,
progressCallback: ProgressCallback?,
replyParameters: ReplyParameters?,
inReplyToEventId: EventId?,
): Result<Unit> {
return room.liveTimeline.sendMedia(
uploadInfo = mediaUploadInfo,
progressCallback = progressCallback,
caption = caption,
formattedCaption = formattedCaption,
replyParameters = replyParameters,
inReplyToEventId = inReplyToEventId,
)
.handleSendResult()
}
@ -66,7 +66,7 @@ class MediaSender @Inject constructor(
caption: String? = null,
formattedCaption: String? = null,
progressCallback: ProgressCallback? = null,
replyParameters: ReplyParameters? = null,
inReplyToEventId: EventId? = null,
): Result<Unit> {
val compressIfPossible = sessionPreferencesStore.doesCompressMedia().first()
return preProcessor
@ -82,7 +82,7 @@ class MediaSender @Inject constructor(
progressCallback = progressCallback,
caption = caption,
formattedCaption = formattedCaption,
replyParameters = replyParameters,
inReplyToEventId = inReplyToEventId,
)
}
.handleSendResult()
@ -93,7 +93,7 @@ class MediaSender @Inject constructor(
mimeType: String,
waveForm: List<Float>,
progressCallback: ProgressCallback? = null,
replyParameters: ReplyParameters? = null,
inReplyToEventId: EventId? = null,
): Result<Unit> {
return preProcessor
.process(
@ -114,7 +114,7 @@ class MediaSender @Inject constructor(
progressCallback = progressCallback,
caption = null,
formattedCaption = null,
replyParameters = replyParameters,
inReplyToEventId = inReplyToEventId,
)
}
.handleSendResult()
@ -136,7 +136,7 @@ class MediaSender @Inject constructor(
progressCallback: ProgressCallback?,
caption: String?,
formattedCaption: String?,
replyParameters: ReplyParameters?,
inReplyToEventId: EventId?,
): Result<Unit> {
val handler = when (uploadInfo) {
is MediaUploadInfo.Image -> {
@ -147,7 +147,7 @@ class MediaSender @Inject constructor(
caption = caption,
formattedCaption = formattedCaption,
progressCallback = progressCallback,
replyParameters = replyParameters,
inReplyToEventId = inReplyToEventId,
)
}
is MediaUploadInfo.Video -> {
@ -158,7 +158,7 @@ class MediaSender @Inject constructor(
caption = caption,
formattedCaption = formattedCaption,
progressCallback = progressCallback,
replyParameters = replyParameters,
inReplyToEventId = inReplyToEventId,
)
}
is MediaUploadInfo.Audio -> {
@ -168,7 +168,7 @@ class MediaSender @Inject constructor(
caption = caption,
formattedCaption = formattedCaption,
progressCallback = progressCallback,
replyParameters = replyParameters,
inReplyToEventId = inReplyToEventId,
)
}
is MediaUploadInfo.VoiceMessage -> {
@ -177,7 +177,7 @@ class MediaSender @Inject constructor(
audioInfo = uploadInfo.audioInfo,
waveform = uploadInfo.waveform,
progressCallback = progressCallback,
replyParameters = replyParameters,
inReplyToEventId = inReplyToEventId,
)
}
is MediaUploadInfo.AnyFile -> {
@ -187,7 +187,7 @@ class MediaSender @Inject constructor(
caption = caption,
formattedCaption = formattedCaption,
progressCallback = progressCallback,
replyParameters = replyParameters,
inReplyToEventId = inReplyToEventId,
)
}
}

View file

@ -10,11 +10,11 @@ package io.element.android.libraries.mediaupload.api
import android.net.Uri
import com.google.common.truth.Truth.assertThat
import io.element.android.libraries.core.mimetype.MimeTypes
import io.element.android.libraries.matrix.api.core.EventId
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.JoinedRoom
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.FakeJoinedRoom
import io.element.android.libraries.matrix.test.timeline.FakeTimeline
@ -47,7 +47,7 @@ class MediaSenderTest {
String?,
String?,
ProgressCallback?,
ReplyParameters?,
EventId?,
Result<FakeMediaUploadHandler>,
> { _, _, _, _, _, _ ->
Result.success(FakeMediaUploadHandler())
@ -65,7 +65,7 @@ class MediaSenderTest {
@Test
fun `given an attachment when sending it the Room will call sendMedia`() = runTest {
val sendImageResult =
lambdaRecorder { _: File, _: File?, _: ImageInfo, _: String?, _: String?, _: ProgressCallback?, _: ReplyParameters? ->
lambdaRecorder { _: File, _: File?, _: ImageInfo, _: String?, _: String?, _: ProgressCallback?, _: EventId? ->
Result.success(FakeMediaUploadHandler())
}
val room = FakeJoinedRoom(
@ -98,7 +98,7 @@ class MediaSenderTest {
givenImageResult()
}
val sendImageResult =
lambdaRecorder { _: File, _: File?, _: ImageInfo, _: String?, _: String?, _: ProgressCallback?, _: ReplyParameters? ->
lambdaRecorder { _: File, _: File?, _: ImageInfo, _: String?, _: String?, _: ProgressCallback?, _: EventId? ->
Result.failure<FakeMediaUploadHandler>(Exception())
}
val room = FakeJoinedRoom(
@ -121,7 +121,7 @@ class MediaSenderTest {
@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?, ReplyParameters?, Result<FakeMediaUploadHandler>> { _, _, _, _, _, _ ->
lambdaRecorder<File, FileInfo, String?, String?, ProgressCallback?, EventId?, Result<FakeMediaUploadHandler>> { _, _, _, _, _, _ ->
Result.success(FakeMediaUploadHandler())
}
val room = FakeJoinedRoom(