From d512ed276d251077406d551b39ff13e295373ac9 Mon Sep 17 00:00:00 2001 From: Chris Tate Date: Sun, 26 May 2024 23:06:31 -0500 Subject: [PATCH] fixes integration settings --- .../apple/Crystal.xcodeproj/project.pbxproj | 4 ---- .../apple/Crystal/Sheets/SettingsView.swift | 16 ++++++---------- platforms/apple/Crystal/UserDefaults.swift | 9 --------- 3 files changed, 6 insertions(+), 23 deletions(-) delete mode 100644 platforms/apple/Crystal/UserDefaults.swift diff --git a/platforms/apple/Crystal.xcodeproj/project.pbxproj b/platforms/apple/Crystal.xcodeproj/project.pbxproj index 991dc5c..73b672e 100644 --- a/platforms/apple/Crystal.xcodeproj/project.pbxproj +++ b/platforms/apple/Crystal.xcodeproj/project.pbxproj @@ -16,7 +16,6 @@ D73C375C2C024DAC00BD37E3 /* MakeRecipeTool.swift in Sources */ = {isa = PBXBuildFile; fileRef = D73C375B2C024DAC00BD37E3 /* MakeRecipeTool.swift */; }; D73C376C2C04134D00BD37E3 /* UserSettings.swift in Sources */ = {isa = PBXBuildFile; fileRef = D73C376B2C04134D00BD37E3 /* UserSettings.swift */; }; D76D3B102BF5D8CA0017F2BA /* ConversationManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = D76D3B0F2BF5D8CA0017F2BA /* ConversationManager.swift */; }; - D7B415792BFD8EF800D2C131 /* UserDefaults.swift in Sources */ = {isa = PBXBuildFile; fileRef = D7B415782BFD8EF800D2C131 /* UserDefaults.swift */; }; D7C9D2A82BF2FCC500697DDE /* CrystalApp.swift in Sources */ = {isa = PBXBuildFile; fileRef = D7C9D2A72BF2FCC500697DDE /* CrystalApp.swift */; }; D7C9D2AA2BF2FCC500697DDE /* ContentView.swift in Sources */ = {isa = PBXBuildFile; fileRef = D7C9D2A92BF2FCC500697DDE /* ContentView.swift */; }; D7C9D2AC2BF2FCC500697DDE /* Item.swift in Sources */ = {isa = PBXBuildFile; fileRef = D7C9D2AB2BF2FCC500697DDE /* Item.swift */; }; @@ -104,7 +103,6 @@ D73C37682C03DF9F00BD37E3 /* CrystalUITests.xcconfig.sample */ = {isa = PBXFileReference; lastKnownFileType = text; path = CrystalUITests.xcconfig.sample; sourceTree = ""; }; D73C376B2C04134D00BD37E3 /* UserSettings.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UserSettings.swift; sourceTree = ""; }; D76D3B0F2BF5D8CA0017F2BA /* ConversationManager.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ConversationManager.swift; sourceTree = ""; }; - D7B415782BFD8EF800D2C131 /* UserDefaults.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UserDefaults.swift; sourceTree = ""; }; D7C9D2A42BF2FCC500697DDE /* Crystal.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Crystal.app; sourceTree = BUILT_PRODUCTS_DIR; }; D7C9D2A72BF2FCC500697DDE /* CrystalApp.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CrystalApp.swift; sourceTree = ""; }; D7C9D2A92BF2FCC500697DDE /* ContentView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ContentView.swift; sourceTree = ""; }; @@ -249,7 +247,6 @@ D73C376B2C04134D00BD37E3 /* UserSettings.swift */, D7C9D2A92BF2FCC500697DDE /* ContentView.swift */, D7C9D3362BF3A48100697DDE /* Notification.swift */, - D7B415782BFD8EF800D2C131 /* UserDefaults.swift */, D76D3B0F2BF5D8CA0017F2BA /* ConversationManager.swift */, D7C9D3402BF3F20C00697DDE /* AdaptiveHeightView.swift */, D7C9D3262BF31A6A00697DDE /* Globals.swift */, @@ -503,7 +500,6 @@ D7C9D3202BF3172200697DDE /* PromptModelsView.swift in Sources */, D7C9D2E92BF3165300697DDE /* OpenAiApi.swift in Sources */, D7C9D2E62BF3165300697DDE /* GroqApi.swift in Sources */, - D7B415792BFD8EF800D2C131 /* UserDefaults.swift in Sources */, D7C9D31E2BF3172200697DDE /* DocumentPicker.swift in Sources */, D7C9D3212BF3172200697DDE /* SettingsView.swift in Sources */, D73C375A2C024D7500BD37E3 /* GenerateImageTool.swift in Sources */, diff --git a/platforms/apple/Crystal/Sheets/SettingsView.swift b/platforms/apple/Crystal/Sheets/SettingsView.swift index b3f4fb0..b3c837e 100644 --- a/platforms/apple/Crystal/Sheets/SettingsView.swift +++ b/platforms/apple/Crystal/Sheets/SettingsView.swift @@ -18,10 +18,10 @@ struct Integration: Identifiable { } } - init(id: String, name: String, isEnabled: Bool = false, hasApiKey: Bool = false) { + init(id: String, name: String, hasApiKey: Bool = false) { self.id = id self.name = name - self.isEnabled = UserSettings.Providers.isEnabled(id) + self.isEnabled = UserSettings.Integrations.isEnabled(id) self.hasApiKey = hasApiKey self.apiKey = loadApiKey(key: "\(bundleIdentifier).\(name)ApiKey") } @@ -61,7 +61,7 @@ struct ProviderWithSettings: Identifiable { } } - init(id: String, name: String, isEnabled: Bool = false, isService: Bool = false) { + init(id: String, name: String, isService: Bool = false) { self.id = id self.name = name self.isEnabled = UserSettings.Providers.isEnabled(id) @@ -243,9 +243,9 @@ struct GeneralSettingsView: View { struct ModelsSettingsView: View { @State private var defaults = [ - ProviderWithSettings(id: "Prompt", name: "Prompt", isEnabled: false), - ProviderWithSettings(id: "Vision", name: "Vision", isEnabled: false), - ProviderWithSettings(id: "Voice", name: "Voice", isEnabled: false) + ProviderWithSettings(id: "Prompt", name: "Prompt"), + ProviderWithSettings(id: "Vision", name: "Vision"), + ProviderWithSettings(id: "Voice", name: "Voice") ] @State private var providers = [ @@ -316,25 +316,21 @@ struct IntegrationsSettingsView: View { Integration( id: "Google", name: "Google", - isEnabled: false, hasApiKey: true ), Integration( id: "HackerNews", name: "Hacker News", - isEnabled: false, hasApiKey: false ), Integration( id: "WeatherGov", name: "Weather.gov", - isEnabled: false, hasApiKey: false ), Integration( id: "Wikipedia", name: "Wikipedia", - isEnabled: false, hasApiKey: false ) ] diff --git a/platforms/apple/Crystal/UserDefaults.swift b/platforms/apple/Crystal/UserDefaults.swift deleted file mode 100644 index 395635a..0000000 --- a/platforms/apple/Crystal/UserDefaults.swift +++ /dev/null @@ -1,9 +0,0 @@ -import Foundation - -extension UserDefaults { - struct Keys { - static let font = "font" - static let isMuted = "isMuted" - static let ollamaHost = "ollamaHost" - } -}