Spaces:
Paused
Paused
| import SwiftUI | |
| @main | |
| struct OpenClawApp: App { | |
| private var appModel: NodeAppModel | |
| private var gatewayController: GatewayConnectionController | |
| (\.scenePhase) private var scenePhase | |
| init() { | |
| GatewaySettingsStore.bootstrapPersistence() | |
| let appModel = NodeAppModel() | |
| _appModel = State(initialValue: appModel) | |
| _gatewayController = State(initialValue: GatewayConnectionController(appModel: appModel)) | |
| } | |
| var body: some Scene { | |
| WindowGroup { | |
| RootCanvas() | |
| .environment(self.appModel) | |
| .environment(self.appModel.voiceWake) | |
| .environment(self.gatewayController) | |
| .onOpenURL { url in | |
| Task { await self.appModel.handleDeepLink(url: url) } | |
| } | |
| .onChange(of: self.scenePhase) { _, newValue in | |
| self.appModel.setScenePhase(newValue) | |
| self.gatewayController.setScenePhase(newValue) | |
| } | |
| } | |
| } | |
| } | |