Skip to content
This repository has been archived by the owner on Feb 24, 2025. It is now read-only.

Commit

Permalink
Merge branch 'main' into fcappelli/subscription_oauth_api_v2
Browse files Browse the repository at this point in the history
# Conflicts:
#	DuckDuckGo.xcodeproj/project.pbxproj
#	DuckDuckGo.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved
  • Loading branch information
federicocappelli committed Jan 20, 2025
2 parents e5ec1bd + e47e5ad commit e98529a
Show file tree
Hide file tree
Showing 11 changed files with 51 additions and 29 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -113,8 +113,8 @@
"kind" : "remoteSourceControl",
"location" : "https://github.com/duckduckgo/privacy-dashboard",
"state" : {
"revision" : "bea4d750913ef82c10cd06e791686501c8e648e4",
"version" : "7.6.0"
"revision" : "c52bd5d851b1f8f0482e82b8720852670f525497",
"version" : "8.1.0"
}
},
{
Expand Down
2 changes: 1 addition & 1 deletion DuckDuckGo/Menus/MainMenuActions.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down Expand Up @@ -62,8 +62,6 @@ final class PrivacyDashboardViewController: NSViewController {
}, keyValueStoring: UserDefaults.standard)
}()

private let eventMapping = EventMapping<PrivacyDashboardEvents> { _, _, _, _ in }

