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>
84 lines
2.7 KiB
Swift
84 lines
2.7 KiB
Swift
import ManaAuthUI
|
|
import ManaCore
|
|
import ManaThemeUI
|
|
import ManaTokens
|
|
import OSLog
|
|
import SwiftUI
|
|
|
|
/// Logger-Namespace für Moodlit-Native.
|
|
enum Log {
|
|
static let app = Logger(subsystem: AppConfig.bundleIdentifier, category: "app")
|
|
static let api = Logger(subsystem: AppConfig.bundleIdentifier, category: "api")
|
|
}
|
|
|
|
@main
|
|
struct MoodlitNativeApp: App {
|
|
@State private var auth: AuthClient
|
|
@State private var authGate: ManaAuthGate
|
|
@State private var themePass: ThemePassStore
|
|
@State private var store: MoodStore
|
|
@State private var presence: PresenceClient
|
|
@State private var hue: HueController
|
|
@State private var lifx: LIFXController
|
|
@State private var beatSubscriber: BeatSubscriber
|
|
#if os(iOS)
|
|
@State private var homeKit: HomeKitController
|
|
#endif
|
|
@AppStorage(ManaAppearanceMode.storageKey) private var appearanceRaw = ManaAppearanceMode.moodlitDefault.rawValue
|
|
@AppStorage(ManaTheme.storageKey) private var variantRaw = ManaTheme.moodlitDefault.rawValue
|
|
|
|
private var appearance: ManaAppearanceMode { ManaAppearanceMode(rawValue: appearanceRaw) ?? .dark }
|
|
private var theme: ManaTheme { ManaTheme(rawValue: variantRaw) ?? .twilight }
|
|
|
|
init() {
|
|
let auth = AuthClient(config: AppConfig.manaCore)
|
|
auth.bootstrap()
|
|
_auth = State(initialValue: auth)
|
|
_authGate = State(initialValue: ManaAuthGate(auth: auth))
|
|
_themePass = State(initialValue: ThemePassStore(auth: auth, config: AppConfig.manaCore))
|
|
_store = State(initialValue: MoodStore(auth: auth))
|
|
_presence = State(initialValue: PresenceClient(
|
|
auth: auth,
|
|
baseURL: AppConfig.presenceBaseURL,
|
|
appGroup: AppConfig.appGroup
|
|
))
|
|
_hue = State(initialValue: HueController(appGroup: AppConfig.appGroup))
|
|
_lifx = State(initialValue: LIFXController(appGroup: AppConfig.appGroup))
|
|
_beatSubscriber = State(initialValue: BeatSubscriber(
|
|
auth: auth,
|
|
presenceBaseURL: AppConfig.presenceBaseURL
|
|
))
|
|
#if os(iOS)
|
|
_homeKit = State(initialValue: HomeKitController(appGroup: AppConfig.appGroup))
|
|
#endif
|
|
Log.app.info("Moodlit starting — auth status: \(String(describing: auth.status), privacy: .public)")
|
|
}
|
|
|
|
var body: some Scene {
|
|
WindowGroup {
|
|
RootView()
|
|
.environment(auth)
|
|
.environment(authGate)
|
|
.environment(themePass)
|
|
.task { await themePass.bootstrap() }
|
|
.environment(store)
|
|
.environment(presence)
|
|
.environment(hue)
|
|
.environment(lifx)
|
|
.environment(beatSubscriber)
|
|
#if os(iOS)
|
|
.environment(homeKit)
|
|
#endif
|
|
.tint(MoodlitTheme.primary)
|
|
.preferredColorScheme(appearance.colorScheme)
|
|
.manaTheme(theme)
|
|
#if os(macOS)
|
|
.frame(minWidth: 720, minHeight: 540)
|
|
#endif
|
|
}
|
|
#if os(macOS)
|
|
.defaultSize(width: 1024, height: 768)
|
|
.windowResizability(.contentMinSize)
|
|
#endif
|
|
}
|
|
}
|