appSlug "moodlit" existierte schon, wurde aber von manaCore nicht in die DefaultManaAppConfig durchgereicht → ergänzt. + generischer ThemePassStore + Galerie unlocked/onLockedTap. Default twilight (eigene Signatur) bleibt. Build grün. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
86 lines
3.3 KiB
Swift
86 lines
3.3 KiB
Swift
import Foundation
|
|
import ManaCore
|
|
|
|
/// Zentrale URL- und Identity-Konfiguration für moodlit-native.
|
|
///
|
|
/// Production-Werte gehen 1:1 in den Build; lokale Dev-Overrides
|
|
/// laufen über `MOODLIT_API_URL`/`MANA_AUTH_URL` Launch-Args. Bundle-
|
|
/// Identifier + Team kommen aus `project.yml`.
|
|
public enum AppConfig {
|
|
/// Backend des Moodlit-Stacks (Hono+Bun, JWKS-Auth).
|
|
public static let apiBaseURL: URL = {
|
|
if let override = ProcessInfo.processInfo.environment["MOODLIT_API_URL"],
|
|
let url = URL(string: override) {
|
|
return url
|
|
}
|
|
return URL(string: "https://moodlit-api.mana.how")!
|
|
}()
|
|
|
|
/// mana-auth — Login, JWKS, GDPR.
|
|
public static let authBaseURL: URL = {
|
|
if let override = ProcessInfo.processInfo.environment["MANA_AUTH_URL"],
|
|
let url = URL(string: override) {
|
|
return url
|
|
}
|
|
return URL(string: "https://auth.mana.how")!
|
|
}()
|
|
|
|
/// mana-presence — Live-State + SSE-Fanout für Cross-Device-Sync.
|
|
/// Multi-Tenant pro `appId` ("moodlit" hier).
|
|
public static let presenceBaseURL: URL = {
|
|
if let override = ProcessInfo.processInfo.environment["MANA_PRESENCE_URL"],
|
|
let url = URL(string: override) {
|
|
return url
|
|
}
|
|
return URL(string: "https://presence.mana.how")!
|
|
}()
|
|
|
|
public static let bundleIdentifier = "ev.mana.moodlit"
|
|
public static let widgetBundleIdentifier = "ev.mana.moodlit.widget"
|
|
|
|
/// Geteilter App-Group-Container — Hauptapp ↔ Widget. Pendant zu
|
|
/// `keychainAccessGroup`. Muss in entitlements + Apple-Dev-Portal
|
|
/// aktiv sein, sonst gibt der Container `nil` zurück.
|
|
public static let appGroup = "group.ev.mana.moodlit"
|
|
|
|
/// Cross-App-Keychain-Group für mana-e.V.-SSO. Alle nativen mana-
|
|
/// Apps (memoro, wordeck, nutriphi, herbatrium, zitare, seepuls,
|
|
/// viadocu, manameme, werdrobe, pageta, comicello, moodlit) teilen
|
|
/// hierüber den Auth-Token — ein Login in einer App, alle anderen
|
|
/// starten direkt im `.signedIn`-Status.
|
|
///
|
|
/// Voraussetzung: Apple-Dev-Portal "Keychain Sharing" Capability
|
|
/// für jede App-ID aktiv, Group `ev.mana.session` hinzugefügt
|
|
/// (sonst OSStatus -34018 errSecMissingEntitlement).
|
|
///
|
|
/// SOT-Konstante: `ManaCore.ManaSharedKeychainGroup`.
|
|
public static let keychainAccessGroup: String? = ManaSharedKeychainGroup
|
|
|
|
public static let appSlug = "moodlit"
|
|
public static let displayName = "Moodlit"
|
|
|
|
/// User-Agent für ausgehende HTTP-Calls. Erlaubt mana-api-Stack,
|
|
/// native Clients in Logs zu unterscheiden.
|
|
public static var userAgent: String {
|
|
let v = Bundle.main.infoDictionary?["CFBundleShortVersionString"] as? String ?? "dev"
|
|
let build = Bundle.main.infoDictionary?["CFBundleVersion"] as? String ?? "0"
|
|
return "Moodlit-Native/\(v).\(build) (+https://moodlit.mana.how)"
|
|
}
|
|
|
|
/// ManaCore-Konfiguration für `AuthClient`-Initialisierung.
|
|
///
|
|
/// `keychainService` ist absichtlich der SHARED-Group-Name (nicht
|
|
/// die Bundle-ID), damit Cross-App-Keychain-Lookups auf demselben
|
|
/// `(service, account)`-Tupel landen. Sonst schreibt jede App in
|
|
/// einen eigenen Bucket und das Sharing wäre wirkungslos.
|
|
public static var manaCore: DefaultManaAppConfig {
|
|
DefaultManaAppConfig(
|
|
authBaseURL: authBaseURL,
|
|
keychainService: ManaSharedKeychainGroup,
|
|
keychainAccessGroup: keychainAccessGroup,
|
|
appGroup: appGroup,
|
|
logSubsystem: bundleIdentifier,
|
|
appSlug: appSlug
|
|
)
|
|
}
|
|
}
|