Skip to content

Commit 908dd8d

Browse files
committed
Add toggle for check for update
1 parent 38a0bdb commit 908dd8d

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

Copilot for Xcode/SettingsView.swift

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ final class Settings: ObservableObject {
1111
var realtimeSuggestionDebounce: Double = 0.7
1212
@AppStorage(SettingsKey.suggestionPresentationMode, store: .shared)
1313
var suggestionPresentationModeRawValue: Int = 0
14+
@AppStorage(SettingsKey.automaticallyCheckForUpdate, store: .shared)
15+
var automaticallyCheckForUpdate: Bool = false
1416
init() {}
1517
}
1618

@@ -26,6 +28,11 @@ struct SettingsView: View {
2628
Text("Quit service when Xcode and host app are terminated")
2729
}
2830
.toggleStyle(.switch)
31+
32+
Toggle(isOn: $settings.automaticallyCheckForUpdate) {
33+
Text("Automatically Check for Update")
34+
}
35+
.toggleStyle(.switch)
2936

3037
Picker(selection: $settings.suggestionPresentationModeRawValue) {
3138
ForEach(PresentationMode.allCases, id: \.rawValue) {

ExtensionService/AppDelegate.swift

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -186,6 +186,8 @@ class AppDelegate: NSObject, NSApplicationDelegate, NSWindowDelegate {
186186
}
187187

188188
func checkForUpdate() {
189+
guard UserDefaults.shared.bool(forKey: SettingsKey.automaticallyCheckForUpdate)
190+
else { return }
189191
Task {
190192
await UpdateChecker().checkForUpdate()
191193
}

0 commit comments

Comments
 (0)