Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 9 additions & 4 deletions BetterCapture/Service/UpdaterService.swift
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,15 @@ final class UpdaterService {
/// Whether Sparkle should automatically check for updates.
/// This directly reads/writes Sparkle's own user-defaults-backed property.
var automaticallyChecksForUpdates: Bool {
get { updater.automaticallyChecksForUpdates }
set { updater.automaticallyChecksForUpdates = newValue }
get {
access(keyPath: \.automaticallyChecksForUpdates)
return updater.automaticallyChecksForUpdates
}
set {
withMutation(keyPath: \.automaticallyChecksForUpdates) {
updater.automaticallyChecksForUpdates = newValue
}
}
}

// MARK: - Initialization
Expand All @@ -52,8 +59,6 @@ final class UpdaterService {
userDriverDelegate: nil
)

guard hasValidKey else { return }

// Observe Sparkle's canCheckForUpdates via KVO
canCheckObservation = updater.observe(
\.canCheckForUpdates,
Expand Down
15 changes: 2 additions & 13 deletions BetterCapture/View/SettingsView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -212,15 +212,7 @@ struct AudioSettingsView: View {

struct GeneralSettingsView: View {
@Bindable var settings: SettingsStore
var updaterService: UpdaterService

@State private var automaticallyChecksForUpdates: Bool

init(settings: SettingsStore, updaterService: UpdaterService) {
self.settings = settings
self.updaterService = updaterService
self._automaticallyChecksForUpdates = State(initialValue: updaterService.automaticallyChecksForUpdates)
}
@Bindable var updaterService: UpdaterService

/// Formats the output directory path for display
private var displayPath: String {
Expand Down Expand Up @@ -260,10 +252,7 @@ struct GeneralSettingsView: View {
}

Section("Software Updates") {
Toggle("Automatically check for updates", isOn: $automaticallyChecksForUpdates)
.onChange(of: automaticallyChecksForUpdates) { _, newValue in
updaterService.automaticallyChecksForUpdates = newValue
}
Toggle("Automatically check for updates", isOn: $updaterService.automaticallyChecksForUpdates)

LabeledContent("Updates") {
Button("Check for Update") {
Expand Down
Loading