-
Notifications
You must be signed in to change notification settings - Fork 16
Implements solution for System Extension activation issues #1502
Implements solution for System Extension activation issues #1502
Conversation
| // | ||
| if onboardingStatusRawValue == OnboardingStatus.isOnboarding(step: .userNeedsToAllowExtension).rawValue { | ||
| onboardingStatusRawValue = OnboardingStatus.completed.rawValue | ||
| return |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This modifies the flow - if we're enabling the system extension, we'll have the user start the tunnel manually again.
As requested here: https://app.asana.com/0/0/1205275221447701/1205278158970389/f
| /// see the alert every single time, they'll see both the alert and system settings being opened automatically. | ||
| /// | ||
| if hasPendingActivationRequests() { | ||
| openSystemSettingsSecurity() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If there are pending activation requests we'll open system settings directly.
| let task = Process() | ||
| let pipe = Pipe() | ||
|
|
||
| task.standardOutput = pipe | ||
| task.launchPath = "/bin/bash" // Specify the shell to use | ||
| task.arguments = ["-c", "$(which systemextensionsctl) list | $(which egrep) -c '(?:\(bundleID)).+(?:activated waiting for user)+'"] | ||
|
|
||
| task.launch() | ||
| task.waitUntilExit() | ||
|
|
||
| let data = pipe.fileHandleForReading.readDataToEndOfFile() | ||
| let output = String(data: data, encoding: .utf8)?.trimmingCharacters(in: .whitespacesAndNewlines) | ||
|
|
||
| return (Int(output ?? "0") ?? 0) > 0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
While we can request the system extension properties using a specific type of request, doing so requires more complicated modifications to the code.
This gives us quickly something that works immediately for macOS 11+.
Sending a properties request is much more complicated because it requires me to modify SystemExtensionManager to support different delegates and running multiple requests.
This decision was a tradeoff.
|
|
||
| let bundleID: String | ||
| let manager: OSSystemExtensionManager | ||
| private static let systemSettingsSecurityURL = "x-apple.systempreferences:com.apple.preference.security?Security" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice, I hadn't seen this URL format before
samsymons
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For me this works perfectly, nice solution. Actually I like your solution better than Apple's since it takes the user right to the section they need to click anyway.
|
Thank you for the review @samsymons ! |
Task/Issue URL: https://app.asana.com/0/0/1205275221447702/f
Description:
This PR offers a solution to the System Extension activation issues we currently have.
It also modifies the startup flow: now when the user enables the system extension they'll still need to start the tunnel manually.
Steps to test this PR:
Internal references:
Pull Request Review Checklist
Software Engineering Expectations
Technical Design Template
Pull Request Documentation