Skip to content

Commit

Permalink
Merge release/1.87.0 into main
Browse files Browse the repository at this point in the history
  • Loading branch information
daxmobile authored May 8, 2024
2 parents 17047bd + 88a7504 commit 6827bb3
Show file tree
Hide file tree
Showing 16 changed files with 99 additions and 48 deletions.
2 changes: 1 addition & 1 deletion Configuration/BuildNumber.xcconfig
Original file line number Diff line number Diff line change
@@ -1 +1 @@
CURRENT_PROJECT_VERSION = 183
CURRENT_PROJECT_VERSION = 184
8 changes: 7 additions & 1 deletion DuckDuckGo.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -2552,6 +2552,8 @@
F116A7C32BD1924B00F3FCF7 /* PixelKitTestingUtilities in Frameworks */ = {isa = PBXBuildFile; productRef = F116A7C22BD1924B00F3FCF7 /* PixelKitTestingUtilities */; };
F116A7C72BD1925500F3FCF7 /* PixelKitTestingUtilities in Frameworks */ = {isa = PBXBuildFile; productRef = F116A7C62BD1925500F3FCF7 /* PixelKitTestingUtilities */; };
F116A7C92BD1929000F3FCF7 /* PixelKitTestingUtilities in Frameworks */ = {isa = PBXBuildFile; productRef = F116A7C82BD1929000F3FCF7 /* PixelKitTestingUtilities */; };
F118EA852BEACC7000F77634 /* NonStandardPixel.swift in Sources */ = {isa = PBXBuildFile; fileRef = F118EA842BEACC7000F77634 /* NonStandardPixel.swift */; };
F118EA862BEACC7000F77634 /* NonStandardPixel.swift in Sources */ = {isa = PBXBuildFile; fileRef = F118EA842BEACC7000F77634 /* NonStandardPixel.swift */; };
F188267C2BBEB3AA00D9AC4F /* GeneralPixel.swift in Sources */ = {isa = PBXBuildFile; fileRef = F188267B2BBEB3AA00D9AC4F /* GeneralPixel.swift */; };
F188267D2BBEB3AA00D9AC4F /* GeneralPixel.swift in Sources */ = {isa = PBXBuildFile; fileRef = F188267B2BBEB3AA00D9AC4F /* GeneralPixel.swift */; };
F18826802BBEB58100D9AC4F /* PrivacyProPixel.swift in Sources */ = {isa = PBXBuildFile; fileRef = F188267F2BBEB58100D9AC4F /* PrivacyProPixel.swift */; };
Expand Down Expand Up @@ -4034,6 +4036,7 @@
EEDE50102BA360C80017F3C4 /* NetworkProtection+VPNAgentConvenienceInitializers.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "NetworkProtection+VPNAgentConvenienceInitializers.swift"; sourceTree = "<group>"; };
EEF12E6D2A2111880023E6BF /* MacPacketTunnelProvider.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MacPacketTunnelProvider.swift; sourceTree = "<group>"; };
EEF53E172950CED5002D78F4 /* JSAlertViewModelTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = JSAlertViewModelTests.swift; sourceTree = "<group>"; };
F118EA842BEACC7000F77634 /* NonStandardPixel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NonStandardPixel.swift; sourceTree = "<group>"; };
F188267B2BBEB3AA00D9AC4F /* GeneralPixel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = GeneralPixel.swift; sourceTree = "<group>"; };
F188267F2BBEB58100D9AC4F /* PrivacyProPixel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PrivacyProPixel.swift; sourceTree = "<group>"; };
F18826832BBEE31700D9AC4F /* PixelKit+Assertion.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "PixelKit+Assertion.swift"; sourceTree = "<group>"; };
Expand Down Expand Up @@ -7823,6 +7826,7 @@
857E5AF32A79044900FC0FB4 /* Experiment */,
B610F2BA27A145C500FCEBE9 /* RulesCompilationMonitor.swift */,
F188267B2BBEB3AA00D9AC4F /* GeneralPixel.swift */,
F118EA842BEACC7000F77634 /* NonStandardPixel.swift */,
F18826832BBEE31700D9AC4F /* PixelKit+Assertion.swift */,
F188267F2BBEB58100D9AC4F /* PrivacyProPixel.swift */,
);
Expand Down Expand Up @@ -10022,6 +10026,7 @@
3706FC38293F65D500E42796 /* BundleExtension.swift in Sources */,
4B9DB04B2A983B24000927DB /* NotificationService.swift in Sources */,
3706FC3A293F65D500E42796 /* NSOpenPanelExtensions.swift in Sources */,
F118EA862BEACC7000F77634 /* NonStandardPixel.swift in Sources */,
3706FC3B293F65D500E42796 /* FirePopover.swift in Sources */,
4B4D60C12A0C848E00BCD287 /* NetworkProtectionControllerErrorStore.swift in Sources */,
3706FC3E293F65D500E42796 /* VariantManager.swift in Sources */,
Expand Down Expand Up @@ -11232,6 +11237,7 @@
4B9DB04A2A983B24000927DB /* NotificationService.swift in Sources */,
3775912D29AAC72700E26367 /* SyncPreferences.swift in Sources */,
F1B33DF22BAD929D001128B3 /* SubscriptionAppStoreRestorer.swift in Sources */,
F118EA852BEACC7000F77634 /* NonStandardPixel.swift in Sources */,
1DB9618329F67F6200CF5568 /* FaviconNullStore.swift in Sources */,
BB5789722B2CA70F0009DFE2 /* DataBrokerProtectionSubscriptionEventHandler.swift in Sources */,
B693954F26F04BEB0015B914 /* PaddedImageButton.swift in Sources */,
Expand Down Expand Up @@ -12772,7 +12778,7 @@
repositoryURL = "https://github.com/duckduckgo/BrowserServicesKit";
requirement = {
kind = exactVersion;
version = 144.0.0;
version = 144.0.1;
};
};
9FF521422BAA8FF300B9819B /* XCRemoteSwiftPackageReference "lottie-spm" */ = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@
"kind" : "remoteSourceControl",
"location" : "https://github.com/duckduckgo/BrowserServicesKit",
"state" : {
"revision" : "9906b9464f6f12e94f3cc62456b5b5a9c1a43db8",
"version" : "144.0.0"
"revision" : "f34b0a63938df11ef471aa3301dcc0de09b0d31b",
"version" : "144.0.1"
}
},
{
Expand Down
6 changes: 3 additions & 3 deletions DuckDuckGo/Application/AppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -449,7 +449,7 @@ final class AppDelegate: NSObject, NSApplicationDelegate {
.filter { $0 }
.asVoid()
.sink { [weak syncService] in
PixelKit.fire(GeneralPixel.syncDaily, frequency: .daily)
PixelKit.fire(GeneralPixel.syncDaily, frequency: .legacyDaily)
syncService?.syncDailyStats.sendStatsIfNeeded(handler: { params in
PixelKit.fire(GeneralPixel.syncSuccessRateDaily, withAdditionalParameters: params)
})
Expand Down Expand Up @@ -532,7 +532,7 @@ final class AppDelegate: NSObject, NSApplicationDelegate {
}

private func emailDidSignInNotification(_ notification: Notification) {
PixelKit.fire(GeneralPixel.emailEnabled)
PixelKit.fire(NonStandardEvent(NonStandardPixel.emailEnabled))
if AppDelegate.isNewUser {
PixelKit.fire(GeneralPixel.emailEnabledInitial, frequency: .legacyInitial)
}
Expand All @@ -543,7 +543,7 @@ final class AppDelegate: NSObject, NSApplicationDelegate {
}

private func emailDidSignOutNotification(_ notification: Notification) {
PixelKit.fire(GeneralPixel.emailDisabled)
PixelKit.fire(NonStandardEvent(NonStandardPixel.emailDisabled))
if let object = notification.object as? EmailManager, let emailManager = syncDataProviders.settingsAdapter.emailManager, object !== emailManager {
syncService?.scheduler.notifyDataChanged()
}
Expand Down
2 changes: 1 addition & 1 deletion DuckDuckGo/Fire/ViewModel/FirePopoverViewModel.swift
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ final class FirePopoverViewModel {
// MARK: - Burning

func burn() {
PixelKit.fire(GeneralPixel.fireButtonFirstBurn, frequency: .daily)
PixelKit.fire(GeneralPixel.fireButtonFirstBurn, frequency: .legacyDaily)

switch (clearingOption, areAllSelected) {
case (.currentTab, _):
Expand Down
2 changes: 1 addition & 1 deletion DuckDuckGo/NavigationBar/View/MoreOptionsMenu.swift
Original file line number Diff line number Diff line change
Expand Up @@ -524,7 +524,7 @@ final class EmailOptionsButtonSubMenu: NSMenu {
let pixelParameters = self.emailManager.emailPixelParameters
self.emailManager.updateLastUseDate()

PixelKit.fire(GeneralPixel.emailUserCreatedAlias, withAdditionalParameters: pixelParameters)
PixelKit.fire(NonStandardEvent(NonStandardPixel.emailUserCreatedAlias), withAdditionalParameters: pixelParameters)

NSPasteboard.general.copy(address)
NotificationCenter.default.post(name: NSNotification.Name.privateEmailCopiedToClipboard, object: nil)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ final class PrivacyDashboardViewController: NSViewController {

private let brokenSiteReporter: BrokenSiteReporter = {
BrokenSiteReporter(pixelHandler: { parameters in
PixelKit.fire(GeneralPixel.brokenSiteReport,
PixelKit.fire(NonStandardEvent(NonStandardPixel.brokenSiteReport),
withAdditionalParameters: parameters,
allowedQueryReservedCharacters: BrokenSiteReport.allowedQueryReservedCharacters)
}, keyValueStoring: UserDefaults.standard)
Expand Down
39 changes: 11 additions & 28 deletions DuckDuckGo/Statistics/GeneralPixel.swift
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ import Configuration
enum GeneralPixel: PixelKitEventV2 {

case crash
case brokenSiteReport
case compileRulesWait(onboardingShown: OnboardingShown, waitTime: CompileRulesWaitTime, result: WaitResult)
case launchInitial(cohort: String)

Expand Down Expand Up @@ -55,12 +54,6 @@ enum GeneralPixel: PixelKitEventV2 {
case adClickAttributionActive
case adClickAttributionPageLoads

case emailEnabled
case emailDisabled
case emailUserPressedUseAddress
case emailUserPressedUseAlias
case emailUserCreatedAlias

case jsPixel(_ pixel: AutofillUserScript.JSPixel)

// Activation Points
Expand Down Expand Up @@ -330,9 +323,6 @@ enum GeneralPixel: PixelKitEventV2 {
case .crash:
return "m_mac_crash"

case .brokenSiteReport:
return "epbf_macos_desktop"

case .compileRulesWait(onboardingShown: let onboardingShown, waitTime: let waitTime, result: let result):
return "m_mac_cbr-wait_\(onboardingShown)_\(waitTime)_\(result)"

Expand Down Expand Up @@ -380,13 +370,6 @@ enum GeneralPixel: PixelKitEventV2 {
case .adClickAttributionPageLoads:
return "m_mac_ad_click_page_loads"

// Deliberately omit the `m_mac_` prefix in order to format these pixels the same way as other platforms
case .emailEnabled: return "email_enabled_macos_desktop"
case .emailDisabled: return "email_disabled_macos_desktop"
case .emailUserPressedUseAddress: return "email_filled_main_macos_desktop"
case .emailUserPressedUseAlias: return "email_filled_random_macos_desktop"
case .emailUserCreatedAlias: return "email_generated_button_macos_desktop"

case .jsPixel(let pixel):
// Email pixels deliberately avoid using the `m_mac_` prefix.
if pixel.isEmailPixel {
Expand All @@ -395,22 +378,22 @@ enum GeneralPixel: PixelKitEventV2 {
return "m_mac_\(pixel.pixelName)"
}
case .emailEnabledInitial:
return "m_mac.enable-email-protection.initial"
return "m_mac_enable-email-protection_initial"

case .watchInDuckPlayerInitial:
return "m_mac.watch-in-duckplayer.initial"
return "m_mac_watch-in-duckplayer_initial"
case .setAsDefaultInitial:
return "m_mac.set-as-default.initial"
return "m_mac_set-as-default_initial"
case .importDataInitial:
return "m_mac.import-data.initial"
return "m_mac_import-data_initial"
case .newTabInitial:
return "m_mac.new-tab-opened.initial"
return "m_mac_new-tab-opened_initial"
case .favoriteSectionHidden:
return "m_mac.favorite-section-hidden"
return "m_mac_favorite-section-hidden"
case .recentActivitySectionHidden:
return "m_mac.recent-activity-section-hidden"
return "m_mac_recent-activity-section-hidden"
case .continueSetUpSectionHidden:
return "m_mac.continue-setup-section-hidden"
return "m_mac_continue-setup-section-hidden"

// Fire Button
case .fireButtonFirstBurn:
Expand Down Expand Up @@ -443,11 +426,11 @@ enum GeneralPixel: PixelKitEventV2 {
return "m_mac_mp_wlr"

case .launchInitial:
return "m.mac.first-launch"
return "m_mac_first-launch"
case .serpInitial:
return "m.mac.navigation.first-search"
return "m_mac_navigation_first-search"
case .serpDay21to27:
return "m.mac.search-day-21-27.initial"
return "m_mac_search-day-21-27_initial"

case .vpnBreakageReport:
return "m_mac_vpn_breakage_report"
Expand Down
53 changes: 53 additions & 0 deletions DuckDuckGo/Statistics/NonStandardPixel.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
//
// NonStandardPixel.swift
//
// Copyright © 2024 DuckDuckGo. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//

import Foundation
import PixelKit
import BrowserServicesKit
import DDGSync
import Configuration

/// These pixels deliberately omit the `m_mac_` prefix in order to format these pixel the same way as other platforms, they are sent unchanged
enum NonStandardPixel: PixelKitEventV2 {

case brokenSiteReport
case emailEnabled
case emailDisabled
case emailUserPressedUseAddress
case emailUserPressedUseAlias
case emailUserCreatedAlias

var name: String {
switch self {
case .brokenSiteReport: return "epbf_macos_desktop"
case .emailEnabled: return "email_enabled_macos_desktop"
case .emailDisabled: return "email_disabled_macos_desktop"
case .emailUserPressedUseAddress: return "email_filled_main_macos_desktop"
case .emailUserPressedUseAlias: return "email_filled_random_macos_desktop"
case .emailUserCreatedAlias: return "email_generated_button_macos_desktop"
}
}

var parameters: [String: String]? {
return nil
}

var error: Error? {
return nil
}
}
6 changes: 3 additions & 3 deletions DuckDuckGo/Tab/Model/Tab.swift
Original file line number Diff line number Diff line change
Expand Up @@ -333,15 +333,15 @@ protocol NewWindowPolicyDecisionMaker {
}

deinit {
cleanUpBeforeClosing(onDeinit: true, webView: webView, userContentController: userContentController)
cleanUpBeforeClosing(onDeinit: true, webView: webView)
}

func cleanUpBeforeClosing() {
cleanUpBeforeClosing(onDeinit: false, webView: webView, userContentController: userContentController)
cleanUpBeforeClosing(onDeinit: false, webView: webView)
}

@MainActor(unsafe)
private func cleanUpBeforeClosing(onDeinit: Bool, webView: WebView, userContentController: UserContentController?) {
private func cleanUpBeforeClosing(onDeinit: Bool, webView: WebView) {
let job = { [webView, userContentController] in
webView.stopAllMedia(shouldStopLoading: true)

Expand Down
2 changes: 1 addition & 1 deletion DuckDuckGo/Tab/TabExtensions/DuckPlayerTabExtension.swift
Original file line number Diff line number Diff line change
Expand Up @@ -312,7 +312,7 @@ extension DuckPlayerTabExtension: NavigationResponder {
return
}
if navigation.url.isDuckPlayer {
PixelKit.fire(GeneralPixel.duckPlayerDailyUniqueView, frequency: .daily)
PixelKit.fire(GeneralPixel.duckPlayerDailyUniqueView, frequency: .legacyDaily)
}
}

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: "144.0.0"),
.package(url: "https://github.com/duckduckgo/BrowserServicesKit", exact: "144.0.1"),
.package(path: "../SwiftUIExtensions"),
.package(path: "../XPCHelper"),
],
Expand Down
2 changes: 1 addition & 1 deletion LocalPackages/NetworkProtectionMac/Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ let package = Package(
.library(name: "NetworkProtectionUI", targets: ["NetworkProtectionUI"]),
],
dependencies: [
.package(url: "https://github.com/duckduckgo/BrowserServicesKit", exact: "144.0.0"),
.package(url: "https://github.com/duckduckgo/BrowserServicesKit", exact: "144.0.1"),
.package(url: "https://github.com/airbnb/lottie-spm", exact: "4.4.1"),
.package(path: "../XPCHelper"),
.package(path: "../SwiftUIExtensions"),
Expand Down
2 changes: 1 addition & 1 deletion LocalPackages/SubscriptionUI/Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ let package = Package(
targets: ["SubscriptionUI"]),
],
dependencies: [
.package(url: "https://github.com/duckduckgo/BrowserServicesKit", exact: "144.0.0"),
.package(url: "https://github.com/duckduckgo/BrowserServicesKit", exact: "144.0.1"),
.package(path: "../SwiftUIExtensions")
],
targets: [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ final class BrokenSiteReportingReferenceTests: XCTestCase {
APIRequest.Headers.setUserAgent("")
var params = parameters
params["test"] = "1"
let configuration = APIRequest.Configuration(url: URL.pixelUrl(forPixelNamed: GeneralPixel.brokenSiteReport.name),
let configuration = APIRequest.Configuration(url: URL.pixelUrl(forPixelNamed: NonStandardPixel.brokenSiteReport.name),
queryParameters: params,
allowedQueryReservedCharacters: BrokenSiteReport.allowedQueryReservedCharacters)
return configuration.request
Expand Down
13 changes: 11 additions & 2 deletions UnitTests/WebsiteBreakageReport/WebsiteBreakageReportTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,21 @@

import PrivacyDashboard
import XCTest

import PixelKit
import PixelKitTestingUtilities
@testable import DuckDuckGo_Privacy_Browser
@testable import Networking

class WebsiteBreakageReportTests: XCTestCase {

func testReportBrokenSitePixel() {
fire(NonStandardEvent(NonStandardPixel.brokenSiteReport),
frequency: .standard,
and: .expect(pixelName: "epbf_macos_desktop"),
file: #filePath,
line: #line)
}

func testCommonSetOfFields() throws {
let breakage = BrokenSiteReport(
siteUrl: URL(string: "https://example.test/")!,
Expand Down Expand Up @@ -129,7 +138,7 @@ class WebsiteBreakageReportTests: XCTestCase {
APIRequest.Headers.setUserAgent("")
var params = parameters
params["test"] = "1"
let configuration = APIRequest.Configuration(url: URL.pixelUrl(forPixelNamed: GeneralPixel.brokenSiteReport.name),
let configuration = APIRequest.Configuration(url: URL.pixelUrl(forPixelNamed: NonStandardPixel.brokenSiteReport.name),
queryParameters: params,
allowedQueryReservedCharacters: BrokenSiteReport.allowedQueryReservedCharacters)
return configuration.request
Expand Down

0 comments on commit 6827bb3

Please sign in to comment.