From 91f27c782224951187852c5def7b1bad6fe648fb Mon Sep 17 00:00:00 2001 From: Dominik Kapusta Date: Mon, 15 Jul 2024 07:21:52 +0200 Subject: [PATCH] Add a debug menu action to reset Remote Messages on macOS (#2972) Task/Issue URL: https://app.asana.com/0/1199230911884351/1207797025533577/f Description: This change adds "Reset Remote Messages" action under Debug Menu -> Reset Data. --- DuckDuckGo.xcodeproj/project.pbxproj | 2 +- .../xcshareddata/swiftpm/Package.resolved | 6 +++--- DuckDuckGo/Application/AppDelegate.swift | 2 +- DuckDuckGo/Menus/MainMenu.swift | 1 + DuckDuckGo/Menus/MainMenuActions.swift | 3 +++ LocalPackages/DataBrokerProtection/Package.swift | 2 +- LocalPackages/NetworkProtectionMac/Package.swift | 2 +- LocalPackages/SubscriptionUI/Package.swift | 2 +- UnitTests/RemoteMessaging/MockRemoteMessagingStore.swift | 2 ++ 9 files changed, 14 insertions(+), 8 deletions(-) diff --git a/DuckDuckGo.xcodeproj/project.pbxproj b/DuckDuckGo.xcodeproj/project.pbxproj index b6d1fc243b..5876eecc5b 100644 --- a/DuckDuckGo.xcodeproj/project.pbxproj +++ b/DuckDuckGo.xcodeproj/project.pbxproj @@ -13310,7 +13310,7 @@ repositoryURL = "https://github.com/duckduckgo/BrowserServicesKit"; requirement = { kind = exactVersion; - version = 171.0.0; + version = 171.1.0; }; }; 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 2e62113413..1b2fc1452c 100644 --- a/DuckDuckGo.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved +++ b/DuckDuckGo.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved @@ -32,8 +32,8 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/duckduckgo/BrowserServicesKit", "state" : { - "revision" : "9ee9b378060b94aeafba65c62e629953fec91093", - "version" : "171.0.0" + "revision" : "c9462f5a01ef4b298caea661981fa6cecff687b7", + "version" : "171.1.0" } }, { @@ -75,7 +75,7 @@ { "identity" : "lottie-spm", "kind" : "remoteSourceControl", - "location" : "https://github.com/airbnb/lottie-spm", + "location" : "https://github.com/airbnb/lottie-spm.git", "state" : { "revision" : "1d29eccc24cc8b75bff9f6804155112c0ffc9605", "version" : "4.4.3" diff --git a/DuckDuckGo/Application/AppDelegate.swift b/DuckDuckGo/Application/AppDelegate.swift index 4027bdb6a7..2c21010cc3 100644 --- a/DuckDuckGo/Application/AppDelegate.swift +++ b/DuckDuckGo/Application/AppDelegate.swift @@ -89,7 +89,7 @@ final class AppDelegate: NSObject, NSApplicationDelegate { var privacyDashboardWindow: NSWindow? let activeRemoteMessageModel: ActiveRemoteMessageModel - private let remoteMessagingClient: RemoteMessagingClient! + let remoteMessagingClient: RemoteMessagingClient! public let subscriptionManager: SubscriptionManager public let subscriptionUIHandler: SubscriptionUIHandling diff --git a/DuckDuckGo/Menus/MainMenu.swift b/DuckDuckGo/Menus/MainMenu.swift index af045c7925..a21e355a4f 100644 --- a/DuckDuckGo/Menus/MainMenu.swift +++ b/DuckDuckGo/Menus/MainMenu.swift @@ -584,6 +584,7 @@ final class MainMenu: NSMenu { } NSMenuItem(title: "Reset Email Protection InContext Signup Prompt", action: #selector(MainViewController.resetEmailProtectionInContextPrompt)) NSMenuItem(title: "Reset Pixels Storage", action: #selector(MainViewController.resetDailyPixels)) + NSMenuItem(title: "Reset Remote Messages", action: #selector(AppDelegate.resetRemoteMessages)) }.withAccessibilityIdentifier("MainMenu.resetData") NSMenuItem(title: "UI Triggers") { NSMenuItem(title: "Show Save Credentials Popover", action: #selector(MainViewController.showSaveCredentialsPopover)) diff --git a/DuckDuckGo/Menus/MainMenuActions.swift b/DuckDuckGo/Menus/MainMenuActions.swift index 7c295f5281..60a901c2bd 100644 --- a/DuckDuckGo/Menus/MainMenuActions.swift +++ b/DuckDuckGo/Menus/MainMenuActions.swift @@ -296,6 +296,9 @@ extension AppDelegate { } } + @objc func resetRemoteMessages(_ sender: Any?) { + remoteMessagingClient.store?.resetRemoteMessages() + } } extension MainViewController { diff --git a/LocalPackages/DataBrokerProtection/Package.swift b/LocalPackages/DataBrokerProtection/Package.swift index 2c727bd0d0..6826eaf6f4 100644 --- a/LocalPackages/DataBrokerProtection/Package.swift +++ b/LocalPackages/DataBrokerProtection/Package.swift @@ -29,7 +29,7 @@ let package = Package( targets: ["DataBrokerProtection"]) ], dependencies: [ - .package(url: "https://github.com/duckduckgo/BrowserServicesKit", exact: "171.0.0"), + .package(url: "https://github.com/duckduckgo/BrowserServicesKit", exact: "171.1.0"), .package(path: "../SwiftUIExtensions"), .package(path: "../XPCHelper"), ], diff --git a/LocalPackages/NetworkProtectionMac/Package.swift b/LocalPackages/NetworkProtectionMac/Package.swift index ed0f066a90..1097879c81 100644 --- a/LocalPackages/NetworkProtectionMac/Package.swift +++ b/LocalPackages/NetworkProtectionMac/Package.swift @@ -32,7 +32,7 @@ let package = Package( .library(name: "VPNAppLauncher", targets: ["VPNAppLauncher"]), ], dependencies: [ - .package(url: "https://github.com/duckduckgo/BrowserServicesKit", exact: "171.0.0"), + .package(url: "https://github.com/duckduckgo/BrowserServicesKit", exact: "171.1.0"), .package(url: "https://github.com/airbnb/lottie-spm", exact: "4.4.3"), .package(path: "../AppLauncher"), .package(path: "../UDSHelper"), diff --git a/LocalPackages/SubscriptionUI/Package.swift b/LocalPackages/SubscriptionUI/Package.swift index 2cdc2fc743..afa4a4d7b5 100644 --- a/LocalPackages/SubscriptionUI/Package.swift +++ b/LocalPackages/SubscriptionUI/Package.swift @@ -12,7 +12,7 @@ let package = Package( targets: ["SubscriptionUI"]), ], dependencies: [ - .package(url: "https://github.com/duckduckgo/BrowserServicesKit", exact: "171.0.0"), + .package(url: "https://github.com/duckduckgo/BrowserServicesKit", exact: "171.1.0"), .package(path: "../SwiftUIExtensions") ], targets: [ diff --git a/UnitTests/RemoteMessaging/MockRemoteMessagingStore.swift b/UnitTests/RemoteMessaging/MockRemoteMessagingStore.swift index 1b6ddbc9c4..e1d9fd397f 100644 --- a/UnitTests/RemoteMessaging/MockRemoteMessagingStore.swift +++ b/UnitTests/RemoteMessaging/MockRemoteMessagingStore.swift @@ -96,4 +96,6 @@ class MockRemoteMessagingStore: RemoteMessagingStoring { shownRemoteMessagesIDs.removeAll(where: { $0 == id }) } } + + func resetRemoteMessages() {} }