From 74af5b4ed1a7f4923eaa2f0f88b69ef189b9bda0 Mon Sep 17 00:00:00 2001 From: Diego Rey Mendez Date: Thu, 18 Jul 2024 08:38:14 +0200 Subject: [PATCH 1/3] Updates some debug menu options for the VPN --- DuckDuckGo.xcodeproj/project.pbxproj | 4 ++-- .../xcshareddata/swiftpm/Package.resolved | 5 ++--- .../xcschemes/sandbox-test-tool.xcscheme | 2 +- .../Common/Extensions/NSAlertExtension.swift | 10 ++++++++++ .../NetworkProtectionDebugMenu.swift | 20 +++++++++++++++++++ .../NetworkProtectionDebugUtilities.swift | 4 ++++ DuckDuckGo/Waitlist/VPNUninstaller.swift | 2 +- 7 files changed, 40 insertions(+), 7 deletions(-) diff --git a/DuckDuckGo.xcodeproj/project.pbxproj b/DuckDuckGo.xcodeproj/project.pbxproj index 222e7d828b..63681f3ea6 100644 --- a/DuckDuckGo.xcodeproj/project.pbxproj +++ b/DuckDuckGo.xcodeproj/project.pbxproj @@ -13309,8 +13309,8 @@ isa = XCRemoteSwiftPackageReference; repositoryURL = "https://github.com/duckduckgo/BrowserServicesKit"; requirement = { - kind = exactVersion; - version = 171.2.2; + kind = revision; + revision = ef27110b549159918fc7913e3d02c106cc66c078; }; }; 9FF521422BAA8FF300B9819B /* XCRemoteSwiftPackageReference "lottie-spm" */ = { diff --git a/DuckDuckGo.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved b/DuckDuckGo.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved index e5f94e91e6..fc4db91209 100644 --- a/DuckDuckGo.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved +++ b/DuckDuckGo.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved @@ -32,8 +32,7 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/duckduckgo/BrowserServicesKit", "state" : { - "revision" : "0e7f13b24876a28934320ebf0ec14f644a211869", - "version" : "171.2.2" + "revision" : "ef27110b549159918fc7913e3d02c106cc66c078" } }, { @@ -75,7 +74,7 @@ { "identity" : "lottie-spm", "kind" : "remoteSourceControl", - "location" : "https://github.com/airbnb/lottie-spm.git", + "location" : "https://github.com/airbnb/lottie-spm", "state" : { "revision" : "1d29eccc24cc8b75bff9f6804155112c0ffc9605", "version" : "4.4.3" diff --git a/DuckDuckGo.xcodeproj/xcshareddata/xcschemes/sandbox-test-tool.xcscheme b/DuckDuckGo.xcodeproj/xcshareddata/xcschemes/sandbox-test-tool.xcscheme index eb7e5e26bb..41730d7069 100644 --- a/DuckDuckGo.xcodeproj/xcshareddata/xcschemes/sandbox-test-tool.xcscheme +++ b/DuckDuckGo.xcodeproj/xcshareddata/xcschemes/sandbox-test-tool.xcscheme @@ -1,7 +1,7 @@ + version = "1.7"> NSAlert { + let alert = NSAlert() + alert.messageText = "Remove VPN Configuration?" + alert.informativeText = "This will remove the VPN configuration from System Settings > VPN." + alert.alertStyle = .warning + alert.addButton(withTitle: "Remove") + alert.addButton(withTitle: UserText.cancel) + return alert + } + static func removeAllDBPStateAndDataAlert() -> NSAlert { let alert = NSAlert() alert.messageText = "Uninstall Personal Information Removal Login Item?" diff --git a/DuckDuckGo/NetworkProtection/AppTargets/BothAppTargets/NetworkProtectionDebugMenu.swift b/DuckDuckGo/NetworkProtection/AppTargets/BothAppTargets/NetworkProtectionDebugMenu.swift index 04464bd4f4..8486e946ab 100644 --- a/DuckDuckGo/NetworkProtection/AppTargets/BothAppTargets/NetworkProtectionDebugMenu.swift +++ b/DuckDuckGo/NetworkProtection/AppTargets/BothAppTargets/NetworkProtectionDebugMenu.swift @@ -64,6 +64,7 @@ final class NetworkProtectionDebugMenu: NSMenu { buildItems { NSMenuItem(title: "Reset") { + NSMenuItem(title: "Reset All State Keeping Invite", action: #selector(NetworkProtectionDebugMenu.resetAllKeepingInvite)) .targetting(self) @@ -73,8 +74,13 @@ final class NetworkProtectionDebugMenu: NSMenu { resetToDefaults .targetting(self) + NSMenuItem.separator() + NSMenuItem(title: "Remove Network Extension and Login Items", action: #selector(NetworkProtectionDebugMenu.removeSystemExtensionAndAgents)) .targetting(self) + + NSMenuItem(title: "Remove VPN configuration", action: #selector(NetworkProtectionDebugMenu.removeVPNConfiguration(_:))) + .targetting(self) } NSMenuItem.separator() @@ -219,6 +225,20 @@ final class NetworkProtectionDebugMenu: NSMenu { } } + /// Removes the system extension and agents for DuckDuckGo VPN. + /// + @objc func removeVPNConfiguration(_ sender: Any?) { + Task { @MainActor in + guard case .alertFirstButtonReturn = await NSAlert.removeVPNConfigurationAlert().runModal() else { return } + + do { + try await debugUtilities.removeVPNConfiguration() + } catch { + await NSAlert(error: error).runModal() + } + } + } + /// Sends a test user notification. /// @objc func sendTestNotification(_ sender: Any?) { diff --git a/DuckDuckGo/NetworkProtection/AppTargets/BothAppTargets/NetworkProtectionDebugUtilities.swift b/DuckDuckGo/NetworkProtection/AppTargets/BothAppTargets/NetworkProtectionDebugUtilities.swift index a640eb38a8..8f3a085734 100644 --- a/DuckDuckGo/NetworkProtection/AppTargets/BothAppTargets/NetworkProtectionDebugUtilities.swift +++ b/DuckDuckGo/NetworkProtection/AppTargets/BothAppTargets/NetworkProtectionDebugUtilities.swift @@ -69,6 +69,10 @@ final class NetworkProtectionDebugUtilities { vpnUninstaller.removeAgents() } + func removeVPNConfiguration() async throws { + try await vpnUninstaller.removeVPNConfiguration() + } + func sendTestNotificationRequest() async throws { try await ipcClient.command(.sendTestNotification) } diff --git a/DuckDuckGo/Waitlist/VPNUninstaller.swift b/DuckDuckGo/Waitlist/VPNUninstaller.swift index 1092c230e5..b8afa97d09 100644 --- a/DuckDuckGo/Waitlist/VPNUninstaller.swift +++ b/DuckDuckGo/Waitlist/VPNUninstaller.swift @@ -297,7 +297,7 @@ final class VPNUninstaller: VPNUninstalling { pinningManager.unpin(.networkProtection) } - private func removeVPNConfiguration() async throws { + func removeVPNConfiguration() async throws { // Remove the agent VPN configuration do { try await ipcClient.uninstall(.configuration) From 98a4e993716e04e7db8c6777da39d9b61bfec56f Mon Sep 17 00:00:00 2001 From: Diego Rey Mendez Date: Fri, 19 Jul 2024 13:05:24 +0200 Subject: [PATCH 2/3] Rolls back an unintentional change --- .../xcshareddata/xcschemes/sandbox-test-tool.xcscheme | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/DuckDuckGo.xcodeproj/xcshareddata/xcschemes/sandbox-test-tool.xcscheme b/DuckDuckGo.xcodeproj/xcshareddata/xcschemes/sandbox-test-tool.xcscheme index 41730d7069..eb7e5e26bb 100644 --- a/DuckDuckGo.xcodeproj/xcshareddata/xcschemes/sandbox-test-tool.xcscheme +++ b/DuckDuckGo.xcodeproj/xcshareddata/xcschemes/sandbox-test-tool.xcscheme @@ -1,7 +1,7 @@ + version = "1.8"> Date: Fri, 19 Jul 2024 13:05:47 +0200 Subject: [PATCH 3/3] Rolls back an unintentional change --- Submodules/privacy-reference-tests | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Submodules/privacy-reference-tests b/Submodules/privacy-reference-tests index a603ff9af2..afb4f6128a 160000 --- a/Submodules/privacy-reference-tests +++ b/Submodules/privacy-reference-tests @@ -1 +1 @@ -Subproject commit a603ff9af22ca3ff7ce2e7ffbfe18c447d9f23e8 +Subproject commit afb4f6128a3b50d53ddcb1897ea1fb4df6858aa1