Skip to content

Implement auto-update functionality and settings integration - #23

Open
DinanathDash wants to merge 2 commits into
srimanachanta:mainfrom
DinanathDash:feat/auto-updater
Open

Implement auto-update functionality and settings integration#23
DinanathDash wants to merge 2 commits into
srimanachanta:mainfrom
DinanathDash:feat/auto-updater

Conversation

@DinanathDash

Copy link
Copy Markdown
Contributor

This pull request introduces a comprehensive update system for Stasis, allowing the app to check for, notify about, and automatically download updates from GitHub. It adds a new UpdaterService, integrates update preferences into the settings UI, and expands localization strings to support these features. Additionally, it improves the menu rebuilding logic for better user experience.

Update System Integration:

  • Added the UpdaterService singleton, which checks for updates from GitHub, notifies the user, and can auto-download updates to the Downloads folder based on user preferences. It supports both manual and automatic update checks and handles user interaction for update installation. (Stasis/Services/UpdaterService.swift)
  • Introduced new user defaults keys for update automation and preferences, enabling persistent control over update behavior. (Stasis/DefaultsKeys.swift)
  • Added the AboutSettingsView to the settings UI, providing controls for update preferences, manual update checks, and displaying version information. (Stasis/Views/Settings/AboutSettingsView.swift)
  • Updated SettingsWindowController and SettingsView to include and pass the UpdaterService and new About tab. (Stasis/Controllers/SettingsWindowController.swift, Stasis/Views/Settings/SettingsView.swift) [1] [2] [3]

Localization and UI:

Menu Handling Improvements:

  • Improved menu rebuilding logic to defer menu updates while the menu is open, preventing UI inconsistencies, and ensuring the menu is rebuilt when closed if needed. (Stasis/AppDelegate.swift) [1] [2] [3] [4] [5] [6]

These changes collectively provide a robust, user-friendly update experience and enhance the overall settings and UI responsiveness.

Screenshot 2026-05-13 at 6 57 54 PM

@DinanathDash

Copy link
Copy Markdown
Contributor Author

@srimanachanta You need to edit out some logic according to your GitHub configurations. In the next PR, I'm adding the GitHub automation for both brew and .dmg app installation methods, to support this auto updater function.

@srimanachanta

Copy link
Copy Markdown
Owner

Given this cask isnt marked as auto-updating on homebrew, and likely will not be, you should be guarding on homebrew installs to disable this feature entirely.

Per review feedback: since the Stasis cask is not marked as
auto-updating on Homebrew and likely won't be, the built-in updater
is now fully disabled when running from a Homebrew-managed install.

- UpdaterService: add static isHomebrewInstall that detects Homebrew
  Cask by checking if the bundle path is under a known Caskroom prefix
  (/opt/homebrew/Caskroom on Apple Silicon, /usr/local/Caskroom on Intel)
- UpdaterService: guard startIfAvailable() and checkForUpdates() to
  no-op silently on Homebrew installs
- AboutSettingsView: replace update toggle/picker/button with an
  informational note (brew upgrade --cask stasis) when running from
  Homebrew, so users know how to update through the correct channel
@DinanathDash

Copy link
Copy Markdown
Contributor Author

Hey @srimanachanta! Addressed your review — here's what was updated:

UpdaterService.swift

  • Added a static isHomebrewInstall property that detects Homebrew Cask installs by checking if the app's bundle path lives under a known Caskroom prefix (/opt/homebrew/Caskroom on Apple Silicon, /usr/local/Caskroom on Intel).
  • Guarded both startIfAvailable() and checkForUpdates() to silently no-op when running from a Homebrew install — so the auto-updater is fully disabled in that case.

AboutSettingsView.swift

  • When running from Homebrew, the update toggle/picker/button is replaced with an informational note explaining that updates are managed by Homebrew, along with the command to run: brew upgrade --cask stasis.
  • Non-Homebrew installs (direct .dmg downloads) continue to show the full update preferences UI as before.

Let me know if anything needs tweaking!

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.

2 participants