Files
aris-old/IrisCompanion/iris/irisApp.swift

45 lines
1.3 KiB
Swift
Raw Permalink Normal View History

2026-01-08 19:16:32 +00:00
//
// irisApp.swift
// iris
//
// Created by Kenneth on 06/01/2026.
//
import SwiftUI
@main
struct irisApp: App {
@Environment(\.scenePhase) private var scenePhase
2026-01-08 19:16:32 +00:00
@StateObject private var ble: BlePeripheralManager
@StateObject private var orchestrator: ContextOrchestrator
@StateObject private var spotifyAuth: SpotifyAuthManager
2026-01-08 19:16:32 +00:00
init() {
let bleManager = BlePeripheralManager()
bleManager.start()
let spotify = SpotifyAuthManager()
2026-01-08 19:16:32 +00:00
_ble = StateObject(wrappedValue: bleManager)
_spotifyAuth = StateObject(wrappedValue: spotify)
_orchestrator = StateObject(wrappedValue: ContextOrchestrator(ble: bleManager, spotifyAuth: spotify))
2026-01-08 19:16:32 +00:00
}
var body: some Scene {
WindowGroup {
ContentView()
.environmentObject(ble)
.environmentObject(orchestrator)
.environmentObject(spotifyAuth)
.onOpenURL { url in
if url.scheme == "iris-spotify-auth" {
spotifyAuth.handleCallback(url: url)
}
}
.onChange(of: scenePhase) { phase in
if phase == .active || phase == .background {
ble.start()
}
}
2026-01-08 19:16:32 +00:00
}
}
}