File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -133,6 +133,24 @@ public struct UserDefaultPreferenceKeys {
133133 public var forceOrderWidgetToFront : HideCommonPrecedingSpacesInSuggestion {
134134 . init( )
135135 }
136+
137+ public struct DisableSuggestionFeatureGlobally : UserDefaultPreferenceKey {
138+ public let defaultValue = false
139+ public let key = " DisableSuggestionFeatureGlobally "
140+ }
141+
142+ public var disableSuggestionFeatureGlobally : DisableSuggestionFeatureGlobally {
143+ . init( )
144+ }
145+
146+ public struct SuggestionFeatureEnabledProjectList : UserDefaultPreferenceKey {
147+ public let defaultValue : [ String ] = [ ]
148+ public let key = " SuggestionFeatureEnabledProjectList "
149+ }
150+
151+ public var suggestionFeatureEnabledProjectList : SuggestionFeatureEnabledProjectList {
152+ . init( )
153+ }
136154
137155 public var disableLazyVStack : FeatureFlags . DisableLazyVStack { . init( ) }
138156}
Original file line number Diff line number Diff line change @@ -22,6 +22,26 @@ extension String: UserDefaultsStorable {}
2222extension Data : UserDefaultsStorable { }
2323extension URL : UserDefaultsStorable { }
2424
25+ extension Array : RawRepresentable where Element: Codable {
26+ public init ? ( rawValue: String ) {
27+ guard let data = rawValue. data ( using: . utf8) ,
28+ let result = try ? JSONDecoder ( ) . decode ( [ Element ] . self, from: data)
29+ else {
30+ return nil
31+ }
32+ self = result
33+ }
34+
35+ public var rawValue : String {
36+ guard let data = try ? JSONEncoder ( ) . encode ( self ) ,
37+ let result = String ( data: data, encoding: . utf8)
38+ else {
39+ return " [] "
40+ }
41+ return result
42+ }
43+ }
44+
2545public extension UserDefaults {
2646 // MARK: - Normal Types
2747
You can’t perform that action at this time.
0 commit comments