mirror of
https://github.com/hanzoai/bot.git
synced 2026-10-30 17:24:26 +00:00
Comprehensive rename of all openclaw references to hanzo-bot equivalents: - Package: openclaw → @hanzo/bot - Binary: openclaw → hanzo-bot - Types: OpenClaw* → Bot* - Env vars: OPENCLAW_* → BOT_* - Android: ai.openclaw.android → ai.hanzo.bot.android - iOS/macOS: ai.openclaw.* → ai.hanzo.* - Swift modules: OpenClaw* → Bot* - Plugins: openclaw.plugin.json → bot.plugin.json - Paths: .openclaw/ → .hanzo/bot/ - URLs: github.com/openclaw → github.com/hanzoai
49 lines
1.7 KiB
Swift
49 lines
1.7 KiB
Swift
import SwiftUI
|
|
import Foundation
|
|
|
|
@main
|
|
struct BotApp: App {
|
|
@State private var appModel: NodeAppModel
|
|
@State private var gatewayController: GatewayConnectionController
|
|
@Environment(\.scenePhase) private var scenePhase
|
|
|
|
init() {
|
|
Self.installUncaughtExceptionLogger()
|
|
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)
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
extension BotApp {
|
|
private static func installUncaughtExceptionLogger() {
|
|
NSLog("Bot: installing uncaught exception handler")
|
|
NSSetUncaughtExceptionHandler { exception in
|
|
// Useful when the app hits NSExceptions from SwiftUI/WebKit internals; these do not
|
|
// produce a normal Swift error backtrace.
|
|
let reason = exception.reason ?? "(no reason)"
|
|
NSLog("UNCAUGHT EXCEPTION: %@ %@", exception.name.rawValue, reason)
|
|
for line in exception.callStackSymbols {
|
|
NSLog(" %@", line)
|
|
}
|
|
}
|
|
}
|
|
}
|