From 906ccd4f7d09a710843ef1f8192a62820e565157 Mon Sep 17 00:00:00 2001 From: Alexey Martemyanov Date: Thu, 28 Nov 2024 23:22:57 +0500 Subject: [PATCH] Malware protection 2: API Client refactoring (#3595) Task/Issue URL: https://app.asana.com/0/481882893211075/1208033567421351/f BSK PR: https://github.com/duckduckgo/BrowserServicesKit/pull/1092 **Description**: - Refactor APIClient to use Networking.APIRequestV2; implement generic request/response (BSK) **Optional E2E tests**: - [ ] Run PIR E2E tests Check this to run the Personal Information Removal end to end tests. If updating CCF, or any PIR related code, tick this. **Steps to test this PR**: 1. Validate Phishing Protection change sets and Match API calls work as before **Definition of Done**: * [ ] Does this PR satisfy our [Definition of Done](https://app.asana.com/0/1202500774821704/1207634633537039/f)? --- ###### Internal references: [Pull Request Review Checklist](https://app.asana.com/0/1202500774821704/1203764234894239/f) [Software Engineering Expectations](https://app.asana.com/0/59792373528535/199064865822552) [Technical Design Template](https://app.asana.com/0/59792373528535/184709971311943) [Pull Request Documentation](https://app.asana.com/0/1202500774821704/1204012835277482/f) --- DuckDuckGo.xcodeproj/project.pbxproj | 2 +- .../project.xcworkspace/xcshareddata/swiftpm/Package.resolved | 2 +- .../MaliciousSiteProtectionManager.swift | 3 +-- 3 files changed, 3 insertions(+), 4 deletions(-) diff --git a/DuckDuckGo.xcodeproj/project.pbxproj b/DuckDuckGo.xcodeproj/project.pbxproj index 30b1e7100e..b8c5fa528a 100644 --- a/DuckDuckGo.xcodeproj/project.pbxproj +++ b/DuckDuckGo.xcodeproj/project.pbxproj @@ -15211,7 +15211,7 @@ repositoryURL = "https://github.com/duckduckgo/BrowserServicesKit"; requirement = { kind = revision; - revision = 180ecc6148ee63ef2d454783099a8ee73159b73a; + revision = b2bdcc7fedf176fbf167d17bd76e25e488e71b86; }; }; 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 ae9be75447..dc2283cbb9 100644 --- a/DuckDuckGo.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved +++ b/DuckDuckGo.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved @@ -32,7 +32,7 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/duckduckgo/BrowserServicesKit", "state" : { - "revision" : "180ecc6148ee63ef2d454783099a8ee73159b73a" + "revision" : "b2bdcc7fedf176fbf167d17bd76e25e488e71b86" } }, { diff --git a/DuckDuckGo/MaliciousSiteProtection/MaliciousSiteProtectionManager.swift b/DuckDuckGo/MaliciousSiteProtection/MaliciousSiteProtectionManager.swift index 9504037703..51830a331a 100644 --- a/DuckDuckGo/MaliciousSiteProtection/MaliciousSiteProtectionManager.swift +++ b/DuckDuckGo/MaliciousSiteProtection/MaliciousSiteProtectionManager.swift @@ -49,7 +49,7 @@ public class MaliciousSiteProtectionManager: MaliciousSiteDetecting { filterSetDataSHA: String = "517e610cd7c304f91ff5aaee91d570f7b6e678dbe9744e00cdb0a3126068432f", hashPrefixURL: URL = Bundle.main.url(forResource: "phishingHashPrefixes", withExtension: "json")!, hashPrefixDataSHA: String = "05075ab14302a9e0329fbc0ba7e4e3118d7fa37846ec087c3942cfb1be92ffe0", - apiClient: MaliciousSiteProtection.APIClientProtocol? = nil, + apiClient: MaliciousSiteProtection.APIClientProtocol = .production, embeddedDataProvider: MaliciousSiteProtection.EmbeddedDataProviding? = nil, dataManager: MaliciousSiteProtection.DataManaging? = nil, detector: MaliciousSiteProtection.MaliciousSiteDetecting? = nil, @@ -76,7 +76,6 @@ public class MaliciousSiteProtectionManager: MaliciousSiteDetecting { hashPrefixDataSHA: hashPrefixDataSHA ) - let apiClient = apiClient ?? MaliciousSiteProtection.APIClient(environment: .production) let dataManager = dataManager ?? MaliciousSiteProtection.DataManager(embeddedDataProvider: embeddedDataProvider) self.detector = detector ?? MaliciousSiteDetector(apiClient: apiClient, dataManager: dataManager, eventMapping: Self.debugEvents)