mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-11-02 12:07:55 +00:00
Introduce flow parameters to simplify dependencies for child flows. (#4448)
This commit is contained in:
@@ -640,19 +640,23 @@ class AppCoordinator: AppCoordinatorProtocol, AuthenticationFlowCoordinatorDeleg
|
||||
fatalError("User session not setup")
|
||||
}
|
||||
|
||||
let userSessionFlowCoordinator = UserSessionFlowCoordinator(userSession: userSession,
|
||||
isNewLogin: isNewLogin,
|
||||
let flowParameters = CommonFlowParameters(userSession: userSession,
|
||||
bugReportService: ServiceLocator.shared.bugReportService,
|
||||
elementCallService: elementCallService,
|
||||
timelineControllerFactory: TimelineControllerFactory(),
|
||||
emojiProvider: EmojiProvider(appSettings: appSettings),
|
||||
appMediator: appMediator,
|
||||
appSettings: appSettings,
|
||||
appHooks: appHooks,
|
||||
analytics: ServiceLocator.shared.analytics,
|
||||
userIndicatorController: ServiceLocator.shared.userIndicatorController,
|
||||
notificationManager: notificationManager,
|
||||
stateMachineFactory: StateMachineFactory())
|
||||
|
||||
let userSessionFlowCoordinator = UserSessionFlowCoordinator(isNewLogin: isNewLogin,
|
||||
navigationRootCoordinator: navigationRootCoordinator,
|
||||
appLockService: appLockFlowCoordinator.appLockService,
|
||||
bugReportService: ServiceLocator.shared.bugReportService,
|
||||
elementCallService: elementCallService,
|
||||
timelineControllerFactory: TimelineControllerFactory(),
|
||||
appMediator: appMediator,
|
||||
appSettings: appSettings,
|
||||
appHooks: appHooks,
|
||||
analytics: ServiceLocator.shared.analytics,
|
||||
notificationManager: notificationManager,
|
||||
stateMachineFactory: StateMachineFactory())
|
||||
flowParameters: flowParameters)
|
||||
|
||||
userSessionFlowCoordinator.actionsPublisher
|
||||
.sink { [weak self] action in
|
||||
|
||||
@@ -14,3 +14,25 @@ protocol FlowCoordinatorProtocol {
|
||||
func handleAppRoute(_ appRoute: AppRoute, animated: Bool)
|
||||
func clearRoute(animated: Bool)
|
||||
}
|
||||
|
||||
/// 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.
|
||||
@MainActor
|
||||
struct CommonFlowParameters {
|
||||
let userSession: UserSessionProtocol
|
||||
let bugReportService: BugReportServiceProtocol
|
||||
let elementCallService: ElementCallServiceProtocol
|
||||
let timelineControllerFactory: TimelineControllerFactoryProtocol
|
||||
let emojiProvider: EmojiProviderProtocol
|
||||
let appMediator: AppMediatorProtocol
|
||||
let appSettings: AppSettings
|
||||
let appHooks: AppHooks
|
||||
let analytics: AnalyticsService
|
||||
let userIndicatorController: UserIndicatorControllerProtocol
|
||||
let notificationManager: NotificationManagerProtocol
|
||||
let stateMachineFactory: StateMachineFactoryProtocol
|
||||
|
||||
var windowManager: WindowManagerProtocol { appMediator.windowManager }
|
||||
var ongoingCallRoomIDPublisher: CurrentValuePublisher<String?, Never> { elementCallService.ongoingCallRoomIDPublisher }
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user