mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-11-03 16:10:20 +00:00
refactor(healthchat): move the session hooks onto UserHooks
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user