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