Space filters (#4977)

* Add support for SpaceFilters on the SpaceServiceProxy level and a screen that renders them

* Add aliases to a couple of space room mocks

* Update translations and related snapshots

* Add a feature flag for space filters

* Add a new room summary provider filter that takes a list of room identifiers next to the normal state filters

This will take the SpaceFilter's descendants and combine it with the normal filters to reduce the rooms shown

* Add a new space filter button to the home screen and link it to the SpaceFiltersScreen and the actual RoomSummaryProvider room list filters

* Bump the RustSDK to v26.01.20-2 for SpaceFilter support.

* Add a cancellation button to the space filters screen

* Make the filter presentation mode liquidy, move the sheet to within the home screen.

* Address PR comments
This commit is contained in:
Stefan Ceriu
2026-01-21 22:19:39 +02:00
committed by GitHub
parent 0d34a28ec2
commit b4b9f6affa
41 changed files with 808 additions and 13 deletions
@@ -7,15 +7,44 @@
//
import Foundation
import MatrixRustSDK
enum SpaceServiceProxyError: Error {
case sdkError(Error)
case missingSpace
}
struct SpaceServiceFilter: Identifiable, Equatable {
let room: SpaceServiceRoomProtocol
let level: UInt
let descendants: Set<String>
init(room: SpaceServiceRoomProtocol, level: UInt, descendants: Set<String>) {
self.room = room
self.level = level
self.descendants = descendants
}
init(filter: SpaceFilter) {
room = SpaceServiceRoom(spaceRoom: filter.spaceRoom)
level = UInt(max(filter.level, 0))
descendants = Set(filter.descendants)
}
// Same rooms might appear on multiple levels
var id: String {
room.id + "\(level)"
}
static func == (lhs: SpaceServiceFilter, rhs: SpaceServiceFilter) -> Bool {
lhs.room.id == rhs.room.id
}
}
// sourcery: AutoMockable
protocol SpaceServiceProxyProtocol {
var topLevelSpacesPublisher: CurrentValuePublisher<[SpaceServiceRoomProtocol], Never> { get }
var spaceFilterPublisher: CurrentValuePublisher<[SpaceServiceFilter], Never> { get }
func spaceRoomList(spaceID: String) async -> Result<SpaceRoomListProxyProtocol, SpaceServiceProxyError>
/// Returns a joined space given its identifier