blob: e65833cb4758f6f6d3c9691bfd419db9d3dc5f93 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
|
import SwiftUI
@main
struct HutchApp: App {
@State private var appState = AppState()
@State private var networkMonitor = NetworkMonitor()
var body: some Scene {
WindowGroup {
RootView()
.environment(appState)
.environment(networkMonitor)
.onOpenURL { url in
if let link = DeepLink(url: url) {
appState.pendingDeepLink = link
}
}
.onChange(of: HutchIntentNavigator.shared.pendingDestination) { _, destination in
guard let destination else { return }
HutchIntentNavigator.shared.pendingDestination = nil
let link: DeepLink
switch destination {
case .home: link = .home
case .inbox: link = .home
case .builds: link = .buildsTab
case .repositories: link = .repositoriesTab
case .trackers: link = .trackersTab
case .systemStatus: link = .systemStatus
case .lookup: link = .lookup
}
appState.pendingDeepLink = link
}
}
}
}
|