mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-11-06 04:18:31 +00:00
added animated to the start of a flow coordinator
This commit is contained in:
@@ -11,11 +11,17 @@ import Foundation
|
|||||||
// periphery:ignore - markdown protocol
|
// periphery:ignore - markdown protocol
|
||||||
@MainActor
|
@MainActor
|
||||||
protocol FlowCoordinatorProtocol {
|
protocol FlowCoordinatorProtocol {
|
||||||
func start()
|
func start(animated: Bool)
|
||||||
func handleAppRoute(_ appRoute: AppRoute, animated: Bool)
|
func handleAppRoute(_ appRoute: AppRoute, animated: Bool)
|
||||||
func clearRoute(animated: Bool)
|
func clearRoute(animated: Bool)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
extension FlowCoordinatorProtocol {
|
||||||
|
func start() {
|
||||||
|
start(animated: true)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// Core parameters that are shared across the main flows for easy dependency injection.
|
/// Core parameters that are shared across the main flows for easy dependency injection.
|
||||||
///
|
///
|
||||||
/// Please do **not** pass this type directly to screen coordinators/view models.
|
/// Please do **not** pass this type directly to screen coordinators/view models.
|
||||||
|
|||||||
@@ -85,7 +85,7 @@ class AppLockSetupFlowCoordinator: FlowCoordinatorProtocol {
|
|||||||
configureStateMachine()
|
configureStateMachine()
|
||||||
}
|
}
|
||||||
|
|
||||||
func start() {
|
func start(animated: Bool) {
|
||||||
stateMachine.tryEvent(.start)
|
stateMachine.tryEvent(.start)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -122,7 +122,7 @@ class AuthenticationFlowCoordinator: FlowCoordinatorProtocol {
|
|||||||
configureStateMachine()
|
configureStateMachine()
|
||||||
}
|
}
|
||||||
|
|
||||||
func start() {
|
func start(animated: Bool) {
|
||||||
stateMachine.tryEvent(.start)
|
stateMachine.tryEvent(.start)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -50,7 +50,7 @@ class BugReportFlowCoordinator: FlowCoordinatorProtocol {
|
|||||||
self.parameters = parameters
|
self.parameters = parameters
|
||||||
}
|
}
|
||||||
|
|
||||||
func start() {
|
func start(animated: Bool) {
|
||||||
presentBugReportScreen()
|
presentBugReportScreen()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -70,7 +70,7 @@ class ChatsFlowCoordinator: FlowCoordinatorProtocol {
|
|||||||
setupObservers()
|
setupObservers()
|
||||||
}
|
}
|
||||||
|
|
||||||
func start() {
|
func start(animated: Bool) {
|
||||||
stateMachine.processEvent(.start)
|
stateMachine.processEvent(.start)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -71,7 +71,7 @@ class EncryptionResetFlowCoordinator: FlowCoordinatorProtocol {
|
|||||||
configureStateMachine()
|
configureStateMachine()
|
||||||
}
|
}
|
||||||
|
|
||||||
func start() {
|
func start(animated: Bool) {
|
||||||
stateMachine.tryEvent(.start)
|
stateMachine.tryEvent(.start)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -72,7 +72,7 @@ class EncryptionSettingsFlowCoordinator: FlowCoordinatorProtocol {
|
|||||||
configureStateMachine()
|
configureStateMachine()
|
||||||
}
|
}
|
||||||
|
|
||||||
func start() {
|
func start(animated: Bool) {
|
||||||
stateMachine.tryEvent(.start)
|
stateMachine.tryEvent(.start)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -37,7 +37,7 @@ class MediaEventsTimelineFlowCoordinator: FlowCoordinatorProtocol {
|
|||||||
self.flowParameters = flowParameters
|
self.flowParameters = flowParameters
|
||||||
}
|
}
|
||||||
|
|
||||||
func start() {
|
func start(animated: Bool) {
|
||||||
Task { await presentMediaEventsTimeline() }
|
Task { await presentMediaEventsTimeline() }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -103,7 +103,7 @@ class OnboardingFlowCoordinator: FlowCoordinatorProtocol {
|
|||||||
return isNewLogin || requiresVerification || requiresAppLockSetup || requiresAnalyticsSetup || requiresNotificationsSetup
|
return isNewLogin || requiresVerification || requiresAppLockSetup || requiresAnalyticsSetup || requiresNotificationsSetup
|
||||||
}
|
}
|
||||||
|
|
||||||
func start() {
|
func start(animated: Bool) {
|
||||||
guard shouldStart else {
|
guard shouldStart else {
|
||||||
fatalError("This flow coordinator shouldn't have been started")
|
fatalError("This flow coordinator shouldn't have been started")
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -38,7 +38,7 @@ class PinnedEventsTimelineFlowCoordinator: FlowCoordinatorProtocol {
|
|||||||
self.flowParameters = flowParameters
|
self.flowParameters = flowParameters
|
||||||
}
|
}
|
||||||
|
|
||||||
func start() {
|
func start(animated: Bool) {
|
||||||
Task { await presentPinnedEventsTimeline() }
|
Task { await presentPinnedEventsTimeline() }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -115,7 +115,7 @@ class RoomFlowCoordinator: FlowCoordinatorProtocol {
|
|||||||
|
|
||||||
// MARK: - FlowCoordinatorProtocol
|
// MARK: - FlowCoordinatorProtocol
|
||||||
|
|
||||||
func start() {
|
func start(animated: Bool) {
|
||||||
fatalError("This flow coordinator expect a route")
|
fatalError("This flow coordinator expect a route")
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1550,12 +1550,11 @@ class RoomFlowCoordinator: FlowCoordinatorProtocol {
|
|||||||
|
|
||||||
spaceFlowCoordinator = coordinator
|
spaceFlowCoordinator = coordinator
|
||||||
|
|
||||||
coordinator.start()
|
coordinator.start(animated: animated)
|
||||||
}
|
}
|
||||||
|
|
||||||
private func startMembersFlow(entryPoint: RoomMembersFlowCoordinatorEntryPoint, animated: Bool) {
|
private func startMembersFlow(entryPoint: RoomMembersFlowCoordinatorEntryPoint, animated: Bool) {
|
||||||
let flowCoordinator = RoomMembersFlowCoordinator(entryPoint: entryPoint,
|
let flowCoordinator = RoomMembersFlowCoordinator(entryPoint: entryPoint,
|
||||||
animatedEntry: animated,
|
|
||||||
roomProxy: roomProxy,
|
roomProxy: roomProxy,
|
||||||
navigationStackCoordinator: navigationStackCoordinator,
|
navigationStackCoordinator: navigationStackCoordinator,
|
||||||
flowParameters: flowParameters)
|
flowParameters: flowParameters)
|
||||||
@@ -1573,7 +1572,7 @@ class RoomFlowCoordinator: FlowCoordinatorProtocol {
|
|||||||
}
|
}
|
||||||
.store(in: &cancellables)
|
.store(in: &cancellables)
|
||||||
|
|
||||||
flowCoordinator.start()
|
flowCoordinator.start(animated: animated)
|
||||||
membersFlowCoordinator = flowCoordinator
|
membersFlowCoordinator = flowCoordinator
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -57,7 +57,6 @@ final class RoomMembersFlowCoordinator: FlowCoordinatorProtocol {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private let entryPoint: RoomMembersFlowCoordinatorEntryPoint
|
private let entryPoint: RoomMembersFlowCoordinatorEntryPoint
|
||||||
private let animatedEntry: Bool
|
|
||||||
private let roomProxy: JoinedRoomProxyProtocol
|
private let roomProxy: JoinedRoomProxyProtocol
|
||||||
private let navigationStackCoordinator: NavigationStackCoordinator
|
private let navigationStackCoordinator: NavigationStackCoordinator
|
||||||
private let flowParameters: CommonFlowParameters
|
private let flowParameters: CommonFlowParameters
|
||||||
@@ -73,7 +72,6 @@ final class RoomMembersFlowCoordinator: FlowCoordinatorProtocol {
|
|||||||
private var roomFlowCoordinator: RoomFlowCoordinator?
|
private var roomFlowCoordinator: RoomFlowCoordinator?
|
||||||
|
|
||||||
init(entryPoint: RoomMembersFlowCoordinatorEntryPoint,
|
init(entryPoint: RoomMembersFlowCoordinatorEntryPoint,
|
||||||
animatedEntry: Bool,
|
|
||||||
roomProxy: JoinedRoomProxyProtocol,
|
roomProxy: JoinedRoomProxyProtocol,
|
||||||
navigationStackCoordinator: NavigationStackCoordinator,
|
navigationStackCoordinator: NavigationStackCoordinator,
|
||||||
flowParameters: CommonFlowParameters) {
|
flowParameters: CommonFlowParameters) {
|
||||||
@@ -81,18 +79,17 @@ final class RoomMembersFlowCoordinator: FlowCoordinatorProtocol {
|
|||||||
self.roomProxy = roomProxy
|
self.roomProxy = roomProxy
|
||||||
self.flowParameters = flowParameters
|
self.flowParameters = flowParameters
|
||||||
self.navigationStackCoordinator = navigationStackCoordinator
|
self.navigationStackCoordinator = navigationStackCoordinator
|
||||||
self.animatedEntry = animatedEntry
|
|
||||||
|
|
||||||
stateMachine = .init(state: .initial)
|
stateMachine = .init(state: .initial)
|
||||||
configureStateMachine()
|
configureStateMachine()
|
||||||
}
|
}
|
||||||
|
|
||||||
func start() {
|
func start(animated: Bool) {
|
||||||
switch entryPoint {
|
switch entryPoint {
|
||||||
case .roomMember(let userID):
|
case .roomMember(let userID):
|
||||||
stateMachine.tryEvent(.presentRoomMemberDetails(userID: userID), userInfo: animatedEntry)
|
stateMachine.tryEvent(.presentRoomMemberDetails(userID: userID), userInfo: animated)
|
||||||
case .roomMembersList:
|
case .roomMembersList:
|
||||||
stateMachine.tryEvent(.presentRoomMembersList, userInfo: animatedEntry)
|
stateMachine.tryEvent(.presentRoomMembersList, userInfo: animated)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -116,9 +113,11 @@ final class RoomMembersFlowCoordinator: FlowCoordinatorProtocol {
|
|||||||
} else {
|
} else {
|
||||||
stateMachine.tryEvent(.startRoomFlow(roomID: roomID, via: via, eventID: eventID), userInfo: animated)
|
stateMachine.tryEvent(.startRoomFlow(roomID: roomID, via: via, eventID: eventID), userInfo: animated)
|
||||||
}
|
}
|
||||||
case .accountProvisioningLink, .roomList, .room, .roomAlias, .childRoomAlias, .roomDetails, .event,
|
case .roomAlias, .childRoomAlias, .eventOnRoomAlias, .childEventOnRoomAlias:
|
||||||
.eventOnRoomAlias, .childEventOnRoomAlias, .userProfile, .call, .genericCallLink, .settings,
|
break // These are converted to a room ID route one level above.
|
||||||
.chatBackupSettings, .share, .transferOwnership, .thread:
|
case .accountProvisioningLink, .roomList, .room, .roomDetails, .event,
|
||||||
|
.userProfile, .call, .genericCallLink, .settings, .chatBackupSettings,
|
||||||
|
.share, .transferOwnership, .thread:
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -77,7 +77,7 @@ class RoomRolesAndPermissionsFlowCoordinator: FlowCoordinatorProtocol {
|
|||||||
configureStateMachine()
|
configureStateMachine()
|
||||||
}
|
}
|
||||||
|
|
||||||
func start() {
|
func start(animated: Bool) {
|
||||||
stateMachine.tryEvent(.start)
|
stateMachine.tryEvent(.start)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -44,7 +44,7 @@ class SettingsFlowCoordinator: FlowCoordinatorProtocol {
|
|||||||
self.flowParameters = flowParameters
|
self.flowParameters = flowParameters
|
||||||
}
|
}
|
||||||
|
|
||||||
func start() {
|
func start(animated: Bool) {
|
||||||
fatalError("Unavailable")
|
fatalError("Unavailable")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -68,7 +68,7 @@ class SpaceExplorerFlowCoordinator: FlowCoordinatorProtocol {
|
|||||||
configureStateMachine()
|
configureStateMachine()
|
||||||
}
|
}
|
||||||
|
|
||||||
func start() {
|
func start(animated: Bool) {
|
||||||
stateMachine.tryEvent(.start)
|
stateMachine.tryEvent(.start)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -109,7 +109,7 @@ class SpaceFlowCoordinator: FlowCoordinatorProtocol {
|
|||||||
configureStateMachine()
|
configureStateMachine()
|
||||||
}
|
}
|
||||||
|
|
||||||
func start() {
|
func start(animated: Bool) {
|
||||||
switch entryPoint {
|
switch entryPoint {
|
||||||
case .space:
|
case .space:
|
||||||
stateMachine.tryEvent(.start)
|
stateMachine.tryEvent(.start)
|
||||||
@@ -373,7 +373,6 @@ class SpaceFlowCoordinator: FlowCoordinatorProtocol {
|
|||||||
|
|
||||||
private func startMembersFlow(roomProxy: JoinedRoomProxyProtocol) async {
|
private func startMembersFlow(roomProxy: JoinedRoomProxyProtocol) async {
|
||||||
let flowCoordinator = RoomMembersFlowCoordinator(entryPoint: .roomMembersList,
|
let flowCoordinator = RoomMembersFlowCoordinator(entryPoint: .roomMembersList,
|
||||||
animatedEntry: true,
|
|
||||||
roomProxy: roomProxy,
|
roomProxy: roomProxy,
|
||||||
navigationStackCoordinator: navigationStackCoordinator,
|
navigationStackCoordinator: navigationStackCoordinator,
|
||||||
flowParameters: flowParameters)
|
flowParameters: flowParameters)
|
||||||
|
|||||||
@@ -108,7 +108,7 @@ class UserSessionFlowCoordinator: FlowCoordinatorProtocol {
|
|||||||
setupObservers()
|
setupObservers()
|
||||||
}
|
}
|
||||||
|
|
||||||
func start() {
|
func start(animated: Bool) {
|
||||||
stateMachine.tryEvent(.start)
|
stateMachine.tryEvent(.start)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user