Improve MatrixRoom.createTimeline API.
This commit is contained in:
parent
2e9a158fb0
commit
cc11677cd9
15 changed files with 112 additions and 94 deletions
|
|
@ -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
|
||||
}
|
||||
|
|
@ -110,15 +110,10 @@ interface MatrixRoom : Closeable {
|
|||
|
||||
/**
|
||||
* Create a new timeline.
|
||||
* @param focusedOnEventId The event to focus on, if any. Note: if not null, and for regular timeline,
|
||||
* this method should not be used directly, see `TimelineController` to manage the various timelines.
|
||||
* @param onlyPinnedEvents True to get the timeline for pinned events only.
|
||||
* @param onlyMedia True to get the timeline for media events only.
|
||||
* @param createTimelineParams contains parameters about how to filter the timeline. Will also configure the date separators.
|
||||
*/
|
||||
suspend fun createTimeline(
|
||||
focusedOnEventId: EventId? = null,
|
||||
onlyPinnedEvents: Boolean = false,
|
||||
onlyMedia: Boolean = false,
|
||||
createTimelineParams: CreateTimelineParams,
|
||||
): Result<Timeline>
|
||||
|
||||
fun destroy()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue