Merge pull request #6136 from element-hq/feature/fga/space_room_list_filter

Add Space Filters feature for Room List
This commit is contained in:
ganfra 2026-02-05 16:14:16 +01:00 committed by GitHub
commit 6327641469
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
75 changed files with 1329 additions and 182 deletions

View file

@ -8,6 +8,8 @@
package io.element.android.libraries.matrix.api.roomlist
import io.element.android.libraries.matrix.api.core.RoomId
sealed interface RoomListFilter {
companion object {
/**
@ -41,6 +43,10 @@ sealed interface RoomListFilter {
val filters: List<RoomListFilter>
) : RoomListFilter
data class Identifiers(
val values: List<RoomId>,
) : RoomListFilter
/**
* A filter that matches rooms that are unread.
*/

View file

@ -12,9 +12,8 @@ import io.element.android.libraries.matrix.api.core.RoomId
import kotlinx.coroutines.flow.SharedFlow
interface SpaceService {
val spaceRoomsFlow: SharedFlow<List<SpaceRoom>>
suspend fun joinedSpaces(): Result<List<SpaceRoom>>
val topLevelSpacesFlow: SharedFlow<List<SpaceRoom>>
val spaceFiltersFlow: SharedFlow<List<SpaceServiceFilter>>
suspend fun joinedParents(spaceId: RoomId): Result<List<SpaceRoom>>
suspend fun getSpaceRoom(spaceId: RoomId): SpaceRoom?

View file

@ -0,0 +1,24 @@
/*
* Copyright (c) 2025 Element Creations Ltd.
* 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.spaces
import io.element.android.libraries.matrix.api.core.RoomId
/**
* Represents a space filter for filtering rooms by space membership.
*
* @property spaceRoom The space room associated with this filter.
* @property level The nesting level of the space (0 = top level, 1 = first level child, etc.).
* @property descendants The list of room IDs that are descendants of this space.
*/
data class SpaceServiceFilter(
val spaceRoom: SpaceRoom,
val level: Int,
val descendants: List<RoomId>,
)