mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-11-03 06:55:59 +00:00
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:
@@ -179,7 +179,8 @@ class JoinRoomScreenViewModel: JoinRoomScreenViewModelType, JoinRoomScreenViewMo
|
||||
avatar: avatar,
|
||||
memberCount: info?.joinedMembersCount,
|
||||
inviter: inviter,
|
||||
isDirect: info?.isDirect)
|
||||
isDirect: info?.isDirect,
|
||||
isSpace: info?.isSpace)
|
||||
|
||||
await updateMode()
|
||||
}
|
||||
@@ -243,8 +244,7 @@ class JoinRoomScreenViewModel: JoinRoomScreenViewModelType, JoinRoomScreenViewMo
|
||||
if let alias = state.roomDetails?.canonicalAlias {
|
||||
switch await clientProxy.joinRoomAlias(alias) {
|
||||
case .success:
|
||||
appSettings.seenInvites.remove(roomID)
|
||||
actionsSubject.send(.joined)
|
||||
await finishJoinAction()
|
||||
case .failure(let error):
|
||||
switch error {
|
||||
case .forbiddenAccess:
|
||||
@@ -261,8 +261,7 @@ class JoinRoomScreenViewModel: JoinRoomScreenViewModelType, JoinRoomScreenViewMo
|
||||
} else {
|
||||
switch await clientProxy.joinRoom(roomID, via: via) {
|
||||
case .success:
|
||||
appSettings.seenInvites.remove(roomID)
|
||||
actionsSubject.send(.joined)
|
||||
await finishJoinAction()
|
||||
case .failure(let error):
|
||||
switch error {
|
||||
case .forbiddenAccess:
|
||||
@@ -279,6 +278,23 @@ class JoinRoomScreenViewModel: JoinRoomScreenViewModelType, JoinRoomScreenViewMo
|
||||
}
|
||||
}
|
||||
|
||||
private func finishJoinAction() async {
|
||||
appSettings.seenInvites.remove(roomID)
|
||||
|
||||
guard state.roomDetails?.isSpace == true else {
|
||||
actionsSubject.send(.joined(.roomID(roomID)))
|
||||
return
|
||||
}
|
||||
|
||||
switch await clientProxy.spaceService.spaceRoomList(spaceID: roomID) {
|
||||
case .success(let spaceRoomListProxy):
|
||||
actionsSubject.send(.joined(.space(spaceRoomListProxy)))
|
||||
case .failure(let error):
|
||||
MXLog.error("Failed to get the space room list after joining: \(error)")
|
||||
userIndicatorController.submitIndicator(.init(title: L10n.errorUnknown))
|
||||
}
|
||||
}
|
||||
|
||||
private func knockRoom() async {
|
||||
showLoadingIndicator()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user