Skip to content

Commit 040fde7

Browse files
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 <[email protected]>
1 parent 33aa7a9 commit 040fde7

File tree

57 files changed

+264
-227
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

57 files changed

+264
-227
lines changed

features/location/impl/src/main/kotlin/io/element/android/features/location/impl/send/SendLocationPresenter.kt

Lines changed: 3 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,6 @@ import io.element.android.libraries.architecture.Presenter
2626
import io.element.android.libraries.core.meta.BuildMeta
2727
import io.element.android.libraries.matrix.api.room.JoinedRoom
2828
import io.element.android.libraries.matrix.api.room.location.AssetType
29-
import io.element.android.libraries.matrix.api.room.message.ReplyParameters
30-
import io.element.android.libraries.matrix.api.room.message.replyInThread
31-
import io.element.android.libraries.matrix.ui.messages.reply.eventId
3229
import io.element.android.libraries.textcomposer.model.MessageComposerMode
3330
import io.element.android.services.analytics.api.AnalyticsService
3431
import kotlinx.coroutines.launch
@@ -103,17 +100,7 @@ class SendLocationPresenter @Inject constructor(
103100
mode: SendLocationState.Mode,
104101
) {
105102
val replyMode = messageComposerContext.composerMode as? MessageComposerMode.Reply
106-
val replyParams = replyMode?.replyToDetails?.let { details ->
107-
if (replyMode.inThread) {
108-
replyInThread(details.eventId())
109-
} else {
110-
ReplyParameters(
111-
inReplyToEventId = details.eventId(),
112-
enforceThreadReply = false,
113-
replyWithinThread = false
114-
)
115-
}
116-
}
103+
val inReplyToEventId = replyMode?.eventId
117104
when (mode) {
118105
SendLocationState.Mode.PinLocation -> {
119106
val geoUri = event.cameraPosition.toGeoUri()
@@ -123,7 +110,7 @@ class SendLocationPresenter @Inject constructor(
123110
description = null,
124111
zoomLevel = MapDefaults.DEFAULT_ZOOM.toInt(),
125112
assetType = AssetType.PIN,
126-
replyParameters = replyParams,
113+
inReplyToEventId = inReplyToEventId,
127114
)
128115
analyticsService.capture(
129116
Composer(
@@ -142,7 +129,7 @@ class SendLocationPresenter @Inject constructor(
142129
description = null,
143130
zoomLevel = MapDefaults.DEFAULT_ZOOM.toInt(),
144131
assetType = AssetType.SENDER,
145-
replyParameters = replyParams,
132+
inReplyToEventId = inReplyToEventId,
146133
)
147134
analyticsService.capture(
148135
Composer(

features/location/impl/src/test/kotlin/io/element/android/features/location/impl/send/SendLocationPresenterTest.kt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,9 @@ import io.element.android.features.location.impl.common.permissions.PermissionsE
2020
import io.element.android.features.location.impl.common.permissions.PermissionsPresenter
2121
import io.element.android.features.location.impl.common.permissions.PermissionsState
2222
import io.element.android.features.messages.test.FakeMessageComposerContext
23+
import io.element.android.libraries.matrix.api.core.EventId
2324
import io.element.android.libraries.matrix.api.room.JoinedRoom
2425
import io.element.android.libraries.matrix.api.room.location.AssetType
25-
import io.element.android.libraries.matrix.api.room.message.ReplyParameters
2626
import io.element.android.libraries.matrix.api.timeline.item.event.toEventOrTransactionId
2727
import io.element.android.libraries.matrix.test.AN_EVENT_ID
2828
import io.element.android.libraries.matrix.test.core.aBuildMeta
@@ -264,7 +264,7 @@ class SendLocationPresenterTest {
264264

265265
@Test
266266
fun `share sender location`() = runTest {
267-
val sendLocationResult = lambdaRecorder<String, String, String?, Int?, AssetType?, ReplyParameters?, Result<Unit>> { _, _, _, _, _, _ ->
267+
val sendLocationResult = lambdaRecorder<String, String, String?, Int?, AssetType?, EventId?, Result<Unit>> { _, _, _, _, _, _ ->
268268
Result.success(Unit)
269269
}
270270
val joinedRoom = FakeJoinedRoom(
@@ -328,7 +328,7 @@ class SendLocationPresenterTest {
328328

329329
@Test
330330
fun `share pin location`() = runTest {
331-
val sendLocationResult = lambdaRecorder<String, String, String?, Int?, AssetType?, ReplyParameters?, Result<Unit>> { _, _, _, _, _, _ ->
331+
val sendLocationResult = lambdaRecorder<String, String, String?, Int?, AssetType?, EventId?, Result<Unit>> { _, _, _, _, _, _ ->
332332
Result.success(Unit)
333333
}
334334
val joinedRoom = FakeJoinedRoom(
@@ -392,7 +392,7 @@ class SendLocationPresenterTest {
392392

393393
@Test
394394
fun `composer context passes through analytics`() = runTest {
395-
val sendLocationResult = lambdaRecorder<String, String, String?, Int?, AssetType?, ReplyParameters?, Result<Unit>> { _, _, _, _, _, _ ->
395+
val sendLocationResult = lambdaRecorder<String, String, String?, Int?, AssetType?, EventId?, Result<Unit>> { _, _, _, _, _, _ ->
396396
Result.success(Unit)
397397
}
398398
val joinedRoom = FakeJoinedRoom(

features/messages/impl/src/main/kotlin/io/element/android/features/messages/impl/attachments/preview/AttachmentsPreviewPresenter.kt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,9 @@ import io.element.android.libraries.core.extensions.runCatchingExceptions
3131
import io.element.android.libraries.di.annotations.SessionCoroutineScope
3232
import io.element.android.libraries.featureflag.api.FeatureFlagService
3333
import io.element.android.libraries.featureflag.api.FeatureFlags
34+
import io.element.android.libraries.matrix.api.core.EventId
3435
import io.element.android.libraries.matrix.api.core.ProgressCallback
3536
import io.element.android.libraries.matrix.api.permalink.PermalinkBuilder
36-
import io.element.android.libraries.matrix.api.room.message.ReplyParameters
3737
import io.element.android.libraries.mediaupload.api.MediaSender
3838
import io.element.android.libraries.mediaupload.api.MediaUploadInfo
3939
import io.element.android.libraries.mediaupload.api.allFiles
@@ -129,7 +129,7 @@ class AttachmentsPreviewPresenter @AssistedInject constructor(
129129
caption = caption,
130130
sendActionState = sendActionState,
131131
dismissAfterSend = !useSendQueue,
132-
replyParameters = null,
132+
inReplyToEventId = null,
133133
)
134134

135135
// Clean up the pre-processed media after it's been sent
@@ -245,7 +245,7 @@ class AttachmentsPreviewPresenter @AssistedInject constructor(
245245
caption: String?,
246246
sendActionState: MutableState<SendActionState>,
247247
dismissAfterSend: Boolean,
248-
replyParameters: ReplyParameters?,
248+
inReplyToEventId: EventId?,
249249
) = runCatchingExceptions {
250250
val context = coroutineContext
251251
val progressCallback = object : ProgressCallback {
@@ -261,7 +261,7 @@ class AttachmentsPreviewPresenter @AssistedInject constructor(
261261
caption = caption,
262262
formattedCaption = null,
263263
progressCallback = progressCallback,
264-
replyParameters = replyParameters,
264+
inReplyToEventId = inReplyToEventId,
265265
).getOrThrow()
266266
}.fold(
267267
onSuccess = {

features/messages/impl/src/main/kotlin/io/element/android/features/messages/impl/messagecomposer/MessageComposerPresenter.kt

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,6 @@ import io.element.android.libraries.matrix.api.room.JoinedRoom
5555
import io.element.android.libraries.matrix.api.room.draft.ComposerDraft
5656
import io.element.android.libraries.matrix.api.room.draft.ComposerDraftType
5757
import io.element.android.libraries.matrix.api.room.isDm
58-
import io.element.android.libraries.matrix.api.room.message.ReplyParameters
5958
import io.element.android.libraries.matrix.api.timeline.TimelineException
6059
import io.element.android.libraries.matrix.api.timeline.item.event.toEventOrTransactionId
6160
import io.element.android.libraries.matrix.ui.messages.reply.InReplyToDetails
@@ -466,12 +465,7 @@ class MessageComposerPresenter @AssistedInject constructor(
466465
body = message.markdown,
467466
htmlBody = message.html,
468467
intentionalMentions = message.intentionalMentions,
469-
replyParameters = ReplyParameters(
470-
inReplyToEventId = eventId,
471-
enforceThreadReply = inThread,
472-
// This should be false until we add a way to make a reply in a thread an explicit reply to the provided eventId
473-
replyWithinThread = false,
474-
),
468+
repliedToEventId = eventId,
475469
)
476470
}
477471
}

features/messages/impl/src/main/kotlin/io/element/android/features/messages/impl/timeline/components/virtual/TimelineItemRoomBeginningView.kt

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ import io.element.android.libraries.designsystem.preview.PreviewsDayNight
2626
import io.element.android.libraries.designsystem.text.toAnnotatedString
2727
import io.element.android.libraries.designsystem.theme.components.Text
2828
import io.element.android.libraries.designsystem.utils.allBooleans
29-
import io.element.android.libraries.matrix.api.core.EventId
3029
import io.element.android.libraries.matrix.api.core.RoomId
3130
import io.element.android.libraries.matrix.api.room.tombstone.PredecessorRoom
3231

@@ -92,7 +91,7 @@ internal fun TimelineItemRoomBeginningViewPreview() = ElementPreview {
9291
onPredecessorRoomClick = {},
9392
)
9493
TimelineItemRoomBeginningView(
95-
predecessorRoom = PredecessorRoom(RoomId("!roomId:matrix.org"), EventId("\$eventId:matrix.org")),
94+
predecessorRoom = PredecessorRoom(RoomId("!roomId:matrix.org")),
9695
roomName = "Room Name",
9796
isDm = isDm,
9897
onPredecessorRoomClick = {},

features/messages/impl/src/test/kotlin/io/element/android/features/messages/impl/attachments/AttachmentsPreviewPresenterTest.kt

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -23,14 +23,14 @@ import io.element.android.libraries.androidutils.file.TemporaryUriDeleter
2323
import io.element.android.libraries.core.mimetype.MimeTypes
2424
import io.element.android.libraries.featureflag.api.FeatureFlags
2525
import io.element.android.libraries.featureflag.test.FakeFeatureFlagService
26+
import io.element.android.libraries.matrix.api.core.EventId
2627
import io.element.android.libraries.matrix.api.core.ProgressCallback
2728
import io.element.android.libraries.matrix.api.media.AudioInfo
2829
import io.element.android.libraries.matrix.api.media.FileInfo
2930
import io.element.android.libraries.matrix.api.media.ImageInfo
3031
import io.element.android.libraries.matrix.api.media.VideoInfo
3132
import io.element.android.libraries.matrix.api.permalink.PermalinkBuilder
3233
import io.element.android.libraries.matrix.api.room.JoinedRoom
33-
import io.element.android.libraries.matrix.api.room.message.ReplyParameters
3434
import io.element.android.libraries.matrix.test.A_CAPTION
3535
import io.element.android.libraries.matrix.test.media.FakeMediaUploadHandler
3636
import io.element.android.libraries.matrix.test.permalink.FakePermalinkBuilder
@@ -108,7 +108,7 @@ class AttachmentsPreviewPresenterTest {
108108
@Test
109109
fun `present - send media success scenario`() = runTest {
110110
val sendFileResult =
111-
lambdaRecorder<File, FileInfo, String?, String?, ProgressCallback?, ReplyParameters?, Result<FakeMediaUploadHandler>> { _, _, _, _, _, _ ->
111+
lambdaRecorder<File, FileInfo, String?, String?, ProgressCallback?, EventId?, Result<FakeMediaUploadHandler>> { _, _, _, _, _, _ ->
112112
Result.success(FakeMediaUploadHandler())
113113
}
114114
val room = FakeJoinedRoom(
@@ -152,7 +152,7 @@ class AttachmentsPreviewPresenterTest {
152152
@Test
153153
fun `present - send media after pre-processing success scenario`() = runTest {
154154
val sendFileResult =
155-
lambdaRecorder<File, FileInfo, String?, String?, ProgressCallback?, ReplyParameters?, Result<FakeMediaUploadHandler>> { _, _, _, _, _, _ ->
155+
lambdaRecorder<File, FileInfo, String?, String?, ProgressCallback?, EventId?, Result<FakeMediaUploadHandler>> { _, _, _, _, _, _ ->
156156
Result.success(FakeMediaUploadHandler())
157157
}
158158
val room = FakeJoinedRoom(
@@ -190,7 +190,7 @@ class AttachmentsPreviewPresenterTest {
190190
@Test
191191
fun `present - send media before pre-processing success scenario`() = runTest {
192192
val sendFileResult =
193-
lambdaRecorder<File, FileInfo, String?, String?, ProgressCallback?, ReplyParameters?, Result<FakeMediaUploadHandler>> { _, _, _, _, _, _ ->
193+
lambdaRecorder<File, FileInfo, String?, String?, ProgressCallback?, EventId?, Result<FakeMediaUploadHandler>> { _, _, _, _, _, _ ->
194194
Result.success(FakeMediaUploadHandler())
195195
}
196196
val room = FakeJoinedRoom(
@@ -305,7 +305,7 @@ class AttachmentsPreviewPresenterTest {
305305
@Test
306306
fun `present - send image with caption success scenario`() = runTest {
307307
val sendImageResult =
308-
lambdaRecorder { _: File, _: File?, _: ImageInfo, _: String?, _: String?, _: ProgressCallback?, _: ReplyParameters? ->
308+
lambdaRecorder { _: File, _: File?, _: ImageInfo, _: String?, _: String?, _: ProgressCallback?, _: EventId? ->
309309
Result.success(FakeMediaUploadHandler())
310310
}
311311
val mediaPreProcessor = FakeMediaPreProcessor().apply {
@@ -349,7 +349,7 @@ class AttachmentsPreviewPresenterTest {
349349
@Test
350350
fun `present - send video with caption success scenario`() = runTest {
351351
val sendVideoResult =
352-
lambdaRecorder { _: File, _: File?, _: VideoInfo, _: String?, _: String?, _: ProgressCallback?, _: ReplyParameters? ->
352+
lambdaRecorder { _: File, _: File?, _: VideoInfo, _: String?, _: String?, _: ProgressCallback?, _: EventId? ->
353353
Result.success(FakeMediaUploadHandler())
354354
}
355355
val mediaPreProcessor = FakeMediaPreProcessor().apply {
@@ -393,7 +393,7 @@ class AttachmentsPreviewPresenterTest {
393393
@Test
394394
fun `present - send audio with caption success scenario`() = runTest {
395395
val sendAudioResult =
396-
lambdaRecorder<File, AudioInfo, String?, String?, ProgressCallback?, ReplyParameters?, Result<FakeMediaUploadHandler>> { _, _, _, _, _, _ ->
396+
lambdaRecorder<File, AudioInfo, String?, String?, ProgressCallback?, EventId?, Result<FakeMediaUploadHandler>> { _, _, _, _, _, _ ->
397397
Result.success(FakeMediaUploadHandler())
398398
}
399399
val mediaPreProcessor = FakeMediaPreProcessor().apply {
@@ -435,7 +435,7 @@ class AttachmentsPreviewPresenterTest {
435435
fun `present - send media failure scenario without media queue`() = runTest {
436436
val failure = MediaPreProcessor.Failure(null)
437437
val sendFileResult =
438-
lambdaRecorder<File, FileInfo, String?, String?, ProgressCallback?, ReplyParameters?, Result<FakeMediaUploadHandler>> { _, _, _, _, _, _ ->
438+
lambdaRecorder<File, FileInfo, String?, String?, ProgressCallback?, EventId?, Result<FakeMediaUploadHandler>> { _, _, _, _, _, _ ->
439439
Result.failure(failure)
440440
}
441441
val room = FakeJoinedRoom(
@@ -466,7 +466,7 @@ class AttachmentsPreviewPresenterTest {
466466
fun `present - send media failure scenario with media queue`() = runTest {
467467
val failure = MediaPreProcessor.Failure(null)
468468
val sendFileResult =
469-
lambdaRecorder<File, FileInfo, String?, String?, ProgressCallback?, ReplyParameters?, Result<FakeMediaUploadHandler>> { _, _, _, _, _, _ ->
469+
lambdaRecorder<File, FileInfo, String?, String?, ProgressCallback?, EventId?, Result<FakeMediaUploadHandler>> { _, _, _, _, _, _ ->
470470
Result.failure(failure)
471471
}
472472
val onDoneListenerResult = lambdaRecorder<Unit> {}

features/messages/impl/src/test/kotlin/io/element/android/features/messages/impl/messagecomposer/MessageComposerPresenterTest.kt

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,6 @@ import io.element.android.libraries.matrix.api.room.RoomMembersState
4848
import io.element.android.libraries.matrix.api.room.RoomMembershipState
4949
import io.element.android.libraries.matrix.api.room.draft.ComposerDraft
5050
import io.element.android.libraries.matrix.api.room.draft.ComposerDraftType
51-
import io.element.android.libraries.matrix.api.room.message.ReplyParameters
5251
import io.element.android.libraries.matrix.api.timeline.TimelineException
5352
import io.element.android.libraries.matrix.api.timeline.item.event.EventOrTransactionId
5453
import io.element.android.libraries.matrix.api.timeline.item.event.InReplyTo
@@ -610,7 +609,7 @@ class MessageComposerPresenterTest {
610609

611610
@Test
612611
fun `present - reply message`() = runTest {
613-
val replyMessageLambda = lambdaRecorder { _: ReplyParameters, _: String, _: String?, _: List<IntentionalMention>, _: Boolean ->
612+
val replyMessageLambda = lambdaRecorder { _: EventId?, _: String, _: String?, _: List<IntentionalMention>, _: Boolean ->
614613
Result.success(Unit)
615614
}
616615
val timeline = FakeTimeline().apply {
@@ -1100,7 +1099,7 @@ class MessageComposerPresenterTest {
11001099
@OptIn(ExperimentalCoroutinesApi::class)
11011100
@Test
11021101
fun `present - send messages with intentional mentions`() = runTest {
1103-
val replyMessageLambda = lambdaRecorder { _: ReplyParameters, _: String, _: String?, _: List<IntentionalMention>, _: Boolean ->
1102+
val replyMessageLambda = lambdaRecorder { _: EventId?, _: String, _: String?, _: List<IntentionalMention>, _: Boolean ->
11041103
Result.success(Unit)
11051104
}
11061105
val editMessageLambda = lambdaRecorder { _: EventOrTransactionId, _: String, _: String?, _: List<IntentionalMention> ->

features/messages/impl/src/test/kotlin/io/element/android/features/messages/impl/timeline/TimelinePresenterTest.kt

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -710,11 +710,7 @@ class TimelinePresenterTest {
710710
@Test
711711
fun `present - timeline room info includes predecessor room when room has predecessor`() = runTest {
712712
val predecessorRoomId = RoomId("!predecessor:server.org")
713-
val predecessorEventId = EventId("\$predecessorEvent:server.org")
714-
val predecessorRoom = PredecessorRoom(
715-
roomId = predecessorRoomId,
716-
lastEventId = predecessorEventId
717-
)
713+
val predecessorRoom = PredecessorRoom(roomId = predecessorRoomId)
718714

719715
val room = FakeJoinedRoom(
720716
baseRoom = FakeBaseRoom(
@@ -730,7 +726,6 @@ class TimelinePresenterTest {
730726
val initialState = awaitFirstItem()
731727
assertThat(initialState.timelineRoomInfo.predecessorRoom).isNotNull()
732728
assertThat(initialState.timelineRoomInfo.predecessorRoom?.roomId).isEqualTo(predecessorRoomId)
733-
assertThat(initialState.timelineRoomInfo.predecessorRoom?.lastEventId).isEqualTo(predecessorEventId)
734729
}
735730
}
736731

features/messages/impl/src/test/kotlin/io/element/android/features/messages/impl/voicemessages/composer/VoiceMessageComposerPresenterTest.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,9 @@ import com.google.common.truth.Truth.assertThat
1919
import im.vector.app.features.analytics.plan.Composer
2020
import io.element.android.features.messages.impl.messagecomposer.aReplyMode
2121
import io.element.android.features.messages.test.FakeMessageComposerContext
22+
import io.element.android.libraries.matrix.api.core.EventId
2223
import io.element.android.libraries.matrix.api.core.ProgressCallback
2324
import io.element.android.libraries.matrix.api.media.AudioInfo
24-
import io.element.android.libraries.matrix.api.room.message.ReplyParameters
2525
import io.element.android.libraries.matrix.test.media.FakeMediaUploadHandler
2626
import io.element.android.libraries.matrix.test.room.FakeJoinedRoom
2727
import io.element.android.libraries.matrix.test.timeline.FakeTimeline
@@ -63,7 +63,7 @@ class VoiceMessageComposerPresenterTest {
6363
)
6464
private val analyticsService = FakeAnalyticsService()
6565
private val sendVoiceMessageResult =
66-
lambdaRecorder<File, AudioInfo, List<Float>, ProgressCallback?, ReplyParameters?, Result<FakeMediaUploadHandler>> { _, _, _, _, _ ->
66+
lambdaRecorder<File, AudioInfo, List<Float>, ProgressCallback?, EventId?, Result<FakeMediaUploadHandler>> { _, _, _, _, _ ->
6767
Result.success(FakeMediaUploadHandler())
6868
}
6969
private val joinedRoom = FakeJoinedRoom(

features/roomdetails/impl/src/main/kotlin/io/element/android/features/roomdetails/impl/analytics/AnalyticUtils.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import io.element.android.libraries.matrix.api.room.powerlevels.RoomPowerLevelsV
1313
import io.element.android.services.analytics.api.AnalyticsService
1414

1515
internal fun RoomMember.Role.toAnalyticsMemberRole(): RoomModeration.Role = when (this) {
16+
RoomMember.Role.CREATOR -> RoomModeration.Role.Administrator // TODO - distinguish creator from admin
1617
RoomMember.Role.ADMIN -> RoomModeration.Role.Administrator
1718
RoomMember.Role.MODERATOR -> RoomModeration.Role.Moderator
1819
RoomMember.Role.USER -> RoomModeration.Role.User

0 commit comments

Comments
 (0)