Add a new UserHooks container and move some AppHooks. (#6332)

* Add a UserHooks system with just the CreateRoomScreenHook for now.

* Move more hooks into UserHooks.

* Pass the ClientProxy to makeUserHooks instead of calling AppHooks.configure(with:).

* Update the Enterprise submodule.
This commit is contained in:
Doug
2026-10-15 10:49:27 +01:00
committed by GitHub
parent 11b6cc3f70
commit b6ccbbc6c3
45 changed files with 90 additions and 168 deletions
@@ -659,8 +659,8 @@ class ChatsTabFlowCoordinator: FlowCoordinatorProtocol {
userIndicatorController: flowParameters.userIndicatorController,
isModallyPresented: true)
let coordinator = flowParameters.appHooks.recoveryKeyScreenHook.makeCoordinator(parameters: parameters,
homeserver: userSession.clientProxy.homeserver)
let coordinator = userSession.userHooks.recoveryKeyScreenHook.makeCoordinator(parameters: parameters,
homeserver: userSession.clientProxy.homeserver)
coordinator.actions.sink { [weak self] action in
guard let self else { return }
switch action {
@@ -744,7 +744,6 @@ class ChatsTabFlowCoordinator: FlowCoordinatorProtocol {
let parameters = UserProfileScreenCoordinatorParameters(userID: userID,
isPresentedModally: true,
userSession: userSession,
appHooks: flowParameters.appHooks,
analytics: flowParameters.analytics,
userIndicatorController: flowParameters.userIndicatorController)
let coordinator = UserProfileScreenCoordinator(parameters: parameters)
@@ -17,7 +17,6 @@ enum EncryptionSettingsFlowCoordinatorAction: Equatable {
struct EncryptionSettingsFlowCoordinatorParameters {
let userSession: UserSessionProtocol
let appHooks: AppHooks
let userIndicatorController: UserIndicatorControllerProtocol
let navigationStackCoordinator: NavigationStackCoordinator
}
@@ -25,7 +24,6 @@ struct EncryptionSettingsFlowCoordinatorParameters {
class EncryptionSettingsFlowCoordinator: FlowCoordinatorProtocol {
private let userSession: UserSessionProtocol
private let userSettings: UserSettings
private let appHooks: AppHooks
private let userIndicatorController: UserIndicatorControllerProtocol
private let navigationStackCoordinator: NavigationStackCoordinator
@@ -66,7 +64,6 @@ class EncryptionSettingsFlowCoordinator: FlowCoordinatorProtocol {
init(parameters: EncryptionSettingsFlowCoordinatorParameters) {
userSession = parameters.userSession
userSettings = parameters.userSession.userSettings
appHooks = parameters.appHooks
userIndicatorController = parameters.userIndicatorController
navigationStackCoordinator = parameters.navigationStackCoordinator
@@ -163,8 +160,8 @@ class EncryptionSettingsFlowCoordinator: FlowCoordinatorProtocol {
let parameters = SecureBackupRecoveryKeyScreenCoordinatorParameters(secureBackupController: userSession.clientProxy.secureBackupController,
userIndicatorController: userIndicatorController,
isModallyPresented: true)
let coordinator = appHooks.recoveryKeyScreenHook.makeCoordinator(parameters: parameters,
homeserver: userSession.clientProxy.homeserver)
let coordinator = userSession.userHooks.recoveryKeyScreenHook.makeCoordinator(parameters: parameters,
homeserver: userSession.clientProxy.homeserver)
coordinator.actions.sink { [weak self] action in
guard let self else { return }
@@ -302,8 +302,8 @@ class OnboardingFlowCoordinator: FlowCoordinatorProtocol {
userIndicatorController: userIndicatorController,
isModallyPresented: false)
let coordinator = appHooks.recoveryKeyScreenHook.makeCoordinator(parameters: parameters,
homeserver: userSession.clientProxy.homeserver)
let coordinator = userSession.userHooks.recoveryKeyScreenHook.makeCoordinator(parameters: parameters,
homeserver: userSession.clientProxy.homeserver)
coordinator.actions
.sink { action in
@@ -681,7 +681,6 @@ class RoomFlowCoordinator: FlowCoordinatorProtocol {
completionSuggestionService: completionSuggestionService,
ongoingCallRoomIDPublisher: flowParameters.ongoingCallRoomIDPublisher,
appMediator: flowParameters.appMediator,
appHooks: flowParameters.appHooks,
analytics: flowParameters.analytics,
composerDraftService: composerDraftService,
timelineControllerFactory: flowParameters.timelineControllerFactory,
@@ -937,7 +936,6 @@ class RoomFlowCoordinator: FlowCoordinatorProtocol {
private func presentRoomDetails(isRoot: Bool, animated: Bool) async {
let params = RoomDetailsScreenCoordinatorParameters(roomProxy: roomProxy,
userSession: userSession,
appHooks: flowParameters.appHooks,
analyticsService: flowParameters.analytics,
userIndicatorController: flowParameters.userIndicatorController,
notificationSettings: userSession.clientProxy.notificationSettings,
@@ -1413,8 +1411,7 @@ class RoomFlowCoordinator: FlowCoordinatorProtocol {
private func presentSecurityAndPrivacyScreen() {
let coordinator = SecurityAndPrivacyScreenCoordinator(parameters: .init(roomProxy: roomProxy,
userSession: userSession,
userIndicatorController: flowParameters.userIndicatorController,
appHooks: flowParameters.appHooks))
userIndicatorController: flowParameters.userIndicatorController))
coordinator.actionsPublisher.sink { [weak self] action in
guard let self else { return }
@@ -231,7 +231,6 @@ final class RoomMembersFlowCoordinator: FlowCoordinatorProtocol {
let params = RoomMemberDetailsScreenCoordinatorParameters(userID: userID,
roomProxy: roomProxy,
userSession: flowParameters.userSession,
appHooks: flowParameters.appHooks,
analytics: flowParameters.analytics,
userIndicatorController: flowParameters.userIndicatorController)
let coordinator = RoomMemberDetailsScreenCoordinator(parameters: params)
@@ -288,7 +287,6 @@ final class RoomMembersFlowCoordinator: FlowCoordinatorProtocol {
let parameters = UserProfileScreenCoordinatorParameters(userID: userID,
isPresentedModally: false,
userSession: flowParameters.userSession,
appHooks: flowParameters.appHooks,
analytics: flowParameters.analytics,
userIndicatorController: flowParameters.userIndicatorController)
let coordinator = UserProfileScreenCoordinator(parameters: parameters)
@@ -157,7 +157,6 @@ class SettingsFlowCoordinator: FlowCoordinatorProtocol {
private func startEncryptionSettingsFlow() {
let coordinator = EncryptionSettingsFlowCoordinator(parameters: .init(userSession: flowParameters.userSession,
appHooks: flowParameters.appHooks,
userIndicatorController: flowParameters.userIndicatorController,
navigationStackCoordinator: navigationStackCoordinator))
coordinator.actionsPublisher.sink { [weak self] action in
@@ -211,7 +211,6 @@ final class SpaceSettingsFlowCoordinator: FlowCoordinatorProtocol {
private func presentSpaceSettings(animated: Bool) {
let coordinator = RoomDetailsScreenCoordinator(parameters: .init(roomProxy: roomProxy,
userSession: flowParameters.userSession,
appHooks: flowParameters.appHooks,
analyticsService: flowParameters.analytics,
userIndicatorController: flowParameters.userIndicatorController,
notificationSettings: flowParameters.userSession.clientProxy.notificationSettings,
@@ -276,8 +275,7 @@ final class SpaceSettingsFlowCoordinator: FlowCoordinatorProtocol {
private func presentSecurityAndPrivacyScreen() {
let coordinator = SecurityAndPrivacyScreenCoordinator(parameters: .init(roomProxy: roomProxy,
userSession: flowParameters.userSession,
userIndicatorController: flowParameters.userIndicatorController,
appHooks: flowParameters.appHooks))
userIndicatorController: flowParameters.userIndicatorController))
coordinator.actionsPublisher.sink { [weak self] action in
guard let self else { return }
@@ -214,8 +214,7 @@ class StartChatFlowCoordinator: FlowCoordinatorProtocol {
shouldShowCancelButton: isRoot,
userSession: flowParameters.userSession,
userIndicatorController: flowParameters.userIndicatorController,
analytics: flowParameters.analytics,
appHooks: flowParameters.appHooks)
analytics: flowParameters.analytics)
let coordinator = CreateRoomScreenCoordinator(parameters: createParameters)
coordinator.actions.sink { [weak self] action in
guard let self else { return }