diff --git a/DuckDuckGo/ContentBlocker/ClickToLoad/ClickToLoadRulesSplitter.swift b/DuckDuckGo/ContentBlocker/ClickToLoad/ClickToLoadRulesSplitter.swift index 2d9efd7905..036a0aada7 100644 --- a/DuckDuckGo/ContentBlocker/ClickToLoad/ClickToLoadRulesSplitter.swift +++ b/DuckDuckGo/ContentBlocker/ClickToLoad/ClickToLoadRulesSplitter.swift @@ -76,41 +76,6 @@ struct ClickToLoadRulesSplitter { cnames: originalTDS.cnames) } -// private func processCTLActions(_ trackers: [String: KnownTracker]) -> (mainTDS: [String: KnownTracker], ctlOverrides: [String: KnownTracker]) { -// var mainTDSTrackers = trackers -// var ctlTrackers: [String: KnownTracker] = [:] -// -// for (key, tracker) in mainTDSTrackers { -// if let rules = tracker.rules as [KnownTracker.Rule]? { -// var ctlRules: [KnownTracker.Rule] = [] -// -// for ruleIndex in rules.indices.reversed() { -// if let action = rules[ruleIndex].action, action == .blockCtlFB { -// var newRule = rules[ruleIndex] -// if newRule.surrogate != nil { -// // if rule includes a surroate, the action should be nil, as it gets converted to a redirect -// newRule.action = nil -// } else { -// newRule.action = .block -// } -// -// mainTDSTrackers[key]?.rules?.remove(at: ruleIndex) -// ctlRules.insert(newRule, at: 0) -// } -// } -// -// if !ctlRules.isEmpty { -// var ctlTracker = tracker -// ctlTracker.defaultAction = .ignore -// ctlTracker.rules = ctlRules -// ctlTrackers[key] = ctlTracker -// } -// } -// } -// -// return (mainTDSTrackers, ctlTrackers) -// } - private func filterTrackersWithoutCTLAction(_ trackers: [String: KnownTracker]) -> [String: KnownTracker] { trackers.filter { (_, tracker) in tracker.containsCTLActions == false } } @@ -118,37 +83,6 @@ struct ClickToLoadRulesSplitter { private func filterTrackersWithCTLAction(_ trackers: [String: KnownTracker]) -> [String: KnownTracker] { return Dictionary(uniqueKeysWithValues: trackers.filter { (_, tracker) in return tracker.containsCTLActions == true - }.map { (trackerKey, trackerValue) in - // Modify the tracker here - if let rules = trackerValue.rules as [KnownTracker.Rule]? { - let updatedRules = rules.map { (ruleValue) in - var action = ruleValue.action - if action == .blockCtlFB { - if ruleValue.surrogate != nil { - action = nil - } else { - action = .block - } - } - let newRule = KnownTracker.Rule(rule: ruleValue.rule, - surrogate: ruleValue.surrogate, - action: action, - options: ruleValue.options, - exceptions: ruleValue.exceptions) - return newRule - } - let updatedTracker = KnownTracker(domain: trackerValue.domain, - defaultAction: trackerValue.defaultAction, - owner: trackerValue.owner, - prevalence: trackerValue.prevalence, - subdomains: trackerValue.subdomains, - categories: trackerValue.categories, - rules: updatedRules) - - return (trackerKey, updatedTracker) - } - - return (trackerKey, trackerValue) }) } diff --git a/DuckDuckGo/ContentBlocker/ScriptSourceProviding.swift b/DuckDuckGo/ContentBlocker/ScriptSourceProviding.swift index dcdedc093a..72a553da3f 100644 --- a/DuckDuckGo/ContentBlocker/ScriptSourceProviding.swift +++ b/DuckDuckGo/ContentBlocker/ScriptSourceProviding.swift @@ -141,7 +141,7 @@ struct ScriptSourceProvider: ScriptSourceProviding { private func mergeTrackerDataSets(rules: [ContentBlockerRulesManager.Rules]) -> (trackerData: TrackerData, encodedTrackerData: String) { let tdsName = DefaultContentBlockerRulesListsSource.Constants.trackerDataSetRulesListName let tdsIndex = contentBlockingManager.currentRules.firstIndex(where: { $0.name == tdsName}) - + var combinedTrackers: [String: KnownTracker] = [:] var combinedEntities: [String: Entity] = [:] var combinedDomains: [String: String] = [:]