Add the JoinRoomScreen into the SpaceFlowCoordinator. (#4513)

* Add the JoinRoomScreen into the SpaceFlowCoordinator.

The screen needs further work to make the join work.

* Fix the tests completing the join flow with the right action.
This commit is contained in:
Doug
2025-09-17 15:12:45 +01:00
committed by GitHub
parent c4de609ad7
commit 27f4c25194
22 changed files with 260 additions and 92 deletions
@@ -21,9 +21,11 @@ class SpaceRoomListProxy: SpaceRoomListProxyProtocol {
private let paginationStateHandle: TaskHandle
let paginationStatePublisher: CurrentValuePublisher<SpaceRoomListPaginationState, Never>
init(_ spaceRoomList: SpaceRoomListProtocol, spaceRoomProxy: SpaceRoomProxyProtocol) {
init(_ spaceRoomList: SpaceRoomListProtocol) throws {
guard let spaceRoom = spaceRoomList.space() else { throw SpaceRoomListProxyError.missingSpace }
self.spaceRoomList = spaceRoomList
self.spaceRoomProxy = spaceRoomProxy
spaceRoomProxy = SpaceRoomProxy(spaceRoom: spaceRoom)
let paginationStateSubject = CurrentValueSubject<SpaceRoomListPaginationState, Never>(spaceRoomList.paginationState())
paginationStatePublisher = paginationStateSubject.asCurrentValuePublisher()
@@ -8,6 +8,10 @@
import Combine
import MatrixRustSDK
enum SpaceRoomListProxyError: Error {
case missingSpace
}
// sourcery: AutoMockable
protocol SpaceRoomListProxyProtocol {
var spaceRoomProxy: SpaceRoomProxyProtocol { get }
@@ -30,11 +30,11 @@ class SpaceServiceProxy: SpaceServiceProxyProtocol {
})
}
func spaceRoomList(for spaceRoomProxy: SpaceRoomProxyProtocol) async -> Result<SpaceRoomListProxyProtocol, SpaceServiceProxyError> {
func spaceRoomList(spaceID: String) async -> Result<SpaceRoomListProxyProtocol, SpaceServiceProxyError> {
do {
return try await .success(SpaceRoomListProxy(spaceService.spaceRoomList(spaceId: spaceRoomProxy.id), spaceRoomProxy: spaceRoomProxy))
return try await .success(SpaceRoomListProxy(spaceService.spaceRoomList(spaceId: spaceID)))
} catch {
MXLog.error("Failed creating space room list for \(spaceRoomProxy.id): \(error)")
MXLog.error("Failed creating space room list for \(spaceID): \(error)")
return .failure(.sdkError(error))
}
}
@@ -9,11 +9,12 @@ import Foundation
enum SpaceServiceProxyError: Error {
case sdkError(Error)
case missingSpace
}
// sourcery: AutoMockable
protocol SpaceServiceProxyProtocol {
var joinedSpacesPublisher: CurrentValuePublisher<[SpaceRoomProxyProtocol], Never> { get }
func spaceRoomList(for spaceRoomProxy: SpaceRoomProxyProtocol) async -> Result<SpaceRoomListProxyProtocol, SpaceServiceProxyError>
func spaceRoomList(spaceID: String) async -> Result<SpaceRoomListProxyProtocol, SpaceServiceProxyError>
}