Skip to content

feat: support disabling the built-in updater #219

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Aug 7, 2025

Conversation

ethanndickson
Copy link
Member

@ethanndickson ethanndickson commented Aug 7, 2025

Closes #182.

UserDefaults can be forcibly set by MDM admins.
When the disableUpdater bool in UserDefaults is set to false, the updater won't be initialized on launch, and the UI elements for the updater in settings will be hidden.

Related to #220.

Copy link
Member Author

This stack of pull requests is managed by Graphite. Learn more about stacking.

@ethanndickson ethanndickson force-pushed the ethan/disable-updater-option branch from 095bf83 to f34e415 Compare August 7, 2025 02:03
@ethanndickson ethanndickson marked this pull request as ready for review August 7, 2025 02:15
@ethanndickson ethanndickson requested a review from Copilot August 7, 2025 07:33
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR adds support for disabling the built-in updater via a UserDefaults setting that can be controlled by MDM policies. When disableUpdater is set to true, the updater won't initialize and related UI elements will be hidden.

  • Adds disabled property to UpdaterService that checks UserDefaults for updater disable setting
  • Conditionally initializes the Sparkle updater only when not disabled
  • Updates GeneralTab UI to hide updater controls and show explanatory message when disabled
  • Refactors some @published properties to private(set) for better encapsulation

Reviewed Changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.

File Description
UpdaterService.swift Core logic for conditionally disabling updater initialization based on UserDefaults
GeneralTab.swift UI changes to hide updater controls and show disabled message
FilePicker.swift Access control improvements for @published properties
VPNService.swift Access control improvements for @published properties

// The auto-updater can be entirely disabled by setting the
// `disableUpdater` UserDefaults key to `true`. This is designed for use in
// MDM configurations, where the value can be set to `true` permanently.
let disabled: Bool = UserDefaults.standard.bool(forKey: Keys.disableUpdater)
Copy link
Preview

Copilot AI Aug 7, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The UserDefaults.bool(forKey:) method returns false when the key doesn't exist, which means the updater will be enabled by default. However, the comment suggests the intent is to disable the updater when the key is set to true. This logic appears inverted - consider using !UserDefaults.standard.bool(forKey: Keys.disableUpdater) if you want the updater enabled by default.

Copilot uses AI. Check for mistakes.

Button("Check for updates") { updater.checkForUpdates() }.disabled(!updater.canCheckForUpdates)
} else {
Section {
Text("The app updater has been disabled by a device management policy.")
Copy link
Preview

Copilot AI Aug 7, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[nitpick] The error message assumes the updater was disabled by device management policy, but the UserDefaults key could be set by other means. Consider making the message more generic like 'The app updater has been disabled.' or 'Automatic updates are not available.'

Suggested change
Text("The app updater has been disabled by a device management policy.")
Text("The app updater has been disabled.")

Copilot uses AI. Check for mistakes.

Copy link
Member Author

ethanndickson commented Aug 7, 2025

Merge activity

  • Aug 7, 8:19 AM UTC: A user started a stack merge that includes this pull request via Graphite.
  • Aug 7, 8:19 AM UTC: @ethanndickson merged this pull request with Graphite.

@ethanndickson ethanndickson merged commit 830d147 into main Aug 7, 2025
4 checks passed
@ethanndickson ethanndickson deleted the ethan/disable-updater-option branch August 7, 2025 08:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support disabling the built-in updater
2 participants