Add ability to swipe between media when opened from the timeline.

This commit is contained in:
Benoit Marty 2025-01-28 09:58:34 +01:00
parent 9e5c5fa48a
commit 1776d93a20
20 changed files with 485 additions and 82 deletions

View file

@ -253,11 +253,21 @@ class RustMatrixRoom(
}
}
override suspend fun mediaTimeline(): Result<Timeline> = withContext(roomDispatcher) {
override suspend fun mediaTimeline(
eventId: EventId?,
): Result<Timeline> = withContext(roomDispatcher) {
val focus = if (eventId != null) {
TimelineFocus.Event(
eventId = eventId.value,
numContextEvents = 50u,
)
} else {
TimelineFocus.Live
}
runCatching {
innerRoom.timelineWithConfiguration(
configuration = TimelineConfiguration(
focus = TimelineFocus.Live,
focus = focus,
allowedMessageTypes = AllowedMessageTypes.Only(
types = listOf(
RoomMessageEventMessageType.FILE,
@ -270,7 +280,7 @@ class RustMatrixRoom(
dateDividerMode = DateDividerMode.MONTHLY,
)
).let { inner ->
createTimeline(inner, mode = Timeline.Mode.MEDIA)
createTimeline(inner, mode = if (eventId != null) Timeline.Mode.FOCUSED_ON_EVENT else Timeline.Mode.MEDIA)
}
}.onFailure {
if (it is CancellationException) {