Skip to content

Commit 9b470eb

Browse files
authored
Merge pull request #58 from SourcePointUSA/sdk-2.3.2-improvements
Release 2.3.3
2 parents 74b3f40 + 07e21c7 commit 9b470eb

File tree

46 files changed

+381
-518
lines changed

Some content is hidden

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

46 files changed

+381
-518
lines changed

Assets/ConsentManagementProvider/Editor/CMPPostProcessBuild.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ static void AddParameterToInfoPlist(string plistPath)
7171
rootDict.SetString(buildKey,"This identifier will be used to deliver personalized ads to you.");
7272
buildKey = "SPLogLevel";
7373
var buildValue="prod";
74-
if (CmpDebugUtil.isLogging())
74+
if (CmpDebugUtil.IsLogging)
7575
{
7676
buildValue="debug";
7777
}

Assets/ConsentManagementProvider/Scripts/facade/CMP.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,12 @@ public static void Initialize(
4747
case CAMPAIGN_TYPE.USNAT: useUSNAT = true; break;
4848
}
4949
}
50+
51+
propertyName = propertyName.Trim();
52+
gdprPmId = gdprPmId.Trim();
53+
ccpaPmId = ccpaPmId.Trim();
54+
usnatPmId = usnatPmId.Trim();
55+
5056
#if UNITY_ANDROID
5157
CreateBroadcastExecutorGO();
5258
//excluding ios14 campaign if any

Assets/ConsentManagementProvider/Scripts/json/JsonUnwrapper.cs

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -240,10 +240,8 @@ private static SpGdprConsent UnwrapSpGdprConsent(SpGdprConsentWrapper wrappedGdp
240240
CmpDebugUtil.LogError("The GDPR consent wrapper cannot be null.");
241241
return null;
242242
}
243-
244-
bool applies = wrappedGdpr.applies;
245243
GdprConsent consent = UnwrapGdprConsent(wrappedGdpr.consents);
246-
return new SpGdprConsent(applies, consent);
244+
return new SpGdprConsent(consent);
247245
}
248246

249247
private static GdprConsent UnwrapGdprConsent(GdprConsentWrapper wrapped)
@@ -346,10 +344,8 @@ private static SpCcpaConsent UnwrapSpCcpaConsent(SpCcpaConsentWrapper wrappedCcp
346344
CmpDebugUtil.LogError("The CCPA consent wrapper cannot be null.");
347345
return null;
348346
}
349-
350-
bool applies = wrappedCcpa.applies;
351347
CcpaConsent consent = UnwrapCcpaConsent(wrappedCcpa.consents);
352-
return new SpCcpaConsent(applies, consent);
348+
return new SpCcpaConsent(consent);
353349
}
354350

355351
private static CcpaConsent UnwrapCcpaConsent(CcpaConsentWrapper wrapped)
@@ -375,10 +371,8 @@ private static SpUsnatConsent UnwrapSpUsnatConsent(SpUsnatConsentWrapper wrapped
375371
CmpDebugUtil.LogError("The USNAT consent wrapper cannot be null.");
376372
return null;
377373
}
378-
379-
bool applies = wrappedUsnat.applies;
380374
UsnatConsent consent = UnwrapUsnatConsent(wrappedUsnat.consents);
381-
return new SpUsnatConsent(applies, consent);
375+
return new SpUsnatConsent(consent);
382376
}
383377

384378
private static UsnatConsent UnwrapUsnatConsent(UsnatConsentWrapper wrapped)

Assets/ConsentManagementProvider/Scripts/model/common/CcpaConsent.cs

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
using System;
2+
using System.Text;
23
using System.Collections.Generic;
34

45
namespace ConsentManagementProviderLib
@@ -79,5 +80,39 @@ ConsentStatus consentStatus
7980
this.consentStatus = consentStatus;
8081
}
8182

83+
public string ToFullString()
84+
{
85+
StringBuilder sb = new StringBuilder();
86+
87+
sb.AppendLine($"CCPA");
88+
89+
sb.AppendLine($"UUID: {uuid}");
90+
sb.AppendLine($"Applies: {applies}");
91+
sb.AppendLine($"Status: {status}");
92+
sb.AppendLine($"Uspstring: {uspstring}");
93+
sb.AppendLine($"ChildPmId: {childPmId}");
94+
if (signedLspa != null)
95+
sb.AppendLine($"SignedLspa: {signedLspa}");
96+
sb.AppendLine($"WebConsentPayload: {webConsentPayload}");
97+
98+
if(rejectedVendors != null)
99+
{
100+
sb.AppendLine("Rejected Vendors:");
101+
foreach (var vendor in rejectedVendors)
102+
sb.AppendLine($" {vendor}");
103+
}
104+
105+
if(rejectedCategories != null)
106+
{
107+
sb.AppendLine("Rejected Categories:");
108+
foreach (var category in rejectedCategories)
109+
sb.AppendLine($" {category}");
110+
}
111+
112+
if (consentStatus != null)
113+
sb = consentStatus.ToFullString(sb);
114+
115+
return sb.ToString();
116+
}
82117
}
83118
}

