// // 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 /// Pins HealthChat's server, OIDC and push configuration by overriding `AppSettings` at startup. /// /// - `accountProviders` / `allowOtherAccountProviders` lock every user to `healthchat.ch` (the server name; /// `.well-known` delegates to `matrix.healthchat.ch`) and hide the change-server / create-account UI. /// - `oAuthRedirectURL` uses the app's own URL scheme so the OIDC/MAS callback needs no associated domain. /// - Legal links point at healthchat.ch. The encryption/verification/backup help links still go to /// Element's help pages because no HealthChat equivalents exist yet. struct HealthChatAppSettingsHook: AppSettingsHookProtocol { func configure(_ appSettings: AppSettings) -> AppSettings { appSettings.override(accountProviders: [.generic("healthchat.ch")], allowOtherAccountProviders: false, hideBrandChrome: false, pushGatewayBaseURL: "https://sygnal.healthchat.ch", oAuthRedirectURL: "ch.healthchat.element:/oauth/callback", // nil keeps the registered client_uri at the bare website URL, as shipped before upstream's `apps/ios` default. oAuthClientURIPath: nil, websiteURL: "https://healthchat.ch", logoURL: "https://app.healthchat.ch/themes/element/img/logos/element-logo.png", copyrightURL: "https://www.healthchat.ch/impressum", acceptableUseURL: "https://www.healthchat.ch/datenschutz", privacyURL: "https://www.healthchat.ch/datenschutz", encryptionURL: nil, deviceVerificationURL: nil, chatBackupDetailsURL: nil, identityPinningViolationDetailsURL: nil, historySharingDetailsURL: nil, elementWebHosts: ["app.healthchat.ch"], accountProvisioningHost: appSettings.accountProvisioningHost, bugReportApplicationID: "healthchat-ios", analyticsTermsURL: "https://www.healthchat.ch/datenschutz", mapTilerConfiguration: Self.mapTilerConfiguration) return appSettings } /// No MapTiler account yet: a nil key hides location sharing and shows received locations as a placeholder. private static let mapTilerConfiguration = MapTilerConfiguration(baseURL: AppSettings.bundledMapTilerConfiguration.baseURL, apiKey: nil, lightStyleID: AppSettings.bundledMapTilerConfiguration.lightStyleID, darkStyleID: AppSettings.bundledMapTilerConfiguration.darkStyleID) }