Skip to content

Commit

Permalink
Merge release/1.112.0 into main
Browse files Browse the repository at this point in the history
  • Loading branch information
daxmobile authored Oct 29, 2024
2 parents 2b14de1 + 34341be commit 5488984
Show file tree
Hide file tree
Showing 8 changed files with 106 additions and 9 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 = 290
CURRENT_PROJECT_VERSION = 291
12 changes: 9 additions & 3 deletions DuckDuckGo.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,8 @@
1DFAB5232A8983E100A0F7F6 /* SetExtensionTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1DFAB51F2A89830D00A0F7F6 /* SetExtensionTests.swift */; };
1E0C72062ABC63BD00802009 /* SubscriptionPagesUserScript.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1E0C72052ABC63BD00802009 /* SubscriptionPagesUserScript.swift */; };
1E0C72072ABC63BD00802009 /* SubscriptionPagesUserScript.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1E0C72052ABC63BD00802009 /* SubscriptionPagesUserScript.swift */; };
1E25A4FE2CC937120080EFD4 /* SubscriptionCookieManageEventPixelMapping.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1E25A4FD2CC937120080EFD4 /* SubscriptionCookieManageEventPixelMapping.swift */; };
1E25A4FF2CC9408A0080EFD4 /* SubscriptionCookieManageEventPixelMapping.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1E25A4FD2CC937120080EFD4 /* SubscriptionCookieManageEventPixelMapping.swift */; };
1E2BEAE42C8B00B5002741A3 /* SubscriptionPagesUseSubscriptionFeatureTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1E2BEAE32C8B00B5002741A3 /* SubscriptionPagesUseSubscriptionFeatureTests.swift */; };
1E2BEAE52C8B00B5002741A3 /* SubscriptionPagesUseSubscriptionFeatureTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1E2BEAE32C8B00B5002741A3 /* SubscriptionPagesUseSubscriptionFeatureTests.swift */; };
1E559BB12BBCA9F1002B4AF6 /* RedirectNavigationResponder.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1E559BB02BBCA9F1002B4AF6 /* RedirectNavigationResponder.swift */; };
Expand Down Expand Up @@ -1852,10 +1854,10 @@
84537A092C99C203008723BC /* DeallocationTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = B6C2C9EE276081AB005B7F0A /* DeallocationTests.swift */; };
848648A12C76F4B20082282D /* BookmarksBarMenuViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 848648A02C76F4B20082282D /* BookmarksBarMenuViewController.swift */; };
848648A22C76F4B20082282D /* BookmarksBarMenuViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 848648A02C76F4B20082282D /* BookmarksBarMenuViewController.swift */; };
84B49F0D2CB10F0900FF08BB /* OHHTTPStubs in Frameworks */ = {isa = PBXBuildFile; productRef = 84B49F0C2CB10F0900FF08BB /* OHHTTPStubs */; };
84B49F0F2CB10F0900FF08BB /* OHHTTPStubsSwift in Frameworks */ = {isa = PBXBuildFile; productRef = 84B49F0E2CB10F0900FF08BB /* OHHTTPStubsSwift */; };
84B479082CCA7A3E00F40329 /* Logger+UnitTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 84B479072CCA7A3900F40329 /* Logger+UnitTests.swift */; };
84B479092CCA7A3E00F40329 /* Logger+UnitTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 84B479072CCA7A3900F40329 /* Logger+UnitTests.swift */; };
84B49F0D2CB10F0900FF08BB /* OHHTTPStubs in Frameworks */ = {isa = PBXBuildFile; productRef = 84B49F0C2CB10F0900FF08BB /* OHHTTPStubs */; };
84B49F0F2CB10F0900FF08BB /* OHHTTPStubsSwift in Frameworks */ = {isa = PBXBuildFile; productRef = 84B49F0E2CB10F0900FF08BB /* OHHTTPStubsSwift */; };
84DC715A2C1C1E9000033B8C /* UserDefaultsWrapperTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 84DC71582C1C1E8A00033B8C /* UserDefaultsWrapperTests.swift */; };
84DC715B2C1C1E9000033B8C /* UserDefaultsWrapperTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 84DC71582C1C1E8A00033B8C /* UserDefaultsWrapperTests.swift */; };
84DDB90A2C92B66E008C997B /* WKVisitedLinkStoreWrapper.swift in Sources */ = {isa = PBXBuildFile; fileRef = 84DDB9092C92B667008C997B /* WKVisitedLinkStoreWrapper.swift */; };
Expand Down Expand Up @@ -3381,6 +3383,7 @@
1DFAB51C2A8982A600A0F7F6 /* SetExtension.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SetExtension.swift; sourceTree = "<group>"; };
1DFAB51F2A89830D00A0F7F6 /* SetExtensionTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SetExtensionTests.swift; sourceTree = "<group>"; };
1E0C72052ABC63BD00802009 /* SubscriptionPagesUserScript.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SubscriptionPagesUserScript.swift; sourceTree = "<group>"; };
1E25A4FD2CC937120080EFD4 /* SubscriptionCookieManageEventPixelMapping.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SubscriptionCookieManageEventPixelMapping.swift; sourceTree = "<group>"; };
1E2BEAE32C8B00B5002741A3 /* SubscriptionPagesUseSubscriptionFeatureTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SubscriptionPagesUseSubscriptionFeatureTests.swift; sourceTree = "<group>"; };
1E559BB02BBCA9F1002B4AF6 /* RedirectNavigationResponder.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RedirectNavigationResponder.swift; sourceTree = "<group>"; };
1E7E2E8F29029A2A00C01B54 /* ContentBlockingRulesUpdateObserver.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ContentBlockingRulesUpdateObserver.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -9492,6 +9495,7 @@
F1D042982BFBABA100A31506 /* SubscriptionManager+StandardConfiguration.swift */,
F1DA51852BF607D200CF29FA /* SubscriptionRedirectManager.swift */,
F1FDC9372BF51F41006B1435 /* VPNSettings+Environment.swift */,
1E25A4FD2CC937120080EFD4 /* SubscriptionCookieManageEventPixelMapping.swift */,
);
path = Subscription;
sourceTree = "<group>";
Expand Down Expand Up @@ -11155,6 +11159,7 @@
3706FB65293F65D500E42796 /* PrivacyDashboardWebView.swift in Sources */,
372BC2A22A4AFA47001D8FD5 /* SyncCredentialsAdapter.swift in Sources */,
3706FB66293F65D500E42796 /* AppearancePreferences.swift in Sources */,
1E25A4FF2CC9408A0080EFD4 /* SubscriptionCookieManageEventPixelMapping.swift in Sources */,
844D7DA52C9443EA00BE61D4 /* NSPrintInfoExtension.swift in Sources */,
3706FB67293F65D500E42796 /* DownloadListCoordinator.swift in Sources */,
C172E7382C93968E00521D9A /* SyncPromoPixelKitEvent.swift in Sources */,
Expand Down Expand Up @@ -12664,6 +12669,7 @@
B69B503A2726A12500758A2B /* StatisticsLoader.swift in Sources */,
37CD54C927F2FDD100F1F7B9 /* DataClearingPreferences.swift in Sources */,
B6F1C80B2761C45400334924 /* LocalUnprotectedDomains.swift in Sources */,
1E25A4FE2CC937120080EFD4 /* SubscriptionCookieManageEventPixelMapping.swift in Sources */,
B69A14FA2B4D705D00B9417D /* BookmarkFolderPicker.swift in Sources */,
1D36E658298AA3BA00AA485D /* InternalUserDeciderStore.swift in Sources */,
B634DBE5293C944700C3C99E /* NewWindowPolicy.swift in Sources */,
Expand Down Expand Up @@ -14670,7 +14676,7 @@
repositoryURL = "https://github.com/duckduckgo/BrowserServicesKit";
requirement = {
kind = exactVersion;
version = 200.3.0;
version = 201.0.0;
};
};
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" : "44d747d56bc73cb74de0e9d7127314ea30eca371",
"version" : "200.3.0"
"revision" : "e5946eee6af859690cc1cc5e51daef3c8368981b",
"version" : "201.0.0"
}
},
{
Expand Down
9 changes: 9 additions & 0 deletions DuckDuckGo/Application/AppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ final class AppDelegate: NSObject, NSApplicationDelegate {

public let subscriptionManager: SubscriptionManager
public let subscriptionUIHandler: SubscriptionUIHandling
public let subscriptionCookieManager: SubscriptionCookieManaging

// MARK: - Freemium DBP
public let freemiumDBPFeature: FreemiumDBPFeature
Expand Down Expand Up @@ -272,6 +273,10 @@ final class AppDelegate: NSObject, NSApplicationDelegate {
return WindowControllersManager.shared
})

subscriptionCookieManager = SubscriptionCookieManager(subscriptionManager: subscriptionManager, currentCookieStore: {
WKWebsiteDataStore.default().httpCookieStore
}, eventMapping: SubscriptionCookieManageEventPixelMapping())

// Update VPN environment and match the Subscription environment
vpnSettings.alignTo(subscriptionEnvironment: subscriptionManager.currentEnvironment)

Expand Down Expand Up @@ -481,6 +486,10 @@ final class AppDelegate: NSObject, NSApplicationDelegate {
Task { @MainActor in
await vpnRedditSessionWorkaround.installRedditSessionWorkaround()
}

Task { @MainActor in
await subscriptionCookieManager.refreshSubscriptionCookie()
}
}

func applicationDidResignActive(_ notification: Notification) {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
//
// SubscriptionCookieManageEventPixelMapping.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 Common
import PixelKit
import Subscription

enum SubscriptionCookieManagerPixel: PixelKitEventV2 {

case missingTokenOnSignIn
case missingCookieOnSignOut
case cookieRefreshedWithUpdate
case cookieRefreshedWithDelete
case failedToSetSubscriptionCookie

var name: String {
switch self {
case .missingTokenOnSignIn:
return "m_mac_privacy-pro_subscription-cookie-missing_token_on_sign_in"
case .missingCookieOnSignOut:
return "m_mac_privacy-pro_subscription-cookie-missing_cookie_on_sign_out"
case .cookieRefreshedWithUpdate:
return "m_mac_privacy-pro_subscription-cookie-refreshed_with_update"
case .cookieRefreshedWithDelete:
return "m_mac_privacy-pro_subscription-cookie-refreshed_with_delete"
case .failedToSetSubscriptionCookie:
return "m_mac_privacy-pro_subscription-cookie-failed_to_set_subscription_cookie"
}
}

var error: (any Error)? {
return nil
}

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

public final class SubscriptionCookieManageEventPixelMapping: EventMapping<SubscriptionCookieManagerEvent> {

public init() {
super.init { event, _, _, _ in
let pixel: SubscriptionCookieManagerPixel = {
switch event {
case .errorHandlingAccountDidSignInTokenIsMissing:
return .missingTokenOnSignIn
case .errorHandlingAccountDidSignOutCookieIsMissing:
return .missingCookieOnSignOut
case .subscriptionCookieRefreshedWithUpdate:
return .cookieRefreshedWithUpdate
case .subscriptionCookieRefreshedWithDelete:
return .cookieRefreshedWithDelete
case .failedToSetSubscriptionCookie:
return .failedToSetSubscriptionCookie
}
}()

PixelKit.fire(pixel)
}
}

override init(mapping: @escaping EventMapping<SubscriptionCookieManagerEvent>.Mapping) {
fatalError("Use init()")
}
}
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: "200.3.0"),
.package(url: "https://github.com/duckduckgo/BrowserServicesKit", exact: "201.0.0"),
.package(path: "../SwiftUIExtensions"),
.package(path: "../XPCHelper"),
.package(path: "../Freemium"),
Expand Down
2 changes: 1 addition & 1 deletion LocalPackages/NetworkProtectionMac/Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ let package = Package(
.library(name: "VPNAppLauncher", targets: ["VPNAppLauncher"]),
],
dependencies: [
.package(url: "https://github.com/duckduckgo/BrowserServicesKit", exact: "200.3.0"),
.package(url: "https://github.com/duckduckgo/BrowserServicesKit", exact: "201.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/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: "200.3.0"),
.package(url: "https://github.com/duckduckgo/BrowserServicesKit", exact: "201.0.0"),
.package(path: "../SwiftUIExtensions")
],
targets: [
Expand Down

0 comments on commit 5488984

Please sign in to comment.