Skip to content

Commit

Permalink
Merge pull request #59 from SourcePointUSA/develop
Browse files Browse the repository at this point in the history
Release 2.3.3
  • Loading branch information
Nevazhnovu authored Jun 7, 2024
2 parents 74b3f40 + 9b470eb commit 87c6a72
Show file tree
Hide file tree
Showing 46 changed files with 381 additions and 518 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ static void AddParameterToInfoPlist(string plistPath)
rootDict.SetString(buildKey,"This identifier will be used to deliver personalized ads to you.");
buildKey = "SPLogLevel";
var buildValue="prod";
if (CmpDebugUtil.isLogging())
if (CmpDebugUtil.IsLogging)
{
buildValue="debug";
}
Expand Down
6 changes: 6 additions & 0 deletions Assets/ConsentManagementProvider/Scripts/facade/CMP.cs
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,12 @@ public static void Initialize(
case CAMPAIGN_TYPE.USNAT: useUSNAT = true; break;
}
}

propertyName = propertyName.Trim();
gdprPmId = gdprPmId.Trim();
ccpaPmId = ccpaPmId.Trim();
usnatPmId = usnatPmId.Trim();

#if UNITY_ANDROID
CreateBroadcastExecutorGO();
//excluding ios14 campaign if any
Expand Down
12 changes: 3 additions & 9 deletions Assets/ConsentManagementProvider/Scripts/json/JsonUnwrapper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -240,10 +240,8 @@ private static SpGdprConsent UnwrapSpGdprConsent(SpGdprConsentWrapper wrappedGdp
CmpDebugUtil.LogError("The GDPR consent wrapper cannot be null.");
return null;
}

bool applies = wrappedGdpr.applies;
GdprConsent consent = UnwrapGdprConsent(wrappedGdpr.consents);
return new SpGdprConsent(applies, consent);
return new SpGdprConsent(consent);
}

private static GdprConsent UnwrapGdprConsent(GdprConsentWrapper wrapped)
Expand Down Expand Up @@ -346,10 +344,8 @@ private static SpCcpaConsent UnwrapSpCcpaConsent(SpCcpaConsentWrapper wrappedCcp
CmpDebugUtil.LogError("The CCPA consent wrapper cannot be null.");
return null;
}

bool applies = wrappedCcpa.applies;
CcpaConsent consent = UnwrapCcpaConsent(wrappedCcpa.consents);
return new SpCcpaConsent(applies, consent);
return new SpCcpaConsent(consent);
}

private static CcpaConsent UnwrapCcpaConsent(CcpaConsentWrapper wrapped)
Expand All @@ -375,10 +371,8 @@ private static SpUsnatConsent UnwrapSpUsnatConsent(SpUsnatConsentWrapper wrapped
CmpDebugUtil.LogError("The USNAT consent wrapper cannot be null.");
return null;
}

bool applies = wrappedUsnat.applies;
UsnatConsent consent = UnwrapUsnatConsent(wrappedUsnat.consents);
return new SpUsnatConsent(applies, consent);
return new SpUsnatConsent(consent);
}

private static UsnatConsent UnwrapUsnatConsent(UsnatConsentWrapper wrapped)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System;
using System.Text;
using System.Collections.Generic;

namespace ConsentManagementProviderLib
Expand Down Expand Up @@ -79,5 +80,39 @@ ConsentStatus consentStatus
this.consentStatus = consentStatus;
}