private let permissionHandler = PrivacyDashboardPermissionHandler()
private var preferredMaxHeight: CGFloat = Constants.initialContentHeight
func setPreferredMaxHeight(_ height: CGFloat) {
Expand All @@ -73,6 +71,20 @@ final class PrivacyDashboardViewController: NSViewController {
var sizeDelegate: PrivacyDashboardViewControllerSizeDelegate?
private weak var tabViewModel: TabViewModel?

private let privacyDashboardEvents = EventMapping<PrivacyDashboardEvents> { event, _, parameters, _ in
let domainEvent: NonStandardPixel
switch event {

Check failure on line 76 in DuckDuckGo/PrivacyDashboard/View/PrivacyDashboardViewController.swift

View workflow job for this annotation

GitHub Actions / Test (Non-Sandbox)

switch must be exhaustive

Check failure on line 76 in DuckDuckGo/PrivacyDashboard/View/PrivacyDashboardViewController.swift

View workflow job for this annotation

GitHub Actions / Make Release Build

switch must be exhaustive

Check failure on line 76 in DuckDuckGo/PrivacyDashboard/View/PrivacyDashboardViewController.swift

View workflow job for this annotation

GitHub Actions / Make Release Build

switch must be exhaustive

Check failure on line 76 in DuckDuckGo/PrivacyDashboard/View/PrivacyDashboardViewController.swift

View workflow job for this annotation

GitHub Actions / Test (Sandbox)

switch must be exhaustive
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) {
Expand All @@ -81,9 +93,8 @@ final class PrivacyDashboardViewController: NSViewController {
let toggleReportingManager = ToggleReportingManager(feature: toggleReportingFeature)
self.privacyDashboardController = PrivacyDashboardController(privacyInfo: privacyInfo,
entryPoint: entryPoint,

Check failure on line 95 in DuckDuckGo/PrivacyDashboard/View/PrivacyDashboardViewController.swift

View workflow job for this annotation

GitHub Actions / Make Release Build

missing argument for parameter 'variant' in call

Check failure on line 95 in DuckDuckGo/PrivacyDashboard/View/PrivacyDashboardViewController.swift

View workflow job for this annotation

GitHub Actions / Make Release Build

missing argument for parameter 'variant' in call
variant: .control,
toggleReportingManager: toggleReportingManager,
eventMapping: eventMapping)
eventMapping: privacyDashboardEvents)
super.init(nibName: nil, bundle: nil)
}

Expand All @@ -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()
}

Expand All @@ -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)

Expand Down Expand Up @@ -187,15 +199,6 @@ final class PrivacyDashboardViewController: NSViewController {

extension PrivacyDashboardViewController: PrivacyDashboardControllerDelegate {

Check failure on line 200 in DuckDuckGo/PrivacyDashboard/View/PrivacyDashboardViewController.swift

View workflow job for this annotation

GitHub Actions / Test (Non-Sandbox)

type 'PrivacyDashboardViewController' does not conform to protocol 'PrivacyDashboardControllerDelegate'

Check failure on line 200 in DuckDuckGo/PrivacyDashboard/View/PrivacyDashboardViewController.swift

View workflow job for this annotation

GitHub Actions / Make Release Build

type 'PrivacyDashboardViewController' does not conform to protocol 'PrivacyDashboardControllerDelegate'

Check failure on line 200 in DuckDuckGo/PrivacyDashboard/View/PrivacyDashboardViewController.swift

View workflow job for this annotation

GitHub Actions / Make Release Build

type 'PrivacyDashboardViewController' does not conform to protocol '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) {
Expand Down Expand Up @@ -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,
Expand Down
6 changes: 6 additions & 0 deletions DuckDuckGo/Statistics/NonStandardPixel.swift
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@ import Configuration
enum NonStandardPixel: PixelKitEventV2 {

case brokenSiteReport
case brokenSiteReportShown
case brokenSiteReportSent
case privacyDashboardReportBrokenSite
case emailEnabled
case emailDisabled
case emailUserPressedUseAddress
Expand All @@ -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"
Expand Down
2 changes: 1 addition & 1 deletion LocalPackages/DataBrokerProtection/Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ let package = Package(
targets: ["DataBrokerProtection"])
],
dependencies: [
.package(url: "https://github.com/duckduckgo/BrowserServicesKit", exact: "225.1.0"),
.package(url: "https://github.com/duckduckgo/BrowserServicesKit", exact: "226.0.0"),
.package(path: "../SwiftUIExtensions"),
.package(path: "../AppKitExtensions"),
.package(path: "../XPCHelper"),
Expand Down
2 changes: 1 addition & 1 deletion LocalPackages/FeatureFlags/Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ let package = Package(
targets: ["FeatureFlags"]),
],
dependencies: [
.package(url: "https://github.com/duckduckgo/BrowserServicesKit", exact: "225.1.0"),
.package(url: "https://github.com/duckduckgo/BrowserServicesKit", exact: "226.0.0"),
],
targets: [
// Targets are the basic building blocks of a package, defining a module or a test suite.
Expand Down
2 changes: 1 addition & 1 deletion LocalPackages/NetworkProtectionMac/Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ let package = Package(
.library(name: "VPNAppLauncher", targets: ["VPNAppLauncher"]),
],
dependencies: [
.package(url: "https://github.com/duckduckgo/BrowserServicesKit", exact: "225.1.0"),
.package(url: "https://github.com/duckduckgo/BrowserServicesKit", exact: "226.0.0"),
.package(url: "https://github.com/airbnb/lottie-spm", exact: "4.4.3"),
.package(path: "../AppLauncher"),
.package(path: "../UDSHelper"),
Expand Down
2 changes: 1 addition & 1 deletion LocalPackages/NewTabPage/Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ let package = Package(
targets: ["NewTabPage"]),
],
dependencies: [
.package(url: "https://github.com/duckduckgo/BrowserServicesKit", exact: "225.1.0"),
.package(url: "https://github.com/duckduckgo/BrowserServicesKit", exact: "226.0.0"),
.package(path: "../WebKitExtensions"),
.package(path: "../Utilities"),
],
Expand Down
2 changes: 1 addition & 1 deletion LocalPackages/SubscriptionUI/Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ let package = Package(
targets: ["SubscriptionUI"]),
],
dependencies: [
.package(url: "https://github.com/duckduckgo/BrowserServicesKit", exact: "225.1.0"),
.package(url: "https://github.com/duckduckgo/BrowserServicesKit", exact: "226.0.0"),
.package(path: "../SwiftUIExtensions"),
.package(path: "../FeatureFlags")
],
Expand Down
2 changes: 1 addition & 1 deletion LocalPackages/WebKitExtensions/Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ let package = Package(
),
],
dependencies: [
.package(url: "https://github.com/duckduckgo/BrowserServicesKit", exact: "225.1.0"),
.package(url: "https://github.com/duckduckgo/BrowserServicesKit", exact: "226.0.0"),
.package(path: "../AppKitExtensions")
],
targets: [
Expand Down
16 changes: 16 additions & 0 deletions UnitTests/WebsiteBreakageReport/WebsiteBreakageReportTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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/")!,
Expand Down

0 comments on commit e98529a

Please sign in to comment.