Files
element-x-ios/ElementX/Sources/AppHooks/HealthChat/HealthChatExtendedProfileLoader.swift
T
joel.poyet dffeb4f9bb Show extended profile details on the profile screens (#10)
* Add HealthChat API and extended profile services

Expose OpenID tokens and homeserver credentials from the client proxy, and
add fork-only services for the HealthChat member directory backend
(api.healthchat.ch) plus a service that reads MSC4133 extended profile
fields directly from the homeserver. Groundwork for the members tab and
the profile screens.

Claude-Session: https://claude.ai/code/session_013qdTbAWsZj2quQzEkagXaS

* Show extended profile details on the profile screens

Add a UserProfileScreenHook that lets the fork inject an extra Form
section below the header of the user profile and room member details
screens. The HealthChat implementation loads the MSC4133 extended
profile fields and renders them with tappable phone/email/website
links, hiding the section entirely for profiles without any fields.

Strings live in a new fork-only HealthChat.strings table (de/en/fr,
generated as HealthChatL10n via SwiftGen) since Untranslated.strings
pins the English bundle.

Claude-Session: https://claude.ai/code/session_013qdTbAWsZj2quQzEkagXaS
2026-10-19 09:17:31 +02:00

33 lines
1.0 KiB
Swift

//
// Copyright 2026 Novaloop AG
//
// SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial.
// Please see LICENSE files in the repository root for full details.
//
import Foundation
import Observation
/// Loads a user's extended profile for display, hiding profiles without any HealthChat fields.
@Observable
final class HealthChatExtendedProfileLoader {
private(set) var profile: ExtendedProfile?
/// The load kicked off on creation — await this in tests before asserting.
@ObservationIgnored private(set) var loadingTask: Task<Void, Never>?
init(userID: String, service: ExtendedProfileServiceProtocol) {
loadingTask = Task {
guard case let .success(profile) = await service.profile(for: userID), profile.hasContent else {
return
}
self.profile = profile
}
}
/// Creates a loader with a fixed result, for previews.
init(profile: ExtendedProfile?) {
self.profile = profile
}
}