Skip to content
This repository was archived by the owner on Feb 24, 2025. It is now read-only.

Commit 1c6b234

Browse files
authored
don't show red dot on major tracker networks (#1526)
1 parent 0738a8a commit 1c6b234

4 files changed

Lines changed: 7 additions & 19 deletions

File tree

‎DuckDuckGo.xcodeproj/project.pbxproj‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7406,7 +7406,7 @@
74067406
repositoryURL = "https://github.com/DuckDuckGo/BrowserServicesKit";
74077407
requirement = {
74087408
kind = exactVersion;
7409-
version = 48.1.1;
7409+
version = 49.0.0;
74107410
};
74117411
};
74127412
C14882EB27F211A000D59F0C /* XCRemoteSwiftPackageReference "SwiftSoup" */ = {

‎DuckDuckGo/PrivacyIconLogic.swift‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ final class PrivacyIconLogic {
3838
let config = ContentBlocking.shared.privacyConfigurationManager.privacyConfig
3939
let isUserUnprotected = config.isUserUnprotected(domain: privacyInfo.url.host)
4040

41-
let notFullyProtected = !privacyInfo.https || privacyInfo.isMajorTrackerNetwork || isUserUnprotected
41+
let notFullyProtected = !privacyInfo.https || isUserUnprotected
4242

4343
return notFullyProtected ? .shieldWithDot : .shield
4444
}

‎DuckDuckGoTests/PrivacyIconLogicTests.swift‎

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -72,30 +72,29 @@ class PrivacyIconLogicTests: XCTestCase {
7272

7373
func testPrivacyIconIsShieldWithDotForHTTP() {
7474
let url = PrivacyIconLogicTests.insecurePageURL
75-
let entity = Entity(displayName: "E", domains: [], prevalence: TrackerInfo.Constants.majorNetworkPrevalence - 1.0)
75+
let entity = Entity(displayName: "E", domains: [], prevalence: 1.0)
7676
let protectionStatus = ProtectionStatus(unprotectedTemporary: false, enabledFeatures: [], allowlisted: false, denylisted: false)
7777
let privacyInfo = PrivacyInfo(url: url, parentEntity: entity, protectionStatus: protectionStatus)
7878

7979
let icon = PrivacyIconLogic.privacyIcon(for: privacyInfo)
8080

8181
XCTAssertTrue(url.isHttp)
8282
XCTAssertFalse(privacyInfo.https)
83-
XCTAssertFalse(privacyInfo.isMajorTrackerNetwork)
8483
XCTAssertEqual(icon, .shieldWithDot)
8584
}
8685

87-
func testPrivacyIconIsShieldWithDotForMajorTrackerNetwork() {
86+
func testPrivacyIconIsShieldWithoutDotForMajorTrackerNetwork() {
8887
let url = PrivacyIconLogicTests.pageURL
89-
let entity = Entity(displayName: "E", domains: [], prevalence: TrackerInfo.Constants.majorNetworkPrevalence + 1.0)
88+
// We don't have constants for major tracker network now now so just use a huge, unlikely prevalence
89+
let entity = Entity(displayName: "E", domains: [], prevalence: 100.0)
9090
let protectionStatus = ProtectionStatus(unprotectedTemporary: false, enabledFeatures: [], allowlisted: false, denylisted: false)
9191
let privacyInfo = PrivacyInfo(url: url, parentEntity: entity, protectionStatus: protectionStatus)
9292

9393
let icon = PrivacyIconLogic.privacyIcon(for: privacyInfo)
9494

9595
XCTAssertTrue(url.isHttps)
9696
XCTAssertTrue(privacyInfo.https)
97-
XCTAssertTrue(privacyInfo.isMajorTrackerNetwork)
98-
XCTAssertEqual(icon, .shieldWithDot)
97+
XCTAssertEqual(icon, .shield)
9998
}
10099

101100
}

‎IntegrationTests/TrackerRadarIntegrationTests.swift‎

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -45,17 +45,6 @@ class TrackerRadarIntegrationTests: XCTestCase {
4545

4646
extension TrackerDataManager {
4747

48-
func assertIsMajorTracker(domain: String, file: StaticString = #file, line: UInt = #line) {
49-
guard let tds = fetchedData?.tds else {
50-
XCTFail("No TDS found")
51-
return
52-
}
53-
54-
let entity = tds.findEntity(forHost: domain)
55-
XCTAssertNotNil(entity, "no entity found for domain \(domain)", file: file, line: line)
56-
XCTAssertGreaterThan(entity?.prevalence ?? 0, TrackerInfo.Constants.majorNetworkPrevalence, file: file, line: line)
57-
}
58-
5948
func assertEntityAndDomainLookups(file: StaticString = #file, line: UInt = #line) {
6049
guard let tds = fetchedData?.tds else {
6150
XCTFail("No TDS found")

0 commit comments

Comments
 (0)