cordova-plugin-onetrust-cmp 202602.1.2 → 202603.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +4 -0
- package/package.json +1 -1
- package/plugin.xml +3 -3
- package/src/android/OneTrust.java +28 -0
- package/src/ios/OneTrust.swift +12 -1
package/CHANGELOG.md
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "cordova-plugin-onetrust-cmp",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "202603.1.0",
|
|
4
4
|
"description": "OneTrust is the leading Consent Management solution provider. This plugin exposes OneTrust's native CMP functionality to Cordova and Ionic environments.",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"scripts": {
|
package/plugin.xml
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<?xml version='1.0' encoding='utf-8'?>
|
|
2
|
-
<plugin id="cordova-plugin-onetrust-cmp" version="
|
|
2
|
+
<plugin id="cordova-plugin-onetrust-cmp" version="202603.1.0"
|
|
3
3
|
xmlns="http://apache.org/cordova/ns/plugins/1.0"
|
|
4
4
|
xmlns:android="http://schemas.android.com/apk/res/android">
|
|
5
5
|
<name>OneTrust</name>
|
|
@@ -18,12 +18,12 @@
|
|
|
18
18
|
<config>
|
|
19
19
|
</config>
|
|
20
20
|
<pods use-frameworks="true">
|
|
21
|
-
<pod name="OneTrust-CMP-XCFramework" spec="~>
|
|
21
|
+
<pod name="OneTrust-CMP-XCFramework" spec="~> 202603.1.0.0" />
|
|
22
22
|
</pods>
|
|
23
23
|
</podspec>
|
|
24
24
|
</platform>
|
|
25
25
|
<platform name="android">
|
|
26
|
-
<framework src="com.onetrust.cmp:native-sdk:
|
|
26
|
+
<framework src="com.onetrust.cmp:native-sdk:202603.1.0.0" />
|
|
27
27
|
<framework src="androidx.appcompat:appcompat:1.2.0" />
|
|
28
28
|
<config-file parent="/*" target="res/xml/config.xml">
|
|
29
29
|
<feature name="OneTrust">
|
|
@@ -71,6 +71,9 @@ public class OneTrust extends CordovaPlugin{
|
|
|
71
71
|
String catId = args.getString(0);
|
|
72
72
|
observeChanges(catId);
|
|
73
73
|
return true;
|
|
74
|
+
case "stopObservingChanges":
|
|
75
|
+
stopObservingChanges();
|
|
76
|
+
return true;
|
|
74
77
|
case "addCustomStyles":
|
|
75
78
|
callbackContext.error("Deprecated Method. Add your JSON as androidUXParams in the params object of startSDK.");
|
|
76
79
|
case "getCachedIdentifier":
|
|
@@ -232,6 +235,14 @@ public class OneTrust extends CordovaPlugin{
|
|
|
232
235
|
}
|
|
233
236
|
|
|
234
237
|
private void observeChanges(String catId){
|
|
238
|
+
if (catId.equals("OTConsentUpdated")) {
|
|
239
|
+
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) {
|
|
240
|
+
cordova.getActivity().registerReceiver(otConsentUpdated, new IntentFilter(OTBroadcastServiceKeys.OT_CONSENT_UPDATED), Context.RECEIVER_NOT_EXPORTED);
|
|
241
|
+
} else {
|
|
242
|
+
cordova.getActivity().registerReceiver(otConsentUpdated, new IntentFilter(OTBroadcastServiceKeys.OT_CONSENT_UPDATED));
|
|
243
|
+
}
|
|
244
|
+
return;
|
|
245
|
+
}
|
|
235
246
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) {
|
|
236
247
|
cordova.getActivity().registerReceiver(consentStatusChanged, new IntentFilter(catId), Context.RECEIVER_NOT_EXPORTED);
|
|
237
248
|
} else {
|
|
@@ -240,6 +251,15 @@ public class OneTrust extends CordovaPlugin{
|
|
|
240
251
|
|
|
241
252
|
}
|
|
242
253
|
|
|
254
|
+
private void stopObservingChanges(){
|
|
255
|
+
try{
|
|
256
|
+
cordova.getActivity().unregisterReceiver(consentStatusChanged);
|
|
257
|
+
cordova.getActivity().unregisterReceiver(otConsentUpdated);
|
|
258
|
+
} catch (Exception e) {
|
|
259
|
+
Log.e("ot_log", "Error when trying to unregister receiver.");
|
|
260
|
+
}
|
|
261
|
+
}
|
|
262
|
+
|
|
243
263
|
private void getCachedIdentifier(CallbackContext callbackContext){
|
|
244
264
|
Runnable runnable = new Runnable() {
|
|
245
265
|
@Override
|
|
@@ -325,6 +345,14 @@ public class OneTrust extends CordovaPlugin{
|
|
|
325
345
|
}
|
|
326
346
|
};
|
|
327
347
|
|
|
348
|
+
BroadcastReceiver otConsentUpdated = new BroadcastReceiver() {
|
|
349
|
+
@Override
|
|
350
|
+
public void onReceive(Context context, Intent intent) {
|
|
351
|
+
String category = intent.getAction();
|
|
352
|
+
emit(category, "{}");
|
|
353
|
+
}
|
|
354
|
+
};
|
|
355
|
+
|
|
328
356
|
private void startCMPActivity(int uiType){
|
|
329
357
|
Intent intent = new Intent(cordova.getContext(), CMPActivity.class);
|
|
330
358
|
intent.putExtra("UIType", uiType);
|
package/src/ios/OneTrust.swift
CHANGED
|
@@ -155,7 +155,11 @@ import AppTrackingTransparency
|
|
|
155
155
|
func observeChanges(_ command:CDVInvokedUrlCommand){
|
|
156
156
|
var pluginResult = CDVPluginResult(status: CDVCommandStatus_ERROR)
|
|
157
157
|
if let category = command.argument(at: 0) as? String{
|
|
158
|
-
|
|
158
|
+
if category == "OTConsentUpdated" {
|
|
159
|
+
NotificationCenter.default.addObserver(self, selector: #selector(otConsentUpdated(_:)), name: Notification.Name(category), object: nil)
|
|
160
|
+
} else {
|
|
161
|
+
NotificationCenter.default.addObserver(self, selector: #selector(consentChanged(_:)), name: Notification.Name(category), object: nil)
|
|
162
|
+
}
|
|
159
163
|
pluginResult = CDVPluginResult(status: CDVCommandStatus_OK)
|
|
160
164
|
}
|
|
161
165
|
self.returnToCordova(pluginResult: pluginResult, command: command)
|
|
@@ -264,6 +268,13 @@ import AppTrackingTransparency
|
|
|
264
268
|
|
|
265
269
|
}
|
|
266
270
|
|
|
271
|
+
@objc private func otConsentUpdated(_ notification:Notification){
|
|
272
|
+
let ex = "cordova.fireDocumentEvent('OTConsentUpdated',{});"
|
|
273
|
+
DispatchQueue.main.async{
|
|
274
|
+
self.webViewEngine.evaluateJavaScript(ex, completionHandler: nil)
|
|
275
|
+
}
|
|
276
|
+
}
|
|
277
|
+
|
|
267
278
|
private func getATTStatusAsString() -> String?{
|
|
268
279
|
guard #available(iOS 14, *) else {return nil}
|
|
269
280
|
let statusMap:[ATTrackingManager.AuthorizationStatus:String] = [.authorized:"authorized", .denied:"denied", .notDetermined:"notDetermined", .restricted:"restricted"]
|