mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-10-31 08:15:24 +00:00
3d1fa27a4b
Applies the HealthChat product identity through the fork seams upstream already provides, so no upstream logic files are touched and merges stay clean. - Variants/HealthChat/healthchat.yml holds the identity scalars (display name, bundle id ch.healthchat.element, app group, development team) and is included permanently from project.yml. APP_NAME stays ElementX so the module name and @testable import ElementX keep working. - ElementX/Sources/AppHooks/HealthChat/ registers an AppSettings hook pinning accountProviders to healthchat.ch with other providers disabled, push through sygnal.healthchat.ch and a custom-scheme OIDC redirect; plus a Compound hook recolouring the accent token family to the HealthChat blue. - Entitlements are edited directly in ElementX/SupportingFiles/target.yml rather than in the variant, because XcodeGen concatenates arrays on include-merge and a variant can override scalars but cannot remove array entries. Drops the Element Classic app group and keychain group, and narrows associated domains to app.healthchat.ch, keeping matrix.to for permalinks. - Info.plist CFBundleName now follows APP_DISPLAY_NAME — it, not CFBundleDisplayName, is what the web authentication sign-in alert shows. - App logo and app icon assets swapped in place; the onboarding welcome title moves to a new screen_onboarding_welcome_title_ios untranslated string.
85 lines
3.2 KiB
Swift
85 lines
3.2 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 Compound
|
|
import SwiftUI
|
|
import UIKit
|
|
|
|
/// Recolours Compound's accent token family to the HealthChat brand.
|
|
/// Applied once at startup from `AppCoordinator` via `AppHooks.compoundHook`. Because the override
|
|
/// runs at app startup (not in previews), preview snapshots keep the default Compound colours.
|
|
struct HealthChatCompoundHook: CompoundHookProtocol {
|
|
func override(colors: CompoundColors, uiColors: CompoundUIColors) {
|
|
let brand = HealthChatBrandColors.brand
|
|
let tint = HealthChatBrandColors.tint
|
|
|
|
// Solid accent → brand blue (primary + send buttons, links, accent icons, badges, borders).
|
|
// NB: bgAccentRest is a SOLID fill (behind a white icon on the send button), not a subtle tint.
|
|
let solidColorTokens: [KeyPath<CompoundColorTokens, Color>] = [
|
|
\.bgActionPrimaryRest,
|
|
\.bgAccentRest,
|
|
\.iconAccentPrimary,
|
|
\.iconAccentTertiary,
|
|
\.textActionPrimary,
|
|
\.textActionAccent,
|
|
\.textLinkExternal,
|
|
\.borderInteractivePrimary,
|
|
\.textBadgeAccent
|
|
]
|
|
let solidUIColorTokens: [KeyPath<CompoundUIColorTokens, UIColor>] = [
|
|
\.bgActionPrimaryRest,
|
|
\.bgAccentRest,
|
|
\.iconAccentPrimary,
|
|
\.iconAccentTertiary,
|
|
\.textActionPrimary,
|
|
\.textActionAccent,
|
|
\.textLinkExternal,
|
|
\.borderInteractivePrimary,
|
|
\.textBadgeAccent
|
|
]
|
|
for keyPath in solidColorTokens {
|
|
colors.override(keyPath, with: Color(brand))
|
|
}
|
|
for keyPath in solidUIColorTokens {
|
|
uiColors.override(keyPath, with: brand)
|
|
}
|
|
|
|
// Primary button pressed state. The disabled state stays Compound's neutral grey.
|
|
colors.override(\.bgActionPrimaryPressed, with: Color(HealthChatBrandColors.brandPressed))
|
|
uiColors.override(\.bgActionPrimaryPressed, with: HealthChatBrandColors.brandPressed)
|
|
|
|
// Gradient "super"/action buttons → brand blue (SwiftUI-only concept).
|
|
let gradientTokens: [KeyPath<CompoundColorTokens, Color>] = [
|
|
\.gradientActionStop1,
|
|
\.gradientActionStop2,
|
|
\.gradientActionStop3,
|
|
\.gradientActionStop4
|
|
]
|
|
for keyPath in gradientTokens {
|
|
colors.override(keyPath, with: Color(brand))
|
|
}
|
|
|
|
// Subtle accent backgrounds (paired with accent-coloured foregrounds) → brand tint.
|
|
let tintColorTokens: [KeyPath<CompoundColorTokens, Color>] = [
|
|
\.bgAccentSelected,
|
|
\.bgBadgeAccent,
|
|
\.borderAccentSubtle
|
|
]
|
|
let tintUIColorTokens: [KeyPath<CompoundUIColorTokens, UIColor>] = [
|
|
\.bgAccentSelected,
|
|
\.bgBadgeAccent,
|
|
\.borderAccentSubtle
|
|
]
|
|
for keyPath in tintColorTokens {
|
|
colors.override(keyPath, with: Color(tint))
|
|
}
|
|
for keyPath in tintUIColorTokens {
|
|
uiColors.override(keyPath, with: tint)
|
|
}
|
|
}
|
|
}
|