mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-11-02 12:07:55 +00:00
Invites list (#787)
* Setup invites SS window * Add invites label in the home screen * Add empty invtes list * Setup navigation to invites list * Inject invitesSummaryProvider * Show invites * Add InviteCell * Refine InviteCell UI * Push invites * Amend SS configuration * Add inviter in RoomProxyProtocol * Add Invite model type * Improve InviteCell * Fix media provider injection * Refine InviteCell * Refine invite cell * Add invites feature flag * Try different SS config for invites * Regiester invites view in configureViewsPostInitialSync * Cleanup * Start tests * Cleanup code * Add changelog.d file * Add tests * Handle canonical alias * Add InvitesListScreen previews * Add localisations and improve UI tests * Add reference screenshots * Cleanup code * Fix UT build errors * Refactor InvitesList -> Invites * Apply pr comments * Remove reduntant @MainActor * Naming cleanup * Fix InvitesScreenCell.title * Add accept/decline InvitesViewAction * Revert Package.resolved * Add warning in InvitesScreenCell * Improve PlaceholderAvatarImage * Record snapshots again * Refactor Invite -> InvitesRoomDeatils * Rename identifier in PlaceholderAvatarImage
This commit is contained in:
@@ -14,6 +14,7 @@
|
||||
// limitations under the License.
|
||||
//
|
||||
|
||||
import Combine
|
||||
import SwiftUI
|
||||
|
||||
enum UserSessionFlowCoordinatorAction {
|
||||
@@ -22,6 +23,7 @@ enum UserSessionFlowCoordinatorAction {
|
||||
|
||||
class UserSessionFlowCoordinator: CoordinatorProtocol {
|
||||
private let stateMachine: UserSessionFlowCoordinatorStateMachine
|
||||
private var cancellables: Set<AnyCancellable> = .init()
|
||||
|
||||
private let userSession: UserSessionProtocol
|
||||
private let navigationSplitCoordinator: NavigationSplitCoordinator
|
||||
@@ -64,7 +66,7 @@ class UserSessionFlowCoordinator: CoordinatorProtocol {
|
||||
|
||||
func handleAppRoute(_ appRoute: AppRoute) {
|
||||
switch stateMachine.state {
|
||||
case .feedbackScreen, .sessionVerificationScreen, .settingsScreen, .startChatScreen:
|
||||
case .feedbackScreen, .sessionVerificationScreen, .settingsScreen, .startChatScreen, .invitesScreen:
|
||||
navigationSplitCoordinator.setSheetCoordinator(nil)
|
||||
case .roomList, .initial:
|
||||
break
|
||||
@@ -115,6 +117,10 @@ class UserSessionFlowCoordinator: CoordinatorProtocol {
|
||||
self.presentStartChat()
|
||||
case (.startChatScreen, .dismissedStartChatScreen, .roomList):
|
||||
break
|
||||
case (.roomList, .showInvitesScreen, .invitesScreen):
|
||||
self.presentInvitesList()
|
||||
case (.invitesScreen, .closedInvitesScreen, .roomList):
|
||||
break
|
||||
default:
|
||||
fatalError("Unknown transition: \(context)")
|
||||
}
|
||||
@@ -150,6 +156,8 @@ class UserSessionFlowCoordinator: CoordinatorProtocol {
|
||||
self.stateMachine.processEvent(.showStartChatScreen)
|
||||
case .signOut:
|
||||
self.callback?(.signOut)
|
||||
case .presentInvitesScreen:
|
||||
self.stateMachine.processEvent(.showInvitesScreen)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -313,4 +321,19 @@ class UserSessionFlowCoordinator: CoordinatorProtocol {
|
||||
self?.stateMachine.processEvent(.dismissedFeedbackScreen)
|
||||
}
|
||||
}
|
||||
|
||||
// MARK: Invites list
|
||||
|
||||
private func presentInvitesList() {
|
||||
let parameters = InvitesCoordinatorParameters(userSession: userSession)
|
||||
let coordinator = InvitesCoordinator(parameters: parameters)
|
||||
|
||||
coordinator.actions
|
||||
.sink { _ in }
|
||||
.store(in: &cancellables)
|
||||
|
||||
navigationSplitCoordinator.setDetailCoordinator(coordinator) { [weak self] in
|
||||
self?.stateMachine.processEvent(.closedInvitesScreen)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -37,6 +37,9 @@ class UserSessionFlowCoordinatorStateMachine {
|
||||
|
||||
/// Showing the start chat screen
|
||||
case startChatScreen(selectedRoomId: String?)
|
||||
|
||||
/// Showing invites list screen
|
||||
case invitesScreen(selectedRoomId: String?)
|
||||
}
|
||||
|
||||
/// Events that can be triggered on the AppCoordinator state machine
|
||||
@@ -69,6 +72,11 @@ class UserSessionFlowCoordinatorStateMachine {
|
||||
case showStartChatScreen
|
||||
/// Start chat has been dismissed
|
||||
case dismissedStartChatScreen
|
||||
|
||||
/// Request presentation of the invites screen
|
||||
case showInvitesScreen
|
||||
/// The invites screen has been dismissed
|
||||
case closedInvitesScreen
|
||||
}
|
||||
|
||||
private let stateMachine: StateMachine<State, Event>
|
||||
@@ -112,6 +120,12 @@ class UserSessionFlowCoordinatorStateMachine {
|
||||
return .startChatScreen(selectedRoomId: selectedRoomId)
|
||||
case (.dismissedStartChatScreen, .startChatScreen(let selectedRoomId)):
|
||||
return .roomList(selectedRoomId: selectedRoomId)
|
||||
|
||||
case (.showInvitesScreen, .roomList(let selectedRoomId)):
|
||||
return .invitesScreen(selectedRoomId: selectedRoomId)
|
||||
case (.closedInvitesScreen, .invitesScreen(let selectedRoomId)):
|
||||
return .roomList(selectedRoomId: selectedRoomId)
|
||||
|
||||
default:
|
||||
return nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user