mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-11-02 21:33:26 +00:00
Handle Room Routing using the membership state (#2154)
This commit is contained in:
@@ -106,7 +106,7 @@ class RoomFlowCoordinator: FlowCoordinatorProtocol {
|
||||
MXLog.error("[RoomFlowCoordinator] Failed to get member: RoomProxy is nil")
|
||||
}
|
||||
}
|
||||
case .invites, .genericCallLink, .oidcCallback, .settings, .chatBackupSettings:
|
||||
case .genericCallLink, .oidcCallback, .settings, .chatBackupSettings:
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
@@ -151,13 +151,12 @@ class UserSessionFlowCoordinator: FlowCoordinatorProtocol {
|
||||
guard let self else { return }
|
||||
|
||||
switch appRoute {
|
||||
case .room, .roomDetails, .roomList, .roomMemberDetails:
|
||||
self.roomFlowCoordinator.handleAppRoute(appRoute, animated: animated)
|
||||
case .invites:
|
||||
if UIDevice.current.isPhone {
|
||||
self.roomFlowCoordinator.clearRoute(animated: animated)
|
||||
case .room(let roomID):
|
||||
Task {
|
||||
await self.handleRoomRoute(roomID: roomID, animated: animated)
|
||||
}
|
||||
self.stateMachine.processEvent(.showInvitesScreen, userInfo: .init(animated: animated))
|
||||
case .roomDetails, .roomList, .roomMemberDetails:
|
||||
self.roomFlowCoordinator.handleAppRoute(appRoute, animated: animated)
|
||||
case .genericCallLink(let url):
|
||||
self.navigationSplitCoordinator.setSheetCoordinator(GenericCallLinkCoordinator(parameters: .init(url: url)), animated: animated)
|
||||
case .oidcCallback:
|
||||
@@ -167,6 +166,21 @@ class UserSessionFlowCoordinator: FlowCoordinatorProtocol {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private func handleRoomRoute(roomID: String, animated: Bool) async {
|
||||
switch await userSession.clientProxy.roomForIdentifier(roomID)?.membership {
|
||||
case .invited:
|
||||
if UIDevice.current.isPhone {
|
||||
roomFlowCoordinator.clearRoute(animated: animated)
|
||||
}
|
||||
stateMachine.processEvent(.showInvitesScreen, userInfo: .init(animated: animated))
|
||||
case .joined:
|
||||
roomFlowCoordinator.handleAppRoute(.room(roomID: roomID), animated: animated)
|
||||
case .left, .none:
|
||||
// Do nothing but maybe we should ask design to have some kind of error state
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
func clearRoute(animated: Bool) {
|
||||
fatalError("not necessary as of right now")
|
||||
|
||||
Reference in New Issue
Block a user