Skip to content

Commit e067d7a

Browse files
authored
Merge pull request #51 from SourcePointUSA/develop
Release 2.3.0
2 parents 4051f1d + 72e077b commit e067d7a

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+1087
-155
lines changed

Assets/ConsentManagementProvider/Plugins/iOS/Source/SwiftBridge.swift

Lines changed: 36 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,9 @@ import UIKit
1313
config = Config(
1414
gdprPmId: nil,
1515
ccpaPmId: nil,
16+
usnatPmId: nil,
17+
transitionCCPAAuth: nil,
18+
supportLegacyUSPString: nil,
1619
vendors: [],
1720
categories: [],
1821
legIntCategories: []
@@ -22,6 +25,7 @@ import UIKit
2225
case GDPR = 0
2326
case IOS14 = 1
2427
case CCPA = 2
28+
case USNAT = 3
2529
}
2630

2731
enum VendorStatus: String {
@@ -41,7 +45,8 @@ import UIKit
4145
}
4246

4347
struct Config {
44-
var gdprPmId, ccpaPmId: String?
48+
var gdprPmId, ccpaPmId, usnatPmId: String?
49+
var transitionCCPAAuth, supportLegacyUSPString: Bool?
4550
var vendors: [String] = []
4651
var categories: [String] = []
4752
var legIntCategories: [String] = []
@@ -52,6 +57,7 @@ import UIKit
5257
var config: Config
5358
lazy var gdprTargetingParams: SPTargetingParams = [:]
5459
lazy var ccpaTargetingParams: SPTargetingParams = [:]
60+
lazy var usnatTargetingParams: SPTargetingParams = [:]
5561

5662
var consentManager: SPSDK?
5763
let logger: OSLogger = OSLogger.standard
@@ -76,23 +82,38 @@ import UIKit
7682
case .IOS14: break
7783

7884
case .CCPA: ccpaTargetingParams[key]=value
85+
86+
case .USNAT: usnatTargetingParams[key]=value
7987

8088
case .none:
8189
print("Incorrect campaignType on addTargetingParam")
8290
}
8391
}
8492

93+
@objc public func setTransitionCCPAAuth(value: Bool){
94+
print("transitionCCPAAuth set to "+String(value))
95+
config.transitionCCPAAuth = value
96+
}
97+
98+
@objc public func setSupportLegacyUSPString(value: Bool){
99+
print("supportLegacyUSPString set to "+String(value))
100+
config.supportLegacyUSPString = value
101+
}
102+
85103
@objc public func configLib(
86104
accountId: Int,
87105
propertyId: Int,
88106
propertyName: String,
89107
gdpr: Bool,
90108
ccpa: Bool,
109+
usnat: Bool,
91110
language: SPMessageLanguage,
92111
gdprPmId: String,
93-
ccpaPmId: String) {
112+
ccpaPmId: String,
113+
usnatPmId: String) {
94114
self.config.gdprPmId = gdprPmId
95115
self.config.ccpaPmId = ccpaPmId
116+
self.config.usnatPmId = usnatPmId
96117
guard let propName = try? SPPropertyName(propertyName) else {
97118
self.runCallback(callback: self.callbackOnErrorCallback, arg: "`propertyName` invalid!")
98119
return
@@ -102,8 +123,9 @@ import UIKit
102123
propertyId: propertyId,
103124
propertyName: propName,
104125
campaigns: SPCampaigns(
105-
gdpr: gdpr ? SPCampaign(targetingParams: gdprTargetingParams, groupPmId: gdprPmId) : nil,
106-
ccpa: ccpa ? SPCampaign(targetingParams: ccpaTargetingParams, groupPmId: ccpaPmId) : nil,
126+
gdpr: gdpr ? SPCampaign(targetingParams: gdprTargetingParams) : nil,
127+
ccpa: ccpa ? SPCampaign(targetingParams: ccpaTargetingParams) : nil,
128+
usnat: usnat ? SPCampaign(targetingParams: usnatTargetingParams, transitionCCPAAuth: config.transitionCCPAAuth, supportLegacyUSPString: config.supportLegacyUSPString) : nil,
107129
ios14: SPCampaign()
108130
),
109131
language: language,
@@ -173,6 +195,16 @@ import UIKit
173195
self.runCallback(callback: self.callbackOnErrorCallback, arg: "Tried to load CCPA pm without ccpa pm id")
174196
}
175197
}
198+
199+
@objc public func onUSNATPrivacyManagerTap() {
200+
if config.usnatPmId != nil {
201+
(consentManager != nil) ?
202+
consentManager?.loadUSNatPrivacyManager(withId: config.usnatPmId!) :
203+
self.runCallback(callback: self.callbackOnErrorCallback, arg: "Library was not initialized correctly!")
204+
} else {
205+
self.runCallback(callback: self.callbackOnErrorCallback, arg: "Tried to load USNAT pm without usnat pm id")
206+
}
207+
}
176208

