Skip to content

Commit

Permalink
Malware protection 2: API Client refactoring (#3595)
Browse files Browse the repository at this point in the history
Task/Issue URL:
https://app.asana.com/0/481882893211075/1208033567421351/f
BSK PR: duckduckgo/BrowserServicesKit#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

<!--
Tagging instructions
If this PR isn't ready to be merged for whatever reason it should be
marked with the `DO NOT MERGE` label (particularly if it's a draft)
If it's pending Product Review/PFR, please add the `Pending Product
Review` label.

If at any point it isn't actively being worked on/ready for
review/otherwise moving forward (besides the above PR/PFR exception)
strongly consider closing it (or not opening it in the first place). If
you decide not to close it, make sure it's labelled to make it clear the
PRs state and comment with more information.
-->

**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)
  • Loading branch information
mallexxx authored Nov 28, 2024
1 parent aca479c commit 906ccd4
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 4 deletions.
2 changes: 1 addition & 1 deletion DuckDuckGo.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -15211,7 +15211,7 @@
repositoryURL = "https://github.com/duckduckgo/BrowserServicesKit";
requirement = {
kind = revision;
revision = 180ecc6148ee63ef2d454783099a8ee73159b73a;
revision = b2bdcc7fedf176fbf167d17bd76e25e488e71b86;
};
};
9FF521422BAA8FF300B9819B /* XCRemoteSwiftPackageReference "lottie-spm" */ = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
"kind" : "remoteSourceControl",
"location" : "https://github.com/duckduckgo/BrowserServicesKit",
"state" : {
"revision" : "180ecc6148ee63ef2d454783099a8ee73159b73a"
"revision" : "b2bdcc7fedf176fbf167d17bd76e25e488e71b86"
}
},
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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)
Expand Down

0 comments on commit 906ccd4

Please sign in to comment.