diff --git a/ElementX/Sources/Application/FlowCoordinatorProtocol.swift b/ElementX/Sources/Application/FlowCoordinatorProtocol.swift index a025c829b..95f67590c 100644 --- a/ElementX/Sources/Application/FlowCoordinatorProtocol.swift +++ b/ElementX/Sources/Application/FlowCoordinatorProtocol.swift @@ -11,11 +11,17 @@ import Foundation // periphery:ignore - markdown protocol @MainActor protocol FlowCoordinatorProtocol { - func start() + func start(animated: Bool) func handleAppRoute(_ appRoute: AppRoute, 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. /// /// Please do **not** pass this type directly to screen coordinators/view models. diff --git a/ElementX/Sources/FlowCoordinators/AppLockSetupFlowCoordinator.swift b/ElementX/Sources/FlowCoordinators/AppLockSetupFlowCoordinator.swift index 51ed1616a..85d577cdd 100644 --- a/ElementX/Sources/FlowCoordinators/AppLockSetupFlowCoordinator.swift +++ b/ElementX/Sources/FlowCoordinators/AppLockSetupFlowCoordinator.swift @@ -85,7 +85,7 @@ class AppLockSetupFlowCoordinator: FlowCoordinatorProtocol { configureStateMachine() } - func start() { + func start(animated: Bool) { stateMachine.tryEvent(.start) } diff --git a/ElementX/Sources/FlowCoordinators/AuthenticationFlowCoordinator.swift b/ElementX/Sources/FlowCoordinators/AuthenticationFlowCoordinator.swift index 1f1352219..6c2b33e8e 100644 --- a/ElementX/Sources/FlowCoordinators/AuthenticationFlowCoordinator.swift +++ b/ElementX/Sources/FlowCoordinators/AuthenticationFlowCoordinator.swift @@ -122,7 +122,7 @@ class AuthenticationFlowCoordinator: FlowCoordinatorProtocol { configureStateMachine() } - func start() { + func start(animated: Bool) { stateMachine.tryEvent(.start) } diff --git a/ElementX/Sources/FlowCoordinators/BugReportFlowCoordinator.swift b/ElementX/Sources/FlowCoordinators/BugReportFlowCoordinator.swift index 428ce1711..a684675dc 100644 --- a/ElementX/Sources/FlowCoordinators/BugReportFlowCoordinator.swift +++ b/ElementX/Sources/FlowCoordinators/BugReportFlowCoordinator.swift @@ -50,7 +50,7 @@ class BugReportFlowCoordinator: FlowCoordinatorProtocol { self.parameters = parameters } - func start() { + func start(animated: Bool) { presentBugReportScreen() } diff --git a/ElementX/Sources/FlowCoordinators/ChatsFlowCoordinator.swift b/ElementX/Sources/FlowCoordinators/ChatsFlowCoordinator.swift index 350ae3191..07495850a 100644 --- a/ElementX/Sources/FlowCoordinators/ChatsFlowCoordinator.swift +++ b/ElementX/Sources/FlowCoordinators/ChatsFlowCoordinator.swift @@ -70,7 +70,7 @@ class ChatsFlowCoordinator: FlowCoordinatorProtocol { setupObservers() } - func start() { + func start(animated: Bool) { stateMachine.processEvent(.start) } diff --git a/ElementX/Sources/FlowCoordinators/EncryptionResetFlowCoordinator.swift b/ElementX/Sources/FlowCoordinators/EncryptionResetFlowCoordinator.swift index a6b8cde90..1e9b57112 100644 --- a/ElementX/Sources/FlowCoordinators/EncryptionResetFlowCoordinator.swift +++ b/ElementX/Sources/FlowCoordinators/EncryptionResetFlowCoordinator.swift @@ -71,7 +71,7 @@ class EncryptionResetFlowCoordinator: FlowCoordinatorProtocol { configureStateMachine() } - func start() { + func start(animated: Bool) { stateMachine.tryEvent(.start) } diff --git a/ElementX/Sources/FlowCoordinators/EncryptionSettingsFlowCoordinator.swift b/ElementX/Sources/FlowCoordinators/EncryptionSettingsFlowCoordinator.swift index 17fb90506..3dae9e69a 100644 --- a/ElementX/Sources/FlowCoordinators/EncryptionSettingsFlowCoordinator.swift +++ b/ElementX/Sources/FlowCoordinators/EncryptionSettingsFlowCoordinator.swift @@ -72,7 +72,7 @@ class EncryptionSettingsFlowCoordinator: FlowCoordinatorProtocol { configureStateMachine() } - func start() { + func start(animated: Bool) { stateMachine.tryEvent(.start) } diff --git a/ElementX/Sources/FlowCoordinators/MediaEventsTimelineFlowCoordinator.swift b/ElementX/Sources/FlowCoordinators/MediaEventsTimelineFlowCoordinator.swift index c4fb5d042..d0e9f75d4 100644 --- a/ElementX/Sources/FlowCoordinators/MediaEventsTimelineFlowCoordinator.swift +++ b/ElementX/Sources/FlowCoordinators/MediaEventsTimelineFlowCoordinator.swift @@ -37,7 +37,7 @@ class MediaEventsTimelineFlowCoordinator: FlowCoordinatorProtocol { self.flowParameters = flowParameters } - func start() { + func start(animated: Bool) { Task { await presentMediaEventsTimeline() } } diff --git a/ElementX/Sources/FlowCoordinators/OnboardingFlowCoordinator.swift b/ElementX/Sources/FlowCoordinators/OnboardingFlowCoordinator.swift index 8fbf6cff9..a07e73ff9 100644 --- a/ElementX/Sources/FlowCoordinators/OnboardingFlowCoordinator.swift +++ b/ElementX/Sources/FlowCoordinators/OnboardingFlowCoordinator.swift @@ -103,7 +103,7 @@ class OnboardingFlowCoordinator: FlowCoordinatorProtocol { return isNewLogin || requiresVerification || requiresAppLockSetup || requiresAnalyticsSetup || requiresNotificationsSetup } - func start() { + func start(animated: Bool) { guard shouldStart else { fatalError("This flow coordinator shouldn't have been started") } diff --git a/ElementX/Sources/FlowCoordinators/PinnedEventsTimelineFlowCoordinator.swift b/ElementX/Sources/FlowCoordinators/PinnedEventsTimelineFlowCoordinator.swift index 695750cfc..358e8efe2 100644 --- a/ElementX/Sources/FlowCoordinators/PinnedEventsTimelineFlowCoordinator.swift +++ b/ElementX/Sources/FlowCoordinators/PinnedEventsTimelineFlowCoordinator.swift @@ -38,7 +38,7 @@ class PinnedEventsTimelineFlowCoordinator: FlowCoordinatorProtocol { self.flowParameters = flowParameters } - func start() { + func start(animated: Bool) { Task { await presentPinnedEventsTimeline() } } diff --git a/ElementX/Sources/FlowCoordinators/RoomFlowCoordinator.swift b/ElementX/Sources/FlowCoordinators/RoomFlowCoordinator.swift index f05aac533..4fbe65919 100644 --- a/ElementX/Sources/FlowCoordinators/RoomFlowCoordinator.swift +++ b/ElementX/Sources/FlowCoordinators/RoomFlowCoordinator.swift @@ -115,7 +115,7 @@ class RoomFlowCoordinator: FlowCoordinatorProtocol { // MARK: - FlowCoordinatorProtocol - func start() { + func start(animated: Bool) { fatalError("This flow coordinator expect a route") } @@ -1550,12 +1550,11 @@ class RoomFlowCoordinator: FlowCoordinatorProtocol { spaceFlowCoordinator = coordinator - coordinator.start() + coordinator.start(animated: animated) } private func startMembersFlow(entryPoint: RoomMembersFlowCoordinatorEntryPoint, animated: Bool) { let flowCoordinator = RoomMembersFlowCoordinator(entryPoint: entryPoint, - animatedEntry: animated, roomProxy: roomProxy, navigationStackCoordinator: navigationStackCoordinator, flowParameters: flowParameters) @@ -1573,7 +1572,7 @@ class RoomFlowCoordinator: FlowCoordinatorProtocol { } .store(in: &cancellables) - flowCoordinator.start() + flowCoordinator.start(animated: animated) membersFlowCoordinator = flowCoordinator } diff --git a/ElementX/Sources/FlowCoordinators/RoomMembersFlowCoordinator.swift b/ElementX/Sources/FlowCoordinators/RoomMembersFlowCoordinator.swift index 2985bd56f..b1c48a603 100644 --- a/ElementX/Sources/FlowCoordinators/RoomMembersFlowCoordinator.swift +++ b/ElementX/Sources/FlowCoordinators/RoomMembersFlowCoordinator.swift @@ -57,7 +57,6 @@ final class RoomMembersFlowCoordinator: FlowCoordinatorProtocol { } private let entryPoint: RoomMembersFlowCoordinatorEntryPoint - private let animatedEntry: Bool private let roomProxy: JoinedRoomProxyProtocol private let navigationStackCoordinator: NavigationStackCoordinator private let flowParameters: CommonFlowParameters @@ -73,7 +72,6 @@ final class RoomMembersFlowCoordinator: FlowCoordinatorProtocol { private var roomFlowCoordinator: RoomFlowCoordinator? init(entryPoint: RoomMembersFlowCoordinatorEntryPoint, - animatedEntry: Bool, roomProxy: JoinedRoomProxyProtocol, navigationStackCoordinator: NavigationStackCoordinator, flowParameters: CommonFlowParameters) { @@ -81,18 +79,17 @@ final class RoomMembersFlowCoordinator: FlowCoordinatorProtocol { self.roomProxy = roomProxy self.flowParameters = flowParameters self.navigationStackCoordinator = navigationStackCoordinator - self.animatedEntry = animatedEntry stateMachine = .init(state: .initial) configureStateMachine() } - func start() { + func start(animated: Bool) { switch entryPoint { case .roomMember(let userID): - stateMachine.tryEvent(.presentRoomMemberDetails(userID: userID), userInfo: animatedEntry) + stateMachine.tryEvent(.presentRoomMemberDetails(userID: userID), userInfo: animated) case .roomMembersList: - stateMachine.tryEvent(.presentRoomMembersList, userInfo: animatedEntry) + stateMachine.tryEvent(.presentRoomMembersList, userInfo: animated) } } @@ -116,9 +113,11 @@ final class RoomMembersFlowCoordinator: FlowCoordinatorProtocol { } else { stateMachine.tryEvent(.startRoomFlow(roomID: roomID, via: via, eventID: eventID), userInfo: animated) } - case .accountProvisioningLink, .roomList, .room, .roomAlias, .childRoomAlias, .roomDetails, .event, - .eventOnRoomAlias, .childEventOnRoomAlias, .userProfile, .call, .genericCallLink, .settings, - .chatBackupSettings, .share, .transferOwnership, .thread: + case .roomAlias, .childRoomAlias, .eventOnRoomAlias, .childEventOnRoomAlias: + break // These are converted to a room ID route one level above. + case .accountProvisioningLink, .roomList, .room, .roomDetails, .event, + .userProfile, .call, .genericCallLink, .settings, .chatBackupSettings, + .share, .transferOwnership, .thread: break } } diff --git a/ElementX/Sources/FlowCoordinators/RoomRolesAndPermissionsFlowCoordinator.swift b/ElementX/Sources/FlowCoordinators/RoomRolesAndPermissionsFlowCoordinator.swift index 3cc4ce2b1..9240e4995 100644 --- a/ElementX/Sources/FlowCoordinators/RoomRolesAndPermissionsFlowCoordinator.swift +++ b/ElementX/Sources/FlowCoordinators/RoomRolesAndPermissionsFlowCoordinator.swift @@ -77,7 +77,7 @@ class RoomRolesAndPermissionsFlowCoordinator: FlowCoordinatorProtocol { configureStateMachine() } - func start() { + func start(animated: Bool) { stateMachine.tryEvent(.start) } diff --git a/ElementX/Sources/FlowCoordinators/SettingsFlowCoordinator.swift b/ElementX/Sources/FlowCoordinators/SettingsFlowCoordinator.swift index a3e02f566..434436eab 100644 --- a/ElementX/Sources/FlowCoordinators/SettingsFlowCoordinator.swift +++ b/ElementX/Sources/FlowCoordinators/SettingsFlowCoordinator.swift @@ -44,7 +44,7 @@ class SettingsFlowCoordinator: FlowCoordinatorProtocol { self.flowParameters = flowParameters } - func start() { + func start(animated: Bool) { fatalError("Unavailable") } diff --git a/ElementX/Sources/FlowCoordinators/SpaceExplorerFlowCoordinator.swift b/ElementX/Sources/FlowCoordinators/SpaceExplorerFlowCoordinator.swift index 63a29f047..489c9af81 100644 --- a/ElementX/Sources/FlowCoordinators/SpaceExplorerFlowCoordinator.swift +++ b/ElementX/Sources/FlowCoordinators/SpaceExplorerFlowCoordinator.swift @@ -68,7 +68,7 @@ class SpaceExplorerFlowCoordinator: FlowCoordinatorProtocol { configureStateMachine() } - func start() { + func start(animated: Bool) { stateMachine.tryEvent(.start) } diff --git a/ElementX/Sources/FlowCoordinators/SpaceFlowCoordinator.swift b/ElementX/Sources/FlowCoordinators/SpaceFlowCoordinator.swift index 72d03e184..767083cbd 100644 --- a/ElementX/Sources/FlowCoordinators/SpaceFlowCoordinator.swift +++ b/ElementX/Sources/FlowCoordinators/SpaceFlowCoordinator.swift @@ -109,7 +109,7 @@ class SpaceFlowCoordinator: FlowCoordinatorProtocol { configureStateMachine() } - func start() { + func start(animated: Bool) { switch entryPoint { case .space: stateMachine.tryEvent(.start) @@ -373,7 +373,6 @@ class SpaceFlowCoordinator: FlowCoordinatorProtocol { private func startMembersFlow(roomProxy: JoinedRoomProxyProtocol) async { let flowCoordinator = RoomMembersFlowCoordinator(entryPoint: .roomMembersList, - animatedEntry: true, roomProxy: roomProxy, navigationStackCoordinator: navigationStackCoordinator, flowParameters: flowParameters) diff --git a/ElementX/Sources/FlowCoordinators/UserSessionFlowCoordinator.swift b/ElementX/Sources/FlowCoordinators/UserSessionFlowCoordinator.swift index 9c27ce931..a34d27044 100644 --- a/ElementX/Sources/FlowCoordinators/UserSessionFlowCoordinator.swift +++ b/ElementX/Sources/FlowCoordinators/UserSessionFlowCoordinator.swift @@ -108,7 +108,7 @@ class UserSessionFlowCoordinator: FlowCoordinatorProtocol { setupObservers() } - func start() { + func start(animated: Bool) { stateMachine.tryEvent(.start) }