Skip to content

Commit

Permalink
element-hq/element-meta/issues/2213 - Automatically pop the invites l…
Browse files Browse the repository at this point in the history
…ist when acting on the last one. Coming back from the room will go directly back to the room list
  • Loading branch information
stefanceriu committed Nov 24, 2023
1 parent 07eccbe commit 163e2e4
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions ElementX/Sources/FlowCoordinators/UserSessionFlowCoordinator.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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 availableInvitesCount == 1 {
dismissInvitesList(animated: false)
}

stateMachine.processEvent(.selectRoom(roomID: roomID))
case .dismissedRoom:
stateMachine.processEvent(.deselectRoom)
Expand Down Expand Up @@ -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) {
Expand Down

0 comments on commit 163e2e4

Please sign in to comment.