Merge pull request #4274 from element-hq/feature/bma/mediaTimelineImprovment

Update Matrix Room API and allow media swipe on pinned event only.
This commit is contained in:
Benoit Marty 2025-02-19 09:41:27 +01:00 committed by GitHub
commit 86afffb4bc
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
31 changed files with 296 additions and 185 deletions

View file

@ -0,0 +1,17 @@
/*
* Copyright 2025 New Vector Ltd.
*
* SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial
* Please see LICENSE files in the repository root for full details.
*/
package io.element.android.libraries.matrix.api.room
import io.element.android.libraries.matrix.api.core.EventId
sealed interface CreateTimelineParams {
data class Focused(val focusedEventId: EventId) : CreateTimelineParams
data object MediaOnly : CreateTimelineParams
data class MediaOnlyFocused(val focusedEventId: EventId) : CreateTimelineParams
data object PinnedOnly : CreateTimelineParams
}

View file

@ -109,21 +109,12 @@ interface MatrixRoom : Closeable {
val liveTimeline: Timeline
/**
* Create a new timeline, focused on the provided Event.
* Should not be used directly, see `TimelineController` to manage the various timelines.
* Create a new timeline.
* @param createTimelineParams contains parameters about how to filter the timeline. Will also configure the date separators.
*/
suspend fun timelineFocusedOnEvent(eventId: EventId): Result<Timeline>
/**
* Create a new timeline for the pinned events of the room.
*/
suspend fun pinnedEventsTimeline(): Result<Timeline>
/**
* Create a new timeline for the media events of the room.
* @param eventId The event to focus on, if any.
*/
suspend fun mediaTimeline(eventId: EventId?): Result<Timeline>
suspend fun createTimeline(
createTimelineParams: CreateTimelineParams,
): Result<Timeline>
fun destroy()