Skip to content

Commit

Permalink
Debug menu for survey remote message.
Browse files Browse the repository at this point in the history
  • Loading branch information
samsymons committed May 23, 2024
1 parent 47ba861 commit 2fdcf49
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 8 deletions.
4 changes: 4 additions & 0 deletions DuckDuckGo/Menus/MainMenu.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
5 changes: 5 additions & 0 deletions DuckDuckGo/Menus/MainMenuActions.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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?) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down Expand Up @@ -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())
}
Expand Down

0 comments on commit 2fdcf49

Please sign in to comment.