11import Client
22import ComposableArchitecture
33import Foundation
4+ import KeyboardShortcuts
45
56#if canImport(LicenseManagement)
67import LicenseManagement
78#endif
89
10+ extension KeyboardShortcuts . Name {
11+ static let showHideWidget = Self ( " ShowHideWidget " )
12+ }
13+
914struct HostApp : ReducerProtocol {
1015 struct State : Equatable {
1116 var general = General . State ( )
@@ -27,20 +32,21 @@ struct HostApp: ReducerProtocol {
2732 Scope ( state: \. general, action: / Action. general) {
2833 General ( )
2934 }
30-
35+
3136 Scope ( state: \. chatModelManagement, action: / Action. chatModelManagement) {
3237 ChatModelManagement ( )
3338 }
34-
39+
3540 Scope ( state: \. embeddingModelManagement, action: / Action. embeddingModelManagement) {
3641 EmbeddingModelManagement ( )
3742 }
3843
3944 Reduce { _, action in
4045 switch action {
4146 case . appear:
47+ KeyboardShortcuts . userDefaults = . shared
4248 return . none
43-
49+
4450 case . informExtensionServiceAboutLicenseKeyChange:
4551 #if canImport(LicenseManagement)
4652 return . run { _ in
@@ -55,13 +61,13 @@ struct HostApp: ReducerProtocol {
5561 #else
5662 return . none
5763 #endif
58-
64+
5965 case . general:
6066 return . none
61-
67+
6268 case . chatModelManagement:
6369 return . none
64-
70+
6571 case . embeddingModelManagement:
6672 return . none
6773 }
@@ -70,8 +76,8 @@ struct HostApp: ReducerProtocol {
7076}
7177
7278import Dependencies
73- import Preferences
7479import Keychain
80+ import Preferences
7581
7682struct UserDefaultsDependencyKey : DependencyKey {
7783 static var liveValue : UserDefaultsType = UserDefaults . shared
@@ -80,6 +86,7 @@ struct UserDefaultsDependencyKey: DependencyKey {
8086 it. removePersistentDomain ( forName: " HostAppPreview " )
8187 return it
8288 } ( )
89+
8390 static var testValue : UserDefaultsType = {
8491 let it = UserDefaults ( suiteName: " HostAppTest " ) !
8592 it. removePersistentDomain ( forName: " HostAppTest " )
@@ -106,3 +113,4 @@ extension DependencyValues {
106113 set { self [ APIKeyKeychainDependencyKey . self] = newValue }
107114 }
108115}
116+
0 commit comments