deps (rust sdk) : handle breaking changes of version 25.06.06

This commit is contained in:
ganfra 2025-06-06 18:01:59 +02:00
parent 6b842e1b18
commit 36c287aa69
2 changed files with 12 additions and 5 deletions

View file

@ -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)
}
}
}

View file

@ -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
)
}