Skip to content

Commit

Permalink
Release 2.1.2: Merge branch 'develop'
Browse files Browse the repository at this point in the history
* develop:
  Update `unitypackage`
  Update `CHANGELOG.md`
  Update `package.json`
  Android's `onSpFinished` handling and force logging enabled
  Update logging system
  Default property example scene
  • Loading branch information
Nevazhnovu committed Nov 8, 2023
2 parents 435be8a + d9c7c57 commit f248d1c
Show file tree
Hide file tree
Showing 7 changed files with 71 additions and 49 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -62,21 +62,34 @@ void onConsentReady(string spConsents)
_spConsents = consents;
ConsentMessenger.Broadcast<IOnConsentReady>(consents);
}


/**
* It is invoked when the interaction with native WebView is done, consent sent, JSON received and CMP is ready to close the WebView
*/
void onSpFinished(string spConsents)
{
CmpDebugUtil.Log("I've reached the C# onSpFinished");
SpConsents consents = JsonUnwrapper.UnwrapSpConsentsAndroid(spConsents);
_spConsents = consents;
ConsentMessenger.Broadcast<IOnConsentSpFinished>(consents);
}
CmpDebugUtil.ForceEnableNextCmpLog();
CmpDebugUtil.LogWarning($"I've reached the C# onSpFinished with JSON spConsents={spConsents}");

try
{
SpConsents consents = JsonUnwrapper.UnwrapSpConsentsAndroid(spConsents);
_spConsents = consents;
ConsentMessenger.Broadcast<IOnConsentSpFinished>(consents);
}
catch (Exception e)
{
ConsentMessenger.Broadcast<IOnConsentError>(e);
}
}

void onError(AndroidJavaObject rawThrowableObject)
{
CmpDebugUtil.Log("I've reached the C# onError : " + rawThrowableObject.ToString());
CmpDebugUtil.ForceEnableNextCmpLog();
CmpDebugUtil.LogError("I've reached the C# onError : " + rawThrowableObject.ToString());
Exception exception = CmpJavaToUnityUtils.ConvertThrowableToError(rawThrowableObject);
CmpDebugUtil.Log("Exception converted successfully : " + exception.ToString());
CmpDebugUtil.ForceEnableNextCmpLog();
CmpDebugUtil.LogError("Exception converted successfully : " + exception.ToString());
ConsentMessenger.Broadcast<IOnConsentError>(exception);
}

