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 59eb253
Show file tree
Hide file tree
Showing 2 changed files with 15 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 case .invitesScreen = stateMachine.state, availableInvitesCount == 1 {
dismissInvitesList(animated: true)
}

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
1 change: 1 addition & 0 deletions changelog.d/pr-2213.change
Original file line number Diff line number Diff line 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

0 comments on commit 59eb253

Please sign in to comment.