Skip to content

Commit

Permalink
Merge pull request #46 from SourcePointUSA/develop
Browse files Browse the repository at this point in the history
Release v 2.2.2
  • Loading branch information
Nevazhnovu authored Feb 27, 2024
2 parents 7b45e51 + 57d46ca commit 4051f1d
Show file tree
Hide file tree
Showing 32 changed files with 387 additions and 270 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -290,7 +290,7 @@ extension SwiftBridge {
}

@objc public func setCallbackOnCustomConsent(callback: @escaping СallbackCharMessage) -> Void{
print("setCallbackOnSPFinished")
print("setCallbackOnCustomConsent")
callbackOnCustomConsent = callback
}

Expand Down
5 changes: 2 additions & 3 deletions Assets/ConsentManagementProvider/Scripts/facade/CMP.cs
Original file line number Diff line number Diff line change
Expand Up @@ -146,12 +146,11 @@ public static void CustomConsentGDPR(string[] vendors, string[] categories, stri
public static void DeleteCustomConsentGDPR(string[] vendors, string[] categories, string[] legIntCategories, Action<GdprConsent> onSuccessDelegate)
{
#if UNITY_ANDROID
// TO-DO
/*ConsentWrapperAndroid.Instance.DeleteCustomConsentGDPR(
ConsentWrapperAndroid.Instance.DeleteCustomConsentGDPR(
vendors: vendors,
categories: categories,
legIntCategories: legIntCategories,
onSuccessDelegate: onSuccessDelegate);*/
onSuccessDelegate: onSuccessDelegate);

#elif UNITY_IOS && !UNITY_EDITOR_OSX
ConsentWrapperIOS.Instance.DeleteCustomConsentGDPR(
Expand Down
22 changes: 21 additions & 1 deletion Assets/ConsentManagementProvider/Scripts/json/JsonUnwrapper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,16 @@ public static SpGdprConsent UnwrapSpGdprConsentAndroid(SpGdprConsentWrapperAndro
}
}

if (wrappedGdpr.gcmStatus != null)
{
unwrapped.googleConsentMode = new SPGCMData(
wrappedGdpr.gcmStatus.ad_storage,
wrappedGdpr.gcmStatus.analytics_storage,
wrappedGdpr.gcmStatus.ad_user_data,
wrappedGdpr.gcmStatus.ad_personalization
);
}

return new SpGdprConsent(unwrapped);
}

Expand Down Expand Up @@ -234,7 +244,17 @@ private static GdprConsent UnwrapGdprConsent(GdprConsentWrapper wrapped)
{
unwrapped.consentStatus = UnwrapConsentStatus(wrapped.consentStatus);
}


if (wrapped.gcmStatus != null)
{
unwrapped.googleConsentMode = new SPGCMData(
wrapped.gcmStatus.ad_storage,
wrapped.gcmStatus.analytics_storage,
wrapped.gcmStatus.ad_user_data,
wrapped.gcmStatus.ad_personalization
);
}

return unwrapped;
}

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
namespace ConsentManagementProviderLib.Json
{
internal class GCMDataWrapper
{
public SPGCMData.Status? ad_storage, analytics_storage, ad_user_data, ad_personalization;
}
}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,6 @@ internal class GdprConsentWrapper
public bool applies;
public string webConsentPayload;
public ConsentStatusWrapper consentStatus;
public GCMDataWrapper? gcmStatus;
}
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System.Collections.Generic;
using Newtonsoft.Json;
using System.Collections.Generic;

namespace ConsentManagementProviderLib.Json
{
Expand All @@ -8,5 +9,7 @@ internal class SpGdprConsentWrapperAndroid
public string euconsent;
public Dictionary<string, object> tcData;
public Dictionary<string, Dictionary<string, object>> grants;
[JsonProperty("googleConsentMode")]
public GCMDataWrapper gcmStatus;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ public class GdprConsent
public Dictionary<string, SpVendorGrant> grants;
public List<string> acceptedCategories;
public ConsentStatus consentStatus;
public SPGCMData? googleConsentMode;

public string ToFullString()
{
Expand Down Expand Up @@ -54,10 +55,35 @@ public string ToFullString()
sb.AppendLine($" {category}");
}

if(googleConsentMode != null)
sb.AppendLine($"adStorage: {googleConsentMode.adStorage}, analyticsStorage: {googleConsentMode.analyticsStorage}, adUserData: {googleConsentMode.adUserData}, adPersonalization: {googleConsentMode.adPersonalization}");

return sb.ToString();
}
}


public class SPGCMData
{
public enum Status
{
granted,
denied
}
public Status? adStorage, analyticsStorage, adUserData, adPersonalization;

public SPGCMData(
Status? adStorage,
Status? analyticsStorage,
Status? adUserData,
Status? adPersonalization)
{
this.adStorage = adStorage;
this.analyticsStorage = analyticsStorage;
this.adUserData = adUserData;
this.adPersonalization = adPersonalization;
}
}

public class ConsentStatus
{
public bool? rejectedAny;
Expand All @@ -71,9 +97,17 @@ public class ConsentStatus
public object rejectedVendors;
public object rejectedCategories;

public ConsentStatus(bool? rejectedAny, bool? rejectedLI, bool? consentedAll,
bool? consentedToAny, bool? vendorListAdditions, bool? legalBasisChanges,
bool? hasConsentData, GranularStatus? granularStatus, object rejectedVendors, object rejectedCategories)
public ConsentStatus(
bool? rejectedAny,
bool? rejectedLI,
bool? consentedAll,
bool? consentedToAny,
bool? vendorListAdditions,
bool? legalBasisChanges,
bool? hasConsentData,
GranularStatus? granularStatus,
object rejectedVendors,
object rejectedCategories)
{
this.rejectedAny = rejectedAny;
this.rejectedLI = rejectedLI;
Expand All @@ -96,7 +130,13 @@ public class GranularStatus
public string? purposeLegInt;
public bool? previousOptInAll;
public bool? defaultConsent;
public GranularStatus(string? vendorConsent, string? vendorLegInt, string? purposeConsent, string? purposeLegInt, bool? previousOptInAll, bool? defaultConsent)
public GranularStatus(
string? vendorConsent,
string? vendorLegInt,
string? purposeConsent,
string? purposeLegInt,
bool? previousOptInAll,
bool? defaultConsent)
{
this.vendorConsent = vendorConsent;
this.vendorLegInt = vendorLegInt;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,12 @@ public void CustomConsentGDPR(string[] vendors, string[] categories, string[] le
consentLib.Call("customConsentGDPR", vendors, categories, legIntCategories, customConsentClient);
}

public void DeleteCustomConsentGDPR(string[] vendors, string[] categories, string[] legIntCategories, Action<GdprConsent> onSuccessDelegate)
{
this.customConsentClient = new CustomConsentClient(onSuccessDelegate);
consentLib.Call("deleteCustomConsentTo", vendors, categories, legIntCategories, customConsentClient);
}

public GdprConsent GetCustomGdprConsent()
{
if (this.customConsentClient != null)
Expand Down
Loading

0 comments on commit 4051f1d

Please sign in to comment.