Membership aware room routes (#2709)

* Remove the invites button when room list invites are enabled

* element-hq/element-x-ios/issues/2632 - Handle room permalinks based on their membership state and show the according room joining screens:
- modify the room flow coordinator to only take a roomID and be able to decide its own room flows (especially for unjoined rooms)
- add support for the new room preview API
- have RoomDirectorySearch go through the same paths
This commit is contained in:
Stefan Ceriu
2024-04-19 17:04:18 +03:00
committed by GitHub
parent 9a172df7fd
commit effe3b6a9b
35 changed files with 698 additions and 247 deletions
@@ -34,13 +34,44 @@ class JoinRoomScreenViewModelTests: XCTestCase {
try await deferred.fulfill()
}
func testAcceptInviteInteraction() async throws {
setupViewModel()
let deferred = deferFulfillment(viewModel.actionsPublisher) { $0 == .joined }
context.send(viewAction: .acceptInvite)
try await deferred.fulfill()
}
func testDeclineInviteInteraction() async throws {
setupViewModel()
try await deferFulfillment(viewModel.context.$viewState) { $0.roomDetails != nil }.fulfill()
context.send(viewAction: .declineInvite)
XCTAssertEqual(viewModel.context.alertInfo?.id, .declineInvite)
}
private func setupViewModel(throwing: Bool = false) {
let clientProxy = ClientProxyMock(.init())
clientProxy.joinRoomReturnValue = throwing ? .failure(.sdkError(ClientProxyMockError.generic)) : .success(())
clientProxy.roomPreviewForIdentifierReturnValue = .success(.init(roomID: "",
name: nil,
canonicalAlias: nil,
topic: nil,
avatarURL: nil,
memberCount: 0,
isHistoryWorldReadable: false,
isJoined: false,
isInvited: false,
isPublic: false,
canKnock: false))
viewModel = JoinRoomScreenViewModel(roomID: "1",
roomName: "Room Name",
avatarURL: nil,
interaction: .join,
clientProxy: clientProxy)
clientProxy: clientProxy,
mediaProvider: MockMediaProvider(),
userIndicatorController: ServiceLocator.shared.userIndicatorController)
}
}