mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-11-02 12:07:55 +00:00
Remove all uses of the ServiceLocator from within Coordinators and View Models.
It is still used for mocks in tests, previews etc, and still used in the AppCoordinator.
This commit is contained in:
@@ -612,6 +612,7 @@ class AppCoordinator: AppCoordinatorProtocol, AuthenticationFlowCoordinatorDeleg
|
||||
let parameters = SoftLogoutScreenCoordinatorParameters(authenticationService: authenticationService,
|
||||
credentials: credentials,
|
||||
keyBackupNeeded: false,
|
||||
appSettings: appSettings,
|
||||
userIndicatorController: ServiceLocator.shared.userIndicatorController)
|
||||
let coordinator = SoftLogoutScreenCoordinator(parameters: parameters)
|
||||
self.softLogoutCoordinator = coordinator
|
||||
@@ -769,7 +770,9 @@ class AppCoordinator: AppCoordinatorProtocol, AuthenticationFlowCoordinatorDeleg
|
||||
let callScreenCoordinator = CallScreenCoordinator(parameters: .init(elementCallService: elementCallService,
|
||||
configuration: configuration,
|
||||
allowPictureInPicture: false,
|
||||
appHooks: appHooks))
|
||||
appSettings: appSettings,
|
||||
appHooks: appHooks,
|
||||
analytics: ServiceLocator.shared.analytics))
|
||||
|
||||
callScreenCoordinator.actions
|
||||
.sink { [weak self] action in
|
||||
|
||||
@@ -518,7 +518,8 @@ class ChatsFlowCoordinator: FlowCoordinatorProtocol {
|
||||
navigationStackCoordinator: startChatNavigationStackCoordinator,
|
||||
userDiscoveryService: userDiscoveryService,
|
||||
mediaUploadingPreprocessor: MediaUploadingPreprocessor(appSettings: flowParameters.appSettings),
|
||||
appSettings: flowParameters.appSettings)
|
||||
appSettings: flowParameters.appSettings,
|
||||
analytics: flowParameters.analytics)
|
||||
|
||||
let coordinator = StartChatScreenCoordinator(parameters: parameters)
|
||||
coordinator.actions.sink { [weak self] action in
|
||||
@@ -578,7 +579,9 @@ class ChatsFlowCoordinator: FlowCoordinatorProtocol {
|
||||
let callScreenCoordinator = CallScreenCoordinator(parameters: .init(elementCallService: flowParameters.elementCallService,
|
||||
configuration: configuration,
|
||||
allowPictureInPicture: true,
|
||||
appHooks: flowParameters.appHooks))
|
||||
appSettings: flowParameters.appSettings,
|
||||
appHooks: flowParameters.appHooks,
|
||||
analytics: flowParameters.analytics))
|
||||
|
||||
callScreenCoordinator.actions
|
||||
.sink { [weak self] action in
|
||||
@@ -652,6 +655,7 @@ class ChatsFlowCoordinator: FlowCoordinatorProtocol {
|
||||
private func startEncryptionResetFlow(animated: Bool) {
|
||||
let sheetNavigationStackCoordinator = NavigationStackCoordinator()
|
||||
let parameters = EncryptionResetFlowCoordinatorParameters(userSession: userSession,
|
||||
appSettings: flowParameters.appSettings,
|
||||
userIndicatorController: flowParameters.userIndicatorController,
|
||||
navigationStackCoordinator: sheetNavigationStackCoordinator,
|
||||
windowManger: flowParameters.windowManager)
|
||||
|
||||
@@ -18,6 +18,7 @@ enum EncryptionResetFlowCoordinatorAction: Equatable {
|
||||
|
||||
struct EncryptionResetFlowCoordinatorParameters {
|
||||
let userSession: UserSessionProtocol
|
||||
let appSettings: AppSettings
|
||||
let userIndicatorController: UserIndicatorControllerProtocol
|
||||
let navigationStackCoordinator: NavigationStackCoordinator
|
||||
let windowManger: WindowManagerProtocol
|
||||
@@ -25,6 +26,7 @@ struct EncryptionResetFlowCoordinatorParameters {
|
||||
|
||||
class EncryptionResetFlowCoordinator: FlowCoordinatorProtocol {
|
||||
private let userSession: UserSessionProtocol
|
||||
private let appSettings: AppSettings
|
||||
private let userIndicatorController: UserIndicatorControllerProtocol
|
||||
|
||||
private let navigationStackCoordinator: NavigationStackCoordinator
|
||||
@@ -59,6 +61,7 @@ class EncryptionResetFlowCoordinator: FlowCoordinatorProtocol {
|
||||
|
||||
init(parameters: EncryptionResetFlowCoordinatorParameters) {
|
||||
userSession = parameters.userSession
|
||||
appSettings = parameters.appSettings
|
||||
userIndicatorController = parameters.userIndicatorController
|
||||
navigationStackCoordinator = parameters.navigationStackCoordinator
|
||||
windowManager = parameters.windowManger
|
||||
@@ -152,7 +155,9 @@ class EncryptionResetFlowCoordinator: FlowCoordinatorProtocol {
|
||||
private func presentOIDCAuthorization(for url: URL) {
|
||||
// Note to anyone in the future if you come back here to make this open in Safari instead of a WAS.
|
||||
// As of iOS 16, there is an issue on the simulator with accessing the cookie but it works on a device. 🤷♂️
|
||||
accountSettingsPresenter = OIDCAccountSettingsPresenter(accountURL: url, presentationAnchor: windowManager.mainWindow)
|
||||
accountSettingsPresenter = OIDCAccountSettingsPresenter(accountURL: url,
|
||||
presentationAnchor: windowManager.mainWindow,
|
||||
appSettings: appSettings)
|
||||
accountSettingsPresenter?.start()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -81,6 +81,8 @@ class MediaEventsTimelineFlowCoordinator: FlowCoordinatorProtocol {
|
||||
mediaPlayerProvider: MediaPlayerProvider(),
|
||||
voiceMessageMediaManager: userSession.voiceMessageMediaManager,
|
||||
appMediator: flowParameters.appMediator,
|
||||
appSettings: flowParameters.appSettings,
|
||||
analytics: flowParameters.analytics,
|
||||
emojiProvider: flowParameters.emojiProvider,
|
||||
userIndicatorController: flowParameters.userIndicatorController,
|
||||
timelineControllerFactory: flowParameters.timelineControllerFactory,
|
||||
|
||||
@@ -313,6 +313,7 @@ class OnboardingFlowCoordinator: FlowCoordinatorProtocol {
|
||||
private func startEncryptionResetFlow() {
|
||||
let resetNavigationStackCoordinator = NavigationStackCoordinator()
|
||||
let coordinator = EncryptionResetFlowCoordinator(parameters: .init(userSession: userSession,
|
||||
appSettings: appSettings,
|
||||
userIndicatorController: userIndicatorController,
|
||||
navigationStackCoordinator: resetNavigationStackCoordinator,
|
||||
windowManger: windowManager))
|
||||
|
||||
@@ -67,9 +67,12 @@ class PinnedEventsTimelineFlowCoordinator: FlowCoordinatorProtocol {
|
||||
mediaPlayerProvider: MediaPlayerProvider(),
|
||||
voiceMessageMediaManager: userSession.voiceMessageMediaManager,
|
||||
appMediator: flowParameters.appMediator,
|
||||
appSettings: flowParameters.appSettings,
|
||||
analytics: flowParameters.analytics,
|
||||
emojiProvider: flowParameters.emojiProvider,
|
||||
timelineControllerFactory: flowParameters.timelineControllerFactory,
|
||||
clientProxy: userSession.clientProxy))
|
||||
clientProxy: userSession.clientProxy,
|
||||
userIndicatorController: flowParameters.userIndicatorController))
|
||||
|
||||
coordinator.actions
|
||||
.sink { [weak self] action in
|
||||
|
||||
@@ -558,8 +558,10 @@ class RoomFlowCoordinator: FlowCoordinatorProtocol {
|
||||
appMediator: flowParameters.appMediator,
|
||||
appSettings: flowParameters.appSettings,
|
||||
appHooks: flowParameters.appHooks,
|
||||
analytics: flowParameters.analytics,
|
||||
composerDraftService: composerDraftService,
|
||||
timelineControllerFactory: flowParameters.timelineControllerFactory)
|
||||
timelineControllerFactory: flowParameters.timelineControllerFactory,
|
||||
userIndicatorController: flowParameters.userIndicatorController)
|
||||
|
||||
let coordinator = RoomScreenCoordinator(parameters: parameters)
|
||||
coordinator.actions
|
||||
@@ -652,8 +654,10 @@ class RoomFlowCoordinator: FlowCoordinatorProtocol {
|
||||
completionSuggestionService: completionSuggestionService,
|
||||
appMediator: flowParameters.appMediator,
|
||||
appSettings: flowParameters.appSettings,
|
||||
analytics: flowParameters.analytics,
|
||||
composerDraftService: composerDraftService,
|
||||
timelineControllerFactory: flowParameters.timelineControllerFactory))
|
||||
timelineControllerFactory: flowParameters.timelineControllerFactory,
|
||||
userIndicatorController: flowParameters.userIndicatorController))
|
||||
|
||||
coordinator.actions.sink { [weak self] action in
|
||||
guard let self else { return }
|
||||
@@ -779,7 +783,8 @@ class RoomFlowCoordinator: FlowCoordinatorProtocol {
|
||||
userIndicatorController: flowParameters.userIndicatorController,
|
||||
notificationSettings: userSession.clientProxy.notificationSettings,
|
||||
attributedStringBuilder: AttributedStringBuilder(mentionBuilder: MentionBuilder()),
|
||||
appMediator: flowParameters.appMediator)
|
||||
appMediator: flowParameters.appMediator,
|
||||
appSettings: flowParameters.appSettings)
|
||||
let coordinator = RoomDetailsScreenCoordinator(parameters: params)
|
||||
coordinator.actions.sink { [weak self] action in
|
||||
guard let self else { return }
|
||||
@@ -1185,7 +1190,8 @@ class RoomFlowCoordinator: FlowCoordinatorProtocol {
|
||||
|
||||
let parameters = RoomPollsHistoryScreenCoordinatorParameters(pollInteractionHandler: PollInteractionHandler(analyticsService: flowParameters.analytics,
|
||||
timelineController: timelineController),
|
||||
timelineController: timelineController)
|
||||
timelineController: timelineController,
|
||||
userIndicatorController: flowParameters.userIndicatorController)
|
||||
let coordinator = RoomPollsHistoryScreenCoordinator(parameters: parameters)
|
||||
coordinator.actions
|
||||
.sink { [weak self] action in
|
||||
@@ -1322,7 +1328,8 @@ class RoomFlowCoordinator: FlowCoordinatorProtocol {
|
||||
let parameters = NotificationSettingsScreenCoordinatorParameters(navigationStackCoordinator: stackCoordinator,
|
||||
userSession: userSession,
|
||||
userNotificationCenter: UNUserNotificationCenter.current(),
|
||||
isModallyPresented: true)
|
||||
isModallyPresented: true,
|
||||
appSettings: flowParameters.appSettings)
|
||||
let coordinator = NotificationSettingsScreenCoordinator(parameters: parameters)
|
||||
coordinator.actions.sink { [weak self] action in
|
||||
switch action {
|
||||
|
||||
@@ -185,7 +185,8 @@ class SettingsFlowCoordinator: FlowCoordinatorProtocol {
|
||||
let notificationParameters = NotificationSettingsScreenCoordinatorParameters(navigationStackCoordinator: navigationStackCoordinator,
|
||||
userSession: flowParameters.userSession,
|
||||
userNotificationCenter: UNUserNotificationCenter.current(),
|
||||
isModallyPresented: false)
|
||||
isModallyPresented: false,
|
||||
appSettings: flowParameters.appSettings)
|
||||
let coordinator = NotificationSettingsScreenCoordinator(parameters: notificationParameters)
|
||||
navigationStackCoordinator.push(coordinator)
|
||||
}
|
||||
@@ -199,7 +200,7 @@ class SettingsFlowCoordinator: FlowCoordinatorProtocol {
|
||||
}
|
||||
|
||||
private func presentDeveloperOptions() {
|
||||
let coordinator = DeveloperOptionsScreenCoordinator()
|
||||
let coordinator = DeveloperOptionsScreenCoordinator(appSettings: flowParameters.appSettings)
|
||||
|
||||
coordinator.actions
|
||||
.sink { [weak self] action in
|
||||
@@ -240,7 +241,9 @@ class SettingsFlowCoordinator: FlowCoordinatorProtocol {
|
||||
private func presentAccountManagementURL(_ url: URL) {
|
||||
// Note to anyone in the future if you come back here to make this open in Safari instead of a WAS.
|
||||
// As of iOS 16, there is an issue on the simulator with accessing the cookie but it works on a device. 🤷♂️
|
||||
accountSettingsPresenter = OIDCAccountSettingsPresenter(accountURL: url, presentationAnchor: flowParameters.windowManager.mainWindow)
|
||||
accountSettingsPresenter = OIDCAccountSettingsPresenter(accountURL: url,
|
||||
presentationAnchor: flowParameters.windowManager.mainWindow,
|
||||
appSettings: flowParameters.appSettings)
|
||||
accountSettingsPresenter?.start()
|
||||
}
|
||||
}
|
||||
|
||||
+2
-1
@@ -12,6 +12,7 @@ struct SoftLogoutScreenCoordinatorParameters {
|
||||
let authenticationService: AuthenticationServiceProtocol
|
||||
let credentials: SoftLogoutScreenCredentials
|
||||
let keyBackupNeeded: Bool
|
||||
let appSettings: AppSettings
|
||||
let userIndicatorController: UserIndicatorControllerProtocol
|
||||
}
|
||||
|
||||
@@ -142,7 +143,7 @@ final class SoftLogoutScreenCoordinator: CoordinatorProtocol {
|
||||
stopLoading()
|
||||
|
||||
let presenter = OIDCAuthenticationPresenter(authenticationService: parameters.authenticationService,
|
||||
oidcRedirectURL: ServiceLocator.shared.settings.oidcRedirectURL,
|
||||
oidcRedirectURL: parameters.appSettings.oidcRedirectURL,
|
||||
presentationAnchor: presentationAnchor,
|
||||
userIndicatorController: parameters.userIndicatorController)
|
||||
self.oidcPresenter = presenter
|
||||
|
||||
@@ -13,7 +13,9 @@ struct CallScreenCoordinatorParameters {
|
||||
let elementCallService: ElementCallServiceProtocol
|
||||
let configuration: ElementCallConfiguration
|
||||
let allowPictureInPicture: Bool
|
||||
let appSettings: AppSettings
|
||||
let appHooks: AppHooks
|
||||
let analytics: AnalyticsService
|
||||
}
|
||||
|
||||
enum CallScreenCoordinatorAction {
|
||||
@@ -44,8 +46,8 @@ final class CallScreenCoordinator: CoordinatorProtocol {
|
||||
configuration: parameters.configuration,
|
||||
allowPictureInPicture: parameters.allowPictureInPicture,
|
||||
appHooks: parameters.appHooks,
|
||||
appSettings: ServiceLocator.shared.settings,
|
||||
analyticsService: ServiceLocator.shared.analytics)
|
||||
appSettings: parameters.appSettings,
|
||||
analyticsService: parameters.analytics)
|
||||
}
|
||||
|
||||
func start() {
|
||||
|
||||
@@ -13,6 +13,8 @@ struct CreateRoomCoordinatorParameters {
|
||||
let userIndicatorController: UserIndicatorControllerProtocol
|
||||
let createRoomParameters: CurrentValuePublisher<CreateRoomFlowParameters, Never>
|
||||
let selectedUsers: CurrentValuePublisher<[UserProfileProxy], Never>
|
||||
let appSettings: AppSettings
|
||||
let analytics: AnalyticsService
|
||||
}
|
||||
|
||||
enum CreateRoomCoordinatorAction {
|
||||
@@ -36,9 +38,9 @@ final class CreateRoomCoordinator: CoordinatorProtocol {
|
||||
viewModel = CreateRoomViewModel(userSession: parameters.userSession,
|
||||
createRoomParameters: parameters.createRoomParameters,
|
||||
selectedUsers: parameters.selectedUsers,
|
||||
analytics: ServiceLocator.shared.analytics,
|
||||
analytics: parameters.analytics,
|
||||
userIndicatorController: parameters.userIndicatorController,
|
||||
appSettings: ServiceLocator.shared.settings)
|
||||
appSettings: parameters.appSettings)
|
||||
}
|
||||
|
||||
func start() {
|
||||
|
||||
+8
-6
@@ -16,6 +16,8 @@ struct MediaEventsTimelineScreenCoordinatorParameters {
|
||||
let mediaPlayerProvider: MediaPlayerProviderProtocol
|
||||
let voiceMessageMediaManager: VoiceMessageMediaManagerProtocol
|
||||
let appMediator: AppMediatorProtocol
|
||||
let appSettings: AppSettings
|
||||
let analytics: AnalyticsService
|
||||
let emojiProvider: EmojiProviderProtocol
|
||||
let userIndicatorController: UserIndicatorControllerProtocol
|
||||
let timelineControllerFactory: TimelineControllerFactoryProtocol
|
||||
@@ -45,10 +47,10 @@ final class MediaEventsTimelineScreenCoordinator: CoordinatorProtocol {
|
||||
mediaProvider: parameters.mediaProvider,
|
||||
mediaPlayerProvider: parameters.mediaPlayerProvider,
|
||||
voiceMessageMediaManager: parameters.voiceMessageMediaManager,
|
||||
userIndicatorController: ServiceLocator.shared.userIndicatorController,
|
||||
userIndicatorController: parameters.userIndicatorController,
|
||||
appMediator: parameters.appMediator,
|
||||
appSettings: ServiceLocator.shared.settings,
|
||||
analyticsService: ServiceLocator.shared.analytics,
|
||||
appSettings: parameters.appSettings,
|
||||
analyticsService: parameters.analytics,
|
||||
emojiProvider: parameters.emojiProvider,
|
||||
timelineControllerFactory: parameters.timelineControllerFactory,
|
||||
clientProxy: parameters.clientProxy)
|
||||
@@ -58,10 +60,10 @@ final class MediaEventsTimelineScreenCoordinator: CoordinatorProtocol {
|
||||
mediaProvider: parameters.mediaProvider,
|
||||
mediaPlayerProvider: parameters.mediaPlayerProvider,
|
||||
voiceMessageMediaManager: parameters.voiceMessageMediaManager,
|
||||
userIndicatorController: ServiceLocator.shared.userIndicatorController,
|
||||
userIndicatorController: parameters.userIndicatorController,
|
||||
appMediator: parameters.appMediator,
|
||||
appSettings: ServiceLocator.shared.settings,
|
||||
analyticsService: ServiceLocator.shared.analytics,
|
||||
appSettings: parameters.appSettings,
|
||||
analyticsService: parameters.analytics,
|
||||
emojiProvider: parameters.emojiProvider,
|
||||
timelineControllerFactory: parameters.timelineControllerFactory,
|
||||
clientProxy: parameters.clientProxy)
|
||||
|
||||
+7
-4
@@ -15,9 +15,12 @@ struct PinnedEventsTimelineScreenCoordinatorParameters {
|
||||
let mediaPlayerProvider: MediaPlayerProviderProtocol
|
||||
let voiceMessageMediaManager: VoiceMessageMediaManagerProtocol
|
||||
let appMediator: AppMediatorProtocol
|
||||
let appSettings: AppSettings
|
||||
let analytics: AnalyticsService
|
||||
let emojiProvider: EmojiProviderProtocol
|
||||
let timelineControllerFactory: TimelineControllerFactoryProtocol
|
||||
let clientProxy: ClientProxyProtocol
|
||||
let userIndicatorController: UserIndicatorControllerProtocol
|
||||
}
|
||||
|
||||
enum PinnedEventsTimelineScreenCoordinatorAction {
|
||||
@@ -43,16 +46,16 @@ final class PinnedEventsTimelineScreenCoordinator: CoordinatorProtocol {
|
||||
init(parameters: PinnedEventsTimelineScreenCoordinatorParameters) {
|
||||
self.parameters = parameters
|
||||
|
||||
viewModel = PinnedEventsTimelineScreenViewModel(analyticsService: ServiceLocator.shared.analytics)
|
||||
viewModel = PinnedEventsTimelineScreenViewModel(analyticsService: parameters.analytics)
|
||||
timelineViewModel = TimelineViewModel(roomProxy: parameters.roomProxy,
|
||||
timelineController: parameters.timelineController,
|
||||
mediaProvider: parameters.mediaProvider,
|
||||
mediaPlayerProvider: parameters.mediaPlayerProvider,
|
||||
voiceMessageMediaManager: parameters.voiceMessageMediaManager,
|
||||
userIndicatorController: ServiceLocator.shared.userIndicatorController,
|
||||
userIndicatorController: parameters.userIndicatorController,
|
||||
appMediator: parameters.appMediator,
|
||||
appSettings: ServiceLocator.shared.settings,
|
||||
analyticsService: ServiceLocator.shared.analytics,
|
||||
appSettings: parameters.appSettings,
|
||||
analyticsService: parameters.analytics,
|
||||
emojiProvider: parameters.emojiProvider,
|
||||
timelineControllerFactory: parameters.timelineControllerFactory,
|
||||
clientProxy: parameters.clientProxy)
|
||||
|
||||
+4
-4
@@ -101,10 +101,10 @@ class ResolveVerifiedUserSendFailureScreenViewModel: ResolveVerifiedUserSendFail
|
||||
private static let failureIndicatorIdentifier = "\(ResolveVerifiedUserSendFailureScreenViewModel.self)-Failure"
|
||||
|
||||
private func showFailureIndicator() {
|
||||
ServiceLocator.shared.userIndicatorController.submitIndicator(UserIndicator(id: Self.failureIndicatorIdentifier,
|
||||
type: .toast,
|
||||
title: L10n.errorUnknown,
|
||||
iconName: "xmark"))
|
||||
userIndicatorController.submitIndicator(UserIndicator(id: Self.failureIndicatorIdentifier,
|
||||
type: .toast,
|
||||
title: L10n.errorUnknown,
|
||||
iconName: "xmark"))
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -17,6 +17,7 @@ struct RoomDetailsScreenCoordinatorParameters {
|
||||
let notificationSettings: NotificationSettingsProxyProtocol
|
||||
let attributedStringBuilder: AttributedStringBuilderProtocol
|
||||
let appMediator: AppMediatorProtocol
|
||||
let appSettings: AppSettings
|
||||
}
|
||||
|
||||
enum RoomDetailsScreenCoordinatorAction {
|
||||
@@ -56,7 +57,7 @@ final class RoomDetailsScreenCoordinator: CoordinatorProtocol {
|
||||
notificationSettingsProxy: parameters.notificationSettings,
|
||||
attributedStringBuilder: parameters.attributedStringBuilder,
|
||||
appMediator: parameters.appMediator,
|
||||
appSettings: ServiceLocator.shared.settings)
|
||||
appSettings: parameters.appSettings)
|
||||
}
|
||||
|
||||
// MARK: - Public
|
||||
|
||||
+2
-1
@@ -11,6 +11,7 @@ import SwiftUI
|
||||
struct RoomPollsHistoryScreenCoordinatorParameters {
|
||||
let pollInteractionHandler: PollInteractionHandlerProtocol
|
||||
let timelineController: TimelineControllerProtocol
|
||||
let userIndicatorController: UserIndicatorControllerProtocol
|
||||
}
|
||||
|
||||
enum RoomPollsHistoryScreenCoordinatorAction {
|
||||
@@ -29,7 +30,7 @@ final class RoomPollsHistoryScreenCoordinator: CoordinatorProtocol {
|
||||
init(parameters: RoomPollsHistoryScreenCoordinatorParameters) {
|
||||
viewModel = RoomPollsHistoryScreenViewModel(pollInteractionHandler: parameters.pollInteractionHandler,
|
||||
timelineController: parameters.timelineController,
|
||||
userIndicatorController: ServiceLocator.shared.userIndicatorController)
|
||||
userIndicatorController: parameters.userIndicatorController)
|
||||
}
|
||||
|
||||
func start() {
|
||||
|
||||
@@ -26,8 +26,10 @@ struct RoomScreenCoordinatorParameters {
|
||||
let appMediator: AppMediatorProtocol
|
||||
let appSettings: AppSettings
|
||||
let appHooks: AppHooks
|
||||
let analytics: AnalyticsService
|
||||
let composerDraftService: ComposerDraftServiceProtocol
|
||||
let timelineControllerFactory: TimelineControllerFactoryProtocol
|
||||
let userIndicatorController: UserIndicatorControllerProtocol
|
||||
}
|
||||
|
||||
enum RoomScreenCoordinatorAction {
|
||||
@@ -75,8 +77,8 @@ final class RoomScreenCoordinator: CoordinatorProtocol {
|
||||
appMediator: parameters.appMediator,
|
||||
appSettings: parameters.appSettings,
|
||||
appHooks: parameters.appHooks,
|
||||
analyticsService: ServiceLocator.shared.analytics,
|
||||
userIndicatorController: ServiceLocator.shared.userIndicatorController)
|
||||
analyticsService: parameters.analytics,
|
||||
userIndicatorController: parameters.userIndicatorController)
|
||||
|
||||
timelineViewModel = TimelineViewModel(roomProxy: parameters.roomProxy,
|
||||
focussedEventID: parameters.focussedEvent?.eventID,
|
||||
@@ -84,10 +86,10 @@ final class RoomScreenCoordinator: CoordinatorProtocol {
|
||||
mediaProvider: parameters.mediaProvider,
|
||||
mediaPlayerProvider: parameters.mediaPlayerProvider,
|
||||
voiceMessageMediaManager: parameters.voiceMessageMediaManager,
|
||||
userIndicatorController: ServiceLocator.shared.userIndicatorController,
|
||||
userIndicatorController: parameters.userIndicatorController,
|
||||
appMediator: parameters.appMediator,
|
||||
appSettings: parameters.appSettings,
|
||||
analyticsService: ServiceLocator.shared.analytics,
|
||||
analyticsService: parameters.analytics,
|
||||
emojiProvider: parameters.emojiProvider,
|
||||
timelineControllerFactory: parameters.timelineControllerFactory,
|
||||
clientProxy: parameters.clientProxy)
|
||||
@@ -103,7 +105,7 @@ final class RoomScreenCoordinator: CoordinatorProtocol {
|
||||
mediaProvider: parameters.mediaProvider,
|
||||
mentionDisplayHelper: ComposerMentionDisplayHelper(timelineContext: timelineViewModel.context),
|
||||
appSettings: parameters.appSettings,
|
||||
analyticsService: ServiceLocator.shared.analytics,
|
||||
analyticsService: parameters.analytics,
|
||||
composerDraftService: parameters.composerDraftService)
|
||||
self.composerViewModel = composerViewModel
|
||||
}
|
||||
|
||||
+2
-2
@@ -19,10 +19,10 @@ class OIDCAccountSettingsPresenter: NSObject {
|
||||
private let presentationAnchor: UIWindow
|
||||
private let oidcRedirectURL: URL
|
||||
|
||||
init(accountURL: URL, presentationAnchor: UIWindow) {
|
||||
init(accountURL: URL, presentationAnchor: UIWindow, appSettings: AppSettings) {
|
||||
self.accountURL = accountURL
|
||||
self.presentationAnchor = presentationAnchor
|
||||
oidcRedirectURL = ServiceLocator.shared.settings.oidcRedirectURL
|
||||
oidcRedirectURL = appSettings.oidcRedirectURL
|
||||
super.init()
|
||||
}
|
||||
|
||||
|
||||
+3
-3
@@ -22,9 +22,9 @@ final class DeveloperOptionsScreenCoordinator: CoordinatorProtocol {
|
||||
actionsSubject.eraseToAnyPublisher()
|
||||
}
|
||||
|
||||
init() {
|
||||
viewModel = DeveloperOptionsScreenViewModel(developerOptions: ServiceLocator.shared.settings,
|
||||
elementCallBaseURL: ServiceLocator.shared.settings.elementCallBaseURL)
|
||||
init(appSettings: AppSettings) {
|
||||
viewModel = DeveloperOptionsScreenViewModel(developerOptions: appSettings,
|
||||
elementCallBaseURL: appSettings.elementCallBaseURL)
|
||||
|
||||
viewModel.actions
|
||||
.sink { [weak self] action in
|
||||
|
||||
+2
-1
@@ -13,6 +13,7 @@ struct NotificationSettingsScreenCoordinatorParameters {
|
||||
let userSession: UserSessionProtocol
|
||||
let userNotificationCenter: UserNotificationCenterProtocol
|
||||
let isModallyPresented: Bool
|
||||
let appSettings: AppSettings
|
||||
}
|
||||
|
||||
enum NotificationSettingsScreenCoordinatorAction {
|
||||
@@ -36,7 +37,7 @@ final class NotificationSettingsScreenCoordinator: CoordinatorProtocol {
|
||||
init(parameters: NotificationSettingsScreenCoordinatorParameters) {
|
||||
self.parameters = parameters
|
||||
|
||||
viewModel = NotificationSettingsScreenViewModel(appSettings: ServiceLocator.shared.settings,
|
||||
viewModel = NotificationSettingsScreenViewModel(appSettings: parameters.appSettings,
|
||||
userNotificationCenter: parameters.userNotificationCenter,
|
||||
notificationSettingsProxy: parameters.userSession.clientProxy.notificationSettings,
|
||||
isModallyPresented: parameters.isModallyPresented)
|
||||
|
||||
@@ -16,6 +16,7 @@ struct StartChatScreenCoordinatorParameters {
|
||||
let userDiscoveryService: UserDiscoveryServiceProtocol
|
||||
let mediaUploadingPreprocessor: MediaUploadingPreprocessor
|
||||
let appSettings: AppSettings
|
||||
let analytics: AnalyticsService
|
||||
}
|
||||
|
||||
enum StartChatScreenCoordinatorAction {
|
||||
@@ -48,10 +49,10 @@ final class StartChatScreenCoordinator: CoordinatorProtocol {
|
||||
self.parameters = parameters
|
||||
|
||||
viewModel = StartChatScreenViewModel(userSession: parameters.userSession,
|
||||
analytics: ServiceLocator.shared.analytics,
|
||||
analytics: parameters.analytics,
|
||||
userIndicatorController: parameters.userIndicatorController,
|
||||
userDiscoveryService: parameters.userDiscoveryService,
|
||||
appSettings: ServiceLocator.shared.settings)
|
||||
appSettings: parameters.appSettings)
|
||||
}
|
||||
|
||||
func start() {
|
||||
@@ -114,7 +115,9 @@ final class StartChatScreenCoordinator: CoordinatorProtocol {
|
||||
let createParameters = CreateRoomCoordinatorParameters(userSession: parameters.userSession,
|
||||
userIndicatorController: parameters.userIndicatorController,
|
||||
createRoomParameters: createRoomParametersPublisher,
|
||||
selectedUsers: selectedUsersPublisher)
|
||||
selectedUsers: selectedUsersPublisher,
|
||||
appSettings: parameters.appSettings,
|
||||
analytics: parameters.analytics)
|
||||
let coordinator = CreateRoomCoordinator(parameters: createParameters)
|
||||
coordinator.actions.sink { [weak self] action in
|
||||
guard let self else { return }
|
||||
|
||||
@@ -21,8 +21,10 @@ struct ThreadTimelineScreenCoordinatorParameters {
|
||||
let completionSuggestionService: CompletionSuggestionServiceProtocol
|
||||
let appMediator: AppMediatorProtocol
|
||||
let appSettings: AppSettings
|
||||
let analytics: AnalyticsService
|
||||
let composerDraftService: ComposerDraftServiceProtocol
|
||||
let timelineControllerFactory: TimelineControllerFactoryProtocol
|
||||
let userIndicatorController: UserIndicatorControllerProtocol
|
||||
}
|
||||
|
||||
enum ThreadTimelineScreenCoordinatorAction {
|
||||
@@ -61,10 +63,10 @@ final class ThreadTimelineScreenCoordinator: CoordinatorProtocol {
|
||||
mediaProvider: parameters.mediaProvider,
|
||||
mediaPlayerProvider: parameters.mediaPlayerProvider,
|
||||
voiceMessageMediaManager: parameters.voiceMessageMediaManager,
|
||||
userIndicatorController: ServiceLocator.shared.userIndicatorController,
|
||||
userIndicatorController: parameters.userIndicatorController,
|
||||
appMediator: parameters.appMediator,
|
||||
appSettings: parameters.appSettings,
|
||||
analyticsService: ServiceLocator.shared.analytics,
|
||||
analyticsService: parameters.analytics,
|
||||
emojiProvider: parameters.emojiProvider,
|
||||
timelineControllerFactory: parameters.timelineControllerFactory,
|
||||
clientProxy: parameters.clientProxy)
|
||||
@@ -81,7 +83,7 @@ final class ThreadTimelineScreenCoordinator: CoordinatorProtocol {
|
||||
mediaProvider: parameters.mediaProvider,
|
||||
mentionDisplayHelper: ComposerMentionDisplayHelper(timelineContext: timelineViewModel.context),
|
||||
appSettings: parameters.appSettings,
|
||||
analyticsService: ServiceLocator.shared.analytics,
|
||||
analyticsService: parameters.analytics,
|
||||
composerDraftService: parameters.composerDraftService)
|
||||
}
|
||||
|
||||
|
||||
@@ -272,8 +272,10 @@ class MockScreen: Identifiable {
|
||||
appMediator: AppMediatorMock.default,
|
||||
appSettings: ServiceLocator.shared.settings,
|
||||
appHooks: AppHooks(),
|
||||
analytics: ServiceLocator.shared.analytics,
|
||||
composerDraftService: ComposerDraftServiceMock(.init()),
|
||||
timelineControllerFactory: TimelineControllerFactoryMock(.init()))
|
||||
timelineControllerFactory: TimelineControllerFactoryMock(.init()),
|
||||
userIndicatorController: UserIndicatorControllerMock())
|
||||
let coordinator = RoomScreenCoordinator(parameters: parameters)
|
||||
navigationStackCoordinator.setRootCoordinator(coordinator)
|
||||
return navigationStackCoordinator
|
||||
@@ -293,8 +295,10 @@ class MockScreen: Identifiable {
|
||||
appMediator: AppMediatorMock.default,
|
||||
appSettings: ServiceLocator.shared.settings,
|
||||
appHooks: AppHooks(),
|
||||
analytics: ServiceLocator.shared.analytics,
|
||||
composerDraftService: ComposerDraftServiceMock(.init()),
|
||||
timelineControllerFactory: TimelineControllerFactoryMock(.init()))
|
||||
timelineControllerFactory: TimelineControllerFactoryMock(.init()),
|
||||
userIndicatorController: UserIndicatorControllerMock())
|
||||
let coordinator = RoomScreenCoordinator(parameters: parameters)
|
||||
navigationStackCoordinator.setRootCoordinator(coordinator)
|
||||
return navigationStackCoordinator
|
||||
@@ -314,8 +318,9 @@ class MockScreen: Identifiable {
|
||||
appMediator: AppMediatorMock.default,
|
||||
appSettings: ServiceLocator.shared.settings,
|
||||
appHooks: AppHooks(),
|
||||
analytics: ServiceLocator.shared.analytics,
|
||||
composerDraftService: ComposerDraftServiceMock(.init()),
|
||||
timelineControllerFactory: TimelineControllerFactoryMock(.init()))
|
||||
timelineControllerFactory: TimelineControllerFactoryMock(.init()), userIndicatorController: UserIndicatorControllerMock())
|
||||
let coordinator = RoomScreenCoordinator(parameters: parameters)
|
||||
navigationStackCoordinator.setRootCoordinator(coordinator)
|
||||
return navigationStackCoordinator
|
||||
@@ -335,8 +340,9 @@ class MockScreen: Identifiable {
|
||||
appMediator: AppMediatorMock.default,
|
||||
appSettings: ServiceLocator.shared.settings,
|
||||
appHooks: AppHooks(),
|
||||
analytics: ServiceLocator.shared.analytics,
|
||||
composerDraftService: ComposerDraftServiceMock(.init()),
|
||||
timelineControllerFactory: TimelineControllerFactoryMock(.init()))
|
||||
timelineControllerFactory: TimelineControllerFactoryMock(.init()), userIndicatorController: UserIndicatorControllerMock())
|
||||
let coordinator = RoomScreenCoordinator(parameters: parameters)
|
||||
navigationStackCoordinator.setRootCoordinator(coordinator)
|
||||
return navigationStackCoordinator
|
||||
@@ -359,8 +365,9 @@ class MockScreen: Identifiable {
|
||||
appMediator: AppMediatorMock.default,
|
||||
appSettings: ServiceLocator.shared.settings,
|
||||
appHooks: AppHooks(),
|
||||
analytics: ServiceLocator.shared.analytics,
|
||||
composerDraftService: ComposerDraftServiceMock(.init()),
|
||||
timelineControllerFactory: TimelineControllerFactoryMock(.init()))
|
||||
timelineControllerFactory: TimelineControllerFactoryMock(.init()), userIndicatorController: UserIndicatorControllerMock())
|
||||
let coordinator = RoomScreenCoordinator(parameters: parameters)
|
||||
|
||||
navigationStackCoordinator.setRootCoordinator(coordinator)
|
||||
@@ -383,8 +390,8 @@ class MockScreen: Identifiable {
|
||||
appMediator: AppMediatorMock.default,
|
||||
appSettings: ServiceLocator.shared.settings,
|
||||
appHooks: AppHooks(),
|
||||
composerDraftService: ComposerDraftServiceMock(.init()),
|
||||
timelineControllerFactory: TimelineControllerFactoryMock(.init()))
|
||||
analytics: ServiceLocator.shared.analytics,
|
||||
composerDraftService: ComposerDraftServiceMock(.init()), timelineControllerFactory: TimelineControllerFactoryMock(.init()), userIndicatorController: UserIndicatorControllerMock())
|
||||
let coordinator = RoomScreenCoordinator(parameters: parameters)
|
||||
|
||||
navigationStackCoordinator.setRootCoordinator(coordinator)
|
||||
@@ -407,8 +414,9 @@ class MockScreen: Identifiable {
|
||||
appMediator: AppMediatorMock.default,
|
||||
appSettings: ServiceLocator.shared.settings,
|
||||
appHooks: AppHooks(),
|
||||
analytics: ServiceLocator.shared.analytics,
|
||||
composerDraftService: ComposerDraftServiceMock(.init()),
|
||||
timelineControllerFactory: TimelineControllerFactoryMock(.init()))
|
||||
timelineControllerFactory: TimelineControllerFactoryMock(.init()), userIndicatorController: UserIndicatorControllerMock())
|
||||
let coordinator = RoomScreenCoordinator(parameters: parameters)
|
||||
|
||||
navigationStackCoordinator.setRootCoordinator(coordinator)
|
||||
@@ -432,8 +440,9 @@ class MockScreen: Identifiable {
|
||||
appMediator: AppMediatorMock.default,
|
||||
appSettings: ServiceLocator.shared.settings,
|
||||
appHooks: AppHooks(),
|
||||
analytics: ServiceLocator.shared.analytics,
|
||||
composerDraftService: ComposerDraftServiceMock(.init()),
|
||||
timelineControllerFactory: TimelineControllerFactoryMock(.init()))
|
||||
timelineControllerFactory: TimelineControllerFactoryMock(.init()), userIndicatorController: UserIndicatorControllerMock())
|
||||
let coordinator = RoomScreenCoordinator(parameters: parameters)
|
||||
|
||||
navigationStackCoordinator.setRootCoordinator(coordinator)
|
||||
@@ -456,8 +465,9 @@ class MockScreen: Identifiable {
|
||||
appMediator: AppMediatorMock.default,
|
||||
appSettings: ServiceLocator.shared.settings,
|
||||
appHooks: AppHooks(),
|
||||
analytics: ServiceLocator.shared.analytics,
|
||||
composerDraftService: ComposerDraftServiceMock(.init()),
|
||||
timelineControllerFactory: TimelineControllerFactoryMock(.init()))
|
||||
timelineControllerFactory: TimelineControllerFactoryMock(.init()), userIndicatorController: UserIndicatorControllerMock())
|
||||
let coordinator = RoomScreenCoordinator(parameters: parameters)
|
||||
|
||||
navigationStackCoordinator.setRootCoordinator(coordinator)
|
||||
@@ -479,8 +489,9 @@ class MockScreen: Identifiable {
|
||||
appMediator: AppMediatorMock.default,
|
||||
appSettings: ServiceLocator.shared.settings,
|
||||
appHooks: AppHooks(),
|
||||
analytics: ServiceLocator.shared.analytics,
|
||||
composerDraftService: ComposerDraftServiceMock(.init()),
|
||||
timelineControllerFactory: TimelineControllerFactoryMock(.init()))
|
||||
timelineControllerFactory: TimelineControllerFactoryMock(.init()), userIndicatorController: UserIndicatorControllerMock())
|
||||
let coordinator = RoomScreenCoordinator(parameters: parameters)
|
||||
navigationStackCoordinator.setRootCoordinator(coordinator)
|
||||
|
||||
@@ -516,8 +527,9 @@ class MockScreen: Identifiable {
|
||||
appMediator: AppMediatorMock.default,
|
||||
appSettings: ServiceLocator.shared.settings,
|
||||
appHooks: AppHooks(),
|
||||
analytics: ServiceLocator.shared.analytics,
|
||||
composerDraftService: ComposerDraftServiceMock(.init()),
|
||||
timelineControllerFactory: TimelineControllerFactoryMock(.init()))
|
||||
timelineControllerFactory: TimelineControllerFactoryMock(.init()), userIndicatorController: UserIndicatorControllerMock())
|
||||
let coordinator = RoomScreenCoordinator(parameters: parameters)
|
||||
|
||||
navigationStackCoordinator.setRootCoordinator(coordinator)
|
||||
@@ -540,8 +552,9 @@ class MockScreen: Identifiable {
|
||||
appMediator: AppMediatorMock.default,
|
||||
appSettings: ServiceLocator.shared.settings,
|
||||
appHooks: AppHooks(),
|
||||
analytics: ServiceLocator.shared.analytics,
|
||||
composerDraftService: ComposerDraftServiceMock(.init()),
|
||||
timelineControllerFactory: TimelineControllerFactoryMock(.init()))
|
||||
timelineControllerFactory: TimelineControllerFactoryMock(.init()), userIndicatorController: UserIndicatorControllerMock())
|
||||
let coordinator = RoomScreenCoordinator(parameters: parameters)
|
||||
|
||||
navigationStackCoordinator.setRootCoordinator(coordinator)
|
||||
@@ -564,8 +577,9 @@ class MockScreen: Identifiable {
|
||||
appMediator: AppMediatorMock.default,
|
||||
appSettings: ServiceLocator.shared.settings,
|
||||
appHooks: AppHooks(),
|
||||
analytics: ServiceLocator.shared.analytics,
|
||||
composerDraftService: ComposerDraftServiceMock(.init()),
|
||||
timelineControllerFactory: TimelineControllerFactoryMock(.init()))
|
||||
timelineControllerFactory: TimelineControllerFactoryMock(.init()), userIndicatorController: UserIndicatorControllerMock())
|
||||
let coordinator = RoomScreenCoordinator(parameters: parameters)
|
||||
|
||||
navigationStackCoordinator.setRootCoordinator(coordinator)
|
||||
@@ -647,7 +661,8 @@ class MockScreen: Identifiable {
|
||||
navigationStackCoordinator: navigationStackCoordinator,
|
||||
userDiscoveryService: userDiscoveryMock,
|
||||
mediaUploadingPreprocessor: MediaUploadingPreprocessor(appSettings: ServiceLocator.shared.settings),
|
||||
appSettings: ServiceLocator.shared.settings)
|
||||
appSettings: ServiceLocator.shared.settings,
|
||||
analytics: ServiceLocator.shared.analytics)
|
||||
let coordinator = StartChatScreenCoordinator(parameters: parameters)
|
||||
navigationStackCoordinator.setRootCoordinator(coordinator)
|
||||
return navigationStackCoordinator
|
||||
@@ -663,7 +678,8 @@ class MockScreen: Identifiable {
|
||||
navigationStackCoordinator: navigationStackCoordinator,
|
||||
userDiscoveryService: userDiscoveryMock,
|
||||
mediaUploadingPreprocessor: MediaUploadingPreprocessor(appSettings: ServiceLocator.shared.settings),
|
||||
appSettings: ServiceLocator.shared.settings))
|
||||
appSettings: ServiceLocator.shared.settings,
|
||||
analytics: ServiceLocator.shared.analytics))
|
||||
navigationStackCoordinator.setRootCoordinator(coordinator)
|
||||
return navigationStackCoordinator
|
||||
case .createRoom:
|
||||
@@ -675,7 +691,9 @@ class MockScreen: Identifiable {
|
||||
let parameters = CreateRoomCoordinatorParameters(userSession: mockUserSession,
|
||||
userIndicatorController: UserIndicatorControllerMock(),
|
||||
createRoomParameters: .init(createRoomParameters),
|
||||
selectedUsers: .init(selectedUsers))
|
||||
selectedUsers: .init(selectedUsers),
|
||||
appSettings: ServiceLocator.shared.settings,
|
||||
analytics: ServiceLocator.shared.analytics)
|
||||
let coordinator = CreateRoomCoordinator(parameters: parameters)
|
||||
navigationStackCoordinator.setRootCoordinator(coordinator)
|
||||
return navigationStackCoordinator
|
||||
@@ -687,7 +705,9 @@ class MockScreen: Identifiable {
|
||||
let parameters = CreateRoomCoordinatorParameters(userSession: mockUserSession,
|
||||
userIndicatorController: UserIndicatorControllerMock(),
|
||||
createRoomParameters: .init(createRoomParameters),
|
||||
selectedUsers: .init([]))
|
||||
selectedUsers: .init([]),
|
||||
appSettings: ServiceLocator.shared.settings,
|
||||
analytics: ServiceLocator.shared.analytics)
|
||||
let coordinator = CreateRoomCoordinator(parameters: parameters)
|
||||
navigationStackCoordinator.setRootCoordinator(coordinator)
|
||||
return navigationStackCoordinator
|
||||
@@ -722,6 +742,7 @@ class MockScreen: Identifiable {
|
||||
let navigationStackCoordinator = NavigationStackCoordinator()
|
||||
|
||||
let coordinator = EncryptionResetFlowCoordinator(parameters: .init(userSession: userSession,
|
||||
appSettings: ServiceLocator.shared.settings,
|
||||
userIndicatorController: userIndicatorController,
|
||||
navigationStackCoordinator: navigationStackCoordinator,
|
||||
windowManger: windowManager))
|
||||
|
||||
Reference in New Issue
Block a user