Skip to content

Commit

Permalink
Authv2 / Networking improvements (#3746)
Browse files Browse the repository at this point in the history
Task/Issue URL:
https://app.asana.com/0/1205842942115003/1209170372758735/f

**Description**:

Adoption of BSK 231.0.0 with the Authv2 Networking improvements
  • Loading branch information
federicocappelli authored Jan 27, 2025
1 parent 3c6dbaf commit 0e0b029
Show file tree
Hide file tree
Showing 25 changed files with 115 additions and 84 deletions.
42 changes: 1 addition & 41 deletions DuckDuckGo-macOS.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -1109,8 +1109,6 @@
37219B3B2CBFD4F300C9D7A8 /* NewTabPageSearchBoxExperiment+Logger.swift in Sources */ = {isa = PBXBuildFile; fileRef = 37219B392CBFD4F300C9D7A8 /* NewTabPageSearchBoxExperiment+Logger.swift */; };
37219B3D2CC27DB700C9D7A8 /* NewTabPageSearchBoxExperimentTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 37219B3C2CC27DB300C9D7A8 /* NewTabPageSearchBoxExperimentTests.swift */; };
37219B3E2CC27DB700C9D7A8 /* NewTabPageSearchBoxExperimentTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 37219B3C2CC27DB300C9D7A8 /* NewTabPageSearchBoxExperimentTests.swift */; };
372217802B3337FE00B8E9C2 /* TestUtils in Frameworks */ = {isa = PBXBuildFile; productRef = 3722177F2B3337FE00B8E9C2 /* TestUtils */; };
372217822B33380700B8E9C2 /* TestUtils in Frameworks */ = {isa = PBXBuildFile; productRef = 372217812B33380700B8E9C2 /* TestUtils */; };
37269EFB2B332F9E005E8E46 /* Common in Frameworks */ = {isa = PBXBuildFile; productRef = 37269EFA2B332F9E005E8E46 /* Common */; };
37269EFD2B332FAC005E8E46 /* Common in Frameworks */ = {isa = PBXBuildFile; productRef = 37269EFC2B332FAC005E8E46 /* Common */; };
37269EFF2B332FBB005E8E46 /* Common in Frameworks */ = {isa = PBXBuildFile; productRef = 37269EFE2B332FBB005E8E46 /* Common */; };
Expand Down Expand Up @@ -1325,7 +1323,6 @@
37FC2A192CF903080048E226 /* MockPrivacyStats.swift in Sources */ = {isa = PBXBuildFile; fileRef = 37FC2A172CF903060048E226 /* MockPrivacyStats.swift */; };
37FD78112A29EBD100B36DB1 /* SyncErrorHandler.swift in Sources */ = {isa = PBXBuildFile; fileRef = 37FD78102A29EBD100B36DB1 /* SyncErrorHandler.swift */; };
37FD78122A29EBD100B36DB1 /* SyncErrorHandler.swift in Sources */ = {isa = PBXBuildFile; fileRef = 37FD78102A29EBD100B36DB1 /* SyncErrorHandler.swift */; };
46066CBC2D1330A100AB683B /* Persistence in Frameworks */ = {isa = PBXBuildFile; productRef = 46066CBB2D1330A100AB683B /* Persistence */; };
467D16672D0C98D5007C020A /* CrashReportSenderExtensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 467D16662D0C98D5007C020A /* CrashReportSenderExtensions.swift */; };
467D16682D0C98D5007C020A /* CrashReportSenderExtensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 467D16662D0C98D5007C020A /* CrashReportSenderExtensions.swift */; };
4B0135CE2729F1AA00D54834 /* NSPasteboardExtension.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4B0135CD2729F1AA00D54834 /* NSPasteboardExtension.swift */; };
Expand Down Expand Up @@ -1967,8 +1964,6 @@
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 */; };
84BBC7FF2CFA0D2F00BAE57A /* TestUtils in Frameworks */ = {isa = PBXBuildFile; productRef = 84BBC7FE2CFA0D2F00BAE57A /* TestUtils */; };
84BBC8012CFA0D3800BAE57A /* TestUtils in Frameworks */ = {isa = PBXBuildFile; productRef = 84BBC8002CFA0D3800BAE57A /* TestUtils */; };
84C96E462CF9BB6400A80A01 /* malwareFilterSet.json in Resources */ = {isa = PBXBuildFile; fileRef = 84C96E442CF9BB6400A80A01 /* malwareFilterSet.json */; };
84C96E472CF9BB6400A80A01 /* malwareHashPrefixes.json in Resources */ = {isa = PBXBuildFile; fileRef = 84C96E452CF9BB6400A80A01 /* malwareHashPrefixes.json */; };
84C96E482CF9BB6400A80A01 /* malwareFilterSet.json in Resources */ = {isa = PBXBuildFile; fileRef = 84C96E442CF9BB6400A80A01 /* malwareFilterSet.json */; };
Expand Down Expand Up @@ -5084,7 +5079,6 @@
4BCBE45A2BA7E17800FC75A1 /* Subscription in Frameworks */,
B6EC37FF29B8D915001ACE79 /* Configuration in Frameworks */,
567A23C52C7F75BB0010F66C /* SpecialErrorPages in Frameworks */,
372217822B33380700B8E9C2 /* TestUtils in Frameworks */,
3706FCAA293F65D500E42796 /* UserScript in Frameworks */,
5641734D2CFE169400F4B716 /* PixelExperimentKit in Frameworks */,
85E2BBD02B8F534A00DBEC7A /* History in Frameworks */,
Expand All @@ -5107,7 +5101,6 @@
files = (
3706FE88293F661700E42796 /* OHHTTPStubs in Frameworks */,
F116A7C72BD1925500F3FCF7 /* PixelKitTestingUtilities in Frameworks */,
84BBC7FF2CFA0D2F00BAE57A /* TestUtils in Frameworks */,
B65CD8CF2B316E0200A595BB /* SnapshotTesting in Frameworks */,
9DC5FACD2C6B8E620011F068 /* AppKitExtensions in Frameworks */,
374EFDF12D01C70A00B30939 /* Utilities in Frameworks */,
Expand Down Expand Up @@ -5365,7 +5358,6 @@
37BA812D29B3CD690053F1A3 /* SyncUI in Frameworks */,
9D9DE5732C63AA0700D20B15 /* AppKitExtensions in Frameworks */,
F1DF95E72BD188B60045E591 /* LoginItems in Frameworks */,
372217802B3337FE00B8E9C2 /* TestUtils in Frameworks */,
CBECDB8A2CDBD616005B8B87 /* PageRefreshMonitor in Frameworks */,
7BA076BB2B65D61400D7FB72 /* NetworkProtectionProxy in Frameworks */,
4B4D60B12A0C83B900BCD287 /* NetworkProtectionUI in Frameworks */,
Expand All @@ -5379,10 +5371,8 @@
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
46066CBC2D1330A100AB683B /* Persistence in Frameworks */,
B6DA44172616C13800DD1EC2 /* OHHTTPStubs in Frameworks */,
F116A7C32BD1924B00F3FCF7 /* PixelKitTestingUtilities in Frameworks */,
84BBC8012CFA0D3800BAE57A /* TestUtils in Frameworks */,
B65CD8CB2B316DF100A595BB /* SnapshotTesting in Frameworks */,
9DC5FACB2C6B8E050011F068 /* AppKitExtensions in Frameworks */,
374EFDEF2D01C70300B30939 /* Utilities in Frameworks */,
Expand Down Expand Up @@ -10003,7 +9993,6 @@
37DF000629F9C061002B7D3E /* SyncDataProviders */,
9DC70B192AA1FA5B005A844B /* LoginItems */,
37269EFC2B332FAC005E8E46 /* Common */,
372217812B33380700B8E9C2 /* TestUtils */,
4BF97AD02B43C43F00EB4240 /* NetworkProtectionIPC */,
4BF97AD22B43C43F00EB4240 /* NetworkProtectionUI */,
4BF97AD42B43C43F00EB4240 /* NetworkProtection */,
Expand Down Expand Up @@ -10063,7 +10052,6 @@
F116A7C62BD1925500F3FCF7 /* PixelKitTestingUtilities */,
F1DA51A42BF6114200CF29FA /* SubscriptionTestingUtilities */,
9DC5FACC2C6B8E620011F068 /* AppKitExtensions */,
84BBC7FE2CFA0D2F00BAE57A /* TestUtils */,
374EFDF02D01C70A00B30939 /* Utilities */,
);
productName = DuckDuckGoTests;
Expand Down Expand Up @@ -10495,7 +10483,6 @@
7BA59C9A2AE18B49009A97B1 /* SystemExtensionManager */,
31A3A4E22B0C115F0021063C /* DataBrokerProtection */,
37269EFA2B332F9E005E8E46 /* Common */,
3722177F2B3337FE00B8E9C2 /* TestUtils */,
7BA076BA2B65D61400D7FB72 /* NetworkProtectionProxy */,
85E2BBCD2B8F534000DBEC7A /* History */,
1EA7B8D22B7E078C000330A4 /* SubscriptionUI */,
Expand Down Expand Up @@ -10551,9 +10538,7 @@
F116A7C22BD1924B00F3FCF7 /* PixelKitTestingUtilities */,
F1DA51A82BF6114C00CF29FA /* SubscriptionTestingUtilities */,
9DC5FACA2C6B8E050011F068 /* AppKitExtensions */,
84BBC8002CFA0D3800BAE57A /* TestUtils */,
374EFDEE2D01C70300B30939 /* Utilities */,
46066CBB2D1330A100AB683B /* Persistence */,
);
productName = DuckDuckGoTests;
productReference = AA585D90248FD31400E9A3E2 /* Unit Tests.xctest */;
Expand Down Expand Up @@ -15372,7 +15357,7 @@
repositoryURL = "https://github.com/duckduckgo/BrowserServicesKit";
requirement = {
kind = exactVersion;
version = 230.1.0;
version = 231.0.0;
};
};
9FF521422BAA8FF300B9819B /* XCRemoteSwiftPackageReference "lottie-spm" */ = {
Expand Down Expand Up @@ -15643,16 +15628,6 @@
package = 371D00DF29D8509400EC8598 /* XCRemoteSwiftPackageReference "OpenSSL-XCFramework" */;
productName = OpenSSL;
};
3722177F2B3337FE00B8E9C2 /* TestUtils */ = {
isa = XCSwiftPackageProductDependency;
package = 9807F643278CA16F00E1547B /* XCRemoteSwiftPackageReference "BrowserServicesKit" */;
productName = TestUtils;
};
372217812B33380700B8E9C2 /* TestUtils */ = {
isa = XCSwiftPackageProductDependency;
package = 9807F643278CA16F00E1547B /* XCRemoteSwiftPackageReference "BrowserServicesKit" */;
productName = TestUtils;
};
37269EFA2B332F9E005E8E46 /* Common */ = {
isa = XCSwiftPackageProductDependency;
package = 9807F643278CA16F00E1547B /* XCRemoteSwiftPackageReference "BrowserServicesKit" */;
Expand Down Expand Up @@ -15783,11 +15758,6 @@
package = 9807F643278CA16F00E1547B /* XCRemoteSwiftPackageReference "BrowserServicesKit" */;
productName = Navigation;
};
46066CBB2D1330A100AB683B /* Persistence */ = {
isa = XCSwiftPackageProductDependency;
package = 9807F643278CA16F00E1547B /* XCRemoteSwiftPackageReference "BrowserServicesKit" */;
productName = Persistence;
};
4B2D062B2A11C0E100DE1F49 /* Networking */ = {
isa = XCSwiftPackageProductDependency;
package = 9807F643278CA16F00E1547B /* XCRemoteSwiftPackageReference "BrowserServicesKit" */;
Expand Down Expand Up @@ -16035,16 +16005,6 @@
package = B6DA44152616C13800DD1EC2 /* XCRemoteSwiftPackageReference "OHHTTPStubs" */;
productName = OHHTTPStubsSwift;
};
84BBC7FE2CFA0D2F00BAE57A /* TestUtils */ = {
isa = XCSwiftPackageProductDependency;
package = 9807F643278CA16F00E1547B /* XCRemoteSwiftPackageReference "BrowserServicesKit" */;
productName = TestUtils;
};
84BBC8002CFA0D3800BAE57A /* TestUtils */ = {
isa = XCSwiftPackageProductDependency;
package = 9807F643278CA16F00E1547B /* XCRemoteSwiftPackageReference "BrowserServicesKit" */;
productName = TestUtils;
};
85D44B852BA08D29001B4AB5 /* Suggestions */ = {
isa = XCSwiftPackageProductDependency;
package = 9807F643278CA16F00E1547B /* XCRemoteSwiftPackageReference "BrowserServicesKit" */;
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" : "2ed8705a2e8a0ba6cb5253ccf3b2f73f98da6bb0",
"version" : "230.1.0"
"revision" : "81e09dafb4fe49745e38c7e36609270d3d367839",
"version" : "231.0.0"
}
},
{
Expand Down Expand Up @@ -72,6 +72,15 @@
"version" : "6.0.1"
}
},
{
"identity" : "jwt-kit",
"kind" : "remoteSourceControl",
"location" : "https://github.com/vapor/jwt-kit.git",
"state" : {
"revision" : "c2595b9ad7f512d7f334830b4df1fed6e917946a",
"version" : "4.13.4"
}
},
{
"identity" : "lottie-spm",
"kind" : "remoteSourceControl",
Expand Down Expand Up @@ -135,6 +144,24 @@
"version" : "1.4.0"
}
},
{
"identity" : "swift-asn1",
"kind" : "remoteSourceControl",
"location" : "https://github.com/apple/swift-asn1.git",
"state" : {
"revision" : "ae33e5941bb88d88538d0a6b19ca0b01e6c76dcf",
"version" : "1.3.1"
}
},
{
"identity" : "swift-crypto",
"kind" : "remoteSourceControl",
"location" : "https://github.com/apple/swift-crypto.git",
"state" : {
"revision" : "ff0f781cf7c6a22d52957e50b104f5768b50c779",
"version" : "3.10.0"
}
},
{
"identity" : "swift-snapshot-testing",
"kind" : "remoteSourceControl",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@

import Foundation
import NetworkProtection
import Common

extension Bundle {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@

import Foundation
import NetworkProtection
import Common

/// Implements convenience default for the client apps making use of this.
///
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import Foundation
import Subscription
import NetworkProtection
import NetworkProtectionUI
import os.log

final class NetworkProtectionSubscriptionEventHandler {

Expand Down Expand Up @@ -66,8 +67,7 @@ final class NetworkProtectionSubscriptionEventHandler {
}

guard let entitlements = notification.userInfo?[UserDefaultsCacheKey.subscriptionEntitlements] as? [Entitlement] else {

assertionFailure("Missing entitlements are truly unexpected")
Logger.networkProtection.error("Missing entitlements are truly unexpected")
return
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -293,7 +293,10 @@ final class UnifiedFeedbackFormViewModel: ObservableObject {
problemSubCategory: selectedSubcategory,
customMetadata: metadata?.toString() ?? "")
let headers = APIRequestV2.HeadersV2(additionalHeaders: [HTTPHeaderKey.authorization: "Bearer \(accessToken)"])
let request = APIRequestV2(url: Self.feedbackEndpoint, method: .post, headers: headers, body: payload.toData())
guard let request = APIRequestV2(url: Self.feedbackEndpoint, method: .post, headers: headers, body: payload.toData()) else {
assertionFailure("Invalid request")
return
}

let response: Response = try await apiService.fetch(request: request).decodeBody()
if let error = response.error, !error.isEmpty {
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: "230.1.0"),
.package(url: "https://github.com/duckduckgo/BrowserServicesKit", exact: "231.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: "230.1.0"),
.package(url: "https://github.com/duckduckgo/BrowserServicesKit", exact: "231.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/HistoryView/Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ let package = Package(
targets: ["HistoryView"]),
],
dependencies: [
.package(url: "https://github.com/duckduckgo/BrowserServicesKit", exact: "230.1.0"),
.package(url: "https://github.com/duckduckgo/BrowserServicesKit", exact: "231.0.0"),
.package(path: "../WebKitExtensions"),
.package(path: "../UserScriptActionsManager"),
.package(path: "../Utilities"),
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: "230.1.0"),
.package(url: "https://github.com/duckduckgo/BrowserServicesKit", exact: "231.0.0"),
.package(url: "https://github.com/airbnb/lottie-spm", exact: "4.4.3"),
.package(path: "../AppLauncher"),
.package(path: "../UDSHelper"),
Expand Down
4 changes: 2 additions & 2 deletions 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: "230.1.0"),
.package(url: "https://github.com/duckduckgo/BrowserServicesKit", exact: "231.0.0"),
.package(path: "../WebKitExtensions"),
.package(path: "../UserScriptActionsManager"),
.package(path: "../Utilities"),
Expand All @@ -46,7 +46,7 @@ let package = Package(
.product(name: "BrowserServicesKit", package: "BrowserServicesKit"),
.product(name: "PrivacyStats", package: "BrowserServicesKit"),
.product(name: "RemoteMessaging", package: "BrowserServicesKit"),
.product(name: "TestUtils", package: "BrowserServicesKit"),
.product(name: "PersistenceTestingUtils", package: "BrowserServicesKit"),
.product(name: "UserScript", package: "BrowserServicesKit"),
.product(name: "UserScriptActionsManager", package: "UserScriptActionsManager"),
.product(name: "WebKitExtensions", package: "WebKitExtensions"),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,10 +80,5 @@ extension NewTabPageDataModel {
struct FavoriteFavicon: Encodable, Equatable {
let maxAvailableSize: Int
let src: String

init(maxAvailableSize: Int, src: String) {
self.maxAvailableSize = maxAvailableSize
self.src = src
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

import Combine
import RemoteMessaging
import TestUtils
import PersistenceTestingUtils
import XCTest
@testable import NewTabPage

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
//

import Combine
import TestUtils
import PersistenceTestingUtils
import XCTest
@testable import NewTabPage

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
//

import Combine
import TestUtils
import PersistenceTestingUtils
import XCTest
@testable import NewTabPage

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

import Combine
import PrivacyStats
import TestUtils
import PersistenceTestingUtils
import TrackerRadarKit
import XCTest
@testable import NewTabPage
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

import Combine
import PrivacyStats
import TestUtils
import PersistenceTestingUtils
import TrackerRadarKit
import XCTest
@testable import NewTabPage
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: "230.1.0"),
.package(url: "https://github.com/duckduckgo/BrowserServicesKit", exact: "231.0.0"),
.package(path: "../SwiftUIExtensions"),
.package(path: "../FeatureFlags")
],
Expand Down
2 changes: 1 addition & 1 deletion LocalPackages/UserScriptActionsManager/Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ let package = Package(
targets: ["UserScriptActionsManager"]),
],
dependencies: [
.package(url: "https://github.com/duckduckgo/BrowserServicesKit", exact: "230.1.0"),
.package(url: "https://github.com/duckduckgo/BrowserServicesKit", exact: "231.0.0"),
],
targets: [
.target(
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: "230.1.0"),
.package(url: "https://github.com/duckduckgo/BrowserServicesKit", exact: "231.0.0"),
.package(path: "../AppKitExtensions")
],
targets: [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ import BrowserServicesKit
import Combine
import Foundation
import MaliciousSiteProtection
import TestUtils
import PersistenceTestingUtils
import NetworkingTestingUtils
import XCTest

@testable import DuckDuckGo_Privacy_Browser
Expand Down
Loading

0 comments on commit 0e0b029

Please sign in to comment.