From 1ce7501e1bb42402deabbfbbb5ad6a04e6d596ca Mon Sep 17 00:00:00 2001 From: Doug <6060466+pixlwave@users.noreply.github.com> Date: Mon, 19 Oct 2026 16:28:18 +0100 Subject: [PATCH] Finish splitting the App/User hooks. (#6348) * Remove the homeserver parameter from user hooks. * Split the OAuthPresenter hook into two. With one living directly on the UserHooks. * Add developerOptionsScreenHook to the UserHooks. * Remove appHooks from the flowParameters. --- ElementX.xcodeproj/project.pbxproj | 12 ++++++++---- ElementX/Sources/AppHooks/AppHooks.swift | 4 ++-- .../AppHooks/Hooks/CreateRoomScreenHook.swift | 4 ++-- .../Hooks/DeveloperOptionsScreenHook.swift | 4 ++-- ...=> OAuthAccountSettingsPresenterHook.swift} | 4 ++-- .../OAuthAuthenticationPresenterHook.swift | 18 ++++++++++++++++++ .../AppHooks/Hooks/RecoveryKeyScreenHook.swift | 4 ++-- .../Hooks/SecurityAndPrivacyScreenHook.swift | 4 ++-- ElementX/Sources/AppHooks/UserHooks.swift | 8 +++++++- .../Sources/Application/AppCoordinator.swift | 1 - .../Application/FlowCoordinatorProtocol.swift | 1 - .../AuthenticationFlowCoordinator.swift | 4 ++-- .../ChatsTabFlowCoordinator.swift | 4 +--- .../EncryptionResetFlowCoordinator.swift | 8 +------- .../EncryptionSettingsFlowCoordinator.swift | 3 +-- .../OnboardingFlowCoordinator.swift | 6 +----- .../SettingsFlowCoordinator.swift | 5 ++--- .../OAuthAuthenticationPresenter.swift | 8 ++++---- .../SoftLogoutScreenCoordinator.swift | 2 +- .../CreateRoomScreenViewModel.swift | 2 +- .../SecurityAndPrivacyScreenViewModel.swift | 2 +- .../OAuthAccountSettingsPresenter.swift | 11 +++++------ .../DeveloperOptionsScreenCoordinator.swift | 4 ++-- .../DeveloperOptionsScreenModels.swift | 3 +-- .../DeveloperOptionsScreenViewModel.swift | 5 ++--- .../View/DeveloperOptionsScreen.swift | 8 +++----- .../Authentication/AuthenticationService.swift | 2 +- .../AuthenticationServiceProtocol.swift | 3 +++ .../UITests/UITestsAppCoordinator.swift | 5 ----- Enterprise | 2 +- .../Sources/ChatsTabFlowCoordinatorTests.swift | 1 - .../Sources/RoomFlowCoordinatorTests.swift | 1 - .../RoomMembersFlowCoordinatorTests.swift | 1 - .../UserSessionFlowCoordinatorTests.swift | 1 - 34 files changed, 78 insertions(+), 77 deletions(-) rename ElementX/Sources/AppHooks/Hooks/{OAuthPresenterHook.swift => OAuthAccountSettingsPresenterHook.swift} (67%) create mode 100644 ElementX/Sources/AppHooks/Hooks/OAuthAuthenticationPresenterHook.swift diff --git a/ElementX.xcodeproj/project.pbxproj b/ElementX.xcodeproj/project.pbxproj index efd3db22c..5bc8d4e56 100644 --- a/ElementX.xcodeproj/project.pbxproj +++ b/ElementX.xcodeproj/project.pbxproj @@ -291,6 +291,7 @@ 2BBE320EE426A347AAE5C7DA /* IdentityConfirmationScreen.swift in Sources */ = {isa = PBXBuildFile; fileRef = 00AFC5F08734C2EA4EE79C59 /* IdentityConfirmationScreen.swift */; }; 2BC579CB5CE90CFE07CA0955 /* EditRoomAddressScreenCoordinator.swift in Sources */ = {isa = PBXBuildFile; fileRef = 41656BC6267D55C56A2AAC08 /* EditRoomAddressScreenCoordinator.swift */; }; 2BFA4C6D5B3D327B02C66AB0 /* TimelineController.swift in Sources */ = {isa = PBXBuildFile; fileRef = A4216C12C0369A8AB059EDE9 /* TimelineController.swift */; }; + 2C1C4D29EE0E5EF80BAEE390 /* OAuthAccountSettingsPresenterHook.swift in Sources */ = {isa = PBXBuildFile; fileRef = 13A1CFE12BDB1D02BEDFFF6D /* OAuthAccountSettingsPresenterHook.swift */; }; 2C289BECCCBEDBA48DC9AC67 /* ClassicAppMXAccount.swift in Sources */ = {isa = PBXBuildFile; fileRef = 74240BE69DACAD01AA670730 /* ClassicAppMXAccount.swift */; }; 2C4C750D0039AFABDF24236C /* TemplateScreenViewModelProtocol.swift in Sources */ = {isa = PBXBuildFile; fileRef = 342BEBC3C5FC3F9943C41C4C /* TemplateScreenViewModelProtocol.swift */; }; 2C5E832434EE94E21AB3B238 /* EmojiPickerScreenViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = F3EAE3E9D5EF4A6D5D9C6CFD /* EmojiPickerScreenViewModel.swift */; }; @@ -672,7 +673,6 @@ 6832733838C57A7D3FE8FEB5 /* Kingfisher in Frameworks */ = {isa = PBXBuildFile; productRef = 50009897F60FAE7D63EF5E5B /* Kingfisher */; }; 6851B077B4C913CC12DB6E77 /* AppLockFlowCoordinator.swift in Sources */ = {isa = PBXBuildFile; fileRef = FCE93F0CBF0D96B77111C413 /* AppLockFlowCoordinator.swift */; }; 68B2DD307C57ECFABBB05323 /* DeclineAndBlockScreen.swift in Sources */ = {isa = PBXBuildFile; fileRef = 127D1947BA9C6CA62E3D03EC /* DeclineAndBlockScreen.swift */; }; - 68B7308BA24EC3DC5FD87B61 /* OAuthPresenterHook.swift in Sources */ = {isa = PBXBuildFile; fileRef = 04CAC77224E949D8E758E2E3 /* OAuthPresenterHook.swift */; }; 68C3AF257678F6E7BB238C3F /* AppAppearance.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0FD22AEFFA20065494ED2333 /* AppAppearance.swift */; }; 695825D20A761C678809345D /* MessageForwardingScreenModels.swift in Sources */ = {isa = PBXBuildFile; fileRef = 52135BD9E0E7A091688F627A /* MessageForwardingScreenModels.swift */; }; 695BE6A2337A634F48B5DBC8 /* RoomMembersFlowCoordinatorTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = CC666DAE98245269775329B2 /* RoomMembersFlowCoordinatorTests.swift */; }; @@ -938,6 +938,7 @@ 8F2FAA98457750D9D664136F /* LoremSwiftum in Frameworks */ = {isa = PBXBuildFile; productRef = 1A6B622CCFDEFB92D9CF1CA5 /* LoremSwiftum */; }; 8F63A813760F3DDA8EA1DE9B /* test_image.png in Resources */ = {isa = PBXBuildFile; fileRef = 137C082DFC0157D66936A0EC /* test_image.png */; }; 8F7D29BD7FCBEC86B9E49CED /* preview_avatar_room.jpg in Resources */ = {isa = PBXBuildFile; fileRef = 690915157A874D1F21ADE70C /* preview_avatar_room.jpg */; }; + 8F802A07E50399D10F471A64 /* OAuthAuthenticationPresenterHook.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0A72DFD9E0508F021EA08247 /* OAuthAuthenticationPresenterHook.swift */; }; 904F06C9C1AEF884C2077542 /* RoomDirectorySearchScreen.swift in Sources */ = {isa = PBXBuildFile; fileRef = F2E4EF80DFB8FE7C4469B15D /* RoomDirectorySearchScreen.swift */; }; 90733645AE76FB33DAD28C2B /* URLSession.swift in Sources */ = {isa = PBXBuildFile; fileRef = AE40D4A5DD857AC16EED945A /* URLSession.swift */; }; 9097C3B61181B731CACEE28B /* Secrets.swift in Sources */ = {isa = PBXBuildFile; fileRef = B2C6AE2DB4FE7FAEA6402663 /* Secrets.swift */; }; @@ -1827,7 +1828,6 @@ 048A21188AB19349D026BECD /* PrivacyInfo.xcprivacy */ = {isa = PBXFileReference; path = PrivacyInfo.xcprivacy; sourceTree = ""; }; 04BB8DDE245ED86C489BA983 /* AccessibilityIdentifiers.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AccessibilityIdentifiers.swift; sourceTree = ""; }; 04C66FE72035CD1A870E8CB7 /* CoordinateAnimator.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CoordinateAnimator.swift; sourceTree = ""; }; - 04CAC77224E949D8E758E2E3 /* OAuthPresenterHook.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = OAuthPresenterHook.swift; sourceTree = ""; }; 04DF593C3F7AF4B2FBAEB05D /* FileManager.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FileManager.swift; sourceTree = ""; }; 04EB6035C1F33F25F1EBFB7D /* RoomThreadListServiceProxyProtocol.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RoomThreadListServiceProxyProtocol.swift; sourceTree = ""; }; 0516C69708D5CBDE1A8E77EC /* RoomDirectorySearchProxyProtocol.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RoomDirectorySearchProxyProtocol.swift; sourceTree = ""; }; @@ -1863,6 +1863,7 @@ 0A3534D37BFC074DD26F2FFE /* RoomThreadListScreenModels.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RoomThreadListScreenModels.swift; sourceTree = ""; }; 0A3E77399BD262D301451BF2 /* RoomDetailsEditScreenCoordinator.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RoomDetailsEditScreenCoordinator.swift; sourceTree = ""; }; 0A459AE4B6566B2FA99E86B2 /* TimelineItemBubbledStylerView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TimelineItemBubbledStylerView.swift; sourceTree = ""; }; + 0A72DFD9E0508F021EA08247 /* OAuthAuthenticationPresenterHook.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = OAuthAuthenticationPresenterHook.swift; sourceTree = ""; }; 0A81FD0C60175FA081EB19AD /* EventTimelineItem.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = EventTimelineItem.swift; sourceTree = ""; }; 0AB7A0C06CB527A1095DEB33 /* da */ = {isa = PBXFileReference; lastKnownFileType = text.plist.stringsdict; name = da; path = da.lproj/Localizable.stringsdict; sourceTree = ""; }; 0AC5E094DFE18C3AB7619D34 /* CreateRoomScreenViewModelProtocol.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CreateRoomScreenViewModelProtocol.swift; sourceTree = ""; }; @@ -1928,6 +1929,7 @@ 136F80A613B55BDD071DCEA5 /* JoinRoomScreenModels.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = JoinRoomScreenModels.swift; sourceTree = ""; }; 137C082DFC0157D66936A0EC /* test_image.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = test_image.png; sourceTree = ""; }; 13802897C7AFA360EA74C0B0 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.stringsdict; name = en; path = en.lproj/Localizable.stringsdict; sourceTree = ""; }; + 13A1CFE12BDB1D02BEDFFF6D /* OAuthAccountSettingsPresenterHook.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = OAuthAccountSettingsPresenterHook.swift; sourceTree = ""; }; 13BE9781699FB510E9263192 /* AppSettingsHook.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppSettingsHook.swift; sourceTree = ""; }; 13F354AD441E2FD83DED89AF /* SeparatorMediaEventsTimelineView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SeparatorMediaEventsTimelineView.swift; sourceTree = ""; }; 1423AB065857FA546444DB15 /* NotificationManager.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NotificationManager.swift; sourceTree = ""; }; @@ -4076,7 +4078,8 @@ 8B89D6C760E8CAE29CA28FB1 /* CompoundHook.swift */, 2F374C789B4BD1C597394987 /* CreateRoomScreenHook.swift */, 0F60FDB3AEFC60830BD289FE /* DeveloperOptionsScreenHook.swift */, - 04CAC77224E949D8E758E2E3 /* OAuthPresenterHook.swift */, + 13A1CFE12BDB1D02BEDFFF6D /* OAuthAccountSettingsPresenterHook.swift */, + 0A72DFD9E0508F021EA08247 /* OAuthAuthenticationPresenterHook.swift */, 7AE97AD18893E2D8120F559D /* RecoveryKeyScreenHook.swift */, D5D186A6DB8FAC5C9D0E4D61 /* RemoteSettingsHook.swift */, 3674212CAB6C5143DD437AC4 /* RoomDetailsScreenHook.swift */, @@ -9353,9 +9356,10 @@ 101C8BFCAE35F43F37A6D8ED /* NotificationToneManagerMock.swift in Sources */, 1E414736CCF094E2CBD8E482 /* NotificationToneManagerProtocol.swift in Sources */, 6AC798F52571BE495E6AA1CE /* OAuthAccountSettingsPresenter.swift in Sources */, + 2C1C4D29EE0E5EF80BAEE390 /* OAuthAccountSettingsPresenterHook.swift in Sources */, E32E71A1AF5E5E69E8363B26 /* OAuthAuthenticationPresenter.swift in Sources */, + 8F802A07E50399D10F471A64 /* OAuthAuthenticationPresenterHook.swift in Sources */, C525F6C2892CB0640E776B3D /* OAuthConfiguration.swift in Sources */, - 68B7308BA24EC3DC5FD87B61 /* OAuthPresenterHook.swift in Sources */, FD573B5D665824EB79EABF06 /* Observable.swift in Sources */, 11A6B8E3CBDBF0A4107FF4CE /* OnboardingFlowCoordinator.swift in Sources */, 3CE4C5071B6D2576E2473989 /* OrderedSet.swift in Sources */, diff --git a/ElementX/Sources/AppHooks/AppHooks.swift b/ElementX/Sources/AppHooks/AppHooks.swift index f10400fd6..39aa13a2f 100644 --- a/ElementX/Sources/AppHooks/AppHooks.swift +++ b/ElementX/Sources/AppHooks/AppHooks.swift @@ -21,8 +21,8 @@ final nonisolated class AppHooks: AppHooksProtocol { @AppHook(default: DefaultBugReportHook()) var bugReportHook: BugReportHookProtocol - @AppHook(default: DefaultOAuthPresenterHook()) - var oAuthPresenterHook: OAuthPresenterHookProtocol + @AppHook(default: DefaultOAuthAuthenticationPresenterHook()) + var oAuthAuthenticationPresenterHook: OAuthAuthenticationPresenterHookProtocol @AppHook(default: DefaultDeveloperOptionsScreenHook()) var developerOptionsScreenHook: DeveloperOptionsScreenHookProtocol diff --git a/ElementX/Sources/AppHooks/Hooks/CreateRoomScreenHook.swift b/ElementX/Sources/AppHooks/Hooks/CreateRoomScreenHook.swift index c9ea03d7f..987733f4d 100644 --- a/ElementX/Sources/AppHooks/Hooks/CreateRoomScreenHook.swift +++ b/ElementX/Sources/AppHooks/Hooks/CreateRoomScreenHook.swift @@ -8,11 +8,11 @@ import Foundation nonisolated protocol CreateRoomScreenHookProtocol: Sendable { - @MainActor func update(_ viewState: CreateRoomScreenViewState, homeserver: String) -> CreateRoomScreenViewState + @MainActor func update(_ viewState: CreateRoomScreenViewState) -> CreateRoomScreenViewState } struct DefaultCreateRoomScreenHook: CreateRoomScreenHookProtocol { - func update(_ viewState: CreateRoomScreenViewState, homeserver: String) -> CreateRoomScreenViewState { + func update(_ viewState: CreateRoomScreenViewState) -> CreateRoomScreenViewState { viewState } } diff --git a/ElementX/Sources/AppHooks/Hooks/DeveloperOptionsScreenHook.swift b/ElementX/Sources/AppHooks/Hooks/DeveloperOptionsScreenHook.swift index 626f177cd..470379503 100644 --- a/ElementX/Sources/AppHooks/Hooks/DeveloperOptionsScreenHook.swift +++ b/ElementX/Sources/AppHooks/Hooks/DeveloperOptionsScreenHook.swift @@ -8,11 +8,11 @@ import SwiftUI nonisolated protocol DeveloperOptionsScreenHookProtocol: Sendable { - func generalSectionRows(isSignedIn: Bool) -> AnyView? + func generalSectionRows() -> AnyView? } struct DefaultDeveloperOptionsScreenHook: DeveloperOptionsScreenHookProtocol { - func generalSectionRows(isSignedIn: Bool) -> AnyView? { + func generalSectionRows() -> AnyView? { nil } } diff --git a/ElementX/Sources/AppHooks/Hooks/OAuthPresenterHook.swift b/ElementX/Sources/AppHooks/Hooks/OAuthAccountSettingsPresenterHook.swift similarity index 67% rename from ElementX/Sources/AppHooks/Hooks/OAuthPresenterHook.swift rename to ElementX/Sources/AppHooks/Hooks/OAuthAccountSettingsPresenterHook.swift index 848e869a1..3854876e8 100644 --- a/ElementX/Sources/AppHooks/Hooks/OAuthPresenterHook.swift +++ b/ElementX/Sources/AppHooks/Hooks/OAuthAccountSettingsPresenterHook.swift @@ -8,11 +8,11 @@ import Foundation -nonisolated protocol OAuthPresenterHookProtocol: Sendable { +nonisolated protocol OAuthAccountSettingsPresenterHookProtocol: Sendable { @MainActor func update(_ url: URL) -> URL } -struct DefaultOAuthPresenterHook: OAuthPresenterHookProtocol { +struct DefaultOAuthAccountSettingsPresenterHook: OAuthAccountSettingsPresenterHookProtocol { func update(_ url: URL) -> URL { url } diff --git a/ElementX/Sources/AppHooks/Hooks/OAuthAuthenticationPresenterHook.swift b/ElementX/Sources/AppHooks/Hooks/OAuthAuthenticationPresenterHook.swift new file mode 100644 index 000000000..0b5b616e2 --- /dev/null +++ b/ElementX/Sources/AppHooks/Hooks/OAuthAuthenticationPresenterHook.swift @@ -0,0 +1,18 @@ +// +// Copyright 2026 Element Creations Ltd. +// +// SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial. +// Please see LICENSE files in the repository root for full details. +// + +import Foundation + +nonisolated protocol OAuthAuthenticationPresenterHookProtocol: Sendable { + @MainActor func update(_ url: URL, homeserver: String) -> URL +} + +struct DefaultOAuthAuthenticationPresenterHook: OAuthAuthenticationPresenterHookProtocol { + func update(_ url: URL, homeserver: String) -> URL { + url + } +} diff --git a/ElementX/Sources/AppHooks/Hooks/RecoveryKeyScreenHook.swift b/ElementX/Sources/AppHooks/Hooks/RecoveryKeyScreenHook.swift index 365d76544..f7ce14f0b 100644 --- a/ElementX/Sources/AppHooks/Hooks/RecoveryKeyScreenHook.swift +++ b/ElementX/Sources/AppHooks/Hooks/RecoveryKeyScreenHook.swift @@ -13,11 +13,11 @@ import SwiftUI } nonisolated protocol RecoveryKeyScreenHookProtocol: Sendable { - @MainActor func makeCoordinator(parameters: SecureBackupRecoveryKeyScreenCoordinatorParameters, homeserver: String) -> any SecureBackupRecoveryKeyCoordinatorProtocol + @MainActor func makeCoordinator(parameters: SecureBackupRecoveryKeyScreenCoordinatorParameters) -> any SecureBackupRecoveryKeyCoordinatorProtocol } struct DefaultRecoveryKeyScreenHook: RecoveryKeyScreenHookProtocol { - @MainActor func makeCoordinator(parameters: SecureBackupRecoveryKeyScreenCoordinatorParameters, homeserver: String) -> any SecureBackupRecoveryKeyCoordinatorProtocol { + @MainActor func makeCoordinator(parameters: SecureBackupRecoveryKeyScreenCoordinatorParameters) -> any SecureBackupRecoveryKeyCoordinatorProtocol { SecureBackupRecoveryKeyScreenCoordinator(parameters: parameters) } } diff --git a/ElementX/Sources/AppHooks/Hooks/SecurityAndPrivacyScreenHook.swift b/ElementX/Sources/AppHooks/Hooks/SecurityAndPrivacyScreenHook.swift index 8ef0614f5..d1d98e788 100644 --- a/ElementX/Sources/AppHooks/Hooks/SecurityAndPrivacyScreenHook.swift +++ b/ElementX/Sources/AppHooks/Hooks/SecurityAndPrivacyScreenHook.swift @@ -8,11 +8,11 @@ import Foundation nonisolated protocol SecurityAndPrivacyScreenHookProtocol: Sendable { - @MainActor func update(_ viewState: SecurityAndPrivacyScreenViewState, homeserver: String) -> SecurityAndPrivacyScreenViewState + @MainActor func update(_ viewState: SecurityAndPrivacyScreenViewState) -> SecurityAndPrivacyScreenViewState } struct DefaultSecurityAndPrivacyScreenHook: SecurityAndPrivacyScreenHookProtocol { - func update(_ viewState: SecurityAndPrivacyScreenViewState, homeserver: String) -> SecurityAndPrivacyScreenViewState { + func update(_ viewState: SecurityAndPrivacyScreenViewState) -> SecurityAndPrivacyScreenViewState { viewState } } diff --git a/ElementX/Sources/AppHooks/UserHooks.swift b/ElementX/Sources/AppHooks/UserHooks.swift index eefa93e6a..369e1bf76 100644 --- a/ElementX/Sources/AppHooks/UserHooks.swift +++ b/ElementX/Sources/AppHooks/UserHooks.swift @@ -15,6 +15,8 @@ nonisolated struct UserHooks: Sendable { let recoveryKeyScreenHook: RecoveryKeyScreenHookProtocol let createRoomScreenHook: CreateRoomScreenHookProtocol let securityAndPrivacyScreenHook: SecurityAndPrivacyScreenHookProtocol + let oAuthAccountSettingsPresenterHook: OAuthAccountSettingsPresenterHookProtocol + let developerOptionsScreenHook: DeveloperOptionsScreenHookProtocol init(roomScreenHook: RoomScreenHookProtocol = DefaultRoomScreenHook(), roomDetailsScreenHook: RoomDetailsScreenHookProtocol = DefaultRoomDetailsScreenHook(), @@ -22,7 +24,9 @@ nonisolated struct UserHooks: Sendable { userProfileScreenHook: UserProfileScreenHookProtocol = DefaultUserProfileScreenHook(), recoveryKeyScreenHook: RecoveryKeyScreenHookProtocol = DefaultRecoveryKeyScreenHook(), createRoomScreenHook: CreateRoomScreenHookProtocol = DefaultCreateRoomScreenHook(), - securityAndPrivacyScreenHook: SecurityAndPrivacyScreenHookProtocol = DefaultSecurityAndPrivacyScreenHook()) { + securityAndPrivacyScreenHook: SecurityAndPrivacyScreenHookProtocol = DefaultSecurityAndPrivacyScreenHook(), + oAuthAccountSettingsPresenterHook: OAuthAccountSettingsPresenterHookProtocol = DefaultOAuthAccountSettingsPresenterHook(), + developerOptionsScreenHook: DeveloperOptionsScreenHookProtocol = DefaultDeveloperOptionsScreenHook()) { self.roomScreenHook = roomScreenHook self.roomDetailsScreenHook = roomDetailsScreenHook self.roomMemberDetailsScreenHook = roomMemberDetailsScreenHook @@ -30,5 +34,7 @@ nonisolated struct UserHooks: Sendable { self.recoveryKeyScreenHook = recoveryKeyScreenHook self.createRoomScreenHook = createRoomScreenHook self.securityAndPrivacyScreenHook = securityAndPrivacyScreenHook + self.oAuthAccountSettingsPresenterHook = oAuthAccountSettingsPresenterHook + self.developerOptionsScreenHook = developerOptionsScreenHook } } diff --git a/ElementX/Sources/Application/AppCoordinator.swift b/ElementX/Sources/Application/AppCoordinator.swift index b46e88209..bb019545a 100644 --- a/ElementX/Sources/Application/AppCoordinator.swift +++ b/ElementX/Sources/Application/AppCoordinator.swift @@ -894,7 +894,6 @@ class AppCoordinator: AppCoordinatorProtocol, AuthenticationFlowCoordinatorDeleg emojiProvider: EmojiProvider(userSettings: userSession.userSettings), linkMetadataProvider: LinkMetadataProvider(), appMediator: appMediator, - appHooks: appHooks, analytics: analyticsService, userIndicatorController: userIndicatorController, stateMachineFactory: StateMachineFactory()) diff --git a/ElementX/Sources/Application/FlowCoordinatorProtocol.swift b/ElementX/Sources/Application/FlowCoordinatorProtocol.swift index 6908b5055..023be922f 100644 --- a/ElementX/Sources/Application/FlowCoordinatorProtocol.swift +++ b/ElementX/Sources/Application/FlowCoordinatorProtocol.swift @@ -34,7 +34,6 @@ struct CommonFlowParameters { let emojiProvider: EmojiProviderProtocol let linkMetadataProvider: LinkMetadataProviderProtocol let appMediator: AppMediatorProtocol - let appHooks: AppHooks let analytics: AnalyticsServiceProtocol let userIndicatorController: UserIndicatorControllerProtocol let stateMachineFactory: StateMachineFactoryProtocol diff --git a/ElementX/Sources/FlowCoordinators/AuthenticationFlowCoordinator.swift b/ElementX/Sources/FlowCoordinators/AuthenticationFlowCoordinator.swift index 9298ca725..16b783913 100644 --- a/ElementX/Sources/FlowCoordinators/AuthenticationFlowCoordinator.swift +++ b/ElementX/Sources/FlowCoordinators/AuthenticationFlowCoordinator.swift @@ -378,7 +378,7 @@ class AuthenticationFlowCoordinator: FlowCoordinatorProtocol { redirectURL: appSettings.oAuthRedirectURL, presentationAnchor: presentationAnchor, appMediator: appMediator, - appHooks: appHooks, + presenterHook: appHooks.oAuthAuthenticationPresenterHook, userIndicatorController: userIndicatorController) oAuthPresenter = presenter @@ -443,7 +443,7 @@ class AuthenticationFlowCoordinator: FlowCoordinatorProtocol { private func showDeveloperOptionsScreen() { let stackCoordinator = NavigationStackCoordinator() let coordinator = DeveloperOptionsScreenCoordinator(appSettings: appSettings, - appHooks: appHooks, + screenHook: appHooks.developerOptionsScreenHook, clientProxy: nil) coordinator.actions .sink { action in diff --git a/ElementX/Sources/FlowCoordinators/ChatsTabFlowCoordinator.swift b/ElementX/Sources/FlowCoordinators/ChatsTabFlowCoordinator.swift index 454f2ff77..71bbf54be 100644 --- a/ElementX/Sources/FlowCoordinators/ChatsTabFlowCoordinator.swift +++ b/ElementX/Sources/FlowCoordinators/ChatsTabFlowCoordinator.swift @@ -658,8 +658,7 @@ class ChatsTabFlowCoordinator: FlowCoordinatorProtocol { userIndicatorController: flowParameters.userIndicatorController, isModallyPresented: true) - let coordinator = userSession.userHooks.recoveryKeyScreenHook.makeCoordinator(parameters: parameters, - homeserver: userSession.clientProxy.homeserver) + let coordinator = userSession.userHooks.recoveryKeyScreenHook.makeCoordinator(parameters: parameters) coordinator.actions.sink { [weak self] action in guard let self else { return } switch action { @@ -680,7 +679,6 @@ class ChatsTabFlowCoordinator: FlowCoordinatorProtocol { let sheetNavigationStackCoordinator = NavigationStackCoordinator() let parameters = EncryptionResetFlowCoordinatorParameters(userSession: userSession, appMediator: flowParameters.appMediator, - appHooks: flowParameters.appHooks, userIndicatorController: flowParameters.userIndicatorController, navigationStackCoordinator: sheetNavigationStackCoordinator, windowManger: flowParameters.windowManager) diff --git a/ElementX/Sources/FlowCoordinators/EncryptionResetFlowCoordinator.swift b/ElementX/Sources/FlowCoordinators/EncryptionResetFlowCoordinator.swift index 409afc80e..3dbe17da7 100644 --- a/ElementX/Sources/FlowCoordinators/EncryptionResetFlowCoordinator.swift +++ b/ElementX/Sources/FlowCoordinators/EncryptionResetFlowCoordinator.swift @@ -20,7 +20,6 @@ enum EncryptionResetFlowCoordinatorAction: Equatable { struct EncryptionResetFlowCoordinatorParameters { let userSession: UserSessionProtocol let appMediator: AppMediatorProtocol - let appHooks: AppHooks let userIndicatorController: UserIndicatorControllerProtocol let navigationStackCoordinator: NavigationStackCoordinator let windowManger: WindowManagerProtocol @@ -29,8 +28,6 @@ struct EncryptionResetFlowCoordinatorParameters { class EncryptionResetFlowCoordinator: FlowCoordinatorProtocol { private let userSession: UserSessionProtocol private let appMediator: AppMediatorProtocol - private let userSettings: UserSettings - private let appHooks: AppHooks private let userIndicatorController: UserIndicatorControllerProtocol private let navigationStackCoordinator: NavigationStackCoordinator @@ -66,8 +63,6 @@ class EncryptionResetFlowCoordinator: FlowCoordinatorProtocol { init(parameters: EncryptionResetFlowCoordinatorParameters) { userSession = parameters.userSession appMediator = parameters.appMediator - userSettings = parameters.userSession.userSettings - appHooks = parameters.appHooks userIndicatorController = parameters.userIndicatorController navigationStackCoordinator = parameters.navigationStackCoordinator windowManager = parameters.windowManger @@ -164,8 +159,7 @@ class EncryptionResetFlowCoordinator: FlowCoordinatorProtocol { accountSettingsPresenter = OAuthAccountSettingsPresenter(accountURL: url, presentationAnchor: windowManager.mainWindow, appMediator: appMediator, - userSettings: userSettings, - appHooks: appHooks) + userSession: userSession) accountSettingsPresenter?.start() } } diff --git a/ElementX/Sources/FlowCoordinators/EncryptionSettingsFlowCoordinator.swift b/ElementX/Sources/FlowCoordinators/EncryptionSettingsFlowCoordinator.swift index 4ecc67640..95adb81f5 100644 --- a/ElementX/Sources/FlowCoordinators/EncryptionSettingsFlowCoordinator.swift +++ b/ElementX/Sources/FlowCoordinators/EncryptionSettingsFlowCoordinator.swift @@ -160,8 +160,7 @@ class EncryptionSettingsFlowCoordinator: FlowCoordinatorProtocol { let parameters = SecureBackupRecoveryKeyScreenCoordinatorParameters(secureBackupController: userSession.clientProxy.secureBackupController, userIndicatorController: userIndicatorController, isModallyPresented: true) - let coordinator = userSession.userHooks.recoveryKeyScreenHook.makeCoordinator(parameters: parameters, - homeserver: userSession.clientProxy.homeserver) + let coordinator = userSession.userHooks.recoveryKeyScreenHook.makeCoordinator(parameters: parameters) coordinator.actions.sink { [weak self] action in guard let self else { return } diff --git a/ElementX/Sources/FlowCoordinators/OnboardingFlowCoordinator.swift b/ElementX/Sources/FlowCoordinators/OnboardingFlowCoordinator.swift index 7a2eed931..54ddb7f2e 100644 --- a/ElementX/Sources/FlowCoordinators/OnboardingFlowCoordinator.swift +++ b/ElementX/Sources/FlowCoordinators/OnboardingFlowCoordinator.swift @@ -22,7 +22,6 @@ class OnboardingFlowCoordinator: FlowCoordinatorProtocol { private let analyticsService: AnalyticsServiceProtocol private let appMediator: AppMediatorProtocol private let userSettings: UserSettings - private let appHooks: AppHooks private let userIndicatorController: UserIndicatorControllerProtocol private let windowManager: WindowManagerProtocol private var isNewLogin: Bool @@ -69,7 +68,6 @@ class OnboardingFlowCoordinator: FlowCoordinatorProtocol { analyticsService = flowParameters.analytics appMediator = flowParameters.appMediator userSettings = flowParameters.userSession.userSettings - appHooks = flowParameters.appHooks userIndicatorController = flowParameters.userIndicatorController windowManager = flowParameters.windowManager @@ -300,8 +298,7 @@ class OnboardingFlowCoordinator: FlowCoordinatorProtocol { userIndicatorController: userIndicatorController, isModallyPresented: false) - let coordinator = userSession.userHooks.recoveryKeyScreenHook.makeCoordinator(parameters: parameters, - homeserver: userSession.clientProxy.homeserver) + let coordinator = userSession.userHooks.recoveryKeyScreenHook.makeCoordinator(parameters: parameters) coordinator.actions .sink { action in @@ -319,7 +316,6 @@ class OnboardingFlowCoordinator: FlowCoordinatorProtocol { let resetNavigationStackCoordinator = NavigationStackCoordinator() let coordinator = EncryptionResetFlowCoordinator(parameters: .init(userSession: userSession, appMediator: appMediator, - appHooks: appHooks, userIndicatorController: userIndicatorController, navigationStackCoordinator: resetNavigationStackCoordinator, windowManger: windowManager)) diff --git a/ElementX/Sources/FlowCoordinators/SettingsFlowCoordinator.swift b/ElementX/Sources/FlowCoordinators/SettingsFlowCoordinator.swift index 15d370af5..b838b0044 100644 --- a/ElementX/Sources/FlowCoordinators/SettingsFlowCoordinator.swift +++ b/ElementX/Sources/FlowCoordinators/SettingsFlowCoordinator.swift @@ -315,7 +315,7 @@ class SettingsFlowCoordinator: FlowCoordinatorProtocol { private func presentDeveloperOptions() { let coordinator = DeveloperOptionsScreenCoordinator(appSettings: userSettings.app, - appHooks: flowParameters.appHooks, + screenHook: flowParameters.userSession.userHooks.developerOptionsScreenHook, clientProxy: flowParameters.userSession.clientProxy) coordinator.actions @@ -360,8 +360,7 @@ class SettingsFlowCoordinator: FlowCoordinatorProtocol { accountSettingsPresenter = OAuthAccountSettingsPresenter(accountURL: url, presentationAnchor: flowParameters.windowManager.mainWindow, appMediator: flowParameters.appMediator, - userSettings: userSettings, - appHooks: flowParameters.appHooks, + userSession: flowParameters.userSession, continuation: continuation) accountSettingsPresenter?.start() } diff --git a/ElementX/Sources/Screens/Authentication/OAuthAuthenticationPresenter.swift b/ElementX/Sources/Screens/Authentication/OAuthAuthenticationPresenter.swift index 264fa1468..c0c6c8337 100644 --- a/ElementX/Sources/Screens/Authentication/OAuthAuthenticationPresenter.swift +++ b/ElementX/Sources/Screens/Authentication/OAuthAuthenticationPresenter.swift @@ -18,7 +18,7 @@ class OAuthAuthenticationPresenter: NSObject { private let redirectURL: URL private let presentationAnchor: UIWindow private let appMediator: AppMediatorProtocol - private let appHooks: AppHooks + private let presenterHook: OAuthAuthenticationPresenterHookProtocol private let userIndicatorController: UserIndicatorControllerProtocol /// The data required to complete a request. @@ -39,13 +39,13 @@ class OAuthAuthenticationPresenter: NSObject { redirectURL: URL, presentationAnchor: UIWindow, appMediator: AppMediatorProtocol, - appHooks: AppHooks, + presenterHook: OAuthAuthenticationPresenterHookProtocol, userIndicatorController: UserIndicatorControllerProtocol) { self.authenticationService = authenticationService self.redirectURL = redirectURL self.presentationAnchor = presentationAnchor self.appMediator = appMediator - self.appHooks = appHooks + self.presenterHook = presenterHook self.userIndicatorController = userIndicatorController super.init() } @@ -56,7 +56,7 @@ class OAuthAuthenticationPresenter: NSObject { /// In particular if the authentication URL requires opening an external app, then the user may return /// to the app without completing (or cancelling) the authentication. func authenticate(using oAuthData: OAuthAuthorizationDataProxy) async -> Result { - let authenticationURL = appHooks.oAuthPresenterHook.update(oAuthData.url) + let authenticationURL = presenterHook.update(oAuthData.url, homeserver: oAuthData.homeserver) let response = await withCheckedContinuation { continuation in let session = ASWebAuthenticationSession(url: authenticationURL, callback: .oAuthRedirectURL(redirectURL)) { url, error in diff --git a/ElementX/Sources/Screens/Authentication/SoftLogoutScreen/SoftLogoutScreenCoordinator.swift b/ElementX/Sources/Screens/Authentication/SoftLogoutScreen/SoftLogoutScreenCoordinator.swift index 02177723e..7ee6f0cee 100644 --- a/ElementX/Sources/Screens/Authentication/SoftLogoutScreen/SoftLogoutScreenCoordinator.swift +++ b/ElementX/Sources/Screens/Authentication/SoftLogoutScreen/SoftLogoutScreenCoordinator.swift @@ -161,7 +161,7 @@ final class SoftLogoutScreenCoordinator: CoordinatorProtocol { redirectURL: parameters.appSettings.oAuthRedirectURL, presentationAnchor: presentationAnchor, appMediator: parameters.appMediator, - appHooks: parameters.appHooks, + presenterHook: parameters.appHooks.oAuthAuthenticationPresenterHook, userIndicatorController: parameters.userIndicatorController) self.oAuthPresenter = presenter switch await presenter.authenticate(using: oAuthData) { diff --git a/ElementX/Sources/Screens/CreateRoomScreen/CreateRoomScreenViewModel.swift b/ElementX/Sources/Screens/CreateRoomScreen/CreateRoomScreenViewModel.swift index 89ee2259b..1df5e21be 100644 --- a/ElementX/Sources/Screens/CreateRoomScreen/CreateRoomScreenViewModel.swift +++ b/ElementX/Sources/Screens/CreateRoomScreen/CreateRoomScreenViewModel.swift @@ -67,7 +67,7 @@ class CreateRoomScreenViewModel: CreateRoomScreenViewModelType, CreateRoomScreen aliasLocalPart: roomAliasNameFromRoomDisplayName(roomName: ""), bindings: bindings) - super.init(initialViewState: userSession.userHooks.createRoomScreenHook.update(viewState, homeserver: userSession.clientProxy.homeserver), + super.init(initialViewState: userSession.userHooks.createRoomScreenHook.update(viewState), mediaProvider: userSession.mediaProvider) setupBindings() diff --git a/ElementX/Sources/Screens/SecurityAndPrivacyScreen/SecurityAndPrivacyScreenViewModel.swift b/ElementX/Sources/Screens/SecurityAndPrivacyScreen/SecurityAndPrivacyScreenViewModel.swift index e166db03a..5777b0093 100644 --- a/ElementX/Sources/Screens/SecurityAndPrivacyScreen/SecurityAndPrivacyScreenViewModel.swift +++ b/ElementX/Sources/Screens/SecurityAndPrivacyScreen/SecurityAndPrivacyScreenViewModel.swift @@ -38,7 +38,7 @@ class SecurityAndPrivacyScreenViewModel: SecurityAndPrivacyScreenViewModelType, isKnockingEnabled: userSettings.app.knockingEnabled, historySharingDetailsURL: userSettings.app.historySharingDetailsURL) - super.init(initialViewState: userSession.userHooks.securityAndPrivacyScreenHook.update(viewState, homeserver: clientProxy.homeserver)) + super.init(initialViewState: userSession.userHooks.securityAndPrivacyScreenHook.update(viewState)) if let powerLevels = roomProxy.infoPublisher.value.powerLevels { setupPermissions(powerLevels: powerLevels) diff --git a/ElementX/Sources/Screens/Settings/AccountSettings/OAuthAccountSettingsPresenter.swift b/ElementX/Sources/Screens/Settings/AccountSettings/OAuthAccountSettingsPresenter.swift index 925aecd52..eba3643e4 100644 --- a/ElementX/Sources/Screens/Settings/AccountSettings/OAuthAccountSettingsPresenter.swift +++ b/ElementX/Sources/Screens/Settings/AccountSettings/OAuthAccountSettingsPresenter.swift @@ -19,7 +19,7 @@ class OAuthAccountSettingsPresenter: NSObject { private let redirectURL: URL private let presentationAnchor: UIWindow private let appMediator: AppMediatorProtocol - private let appHooks: AppHooks + private let presenterHook: OAuthAccountSettingsPresenterHookProtocol typealias Continuation = AsyncStream>.Continuation private let continuation: Continuation? @@ -27,14 +27,13 @@ class OAuthAccountSettingsPresenter: NSObject { init(accountURL: URL, presentationAnchor: UIWindow, appMediator: AppMediatorProtocol, - userSettings: UserSettings, - appHooks: AppHooks, + userSession: UserSessionProtocol, continuation: Continuation? = nil) { self.accountURL = accountURL - redirectURL = userSettings.app.oAuthRedirectURL + redirectURL = userSession.userSettings.app.oAuthRedirectURL self.presentationAnchor = presentationAnchor self.appMediator = appMediator - self.appHooks = appHooks + presenterHook = userSession.userHooks.oAuthAccountSettingsPresenterHook self.continuation = continuation super.init() @@ -42,7 +41,7 @@ class OAuthAccountSettingsPresenter: NSObject { /// Presents a web authentication session for the supplied data. func start() { - let accountURL = appHooks.oAuthPresenterHook.update(accountURL) + let accountURL = presenterHook.update(accountURL) let session = ASWebAuthenticationSession(url: accountURL, callback: .oAuthRedirectURL(redirectURL)) { [continuation] _, error in guard let continuation else { return } diff --git a/ElementX/Sources/Screens/Settings/DeveloperOptionsScreen/DeveloperOptionsScreenCoordinator.swift b/ElementX/Sources/Screens/Settings/DeveloperOptionsScreen/DeveloperOptionsScreenCoordinator.swift index 4f692d588..961b9629d 100644 --- a/ElementX/Sources/Screens/Settings/DeveloperOptionsScreen/DeveloperOptionsScreenCoordinator.swift +++ b/ElementX/Sources/Screens/Settings/DeveloperOptionsScreen/DeveloperOptionsScreenCoordinator.swift @@ -23,9 +23,9 @@ final class DeveloperOptionsScreenCoordinator: CoordinatorProtocol { actionsSubject.eraseToAnyPublisher() } - init(appSettings: AppSettings, appHooks: AppHooks, clientProxy: ClientProxyProtocol?) { + init(appSettings: AppSettings, screenHook: DeveloperOptionsScreenHookProtocol, clientProxy: ClientProxyProtocol?) { viewModel = DeveloperOptionsScreenViewModel(developerOptions: appSettings, - appHooks: appHooks, + screenHook: screenHook, clientProxy: clientProxy) viewModel.actions diff --git a/ElementX/Sources/Screens/Settings/DeveloperOptionsScreen/DeveloperOptionsScreenModels.swift b/ElementX/Sources/Screens/Settings/DeveloperOptionsScreen/DeveloperOptionsScreenModels.swift index a01da63e7..5ccfd6ac7 100644 --- a/ElementX/Sources/Screens/Settings/DeveloperOptionsScreen/DeveloperOptionsScreenModels.swift +++ b/ElementX/Sources/Screens/Settings/DeveloperOptionsScreen/DeveloperOptionsScreenModels.swift @@ -14,9 +14,8 @@ enum DeveloperOptionsScreenViewModelAction { } struct DeveloperOptionsScreenViewState: BindableState { - let appHooks: AppHooks + let screenHook: DeveloperOptionsScreenHookProtocol var storeSizes: [StoreSize]? - let shouldShowClearCache: Bool let isSignedIn: Bool var bindings: DeveloperOptionsScreenViewStateBindings diff --git a/ElementX/Sources/Screens/Settings/DeveloperOptionsScreen/DeveloperOptionsScreenViewModel.swift b/ElementX/Sources/Screens/Settings/DeveloperOptionsScreen/DeveloperOptionsScreenViewModel.swift index 31a63dda5..1dff8e34c 100644 --- a/ElementX/Sources/Screens/Settings/DeveloperOptionsScreen/DeveloperOptionsScreenViewModel.swift +++ b/ElementX/Sources/Screens/Settings/DeveloperOptionsScreen/DeveloperOptionsScreenViewModel.swift @@ -20,10 +20,9 @@ class DeveloperOptionsScreenViewModel: DeveloperOptionsScreenViewModelType, Deve private let clientProxy: ClientProxyProtocol? - init(developerOptions: DeveloperOptionsProtocol, appHooks: AppHooks, clientProxy: ClientProxyProtocol?) { + init(developerOptions: DeveloperOptionsProtocol, screenHook: DeveloperOptionsScreenHookProtocol, clientProxy: ClientProxyProtocol?) { self.clientProxy = clientProxy - super.init(initialViewState: .init(appHooks: appHooks, - shouldShowClearCache: clientProxy != nil, + super.init(initialViewState: .init(screenHook: screenHook, isSignedIn: clientProxy != nil, bindings: .init(developerOptions: developerOptions))) diff --git a/ElementX/Sources/Screens/Settings/DeveloperOptionsScreen/View/DeveloperOptionsScreen.swift b/ElementX/Sources/Screens/Settings/DeveloperOptionsScreen/View/DeveloperOptionsScreen.swift index 0e0ce9d85..a8adc4492 100644 --- a/ElementX/Sources/Screens/Settings/DeveloperOptionsScreen/View/DeveloperOptionsScreen.swift +++ b/ElementX/Sources/Screens/Settings/DeveloperOptionsScreen/View/DeveloperOptionsScreen.swift @@ -54,9 +54,7 @@ struct DeveloperOptionsScreen: View { Text("Moves search to a separate tab") } - context.viewState.appHooks - .developerOptionsScreenHook - .generalSectionRows(isSignedIn: context.viewState.isSignedIn) + context.viewState.screenHook.generalSectionRows() } Section("Accounts") { @@ -173,7 +171,7 @@ struct DeveloperOptionsScreen: View { } } - if context.viewState.shouldShowClearCache { + if context.viewState.isSignedIn { Section { Button(role: .destructive) { context.send(viewAction: .clearCache) @@ -257,7 +255,7 @@ private extension Set { struct DeveloperOptionsScreen_Previews: PreviewProvider { static let viewModel = DeveloperOptionsScreenViewModel(developerOptions: AppSettings.volatile(), - appHooks: AppHooks(), + screenHook: DefaultDeveloperOptionsScreenHook(), clientProxy: ClientProxyMock(.init())) static var previews: some View { diff --git a/ElementX/Sources/Services/Authentication/AuthenticationService.swift b/ElementX/Sources/Services/Authentication/AuthenticationService.swift index f4de7b3a2..b58aa9367 100644 --- a/ElementX/Sources/Services/Authentication/AuthenticationService.swift +++ b/ElementX/Sources/Services/Authentication/AuthenticationService.swift @@ -123,7 +123,7 @@ class AuthenticationService: AuthenticationServiceProtocol { loginHint: loginHint, deviceId: nil, additionalScopes: nil) - return .success(OAuthAuthorizationDataProxy(underlyingData: oAuthData)) + return .success(OAuthAuthorizationDataProxy(underlyingData: oAuthData, homeserver: client.homeserver())) } catch { MXLog.error("Failed to get URL for OAuth login: \(error)") return .failure(.oAuthError(.urlFailure)) diff --git a/ElementX/Sources/Services/Authentication/AuthenticationServiceProtocol.swift b/ElementX/Sources/Services/Authentication/AuthenticationServiceProtocol.swift index ade43ea1c..13669d4d3 100644 --- a/ElementX/Sources/Services/Authentication/AuthenticationServiceProtocol.swift +++ b/ElementX/Sources/Services/Authentication/AuthenticationServiceProtocol.swift @@ -85,7 +85,10 @@ enum OAuthError: Error { } struct OAuthAuthorizationDataProxy: Hashable { + /// The authorisation data supplied by the SDK. let underlyingData: OAuthAuthorizationData + /// The homeserver that the authorisation is for. + let homeserver: String var url: URL { guard let url = URL(string: underlyingData.loginUrl()) else { diff --git a/ElementX/Sources/UITests/UITestsAppCoordinator.swift b/ElementX/Sources/UITests/UITestsAppCoordinator.swift index 669b99f5f..d5ca3f49b 100644 --- a/ElementX/Sources/UITests/UITestsAppCoordinator.swift +++ b/ElementX/Sources/UITests/UITestsAppCoordinator.swift @@ -634,7 +634,6 @@ class MockScreen: Identifiable { emojiProvider: EmojiProvider(userSettings: userSession.userSettings), linkMetadataProvider: LinkMetadataProvider(), appMediator: appMediator, - appHooks: AppHooks(), analytics: analytics, userIndicatorController: UserIndicatorControllerMock(), stateMachineFactory: StateMachineFactory())) @@ -686,7 +685,6 @@ class MockScreen: Identifiable { emojiProvider: EmojiProvider(userSettings: userSession.userSettings), linkMetadataProvider: LinkMetadataProvider(), appMediator: AppMediatorMock(.init()), - appHooks: AppHooks(), analytics: analytics, userIndicatorController: UserIndicatorControllerMock(), stateMachineFactory: StateMachineFactory())) @@ -743,7 +741,6 @@ class MockScreen: Identifiable { let coordinator = EncryptionResetFlowCoordinator(parameters: .init(userSession: userSession, appMediator: AppMediatorMock(.init()), - appHooks: AppHooks(), userIndicatorController: userIndicatorController, navigationStackCoordinator: navigationStackCoordinator, windowManger: windowManager)) @@ -785,7 +782,6 @@ class MockScreen: Identifiable { emojiProvider: EmojiProvider(userSettings: userSession.userSettings), linkMetadataProvider: LinkMetadataProvider(), appMediator: AppMediatorMock(.init()), - appHooks: AppHooks(), analytics: analytics, userIndicatorController: UserIndicatorControllerMock(), stateMachineFactory: StateMachineFactory())) @@ -841,7 +837,6 @@ class MockScreen: Identifiable { emojiProvider: EmojiProvider(userSettings: userSession.userSettings), linkMetadataProvider: LinkMetadataProvider(), appMediator: AppMediatorMock(.init()), - appHooks: AppHooks(), analytics: analytics, userIndicatorController: UserIndicatorControllerMock(), stateMachineFactory: StateMachineFactory())) diff --git a/Enterprise b/Enterprise index 8b65ca7f1..5fbb11851 160000 --- a/Enterprise +++ b/Enterprise @@ -1 +1 @@ -Subproject commit 8b65ca7f1334e3d696fe01f2ad071cc5d9db9326 +Subproject commit 5fbb11851e3869b7388647d7561ec7c12220e78c diff --git a/UnitTests/Sources/ChatsTabFlowCoordinatorTests.swift b/UnitTests/Sources/ChatsTabFlowCoordinatorTests.swift index b7fc32018..b27e44250 100644 --- a/UnitTests/Sources/ChatsTabFlowCoordinatorTests.swift +++ b/UnitTests/Sources/ChatsTabFlowCoordinatorTests.swift @@ -45,7 +45,6 @@ struct ChatsTabFlowCoordinatorTests { emojiProvider: EmojiProvider(userSettings: userSession.userSettings), linkMetadataProvider: LinkMetadataProvider(), appMediator: AppMediatorMock(.init()), - appHooks: AppHooks(), analytics: AnalyticsServiceMock(.init()), userIndicatorController: UserIndicatorControllerMock(), stateMachineFactory: stateMachineFactory) diff --git a/UnitTests/Sources/RoomFlowCoordinatorTests.swift b/UnitTests/Sources/RoomFlowCoordinatorTests.swift index 50ad3aad8..250767f95 100644 --- a/UnitTests/Sources/RoomFlowCoordinatorTests.swift +++ b/UnitTests/Sources/RoomFlowCoordinatorTests.swift @@ -531,7 +531,6 @@ final class RoomFlowCoordinatorTests { emojiProvider: EmojiProvider(userSettings: userSettings), linkMetadataProvider: LinkMetadataProvider(), appMediator: AppMediatorMock(.init()), - appHooks: AppHooks(), analytics: AnalyticsServiceMock(.init()), userIndicatorController: UserIndicatorControllerMock(), stateMachineFactory: StateMachineFactory()) diff --git a/UnitTests/Sources/RoomMembersFlowCoordinatorTests.swift b/UnitTests/Sources/RoomMembersFlowCoordinatorTests.swift index 9a9d49137..a9eb93680 100644 --- a/UnitTests/Sources/RoomMembersFlowCoordinatorTests.swift +++ b/UnitTests/Sources/RoomMembersFlowCoordinatorTests.swift @@ -61,7 +61,6 @@ struct RoomMembersFlowCoordinatorTests { emojiProvider: EmojiProvider(userSettings: userSession.userSettings), linkMetadataProvider: LinkMetadataProvider(), appMediator: AppMediatorMock(.init()), - appHooks: AppHooks(), analytics: AnalyticsServiceMock(.init()), userIndicatorController: UserIndicatorControllerMock(), stateMachineFactory: stateMachineFactory) diff --git a/UnitTests/Sources/UserSessionFlowCoordinatorTests.swift b/UnitTests/Sources/UserSessionFlowCoordinatorTests.swift index 19307f763..3a0a23651 100644 --- a/UnitTests/Sources/UserSessionFlowCoordinatorTests.swift +++ b/UnitTests/Sources/UserSessionFlowCoordinatorTests.swift @@ -58,7 +58,6 @@ struct UserSessionFlowCoordinatorTests { emojiProvider: EmojiProvider(userSettings: userSession.userSettings), linkMetadataProvider: LinkMetadataProvider(), appMediator: appMediator, - appHooks: AppHooks(), analytics: AnalyticsServiceMock(.init()), userIndicatorController: userIndicatorController, stateMachineFactory: stateMachineFactory)