diff --git a/DuckDuckGo.xcodeproj/project.pbxproj b/DuckDuckGo.xcodeproj/project.pbxproj index 06a5ccb48f..9201b39429 100644 --- a/DuckDuckGo.xcodeproj/project.pbxproj +++ b/DuckDuckGo.xcodeproj/project.pbxproj @@ -15385,8 +15385,8 @@ isa = XCRemoteSwiftPackageReference; repositoryURL = "https://github.com/duckduckgo/BrowserServicesKit"; requirement = { - kind = exactVersion; - version = 225.0.0; + branch = "mgurgel/improved-breakage-form-pixel"; + kind = branch; }; }; 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 fb5f5537b3..dfcae91ded 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" : "20e6eaf0b1e423d9a270e2d460cae284c08f73d8", - "version" : "225.0.0" + "branch" : "mgurgel/improved-breakage-form-pixel", + "revision" : "f85a4199ba4251921ecff6d110527c8d5c44e329" } }, { @@ -41,8 +41,8 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/duckduckgo/content-scope-scripts", "state" : { - "revision" : "7958ddab724c26326333cae13fe81478290607fa", - "version" : "7.6.0" + "revision" : "0502ed7de4130bd8705daebaca9aeb20d3e62d15", + "version" : "7.5.0" } }, { @@ -104,8 +104,8 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/duckduckgo/privacy-dashboard", "state" : { - "revision" : "bea4d750913ef82c10cd06e791686501c8e648e4", - "version" : "7.6.0" + "branch" : "pr-releases/pr-302", + "revision" : "05d04de7505117b32949b2007e5a56ba2d39469b" } }, { @@ -167,8 +167,8 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/duckduckgo/sync_crypto", "state" : { - "revision" : "cc726cebb67367466bc31ced4784e16d44ac68d1", - "version" : "0.4.0" + "revision" : "0c8bf3c0e75591bc366407b9d7a73a9fcfc7736f", + "version" : "0.3.0" } }, { diff --git a/DuckDuckGo/Menus/MainMenuActions.swift b/DuckDuckGo/Menus/MainMenuActions.swift index 77e928f30b..33d5bf67d0 100644 --- a/DuckDuckGo/Menus/MainMenuActions.swift +++ b/DuckDuckGo/Menus/MainMenuActions.swift @@ -1241,7 +1241,7 @@ extension MainViewController: FindInPageDelegate { extension AppDelegate: PrivacyDashboardViewControllerSizeDelegate { func privacyDashboardViewControllerDidChange(size: NSSize) { - privacyDashboardWindow?.setFrame(NSRect(origin: .zero, size: size), display: true, animate: true) + privacyDashboardWindow?.setFrame(NSRect(origin: .zero, size: size), display: true, animate: false) } } diff --git a/DuckDuckGo/PrivacyDashboard/View/PrivacyDashboardViewController.swift b/DuckDuckGo/PrivacyDashboard/View/PrivacyDashboardViewController.swift index efeb045455..04a6aa222d 100644 --- a/DuckDuckGo/PrivacyDashboard/View/PrivacyDashboardViewController.swift +++ b/DuckDuckGo/PrivacyDashboard/View/PrivacyDashboardViewController.swift @@ -34,7 +34,7 @@ final class PrivacyDashboardViewController: NSViewController { struct Constants { static let initialContentHeight: CGFloat = 489.0 - static let reportBrokenSiteInitialContentHeight = 587.0 + 28.0 + static let reportBrokenSiteInitialContentHeight = 406.0 + 28.0 static let initialContentWidth: CGFloat = 360.0 } @@ -62,8 +62,6 @@ final class PrivacyDashboardViewController: NSViewController { }, keyValueStoring: UserDefaults.standard) }() - private let eventMapping = EventMapping { _, _, _, _ in } - private let permissionHandler = PrivacyDashboardPermissionHandler() private var preferredMaxHeight: CGFloat = Constants.initialContentHeight func setPreferredMaxHeight(_ height: CGFloat) { @@ -73,6 +71,20 @@ final class PrivacyDashboardViewController: NSViewController { var sizeDelegate: PrivacyDashboardViewControllerSizeDelegate? private weak var tabViewModel: TabViewModel? + private let privacyDashboardEvents = EventMapping { event, _, parameters, _ in + let domainEvent: NonStandardPixel + switch event { + case .showReportBrokenSite: domainEvent = .brokenSiteReportShown + case .reportBrokenSiteShown: domainEvent = .brokenSiteReportShown + case .reportBrokenSiteSent: domainEvent = .brokenSiteReportSent + } + if let parameters { + PixelKit.fire(NonStandardEvent(domainEvent), withAdditionalParameters: parameters) + } else { + PixelKit.fire(NonStandardEvent(domainEvent)) + } + } + init(privacyInfo: PrivacyInfo? = nil, entryPoint: PrivacyDashboardEntryPoint = .dashboard, privacyConfigurationManager: PrivacyConfigurationManaging = ContentBlocking.shared.privacyConfigurationManager) { @@ -81,9 +93,8 @@ final class PrivacyDashboardViewController: NSViewController { let toggleReportingManager = ToggleReportingManager(feature: toggleReportingFeature) self.privacyDashboardController = PrivacyDashboardController(privacyInfo: privacyInfo, entryPoint: entryPoint, - variant: .control, toggleReportingManager: toggleReportingManager, - eventMapping: eventMapping) + eventMapping: privacyDashboardEvents) super.init(nibName: nil, bundle: nil) } @@ -103,7 +114,7 @@ final class PrivacyDashboardViewController: NSViewController { } override func loadView() { - view = NSView(frame: NSRect(x: 0, y: 0, width: 360, height: 489)) + view = ColorView(frame: NSRect(x: 0, y: 0, width: 360, height: 489), backgroundColor: NSColor(named: "PopoverBackgroundColor")) initWebView() } @@ -128,6 +139,7 @@ final class PrivacyDashboardViewController: NSViewController { configuration.preferences.setValue(true, forKey: "developerExtrasEnabled") #endif let webView = PrivacyDashboardWebView(frame: .zero, configuration: configuration) + webView.setValue(false, forKey: "drawsBackground") self.webView = webView view.addAndLayout(webView) @@ -187,15 +199,6 @@ final class PrivacyDashboardViewController: NSViewController { extension PrivacyDashboardViewController: PrivacyDashboardControllerDelegate { - func privacyDashboardController(_ privacyDashboardController: PrivacyDashboardController, - didSelectBreakageCategory category: String) { - // Not used in macOS - } - - func privacyDashboardControllerDidRequestShowReportBrokenSite(_ privacyDashboardController: PrivacyDashboardController) { - // Not used in macOS: PixelKit.fire(GeneralPixel.privacyDashboardReportBrokenSite) - } - func privacyDashboardController(_ privacyDashboardController: PrivacyDashboardController, didChangeProtectionSwitch protectionState: ProtectionState, didSendReport: Bool) { @@ -246,12 +249,9 @@ extension PrivacyDashboardViewController: PrivacyDashboardControllerDelegate { dismiss() } - func privacyDashboardControllerDidRequestShowAlertForMissingDescription(_ privacyDashboardController: PrivacyDashboardController) { - // Not used in macOS - } - func privacyDashboardControllerDidRequestShowGeneralFeedback(_ privacyDashboardController: PrivacyDashboardController) { - // Not used in macOS + dismiss() + FeedbackPresenter.presentFeedbackForm() } func privacyDashboardController(_ privacyDashboardController: PrivacyDashboardController, diff --git a/DuckDuckGo/Statistics/NonStandardPixel.swift b/DuckDuckGo/Statistics/NonStandardPixel.swift index b528aef0a1..5accaf5020 100644 --- a/DuckDuckGo/Statistics/NonStandardPixel.swift +++ b/DuckDuckGo/Statistics/NonStandardPixel.swift @@ -26,6 +26,9 @@ import Configuration enum NonStandardPixel: PixelKitEventV2 { case brokenSiteReport + case brokenSiteReportShown + case brokenSiteReportSent + case privacyDashboardReportBrokenSite case emailEnabled case emailDisabled case emailUserPressedUseAddress @@ -35,6 +38,9 @@ enum NonStandardPixel: PixelKitEventV2 { var name: String { switch self { case .brokenSiteReport: return "epbf_macos_desktop" + case .brokenSiteReportSent: return "m_report-broken-site_sent" + case .brokenSiteReportShown: return "m_report-broken-site_shown" + case .privacyDashboardReportBrokenSite: return "mp_rb" case .emailEnabled: return "email_enabled_macos_desktop" case .emailDisabled: return "email_disabled_macos_desktop" case .emailUserPressedUseAddress: return "email_filled_main_macos_desktop" diff --git a/LocalPackages/DataBrokerProtection/Package.swift b/LocalPackages/DataBrokerProtection/Package.swift index bdb4a5fec8..21a83f3f74 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: "225.0.0"), + .package(url: "https://github.com/duckduckgo/BrowserServicesKit", branch: "mgurgel/improved-breakage-form-pixel"), .package(path: "../SwiftUIExtensions"), .package(path: "../AppKitExtensions"), .package(path: "../XPCHelper"), diff --git a/LocalPackages/FeatureFlags/Package.swift b/LocalPackages/FeatureFlags/Package.swift index 960f4c7a76..ce06b688ee 100644 --- a/LocalPackages/FeatureFlags/Package.swift +++ b/LocalPackages/FeatureFlags/Package.swift @@ -32,7 +32,7 @@ let package = Package( targets: ["FeatureFlags"]), ], dependencies: [ - .package(url: "https://github.com/duckduckgo/BrowserServicesKit", exact: "225.0.0"), + .package(url: "https://github.com/duckduckgo/BrowserServicesKit", branch: "mgurgel/improved-breakage-form-pixel"), ], targets: [ // Targets are the basic building blocks of a package, defining a module or a test suite. diff --git a/LocalPackages/NetworkProtectionMac/Package.swift b/LocalPackages/NetworkProtectionMac/Package.swift index ef83a3965f..4e09a12031 100644 --- a/LocalPackages/NetworkProtectionMac/Package.swift +++ b/LocalPackages/NetworkProtectionMac/Package.swift @@ -33,7 +33,7 @@ let package = Package( .library(name: "VPNAppLauncher", targets: ["VPNAppLauncher"]), ], dependencies: [ - .package(url: "https://github.com/duckduckgo/BrowserServicesKit", exact: "225.0.0"), + .package(url: "https://github.com/duckduckgo/BrowserServicesKit", branch: "mgurgel/improved-breakage-form-pixel"), .package(url: "https://github.com/airbnb/lottie-spm", exact: "4.4.3"), .package(path: "../AppLauncher"), .package(path: "../UDSHelper"), diff --git a/LocalPackages/NewTabPage/Package.swift b/LocalPackages/NewTabPage/Package.swift index 68a041c2a5..1920a18ab6 100644 --- a/LocalPackages/NewTabPage/Package.swift +++ b/LocalPackages/NewTabPage/Package.swift @@ -32,7 +32,7 @@ let package = Package( targets: ["NewTabPage"]), ], dependencies: [ - .package(url: "https://github.com/duckduckgo/BrowserServicesKit", exact: "225.0.0"), + .package(url: "https://github.com/duckduckgo/BrowserServicesKit", branch: "mgurgel/improved-breakage-form-pixel"), .package(path: "../WebKitExtensions"), .package(path: "../Utilities"), ], diff --git a/LocalPackages/SubscriptionUI/Package.swift b/LocalPackages/SubscriptionUI/Package.swift index 0848795ec1..73f197f815 100644 --- a/LocalPackages/SubscriptionUI/Package.swift +++ b/LocalPackages/SubscriptionUI/Package.swift @@ -13,7 +13,7 @@ let package = Package( targets: ["SubscriptionUI"]), ], dependencies: [ - .package(url: "https://github.com/duckduckgo/BrowserServicesKit", exact: "225.0.0"), + .package(url: "https://github.com/duckduckgo/BrowserServicesKit", branch: "mgurgel/improved-breakage-form-pixel"), .package(path: "../SwiftUIExtensions"), .package(path: "../FeatureFlags") ], diff --git a/LocalPackages/WebKitExtensions/Package.swift b/LocalPackages/WebKitExtensions/Package.swift index 38502ce36a..f3c600a4a9 100644 --- a/LocalPackages/WebKitExtensions/Package.swift +++ b/LocalPackages/WebKitExtensions/Package.swift @@ -32,7 +32,7 @@ let package = Package( ), ], dependencies: [ - .package(url: "https://github.com/duckduckgo/BrowserServicesKit", exact: "225.0.0"), + .package(url: "https://github.com/duckduckgo/BrowserServicesKit", branch: "mgurgel/improved-breakage-form-pixel"), .package(path: "../AppKitExtensions") ], targets: [ diff --git a/UnitTests/WebsiteBreakageReport/WebsiteBreakageReportTests.swift b/UnitTests/WebsiteBreakageReport/WebsiteBreakageReportTests.swift index cb7f619b4b..7d50333d95 100644 --- a/UnitTests/WebsiteBreakageReport/WebsiteBreakageReportTests.swift +++ b/UnitTests/WebsiteBreakageReport/WebsiteBreakageReportTests.swift @@ -33,6 +33,22 @@ class WebsiteBreakageReportTests: XCTestCase { line: #line) } + func testReportBrokenSiteShownPixel() { + fire(NonStandardEvent(NonStandardPixel.brokenSiteReportShown), + frequency: .standard, + and: .expect(pixelName: "m_report-broken-site_shown"), + file: #filePath, + line: #line) + } + + func testReportBrokenSiteSentPixel() { + fire(NonStandardEvent(NonStandardPixel.brokenSiteReportSent), + frequency: .standard, + and: .expect(pixelName: "m_report-broken-site_sent"), + file: #filePath, + line: #line) + } + func testCommonSetOfFields() throws { let breakage = BrokenSiteReport( siteUrl: URL(string: "https://example.test/")!,