Skip to content

Commit 62019c3

Browse files
authored
Merge pull request #54 from SourcePointUSA/develop
Release 2.3.1
2 parents 446b691 + 500d3b9 commit 62019c3

File tree

6 files changed

+37
-13
lines changed

6 files changed

+37
-13
lines changed

Assets/ConsentManagementProvider/Scripts/wrapper/iOS/CMPiOSListenerHelper.cs

Lines changed: 25 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -42,15 +42,22 @@ private void Awake()
4242
self=this;
4343
gameObject.name = "CMPiOSListenerHelper";
4444
#if UNITY_IOS && !UNITY_EDITOR_OSX
45-
CmpDebugUtil.Log("Constructing CMPiOSListenerHelper game object...");
46-
DontDestroyOnLoad(this.gameObject);
47-
_setCallbackDefault(Callback);
48-
_setCallbackOnConsentReady(OnConsentReady);
49-
_setCallbackOnConsentUIReady(OnConsentUIReady);
50-
_setCallbackOnConsentAction(OnConsentAction);
51-
_setCallbackOnConsentUIFinished(OnConsentUIFinished);
52-
_setCallbackOnErrorCallback(OnErrorCallback);
53-
_setCallbackOnCustomConsent(OnCustomConsentGDPRCallback);
45+
CmpDebugUtil.Log("Constructing CMPiOSListenerHelper game object...");
46+
DontDestroyOnLoad(this.gameObject);
47+
SetBridgeCallbacks();
48+
#endif
49+
}
50+
51+
internal void SetBridgeCallbacks()
52+
{
53+
#if UNITY_IOS && !UNITY_EDITOR_OSX
54+
_setCallbackDefault(Callback);
55+
_setCallbackOnConsentReady(OnConsentReady);
56+
_setCallbackOnConsentUIReady(OnConsentUIReady);
57+
_setCallbackOnConsentAction(OnConsentAction);
58+
_setCallbackOnConsentUIFinished(OnConsentUIFinished);
59+
_setCallbackOnErrorCallback(OnErrorCallback);
60+
_setCallbackOnCustomConsent(OnCustomConsentGDPRCallback);
5461
#endif
5562
}
5663

@@ -158,5 +165,14 @@ static void OnCustomConsentGDPRCallback(string jsonSPGDPRConsent)
158165
}
159166
}
160167
}
168+
169+
public void Dispose()
170+
{
171+
if (self != null)
172+
{
173+
Destroy(self.gameObject);
174+
self = null;
175+
}
176+
}
161177
}
162178
}

Assets/ConsentManagementProvider/Scripts/wrapper/iOS/ConsentWrapperIOS.cs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,12 @@ public void InitializeLib(
9696
{
9797
#if UNITY_IOS && !UNITY_EDITOR_OSX
9898
_initLib();
99+
if(iOSListener == null)
100+
{
101+
CmpDebugUtil.Log("Creating iosListener");
102+
CreateHelperIOSListener();
103+
}
104+
99105
int campaignsAmount = spCampaigns.Count;
100106
int[] campaignTypes = new int[campaignsAmount];
101107
foreach(SpCampaign sp in spCampaigns)
@@ -200,6 +206,7 @@ public SpConsents GetSpConsents()
200206
public void ClearAllData()
201207
{
202208
#if UNITY_IOS && !UNITY_EDITOR_OSX
209+
iOSListener._spConsents = null;
203210
_cleanConsent();
204211
#endif
205212
}
@@ -208,6 +215,7 @@ public void Dispose()
208215
{
209216
#if UNITY_IOS && !UNITY_EDITOR_OSX
210217
_dispose();
218+
iOSListener.Dispose();
211219
#endif
212220
}
213221
}

Assets/ExampleApp/Scenes/SourcepointSampleScene.unity

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -236,9 +236,6 @@ MonoBehaviour:
236236
accountId: 22
237237
propertyId: 16893
238238
propertyName: mobile.multicampaign.demo
239-
useGDPR: 1
240-
useCCPA: 1
241-
useUSNAT: 1
242239
gdprPmId: 488393
243240
ccpaPmId: 509688
244241
usnatPmId: 943886

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
# 2.3.1
2+
* [DIA-3844](https://sourcepoint.atlassian.net/browse/DIA-3844) Destroy CMPiOSListenerHelper GameObject in Dispose() call and re-initialize it in CMP.Initialize() call if needed. Also, ClearAllData() method for IOS clears cached value in c# [#53](https://github.com/SourcePointUSA/unity-sdk/pull/53)
3+
14
# 2.3.0
25
* [DIA-3046](https://sourcepoint.atlassian.net/browse/DIA-3046) Implemented USNat company for IOS [#47](https://github.com/SourcePointUSA/unity-sdk/pull/47)
36
* [DIA-3630](https://sourcepoint.atlassian.net/browse/DIA-3630) Implemented USNat company for Android [#48](https://github.com/SourcePointUSA/unity-sdk/pull/48)

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "com.sourcepoint.unitycmp",
33
"displayName": "Sourcepoint Consent Message Plugin",
4-
"version": "2.3.0",
4+
"version": "2.3.1",
55
"unity": "2021.3",
66
"description": "Native UI Privacy Manager for both GDPR and CCPA legislations.",
77
"author": {
Binary file not shown.

0 commit comments

Comments
 (0)