177209
@objc public func customConsentToGDPR() {
178210
if let consentManager = consentManager {

Assets/ConsentManagementProvider/Plugins/iOS/Source/Unity.mm

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,9 +71,19 @@ void _addTargetingParamForCampaignType(int campaignType, char* key, char* value)
7171
[swiftBridge addTargetingParamWithCampaignType:campaignType key:[NSString stringWithFormat:@"%s", key] value:[NSString stringWithFormat:@"%s", value]];
7272
}
7373

74-
void _configLib(int accountId, int propertyId, char* propertyName, bool gdpr, bool ccpa, SPMessageLanguage language, char* gdprPmId, char* ccpaPmId)
74+
void _setTransitionCCPAAuth(bool value)
7575
{
76-
[swiftBridge configLibWithAccountId:accountId propertyId:propertyId propertyName:[NSString stringWithFormat:@"%s", propertyName] gdpr:gdpr ccpa:ccpa language:language gdprPmId:[NSString stringWithFormat:@"%s", gdprPmId] ccpaPmId:[NSString stringWithFormat:@"%s", ccpaPmId]];
76+
[swiftBridge setTransitionCCPAAuthWithValue:value];
77+
}
78+
79+
void _setSupportLegacyUSPString(bool value)
80+
{
81+
[swiftBridge setSupportLegacyUSPStringWithValue:value];
82+
}
83+
84+
void _configLib(int accountId, int propertyId, char* propertyName, bool gdpr, bool ccpa, bool usnat, SPMessageLanguage language, char* gdprPmId, char* ccpaPmId, char* usnatPmId)
85+
{
86+
[swiftBridge configLibWithAccountId:accountId propertyId:propertyId propertyName:[NSString stringWithFormat:@"%s", propertyName] gdpr:gdpr ccpa:ccpa usnat:usnat language:language gdprPmId:[NSString stringWithFormat:@"%s", gdprPmId] ccpaPmId:[NSString stringWithFormat:@"%s", ccpaPmId] usnatPmId:[NSString stringWithFormat:@"%s", usnatPmId]];
7787
}
7888

7989
void _loadMessage(char * authId)
@@ -91,6 +101,12 @@ void _loadCCPAPrivacyManager()
91101
[swiftBridge onCCPAPrivacyManagerTap];
92102
}
93103

104+
void _loadUSNATPrivacyManager()
105+
{
106+
[swiftBridge onUSNATPrivacyManagerTap];
107+
}
108+
109+
94110
void _cleanConsent()
95111
{
96112
[swiftBridge onClearConsentTap];
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
namespace ConsentMessagePlugin.Android
2+
{
3+
internal static class CONFIG_OPTION_FULL_KEY
4+
{
5+
internal const string
6+
TRANSITION_CCPA_AUTH = "TRANSITION_CCPA_AUTH",
7+
SUPPORT_LEGACY_USPSTRING = "SUPPORT_LEGACY_USPSTRING";
8+
}
9+
}

Assets/ConsentManagementProvider/Scripts/enum/Android/CONFIG_OPTION.cs.meta

Lines changed: 11 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Assets/ConsentManagementProvider/Scripts/enum/CAMPAIGN_TYPE.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,6 @@ public enum CAMPAIGN_TYPE
88
GDPR = 0,
99
IOS14 = 1, //exist ios only
1010
CCPA = 2,
11-
// UNKNOWN = 3 //exist ios only
11+
USNAT = 3
1212
}
1313
}

