Skip to content

Commit

Permalink
VPN clean-up (#3474)
Browse files Browse the repository at this point in the history
Task/Issue URL: https://app.asana.com/0/1207603085593419/1208654487861283/f
Tech Design URL:
CC:

Description:

This PR cleans up some VPN code, namely pixels for events that no longer exist.
  • Loading branch information
samsymons authored Nov 6, 2024
1 parent b5d8e52 commit 1cd1cab
Show file tree
Hide file tree
Showing 9 changed files with 8 additions and 79 deletions.
2 changes: 1 addition & 1 deletion DuckDuckGo.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -14778,7 +14778,7 @@
repositoryURL = "https://github.com/duckduckgo/BrowserServicesKit";
requirement = {
kind = exactVersion;
version = 204.0.0;
version = 205.0.0;
};
};
9FF521422BAA8FF300B9819B /* XCRemoteSwiftPackageReference "lottie-spm" */ = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@
"kind" : "remoteSourceControl",
"location" : "https://github.com/duckduckgo/BrowserServicesKit",
"state" : {
"revision" : "14594b6f3f3ddbea65be2818298e2e79305d8a26",
"version" : "204.0.0"
"revision" : "1d228b8fde43e7ab5f28e7a511f440676e6b05a8",
"version" : "205.0.0"
}
},
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,10 +79,6 @@ enum NetworkProtectionPixelEvent: PixelKitEventV2 {
case networkProtectionClientFailedToEncodeRegisterKeyRequest
case networkProtectionClientFailedToFetchRegisteredServers(_ error: Error?)
case networkProtectionClientFailedToParseRegisteredServersResponse
case networkProtectionClientFailedToEncodeRedeemRequest
case networkProtectionClientInvalidInviteCode
case networkProtectionClientFailedToRedeemInviteCode(_ error: Error?)
case networkProtectionClientFailedToParseRedeemResponse(_ error: Error)
case networkProtectionClientFailedToFetchLocations(_ error: Error?)
case networkProtectionClientFailedToParseLocationsResponse(_ error: Error?)
case networkProtectionClientFailedToFetchServerStatus(_ error: Error?)
Expand Down Expand Up @@ -248,18 +244,6 @@ enum NetworkProtectionPixelEvent: PixelKitEventV2 {
case .networkProtectionClientFailedToParseRegisteredServersResponse:
return "netp_backend_api_error_parsing_device_registration_response_failed"

case .networkProtectionClientFailedToEncodeRedeemRequest:
return "netp_backend_api_error_encoding_redeem_request_body_failed"

case .networkProtectionClientInvalidInviteCode:
return "netp_backend_api_error_invalid_invite_code"

case .networkProtectionClientFailedToRedeemInviteCode:
return "netp_backend_api_error_failed_to_redeem_invite_code"

case .networkProtectionClientFailedToParseRedeemResponse:
return "netp_backend_api_error_parsing_redeem_response_failed"

case .networkProtectionClientFailedToFetchLocations:
return "netp_backend_api_error_failed_to_fetch_location_list"

Expand Down Expand Up @@ -392,8 +376,6 @@ enum NetworkProtectionPixelEvent: PixelKitEventV2 {
return error?.pixelParameters
case .networkProtectionClientFailedToFetchRegisteredServers(let error):
return error?.pixelParameters
case .networkProtectionClientFailedToRedeemInviteCode(let error):
return error?.pixelParameters
case .networkProtectionClientFailedToFetchLocations(let error):
return error?.pixelParameters
case .networkProtectionClientFailedToParseLocationsResponse(let error):
Expand Down Expand Up @@ -455,9 +437,6 @@ enum NetworkProtectionPixelEvent: PixelKitEventV2 {
.networkProtectionClientFailedToParseServerListResponse,
.networkProtectionClientFailedToEncodeRegisterKeyRequest,
.networkProtectionClientFailedToParseRegisteredServersResponse,
.networkProtectionClientFailedToEncodeRedeemRequest,
.networkProtectionClientInvalidInviteCode,
.networkProtectionClientFailedToParseRedeemResponse,
.networkProtectionClientInvalidAuthToken,
.networkProtectionWireguardErrorCannotLocateTunnelFileDescriptor,
.networkProtectionWireguardErrorFailedDNSResolution,
Expand All @@ -479,8 +458,7 @@ enum NetworkProtectionPixelEvent: PixelKitEventV2 {

var error: (any Error)? {
switch self {
case .networkProtectionClientFailedToRedeemInviteCode(let error),
.networkProtectionClientFailedToFetchLocations(let error),
case .networkProtectionClientFailedToFetchLocations(let error),
.networkProtectionClientFailedToParseLocationsResponse(let error),
.networkProtectionClientFailedToFetchServerList(let error),
.networkProtectionClientFailedToFetchRegisteredServers(let error),
Expand All @@ -492,7 +470,6 @@ enum NetworkProtectionPixelEvent: PixelKitEventV2 {
.networkProtectionTunnelStopFailure(let error),
.networkProtectionTunnelUpdateFailure(let error),
.networkProtectionTunnelWakeFailure(let error),
.networkProtectionClientFailedToParseRedeemResponse(let error),
.networkProtectionWireguardErrorCannotSetNetworkSettings(let error),
.networkProtectionWireguardErrorCannotStartWireguardBackend(let error),
.networkProtectionWireguardErrorCannotSetWireguardConfig(let error),
Expand Down Expand Up @@ -537,8 +514,6 @@ enum NetworkProtectionPixelEvent: PixelKitEventV2 {
.networkProtectionClientFailedToParseServerListResponse,
.networkProtectionClientFailedToEncodeRegisterKeyRequest,
.networkProtectionClientFailedToParseRegisteredServersResponse,
.networkProtectionClientFailedToEncodeRedeemRequest,
.networkProtectionClientInvalidInviteCode,
.networkProtectionClientInvalidAuthToken,
.networkProtectionKeychainErrorFailedToCastKeychainValueToData,
.networkProtectionKeychainReadError,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,18 +27,6 @@ extension EventMapping where Event == NetworkProtectionError {
let frequency: PixelKit.Frequency

switch event {
case .failedToEncodeRedeemRequest:
domainEvent = .networkProtectionClientFailedToEncodeRedeemRequest
frequency = .standard
case .invalidInviteCode:
domainEvent = .networkProtectionClientInvalidInviteCode
frequency = .standard
case .failedToRedeemInviteCode(let error):
domainEvent = .networkProtectionClientFailedToRedeemInviteCode(error)
frequency = .standard
case .failedToParseRedeemResponse(let error):
domainEvent = .networkProtectionClientFailedToParseRedeemResponse(error)
frequency = .standard
case .invalidAuthToken:
domainEvent = .networkProtectionClientInvalidAuthToken
frequency = .standard
Expand Down Expand Up @@ -83,7 +71,6 @@ extension EventMapping where Event == NetworkProtectionError {
.wireGuardSetNetworkSettings,
.startWireGuardBackend,
.setWireguardConfig,
.failedToRetrieveAuthToken,
.failedToFetchServerStatus,
.failedToParseServerStatusResponse:
domainEvent = .networkProtectionUnhandledError(function: #function, line: #line, error: event)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,14 +82,6 @@ final class MacPacketTunnelProvider: PacketTunnelProvider {
domainEvent = .networkProtectionClientFailedToFetchRegisteredServers(eventError)
case .failedToParseRegisteredServersResponse:
domainEvent = .networkProtectionClientFailedToParseRegisteredServersResponse
case .failedToEncodeRedeemRequest:
domainEvent = .networkProtectionClientFailedToEncodeRedeemRequest
case .invalidInviteCode:
domainEvent = .networkProtectionClientInvalidInviteCode
case .failedToRedeemInviteCode(let error):
domainEvent = .networkProtectionClientFailedToRedeemInviteCode(error)
case .failedToParseRedeemResponse(let error):
domainEvent = .networkProtectionClientFailedToParseRedeemResponse(error)
case .invalidAuthToken:
domainEvent = .networkProtectionClientInvalidAuthToken
case .serverListInconsistency:
Expand Down Expand Up @@ -124,8 +116,7 @@ final class MacPacketTunnelProvider: PacketTunnelProvider {
domainEvent = .networkProtectionClientFailedToParseServerStatusResponse(error)
case .unhandledError(function: let function, line: let line, error: let error):
domainEvent = .networkProtectionUnhandledError(function: function, line: line, error: error)
case .failedToRetrieveAuthToken,
.failedToFetchLocationList,
case .failedToFetchLocationList,
.failedToParseLocationListResponse:
// Needs Privacy triage for macOS Geoswitching pixels
return
Expand Down
2 changes: 1 addition & 1 deletion LocalPackages/DataBrokerProtection/Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ let package = Package(
targets: ["DataBrokerProtection"])
],
dependencies: [
.package(url: "https://github.com/duckduckgo/BrowserServicesKit", exact: "204.0.0"),
.package(url: "https://github.com/duckduckgo/BrowserServicesKit", exact: "205.0.0"),
.package(path: "../SwiftUIExtensions"),
.package(path: "../XPCHelper"),
.package(path: "../Freemium"),
Expand Down
2 changes: 1 addition & 1 deletion LocalPackages/NetworkProtectionMac/Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ let package = Package(
.library(name: "VPNAppLauncher", targets: ["VPNAppLauncher"]),
],
dependencies: [
.package(url: "https://github.com/duckduckgo/BrowserServicesKit", exact: "204.0.0"),
.package(url: "https://github.com/duckduckgo/BrowserServicesKit", exact: "205.0.0"),
.package(url: "https://github.com/airbnb/lottie-spm", exact: "4.4.3"),
.package(path: "../AppLauncher"),
.package(path: "../UDSHelper"),
Expand Down
2 changes: 1 addition & 1 deletion LocalPackages/SubscriptionUI/Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ let package = Package(
targets: ["SubscriptionUI"]),
],
dependencies: [
.package(url: "https://github.com/duckduckgo/BrowserServicesKit", exact: "204.0.0"),
.package(url: "https://github.com/duckduckgo/BrowserServicesKit", exact: "205.0.0"),
.package(path: "../SwiftUIExtensions")
],
targets: [
Expand Down
24 changes: 0 additions & 24 deletions UnitTests/NetworkProtection/NetworkProtectionPixelEventTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -211,30 +211,6 @@ final class NetworkProtectionPixelEventTests: XCTestCase {
and: .expect(pixelName: "m_mac_netp_backend_api_error_parsing_device_registration_response_failed"),
file: #filePath,
line: #line)
fire(NetworkProtectionPixelEvent.networkProtectionClientFailedToEncodeRedeemRequest,
frequency: .legacyDailyAndCount,
and: .expect(pixelName: "m_mac_netp_backend_api_error_encoding_redeem_request_body_failed"),
file: #filePath,
line: #line)
fire(NetworkProtectionPixelEvent.networkProtectionClientInvalidInviteCode,
frequency: .legacyDailyAndCount,
and: .expect(pixelName: "m_mac_netp_backend_api_error_invalid_invite_code"),
file: #filePath,
line: #line)
fire(NetworkProtectionPixelEvent.networkProtectionClientFailedToRedeemInviteCode(TestError.testError),
frequency: .legacyDailyAndCount,
and: .expect(pixelName: "m_mac_netp_backend_api_error_failed_to_redeem_invite_code",
error: TestError.testError,
underlyingErrors: [TestError.underlyingError]),
file: #filePath,
line: #line)
fire(NetworkProtectionPixelEvent.networkProtectionClientFailedToParseRedeemResponse(TestError.testError),
frequency: .legacyDailyAndCount,
and: .expect(pixelName: "m_mac_netp_backend_api_error_parsing_redeem_response_failed",
error: TestError.testError,
underlyingErrors: [TestError.underlyingError]),
file: #filePath,
line: #line)
fire(NetworkProtectionPixelEvent.networkProtectionClientFailedToFetchLocations(TestError.testError),
frequency: .legacyDailyAndCount,
and: .expect(pixelName: "m_mac_netp_backend_api_error_failed_to_fetch_location_list",
Expand Down

0 comments on commit 1cd1cab

Please sign in to comment.