@didomi/react-native 1.6.0 → 1.7.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/android/build.gradle +1 -1
- package/android/src/main/java/com/reactnativedidomi/DidomiModule.kt +10 -9
- package/ios/RNDidomi.swift +55 -39
- package/lib/commonjs/Constants.js +1 -1
- package/lib/commonjs/Constants.js.map +1 -1
- package/lib/module/Constants.js +1 -1
- package/lib/module/Constants.js.map +1 -1
- package/lib/typescript/Constants.d.ts +1 -1
- package/package.json +1 -1
- package/react-native-didomi.podspec +1 -1
- package/src/Constants.ts +1 -1
package/android/build.gradle
CHANGED
|
@@ -270,7 +270,8 @@ class DidomiModule(reactContext: ReactApplicationContext) : ReactContextBaseJava
|
|
|
270
270
|
noticeId
|
|
271
271
|
)
|
|
272
272
|
|
|
273
|
-
|
|
273
|
+
val application = currentActivity?.application ?: throw IllegalStateException("No activity present")
|
|
274
|
+
Didomi.getInstance().initialize(application, parameters)
|
|
274
275
|
|
|
275
276
|
Didomi.getInstance().onReady { prepareEvent(EventTypes.READY_CALLBACK.event, null) }
|
|
276
277
|
Didomi.getInstance().onError { prepareEvent(EventTypes.ERROR_CALLBACK.event, null) }
|
|
@@ -278,7 +279,7 @@ class DidomiModule(reactContext: ReactApplicationContext) : ReactContextBaseJava
|
|
|
278
279
|
promise.resolve(0)
|
|
279
280
|
|
|
280
281
|
} catch (e: Exception) {
|
|
281
|
-
Log.e("initialize", "Error while initializing the Didomi SDK", e)
|
|
282
|
+
Log.e("initialize", "Error while initializing the Didomi SDK", e)
|
|
282
283
|
promise.reject(e)
|
|
283
284
|
}
|
|
284
285
|
}
|
|
@@ -287,7 +288,7 @@ class DidomiModule(reactContext: ReactApplicationContext) : ReactContextBaseJava
|
|
|
287
288
|
fun setupUI(promise: Promise) {
|
|
288
289
|
try {
|
|
289
290
|
runOnUiThread {
|
|
290
|
-
Didomi.getInstance().setupUI(currentActivity as FragmentActivity)
|
|
291
|
+
Didomi.getInstance().setupUI(currentActivity as? FragmentActivity)
|
|
291
292
|
}
|
|
292
293
|
promise.resolve(0)
|
|
293
294
|
} catch (e: Exception) {
|
|
@@ -531,7 +532,7 @@ class DidomiModule(reactContext: ReactApplicationContext) : ReactContextBaseJava
|
|
|
531
532
|
@ReactMethod
|
|
532
533
|
fun getUserStatus(promise: Promise) {
|
|
533
534
|
try {
|
|
534
|
-
promise.resolve(objectToWritableMap(Didomi.getInstance().
|
|
535
|
+
promise.resolve(objectToWritableMap(Didomi.getInstance().userStatus))
|
|
535
536
|
} catch (e: DidomiNotReadyException) {
|
|
536
537
|
promise.reject(e)
|
|
537
538
|
}
|
|
@@ -596,7 +597,7 @@ class DidomiModule(reactContext: ReactApplicationContext) : ReactContextBaseJava
|
|
|
596
597
|
@ReactMethod
|
|
597
598
|
fun isNoticeVisible(promise: Promise) {
|
|
598
599
|
try {
|
|
599
|
-
promise.resolve(Didomi.getInstance().isNoticeVisible)
|
|
600
|
+
promise.resolve(Didomi.getInstance().isNoticeVisible())
|
|
600
601
|
} catch (e: DidomiNotReadyException) {
|
|
601
602
|
promise.reject(e)
|
|
602
603
|
}
|
|
@@ -605,7 +606,7 @@ class DidomiModule(reactContext: ReactApplicationContext) : ReactContextBaseJava
|
|
|
605
606
|
@ReactMethod
|
|
606
607
|
fun isPreferencesVisible(promise: Promise) {
|
|
607
608
|
try {
|
|
608
|
-
promise.resolve(Didomi.getInstance().isPreferencesVisible)
|
|
609
|
+
promise.resolve(Didomi.getInstance().isPreferencesVisible())
|
|
609
610
|
} catch (e: DidomiNotReadyException) {
|
|
610
611
|
promise.reject(e)
|
|
611
612
|
}
|
|
@@ -718,7 +719,7 @@ class DidomiModule(reactContext: ReactApplicationContext) : ReactContextBaseJava
|
|
|
718
719
|
fun showNotice(promise: Promise) {
|
|
719
720
|
try {
|
|
720
721
|
runOnUiThread {
|
|
721
|
-
Didomi.getInstance().showNotice(currentActivity as FragmentActivity)
|
|
722
|
+
Didomi.getInstance().showNotice(currentActivity as? FragmentActivity)
|
|
722
723
|
}
|
|
723
724
|
promise.resolve(0)
|
|
724
725
|
} catch (e: Exception) {
|
|
@@ -732,8 +733,8 @@ class DidomiModule(reactContext: ReactApplicationContext) : ReactContextBaseJava
|
|
|
732
733
|
try {
|
|
733
734
|
runOnUiThread {
|
|
734
735
|
view?.also {
|
|
735
|
-
Didomi.getInstance().showPreferences(currentActivity as FragmentActivity, view)
|
|
736
|
-
} ?: Didomi.getInstance().showPreferences(currentActivity as FragmentActivity)
|
|
736
|
+
Didomi.getInstance().showPreferences(currentActivity as? FragmentActivity, view)
|
|
737
|
+
} ?: Didomi.getInstance().showPreferences(currentActivity as? FragmentActivity)
|
|
737
738
|
}
|
|
738
739
|
promise.resolve(0)
|
|
739
740
|
} catch (e: Exception) {
|
package/ios/RNDidomi.swift
CHANGED
|
@@ -6,8 +6,14 @@ import AppTrackingTransparency
|
|
|
6
6
|
class RNDidomi: RCTEventEmitter {
|
|
7
7
|
|
|
8
8
|
public static var initialized = false
|
|
9
|
-
|
|
10
|
-
|
|
9
|
+
var didomiEventListener: EventListener
|
|
10
|
+
|
|
11
|
+
override init() {
|
|
12
|
+
didomiEventListener = EventListener()
|
|
13
|
+
super.init()
|
|
14
|
+
initEventListener()
|
|
15
|
+
}
|
|
16
|
+
|
|
11
17
|
override static func requiresMainQueueSetup() -> Bool {
|
|
12
18
|
return true
|
|
13
19
|
}
|
|
@@ -36,13 +42,13 @@ class RNDidomi: RCTEventEmitter {
|
|
|
36
42
|
|
|
37
43
|
private func onReady() {
|
|
38
44
|
Didomi.shared.onReady {
|
|
39
|
-
self.
|
|
45
|
+
self.dispatchEvent(withName: "on_ready_callback", body: nil)
|
|
40
46
|
}
|
|
41
47
|
}
|
|
42
48
|
|
|
43
49
|
private func onError() {
|
|
44
50
|
Didomi.shared.onError { error in
|
|
45
|
-
self.
|
|
51
|
+
self.dispatchEvent(withName: "on_error_callback", body: error.descriptionText)
|
|
46
52
|
}
|
|
47
53
|
}
|
|
48
54
|
|
|
@@ -530,135 +536,145 @@ extension RNDidomi {
|
|
|
530
536
|
"on_sync_error"
|
|
531
537
|
]
|
|
532
538
|
}
|
|
539
|
+
|
|
540
|
+
private func initEventListener() {
|
|
533
541
|
|
|
534
|
-
private func initEventListener(){
|
|
535
|
-
|
|
536
542
|
didomiEventListener.onConsentChanged = { event in
|
|
537
|
-
self.
|
|
543
|
+
self.dispatchEvent(withName: "on_consent_changed", body:"")
|
|
538
544
|
}
|
|
539
545
|
|
|
540
546
|
didomiEventListener.onReady = { event in
|
|
541
|
-
self.
|
|
547
|
+
self.dispatchEvent(withName: "on_ready", body: "")
|
|
542
548
|
}
|
|
543
549
|
|
|
544
550
|
didomiEventListener.onError = { event in
|
|
545
|
-
self.
|
|
551
|
+
self.dispatchEvent(withName: "on_error", body: "")
|
|
546
552
|
}
|
|
547
553
|
|
|
548
554
|
didomiEventListener.onShowNotice = { event in
|
|
549
|
-
self.
|
|
555
|
+
self.dispatchEvent(withName: "on_show_notice", body: "")
|
|
550
556
|
}
|
|
551
557
|
|
|
552
558
|
didomiEventListener.onHideNotice = { event in
|
|
553
|
-
self.
|
|
559
|
+
self.dispatchEvent(withName: "on_hide_notice", body: "")
|
|
554
560
|
}
|
|
555
561
|
|
|
556
562
|
didomiEventListener.onNoticeClickAgree = { event in
|
|
557
|
-
self.
|
|
563
|
+
self.dispatchEvent(withName: "on_notice_click_agree", body: "")
|
|
558
564
|
}
|
|
559
565
|
|
|
560
566
|
didomiEventListener.onNoticeClickDisagree = { event in
|
|
561
|
-
self.
|
|
567
|
+
self.dispatchEvent(withName: "on_notice_click_disagree", body: "")
|
|
562
568
|
}
|
|
563
569
|
|
|
564
570
|
didomiEventListener.onNoticeClickMoreInfo = { event in
|
|
565
|
-
self.
|
|
571
|
+
self.dispatchEvent(withName: "on_notice_click_more_info", body: "")
|
|
566
572
|
}
|
|
567
|
-
|
|
573
|
+
|
|
568
574
|
didomiEventListener.onNoticeClickViewVendors = { event in
|
|
569
|
-
self.
|
|
575
|
+
self.dispatchEvent(withName: "on_notice_click_view_vendors", body: "")
|
|
570
576
|
}
|
|
571
|
-
|
|
577
|
+
|
|
572
578
|
didomiEventListener.onNoticeClickPrivacyPolicy = { event in
|
|
573
|
-
self.
|
|
579
|
+
self.dispatchEvent(withName: "on_notice_click_privacy_policy", body: "")
|
|
574
580
|
}
|
|
575
581
|
|
|
576
582
|
didomiEventListener.onShowPreferences = { event in
|
|
577
|
-
self.
|
|
583
|
+
self.dispatchEvent(withName: "on_show_preferences", body: "")
|
|
578
584
|
}
|
|
579
585
|
|
|
580
586
|
didomiEventListener.onHidePreferences = { event in
|
|
581
|
-
self.
|
|
587
|
+
self.dispatchEvent(withName: "on_hide_preferences", body: "")
|
|
582
588
|
}
|
|
583
589
|
|
|
584
590
|
didomiEventListener.onPreferencesClickAgreeToAll = { event in
|
|
585
|
-
self.
|
|
591
|
+
self.dispatchEvent(withName: "on_preferences_click_agree_to_all", body: "")
|
|
586
592
|
}
|
|
587
593
|
|
|
588
594
|
didomiEventListener.onPreferencesClickDisagreeToAll = { event in
|
|
589
|
-
self.
|
|
595
|
+
self.dispatchEvent(withName: "on_preferences_click_disagree_to_all", body: "")
|
|
590
596
|
}
|
|
591
597
|
|
|
592
598
|
didomiEventListener.onPreferencesClickAgreeToAllPurposes = { event in
|
|
593
|
-
self.
|
|
599
|
+
self.dispatchEvent(withName: "on_preferences_click_agree_to_all_purposes", body: "")
|
|
594
600
|
}
|
|
595
601
|
|
|
596
602
|
didomiEventListener.onPreferencesClickDisagreeToAllPurposes = { event in
|
|
597
|
-
self.
|
|
603
|
+
self.dispatchEvent(withName: "on_preferences_click_disagree_to_all_purposes", body: "")
|
|
598
604
|
}
|
|
599
605
|
|
|
600
606
|
didomiEventListener.onPreferencesClickResetAllPurposes = { event in
|
|
601
|
-
self.
|
|
607
|
+
self.dispatchEvent(withName: "on_preferences_click_reset_all_purposes", body: "")
|
|
602
608
|
}
|
|
603
609
|
|
|
604
610
|
didomiEventListener.onPreferencesClickAgreeToAllVendors = { event in
|
|
605
|
-
self.
|
|
611
|
+
self.dispatchEvent(withName: "on_preferences_click_agree_to_all_vendors", body: "")
|
|
606
612
|
}
|
|
607
613
|
|
|
608
614
|
didomiEventListener.onPreferencesClickDisagreeToAllVendors = { event in
|
|
609
|
-
self.
|
|
615
|
+
self.dispatchEvent(withName: "on_preferences_click_disagree_to_all_vendors", body: "")
|
|
610
616
|
}
|
|
611
617
|
|
|
612
618
|
didomiEventListener.onPreferencesClickPurposeAgree = { event, purposeId in
|
|
613
|
-
self.
|
|
619
|
+
self.dispatchEvent(withName: "on_preferences_click_purpose_agree", body: purposeId)
|
|
614
620
|
}
|
|
615
621
|
|
|
616
622
|
didomiEventListener.onPreferencesClickPurposeDisagree = { event, purposeId in
|
|
617
|
-
self.
|
|
623
|
+
self.dispatchEvent(withName: "on_preferences_click_purpose_disagree", body: purposeId)
|
|
618
624
|
}
|
|
619
625
|
|
|
620
626
|
didomiEventListener.onPreferencesClickCategoryAgree = { event, categoryId in
|
|
621
|
-
self.
|
|
627
|
+
self.dispatchEvent(withName: "on_preferences_click_category_agree", body: categoryId)
|
|
622
628
|
}
|
|
623
629
|
|
|
624
630
|
didomiEventListener.onPreferencesClickCategoryDisagree = { event, categoryId in
|
|
625
|
-
self.
|
|
631
|
+
self.dispatchEvent(withName: "on_preferences_click_category_disagree", body: categoryId)
|
|
626
632
|
}
|
|
627
633
|
|
|
628
634
|
didomiEventListener.onPreferencesClickViewVendors = { event in
|
|
629
|
-
self.
|
|
635
|
+
self.dispatchEvent(withName: "on_preferences_click_view_vendors", body: "")
|
|
630
636
|
}
|
|
631
637
|
|
|
632
638
|
didomiEventListener.onPreferencesClickViewPurposes = { event in
|
|
633
|
-
self.
|
|
639
|
+
self.dispatchEvent(withName: "on_preferences_click_view_purposes", body: "")
|
|
634
640
|
}
|
|
635
641
|
|
|
636
642
|
didomiEventListener.onPreferencesClickSaveChoices = { event in
|
|
637
|
-
self.
|
|
643
|
+
self.dispatchEvent(withName: "on_preferences_click_save_choices", body: "")
|
|
638
644
|
}
|
|
639
645
|
|
|
640
646
|
didomiEventListener.onPreferencesClickVendorAgree = { event, vendorId in
|
|
641
|
-
self.
|
|
647
|
+
self.dispatchEvent(withName: "on_preferences_click_vendor_agree", body: vendorId)
|
|
642
648
|
}
|
|
643
649
|
|
|
644
650
|
didomiEventListener.onPreferencesClickVendorDisagree = { event, vendorId in
|
|
645
|
-
self.
|
|
651
|
+
self.dispatchEvent(withName: "on_preferences_click_vendor_disagree", body: vendorId)
|
|
646
652
|
}
|
|
647
653
|
|
|
648
654
|
didomiEventListener.onPreferencesClickVendorSaveChoices = { event in
|
|
649
|
-
self.
|
|
655
|
+
self.dispatchEvent(withName: "on_preferences_click_vendor_save_choices", body: "")
|
|
650
656
|
}
|
|
651
657
|
|
|
652
658
|
didomiEventListener.onSyncDone = { event, organizationUserId in
|
|
653
|
-
self.
|
|
659
|
+
self.dispatchEvent(withName: "on_sync_done", body: organizationUserId)
|
|
654
660
|
}
|
|
655
661
|
|
|
656
662
|
didomiEventListener.onSyncError = { event, error in
|
|
657
|
-
self.
|
|
663
|
+
self.dispatchEvent(withName: "on_sync_error", body: error)
|
|
658
664
|
}
|
|
659
665
|
|
|
660
666
|
Didomi.shared.addEventListener(listener: didomiEventListener)
|
|
661
667
|
}
|
|
668
|
+
|
|
669
|
+
/// Sends the specified event only if the react-native bridge is still valid
|
|
670
|
+
private func dispatchEvent(withName: String, body: String?) {
|
|
671
|
+
if self.bridge != nil {
|
|
672
|
+
self.sendEvent(withName: withName, body: body)
|
|
673
|
+
} else {
|
|
674
|
+
// Event emitter is not valid anymore, remove event listener
|
|
675
|
+
Didomi.shared.removeEventListener(listener: didomiEventListener)
|
|
676
|
+
}
|
|
677
|
+
}
|
|
662
678
|
}
|
|
663
679
|
|
|
664
680
|
extension Int {
|
|
@@ -8,6 +8,6 @@ exports.DIDOMI_VERSION = exports.DIDOMI_USER_AGENT_NAME = void 0;
|
|
|
8
8
|
const DIDOMI_USER_AGENT_NAME = "Didomi React-Native SDK"; // User agent version
|
|
9
9
|
|
|
10
10
|
exports.DIDOMI_USER_AGENT_NAME = DIDOMI_USER_AGENT_NAME;
|
|
11
|
-
const DIDOMI_VERSION = "1.
|
|
11
|
+
const DIDOMI_VERSION = "1.7.0";
|
|
12
12
|
exports.DIDOMI_VERSION = DIDOMI_VERSION;
|
|
13
13
|
//# sourceMappingURL=Constants.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["Constants.ts"],"names":["DIDOMI_USER_AGENT_NAME","DIDOMI_VERSION"],"mappings":";;;;;;AAAA;AACO,MAAMA,sBAAsB,GAAG,yBAA/B,C,CACP;;;AACO,MAAMC,cAAc,GAAG,OAAvB","sourcesContent":["// User agent name\nexport const DIDOMI_USER_AGENT_NAME = \"Didomi React-Native SDK\"\n// User agent version\nexport const DIDOMI_VERSION = \"1.
|
|
1
|
+
{"version":3,"sources":["Constants.ts"],"names":["DIDOMI_USER_AGENT_NAME","DIDOMI_VERSION"],"mappings":";;;;;;AAAA;AACO,MAAMA,sBAAsB,GAAG,yBAA/B,C,CACP;;;AACO,MAAMC,cAAc,GAAG,OAAvB","sourcesContent":["// User agent name\nexport const DIDOMI_USER_AGENT_NAME = \"Didomi React-Native SDK\"\n// User agent version\nexport const DIDOMI_VERSION = \"1.7.0\"\n"]}
|
package/lib/module/Constants.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["Constants.ts"],"names":["DIDOMI_USER_AGENT_NAME","DIDOMI_VERSION"],"mappings":"AAAA;AACA,OAAO,MAAMA,sBAAsB,GAAG,yBAA/B,C,CACP;;AACA,OAAO,MAAMC,cAAc,GAAG,OAAvB","sourcesContent":["// User agent name\nexport const DIDOMI_USER_AGENT_NAME = \"Didomi React-Native SDK\"\n// User agent version\nexport const DIDOMI_VERSION = \"1.
|
|
1
|
+
{"version":3,"sources":["Constants.ts"],"names":["DIDOMI_USER_AGENT_NAME","DIDOMI_VERSION"],"mappings":"AAAA;AACA,OAAO,MAAMA,sBAAsB,GAAG,yBAA/B,C,CACP;;AACA,OAAO,MAAMC,cAAc,GAAG,OAAvB","sourcesContent":["// User agent name\nexport const DIDOMI_USER_AGENT_NAME = \"Didomi React-Native SDK\"\n// User agent version\nexport const DIDOMI_VERSION = \"1.7.0\"\n"]}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export declare const DIDOMI_USER_AGENT_NAME = "Didomi React-Native SDK";
|
|
2
|
-
export declare const DIDOMI_VERSION = "1.
|
|
2
|
+
export declare const DIDOMI_VERSION = "1.7.0";
|
package/package.json
CHANGED
package/src/Constants.ts
CHANGED