Assets/ConsentManagementProvider/Scripts/facade/CMP.cs

Lines changed: 27 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -17,26 +17,36 @@ public static class CMP
1717

1818
public static bool useGDPR = false;
1919
public static bool useCCPA = false;
20+
public static bool useUSNAT = false;
2021

2122
public static void Initialize(
2223
List<SpCampaign> spCampaigns,
2324
int accountId,
2425
int propertyId,
25-
string propertyName,
26-
bool gdpr,
27-
bool ccpa,
26+
string propertyName,
2827
MESSAGE_LANGUAGE language,
2928
string gdprPmId,
3029
string ccpaPmId,
30+
string usnatPmId,
3131
CAMPAIGN_ENV campaignsEnvironment,
32-
long messageTimeoutInSeconds = 3)
32+
long messageTimeoutInSeconds = 3,
33+
bool? transitionCCPAAuth = null,
34+
bool? supportLegacyUSPString = null)
3335
{
3436
if(!IsSpCampaignsValid(spCampaigns))
3537
{
3638
return;
3739
}
38-
useGDPR = gdpr;
39-
useCCPA = ccpa;
40+
41+
foreach (SpCampaign sp in spCampaigns)
42+
{
43+
switch (sp.CampaignType)
44+
{
45+
case CAMPAIGN_TYPE.GDPR: useGDPR = true; break;
46+
case CAMPAIGN_TYPE.CCPA: useCCPA = true; break;
47+
case CAMPAIGN_TYPE.USNAT: useUSNAT = true; break;
48+
}
49+
}
4050
#if UNITY_ANDROID
4151
CreateBroadcastExecutorGO();
4252
//excluding ios14 campaign if any
@@ -52,22 +62,28 @@ public static void Initialize(
5262
propertyName: propertyName,
5363
language: language,
5464
campaignsEnvironment: campaignsEnvironment,
55-
messageTimeoutMilliSeconds: messageTimeoutInSeconds * 1000);
65+
messageTimeoutMilliSeconds: messageTimeoutInSeconds * 1000,
66+
transitionCCPAAuth: transitionCCPAAuth,
67+
supportLegacyUSPString: supportLegacyUSPString);
5668

5769
#elif UNITY_IOS && !UNITY_EDITOR_OSX
5870
CreateBroadcastExecutorGO();
5971
ConsentWrapperIOS.Instance.InitializeLib(
6072
accountId,
6173
propertyId,
6274
propertyName,
63-
gdpr,
64-
ccpa,
75+
useGDPR,
76+
useCCPA,
77+
useUSNAT,
6578
language,
6679
gdprPmId,
6780
ccpaPmId,
81+
usnatPmId,
6882
spCampaigns,
6983
campaignsEnvironment,
70-
messageTimeoutInSeconds);
84+
messageTimeoutInSeconds,
85+
transitionCCPAAuth,
86+
supportLegacyUSPString);
7187
#endif
7288
}
7389

@@ -121,6 +137,7 @@ public static void LoadPrivacyManager(CAMPAIGN_TYPE campaignType, string pmId, P
121137
switch (campaignType){
122138
case CAMPAIGN_TYPE.GDPR: ConsentWrapperIOS.Instance.LoadGDPRPrivacyManager(); break;
123139
case CAMPAIGN_TYPE.CCPA: ConsentWrapperIOS.Instance.LoadCCPAPrivacyManager(); break;
140+
case CAMPAIGN_TYPE.USNAT: ConsentWrapperIOS.Instance.LoadUSNATPrivacyManager(); break;
124141
}
125142
#endif
126143
}

0 commit comments

Comments
 (0)