diff --git a/ElementX/Sources/FlowCoordinators/UserSessionFlowCoordinator.swift b/ElementX/Sources/FlowCoordinators/UserSessionFlowCoordinator.swift index cda06257da..cc8fbd080e 100644 --- a/ElementX/Sources/FlowCoordinators/UserSessionFlowCoordinator.swift +++ b/ElementX/Sources/FlowCoordinators/UserSessionFlowCoordinator.swift @@ -97,6 +97,12 @@ class UserSessionFlowCoordinator: FlowCoordinatorProtocol { switch action { case .presentedRoom(let roomID): analytics.signpost.beginRoomFlow(roomID) + + let availableInvitesCount = userSession.clientProxy.inviteSummaryProvider?.roomListPublisher.value.count ?? 0 + if case .invitesScreen = stateMachine.state, availableInvitesCount == 1 { + dismissInvitesList(animated: true) + } + stateMachine.processEvent(.selectRoom(roomID: roomID)) case .dismissedRoom: stateMachine.processEvent(.deselectRoom) @@ -521,6 +527,14 @@ class UserSessionFlowCoordinator: FlowCoordinatorProtocol { } } + private func dismissInvitesList(animated: Bool) { + guard case .invitesScreen = stateMachine.state else { + fatalError() + } + + sidebarNavigationStackCoordinator.pop(animated: animated) + } + // MARK: Calls private func presentCallScreen(roomProxy: RoomProxyProtocol) { diff --git a/changelog.d/pr-2213.change b/changelog.d/pr-2213.change new file mode 100644 index 0000000000..571a69c089 --- /dev/null +++ b/changelog.d/pr-2213.change @@ -0,0 +1 @@ +Automatically pop the invites list when acting on the last one. Coming back from the room will go directly back to the room list \ No newline at end of file