From 2fdcf49d9026f804cdad27746eb765017acdb13f Mon Sep 17 00:00:00 2001 From: Sam Symons Date: Thu, 23 May 2024 16:32:51 -0700 Subject: [PATCH] Debug menu for survey remote message. --- DuckDuckGo/Menus/MainMenu.swift | 4 ++++ DuckDuckGo/Menus/MainMenuActions.swift | 5 +++++ .../BothAppTargets/NetworkProtectionDebugMenu.swift | 8 -------- 3 files changed, 9 insertions(+), 8 deletions(-) diff --git a/DuckDuckGo/Menus/MainMenu.swift b/DuckDuckGo/Menus/MainMenu.swift index 3a41e65525..c7e3b6d6ae 100644 --- a/DuckDuckGo/Menus/MainMenu.swift +++ b/DuckDuckGo/Menus/MainMenu.swift @@ -642,6 +642,10 @@ import SubscriptionUI currentViewController: { WindowControllersManager.shared.lastKeyMainWindowController?.mainViewController }, subscriptionManager: Application.appDelegate.subscriptionManager) + NSMenuItem(title: "Privacy Pro Survey") { + NSMenuItem(title: "Reset Remote Message Cache", action: #selector(MainViewController.resetSurveyRemoteMessages)) + } + NSMenuItem(title: "Logging").submenu(setupLoggingMenu()) } debugMenu.addItem(internalUserItem) diff --git a/DuckDuckGo/Menus/MainMenuActions.swift b/DuckDuckGo/Menus/MainMenuActions.swift index 103b90bc81..dab061f410 100644 --- a/DuckDuckGo/Menus/MainMenuActions.swift +++ b/DuckDuckGo/Menus/MainMenuActions.swift @@ -924,6 +924,11 @@ extension MainViewController { setConfigurationUrl(nil) } + @objc func resetSurveyRemoteMessages(_ sender: Any?) { + DefaultSurveyRemoteMessagingStorage.surveys().removeStoredAndDismissedMessages() + DefaultSurveyRemoteMessaging(subscriptionManager: Application.appDelegate.subscriptionManager).resetLastRefreshTimestamp() + } + // MARK: - Developer Tools @objc func toggleDeveloperTools(_ sender: Any?) { diff --git a/DuckDuckGo/NetworkProtection/AppTargets/BothAppTargets/NetworkProtectionDebugMenu.swift b/DuckDuckGo/NetworkProtection/AppTargets/BothAppTargets/NetworkProtectionDebugMenu.swift index 749e95c02b..23fb71b7ab 100644 --- a/DuckDuckGo/NetworkProtection/AppTargets/BothAppTargets/NetworkProtectionDebugMenu.swift +++ b/DuckDuckGo/NetworkProtection/AppTargets/BothAppTargets/NetworkProtectionDebugMenu.swift @@ -76,9 +76,6 @@ final class NetworkProtectionDebugMenu: NSMenu { NSMenuItem(title: "Remove Network Extension and Login Items", action: #selector(NetworkProtectionDebugMenu.removeSystemExtensionAndAgents)) .targetting(self) - - NSMenuItem(title: "Reset Remote Messages", action: #selector(NetworkProtectionDebugMenu.resetNetworkProtectionRemoteMessages)) - .targetting(self) } NSMenuItem.separator() @@ -483,11 +480,6 @@ final class NetworkProtectionDebugMenu: NSMenu { overrideNetworkProtectionActivationDate(to: nil) } - @objc func resetNetworkProtectionRemoteMessages(_ sender: Any?) { - DefaultSurveyRemoteMessagingStorage.surveys().removeStoredAndDismissedMessages() - DefaultSurveyRemoteMessaging(subscriptionManager: Application.appDelegate.subscriptionManager).resetLastRefreshTimestamp() - } - @objc func overrideNetworkProtectionActivationDateToNow(_ sender: Any?) { overrideNetworkProtectionActivationDate(to: Date()) }