Skip to content

fix(apple): Force enable VPN configuration on autoStart#8814

Merged
jamilbk merged 3 commits into
mainfrom
fix/apple-black-screen
Apr 18, 2025
Merged

fix(apple): Force enable VPN configuration on autoStart#8814
jamilbk merged 3 commits into
mainfrom
fix/apple-black-screen

Conversation

@jamilbk

@jamilbk jamilbk commented Apr 18, 2025

Copy link
Copy Markdown
Member

If another VPN has been activated on the system while Firezone is active, Apple OSes will deactivate our configuration, and never reactivate it.

We knew this already, and always activated the configuration when starting during the sign in flow, but failed to also do this when autoStarting on launch.

This PR updates ensures that during autoStart, we re-enable the configuration as well.

Fixes #8813

Copilot AI review requested due to automatic review settings April 18, 2025 17:29
@vercel

vercel Bot commented Apr 18, 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 Apr 18, 2025 5:37pm

@jamilbk jamilbk requested a review from a team April 18, 2025 17:29

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 ensures that the VPN configuration is re-enabled during autoStart on Apple OSes, preventing deactivation if another VPN is activated on the system.

  • In Store.swift, the autoStart flow now explicitly calls enableConfiguration.
  • In VPNConfigurationManager.swift, duplicated configuration updates are consolidated into the enableConfiguration() helper.

Reviewed Changes

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

File Description
swift/apple/FirezoneKit/Sources/FirezoneKit/Stores/Store.swift Added call to enable VPN configuration during autoStart
swift/apple/FirezoneKit/Sources/FirezoneKit/Managers/VPNConfigurationManager.swift Consolidated configuration update logic into enableConfiguration() and removed redundant inline updates

Comment on lines 102 to 103
try await vpnConfigurationManager?.enableConfiguration()
try ipcClient().start()

Copilot AI Apr 18, 2025

Copy link

Choose a reason for hiding this comment

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

Since enabling the VPN configuration is critical during autoStart, using optional chaining might silently fail if vpnConfigurationManager is nil. Consider explicitly handling the nil case (for example, by logging an error or throwing an exception) to ensure the configuration is properly enabled.

Suggested change
try await vpnConfigurationManager?.enableConfiguration()
try ipcClient().start()
guard let manager = vpnConfigurationManager else {
Log.error("VPNConfigurationManager is nil. Unable to enable configuration during autoStart.")
throw NSError(domain: "StoreError", code: 1, userInfo: [NSLocalizedDescriptionKey: "VPNConfigurationManager is not initialized."])
}
try await manager.enableConfiguration()

Copilot uses AI. Check for mistakes.
@jamilbk

jamilbk commented Apr 18, 2025

Copy link
Copy Markdown
Member Author

Tested and works on live device.

@bmanifold bmanifold left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM

@jamilbk jamilbk added this pull request to the merge queue Apr 18, 2025
Merged via the queue into main with commit 4c1379a Apr 18, 2025
@jamilbk jamilbk deleted the fix/apple-black-screen branch April 18, 2025 18:16
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.

Opening iOS app after a while gets stuck at black loading screen

3 participants