mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-10-31 08:15:24 +00:00
dffeb4f9bb
* 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
54 lines
1.8 KiB
Swift
54 lines
1.8 KiB
Swift
//
|
|
// Copyright 2026 Element Creations Ltd.
|
|
//
|
|
// SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial.
|
|
// Please see LICENSE files in the repository root for full details.
|
|
//
|
|
|
|
@testable import ElementX
|
|
import Foundation
|
|
import Testing
|
|
|
|
final class HealthChatExtendedProfileLoaderTests {
|
|
private let service = ExtendedProfileServiceMock()
|
|
|
|
@Test
|
|
func showsProfileWithContent() async throws {
|
|
service.profileForReturnValue = try .success(makeProfile("""
|
|
{ "displayname": "Alice", "io.element.profile.business_tel": "+41 44 123 45 67" }
|
|
"""))
|
|
|
|
let loader = HealthChatExtendedProfileLoader(userID: "@alice:healthchat.ch", service: service)
|
|
await loader.loadingTask?.value
|
|
|
|
#expect(loader.profile?.businessTel == "+41 44 123 45 67")
|
|
#expect(service.profileForReceivedUserID == "@alice:healthchat.ch")
|
|
}
|
|
|
|
@Test
|
|
func hidesProfileWithoutHealthChatFields() async throws {
|
|
service.profileForReturnValue = try .success(makeProfile("""
|
|
{ "displayname": "Alice" }
|
|
"""))
|
|
|
|
let loader = HealthChatExtendedProfileLoader(userID: "@alice:healthchat.ch", service: service)
|
|
await loader.loadingTask?.value
|
|
|
|
#expect(loader.profile == nil)
|
|
}
|
|
|
|
@Test
|
|
func hidesProfileOnFailure() async {
|
|
service.profileForReturnValue = .failure(.networkFailure)
|
|
|
|
let loader = HealthChatExtendedProfileLoader(userID: "@alice:healthchat.ch", service: service)
|
|
await loader.loadingTask?.value
|
|
|
|
#expect(loader.profile == nil)
|
|
}
|
|
|
|
private func makeProfile(_ json: String) throws -> ExtendedProfile {
|
|
try JSONDecoder().decode(ExtendedProfile.self, from: Data(json.utf8))
|
|
}
|
|
}
|