From 36c287aa69859cee034e27b67e05c76127490a39 Mon Sep 17 00:00:00 2001 From: ganfra Date: Fri, 6 Jun 2025 18:01:59 +0200 Subject: [PATCH] deps (rust sdk) : handle breaking changes of version 25.06.06 --- .../impl/timeline/item/event/EventMessageMapper.kt | 7 +++++++ .../matrix/impl/timeline/reply/InReplyToMapper.kt | 10 +++++----- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/libraries/matrix/impl/src/main/kotlin/io/element/android/libraries/matrix/impl/timeline/item/event/EventMessageMapper.kt b/libraries/matrix/impl/src/main/kotlin/io/element/android/libraries/matrix/impl/timeline/item/event/EventMessageMapper.kt index 7cd12d0f38..d806c9492f 100644 --- a/libraries/matrix/impl/src/main/kotlin/io/element/android/libraries/matrix/impl/timeline/item/event/EventMessageMapper.kt +++ b/libraries/matrix/impl/src/main/kotlin/io/element/android/libraries/matrix/impl/timeline/item/event/EventMessageMapper.kt @@ -31,6 +31,9 @@ import org.matrix.rustcomponents.sdk.FormattedBody as RustFormattedBody import org.matrix.rustcomponents.sdk.MessageFormat as RustMessageFormat import org.matrix.rustcomponents.sdk.MessageType as RustMessageType +// https://github.com/Johennes/matrix-spec-proposals/blob/johannes/msgtype-galleries/proposals/4274-inline-media-galleries.md#unstable-prefix +private const val MSG_TYPE_GALLERY_UNSTABLE = "dm.filament.gallery" + class EventMessageMapper { private val inReplyToMapper by lazy { InReplyToMapper(TimelineEventContentMapper()) } @@ -112,6 +115,10 @@ class EventMessageMapper { is MessageType.Other -> { OtherMessageType(type.msgtype, type.body) } + is MessageType.Gallery -> { + // TODO expose the GalleryType. + OtherMessageType(MSG_TYPE_GALLERY_UNSTABLE, type.content.body) + } } } diff --git a/libraries/matrix/impl/src/main/kotlin/io/element/android/libraries/matrix/impl/timeline/reply/InReplyToMapper.kt b/libraries/matrix/impl/src/main/kotlin/io/element/android/libraries/matrix/impl/timeline/reply/InReplyToMapper.kt index 052385e5be..1b329bfe0a 100644 --- a/libraries/matrix/impl/src/main/kotlin/io/element/android/libraries/matrix/impl/timeline/reply/InReplyToMapper.kt +++ b/libraries/matrix/impl/src/main/kotlin/io/element/android/libraries/matrix/impl/timeline/reply/InReplyToMapper.kt @@ -12,8 +12,8 @@ import io.element.android.libraries.matrix.api.core.UserId import io.element.android.libraries.matrix.api.timeline.item.event.InReplyTo import io.element.android.libraries.matrix.impl.timeline.item.event.TimelineEventContentMapper import io.element.android.libraries.matrix.impl.timeline.item.event.map +import org.matrix.rustcomponents.sdk.EmbeddedEventDetails import org.matrix.rustcomponents.sdk.InReplyToDetails -import org.matrix.rustcomponents.sdk.RepliedToEventDetails class InReplyToMapper( private val timelineEventContentMapper: TimelineEventContentMapper, @@ -21,7 +21,7 @@ class InReplyToMapper( fun map(inReplyToDetails: InReplyToDetails): InReplyTo { val inReplyToId = EventId(inReplyToDetails.eventId()) return when (val event = inReplyToDetails.event()) { - is RepliedToEventDetails.Ready -> { + is EmbeddedEventDetails.Ready -> { InReplyTo.Ready( eventId = inReplyToId, content = timelineEventContentMapper.map(event.content), @@ -29,14 +29,14 @@ class InReplyToMapper( senderProfile = event.senderProfile.map(), ) } - is RepliedToEventDetails.Error -> InReplyTo.Error( + is EmbeddedEventDetails.Error -> InReplyTo.Error( eventId = inReplyToId, message = event.message, ) - RepliedToEventDetails.Pending -> InReplyTo.Pending( + EmbeddedEventDetails.Pending -> InReplyTo.Pending( eventId = inReplyToId, ) - is RepliedToEventDetails.Unavailable -> InReplyTo.NotLoaded( + is EmbeddedEventDetails.Unavailable -> InReplyTo.NotLoaded( eventId = inReplyToId ) }