refactor(healthchat): move the session hooks onto UserHooks

This commit is contained in:
Sedat Qaja
2026-10-19 09:18:07 +02:00
parent 1b34a71857
commit 979d20572d
22 changed files with 725 additions and 409 deletions
@@ -12,20 +12,14 @@ import SwiftUI
// service is main-actor state — the hook's requirements are all @MainActor anyway.
@MainActor
final class HealthChatExtendedProfileSectionHook: ExtendedProfileSectionHookProtocol {
private var extendedProfileService: ExtendedProfileServiceProtocol?
private let extendedProfileService: ExtendedProfileServiceProtocol
// Constructed during hook registration, before the main actor is reachable.
nonisolated init() { }
func configure(with userSession: UserSessionProtocol?) async {
extendedProfileService = userSession.map { ExtendedProfileService(clientProxy: $0.clientProxy) }
init(extendedProfileService: ExtendedProfileServiceProtocol) {
self.extendedProfileService = extendedProfileService
}
func extendedProfileSection(userID: String) -> AnyView? {
guard let extendedProfileService else {
return nil
}
return AnyView(HealthChatExtendedProfileSection(userID: userID, service: extendedProfileService))
AnyView(HealthChatExtendedProfileSection(userID: userID, service: extendedProfileService))
}
}
#endif