Skip to content

Commit

Permalink
switch to true|false for protectionsState param
Browse files Browse the repository at this point in the history
  • Loading branch information
Shane Osbourne committed Nov 9, 2023
1 parent 910a4f8 commit f439d20
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 11 deletions.
13 changes: 4 additions & 9 deletions DuckDuckGo/BrokenSiteInfo.swift
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,6 @@ public struct BrokenSiteInfo {

static let allowedQueryReservedCharacters = CharacterSet(charactersIn: ",")

enum ProtectionsState: String {
case enabled = "1"
case disabled = "0"
}

private struct Keys {
static let url = "siteUrl"
static let category = "category"
Expand Down Expand Up @@ -60,14 +55,14 @@ public struct BrokenSiteInfo {
private let manufacturer: String
private let systemVersion: String
private let gpc: Bool
private let protectionsState: ProtectionsState
private let protectionsState: Bool

public init(url: URL?, httpsUpgrade: Bool,
blockedTrackerDomains: [String], installedSurrogates: [String],
isDesktop: Bool, tdsETag: String?,
ampUrl: String?,
urlParametersRemoved: Bool,
protected: Bool,
protectionsState: Bool,
model: String = UIDevice.current.model,
manufacturer: String = "Apple",
systemVersion: String = UIDevice.current.systemVersion,
Expand All @@ -84,7 +79,7 @@ public struct BrokenSiteInfo {
self.model = model
self.manufacturer = manufacturer
self.systemVersion = systemVersion
self.protectionsState = protected ? .enabled : .disabled
self.protectionsState = protectionsState

if let gpcParam = gpc {
self.gpc = gpcParam
Expand All @@ -111,7 +106,7 @@ public struct BrokenSiteInfo {
Keys.gpc: gpc ? "true" : "false",
Keys.ampUrl: ampUrl ?? "",
Keys.urlParametersRemoved: urlParametersRemoved ? "true" : "false",
Keys.protectionsState: protectionsState.rawValue
Keys.protectionsState: protectionsState ? "true" : "false"
]

Pixel.fire(pixel: .brokenSiteReport,
Expand Down
4 changes: 2 additions & 2 deletions DuckDuckGo/TabViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -868,7 +868,7 @@ class TabViewController: UIViewController {
let blockedTrackerDomains = privacyInfo?.trackerInfo.trackersBlocked.compactMap { $0.domain } ?? []

let configuration = ContentBlocking.shared.privacyConfigurationManager.privacyConfig
let protected = configuration.isFeature(.contentBlocking, enabledForDomain: url?.host)
let protectionsState = configuration.isFeature(.contentBlocking, enabledForDomain: url?.host)

return BrokenSiteInfo(url: url,
httpsUpgrade: httpsForced,
Expand All @@ -878,7 +878,7 @@ class TabViewController: UIViewController {
tdsETag: ContentBlocking.shared.contentBlockingManager.currentMainRules?.etag ?? "",
ampUrl: linkProtection.lastAMPURLString,
urlParametersRemoved: linkProtection.urlParametersRemoved,
protected: protected)
protectionsState: protectionsState)
}

public func print() {
Expand Down

0 comments on commit f439d20

Please sign in to comment.