Skip to content

feat(apple): Add start on login functionality#9168

Merged
jamilbk merged 6 commits into
mainfrom
feat/apple/start-on-login
May 16, 2025
Merged

feat(apple): Add start on login functionality#9168
jamilbk merged 6 commits into
mainfrom
feat/apple/start-on-login

Conversation

@jamilbk

@jamilbk jamilbk commented May 16, 2025

Copy link
Copy Markdown
Member

Adds a new settings/configuration item startOnLogin which simply adds a "Login Item" which starts Firezone after signing into the Mac.

This feature is macOS 13 and above only because otherwise we will need to bundle a helper application to register as a service to start the app. Given our very small footprint of macOS 12 users, and how unsupported it is, this is ok.

When it comes time to implement MDM for this feature, note that Apple provides a means to enforce login items via the ServiceManagementLoginItems payload which is outside the scope of com.apple.configuration.managed. This enforces the login item in System Settings so that the user is unable to disable it.

We also add functionality here, but bear in mind that even if we disable the Toggle switch in our Settings page, the user could still disable the item in system settings unless it is being set through MDM via the service management key above.

Another thing to note is that this setting is applied on the GUI side of the tunnel only, because it is inherently tied to the process it is running as. We are not able to (nor does it make sense to) enable the login item for the tunnel service. This should be fine.

Tested to ensure enabling/disabling appropriately adds and removes the login item (and re-adds it if I manually remove it from system settings).

Related: #8916
Related: #2306

@jamilbk jamilbk requested review from Copilot and thomaseizinger May 16, 2025 08:51
@vercel

vercel Bot commented May 16, 2025

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
firezone ✅ Ready (Inspect) Visit Preview 💬 Add feedback May 16, 2025 10:04pm

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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 introduces a new "start on login" functionality for macOS 13+ by adding a new configuration setting and updating the UI and service registration flows accordingly.

  • Adds a new configuration key and corresponding default value for starting on login.
  • Updates the settings UI with a new toggle and adjusts service registration in the store.
  • Updates configuration handling to incorporate the new start on login option.

Reviewed Changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
swift/apple/FirezoneNetworkExtension/ConfigurationManager.swift Adds support for persisting the new startOnLogin setting.
swift/apple/FirezoneKit/Sources/FirezoneKit/Views/SettingsView.swift Inserts a new toggle for the start on login functionality and updates the connect toggle text.
swift/apple/FirezoneKit/Sources/FirezoneKit/Stores/Store.swift Refactors configuration reloading and registers/unregisters the launch service based on startOnLogin.
swift/apple/FirezoneKit/Sources/FirezoneKit/Models/Settings.swift Updates the Settings model to include the new startOnLogin and its override flag.
swift/apple/FirezoneKit/Sources/FirezoneKit/Models/Configuration.swift Adds the default value and key for startOnLogin in the configuration model.

Text("Automatically connect when Firezone is launched")
}
.toggleStyle(.checkbox)
.disabled(viewModel.settings.isConnectOnStartOverridden)

Copilot AI May 16, 2025

Copy link

Choose a reason for hiding this comment

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

The 'startOnLogin' toggle is disabled based on 'isConnectOnStartOverridden'. Update it to use 'isStartOnLoginOverridden' so that the correct override flag is applied.

Copilot uses AI. Check for mistakes.
….swift

Signed-off-by: Jamil <jamilbk@users.noreply.github.com>
Comment thread swift/apple/FirezoneKit/Sources/FirezoneKit/Stores/Store.swift
@jamilbk jamilbk added this pull request to the merge queue May 16, 2025
Merged via the queue into main with commit 73f334e May 16, 2025
@jamilbk jamilbk deleted the feat/apple/start-on-login branch May 16, 2025 22:30
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.

3 participants