@didomi/react-native 2.26.0 → 2.28.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 +29 -2
- package/android/src/main/java/io/didomi/reactnative/DidomiModule.kt +130 -74
- package/android/src/main/java/io/didomi/reactnative/DidomiPackage.kt +19 -8
- package/android/src/newarch/java/io/didomi/reactnative/DidomiModuleSpec.kt +6 -0
- package/android/src/oldarch/java/io/didomi/reactnative/DidomiModuleSpec.kt +222 -0
- package/ios/Didomi.m +9 -3
- package/ios/RNDidomi+TurboModule.mm +24 -0
- package/ios/RNDidomi.swift +16 -10
- package/lib/commonjs/Constants.js +1 -1
- package/lib/commonjs/Didomi.js +3 -4
- package/lib/commonjs/Didomi.js.map +1 -1
- package/lib/commonjs/DidomiListener.js +3 -3
- package/lib/commonjs/DidomiListener.js.map +1 -1
- package/lib/commonjs/specs/NativeDidomi.js +9 -0
- package/lib/commonjs/specs/NativeDidomi.js.map +1 -0
- package/lib/module/Constants.js +1 -1
- package/lib/module/Didomi.js +2 -4
- package/lib/module/Didomi.js.map +1 -1
- package/lib/module/DidomiListener.js +3 -4
- package/lib/module/DidomiListener.js.map +1 -1
- package/lib/module/specs/NativeDidomi.js +5 -0
- package/lib/module/specs/NativeDidomi.js.map +1 -0
- package/lib/typescript/Constants.d.ts +1 -1
- package/lib/typescript/DidomiListener.d.ts.map +1 -1
- package/lib/typescript/specs/NativeDidomi.d.ts +73 -0
- package/lib/typescript/specs/NativeDidomi.d.ts.map +1 -0
- package/package.json +10 -1
- package/react-native-didomi.podspec +3 -2
- package/src/Constants.ts +1 -1
- package/src/Didomi.ts +2 -2
- package/src/DidomiListener.ts +3 -2
- package/src/specs/NativeDidomi.ts +187 -0
|
@@ -24,7 +24,11 @@ import org.json.JSONArray
|
|
|
24
24
|
import org.json.JSONException
|
|
25
25
|
import org.json.JSONObject
|
|
26
26
|
|
|
27
|
-
class DidomiModule(reactContext: ReactApplicationContext) :
|
|
27
|
+
class DidomiModule(reactContext: ReactApplicationContext) : DidomiModuleSpec(reactContext) {
|
|
28
|
+
|
|
29
|
+
companion object {
|
|
30
|
+
const val NAME = "Didomi"
|
|
31
|
+
}
|
|
28
32
|
|
|
29
33
|
val gson = Gson()
|
|
30
34
|
|
|
@@ -247,7 +251,7 @@ class DidomiModule(reactContext: ReactApplicationContext) : ReactContextBaseJava
|
|
|
247
251
|
private val syncAcknowledgedCallbacks: MutableMap<Int, () -> Boolean> = mutableMapOf()
|
|
248
252
|
private var syncAcknowledgedCallbackIndex = 0
|
|
249
253
|
|
|
250
|
-
override fun getName() =
|
|
254
|
+
override fun getName() = NAME
|
|
251
255
|
|
|
252
256
|
override fun getConstants(): Map<String, Any> {
|
|
253
257
|
val map = mutableMapOf<String, Any>()
|
|
@@ -327,7 +331,7 @@ class DidomiModule(reactContext: ReactApplicationContext) : ReactContextBaseJava
|
|
|
327
331
|
}
|
|
328
332
|
|
|
329
333
|
@ReactMethod
|
|
330
|
-
fun initialize(
|
|
334
|
+
override fun initialize(
|
|
331
335
|
userAgentName: String,
|
|
332
336
|
userAgentVersion: String,
|
|
333
337
|
apiKey: String,
|
|
@@ -375,7 +379,7 @@ class DidomiModule(reactContext: ReactApplicationContext) : ReactContextBaseJava
|
|
|
375
379
|
}
|
|
376
380
|
|
|
377
381
|
@ReactMethod
|
|
378
|
-
fun initializeWithParameters(
|
|
382
|
+
override fun initializeWithParameters(
|
|
379
383
|
userAgentName: String,
|
|
380
384
|
userAgentVersion: String,
|
|
381
385
|
jsonParameters: String,
|
|
@@ -399,19 +403,19 @@ class DidomiModule(reactContext: ReactApplicationContext) : ReactContextBaseJava
|
|
|
399
403
|
}
|
|
400
404
|
|
|
401
405
|
@ReactMethod
|
|
402
|
-
fun onReady(promise: Promise) {
|
|
406
|
+
override fun onReady(promise: Promise) {
|
|
403
407
|
Didomi.getInstance().onReady { prepareEvent(EventTypes.READY_CALLBACK.event, null) }
|
|
404
408
|
promise.resolve(0)
|
|
405
409
|
}
|
|
406
410
|
|
|
407
411
|
@ReactMethod
|
|
408
|
-
fun onError(promise: Promise) {
|
|
412
|
+
override fun onError(promise: Promise) {
|
|
409
413
|
Didomi.getInstance().onError { prepareEvent(EventTypes.ERROR_CALLBACK.event, null) }
|
|
410
414
|
promise.resolve(0)
|
|
411
415
|
}
|
|
412
416
|
|
|
413
417
|
@ReactMethod
|
|
414
|
-
fun setupUI(promise: Promise) {
|
|
418
|
+
override fun setupUI(promise: Promise) {
|
|
415
419
|
try {
|
|
416
420
|
runOnUiThread {
|
|
417
421
|
Didomi.getInstance().setupUI(reactContext.currentActivity as? FragmentActivity)
|
|
@@ -424,9 +428,9 @@ class DidomiModule(reactContext: ReactApplicationContext) : ReactContextBaseJava
|
|
|
424
428
|
}
|
|
425
429
|
|
|
426
430
|
@ReactMethod
|
|
427
|
-
fun setLogLevel(level:
|
|
431
|
+
override fun setLogLevel(level: Double, promise: Promise) {
|
|
428
432
|
Didomi.getInstance().setLogLevel(
|
|
429
|
-
when (level) {
|
|
433
|
+
when (level.toInt()) {
|
|
430
434
|
0 -> Log.INFO
|
|
431
435
|
1 -> Log.DEBUG
|
|
432
436
|
2 -> Log.WARN
|
|
@@ -439,7 +443,7 @@ class DidomiModule(reactContext: ReactApplicationContext) : ReactContextBaseJava
|
|
|
439
443
|
}
|
|
440
444
|
|
|
441
445
|
@ReactMethod
|
|
442
|
-
fun getJavaScriptForWebView(extra: String?, promise: Promise) {
|
|
446
|
+
override fun getJavaScriptForWebView(extra: String?, promise: Promise) {
|
|
443
447
|
try {
|
|
444
448
|
extra?.also {
|
|
445
449
|
promise.resolve(Didomi.getInstance().getJavaScriptForWebView(extra))
|
|
@@ -452,7 +456,7 @@ class DidomiModule(reactContext: ReactApplicationContext) : ReactContextBaseJava
|
|
|
452
456
|
}
|
|
453
457
|
|
|
454
458
|
@ReactMethod
|
|
455
|
-
fun getQueryStringForWebView(promise: Promise) {
|
|
459
|
+
override fun getQueryStringForWebView(promise: Promise) {
|
|
456
460
|
try {
|
|
457
461
|
promise.resolve(Didomi.getInstance().queryStringForWebView)
|
|
458
462
|
} catch (e: DidomiNotReadyException) {
|
|
@@ -461,7 +465,7 @@ class DidomiModule(reactContext: ReactApplicationContext) : ReactContextBaseJava
|
|
|
461
465
|
}
|
|
462
466
|
|
|
463
467
|
@ReactMethod
|
|
464
|
-
fun getPurpose(purposeId: String, promise: Promise) {
|
|
468
|
+
override fun getPurpose(purposeId: String, promise: Promise) {
|
|
465
469
|
try {
|
|
466
470
|
promise.resolve(objectToWritableMap(Didomi.getInstance().getPurpose(purposeId)))
|
|
467
471
|
} catch (e: DidomiNotReadyException) {
|
|
@@ -470,7 +474,7 @@ class DidomiModule(reactContext: ReactApplicationContext) : ReactContextBaseJava
|
|
|
470
474
|
}
|
|
471
475
|
|
|
472
476
|
@ReactMethod
|
|
473
|
-
fun getRequiredPurposes(promise: Promise) {
|
|
477
|
+
override fun getRequiredPurposes(promise: Promise) {
|
|
474
478
|
try {
|
|
475
479
|
promise.resolve(setToWritableArray(Didomi.getInstance().requiredPurposes))
|
|
476
480
|
} catch (e: DidomiNotReadyException) {
|
|
@@ -479,7 +483,7 @@ class DidomiModule(reactContext: ReactApplicationContext) : ReactContextBaseJava
|
|
|
479
483
|
}
|
|
480
484
|
|
|
481
485
|
@ReactMethod
|
|
482
|
-
fun getRequiredPurposeIds(promise: Promise) {
|
|
486
|
+
override fun getRequiredPurposeIds(promise: Promise) {
|
|
483
487
|
try {
|
|
484
488
|
promise.resolve(setOfStringToWritableArray(Didomi.getInstance().requiredPurposeIds))
|
|
485
489
|
} catch (e: DidomiNotReadyException) {
|
|
@@ -488,7 +492,7 @@ class DidomiModule(reactContext: ReactApplicationContext) : ReactContextBaseJava
|
|
|
488
492
|
}
|
|
489
493
|
|
|
490
494
|
@ReactMethod
|
|
491
|
-
fun getVendor(vendorId: String, promise: Promise) {
|
|
495
|
+
override fun getVendor(vendorId: String, promise: Promise) {
|
|
492
496
|
try {
|
|
493
497
|
promise.resolve(objectToWritableMap(Didomi.getInstance().getVendor(vendorId)))
|
|
494
498
|
} catch (e: DidomiNotReadyException) {
|
|
@@ -497,7 +501,7 @@ class DidomiModule(reactContext: ReactApplicationContext) : ReactContextBaseJava
|
|
|
497
501
|
}
|
|
498
502
|
|
|
499
503
|
@ReactMethod
|
|
500
|
-
fun getTotalVendorCount(promise: Promise) {
|
|
504
|
+
override fun getTotalVendorCount(promise: Promise) {
|
|
501
505
|
try {
|
|
502
506
|
promise.resolve(Didomi.getInstance().getTotalVendorCount())
|
|
503
507
|
} catch (e: DidomiNotReadyException) {
|
|
@@ -506,7 +510,7 @@ class DidomiModule(reactContext: ReactApplicationContext) : ReactContextBaseJava
|
|
|
506
510
|
}
|
|
507
511
|
|
|
508
512
|
@ReactMethod
|
|
509
|
-
fun getIabVendorCount(promise: Promise) {
|
|
513
|
+
override fun getIabVendorCount(promise: Promise) {
|
|
510
514
|
try {
|
|
511
515
|
promise.resolve(Didomi.getInstance().getIabVendorCount())
|
|
512
516
|
} catch (e: DidomiNotReadyException) {
|
|
@@ -515,7 +519,7 @@ class DidomiModule(reactContext: ReactApplicationContext) : ReactContextBaseJava
|
|
|
515
519
|
}
|
|
516
520
|
|
|
517
521
|
@ReactMethod
|
|
518
|
-
fun getNonIabVendorCount(promise: Promise) {
|
|
522
|
+
override fun getNonIabVendorCount(promise: Promise) {
|
|
519
523
|
try {
|
|
520
524
|
promise.resolve(Didomi.getInstance().getNonIabVendorCount())
|
|
521
525
|
} catch (e: DidomiNotReadyException) {
|
|
@@ -524,7 +528,7 @@ class DidomiModule(reactContext: ReactApplicationContext) : ReactContextBaseJava
|
|
|
524
528
|
}
|
|
525
529
|
|
|
526
530
|
@ReactMethod
|
|
527
|
-
fun getRequiredVendors(promise: Promise) {
|
|
531
|
+
override fun getRequiredVendors(promise: Promise) {
|
|
528
532
|
try {
|
|
529
533
|
promise.resolve(setToWritableArray(Didomi.getInstance().requiredVendors))
|
|
530
534
|
} catch (e: DidomiNotReadyException) {
|
|
@@ -533,7 +537,7 @@ class DidomiModule(reactContext: ReactApplicationContext) : ReactContextBaseJava
|
|
|
533
537
|
}
|
|
534
538
|
|
|
535
539
|
@ReactMethod
|
|
536
|
-
fun getRequiredVendorIds(promise: Promise) {
|
|
540
|
+
override fun getRequiredVendorIds(promise: Promise) {
|
|
537
541
|
try {
|
|
538
542
|
promise.resolve(setOfStringToWritableArray(Didomi.getInstance().requiredVendorIds))
|
|
539
543
|
} catch (e: DidomiNotReadyException) {
|
|
@@ -542,7 +546,7 @@ class DidomiModule(reactContext: ReactApplicationContext) : ReactContextBaseJava
|
|
|
542
546
|
}
|
|
543
547
|
|
|
544
548
|
@ReactMethod
|
|
545
|
-
fun getText(textKey: String, promise: Promise) {
|
|
549
|
+
override fun getText(textKey: String, promise: Promise) {
|
|
546
550
|
try {
|
|
547
551
|
val map = Didomi.getInstance().getText(textKey)
|
|
548
552
|
val writableMap = WritableNativeMap()
|
|
@@ -558,7 +562,7 @@ class DidomiModule(reactContext: ReactApplicationContext) : ReactContextBaseJava
|
|
|
558
562
|
}
|
|
559
563
|
|
|
560
564
|
@ReactMethod
|
|
561
|
-
fun getTranslatedText(key: String, promise: Promise) {
|
|
565
|
+
override fun getTranslatedText(key: String, promise: Promise) {
|
|
562
566
|
try {
|
|
563
567
|
promise.resolve(Didomi.getInstance().getTranslatedText(key))
|
|
564
568
|
} catch (e: DidomiNotReadyException) {
|
|
@@ -567,7 +571,7 @@ class DidomiModule(reactContext: ReactApplicationContext) : ReactContextBaseJava
|
|
|
567
571
|
}
|
|
568
572
|
|
|
569
573
|
@ReactMethod
|
|
570
|
-
fun getCurrentUserStatus(promise: Promise) {
|
|
574
|
+
override fun getCurrentUserStatus(promise: Promise) {
|
|
571
575
|
try {
|
|
572
576
|
promise.resolve(objectToWritableMap(Didomi.getInstance().currentUserStatus))
|
|
573
577
|
} catch (e: DidomiNotReadyException) {
|
|
@@ -576,7 +580,7 @@ class DidomiModule(reactContext: ReactApplicationContext) : ReactContextBaseJava
|
|
|
576
580
|
}
|
|
577
581
|
|
|
578
582
|
@ReactMethod
|
|
579
|
-
fun getUserStatus(promise: Promise) {
|
|
583
|
+
override fun getUserStatus(promise: Promise) {
|
|
580
584
|
try {
|
|
581
585
|
promise.resolve(objectToWritableMap(Didomi.getInstance().userStatus))
|
|
582
586
|
} catch (e: DidomiNotReadyException) {
|
|
@@ -585,7 +589,7 @@ class DidomiModule(reactContext: ReactApplicationContext) : ReactContextBaseJava
|
|
|
585
589
|
}
|
|
586
590
|
|
|
587
591
|
@ReactMethod
|
|
588
|
-
fun getApplicableRegulation(promise: Promise) {
|
|
592
|
+
override fun getApplicableRegulation(promise: Promise) {
|
|
589
593
|
try {
|
|
590
594
|
promise.resolve(Didomi.getInstance().applicableRegulation.value)
|
|
591
595
|
} catch (e: DidomiNotReadyException) {
|
|
@@ -594,7 +598,7 @@ class DidomiModule(reactContext: ReactApplicationContext) : ReactContextBaseJava
|
|
|
594
598
|
}
|
|
595
599
|
|
|
596
600
|
@ReactMethod
|
|
597
|
-
fun hideNotice(promise: Promise) {
|
|
601
|
+
override fun hideNotice(promise: Promise) {
|
|
598
602
|
try {
|
|
599
603
|
Didomi.getInstance().hideNotice()
|
|
600
604
|
promise.resolve(0)
|
|
@@ -604,7 +608,7 @@ class DidomiModule(reactContext: ReactApplicationContext) : ReactContextBaseJava
|
|
|
604
608
|
}
|
|
605
609
|
|
|
606
610
|
@ReactMethod
|
|
607
|
-
fun hidePreferences(promise: Promise) {
|
|
611
|
+
override fun hidePreferences(promise: Promise) {
|
|
608
612
|
try {
|
|
609
613
|
Didomi.getInstance().hidePreferences()
|
|
610
614
|
promise.resolve(0)
|
|
@@ -614,7 +618,7 @@ class DidomiModule(reactContext: ReactApplicationContext) : ReactContextBaseJava
|
|
|
614
618
|
}
|
|
615
619
|
|
|
616
620
|
@ReactMethod
|
|
617
|
-
fun isConsentRequired(promise: Promise) {
|
|
621
|
+
override fun isConsentRequired(promise: Promise) {
|
|
618
622
|
try {
|
|
619
623
|
promise.resolve(Didomi.getInstance().isConsentRequired)
|
|
620
624
|
} catch (e: DidomiNotReadyException) {
|
|
@@ -623,7 +627,7 @@ class DidomiModule(reactContext: ReactApplicationContext) : ReactContextBaseJava
|
|
|
623
627
|
}
|
|
624
628
|
|
|
625
629
|
@ReactMethod
|
|
626
|
-
fun shouldUserStatusBeCollected(promise: Promise) {
|
|
630
|
+
override fun shouldUserStatusBeCollected(promise: Promise) {
|
|
627
631
|
try {
|
|
628
632
|
promise.resolve(Didomi.getInstance().shouldUserStatusBeCollected())
|
|
629
633
|
} catch (e: DidomiNotReadyException) {
|
|
@@ -632,7 +636,7 @@ class DidomiModule(reactContext: ReactApplicationContext) : ReactContextBaseJava
|
|
|
632
636
|
}
|
|
633
637
|
|
|
634
638
|
@ReactMethod
|
|
635
|
-
fun isUserConsentStatusPartial(promise: Promise) {
|
|
639
|
+
override fun isUserConsentStatusPartial(promise: Promise) {
|
|
636
640
|
try {
|
|
637
641
|
promise.resolve(Didomi.getInstance().isUserConsentStatusPartial)
|
|
638
642
|
} catch (e: DidomiNotReadyException) {
|
|
@@ -641,7 +645,7 @@ class DidomiModule(reactContext: ReactApplicationContext) : ReactContextBaseJava
|
|
|
641
645
|
}
|
|
642
646
|
|
|
643
647
|
@ReactMethod
|
|
644
|
-
fun isUserStatusPartial(promise: Promise) {
|
|
648
|
+
override fun isUserStatusPartial(promise: Promise) {
|
|
645
649
|
try {
|
|
646
650
|
promise.resolve(Didomi.getInstance().isUserStatusPartial)
|
|
647
651
|
} catch (e: DidomiNotReadyException) {
|
|
@@ -650,7 +654,16 @@ class DidomiModule(reactContext: ReactApplicationContext) : ReactContextBaseJava
|
|
|
650
654
|
}
|
|
651
655
|
|
|
652
656
|
@ReactMethod
|
|
653
|
-
fun
|
|
657
|
+
override fun isUserLegitimateInterestStatusPartial(promise: Promise) {
|
|
658
|
+
try {
|
|
659
|
+
promise.resolve(Didomi.getInstance().isUserLegitimateInterestStatusPartial)
|
|
660
|
+
} catch (e: DidomiNotReadyException) {
|
|
661
|
+
promise.reject(e)
|
|
662
|
+
}
|
|
663
|
+
}
|
|
664
|
+
|
|
665
|
+
@ReactMethod
|
|
666
|
+
override fun isNoticeVisible(promise: Promise) {
|
|
654
667
|
try {
|
|
655
668
|
promise.resolve(Didomi.getInstance().isNoticeVisible())
|
|
656
669
|
} catch (e: DidomiNotReadyException) {
|
|
@@ -659,7 +672,7 @@ class DidomiModule(reactContext: ReactApplicationContext) : ReactContextBaseJava
|
|
|
659
672
|
}
|
|
660
673
|
|
|
661
674
|
@ReactMethod
|
|
662
|
-
fun isPreferencesVisible(promise: Promise) {
|
|
675
|
+
override fun isPreferencesVisible(promise: Promise) {
|
|
663
676
|
try {
|
|
664
677
|
promise.resolve(Didomi.getInstance().isPreferencesVisible())
|
|
665
678
|
} catch (e: DidomiNotReadyException) {
|
|
@@ -668,35 +681,35 @@ class DidomiModule(reactContext: ReactApplicationContext) : ReactContextBaseJava
|
|
|
668
681
|
}
|
|
669
682
|
|
|
670
683
|
@ReactMethod
|
|
671
|
-
fun isError(promise: Promise) {
|
|
684
|
+
override fun isError(promise: Promise) {
|
|
672
685
|
promise.resolve(Didomi.getInstance().isError)
|
|
673
686
|
}
|
|
674
687
|
|
|
675
688
|
@ReactMethod
|
|
676
|
-
fun isReady(promise: Promise) {
|
|
689
|
+
override fun isReady(promise: Promise) {
|
|
677
690
|
promise.resolve(Didomi.getInstance().isReady)
|
|
678
691
|
}
|
|
679
692
|
|
|
680
693
|
@ReactMethod
|
|
681
|
-
fun clearUser(promise: Promise) {
|
|
694
|
+
override fun clearUser(promise: Promise) {
|
|
682
695
|
Didomi.getInstance().clearUser()
|
|
683
696
|
promise.resolve(0)
|
|
684
697
|
}
|
|
685
698
|
|
|
686
699
|
@ReactMethod
|
|
687
|
-
fun setUser(organizationUserId: String, promise: Promise) {
|
|
700
|
+
override fun setUser(organizationUserId: String, promise: Promise) {
|
|
688
701
|
Didomi.getInstance().setUser(organizationUserId)
|
|
689
702
|
promise.resolve(0)
|
|
690
703
|
}
|
|
691
704
|
|
|
692
705
|
@ReactMethod
|
|
693
|
-
fun setUserAndSetupUI(organizationUserId: String, promise: Promise) {
|
|
706
|
+
override fun setUserAndSetupUI(organizationUserId: String, promise: Promise) {
|
|
694
707
|
Didomi.getInstance().setUser(organizationUserId, reactContext.currentActivity as? FragmentActivity)
|
|
695
708
|
promise.resolve(0)
|
|
696
709
|
}
|
|
697
710
|
|
|
698
711
|
@ReactMethod
|
|
699
|
-
fun setUserWithHashAuth(
|
|
712
|
+
override fun setUserWithHashAuth(
|
|
700
713
|
organizationUserId: String,
|
|
701
714
|
algorithm: String,
|
|
702
715
|
secretId: String,
|
|
@@ -717,7 +730,7 @@ class DidomiModule(reactContext: ReactApplicationContext) : ReactContextBaseJava
|
|
|
717
730
|
}
|
|
718
731
|
|
|
719
732
|
@ReactMethod
|
|
720
|
-
fun setUserWithHashAuthAndSetupUI(
|
|
733
|
+
override fun setUserWithHashAuthAndSetupUI(
|
|
721
734
|
organizationUserId: String,
|
|
722
735
|
algorithm: String,
|
|
723
736
|
secretId: String,
|
|
@@ -739,13 +752,13 @@ class DidomiModule(reactContext: ReactApplicationContext) : ReactContextBaseJava
|
|
|
739
752
|
}
|
|
740
753
|
|
|
741
754
|
@ReactMethod
|
|
742
|
-
fun setUserWithHashAuthWithExpiration(
|
|
755
|
+
override fun setUserWithHashAuthWithExpiration(
|
|
743
756
|
organizationUserId: String,
|
|
744
757
|
algorithm: String,
|
|
745
758
|
secretId: String,
|
|
746
759
|
digest: String,
|
|
747
760
|
salt: String?,
|
|
748
|
-
expiration:
|
|
761
|
+
expiration: Double,
|
|
749
762
|
promise: Promise
|
|
750
763
|
) {
|
|
751
764
|
Didomi.getInstance().setUser(
|
|
@@ -762,13 +775,13 @@ class DidomiModule(reactContext: ReactApplicationContext) : ReactContextBaseJava
|
|
|
762
775
|
}
|
|
763
776
|
|
|
764
777
|
@ReactMethod
|
|
765
|
-
fun setUserWithHashAuthWithExpirationAndSetupUI(
|
|
778
|
+
override fun setUserWithHashAuthWithExpirationAndSetupUI(
|
|
766
779
|
organizationUserId: String,
|
|
767
780
|
algorithm: String,
|
|
768
781
|
secretId: String,
|
|
769
782
|
digest: String,
|
|
770
783
|
salt: String?,
|
|
771
|
-
expiration:
|
|
784
|
+
expiration: Double,
|
|
772
785
|
promise: Promise
|
|
773
786
|
) {
|
|
774
787
|
Didomi.getInstance().setUser(
|
|
@@ -786,7 +799,7 @@ class DidomiModule(reactContext: ReactApplicationContext) : ReactContextBaseJava
|
|
|
786
799
|
}
|
|
787
800
|
|
|
788
801
|
@ReactMethod
|
|
789
|
-
fun setUserWithEncryptionAuth(
|
|
802
|
+
override fun setUserWithEncryptionAuth(
|
|
790
803
|
organizationUserId: String,
|
|
791
804
|
algorithm: String,
|
|
792
805
|
secretId: String,
|
|
@@ -805,7 +818,7 @@ class DidomiModule(reactContext: ReactApplicationContext) : ReactContextBaseJava
|
|
|
805
818
|
}
|
|
806
819
|
|
|
807
820
|
@ReactMethod
|
|
808
|
-
fun setUserWithEncryptionAuthAndSetupUI(
|
|
821
|
+
override fun setUserWithEncryptionAuthAndSetupUI(
|
|
809
822
|
organizationUserId: String,
|
|
810
823
|
algorithm: String,
|
|
811
824
|
secretId: String,
|
|
@@ -825,12 +838,12 @@ class DidomiModule(reactContext: ReactApplicationContext) : ReactContextBaseJava
|
|
|
825
838
|
}
|
|
826
839
|
|
|
827
840
|
@ReactMethod
|
|
828
|
-
fun setUserWithEncryptionAuthWithExpiration(
|
|
841
|
+
override fun setUserWithEncryptionAuthWithExpiration(
|
|
829
842
|
organizationUserId: String,
|
|
830
843
|
algorithm: String,
|
|
831
844
|
secretId: String,
|
|
832
845
|
initializationVector: String,
|
|
833
|
-
expiration:
|
|
846
|
+
expiration: Double,
|
|
834
847
|
promise: Promise
|
|
835
848
|
) {
|
|
836
849
|
Didomi.getInstance().setUser(
|
|
@@ -846,12 +859,12 @@ class DidomiModule(reactContext: ReactApplicationContext) : ReactContextBaseJava
|
|
|
846
859
|
}
|
|
847
860
|
|
|
848
861
|
@ReactMethod
|
|
849
|
-
fun setUserWithEncryptionAuthWithExpirationAndSetupUI(
|
|
862
|
+
override fun setUserWithEncryptionAuthWithExpirationAndSetupUI(
|
|
850
863
|
organizationUserId: String,
|
|
851
864
|
algorithm: String,
|
|
852
865
|
secretId: String,
|
|
853
866
|
initializationVector: String,
|
|
854
|
-
expiration:
|
|
867
|
+
expiration: Double,
|
|
855
868
|
promise: Promise
|
|
856
869
|
) {
|
|
857
870
|
Didomi.getInstance().setUser(
|
|
@@ -868,7 +881,7 @@ class DidomiModule(reactContext: ReactApplicationContext) : ReactContextBaseJava
|
|
|
868
881
|
}
|
|
869
882
|
|
|
870
883
|
@ReactMethod
|
|
871
|
-
fun setUserWithAuthParams(
|
|
884
|
+
override fun setUserWithAuthParams(
|
|
872
885
|
jsonUserAuthParams: String,
|
|
873
886
|
jsonSynchronizedUsers: String?,
|
|
874
887
|
promise: Promise
|
|
@@ -895,7 +908,7 @@ class DidomiModule(reactContext: ReactApplicationContext) : ReactContextBaseJava
|
|
|
895
908
|
}
|
|
896
909
|
|
|
897
910
|
@ReactMethod
|
|
898
|
-
fun setUserWithAuthParamsAndSetupUI(
|
|
911
|
+
override fun setUserWithAuthParamsAndSetupUI(
|
|
899
912
|
jsonUserAuthParams: String,
|
|
900
913
|
jsonSynchronizedUsers: String?,
|
|
901
914
|
promise: Promise
|
|
@@ -923,7 +936,7 @@ class DidomiModule(reactContext: ReactApplicationContext) : ReactContextBaseJava
|
|
|
923
936
|
}
|
|
924
937
|
|
|
925
938
|
@ReactMethod
|
|
926
|
-
fun setUserWithParameters(
|
|
939
|
+
override fun setUserWithParameters(
|
|
927
940
|
jsonUserParameters: String,
|
|
928
941
|
promise: Promise
|
|
929
942
|
) {
|
|
@@ -938,7 +951,7 @@ class DidomiModule(reactContext: ReactApplicationContext) : ReactContextBaseJava
|
|
|
938
951
|
}
|
|
939
952
|
|
|
940
953
|
@ReactMethod
|
|
941
|
-
fun setUserWithParametersAndSetupUI(
|
|
954
|
+
override fun setUserWithParametersAndSetupUI(
|
|
942
955
|
jsonUserParameters: String,
|
|
943
956
|
promise: Promise
|
|
944
957
|
) {
|
|
@@ -954,7 +967,7 @@ class DidomiModule(reactContext: ReactApplicationContext) : ReactContextBaseJava
|
|
|
954
967
|
}
|
|
955
968
|
|
|
956
969
|
@ReactMethod
|
|
957
|
-
fun showNotice(promise: Promise) {
|
|
970
|
+
override fun showNotice(promise: Promise) {
|
|
958
971
|
try {
|
|
959
972
|
runOnUiThread {
|
|
960
973
|
Didomi.getInstance().showNotice(reactContext.currentActivity as? FragmentActivity)
|
|
@@ -967,7 +980,20 @@ class DidomiModule(reactContext: ReactApplicationContext) : ReactContextBaseJava
|
|
|
967
980
|
}
|
|
968
981
|
|
|
969
982
|
@ReactMethod
|
|
970
|
-
fun
|
|
983
|
+
override fun forceShowNotice(promise: Promise) {
|
|
984
|
+
try {
|
|
985
|
+
runOnUiThread {
|
|
986
|
+
Didomi.getInstance().forceShowNotice(reactContext.currentActivity as? FragmentActivity)
|
|
987
|
+
}
|
|
988
|
+
promise.resolve(0)
|
|
989
|
+
} catch (e: Exception) {
|
|
990
|
+
Log.e("forceShowNotice", "An error occurred while force-showing the notice", e)
|
|
991
|
+
promise.reject(e)
|
|
992
|
+
}
|
|
993
|
+
}
|
|
994
|
+
|
|
995
|
+
@ReactMethod
|
|
996
|
+
override fun showPreferences(view: String?, promise: Promise) {
|
|
971
997
|
try {
|
|
972
998
|
runOnUiThread {
|
|
973
999
|
view?.also {
|
|
@@ -982,7 +1008,7 @@ class DidomiModule(reactContext: ReactApplicationContext) : ReactContextBaseJava
|
|
|
982
1008
|
}
|
|
983
1009
|
|
|
984
1010
|
@ReactMethod
|
|
985
|
-
fun reset(promise: Promise) {
|
|
1011
|
+
override fun reset(promise: Promise) {
|
|
986
1012
|
try {
|
|
987
1013
|
Didomi.getInstance().reset()
|
|
988
1014
|
promise.resolve(0)
|
|
@@ -992,7 +1018,7 @@ class DidomiModule(reactContext: ReactApplicationContext) : ReactContextBaseJava
|
|
|
992
1018
|
}
|
|
993
1019
|
|
|
994
1020
|
@ReactMethod
|
|
995
|
-
fun setUserAgreeToAll(promise: Promise) {
|
|
1021
|
+
override fun setUserAgreeToAll(promise: Promise) {
|
|
996
1022
|
try {
|
|
997
1023
|
promise.resolve(Didomi.getInstance().setUserAgreeToAll())
|
|
998
1024
|
} catch (e: DidomiNotReadyException) {
|
|
@@ -1001,7 +1027,7 @@ class DidomiModule(reactContext: ReactApplicationContext) : ReactContextBaseJava
|
|
|
1001
1027
|
}
|
|
1002
1028
|
|
|
1003
1029
|
@ReactMethod
|
|
1004
|
-
fun setUserDisagreeToAll(promise: Promise) {
|
|
1030
|
+
override fun setUserDisagreeToAll(promise: Promise) {
|
|
1005
1031
|
try {
|
|
1006
1032
|
promise.resolve(Didomi.getInstance().setUserDisagreeToAll())
|
|
1007
1033
|
} catch (e: DidomiNotReadyException) {
|
|
@@ -1010,7 +1036,7 @@ class DidomiModule(reactContext: ReactApplicationContext) : ReactContextBaseJava
|
|
|
1010
1036
|
}
|
|
1011
1037
|
|
|
1012
1038
|
@ReactMethod
|
|
1013
|
-
fun setCurrentUserStatus(
|
|
1039
|
+
override fun setCurrentUserStatus(
|
|
1014
1040
|
currentUserStatusAsString: String,
|
|
1015
1041
|
promise: Promise
|
|
1016
1042
|
) {
|
|
@@ -1025,7 +1051,7 @@ class DidomiModule(reactContext: ReactApplicationContext) : ReactContextBaseJava
|
|
|
1025
1051
|
}
|
|
1026
1052
|
|
|
1027
1053
|
@ReactMethod
|
|
1028
|
-
fun setUserStatus(
|
|
1054
|
+
override fun setUserStatus(
|
|
1029
1055
|
purposesConsentStatus: Boolean,
|
|
1030
1056
|
purposesLIStatus: Boolean,
|
|
1031
1057
|
vendorsConsentStatus: Boolean,
|
|
@@ -1047,7 +1073,34 @@ class DidomiModule(reactContext: ReactApplicationContext) : ReactContextBaseJava
|
|
|
1047
1073
|
}
|
|
1048
1074
|
|
|
1049
1075
|
@ReactMethod
|
|
1050
|
-
fun
|
|
1076
|
+
override fun setUserConsentStatus(
|
|
1077
|
+
enabledPurposeIds: ReadableArray,
|
|
1078
|
+
disabledPurposeIds: ReadableArray,
|
|
1079
|
+
enabledVendorIds: ReadableArray,
|
|
1080
|
+
disabledVendorIds: ReadableArray,
|
|
1081
|
+
promise: Promise
|
|
1082
|
+
) {
|
|
1083
|
+
try {
|
|
1084
|
+
@Suppress("DEPRECATION")
|
|
1085
|
+
promise.resolve(
|
|
1086
|
+
Didomi.getInstance().setUserStatus(
|
|
1087
|
+
enabledPurposeIds.toSet(),
|
|
1088
|
+
disabledPurposeIds.toSet(),
|
|
1089
|
+
emptySet(),
|
|
1090
|
+
emptySet(),
|
|
1091
|
+
enabledVendorIds.toSet(),
|
|
1092
|
+
disabledVendorIds.toSet(),
|
|
1093
|
+
emptySet(),
|
|
1094
|
+
emptySet()
|
|
1095
|
+
)
|
|
1096
|
+
)
|
|
1097
|
+
} catch (e: DidomiNotReadyException) {
|
|
1098
|
+
promise.reject(e)
|
|
1099
|
+
}
|
|
1100
|
+
}
|
|
1101
|
+
|
|
1102
|
+
@ReactMethod
|
|
1103
|
+
override fun setUserStatusSets(
|
|
1051
1104
|
enabledConsentPurposeIds: ReadableArray,
|
|
1052
1105
|
disabledConsentPurposeIds: ReadableArray,
|
|
1053
1106
|
enabledLIPurposeIds: ReadableArray,
|
|
@@ -1077,7 +1130,7 @@ class DidomiModule(reactContext: ReactApplicationContext) : ReactContextBaseJava
|
|
|
1077
1130
|
}
|
|
1078
1131
|
|
|
1079
1132
|
@ReactMethod
|
|
1080
|
-
fun shouldConsentBeCollected(promise: Promise) {
|
|
1133
|
+
override fun shouldConsentBeCollected(promise: Promise) {
|
|
1081
1134
|
try {
|
|
1082
1135
|
@Suppress("DEPRECATION")
|
|
1083
1136
|
promise.resolve(Didomi.getInstance().shouldConsentBeCollected())
|
|
@@ -1087,7 +1140,7 @@ class DidomiModule(reactContext: ReactApplicationContext) : ReactContextBaseJava
|
|
|
1087
1140
|
}
|
|
1088
1141
|
|
|
1089
1142
|
@ReactMethod
|
|
1090
|
-
fun updateSelectedLanguage(languageCode: String, promise: Promise) {
|
|
1143
|
+
override fun updateSelectedLanguage(languageCode: String, promise: Promise) {
|
|
1091
1144
|
try {
|
|
1092
1145
|
Didomi.getInstance().updateSelectedLanguage(languageCode)
|
|
1093
1146
|
promise.resolve(0)
|
|
@@ -1098,18 +1151,18 @@ class DidomiModule(reactContext: ReactApplicationContext) : ReactContextBaseJava
|
|
|
1098
1151
|
|
|
1099
1152
|
@Suppress("UNUSED_PARAMETER")
|
|
1100
1153
|
@ReactMethod
|
|
1101
|
-
fun addListener(eventName: String) {
|
|
1154
|
+
override fun addListener(eventName: String) {
|
|
1102
1155
|
// Keep: Required for RN built in Event Emitter Calls.
|
|
1103
1156
|
}
|
|
1104
1157
|
|
|
1105
1158
|
@Suppress("UNUSED_PARAMETER")
|
|
1106
1159
|
@ReactMethod
|
|
1107
|
-
fun removeListeners(count:
|
|
1160
|
+
override fun removeListeners(count: Double) {
|
|
1108
1161
|
// Keep: Required for RN built in Event Emitter Calls.
|
|
1109
1162
|
}
|
|
1110
1163
|
|
|
1111
1164
|
@ReactMethod
|
|
1112
|
-
fun listenToVendorStatus(vendorId: String) {
|
|
1165
|
+
override fun listenToVendorStatus(vendorId: String, promise: Promise) {
|
|
1113
1166
|
if (!vendorStatusListeners.contains(vendorId)) {
|
|
1114
1167
|
Didomi.getInstance().addVendorStatusListener(vendorId) { vendorStatus ->
|
|
1115
1168
|
val statusAsMap = objectToWritableMap(vendorStatus)
|
|
@@ -1117,18 +1170,20 @@ class DidomiModule(reactContext: ReactApplicationContext) : ReactContextBaseJava
|
|
|
1117
1170
|
}
|
|
1118
1171
|
vendorStatusListeners.add(vendorId)
|
|
1119
1172
|
}
|
|
1173
|
+
promise.resolve(0)
|
|
1120
1174
|
}
|
|
1121
1175
|
|
|
1122
1176
|
@ReactMethod
|
|
1123
|
-
fun stopListeningToVendorStatus(vendorId: String) {
|
|
1177
|
+
override fun stopListeningToVendorStatus(vendorId: String, promise: Promise) {
|
|
1124
1178
|
if (vendorStatusListeners.contains(vendorId)) {
|
|
1125
1179
|
Didomi.getInstance().removeVendorStatusListener(vendorId)
|
|
1126
1180
|
vendorStatusListeners.remove(vendorId)
|
|
1127
1181
|
}
|
|
1182
|
+
promise.resolve(0)
|
|
1128
1183
|
}
|
|
1129
1184
|
|
|
1130
1185
|
@ReactMethod
|
|
1131
|
-
fun commitCurrentUserStatusTransaction(
|
|
1186
|
+
override fun commitCurrentUserStatusTransaction(
|
|
1132
1187
|
enabledPurposes: ReadableArray,
|
|
1133
1188
|
disabledPurposes: ReadableArray,
|
|
1134
1189
|
enabledVendors: ReadableArray,
|
|
@@ -1144,9 +1199,10 @@ class DidomiModule(reactContext: ReactApplicationContext) : ReactContextBaseJava
|
|
|
1144
1199
|
}
|
|
1145
1200
|
|
|
1146
1201
|
@ReactMethod
|
|
1147
|
-
fun syncAcknowledged(callbackIndex:
|
|
1148
|
-
val
|
|
1149
|
-
syncAcknowledgedCallbacks
|
|
1202
|
+
override fun syncAcknowledged(callbackIndex: Double, promise: Promise) {
|
|
1203
|
+
val index = callbackIndex.toInt()
|
|
1204
|
+
val result = syncAcknowledgedCallbacks[index]?.let { it() }
|
|
1205
|
+
syncAcknowledgedCallbacks.remove(index)
|
|
1150
1206
|
if (result != null) {
|
|
1151
1207
|
promise.resolve(result)
|
|
1152
1208
|
} else {
|
|
@@ -1155,8 +1211,8 @@ class DidomiModule(reactContext: ReactApplicationContext) : ReactContextBaseJava
|
|
|
1155
1211
|
}
|
|
1156
1212
|
|
|
1157
1213
|
@ReactMethod
|
|
1158
|
-
fun removeSyncAcknowledgedCallback(callbackIndex:
|
|
1159
|
-
syncAcknowledgedCallbacks.remove(callbackIndex)
|
|
1214
|
+
override fun removeSyncAcknowledgedCallback(callbackIndex: Double, promise: Promise) {
|
|
1215
|
+
syncAcknowledgedCallbacks.remove(callbackIndex.toInt())
|
|
1160
1216
|
promise.resolve(0)
|
|
1161
1217
|
}
|
|
1162
1218
|
|
|
@@ -1,16 +1,27 @@
|
|
|
1
1
|
package io.didomi.reactnative
|
|
2
2
|
|
|
3
|
-
import com.facebook.react.
|
|
3
|
+
import com.facebook.react.TurboReactPackage
|
|
4
4
|
import com.facebook.react.bridge.NativeModule
|
|
5
5
|
import com.facebook.react.bridge.ReactApplicationContext
|
|
6
|
-
import com.facebook.react.
|
|
6
|
+
import com.facebook.react.module.model.ReactModuleInfo
|
|
7
|
+
import com.facebook.react.module.model.ReactModuleInfoProvider
|
|
7
8
|
|
|
8
|
-
class DidomiPackage :
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
9
|
+
class DidomiPackage : TurboReactPackage() {
|
|
10
|
+
|
|
11
|
+
override fun getModule(name: String, reactContext: ReactApplicationContext): NativeModule? =
|
|
12
|
+
if (name == DidomiModule.NAME) DidomiModule(reactContext) else null
|
|
12
13
|
|
|
13
|
-
override fun
|
|
14
|
-
|
|
14
|
+
override fun getReactModuleInfoProvider() = ReactModuleInfoProvider {
|
|
15
|
+
mapOf(
|
|
16
|
+
DidomiModule.NAME to ReactModuleInfo(
|
|
17
|
+
DidomiModule.NAME,
|
|
18
|
+
DidomiModule.NAME,
|
|
19
|
+
false, // canOverrideExistingModule
|
|
20
|
+
false, // needsEagerInit
|
|
21
|
+
true, // hasConstants — DidomiModule.getConstants() exposes event registration names
|
|
22
|
+
false, // isCxxModule
|
|
23
|
+
BuildConfig.IS_NEW_ARCHITECTURE_ENABLED
|
|
24
|
+
)
|
|
25
|
+
)
|
|
15
26
|
}
|
|
16
27
|
}
|