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
@@ -16,7 +16,6 @@ struct CreateRoomScreenCoordinatorParameters {
let userSession: UserSessionProtocol
let userIndicatorController: UserIndicatorControllerProtocol
let analytics: AnalyticsServiceProtocol
let appHooks: AppHooks
}
enum CreateRoomScreenCoordinatorAction {
@@ -40,8 +39,7 @@ final class CreateRoomScreenCoordinator: CoordinatorProtocol {
shouldShowCancelButton: parameters.shouldShowCancelButton,
userSession: parameters.userSession,
analytics: parameters.analytics,
userIndicatorController: parameters.userIndicatorController,
appHooks: parameters.appHooks)
userIndicatorController: parameters.userIndicatorController)
}
func start() {
@@ -32,8 +32,7 @@ class CreateRoomScreenViewModel: CreateRoomScreenViewModelType, CreateRoomScreen
shouldShowCancelButton: Bool,
userSession: UserSessionProtocol,
analytics: AnalyticsServiceProtocol,
userIndicatorController: UserIndicatorControllerProtocol,
appHooks: AppHooks) {
userIndicatorController: UserIndicatorControllerProtocol) {
self.userSession = userSession
mediaUploadingPreprocessor = MediaUploadingPreprocessor(userSettings: userSession.userSettings)
self.analytics = analytics
@@ -68,7 +67,7 @@ class CreateRoomScreenViewModel: CreateRoomScreenViewModelType, CreateRoomScreen
aliasLocalPart: roomAliasNameFromRoomDisplayName(roomName: ""),
bindings: bindings)
super.init(initialViewState: appHooks.createRoomScreenHook.update(viewState, homeserver: userSession.clientProxy.homeserver),
super.init(initialViewState: userSession.userHooks.createRoomScreenHook.update(viewState, homeserver: userSession.clientProxy.homeserver),
mediaProvider: userSession.mediaProvider)
setupBindings()
@@ -466,7 +466,6 @@ struct CreateRoom_Previews: PreviewProvider, TestablePreview {
shouldShowCancelButton: isSpace,
userSession: userSession,
analytics: AnalyticsServiceMock(.init()),
userIndicatorController: UserIndicatorControllerMock(),
appHooks: AppHooks())
userIndicatorController: UserIndicatorControllerMock())
}
}
@@ -70,8 +70,7 @@ struct CreateRoomSpaceSelectionSheet_Previews: PreviewProvider, TestablePreview
shouldShowCancelButton: false,
userSession: userSession,
analytics: AnalyticsServiceMock(.init()),
userIndicatorController: UserIndicatorControllerMock(),
appHooks: AppHooks())
userIndicatorController: UserIndicatorControllerMock())
}()
static var previews: some View {