added animated to the start of a flow coordinator
This commit is contained in:
@@ -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.
|
||||
|
||||
@@ -85,7 +85,7 @@ class AppLockSetupFlowCoordinator: FlowCoordinatorProtocol {
|
||||
configureStateMachine()
|
||||
}
|
||||
|
||||
func start() {
|
||||
func start(animated: Bool) {
|
||||
stateMachine.tryEvent(.start)
|
||||
}
|
||||
|
||||
|
||||
@@ -122,7 +122,7 @@ class AuthenticationFlowCoordinator: FlowCoordinatorProtocol {
|
||||
configureStateMachine()
|
||||
}
|
||||
|
||||
func start() {
|
||||
func start(animated: Bool) {
|
||||
stateMachine.tryEvent(.start)
|
||||
}
|
||||
|
||||
|
||||
@@ -50,7 +50,7 @@ class BugReportFlowCoordinator: FlowCoordinatorProtocol {
|
||||
self.parameters = parameters
|
||||
}
|
||||
|
||||
func start() {
|
||||
func start(animated: Bool) {
|
||||
presentBugReportScreen()
|
||||
}
|
||||
|
||||
|
||||
@@ -70,7 +70,7 @@ class ChatsFlowCoordinator: FlowCoordinatorProtocol {
|
||||
setupObservers()
|
||||
}
|
||||
|
||||
func start() {
|
||||
func start(animated: Bool) {
|
||||
stateMachine.processEvent(.start)
|
||||
}
|
||||
|
||||
|
||||
@@ -71,7 +71,7 @@ class EncryptionResetFlowCoordinator: FlowCoordinatorProtocol {
|
||||
configureStateMachine()
|
||||
}
|
||||
|
||||
func start() {
|
||||
func start(animated: Bool) {
|
||||
stateMachine.tryEvent(.start)
|
||||
}
|
||||
|
||||
|
||||
@@ -72,7 +72,7 @@ class EncryptionSettingsFlowCoordinator: FlowCoordinatorProtocol {
|
||||
configureStateMachine()
|
||||
}
|
||||
|
||||
func start() {
|
||||
func start(animated: Bool) {
|
||||
stateMachine.tryEvent(.start)
|
||||
}
|
||||
|
||||
|
||||
@@ -37,7 +37,7 @@ class MediaEventsTimelineFlowCoordinator: FlowCoordinatorProtocol {
|
||||
self.flowParameters = flowParameters
|
||||
}
|
||||
|
||||
func start() {
|
||||
func start(animated: Bool) {
|
||||
Task { await presentMediaEventsTimeline() }
|
||||
}
|
||||
|
||||
|
||||
@@ -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")
|
||||
}
|
||||
|
||||
@@ -38,7 +38,7 @@ class PinnedEventsTimelineFlowCoordinator: FlowCoordinatorProtocol {
|
||||
self.flowParameters = flowParameters
|
||||
}
|
||||
|
||||
func start() {
|
||||
func start(animated: Bool) {
|
||||
Task { await presentPinnedEventsTimeline() }
|
||||
}
|
||||
|
||||
|
||||
@@ -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
|
||||
}
|
||||
|
||||
|
||||
@@ -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
|
||||
}
|
||||
}
|
||||
|
||||
@@ -77,7 +77,7 @@ class RoomRolesAndPermissionsFlowCoordinator: FlowCoordinatorProtocol {
|
||||
configureStateMachine()
|
||||
}
|
||||
|
||||
func start() {
|
||||
func start(animated: Bool) {
|
||||
stateMachine.tryEvent(.start)
|
||||
}
|
||||
|
||||
|
||||
@@ -44,7 +44,7 @@ class SettingsFlowCoordinator: FlowCoordinatorProtocol {
|
||||
self.flowParameters = flowParameters
|
||||
}
|
||||
|
||||
func start() {
|
||||
func start(animated: Bool) {
|
||||
fatalError("Unavailable")
|
||||
}
|
||||
|
||||
|
||||
@@ -68,7 +68,7 @@ class SpaceExplorerFlowCoordinator: FlowCoordinatorProtocol {
|
||||
configureStateMachine()
|
||||
}
|
||||
|
||||
func start() {
|
||||
func start(animated: Bool) {
|
||||
stateMachine.tryEvent(.start)
|
||||
}
|
||||
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -108,7 +108,7 @@ class UserSessionFlowCoordinator: FlowCoordinatorProtocol {
|
||||
setupObservers()
|
||||
}
|
||||
|
||||
func start() {
|
||||
func start(animated: Bool) {
|
||||
stateMachine.tryEvent(.start)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user