Expand Down
24 changes: 17 additions & 7 deletions Assets/ConsentManagementProvider/Scripts/wrapper/CmpDebugUtil.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,27 @@ public static class CmpDebugUtil
{
private static bool enableLogging = false;
private static bool enableDebugging = false;
private static bool forceEnableSingleLog;

private static bool IsLoggingEnabled
{
get
{
var result = enableLogging || forceEnableSingleLog;
forceEnableSingleLog = false;
return result;
}
}

static CmpDebugUtil()
{
EnableGarbageCollectorDebugging(enableDebugging);
EnableCmpLogs(enableLogging);
}

public static void EnableCmpLogs(bool enable)
{
enableLogging = enable;
}
public static void ForceEnableNextCmpLog() => forceEnableSingleLog = true;

public static void EnableCmpLogs(bool enable) => enableLogging = enable;

public static void EnableGarbageCollectorDebugging(bool enable)
{
Expand All @@ -26,19 +36,19 @@ public static void EnableGarbageCollectorDebugging(bool enable)

public static void Log(string message)
{
if(enableLogging)
if(IsLoggingEnabled)
Debug.Log(message);
}

public static void LogWarning(string message)
{
if (enableLogging)
if (IsLoggingEnabled)
Debug.LogWarning(message);
}

public static void LogError(string message)
{
//if(enableLogging)
//if(EnableLogging)
Debug.LogError(message);
}
}
Expand Down
52 changes: 23 additions & 29 deletions Assets/ExampleApp/Scenes/SourcepointSampleScene.unity
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ NavMeshSettings:
serializedVersion: 2
m_ObjectHideFlags: 0
m_BuildSettings:
serializedVersion: 3
serializedVersion: 2
agentTypeID: 0
agentRadius: 0.5
agentHeight: 2
Expand All @@ -117,7 +117,7 @@ NavMeshSettings:
cellSize: 0.16666667
manualTileSize: 0
tileSize: 256
buildHeightMesh: 0
accuratePlacement: 0
maxJobWorkers: 0
preserveTilesOutsideBounds: 0
debug:
Expand Down Expand Up @@ -153,9 +153,10 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: cde022323c7f34dc983348b3ed862e86, type: 3}
m_Name:
m_EditorClassIdentifier:
accountId: 1909
propertyName: voodoo.ios
pmId: 838714
accountId: 22
propertyName: mobile.multicampaign.demo
propertyId: 16893
pmId: 488393
authId:
campaignTypes: 00000000
consentValueText: {fileID: 740499557}
Expand All @@ -169,13 +170,13 @@ Transform:
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 131616236}
serializedVersion: 2
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: 555.3208, y: 1261.6669, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 3
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!82 &131616239
AudioSource:
Expand Down Expand Up @@ -304,6 +305,7 @@ RectTransform:
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 448136249}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 1, y: 1}
Expand Down Expand Up @@ -483,9 +485,7 @@ Canvas:
m_OverrideSorting: 0
m_OverridePixelPerfect: 0
m_SortingBucketNormalizedSize: 0
m_VertexColorAlwaysGammaSpace: 1
m_AdditionalShaderChannelsFlag: 25
m_UpdateRectTransformForStandalone: 0
m_SortingLayerID: 0
m_SortingOrder: 0
m_TargetDisplay: 0
Expand All @@ -509,6 +509,7 @@ RectTransform:
- {fileID: 855986890}
- {fileID: 448136249}
m_Father: {fileID: 0}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 0, y: 0}
Expand Down Expand Up @@ -548,6 +549,7 @@ RectTransform:
m_Children:
- {fileID: 183465787}
m_Father: {fileID: 207973236}
m_RootOrder: 6
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0.5, y: 0.5}
m_AnchorMax: {x: 0.5, y: 0.5}
Expand Down Expand Up @@ -700,17 +702,9 @@ Camera:
m_projectionMatrixMode: 1
m_GateFitMode: 2
m_FOVAxisMode: 0
m_Iso: 200
m_ShutterSpeed: 0.005
m_Aperture: 16
m_FocusDistance: 10
m_FocalLength: 50
m_BladeCount: 5
m_Curvature: {x: 2, y: 11}
m_BarrelClipping: 0.25
m_Anamorphism: 0
m_SensorSize: {x: 36, y: 24}
m_LensShift: {x: 0, y: 0}
m_FocalLength: 50
m_NormalizedViewPortRect:
serializedVersion: 2
x: 0
Expand Down Expand Up @@ -744,13 +738,13 @@ Transform:
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 519420028}
serializedVersion: 2
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: -10}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 2
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &575223733
GameObject:
Expand Down Expand Up @@ -783,6 +777,7 @@ RectTransform:
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 207973236}
m_RootOrder: 2
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 1}
m_AnchorMax: {x: 1, y: 1}
Expand Down Expand Up @@ -917,6 +912,7 @@ RectTransform:
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 1539184778}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 1, y: 1}
Expand Down Expand Up @@ -1051,6 +1047,7 @@ RectTransform:
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 855986890}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 1, y: 1}
Expand Down Expand Up @@ -1185,6 +1182,7 @@ RectTransform:
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 207973236}
m_RootOrder: 3
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 1}
m_AnchorMax: {x: 1, y: 1}
Expand Down Expand Up @@ -1321,6 +1319,7 @@ RectTransform:
m_Children:
- {fileID: 640286547}
m_Father: {fileID: 207973236}
m_RootOrder: 5
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0.5, y: 0.5}
m_AnchorMax: {x: 0.5, y: 0.5}
Expand Down Expand Up @@ -1466,6 +1465,7 @@ RectTransform:
m_Children:
- {fileID: 576126876}
m_Father: {fileID: 207973236}
m_RootOrder: 4
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0.5, y: 0.5}
m_AnchorMax: {x: 0.5, y: 0.5}
Expand Down Expand Up @@ -1638,13 +1638,13 @@ Transform:
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1808727966}
serializedVersion: 2
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: 579.6337, y: 1769.8843, z: -3.4428744}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 1
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &1845083880
GameObject:
Expand Down Expand Up @@ -1677,6 +1677,7 @@ RectTransform:
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 207973236}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 1, y: 1}
Expand Down Expand Up @@ -1752,6 +1753,7 @@ RectTransform:
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 207973236}
m_RootOrder: 1
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 1}
m_AnchorMax: {x: 1, y: 1}
Expand Down Expand Up @@ -1780,8 +1782,8 @@ MonoBehaviour:
m_Calls: []
m_text: Sourcepoint
m_isRightToLeft: 0
m_fontAsset: {fileID: 11400000, guid: dc36b3fdc14f47ebb36fd484a67e268a, type: 2}
m_sharedMaterial: {fileID: 2140032, guid: dc36b3fdc14f47ebb36fd484a67e268a, type: 2}
m_fontAsset: {fileID: 11400000, guid: 8f586378b4e144a9851e7b34d9b748ee, type: 2}
m_sharedMaterial: {fileID: 2180264, guid: 8f586378b4e144a9851e7b34d9b748ee, type: 2}
m_fontSharedMaterials: []
m_fontMaterial: {fileID: 0}
m_fontMaterials: []
Expand Down Expand Up @@ -1855,11 +1857,3 @@ CanvasRenderer:
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1917161865}
m_CullTransparentMesh: 1
--- !u!1660057539 &9223372036854775807
SceneRoots:
m_ObjectHideFlags: 0
m_Roots:
- {fileID: 519420032}
- {fileID: 207973236}
- {fileID: 131616238}
- {fileID: 1808727969}
8 changes: 4 additions & 4 deletions Assets/ExampleApp/Scripts/PrivacySettings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@

public class PrivacySettings : MonoBehaviour, IOnConsentReady
{
public int accountId = 1909;
public string propertyName = "voodoo.ios";
public int propertyId = 31817;
public string pmId = "838714";
public int accountId = 22;
public string propertyName = "mobile.multicampaign.demo";
public int propertyId = 16893;
public string pmId = "488393";
public string authId = null;
public List<CAMPAIGN_TYPE> campaignTypes = new ();

Expand Down
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
# 2.1.2
* Miscellaneous fixes
* Improve logging system and error handling
* Enabling improved logging in onSpFinished

# 2.1.1
* [DIA-2884](https://sourcepoint.atlassian.net/browse/DIA-2884) Fixed enum error for Android 8.0 [#17](https://github.com/SourcePointUSA/unity-sdk/pull/17)
* [DIA-2583](https://sourcepoint.atlassian.net/browse/DIA-2583) Import scene with `TextMesh Pro` [#16](https://github.com/SourcePointUSA/unity-sdk/pull/16)
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "com.sourcepoint.unitycmp",
"displayName": "Sourcepoint Consent Message Plugin",
"version": "2.1.1",
"version": "2.1.2",
"unity": "2021.3",
"description": "Native UI Privacy Manager for both GDPR and CCPA legislations.",
"author": {
Expand Down
Binary file modified unitypackage/ConsentManagementProvider.unitypackage
Binary file not shown.

0 comments on commit f248d1c

Please sign in to comment.