Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DIA-2030 add support to USNat #510

Merged
merged 111 commits into from
Jan 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
111 commits
Select commit Hold shift + click to select a range
cc29fde
change environment to stage by default
andresilveirah Nov 2, 2023
84ccb68
skip UI and other targets tests
andresilveirah Nov 2, 2023
a524850
add usnat to MetaData request and response
andresilveirah Nov 2, 2023
4e43b81
implement SPUSNatConsent class and add it to SPUserData
andresilveirah Nov 2, 2023
8bb63cb
handle usnat meta-data request/response on spcoordinator
andresilveirah Nov 2, 2023
5e646b9
fix typo on SPUserData
andresilveirah Nov 3, 2023
bd229b7
remove version from metadata response
andresilveirah Nov 3, 2023
e480e7b
Merge pull request #508 from SourcePointUSA/DIA_2621_add_usnat_to_met…
andresilveirah Nov 3, 2023
e75e3c6
move CampaignConsent to its own file
andresilveirah Nov 6, 2023
428e09c
move LastMessageData to its own file
andresilveirah Nov 6, 2023
84cd8aa
implement custom test matchers for SPDate
andresilveirah Nov 6, 2023
9faa4cd
implement convenience init for consent classes from MessagesResponse
andresilveirah Nov 6, 2023
515f889
add new SPCampaignType .usnat
andresilveirah Nov 6, 2023
9941eb9
add usnat campaign type to messages request
andresilveirah Nov 6, 2023
f74274e
update SPUSNatConsent with more consent data attributes
andresilveirah Nov 6, 2023
7393395
add usnat campaign type to messages response
andresilveirah Nov 6, 2023
56430b8
update state with usnat on messages response
andresilveirah Nov 6, 2023
e388e60
add back ios14 lastMessageData
andresilveirah Nov 6, 2023
0ad3e2e
update spDate custom matcher comment
andresilveirah Nov 6, 2023
1149575
add hasLocalData and status to usnat messages request
andresilveirah Nov 7, 2023
6a109f1
add consentStatus to SPUSNatConsent
andresilveirah Nov 6, 2023
727bf73
remove default values of ConsentStatus class
andresilveirah Nov 6, 2023
6b73e76
add usnat to pvData request / response
andresilveirah Nov 6, 2023
bcdbdd7
send usnat pvData on coordinator loadMessages
andresilveirah Nov 6, 2023
cba51e1
Merge pull request #513 from SourcePointUSA/DIA-2622_add_usnat_to_mes…
andresilveirah Nov 7, 2023
9c442b6
Merge pull request #514 from SourcePointUSA/DIA-2623_add_usnat_to_pvdata
andresilveirah Nov 7, 2023
459df19
Merge branch 'develop' into DIA-2030_add_support_to_usnat
andresilveirah Nov 8, 2023
fd6de5b
replace messages request usnat status with consentStatus
andresilveirah Nov 8, 2023
81b5263
add vendorListId key to USNatMetadata state
andresilveirah Nov 8, 2023
a47a3ab
implement USNatChoice request and response
andresilveirah Nov 8, 2023
93ab0af
add choice usnat url to Constants
andresilveirah Nov 8, 2023
e31a553
implement postUSNatAction on SpClient
andresilveirah Nov 8, 2023
aaa7a74
update uuid on reportIdfaStatus
andresilveirah Nov 8, 2023
5c417bb
implement usnat reportAction on SPCoordinator
andresilveirah Nov 8, 2023
9853d14
deal with usnat campaign type on SPConsentManager.report
andresilveirah Nov 8, 2023
3fb71b5
rename _id to vendorListId on metadata and save its value
andresilveirah Nov 9, 2023
46659de
change example app temporary to test usnat
andresilveirah Nov 9, 2023
06f5e93
Merge pull request #516 from SourcePointUSA/DIA-2624_add_usnat_to_pos…
andresilveirah Nov 9, 2023
72c9a71
add usnat to consent-status request and response
andresilveirah Nov 9, 2023
2d59195
revert mapping from Messages.Consent to Consent classes
andresilveirah Nov 9, 2023
c8ee717
update needsNewConsentData method with usnat
andresilveirah Nov 9, 2023
ae09c9f
hardcode false as hasConsentData on consent-status call
andresilveirah Nov 9, 2023
c7207d1
add usnat campaign to consent-status call on coordinator
andresilveirah Nov 9, 2023
5f6ab02
update coordinator tests with usnat call and authenticated consent
andresilveirah Nov 9, 2023
150a17c
Merge pull request #518 from SourcePointUSA/DIA-2625_add_usnat_to_con…
andresilveirah Nov 10, 2023
a30991f
refactor JSReceiver to include pmUrl for usnat
andresilveirah Nov 9, 2023
68ba3e7
implement loadUSNatPrivacyManager method
andresilveirah Nov 10, 2023
e687256
refactored Example App to include usnat
andresilveirah Nov 10, 2023
617f713
add expirationDate to SPUSNatConsent
andresilveirah Nov 10, 2023
1258fc7
remove consentStatus Campaign response
andresilveirah Nov 10, 2023
7fcab4b
add new attributes to CosnentStatus and GranularStatus
andresilveirah Nov 10, 2023
15f929e
implement test for usnat consent expiration
andresilveirah Nov 10, 2023
2d08f9e
Merge pull request #519 from SourcePointUSA/DIA-2989_handle_pm_for_usnat
andresilveirah Nov 10, 2023
c829bae
Add GPP support
tom-win87 Nov 28, 2023
63c2c1c
Merge pull request #520 from SourcePointUSA/DIA-3007_handle_consent_e…
andresilveirah Nov 30, 2023
62715ca
Merge branch 'develop' into DIA-2030_add_support_to_usnat
andresilveirah Dec 1, 2023
95b0f2d
Merge branch 'develop' into DIA-2030_add_support_to_usnat
andresilveirah Dec 1, 2023
1b76f51
revert stage urls back to prod
andresilveirah Dec 4, 2023
76e1e2f
refactor url tests to work with either prod or preprod urls
andresilveirah Dec 4, 2023
f04f8ec
use preprod property and urls
andresilveirah Dec 4, 2023
a9f4fef
change usnat consentString to consentStrings
andresilveirah Dec 4, 2023
a39110f
refactor tests and code cleanup
andresilveirah Dec 4, 2023
6430def
skip authid test for usnat
andresilveirah Dec 4, 2023
069d9bf
Merge pull request #523 from SourcePointUSA/DIA-3210_update_consentSt…
andresilveirah Dec 5, 2023
f8beb58
remove GPPConfig from IncludeData and refactor it
andresilveirah Dec 5, 2023
28b7d4e
Merge pull request #524 from SourcePointUSA/remove_gpp_config
andresilveirah Dec 5, 2023
30dee93
refactor PM url code to improve tests
andresilveirah Dec 5, 2023
d6bd825
add GPPData to SPUSNatConsent
andresilveirah Dec 5, 2023
edbc47a
add GPPData to USNat responses
andresilveirah Dec 5, 2023
d002ad6
handle usnat GPPData on SPCoordinator
andresilveirah Dec 5, 2023
6637462
store usnat GPPData on SPConsentManager
andresilveirah Dec 5, 2023
82d8bda
implement reconsent logic based on additionsChangeDate
andresilveirah Dec 5, 2023
a9ca4f6
Merge pull request #526 from SourcePointUSA/DIA-3008_handle_reconsent
andresilveirah Dec 6, 2023
1da7074
Merge pull request #525 from SourcePointUSA/DIA-3211_store_GPPData
andresilveirah Dec 6, 2023
dc0e1be
rename metadata gdpr _id to vendorListId
andresilveirah Dec 8, 2023
9968a88
add applicableSections to MetaDataResponse.USNat
andresilveirah Dec 8, 2023
4c4d6c2
call consent-status if usnat applicableSections changes
andresilveirah Dec 8, 2023
4ff558e
change tests fail error message
andresilveirah Dec 8, 2023
25a0ee3
update needsNewUSNatData comment
andresilveirah Dec 8, 2023
b6d54a8
Merge pull request #528 from SourcePointUSA/DIA-3187_handle_state_con…
andresilveirah Dec 8, 2023
a283954
refactor consent-status metadata param
andresilveirah Dec 11, 2023
68ac629
add transitionCCPAuth to SPCampaign
andresilveirah Dec 11, 2023
1317490
implement ccpa transition logic on spcoordinator
andresilveirah Dec 11, 2023
ffe93ed
refactor tests related to spclient mock
andresilveirah Dec 11, 2023
efc1e53
call pv-data only for campaigns in the config
andresilveirah Dec 11, 2023
9e86fbe
stop calling consent-status for fresh installs (localVersion == nil)
andresilveirah Dec 11, 2023
4957de6
fix transitionCCPAUSNat logic
andresilveirah Dec 11, 2023
3549cb8
added CCPA transition to USNat section to README
andresilveirah Dec 11, 2023
6f1f5f4
Update README.md
andresilveirah Dec 12, 2023
fa25d55
Merge pull request #522 from SourcePointUSA/tom-win87-patch-1
andresilveirah Dec 12, 2023
64048d8
fix SPClientCoordinatorSpec ccpa transfer test
andresilveirah Dec 13, 2023
003d1ff
Merge pull request #529 from SourcePointUSA/DIA-3249_handle_ccpa_optouts
andresilveirah Dec 13, 2023
afaf317
point SDK to preprod
andresilveirah Dec 18, 2023
50a336a
point SDK to preprod
andresilveirah Dec 18, 2023
5f62ad4
Add link to onError codes
tom-win87 Dec 20, 2023
a919796
Merge branch 'develop' into DIA-2030_add_support_to_usnat
andresilveirah Jan 10, 2024
808e2bf
used prod campaign for usnat and refactored coordinator tests
andresilveirah Jan 16, 2024
4de756f
pointed SDK back to prod
andresilveirah Jan 16, 2024
2064972
fix linting warnings
andresilveirah Jan 18, 2024
64de9fb
synchronize UserDefaults whenever saving spState
andresilveirah Jan 18, 2024
ab96161
fix build for Objc implementations
andresilveirah Jan 18, 2024
625c656
fix UI tests for native PM app
andresilveirah Jan 18, 2024
530d1b6
fix UI tests for sample app
andresilveirah Jan 18, 2024
d5136e3
update pods
andresilveirah Jan 18, 2024
afb0fdf
Merge pull request #542 from SourcePointUSA/point_SDK_to_prod
andresilveirah Jan 18, 2024
4cb72fe
Merge branch 'develop' into DIA-2030_add_support_to_usnat
andresilveirah Jan 18, 2024
6905f73
re-enable ui tests on gh actions
andresilveirah Jan 18, 2024
0544e0a
fix build via commandline tools
andresilveirah Jan 18, 2024
f8f2cb3
add GPPConfig back to IncludeData
andresilveirah Jan 18, 2024
e50e0ee
fix issue with SPOptinalBool
andresilveirah Jan 18, 2024
ef1913d
fix issue with SPOptinalBool
andresilveirah Jan 18, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/swift.yml
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ jobs:
if: failure()
name: Upload NativePMExampleApp tests results
with:
path: /Users/runner/Library/Developer/Xcode/DerivedData/**/*.xcresult
path: /Users/runner/Library/Developer/Xcode/DerivedData/**/*.xcresult
# MetaApp:
# runs-on: macos-12
# steps:
Expand All @@ -105,4 +105,4 @@ jobs:
# if: failure()
# name: Upload SourcePointMetaApp tests results
# with:
# path: /Users/runner/Library/Developer/Xcode/DerivedData/**/*.xcresult
# path: /Users/runner/Library/Developer/Xcode/DerivedData/**/*.xcresult
8 changes: 5 additions & 3 deletions ConsentViewController/Assets/javascript/SPJSReceiver.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ var getActionFromMessage = function (eventData) {
return {
id: String(choiceData.choice_id),
type: choiceData.type,
pm_url: choiceData.iframe_url,
pmUrl: choiceData.pmUrl || choiceData.iframe_url,
consentLanguage: eventData.consentLanguage,
customActionId: choiceData.customAction
};
Expand All @@ -66,7 +66,8 @@ var handleMessageEvent = function(SDK) {
type: eventData.actionType,
payload: eventData.payload,
consentLanguage: eventData.consentLanguage,
customActionId: eventData.customAction
customActionId: eventData.customAction,
pmUrl: eventData.pmUrl
}) :
SDK.onAction(getActionFromMessage(eventData));
break;
Expand Down Expand Up @@ -107,7 +108,8 @@ var handleMessageOrPMEvent = function (SDK) {
actionType: data.actionType,
payload: data.payload || data.actions || {},
consentLanguage: data.consentLanguage,
customAction: data.customAction
customAction: data.customAction,
pmUrl: data.iframe_url
});
} catch (error) {
SDK.onError(error);
Expand Down
14 changes: 14 additions & 0 deletions ConsentViewController/Classes/Consents/CampaignConsent.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
//
// CampaignConsent.swift
// Pods
//
// Created by Andre Herculano on 06.11.23.
//

import Foundation

protocol CampaignConsent {
var uuid: String? { get set }
var applies: Bool { get set }
var dateCreated: SPDate { get set }
}
10 changes: 6 additions & 4 deletions ConsentViewController/Classes/Consents/ConsentStatus.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,14 @@ import Foundation
public struct ConsentStatus: Codable, Equatable {
struct GranularStatus: Codable, Equatable {
var vendorConsent, vendorLegInt, purposeConsent, purposeLegInt: String?
var previousOptInAll, defaultConsent: Bool?
var previousOptInAll, defaultConsent, sellStatus,
shareStatus, sensitiveDataStatus, gpcStatus: Bool?
}

var granularStatus: GranularStatus? = GranularStatus()
public var rejectedAny, rejectedLI, consentedAll, consentedToAny, rejectedAll, vendorListAdditions, legalBasisChanges: Bool?
public var rejectedAny, rejectedLI, consentedAll, consentedToAll,
consentedToAny, rejectedAll, vendorListAdditions, legalBasisChanges: Bool?
var hasConsentData: Bool? = false
var rejectedVendors: [String?]? = []
var rejectedCategories: [String?]? = []
var rejectedVendors: [String?]?
var rejectedCategories: [String?]?
}
24 changes: 24 additions & 0 deletions ConsentViewController/Classes/Consents/LastMessageData.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
//
// LastMessageData.swift
// Pods
//
// Created by Andre Herculano on 06.11.23.
//

import Foundation

struct LastMessageData: Codable {
var id, categoryId, subCategoryId: Int
var partitionUUID: String
}

extension LastMessageData {
init?(from metadata: MessageMetaData?) {
guard let metadata = metadata else { return nil }

id = Int(metadata.messageId) ?? 0
categoryId = metadata.categoryId.rawValue
subCategoryId = metadata.subCategoryId.rawValue
partitionUUID = metadata.messagePartitionUUID ?? ""
}
}
8 changes: 1 addition & 7 deletions ConsentViewController/Classes/Consents/SPCCPAConsent.swift
Original file line number Diff line number Diff line change
Expand Up @@ -88,12 +88,6 @@ extension SPUSPString {
}
}

