Skip to content

Commit f0634b9

Browse files
committed
Adjust interface of Service
1 parent 44ecf40 commit f0634b9

File tree

3 files changed

+23
-2
lines changed

3 files changed

+23
-2
lines changed

Core/Sources/Service/GUI/GraphicalUserInterfaceController.swift

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -266,7 +266,9 @@ public final class GraphicalUserInterfaceController {
266266
await commandHandler.handleCustomCommand(command)
267267
}
268268
}
269-
269+
}
270+
271+
func start() {
270272
store.send(.start)
271273
}
272274

Core/Sources/Service/Service.swift

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import Foundation
2+
import KeyBindingManager
23
import Workspace
34

45
@globalActor public enum ServiceActor {
@@ -18,15 +19,32 @@ public final class Service {
1819
}
1920
return it
2021
}()
22+
2123
@MainActor
2224
public let guiController = GraphicalUserInterfaceController()
23-
@WorkspaceActor
2425
public let realtimeSuggestionController = RealtimeSuggestionController()
2526
public let scheduledCleaner: ScheduledCleaner
27+
let keyBindingManager: KeyBindingManager
2628

2729
private init() {
2830
scheduledCleaner = .init(workspacePool: workspacePool, guiController: guiController)
31+
keyBindingManager = .init(
32+
workspacePool: workspacePool,
33+
acceptSuggestion: {
34+
Task {
35+
await PseudoCommandHandler().acceptSuggestion()
36+
}
37+
}
38+
)
2939
DependencyUpdater().update()
3040
}
41+
42+
@MainActor
43+
public func start() {
44+
scheduledCleaner.start()
45+
realtimeSuggestionController.start()
46+
guiController.start()
47+
keyBindingManager.start()
48+
}
3149
}
3250

ExtensionService/AppDelegate.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ class AppDelegate: NSObject, NSApplicationDelegate, NSWindowDelegate {
3030
func applicationDidFinishLaunching(_: Notification) {
3131
if ProcessInfo.processInfo.environment["IS_UNIT_TEST"] == "YES" { return }
3232
_ = XcodeInspector.shared
33+
service.start()
3334
AXIsProcessTrustedWithOptions([
3435
kAXTrustedCheckOptionPrompt.takeRetainedValue() as NSString: true,
3536
] as CFDictionary)

0 commit comments

Comments
 (0)