Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion Orchard/OrchardApp.swift
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,16 @@ import SwiftUI

@main
struct OrchardApp: App {
@StateObject private var services = AppServices.forLaunch()
@NSApplicationDelegateAdaptor(OrchardAppDelegate.self) private var appDelegate
@StateObject private var services: AppServices
@StateObject private var menuBarManager = MenuBarManager()
@StateObject private var updater = UpdaterService()

init() {
let services = AppServices.forLaunch()
_services = StateObject(wrappedValue: services)
}
Comment thread
coderabbitai[bot] marked this conversation as resolved.

var body: some Scene {
WindowGroup(id: "main") {
ContentView()
Expand Down Expand Up @@ -70,6 +76,7 @@ extension View {
.environmentObject(s.dnsService)
.environmentObject(s.systemService)
.environmentObject(s.containerListService)
.environmentObject(s.startupSequenceService)
.environmentObject(s.machineService)
.environmentObject(s.modelService)
.environmentObject(s.modelServerService)
Expand Down
4 changes: 4 additions & 0 deletions Orchard/OrchardAppDelegate.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import AppKit

@MainActor
final class OrchardAppDelegate: NSObject, NSApplicationDelegate {}
8 changes: 7 additions & 1 deletion Orchard/Services/AppServices.swift
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ final class AppServices: ObservableObject {
let dnsService: DNSService
let systemService: SystemService
let containerListService: ContainerListService
let startupSequenceService: StartupSequenceService
let machineService: MachineService
let modelService: ModelService
let modelServerService: ModelServerService
Expand Down Expand Up @@ -65,7 +66,12 @@ final class AppServices: ObservableObject {
// ContainerListService is built before StatsService, which depends on it.
let containerListService = ContainerListService(backend: backend, alertCenter: alertCenter)
self.containerListService = containerListService
let statsService = StatsService(backend: backend, alertCenter: alertCenter, containerList: containerListService)
let startupRuntime = StartupSequenceRuntimeAdapter(
backend: backend,
systemService: systemService,
containerListService: containerListService)
self.startupSequenceService = StartupSequenceService(runtime: startupRuntime, defaults: defaults)
let statsService = StatsService(backend: backend, alertCenter: alertCenter, containerList: containerListService)
self.statsService = statsService
self.machineService = MachineService(backend: machineBackend, alertCenter: alertCenter)
self.modelService = ModelService(backend: modelBackend)
Expand Down
Loading