protocol CampaignConsent {
var uuid: String? { get set }
var applies: Bool { get set }
var dateCreated: SPDate { get set }
}

/**
The UserConsent class encapsulates the consent status, rejected vendor ids and rejected categories (purposes) ids.
- Important: The `rejectedVendors` and `rejectedCategories` arrays will only be populated if the `status` is `.Some`.
Expand Down Expand Up @@ -150,7 +144,7 @@ protocol CampaignConsent {

override open var description: String {
"""
UserConsent(
SPCCPAConsent(
- uuid: \(uuid ?? "")
- status: \(status.rawValue)
- rejectedVendors: \(rejectedVendors)
Expand Down
16 changes: 1 addition & 15 deletions ConsentViewController/Classes/Consents/SPGDPRConsent.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,20 +7,6 @@

import Foundation

struct LastMessageData: Codable {
var id, categoryId, subCategoryId: Int
var partitionUUID: String
}

extension LastMessageData {
init(from metadata: MessageMetaData) {
id = Int(metadata.messageId) ?? 0
categoryId = metadata.categoryId.rawValue
subCategoryId = metadata.subCategoryId.rawValue
partitionUUID = metadata.messagePartitionUUID ?? ""
}
}

/// A dictionary in which the keys represent the Vendor Id
public typealias SPGDPRVendorGrants = [GDPRVendorId: SPGDPRVendorGrant]
public typealias GDPRVendorId = String
Expand Down Expand Up @@ -183,7 +169,7 @@ public typealias SPGDPRPurposeId = String
uuid: String? = nil,
vendorGrants: SPGDPRVendorGrants,
euconsent: String,
tcfData: SPJson,
tcfData: SPJson?,
childPmId: String? = nil,
dateCreated: SPDate,
expirationDate: SPDate,
Expand Down
122 changes: 122 additions & 0 deletions ConsentViewController/Classes/Consents/SPUSNatConsent.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,122 @@
//
// SPUSNatConsent.swift
// Pods
//
// Created by Andre Herculano on 02.11.23.
//

import Foundation

@objcMembers public class SPUSNatConsent: NSObject, Codable, CampaignConsent, NSCopying {
public struct ConsentString: Codable, Equatable {
let sectionId: Int
let sectionName, consentString: String
}

public var uuid: String?

public var applies: Bool

public let consentStrings: [ConsentString]

/// A dictionary with all GPP related data
public var GPPData: SPJson?

let categories: [String]

var dateCreated, expirationDate: SPDate

/// Required by SP endpoints
var lastMessage: LastMessageData?

/// Used by the rendering app
let webConsentPayload: SPWebConsentPayload?

var consentStatus: ConsentStatus

override open var description: String {
"""
SPUSNatConsent(
- uuid: \(uuid ?? "")
- applies: \(applies)
- consentStrings: \(consentStrings)
- categories: \(categories)
- dateCreated: \(dateCreated)
- expirationDate: \(expirationDate)
)
"""
}

init(
uuid: String? = nil,
applies: Bool,
dateCreated: SPDate,
expirationDate: SPDate,
consentStrings: [ConsentString],
webConsentPayload: SPWebConsentPayload? = nil,
lastMessage: LastMessageData? = nil,
categories: [String],
consentStatus: ConsentStatus,
GPPData: SPJson? = nil
) {
self.uuid = uuid
self.applies = applies
self.dateCreated = dateCreated
self.expirationDate = expirationDate
self.consentStrings = consentStrings
self.webConsentPayload = webConsentPayload
self.lastMessage = lastMessage
self.categories = []
self.consentStatus = consentStatus
self.GPPData = GPPData
}

required public init(from decoder: Decoder) throws {
let container = try decoder.container(keyedBy: CodingKeys.self)
uuid = try container.decodeIfPresent(String.self, forKey: .uuid)
applies = try container.decodeIfPresent(Bool.self, forKey: .applies) ?? false
dateCreated = try container.decode(SPDate.self, forKey: .dateCreated)
expirationDate = try container.decode(SPDate.self, forKey: .expirationDate)
consentStrings = try container.decode([ConsentString].self, forKey: .consentStrings)
webConsentPayload = try container.decodeIfPresent(SPWebConsentPayload.self, forKey: .webConsentPayload)
lastMessage = try container.decodeIfPresent(LastMessageData.self, forKey: .lastMessage)
categories = try container.decode([String].self, forKey: .categories)
consentStatus = try container.decode(ConsentStatus.self, forKey: .consentStatus)
GPPData = try container.decodeIfPresent(SPJson.self, forKey: .GPPData)
}

public static func empty() -> SPUSNatConsent { SPUSNatConsent(
applies: false,
dateCreated: .now(),
expirationDate: .distantFuture(),
consentStrings: [],
categories: [],
consentStatus: ConsentStatus()
)}

override public func isEqual(_ object: Any?) -> Bool {
if let other = object as? SPUSNatConsent {
return other.uuid == uuid &&
other.applies == applies &&
other.consentStrings.count == consentStrings.count &&
other.consentStrings.sorted(by: { $0.sectionId > $1.sectionId }) ==
other.consentStrings.sorted(by: { $0.sectionId > $1.sectionId }) &&
other.categories == categories
} else {
return false
}
}

public func copy(with zone: NSZone? = nil) -> Any { SPUSNatConsent(
uuid: uuid,
applies: applies,
dateCreated: dateCreated,
expirationDate: expirationDate,
consentStrings: consentStrings,
webConsentPayload: webConsentPayload,
lastMessage: lastMessage,
categories: categories,
consentStatus: consentStatus,
GPPData: GPPData
)}
}
45 changes: 34 additions & 11 deletions ConsentViewController/Classes/Consents/SPUserData.swift
Original file line number Diff line number Diff line change
Expand Up @@ -20,17 +20,17 @@ public struct SPWebConsents: Codable, Equatable {
}
}

let gdpr: SPWebConsent?
let ccpa: SPWebConsent?
let gdpr, ccpa, usnat: SPWebConsent?

public init(gdpr: SPWebConsent? = nil, ccpa: SPWebConsent? = nil) {
public init(gdpr: SPWebConsent? = nil, ccpa: SPWebConsent? = nil, usnat: SPWebConsent? = nil) {
self.gdpr = gdpr
self.ccpa = ccpa
self.usnat = usnat
}
}

public class SPConsent<ConsentType: Codable & Equatable & NSCopying>: NSObject, Codable, NSCopying {
/// The consents data. See: `SPGDPRConsent`, `SPCCPAConsent`
/// The consents data. See: `SPGDPRConsent`, `SPCCPAConsent`, `SPUSNatConsent`
public let consents: ConsentType?

// swiftlint:disable:next todo
Expand Down Expand Up @@ -66,27 +66,35 @@ public class SPConsent<ConsentType: Codable & Equatable & NSCopying>: NSObject,
/// - SeeAlso: `SPCCPAConsent`
public let ccpa: SPConsent<SPCCPAConsent>?

/// Consent data for USNat. This attribute will be nil if your setup doesn't include a CCPA campaign
/// - SeeAlso: `SPUSNatConsent`
public let usnat: SPConsent<SPUSNatConsent>?

var webConsents: SPWebConsents { SPWebConsents(
gdpr: .init(uuid: gdpr?.consents?.uuid, webConsentPayload: gdpr?.consents?.webConsentPayload),
ccpa: .init(uuid: ccpa?.consents?.uuid, webConsentPayload: ccpa?.consents?.webConsentPayload)
ccpa: .init(uuid: ccpa?.consents?.uuid, webConsentPayload: ccpa?.consents?.webConsentPayload),
usnat: .init(uuid: usnat?.consents?.uuid, webConsentPayload: usnat?.consents?.webConsentPayload)
)}

override public var description: String {
"gdpr: \(String(describing: gdpr)), ccpa: \(String(describing: ccpa))"
"gdpr: \(String(describing: gdpr)), ccpa: \(String(describing: ccpa)), usnat: \(String(describing: usnat))"
}

public init(
gdpr: SPConsent<SPGDPRConsent>? = nil,
ccpa: SPConsent<SPCCPAConsent>? = nil
ccpa: SPConsent<SPCCPAConsent>? = nil,
usnat: SPConsent<SPUSNatConsent>? = nil
) {
self.gdpr = gdpr
self.ccpa = ccpa
self.usnat = usnat
}

public func copy(with zone: NSZone? = nil) -> Any {
SPUserData(
gdpr: gdpr?.copy() as? SPConsent<SPGDPRConsent>,
ccpa: ccpa?.copy() as? SPConsent<SPCCPAConsent>
ccpa: ccpa?.copy() as? SPConsent<SPCCPAConsent>,
usnat: usnat?.copy() as? SPConsent<SPUSNatConsent>
)
}

Expand All @@ -95,7 +103,9 @@ public class SPConsent<ConsentType: Codable & Equatable & NSCopying>: NSObject,
return gdpr?.applies == object.gdpr?.applies &&
gdpr?.consents == object.gdpr?.consents &&
ccpa?.applies == object.ccpa?.applies &&
ccpa?.consents == object.ccpa?.consents
ccpa?.consents == object.ccpa?.consents &&
usnat?.applies == object.usnat?.applies &&
usnat?.consents == object.usnat?.consents
} else {
return false
}
Expand All @@ -107,6 +117,8 @@ public protocol SPObjcUserData {
func objcGDPRApplies() -> Bool
func objcCCPAConsents() -> SPCCPAConsent?
func objcCCPAApplies() -> Bool
func objcUSNatConsents() -> SPUSNatConsent?
func objcUSNatApplies() -> Bool
}

@objc extension SPUserData: SPObjcUserData {
Expand All @@ -121,14 +133,25 @@ public protocol SPObjcUserData {
gdpr?.applies ?? false
}

/// Returns GDPR consent data if any available.
/// Returns CCPA consent data if any available.
/// - SeeAlso: `SPCCPAConsent`
public func objcCCPAConsents() -> SPCCPAConsent? {
ccpa?.consents
}

/// Indicates whether GDPR applies based on the VendorList configuration.
/// Indicates whether CCPA applies based on the VendorList configuration.
public func objcCCPAApplies() -> Bool {
ccpa?.applies ?? false
}

/// Returns USNat consent data if any available.
/// - SeeAlso: `SPUSNatConsent`
public func objcUSNatConsents() -> SPUSNatConsent? {
usnat?.consents
}

/// Indicates whether USNat applies based on the VendorList configuration.
public func objcUSNatApplies() -> Bool {
usnat?.applies ?? false
}
}
Loading
Loading