Assets/ConsentManagementProvider/Scripts/model/common/GdprConsent.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@ public string ToFullString()
2121
{
2222
StringBuilder sb = new StringBuilder();
2323

24+
sb.AppendLine($"GDPR");
25+
2426
sb.AppendLine($"UUID: {uuid}");
2527
sb.AppendLine($"EUConsent: {euconsent}");
2628
sb.AppendLine($"Applies: {applies}");

Assets/ConsentManagementProvider/Scripts/model/common/SpCcpaConsent.cs

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,9 @@ namespace ConsentManagementProviderLib
22
{
33
public class SpCcpaConsent
44
{
5-
public object applies;
5+
public bool? applies => consents?.applies;
66
public CcpaConsent consents;
77

8-
public SpCcpaConsent(bool applies, CcpaConsent consents)
9-
{
10-
this.applies = applies;
11-
this.consents = consents;
12-
}
13-
public SpCcpaConsent(CcpaConsent consents)
14-
{
15-
this.consents = consents;
16-
}
8+
public SpCcpaConsent(CcpaConsent consents) => this.consents = consents;
179
}
1810
}

Assets/ConsentManagementProvider/Scripts/model/common/SpGdprConsent.cs

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,9 @@ namespace ConsentManagementProviderLib
22
{
33
public class SpGdprConsent
44
{
5-
public bool applies;
5+
public bool? applies => consents?.applies;
66
public GdprConsent consents;
77

8-
public SpGdprConsent(bool applies, GdprConsent consents)
9-
{
10-
this.applies = applies;
11-
this.consents = consents;
12-
}
13-
14-
public SpGdprConsent(GdprConsent consents)
15-
{
16-
this.consents = consents;
17-
}
8+
public SpGdprConsent(GdprConsent consents) => this.consents = consents;
189
}
1910
}

Assets/ConsentManagementProvider/Scripts/model/common/SpUsnatConsent.cs

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,9 @@ namespace ConsentManagementProviderLib
22
{
33
public class SpUsnatConsent
44
{
5-
public object applies;
5+
public bool? applies => consents?.applies;
66
public UsnatConsent consents;
77

8-
public SpUsnatConsent(bool applies, UsnatConsent consents)
9-
{
10-
this.applies = applies;
11-
this.consents = consents;
12-
}
13-
public SpUsnatConsent(UsnatConsent consents)
14-
{
15-
this.consents = consents;
16-
}
8+
public SpUsnatConsent(UsnatConsent consents) => this.consents = consents;
179
}
1810
}

Assets/ConsentManagementProvider/Scripts/wrapper/Android/AndroidJavaConstruct.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ internal AndroidJavaObject ConstructSpConfig(int accountId, int propertyId, stri
136136
SpConfigDataBuilderClass.Call<AndroidJavaObject>("addCampaign", camp);
137137
CmpDebugUtil.Log("addCampaign is OK");
138138
}
139-
if (CmpDebugUtil.isLogging())
139+
if (CmpDebugUtil.IsLogging)
140140
{
141141
SpConfigDataBuilderClass.Call<AndroidJavaObject>("addLogger", new CmpAndroidLoggerProxy());
142142
CmpDebugUtil.Log("addLogger is OK");

Assets/ConsentManagementProvider/Scripts/wrapper/CmpDebugUtil.cs

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ public static class CmpDebugUtil
88
private static bool enableDebugging = false;
99
private static bool forceEnableSingleLog;
1010

11+
public static bool IsLogging => enableLogging;
12+
1113
private static bool IsLoggingEnabled
1214
{
1315
get
@@ -37,7 +39,7 @@ public static void EnableGarbageCollectorDebugging(bool enable)
3739
public static void Log(string message)
3840
{
3941
if(IsLoggingEnabled)
40-
Debug.Log(message);
42+
PrintLog(message);
4143
}
4244

4345
public static void LogWarning(string message)
@@ -51,10 +53,23 @@ public static void LogError(string message)
5153
//if(EnableLogging)
5254
Debug.LogError(message);
5355
}
54-
55-
public static bool isLogging()
56+
57+
/// <summary>
58+
/// Some logs we print are ENORMOUS and logcat shortens the lenght of a string.
59+
/// To workaround it, we'll use this method.
60+
/// </summary>
61+
private static void PrintLog(string message)
5662
{
57-
return enableLogging;
63+
int maxLogSize = 1000;
64+
int start = 0;
65+
int end = 0;
66+
for(int i = 0; i <= (message.Length / maxLogSize)-1; i++) {
67+
start = i * maxLogSize;
68+
end = (i+1) * maxLogSize;
69+
end = end > message.Length ? message.Length : end;
70+
Debug.Log(message.Substring(start, maxLogSize));
71+
}
72+
Debug.Log(message.Substring(end));
5873
}
5974
}
6075
}

0 commit comments

Comments
 (0)