mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-11-02 12:07:55 +00:00
b4b9f6affa
* 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
64 lines
1.8 KiB
Swift
64 lines
1.8 KiB
Swift
//
|
|
// Copyright 2025 Element Creations Ltd.
|
|
// Copyright 2022-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.
|
|
//
|
|
|
|
import Combine
|
|
import Foundation
|
|
import MatrixRustSDK
|
|
|
|
enum RoomSummaryProviderState {
|
|
case notLoaded
|
|
case loaded(totalNumberOfRooms: UInt)
|
|
|
|
var isLoaded: Bool {
|
|
switch self {
|
|
case .loaded:
|
|
return true
|
|
default:
|
|
return false
|
|
}
|
|
}
|
|
|
|
var totalNumberOfRooms: UInt? {
|
|
switch self {
|
|
case .loaded(let totalNumberOfRooms):
|
|
return totalNumberOfRooms
|
|
default:
|
|
return nil
|
|
}
|
|
}
|
|
}
|
|
|
|
enum RoomSummaryProviderFilter: Equatable {
|
|
/// Filters out everything
|
|
case excludeAll
|
|
/// Includes only the items that satisfy the predicate logic
|
|
case search(query: String)
|
|
/// Includes only what satisfies the filters used
|
|
case all(filters: Set<RoomListFilter>)
|
|
/// Include only rooms from the given that satisfy the given filters
|
|
case rooms(roomsIDs: Set<String>, filters: Set<RoomListFilter>)
|
|
}
|
|
|
|
// sourcery: AutoMockable
|
|
protocol StaticRoomSummaryProviderProtocol {
|
|
/// Publishes the current state the summary provider is finding itself in
|
|
var statePublisher: CurrentValuePublisher<RoomSummaryProviderState, Never> { get }
|
|
|
|
/// Publishes the currently available room summaries
|
|
var roomListPublisher: CurrentValuePublisher<[RoomSummary], Never> { get }
|
|
|
|
func setRoomList(_ roomList: RoomList)
|
|
}
|
|
|
|
// sourcery: AutoMockable
|
|
protocol RoomSummaryProviderProtocol: StaticRoomSummaryProviderProtocol {
|
|
func updateVisibleRange(_ range: Range<Int>)
|
|
|
|
func setFilter(_ filter: RoomSummaryProviderFilter)
|
|
}
|