Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Integrate BSK changes #2101

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion DuckDuckGo.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -8978,7 +8978,7 @@
repositoryURL = "https://github.com/DuckDuckGo/BrowserServicesKit";
requirement = {
kind = exactVersion;
version = 81.4.1;
version = 81.5.0;
};
};
C14882EB27F211A000D59F0C /* XCRemoteSwiftPackageReference "SwiftSoup" */ = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
"repositoryURL": "https://github.com/DuckDuckGo/BrowserServicesKit",
"state": {
"branch": null,
"revision": "57d8ed94cf503fdbd348420e821df00142660333",
"version": "81.4.1"
"revision": "c427dc63421c4b394f54c245de8e5665bcd6966a",
"version": "81.5.0"
}
},
{
Expand Down
6 changes: 3 additions & 3 deletions DuckDuckGo/NetworkProtectionDebugUtilities.swift
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ final class NetworkProtectionDebugUtilities {
return
}

try? activeSession.sendProviderMessage(.expireRegistrationKey)
try? await activeSession.sendProviderMessage(.expireRegistrationKey)
}

// MARK: - Notifications
Expand All @@ -45,7 +45,7 @@ final class NetworkProtectionDebugUtilities {
return
}

try? activeSession.sendProviderMessage(.triggerTestNotification)
try? await activeSession.sendProviderMessage(.triggerTestNotification)
}

// MARK: - Failure Simulation
Expand All @@ -58,7 +58,7 @@ final class NetworkProtectionDebugUtilities {
guard let message = option.extensionMessage else {
return
}
try? activeSession.sendProviderMessage(message)
try? await activeSession.sendProviderMessage(message)
}
}

Expand Down
21 changes: 21 additions & 0 deletions DuckDuckGo/NetworkProtectionTunnelController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,27 @@ final class NetworkProtectionTunnelController: TunnelController {
tunnelManager.connection.stopVPNTunnel()
}

// MARK: - Connection Status Querying

/// Queries Network Protection to know if its VPN is connected.
///
/// - Returns: `true` if the VPN is connected, connecting or reasserting, and `false` otherwise.
///
var isConnected: Bool {
get async {
guard let tunnelManager = await loadTunnelManager() else {
return false
}

switch tunnelManager.connection.status {
case .connected, .connecting, .reasserting:
return true
default:
return false
}
}
}

private func startWithError() async throws {
let tunnelManager: NETunnelProviderManager

Expand Down