Skip to content

Commit

Permalink
fixes integration settings
Browse files Browse the repository at this point in the history
  • Loading branch information
ctate committed May 27, 2024
1 parent 330dbea commit d512ed2
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 23 deletions.
4 changes: 0 additions & 4 deletions platforms/apple/Crystal.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -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 */; };
Expand Down Expand Up @@ -104,7 +103,6 @@
D73C37682C03DF9F00BD37E3 /* CrystalUITests.xcconfig.sample */ = {isa = PBXFileReference; lastKnownFileType = text; path = CrystalUITests.xcconfig.sample; sourceTree = "<group>"; };
D73C376B2C04134D00BD37E3 /* UserSettings.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UserSettings.swift; sourceTree = "<group>"; };
D76D3B0F2BF5D8CA0017F2BA /* ConversationManager.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ConversationManager.swift; sourceTree = "<group>"; };
D7B415782BFD8EF800D2C131 /* UserDefaults.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UserDefaults.swift; sourceTree = "<group>"; };
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 = "<group>"; };
D7C9D2A92BF2FCC500697DDE /* ContentView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ContentView.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -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 */,
Expand Down Expand Up @@ -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 */,
Expand Down
16 changes: 6 additions & 10 deletions platforms/apple/Crystal/Sheets/SettingsView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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")
}
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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 = [
Expand Down Expand Up @@ -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
)
]
Expand Down
9 changes: 0 additions & 9 deletions platforms/apple/Crystal/UserDefaults.swift

This file was deleted.

0 comments on commit d512ed2

Please sign in to comment.