public string ToFullString()
{
StringBuilder sb = new StringBuilder();

sb.AppendLine($"CCPA");

sb.AppendLine($"UUID: {uuid}");
sb.AppendLine($"Applies: {applies}");
sb.AppendLine($"Status: {status}");
sb.AppendLine($"Uspstring: {uspstring}");
sb.AppendLine($"ChildPmId: {childPmId}");
if (signedLspa != null)
sb.AppendLine($"SignedLspa: {signedLspa}");
sb.AppendLine($"WebConsentPayload: {webConsentPayload}");

if(rejectedVendors != null)
{
sb.AppendLine("Rejected Vendors:");
foreach (var vendor in rejectedVendors)
sb.AppendLine($" {vendor}");
}

if(rejectedCategories != null)
{
sb.AppendLine("Rejected Categories:");
foreach (var category in rejectedCategories)
sb.AppendLine($" {category}");
}

if (consentStatus != null)
sb = consentStatus.ToFullString(sb);

return sb.ToString();
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ public string ToFullString()
{
StringBuilder sb = new StringBuilder();

sb.AppendLine($"GDPR");

sb.AppendLine($"UUID: {uuid}");
sb.AppendLine($"EUConsent: {euconsent}");
sb.AppendLine($"Applies: {applies}");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,9 @@ namespace ConsentManagementProviderLib
{
public class SpCcpaConsent
{
public object applies;
public bool? applies => consents?.applies;
public CcpaConsent consents;

public SpCcpaConsent(bool applies, CcpaConsent consents)
{
this.applies = applies;
this.consents = consents;
}
public SpCcpaConsent(CcpaConsent consents)
{
this.consents = consents;
}
public SpCcpaConsent(CcpaConsent consents) => this.consents = consents;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,9 @@ namespace ConsentManagementProviderLib
{
public class SpGdprConsent
{
public bool applies;
public bool? applies => consents?.applies;
public GdprConsent consents;

public SpGdprConsent(bool applies, GdprConsent consents)
{
this.applies = applies;
this.consents = consents;
}

public SpGdprConsent(GdprConsent consents)
{
this.consents = consents;
}
public SpGdprConsent(GdprConsent consents) => this.consents = consents;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,9 @@ namespace ConsentManagementProviderLib
{
public class SpUsnatConsent
{
public object applies;
public bool? applies => consents?.applies;
public UsnatConsent consents;

public SpUsnatConsent(bool applies, UsnatConsent consents)
{
this.applies = applies;
this.consents = consents;
}
public SpUsnatConsent(UsnatConsent consents)
{
this.consents = consents;
}
public SpUsnatConsent(UsnatConsent consents) => this.consents = consents;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ internal AndroidJavaObject ConstructSpConfig(int accountId, int propertyId, stri
SpConfigDataBuilderClass.Call<AndroidJavaObject>("addCampaign", camp);
CmpDebugUtil.Log("addCampaign is OK");
}
if (CmpDebugUtil.isLogging())
if (CmpDebugUtil.IsLogging)
{
SpConfigDataBuilderClass.Call<AndroidJavaObject>("addLogger", new CmpAndroidLoggerProxy());
CmpDebugUtil.Log("addLogger is OK");
Expand Down
23 changes: 19 additions & 4 deletions Assets/ConsentManagementProvider/Scripts/wrapper/CmpDebugUtil.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ public static class CmpDebugUtil
private static bool enableDebugging = false;
private static bool forceEnableSingleLog;

public static bool IsLogging => enableLogging;

private static bool IsLoggingEnabled
{
get
Expand Down Expand Up @@ -37,7 +39,7 @@ public static void EnableGarbageCollectorDebugging(bool enable)
public static void Log(string message)
{
if(IsLoggingEnabled)
Debug.Log(message);
PrintLog(message);
}

public static void LogWarning(string message)
Expand All @@ -51,10 +53,23 @@ public static void LogError(string message)
//if(EnableLogging)
Debug.LogError(message);
}

public static bool isLogging()

/// <summary>
/// Some logs we print are ENORMOUS and logcat shortens the lenght of a string.
/// To workaround it, we'll use this method.
/// </summary>
private static void PrintLog(string message)
{
return enableLogging;
int maxLogSize = 1000;
int start = 0;
int end = 0;
for(int i = 0; i <= (message.Length / maxLogSize)-1; i++) {
start = i * maxLogSize;
end = (i+1) * maxLogSize;
end = end > message.Length ? message.Length : end;
Debug.Log(message.Substring(start, maxLogSize));
}
Debug.Log(message.Substring(end));
}
}
}
11 changes: 8 additions & 3 deletions Assets/ExampleApp/Scripts/PrivacySettings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ public class PrivacySettings : MonoBehaviour, IOnConsentReady
public string authId = null;
public List<CAMPAIGN_TYPE> campaignTypes = new ();

// GDPR Custom Consent
[Header("GDPR Custom Consent")]
public string[] vendors = { "5fbe6f050d88c7d28d765d47", "5ff4d000a228633ac048be41" };
public string[] categories = { "60657acc9c97c400122f21f3", "608bad95d08d3112188e0e36", "608bad95d08d3112188e0e2f" };
public string[] legIntCategories = { };
Expand All @@ -33,6 +33,7 @@ private MESSAGE_LANGUAGE language
}
}

[Header("UI")]
public Text consentValueText;
public Button loadMessageButton;
public Button gdprPrivacySettingsButton;
Expand Down Expand Up @@ -68,9 +69,11 @@ private void Awake()
spCampaigns: spCampaigns,
accountId: accountId,
propertyId: propertyId,
propertyName: propertyName,
propertyName: propertyName, // pay attention to any leading and trailing whitespaces;
// it's unlikely you voluntarily use them in property name, but if you do
// please note that we Trim them down in the call tree.
language: language,
gdprPmId: gdprPmId,
gdprPmId: gdprPmId,
ccpaPmId: ccpaPmId,
usnatPmId: usnatPmId,
campaignsEnvironment: CAMPAIGN_ENV.PUBLIC,
Expand Down Expand Up @@ -158,6 +161,8 @@ public void OnConsentReady(SpConsents consents)
storedConsentString = consents.gdpr.consents.euconsent ?? "--";
if(CMP.useGDPR)
CmpDebugUtil.Log(consents.gdpr.consents.ToFullString());
if(CMP.useCCPA)
CmpDebugUtil.Log(consents.ccpa.consents.ToFullString());
if(CMP.useUSNAT)
CmpDebugUtil.Log(consents.usnat.consents.ToFullString());
updateUI();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,6 @@

<androidPackages>
<!-- <androidPackage spec="org.jetbrains.kotlinx:kotlinx-serialization-json-jvm:1.3.0" />-->
<androidPackage spec="com.sourcepoint.cmplibrary:cmplibrary:7.8.1" />
<androidPackage spec="com.sourcepoint.cmplibrary:cmplibrary:7.8.3" />
</androidPackages>
</dependencies>
Binary file not shown.

This file was deleted.

Binary file not shown.
34 changes: 0 additions & 34 deletions Assets/Plugins/Android/com.squareup.okhttp3.okhttp-4.9.0.jar.meta

This file was deleted.

Binary file not shown.
34 changes: 0 additions & 34 deletions Assets/Plugins/Android/com.squareup.okio.okio-2.8.0.jar.meta

This file was deleted.

Loading

0 comments on commit 87c6a72

Please sign in to comment.