Skip to content

Commit

Permalink
macOS VPN: Ask users to reboot if system extension was not uninstalled (
Browse files Browse the repository at this point in the history
#2603)

Task/Issue URL:
https://app.asana.com/0/1199230911884351/1207056555335340/f

## Description

We now ask again users to reboot if macOS requires it to complete
installation of the system extension.
  • Loading branch information
diegoreymendez committed Apr 11, 2024
1 parent 99b8fab commit ad5947f
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ extension UserText {
// "network.protection.system.extension.unknown.activation.error" - Message shown to users when they try to enable NetP and there is an unexpected activation error.
static let networkProtectionUnknownActivationError = "There as an unexpected error. Please try again."
// "network.protection.system.extension.please.reboot" - Message shown to users when they try to enable NetP and they need to reboot the computer to complete the installation
static let networkProtectionPleaseReboot = "Please reboot to activate the VPN"
static let networkProtectionPleaseReboot = "VPN update available. Restart your Mac to reconnect."
}

// MARK: - VPN Waitlist
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ enum NetworkProtectionPixelEvent: PixelKitEventV2 {
case networkProtectionRekeyCompleted
case networkProtectionRekeyFailure(_ error: Error)

case networkProtectionSystemExtensionActivationFailure
case networkProtectionSystemExtensionActivationFailure(_ error: Error)

case networkProtectionUnhandledError(function: String, line: Int, error: Error)

Expand Down Expand Up @@ -393,8 +393,7 @@ enum NetworkProtectionPixelEvent: PixelKitEventV2 {
.networkProtectionWireguardErrorCannotStartWireguardBackend,
.networkProtectionNoAuthTokenFoundError,
.networkProtectionRekeyAttempt,
.networkProtectionRekeyCompleted,
.networkProtectionSystemExtensionActivationFailure:
.networkProtectionRekeyCompleted:
return nil
case .networkProtectionClientFailedToRedeemInviteCode(let error),
.networkProtectionClientFailedToFetchLocations(let error),
Expand All @@ -408,7 +407,8 @@ enum NetworkProtectionPixelEvent: PixelKitEventV2 {
.networkProtectionClientFailedToParseRedeemResponse(let error),
.networkProtectionWireguardErrorCannotSetNetworkSettings(let error),
.networkProtectionRekeyFailure(let error),
.networkProtectionUnhandledError(_, _, let error):
.networkProtectionUnhandledError(_, _, let error),
.networkProtectionSystemExtensionActivationFailure(let error):
return error
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -418,16 +418,16 @@ final class NetworkProtectionTunnelController: TunnelController, TunnelSessionPr
controllerErrorStore.lastErrorMessage = UserText.networkProtectionSystemSettings
case SystemExtensionRequestError.unknownRequestResult:
controllerErrorStore.lastErrorMessage = UserText.networkProtectionUnknownActivationError
case SystemExtensionRequestError.willActivateAfterReboot:
case OSSystemExtensionError.extensionNotFound,
SystemExtensionRequestError.willActivateAfterReboot:
controllerErrorStore.lastErrorMessage = UserText.networkProtectionPleaseReboot
default:
controllerErrorStore.lastErrorMessage = error.localizedDescription
}

PixelKit.fire(
NetworkProtectionPixelEvent.networkProtectionSystemExtensionActivationFailure,
NetworkProtectionPixelEvent.networkProtectionSystemExtensionActivationFailure(error),
frequency: .standard,
withError: error,
includeAppVersionParameter: true
)

Expand Down
2 changes: 1 addition & 1 deletion DuckDuckGoVPN/NetworkExtensionController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ extension NetworkExtensionController {

NetworkProtectionLastVersionRunStore(userDefaults: defaults).lastExtensionVersionRun = extensionVersion

try? await Task.sleep(nanoseconds: 300 * NSEC_PER_MSEC)
try await Task.sleep(nanoseconds: 300 * NSEC_PER_MSEC)
#endif
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -303,8 +303,10 @@ final class NetworkProtectionPixelEventTests: XCTestCase {
underlyingErrors: [TestError.underlyingError]),
file: #filePath,
line: #line)
fire(NetworkProtectionPixelEvent.networkProtectionSystemExtensionActivationFailure,
and: .expect(pixelName: "m_mac_netp_system_extension_activation_failure"),
fire(NetworkProtectionPixelEvent.networkProtectionSystemExtensionActivationFailure(TestError.testError),
and: .expect(pixelName: "m_mac_netp_system_extension_activation_failure",
error: TestError.testError,
underlyingErrors: [TestError.underlyingError]),
file: #filePath,
line: #line)
fire(NetworkProtectionPixelEvent.networkProtectionUnhandledError(function: "function", line: 1, error: TestError.testError),
Expand Down

0 comments on commit ad5947f

Please sign in to comment.