@blueconic/blueconic-react-native 4.0.2 → 5.0.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 +20 -0
- package/android/build.gradle +7 -7
- package/android/src/main/java/com/blueconic/reactnative/BlueConicClientModule.java +63 -42
- package/android/src/test/java/com/blueconic/reactnative/BlueConicTests.kt +20 -20
- package/ios/BlueConicClient-Bridging-Header.h +2 -1
- package/ios/BlueConicClientModule.m +4 -2
- package/ios/BlueConicClientModule.swift +50 -37
- package/package.json +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,26 @@
|
|
|
2
2
|
All notable changes to this project will be documented in this file.
|
|
3
3
|
`@blueconic/blueconic-react-native` adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
|
|
4
4
|
|
|
5
|
+
## [5.0.0] 2025-07-11
|
|
6
|
+
|
|
7
|
+
### Added
|
|
8
|
+
- React-Android & iOS: Added support for CTV devices, specifically for Android TV, Fire TV and Apple TV. The SDK can now be initialized on these devices, and it supports the same functionalities as on mobile devices.
|
|
9
|
+
- React-Android & iOS: Added ability to delete a profile ID server-side via the SDK. This can be done by calling the `deleteProfile` method. Additionally, the `clearProfileId` has been renamed to `createProfile` having the same functionality as before.
|
|
10
|
+
|
|
11
|
+
### Changed
|
|
12
|
+
- React-Android: Changed the way the SDK stores the BCSessionId, by migrating the storage from CookieManager to SharedPreferences.
|
|
13
|
+
- React-iOS: Fixed issue with certain callbacks being invoked multiple times.
|
|
14
|
+
|
|
15
|
+
### Fixed
|
|
16
|
+
- React-Android & iOS: Fixed issue with the SDK not sending the 'time' parameter in the correct format to the server.
|
|
17
|
+
|
|
18
|
+
## [4.0.3] 2025-04-08
|
|
19
|
+
|
|
20
|
+
### Fixed
|
|
21
|
+
- React-Android: Fixed issue with the Fullscreen Lightbox not loading JavaScript correctly in certain cases.
|
|
22
|
+
- React-iOS: Fixed issue where profile operations were not invoking the success callback if the operation was successful.
|
|
23
|
+
- React-iOS: Fixed issue with Fullscreen Lightbox not loading correctly in some cases.
|
|
24
|
+
|
|
5
25
|
## [4.0.2] 2025-02-21
|
|
6
26
|
|
|
7
27
|
### Added
|
package/android/build.gradle
CHANGED
|
@@ -18,16 +18,16 @@ apply plugin: 'com.android.library'
|
|
|
18
18
|
apply plugin: 'org.jetbrains.kotlin.android'
|
|
19
19
|
|
|
20
20
|
android {
|
|
21
|
-
compileSdk
|
|
21
|
+
compileSdk 35
|
|
22
22
|
|
|
23
23
|
namespace 'com.blueconic.reactnative'
|
|
24
24
|
defaultConfig {
|
|
25
25
|
minSdkVersion 21
|
|
26
|
-
targetSdkVersion
|
|
27
|
-
versionCode
|
|
28
|
-
versionName "
|
|
26
|
+
targetSdkVersion 35
|
|
27
|
+
versionCode 500
|
|
28
|
+
versionName "5.0.0"
|
|
29
29
|
buildConfigField 'String', 'PLATFORM_NAME', "\"React Native\""
|
|
30
|
-
buildConfigField 'String', 'PLATFORM_VERSION', "\"
|
|
30
|
+
buildConfigField 'String', 'PLATFORM_VERSION', "\"5.0.0\""
|
|
31
31
|
}
|
|
32
32
|
lintOptions {
|
|
33
33
|
abortOnError false
|
|
@@ -48,12 +48,12 @@ repositories {
|
|
|
48
48
|
|
|
49
49
|
dependencies {
|
|
50
50
|
compileOnly 'com.facebook.react:react-android:+'
|
|
51
|
-
implementation 'com.blueconic:blueconic-android-lib:
|
|
51
|
+
implementation 'com.blueconic:blueconic-android-lib:7.0.0'
|
|
52
52
|
|
|
53
53
|
testImplementation 'androidx.core:core-ktx:1.13.1'
|
|
54
54
|
testImplementation 'junit:junit:4.13.2'
|
|
55
55
|
testImplementation "io.mockk:mockk:1.12.5"
|
|
56
56
|
testImplementation 'com.facebook.react:react-android:+'
|
|
57
|
-
testImplementation 'com.blueconic:blueconic-android-lib:
|
|
57
|
+
testImplementation 'com.blueconic:blueconic-android-lib:7.0.0'
|
|
58
58
|
implementation "org.jetbrains.kotlin:kotlin-reflect:1.9.24"
|
|
59
59
|
}
|
|
@@ -158,7 +158,7 @@ public class BlueConicClientModule extends ReactContextBaseJavaModule {
|
|
|
158
158
|
final BlueConicClient blueConicClient = getBlueConicClientInstance();
|
|
159
159
|
String profileId = "";
|
|
160
160
|
if (blueConicClient != null) {
|
|
161
|
-
profileId = blueConicClient.
|
|
161
|
+
profileId = blueConicClient.getProfile().getId();
|
|
162
162
|
}
|
|
163
163
|
|
|
164
164
|
promise.resolve(profileId);
|
|
@@ -175,20 +175,41 @@ public class BlueConicClientModule extends ReactContextBaseJavaModule {
|
|
|
175
175
|
final BlueConicClient blueConicClient = getBlueConicClientInstance();
|
|
176
176
|
String profileId = "";
|
|
177
177
|
if (blueConicClient != null) {
|
|
178
|
-
profileId = blueConicClient.
|
|
178
|
+
profileId = blueConicClient.getProfile().getId();
|
|
179
179
|
}
|
|
180
180
|
|
|
181
181
|
callback.invoke(profileId);
|
|
182
182
|
}
|
|
183
183
|
|
|
184
184
|
/**
|
|
185
|
-
*
|
|
185
|
+
* Clears the profile ID from the BlueConic client locally (cache). A new profile ID will be generated.
|
|
186
186
|
*/
|
|
187
187
|
@ReactMethod
|
|
188
|
-
public void
|
|
188
|
+
public void createProfile(@Nonnull Callback callback) {
|
|
189
189
|
final BlueConicClient blueConicClient = getBlueConicClientInstance();
|
|
190
190
|
if (blueConicClient != null) {
|
|
191
|
-
blueConicClient.
|
|
191
|
+
blueConicClient.createProfile(new com.blueconic.Callback() {
|
|
192
|
+
@Override
|
|
193
|
+
public void onSuccess() {
|
|
194
|
+
callback.invoke(true, null);
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
@Override
|
|
198
|
+
public void onError(@NotNull com.blueconic.Error error) {
|
|
199
|
+
callback.invoke(false, error.toString());
|
|
200
|
+
}
|
|
201
|
+
});
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
/**
|
|
206
|
+
* Removes the profile from the BlueConic servers. The profile ID will be removed from the BlueConic client. A new profile ID will be generated.
|
|
207
|
+
*/
|
|
208
|
+
@ReactMethod
|
|
209
|
+
public void deleteProfile(@Nonnull Callback callback) {
|
|
210
|
+
final BlueConicClient blueConicClient = getBlueConicClientInstance();
|
|
211
|
+
if (blueConicClient != null) {
|
|
212
|
+
blueConicClient.deleteProfile(new com.blueconic.Callback() {
|
|
192
213
|
@Override
|
|
193
214
|
public void onSuccess() {
|
|
194
215
|
callback.invoke(true, null);
|
|
@@ -250,7 +271,7 @@ public class BlueConicClientModule extends ReactContextBaseJavaModule {
|
|
|
250
271
|
final WritableArray result = getWritableArray();
|
|
251
272
|
|
|
252
273
|
if (blueConicClient != null) {
|
|
253
|
-
result.pushString(blueConicClient.
|
|
274
|
+
result.pushString(blueConicClient.getProfile().getValue(property));
|
|
254
275
|
}
|
|
255
276
|
promise.resolve(result);
|
|
256
277
|
}
|
|
@@ -269,7 +290,7 @@ public class BlueConicClientModule extends ReactContextBaseJavaModule {
|
|
|
269
290
|
final WritableArray result = getWritableArray();
|
|
270
291
|
|
|
271
292
|
if (blueConicClient != null) {
|
|
272
|
-
Collection<String> values = blueConicClient.
|
|
293
|
+
Collection<String> values = blueConicClient.getProfile().getValues(property);
|
|
273
294
|
result.pushArray(fromList(new ArrayList<>(values)));
|
|
274
295
|
}
|
|
275
296
|
|
|
@@ -290,7 +311,7 @@ public class BlueConicClientModule extends ReactContextBaseJavaModule {
|
|
|
290
311
|
final WritableArray result = getWritableArray();
|
|
291
312
|
|
|
292
313
|
if (blueConicClient != null) {
|
|
293
|
-
result.pushString(blueConicClient.
|
|
314
|
+
result.pushString(blueConicClient.getProfile().getValue(property));
|
|
294
315
|
}
|
|
295
316
|
|
|
296
317
|
callback.invoke(result);
|
|
@@ -310,7 +331,7 @@ public class BlueConicClientModule extends ReactContextBaseJavaModule {
|
|
|
310
331
|
final WritableArray result = getWritableArray();
|
|
311
332
|
|
|
312
333
|
if (blueConicClient != null) {
|
|
313
|
-
Collection<String> values = blueConicClient.
|
|
334
|
+
Collection<String> values = blueConicClient.getProfile().getValues(property);
|
|
314
335
|
result.pushArray(fromList(new ArrayList<>(values)));
|
|
315
336
|
}
|
|
316
337
|
|
|
@@ -333,10 +354,10 @@ public class BlueConicClientModule extends ReactContextBaseJavaModule {
|
|
|
333
354
|
}
|
|
334
355
|
BlueConicClientImpl implInstance = (BlueConicClientImpl) blueConicClient;
|
|
335
356
|
|
|
336
|
-
for (String propertyName : implInstance.getProfilePropertyNames()) {
|
|
357
|
+
for (String propertyName : implInstance.getProfile().getProfilePropertyNames()) {
|
|
337
358
|
final WritableMap item = getWritableMap();
|
|
338
359
|
item.putString("id", propertyName);
|
|
339
|
-
Collection<String> values = blueConicClient.
|
|
360
|
+
Collection<String> values = blueConicClient.getProfile().getValues(propertyName);
|
|
340
361
|
String joinedValues = String.join(",", values);
|
|
341
362
|
item.putString("value", joinedValues);
|
|
342
363
|
result.pushMap(item);
|
|
@@ -358,7 +379,7 @@ public class BlueConicClientModule extends ReactContextBaseJavaModule {
|
|
|
358
379
|
final WritableArray result = getWritableArray();
|
|
359
380
|
|
|
360
381
|
if (blueConicClient != null) {
|
|
361
|
-
result.pushString(blueConicClient.getPrivacyLegislation());
|
|
382
|
+
result.pushString(blueConicClient.getProfile().getPrivacyLegislation());
|
|
362
383
|
}
|
|
363
384
|
promise.resolve(result);
|
|
364
385
|
}
|
|
@@ -376,7 +397,7 @@ public class BlueConicClientModule extends ReactContextBaseJavaModule {
|
|
|
376
397
|
final WritableArray result = getWritableArray();
|
|
377
398
|
|
|
378
399
|
if (blueConicClient != null) {
|
|
379
|
-
result.pushString(blueConicClient.getPrivacyLegislation());
|
|
400
|
+
result.pushString(blueConicClient.getProfile().getPrivacyLegislation());
|
|
380
401
|
}
|
|
381
402
|
|
|
382
403
|
callback.invoke(result);
|
|
@@ -395,7 +416,7 @@ public class BlueConicClientModule extends ReactContextBaseJavaModule {
|
|
|
395
416
|
final WritableArray result = getWritableArray();
|
|
396
417
|
|
|
397
418
|
if (blueConicClient != null) {
|
|
398
|
-
Collection<String> values = blueConicClient.getConsentedObjectives();
|
|
419
|
+
Collection<String> values = blueConicClient.getProfile().getConsentedObjectives();
|
|
399
420
|
result.pushArray(fromList(new ArrayList<>(values)));
|
|
400
421
|
}
|
|
401
422
|
|
|
@@ -415,7 +436,7 @@ public class BlueConicClientModule extends ReactContextBaseJavaModule {
|
|
|
415
436
|
final WritableArray result = getWritableArray();
|
|
416
437
|
|
|
417
438
|
if (blueConicClient != null) {
|
|
418
|
-
Collection<String> values = blueConicClient.getConsentedObjectives();
|
|
439
|
+
Collection<String> values = blueConicClient.getProfile().getConsentedObjectives();
|
|
419
440
|
result.pushArray(fromList(new ArrayList<>(values)));
|
|
420
441
|
}
|
|
421
442
|
|
|
@@ -435,7 +456,7 @@ public class BlueConicClientModule extends ReactContextBaseJavaModule {
|
|
|
435
456
|
final WritableArray result = getWritableArray();
|
|
436
457
|
|
|
437
458
|
if (blueConicClient != null) {
|
|
438
|
-
Collection<String> values = blueConicClient.getRefusedObjectives();
|
|
459
|
+
Collection<String> values = blueConicClient.getProfile().getRefusedObjectives();
|
|
439
460
|
result.pushArray(fromList(new ArrayList<>(values)));
|
|
440
461
|
}
|
|
441
462
|
|
|
@@ -455,7 +476,7 @@ public class BlueConicClientModule extends ReactContextBaseJavaModule {
|
|
|
455
476
|
final WritableArray result = getWritableArray();
|
|
456
477
|
|
|
457
478
|
if (blueConicClient != null) {
|
|
458
|
-
Collection<String> values = blueConicClient.getRefusedObjectives();
|
|
479
|
+
Collection<String> values = blueConicClient.getProfile().getRefusedObjectives();
|
|
459
480
|
result.pushArray(fromList(new ArrayList<>(values)));
|
|
460
481
|
}
|
|
461
482
|
|
|
@@ -471,7 +492,7 @@ public class BlueConicClientModule extends ReactContextBaseJavaModule {
|
|
|
471
492
|
public void addConsentedObjective(@Nonnull String objectiveId) {
|
|
472
493
|
final BlueConicClient blueConicClient = getBlueConicClientInstance();
|
|
473
494
|
if (blueConicClient != null) {
|
|
474
|
-
blueConicClient.addConsentedObjective(objectiveId, null);
|
|
495
|
+
blueConicClient.getProfile().addConsentedObjective(objectiveId, null);
|
|
475
496
|
}
|
|
476
497
|
}
|
|
477
498
|
|
|
@@ -484,7 +505,7 @@ public class BlueConicClientModule extends ReactContextBaseJavaModule {
|
|
|
484
505
|
public void addRefusedObjective(@Nonnull String objectiveId) {
|
|
485
506
|
final BlueConicClient blueConicClient = getBlueConicClientInstance();
|
|
486
507
|
if (blueConicClient != null) {
|
|
487
|
-
blueConicClient.addRefusedObjective(objectiveId, null);
|
|
508
|
+
blueConicClient.getProfile().addRefusedObjective(objectiveId, null);
|
|
488
509
|
}
|
|
489
510
|
}
|
|
490
511
|
|
|
@@ -497,7 +518,7 @@ public class BlueConicClientModule extends ReactContextBaseJavaModule {
|
|
|
497
518
|
public void setPrivacyLegislation(@Nonnull String privacyLegislation) {
|
|
498
519
|
final BlueConicClient blueConicClient = getBlueConicClientInstance();
|
|
499
520
|
if (blueConicClient != null) {
|
|
500
|
-
blueConicClient.setPrivacyLegislation(privacyLegislation);
|
|
521
|
+
blueConicClient.getProfile().setPrivacyLegislation(privacyLegislation);
|
|
501
522
|
}
|
|
502
523
|
}
|
|
503
524
|
|
|
@@ -510,7 +531,7 @@ public class BlueConicClientModule extends ReactContextBaseJavaModule {
|
|
|
510
531
|
public void setConsentedObjectives(@Nonnull ReadableArray objectiveIds) {
|
|
511
532
|
final BlueConicClient blueConicClient = getBlueConicClientInstance();
|
|
512
533
|
if (blueConicClient != null) {
|
|
513
|
-
blueConicClient.setConsentedObjectives(toList(objectiveIds));
|
|
534
|
+
blueConicClient.getProfile().setConsentedObjectives(toList(objectiveIds));
|
|
514
535
|
}
|
|
515
536
|
}
|
|
516
537
|
|
|
@@ -523,7 +544,7 @@ public class BlueConicClientModule extends ReactContextBaseJavaModule {
|
|
|
523
544
|
public void setRefusedObjectives(@Nonnull ReadableArray objectiveIds) {
|
|
524
545
|
final BlueConicClient blueConicClient = getBlueConicClientInstance();
|
|
525
546
|
if (blueConicClient != null) {
|
|
526
|
-
blueConicClient.setRefusedObjectives(toList(objectiveIds));
|
|
547
|
+
blueConicClient.getProfile().setRefusedObjectives(toList(objectiveIds));
|
|
527
548
|
}
|
|
528
549
|
}
|
|
529
550
|
|
|
@@ -618,7 +639,7 @@ public class BlueConicClientModule extends ReactContextBaseJavaModule {
|
|
|
618
639
|
public void addProfileValue(@Nonnull String property, @Nonnull String value) {
|
|
619
640
|
final BlueConicClient blueConicClient = getBlueConicClientInstance();
|
|
620
641
|
if (blueConicClient != null) {
|
|
621
|
-
blueConicClient.
|
|
642
|
+
blueConicClient.getProfile().addValue(property, value, null);
|
|
622
643
|
}
|
|
623
644
|
}
|
|
624
645
|
|
|
@@ -632,7 +653,7 @@ public class BlueConicClientModule extends ReactContextBaseJavaModule {
|
|
|
632
653
|
public void addProfileValues(@Nonnull String property, @Nonnull ReadableArray values) {
|
|
633
654
|
final BlueConicClient blueConicClient = getBlueConicClientInstance();
|
|
634
655
|
if (blueConicClient != null) {
|
|
635
|
-
blueConicClient.
|
|
656
|
+
blueConicClient.getProfile().addValues(property, toList(values), null);
|
|
636
657
|
}
|
|
637
658
|
}
|
|
638
659
|
|
|
@@ -646,7 +667,7 @@ public class BlueConicClientModule extends ReactContextBaseJavaModule {
|
|
|
646
667
|
public void setProfileValue(@Nonnull String property, @Nonnull String value) {
|
|
647
668
|
final BlueConicClient blueConicClient = getBlueConicClientInstance();
|
|
648
669
|
if (blueConicClient != null) {
|
|
649
|
-
blueConicClient.
|
|
670
|
+
blueConicClient.getProfile().setValue(property, value, null);
|
|
650
671
|
}
|
|
651
672
|
}
|
|
652
673
|
|
|
@@ -660,7 +681,7 @@ public class BlueConicClientModule extends ReactContextBaseJavaModule {
|
|
|
660
681
|
public void setProfileValues(@Nonnull String property, @Nonnull ReadableArray values) {
|
|
661
682
|
final BlueConicClient blueConicClient = getBlueConicClientInstance();
|
|
662
683
|
if (blueConicClient != null) {
|
|
663
|
-
blueConicClient.
|
|
684
|
+
blueConicClient.getProfile().setValues(property, toList(values), null);
|
|
664
685
|
}
|
|
665
686
|
}
|
|
666
687
|
|
|
@@ -674,7 +695,7 @@ public class BlueConicClientModule extends ReactContextBaseJavaModule {
|
|
|
674
695
|
public void incrementProfileValue(@Nonnull String property, @Nonnull String value) {
|
|
675
696
|
final BlueConicClient blueConicClient = getBlueConicClientInstance();
|
|
676
697
|
if (blueConicClient != null) {
|
|
677
|
-
blueConicClient.
|
|
698
|
+
blueConicClient.getProfile().incrementValue(property, value, null);
|
|
678
699
|
}
|
|
679
700
|
}
|
|
680
701
|
|
|
@@ -690,7 +711,7 @@ public class BlueConicClientModule extends ReactContextBaseJavaModule {
|
|
|
690
711
|
final Map<String, Object> properties = readableMap.toHashMap();
|
|
691
712
|
|
|
692
713
|
if (blueConicClient != null) {
|
|
693
|
-
blueConicClient.createEvent(eventName, properties, getCurrentActivity(), null);
|
|
714
|
+
blueConicClient.createEvent(eventName, properties, getReactApplicationContext().getCurrentActivity(), null);
|
|
694
715
|
}
|
|
695
716
|
}
|
|
696
717
|
|
|
@@ -708,7 +729,7 @@ public class BlueConicClientModule extends ReactContextBaseJavaModule {
|
|
|
708
729
|
final Map<String, Object> properties = readableMap.toHashMap();
|
|
709
730
|
|
|
710
731
|
if (blueConicClient != null) {
|
|
711
|
-
blueConicClient.createEvent(eventName, properties, getCurrentActivity(), new com.blueconic.Callback() {
|
|
732
|
+
blueConicClient.createEvent(eventName, properties, getReactApplicationContext().getCurrentActivity(), new com.blueconic.Callback() {
|
|
712
733
|
@Override
|
|
713
734
|
public void onSuccess() {
|
|
714
735
|
promise.resolve(getWritableArray());
|
|
@@ -738,7 +759,7 @@ public class BlueConicClientModule extends ReactContextBaseJavaModule {
|
|
|
738
759
|
final Map<String, Object> properties = readableMap.toHashMap();
|
|
739
760
|
|
|
740
761
|
if (blueConicClient != null) {
|
|
741
|
-
blueConicClient.createEvent(eventName, properties, getCurrentActivity(), new com.blueconic.Callback() {
|
|
762
|
+
blueConicClient.createEvent(eventName, properties, getReactApplicationContext().getCurrentActivity(), new com.blueconic.Callback() {
|
|
742
763
|
@Override
|
|
743
764
|
public void onSuccess() {
|
|
744
765
|
callback.invoke(true, null);
|
|
@@ -832,7 +853,7 @@ public class BlueConicClientModule extends ReactContextBaseJavaModule {
|
|
|
832
853
|
if (blueConicClient != null) {
|
|
833
854
|
// blueConicClient instance must have an activity or application
|
|
834
855
|
final Map<String, Object> properties = readableMap.toHashMap();
|
|
835
|
-
Activity activity = getCurrentActivity();
|
|
856
|
+
Activity activity = getReactApplicationContext().getCurrentActivity();
|
|
836
857
|
if (activity == null) {
|
|
837
858
|
activity = new Activity();
|
|
838
859
|
}
|
|
@@ -855,7 +876,7 @@ public class BlueConicClientModule extends ReactContextBaseJavaModule {
|
|
|
855
876
|
if (blueConicClient != null) {
|
|
856
877
|
// blueConicClient instance must have an activity or application
|
|
857
878
|
final Map<String, Object> properties = readableMap.toHashMap();
|
|
858
|
-
Activity activity = getCurrentActivity();
|
|
879
|
+
Activity activity = getReactApplicationContext().getCurrentActivity();
|
|
859
880
|
if (activity == null) {
|
|
860
881
|
activity = new Activity();
|
|
861
882
|
}
|
|
@@ -889,7 +910,7 @@ public class BlueConicClientModule extends ReactContextBaseJavaModule {
|
|
|
889
910
|
if (blueConicClient != null) {
|
|
890
911
|
// blueConicClient instance must have an activity or application
|
|
891
912
|
final Map<String, Object> properties = readableMap.toHashMap();
|
|
892
|
-
Activity activity = getCurrentActivity();
|
|
913
|
+
Activity activity = getReactApplicationContext().getCurrentActivity();
|
|
893
914
|
if (activity == null) {
|
|
894
915
|
activity = new Activity();
|
|
895
916
|
}
|
|
@@ -923,7 +944,7 @@ public class BlueConicClientModule extends ReactContextBaseJavaModule {
|
|
|
923
944
|
final Map<String, Object> properties = readableMap.toHashMap();
|
|
924
945
|
|
|
925
946
|
if (blueConicClient != null) {
|
|
926
|
-
Activity activity = getCurrentActivity();
|
|
947
|
+
Activity activity = getReactApplicationContext().getCurrentActivity();
|
|
927
948
|
if (activity == null) {
|
|
928
949
|
activity = new Activity();
|
|
929
950
|
}
|
|
@@ -946,7 +967,7 @@ public class BlueConicClientModule extends ReactContextBaseJavaModule {
|
|
|
946
967
|
final Map<String, Object> properties = readableMap.toHashMap();
|
|
947
968
|
|
|
948
969
|
if (blueConicClient != null) {
|
|
949
|
-
Activity activity = getCurrentActivity();
|
|
970
|
+
Activity activity = getReactApplicationContext().getCurrentActivity();
|
|
950
971
|
if (activity == null) {
|
|
951
972
|
activity = new Activity();
|
|
952
973
|
}
|
|
@@ -981,7 +1002,7 @@ public class BlueConicClientModule extends ReactContextBaseJavaModule {
|
|
|
981
1002
|
final Map<String, Object> properties = readableMap.toHashMap();
|
|
982
1003
|
|
|
983
1004
|
if (blueConicClient != null) {
|
|
984
|
-
Activity activity = getCurrentActivity();
|
|
1005
|
+
Activity activity = getReactApplicationContext().getCurrentActivity();
|
|
985
1006
|
if (activity == null) {
|
|
986
1007
|
activity = new Activity();
|
|
987
1008
|
}
|
|
@@ -1013,7 +1034,7 @@ public class BlueConicClientModule extends ReactContextBaseJavaModule {
|
|
|
1013
1034
|
final Map<String, Object> properties = readableMap.toHashMap();
|
|
1014
1035
|
|
|
1015
1036
|
if (blueConicClient != null) {
|
|
1016
|
-
Activity activity = getCurrentActivity();
|
|
1037
|
+
Activity activity = getReactApplicationContext().getCurrentActivity();
|
|
1017
1038
|
if (activity == null) {
|
|
1018
1039
|
activity = new Activity();
|
|
1019
1040
|
}
|
|
@@ -1036,7 +1057,7 @@ public class BlueConicClientModule extends ReactContextBaseJavaModule {
|
|
|
1036
1057
|
final Map<String, Object> properties = readableMap.toHashMap();
|
|
1037
1058
|
|
|
1038
1059
|
if (blueConicClient != null) {
|
|
1039
|
-
Activity activity = getCurrentActivity();
|
|
1060
|
+
Activity activity = getReactApplicationContext().getCurrentActivity();
|
|
1040
1061
|
if (activity == null) {
|
|
1041
1062
|
activity = new Activity();
|
|
1042
1063
|
}
|
|
@@ -1070,7 +1091,7 @@ public class BlueConicClientModule extends ReactContextBaseJavaModule {
|
|
|
1070
1091
|
final Map<String, Object> properties = readableMap.toHashMap();
|
|
1071
1092
|
|
|
1072
1093
|
if (blueConicClient != null) {
|
|
1073
|
-
Activity activity = getCurrentActivity();
|
|
1094
|
+
Activity activity = getReactApplicationContext().getCurrentActivity();
|
|
1074
1095
|
if (activity == null) {
|
|
1075
1096
|
activity = new Activity();
|
|
1076
1097
|
}
|
|
@@ -1102,7 +1123,7 @@ public class BlueConicClientModule extends ReactContextBaseJavaModule {
|
|
|
1102
1123
|
final Map<String, Object> properties = readableMap.toHashMap();
|
|
1103
1124
|
|
|
1104
1125
|
if (blueConicClient != null) {
|
|
1105
|
-
Activity activity = getCurrentActivity();
|
|
1126
|
+
Activity activity = getReactApplicationContext().getCurrentActivity();
|
|
1106
1127
|
if (activity == null) {
|
|
1107
1128
|
activity = new Activity();
|
|
1108
1129
|
}
|
|
@@ -1125,7 +1146,7 @@ public class BlueConicClientModule extends ReactContextBaseJavaModule {
|
|
|
1125
1146
|
final Map<String, Object> properties = readableMap.toHashMap();
|
|
1126
1147
|
|
|
1127
1148
|
if (blueConicClient != null) {
|
|
1128
|
-
Activity activity = getCurrentActivity();
|
|
1149
|
+
Activity activity = getReactApplicationContext().getCurrentActivity();
|
|
1129
1150
|
if (activity == null) {
|
|
1130
1151
|
activity = new Activity();
|
|
1131
1152
|
}
|
|
@@ -1159,7 +1180,7 @@ public class BlueConicClientModule extends ReactContextBaseJavaModule {
|
|
|
1159
1180
|
final Map<String, Object> properties = readableMap.toHashMap();
|
|
1160
1181
|
|
|
1161
1182
|
if (blueConicClient != null) {
|
|
1162
|
-
Activity activity = getCurrentActivity();
|
|
1183
|
+
Activity activity = getReactApplicationContext().getCurrentActivity();
|
|
1163
1184
|
if (activity == null) {
|
|
1164
1185
|
activity = new Activity();
|
|
1165
1186
|
}
|
|
@@ -71,7 +71,7 @@ class BlueConicClientModuleTests {
|
|
|
71
71
|
val promise = mockk<Promise>(relaxed = true)
|
|
72
72
|
val expectedProfileId = "testProfileId"
|
|
73
73
|
|
|
74
|
-
every { blueConicClient.
|
|
74
|
+
every { blueConicClient.profile.id } returns expectedProfileId
|
|
75
75
|
|
|
76
76
|
// When
|
|
77
77
|
module.getProfileIdAsync(promise)
|
|
@@ -85,7 +85,7 @@ class BlueConicClientModuleTests {
|
|
|
85
85
|
// Given
|
|
86
86
|
val callback = mockk<Callback>(relaxed = true)
|
|
87
87
|
val expectedProfileId = "testProfileId"
|
|
88
|
-
every { blueConicClient.
|
|
88
|
+
every { blueConicClient.profile.id } returns expectedProfileId
|
|
89
89
|
|
|
90
90
|
// When
|
|
91
91
|
module.getProfileIdWithCallback(callback)
|
|
@@ -99,7 +99,7 @@ class BlueConicClientModuleTests {
|
|
|
99
99
|
// Given
|
|
100
100
|
val property = "testProperty"
|
|
101
101
|
val value = "testValue"
|
|
102
|
-
every { blueConicClient.
|
|
102
|
+
every { blueConicClient.profile.getValues(property) } returns listOf(value)
|
|
103
103
|
val expectedValue = MockWritableArray().apply { pushString(value) }
|
|
104
104
|
// When
|
|
105
105
|
module.getProfileValuesAsync(property, object : MockPromise() {
|
|
@@ -116,7 +116,7 @@ class BlueConicClientModuleTests {
|
|
|
116
116
|
// Given
|
|
117
117
|
val property = "testProperty"
|
|
118
118
|
val value = "testValue"
|
|
119
|
-
every { blueConicClient.
|
|
119
|
+
every { blueConicClient.profile.getValue(property) } returns value
|
|
120
120
|
val expectedValue = MockWritableArray().apply { pushString(value) }
|
|
121
121
|
// When
|
|
122
122
|
module.getProfileValueWithCallback(property, object : MockCallback() {
|
|
@@ -133,7 +133,7 @@ class BlueConicClientModuleTests {
|
|
|
133
133
|
// Given
|
|
134
134
|
val property = "testProperty"
|
|
135
135
|
val value = listOf("testValue1", "testValue2")
|
|
136
|
-
every { blueConicClient.
|
|
136
|
+
every { blueConicClient.profile.getValues(property) } returns value
|
|
137
137
|
val expectedValue = MockWritableArray().apply { pushArray(module.fromList(value)) }
|
|
138
138
|
// When
|
|
139
139
|
module.getProfileValuesAsync(property, object : MockPromise() {
|
|
@@ -151,7 +151,7 @@ class BlueConicClientModuleTests {
|
|
|
151
151
|
// Given
|
|
152
152
|
val property = "testProperty"
|
|
153
153
|
val value = listOf("testValue1", "testValue2")
|
|
154
|
-
every { blueConicClient.
|
|
154
|
+
every { blueConicClient.profile.getValues(property) } returns value
|
|
155
155
|
val expectedValue = MockWritableArray().apply { pushArray(module.fromList(value)) }
|
|
156
156
|
// When
|
|
157
157
|
module.getProfileValuesWithCallback(property, object : MockCallback() {
|
|
@@ -168,9 +168,9 @@ class BlueConicClientModuleTests {
|
|
|
168
168
|
// Given
|
|
169
169
|
val propertyNames = listOf("testProperty1", "testProperty2")
|
|
170
170
|
val propertyValue = listOf("testValue1", "testValue2")
|
|
171
|
-
every { blueConicClient.profilePropertyNames } returns propertyNames
|
|
172
|
-
every { blueConicClient.
|
|
173
|
-
every { blueConicClient.
|
|
171
|
+
every { blueConicClient.profile.profilePropertyNames } returns propertyNames
|
|
172
|
+
every { blueConicClient.profile.getValues(propertyNames[0]) } returns listOf(propertyValue[0])
|
|
173
|
+
every { blueConicClient.profile.getValues(propertyNames[1]) } returns listOf(propertyValue[1])
|
|
174
174
|
val expectedValue = MockWritableArray()
|
|
175
175
|
for (name in propertyNames) {
|
|
176
176
|
val valuesMap = MockWritableMap().apply {
|
|
@@ -198,7 +198,7 @@ class BlueConicClientModuleTests {
|
|
|
198
198
|
fun `getPrivacyLegislation should resolve promise with value`() {
|
|
199
199
|
// Given
|
|
200
200
|
val value = "GDPR"
|
|
201
|
-
every { blueConicClient.privacyLegislation } returns value
|
|
201
|
+
every { blueConicClient.profile.privacyLegislation } returns value
|
|
202
202
|
val expectedValue = MockWritableArray().apply { pushString(value) }
|
|
203
203
|
// When
|
|
204
204
|
module.getPrivacyLegislationAsync(object : MockPromise() {
|
|
@@ -214,7 +214,7 @@ class BlueConicClientModuleTests {
|
|
|
214
214
|
fun `getPrivacyLegislation should invoke callback with value`() {
|
|
215
215
|
// Given
|
|
216
216
|
val value = "GDPR"
|
|
217
|
-
every { blueConicClient.privacyLegislation } returns value
|
|
217
|
+
every { blueConicClient.profile.privacyLegislation } returns value
|
|
218
218
|
val expectedValue = MockWritableArray().apply { pushString(value) }
|
|
219
219
|
// When
|
|
220
220
|
module.getPrivacyLegislationWithCallback(object : MockCallback() {
|
|
@@ -229,7 +229,7 @@ class BlueConicClientModuleTests {
|
|
|
229
229
|
fun `getConsentedObjectives should resolve promise with value`() {
|
|
230
230
|
// Given
|
|
231
231
|
val value = listOf("tracking")
|
|
232
|
-
every { blueConicClient.consentedObjectives } returns value
|
|
232
|
+
every { blueConicClient.profile.consentedObjectives } returns value
|
|
233
233
|
val expectedValue = MockWritableArray().apply { pushArray(module.fromList(value)) }
|
|
234
234
|
// When
|
|
235
235
|
module.getConsentedObjectivesAsync(object : MockPromise() {
|
|
@@ -245,7 +245,7 @@ class BlueConicClientModuleTests {
|
|
|
245
245
|
fun `getConsentedObjectives should invoke callback with value`() {
|
|
246
246
|
// Given
|
|
247
247
|
val value = listOf("tracking")
|
|
248
|
-
every { blueConicClient.consentedObjectives } returns value
|
|
248
|
+
every { blueConicClient.profile.consentedObjectives } returns value
|
|
249
249
|
val expectedValue = MockWritableArray().apply { pushArray(module.fromList(value)) }
|
|
250
250
|
// When
|
|
251
251
|
module.getConsentedObjectivesWithCallback(object : MockCallback() {
|
|
@@ -260,7 +260,7 @@ class BlueConicClientModuleTests {
|
|
|
260
260
|
fun `getRefusedObjectives should resolve promise with value`() {
|
|
261
261
|
// Given
|
|
262
262
|
val value = listOf("analytics")
|
|
263
|
-
every { blueConicClient.refusedObjectives } returns value
|
|
263
|
+
every { blueConicClient.profile.refusedObjectives } returns value
|
|
264
264
|
val expectedValue = MockWritableArray().apply { pushArray(module.fromList(value)) }
|
|
265
265
|
// When
|
|
266
266
|
module.getRefusedObjectivesAsync(object : MockPromise() {
|
|
@@ -276,7 +276,7 @@ class BlueConicClientModuleTests {
|
|
|
276
276
|
fun `getRefusedObjectives should invoke callback with value`() {
|
|
277
277
|
// Given
|
|
278
278
|
val value = listOf("analytics")
|
|
279
|
-
every { blueConicClient.refusedObjectives } returns value
|
|
279
|
+
every { blueConicClient.profile.refusedObjectives } returns value
|
|
280
280
|
val expectedValue = MockWritableArray().apply { pushArray(module.fromList(value)) }
|
|
281
281
|
// When
|
|
282
282
|
module.getRefusedObjectivesWithCallback(object : MockCallback() {
|
|
@@ -363,7 +363,7 @@ class BlueConicClientModuleTests {
|
|
|
363
363
|
// When
|
|
364
364
|
module.addProfileValue(property, value)
|
|
365
365
|
// Then
|
|
366
|
-
verify { blueConicClient.
|
|
366
|
+
verify { blueConicClient.profile.addValue(property, value) }
|
|
367
367
|
}
|
|
368
368
|
|
|
369
369
|
@Test
|
|
@@ -374,7 +374,7 @@ class BlueConicClientModuleTests {
|
|
|
374
374
|
// When
|
|
375
375
|
module.addProfileValues(property, value)
|
|
376
376
|
// Then
|
|
377
|
-
verify { blueConicClient.
|
|
377
|
+
verify { blueConicClient.profile.addValues(property, any()) }
|
|
378
378
|
}
|
|
379
379
|
|
|
380
380
|
@Test
|
|
@@ -385,7 +385,7 @@ class BlueConicClientModuleTests {
|
|
|
385
385
|
// When
|
|
386
386
|
module.setProfileValue(property, value)
|
|
387
387
|
// Then
|
|
388
|
-
verify { blueConicClient.
|
|
388
|
+
verify { blueConicClient.profile.setValue(property, value) }
|
|
389
389
|
}
|
|
390
390
|
|
|
391
391
|
@Test
|
|
@@ -396,7 +396,7 @@ class BlueConicClientModuleTests {
|
|
|
396
396
|
// When
|
|
397
397
|
module.setProfileValues(property, value)
|
|
398
398
|
// Then
|
|
399
|
-
verify { blueConicClient.
|
|
399
|
+
verify { blueConicClient.profile.setValues(property, any()) }
|
|
400
400
|
}
|
|
401
401
|
|
|
402
402
|
@Test
|
|
@@ -407,7 +407,7 @@ class BlueConicClientModuleTests {
|
|
|
407
407
|
// When
|
|
408
408
|
module.incrementProfileValue(property, value)
|
|
409
409
|
// Then
|
|
410
|
-
verify { blueConicClient.
|
|
410
|
+
verify { blueConicClient.profile.incrementValue(property, value) }
|
|
411
411
|
}
|
|
412
412
|
|
|
413
413
|
@Test
|
|
@@ -61,6 +61,10 @@ RCT_EXTERN_METHOD(createEvent:(NSString *)eventName withProperties:(NSDictionary
|
|
|
61
61
|
RCT_EXTERN_METHOD(createEventAsync:(NSString *)eventName withProperties:(NSDictionary *)properties withResolver:(RCTPromiseResolveBlock)resolve rejecter:(RCTPromiseRejectBlock)reject)
|
|
62
62
|
RCT_EXTERN_METHOD(createEventWithCallback:(NSString *)eventName withProperties:(NSDictionary *)properties withCallback:(RCTResponseSenderBlock)callback)
|
|
63
63
|
|
|
64
|
+
RCT_EXTERN_METHOD(createProfile:(RCTResponseSenderBlock)callback)
|
|
65
|
+
|
|
66
|
+
RCT_EXTERN_METHOD(deleteProfile:(RCTResponseSenderBlock)callback)
|
|
67
|
+
|
|
64
68
|
RCT_EXTERN_METHOD(updateProfile)
|
|
65
69
|
RCT_EXTERN_METHOD(updateProfileAsync:(RCTPromiseResolveBlock)resolve rejecter:(RCTPromiseRejectBlock)reject)
|
|
66
70
|
RCT_EXTERN_METHOD(updateProfileWithCallback:(RCTResponseSenderBlock)callback)
|
|
@@ -103,8 +107,6 @@ RCT_EXTERN_METHOD(publishUpdateValuesEventWithCallback:(NSString *)selector with
|
|
|
103
107
|
RCT_EXTERN_METHOD(publishAdvancedEvent:(NSString *)name withValues:(NSArray *)values)
|
|
104
108
|
RCT_EXTERN_METHOD(publishAdvancedEventWithCallback:(NSString *)name withValues:(NSArray *)values withCallback:(RCTResponseSenderBlock)callback)
|
|
105
109
|
|
|
106
|
-
RCT_EXTERN_METHOD(clearProfileId:(RCTResponseSenderBlock)callback)
|
|
107
|
-
|
|
108
110
|
RCT_EXTERN_METHOD(getScreenNameAsync:(RCTPromiseResolveBlock)resolve rejecter:(RCTPromiseRejectBlock)reject)
|
|
109
111
|
RCT_EXTERN_METHOD(getScreenNameWithCallback:(RCTResponseSenderBlock)callback)
|
|
110
112
|
|
|
@@ -9,7 +9,7 @@ import BlueConicClient
|
|
|
9
9
|
@objc(BlueConicClientModule)
|
|
10
10
|
class BlueConicClientModule: RCTEventEmitter {
|
|
11
11
|
private static var platformName: String = "React Native"
|
|
12
|
-
private static var platformVersion: String = "
|
|
12
|
+
private static var platformVersion: String = "5.0.0"
|
|
13
13
|
private static var moduleInstance: BlueConicClientModule?
|
|
14
14
|
private static var hasListeners: Bool?
|
|
15
15
|
|
|
@@ -64,7 +64,7 @@ class BlueConicClientModule: RCTEventEmitter {
|
|
|
64
64
|
Native Modules to pass values back to the JavaScript.
|
|
65
65
|
*/
|
|
66
66
|
@objc func getProfileIdAsync(_ resolve: RCTPromiseResolveBlock, rejecter reject: RCTPromiseRejectBlock) -> Void {
|
|
67
|
-
resolve([self.getBlueConicClientInstance().
|
|
67
|
+
resolve([self.getBlueConicClientInstance().getProfile().getId() ?? ""])
|
|
68
68
|
}
|
|
69
69
|
|
|
70
70
|
/**
|
|
@@ -73,7 +73,7 @@ class BlueConicClientModule: RCTEventEmitter {
|
|
|
73
73
|
Native Modules to pass values back to the JavaScript.
|
|
74
74
|
*/
|
|
75
75
|
@objc func getProfileIdWithCallback(_ callback: RCTResponseSenderBlock) -> Void {
|
|
76
|
-
callback([self.getBlueConicClientInstance().
|
|
76
|
+
callback([self.getBlueConicClientInstance().getProfile().getId() ?? ""])
|
|
77
77
|
}
|
|
78
78
|
|
|
79
79
|
/**
|
|
@@ -84,7 +84,7 @@ class BlueConicClientModule: RCTEventEmitter {
|
|
|
84
84
|
Native Modules to pass values back to the JavaScript.
|
|
85
85
|
*/
|
|
86
86
|
@objc func getProfileValueAsync(_ property: String, withResolver resolve: RCTPromiseResolveBlock, rejecter reject: RCTPromiseRejectBlock) -> Void {
|
|
87
|
-
resolve([self.getBlueConicClientInstance().
|
|
87
|
+
resolve([self.getBlueConicClientInstance().getProfile().getValue(property)])
|
|
88
88
|
}
|
|
89
89
|
|
|
90
90
|
|
|
@@ -96,7 +96,7 @@ class BlueConicClientModule: RCTEventEmitter {
|
|
|
96
96
|
Native Modules to pass values back to the JavaScript.
|
|
97
97
|
*/
|
|
98
98
|
@objc func getProfileValuesAsync(_ property: String, withResolver resolve: RCTPromiseResolveBlock, rejecter reject: RCTPromiseRejectBlock) -> Void {
|
|
99
|
-
resolve(self.getBlueConicClientInstance().
|
|
99
|
+
resolve(self.getBlueConicClientInstance().getProfile().getValues(property))
|
|
100
100
|
}
|
|
101
101
|
|
|
102
102
|
/**
|
|
@@ -107,7 +107,7 @@ class BlueConicClientModule: RCTEventEmitter {
|
|
|
107
107
|
Native Modules to pass values back to the JavaScript.
|
|
108
108
|
*/
|
|
109
109
|
@objc func getProfileValueWithCallback(_ property: String, withCallback callback: RCTResponseSenderBlock) -> Void {
|
|
110
|
-
callback([self.getBlueConicClientInstance().
|
|
110
|
+
callback([self.getBlueConicClientInstance().getProfile().getValue(property)])
|
|
111
111
|
}
|
|
112
112
|
|
|
113
113
|
|
|
@@ -119,7 +119,7 @@ class BlueConicClientModule: RCTEventEmitter {
|
|
|
119
119
|
Native Modules to pass values back to the JavaScript.
|
|
120
120
|
*/
|
|
121
121
|
@objc func getProfileValuesWithCallback(_ property: String, withCallback callback: RCTResponseSenderBlock) -> Void {
|
|
122
|
-
callback(self.getBlueConicClientInstance().
|
|
122
|
+
callback(self.getBlueConicClientInstance().getProfile().getValues(property))
|
|
123
123
|
}
|
|
124
124
|
|
|
125
125
|
/**
|
|
@@ -128,7 +128,7 @@ class BlueConicClientModule: RCTEventEmitter {
|
|
|
128
128
|
*/
|
|
129
129
|
@objc func getAllProfilePropertiesAsync(_ resolve: RCTPromiseResolveBlock, rejecter reject: RCTPromiseRejectBlock) -> Void {
|
|
130
130
|
var result = [[String: String]]()
|
|
131
|
-
let allProperties = self.getBlueConicClientInstance().
|
|
131
|
+
let allProperties = self.getBlueConicClientInstance().getProfile().getAllProperties()
|
|
132
132
|
for (key, value) in allProperties {
|
|
133
133
|
let item = [
|
|
134
134
|
"id": key,
|
|
@@ -145,7 +145,7 @@ class BlueConicClientModule: RCTEventEmitter {
|
|
|
145
145
|
Native Modules to pass values back to the JavaScript.
|
|
146
146
|
*/
|
|
147
147
|
@objc func getPrivacyLegislationAsync(_ resolve: RCTPromiseResolveBlock, rejecter reject: RCTPromiseRejectBlock) -> Void {
|
|
148
|
-
resolve([self.getBlueConicClientInstance().getPrivacyLegislation() ?? ""])
|
|
148
|
+
resolve([self.getBlueConicClientInstance().getProfile().getPrivacyLegislation() ?? ""])
|
|
149
149
|
}
|
|
150
150
|
|
|
151
151
|
/**
|
|
@@ -154,7 +154,7 @@ class BlueConicClientModule: RCTEventEmitter {
|
|
|
154
154
|
Native Modules to pass values back to the JavaScript.
|
|
155
155
|
*/
|
|
156
156
|
@objc func getPrivacyLegislationWithCallback(_ callback: RCTResponseSenderBlock) -> Void {
|
|
157
|
-
callback([self.getBlueConicClientInstance().getPrivacyLegislation() ?? ""])
|
|
157
|
+
callback([self.getBlueConicClientInstance().getProfile().getPrivacyLegislation() ?? ""])
|
|
158
158
|
}
|
|
159
159
|
|
|
160
160
|
/**
|
|
@@ -163,7 +163,7 @@ class BlueConicClientModule: RCTEventEmitter {
|
|
|
163
163
|
Native Modules to pass values back to the JavaScript.
|
|
164
164
|
*/
|
|
165
165
|
@objc func getConsentedObjectivesAsync(_ resolve: RCTPromiseResolveBlock, rejecter reject: RCTPromiseRejectBlock) -> Void {
|
|
166
|
-
resolve(self.getBlueConicClientInstance().getConsentedObjectives())
|
|
166
|
+
resolve(self.getBlueConicClientInstance().getProfile().getConsentedObjectives())
|
|
167
167
|
}
|
|
168
168
|
|
|
169
169
|
/**
|
|
@@ -172,7 +172,7 @@ class BlueConicClientModule: RCTEventEmitter {
|
|
|
172
172
|
Native Modules to pass values back to the JavaScript.
|
|
173
173
|
*/
|
|
174
174
|
@objc func getConsentedObjectivesWithCallback(_ callback: RCTResponseSenderBlock) -> Void {
|
|
175
|
-
callback(self.getBlueConicClientInstance().getConsentedObjectives())
|
|
175
|
+
callback(self.getBlueConicClientInstance().getProfile().getConsentedObjectives())
|
|
176
176
|
}
|
|
177
177
|
|
|
178
178
|
/**
|
|
@@ -181,7 +181,7 @@ class BlueConicClientModule: RCTEventEmitter {
|
|
|
181
181
|
Native Modules to pass values back to the JavaScript.
|
|
182
182
|
*/
|
|
183
183
|
@objc func getRefusedObjectivesAsync(_ resolve: RCTPromiseResolveBlock, rejecter reject: RCTPromiseRejectBlock) -> Void {
|
|
184
|
-
resolve(self.getBlueConicClientInstance().getRefusedObjectives())
|
|
184
|
+
resolve(self.getBlueConicClientInstance().getProfile().getRefusedObjectives())
|
|
185
185
|
}
|
|
186
186
|
|
|
187
187
|
/**
|
|
@@ -190,7 +190,7 @@ class BlueConicClientModule: RCTEventEmitter {
|
|
|
190
190
|
Native Modules to pass values back to the JavaScript.
|
|
191
191
|
*/
|
|
192
192
|
@objc func getRefusedObjectivesWithCallback(_ callback: RCTResponseSenderBlock) -> Void {
|
|
193
|
-
callback(self.getBlueConicClientInstance().getRefusedObjectives())
|
|
193
|
+
callback(self.getBlueConicClientInstance().getProfile().getRefusedObjectives())
|
|
194
194
|
}
|
|
195
195
|
|
|
196
196
|
/**
|
|
@@ -221,7 +221,7 @@ class BlueConicClientModule: RCTEventEmitter {
|
|
|
221
221
|
- parameter values: An Array containing Strings to be added to the profile property.
|
|
222
222
|
*/
|
|
223
223
|
@objc func addProfileValue(_ property: String, withValue value: String) -> Void {
|
|
224
|
-
self.getBlueConicClientInstance().
|
|
224
|
+
self.getBlueConicClientInstance().getProfile().addValue(property, value: value)
|
|
225
225
|
}
|
|
226
226
|
|
|
227
227
|
/**
|
|
@@ -230,7 +230,7 @@ class BlueConicClientModule: RCTEventEmitter {
|
|
|
230
230
|
- parameter values: An Array containing Strings to be added to the profile property.
|
|
231
231
|
*/
|
|
232
232
|
@objc func addProfileValues(_ property: String, withValues values: [String]) -> Void {
|
|
233
|
-
self.getBlueConicClientInstance().
|
|
233
|
+
self.getBlueConicClientInstance().getProfile().addValues(property, values: values)
|
|
234
234
|
}
|
|
235
235
|
|
|
236
236
|
/**
|
|
@@ -238,7 +238,7 @@ class BlueConicClientModule: RCTEventEmitter {
|
|
|
238
238
|
- parameter objectiveId: The ID of the objective to add to consented objectives.
|
|
239
239
|
*/
|
|
240
240
|
@objc func addConsentedObjective(_ objectiveId: String) -> Void {
|
|
241
|
-
self.getBlueConicClientInstance().addConsentedObjective(objectiveId)
|
|
241
|
+
self.getBlueConicClientInstance().getProfile().addConsentedObjective(objectiveId)
|
|
242
242
|
}
|
|
243
243
|
|
|
244
244
|
/**
|
|
@@ -246,7 +246,7 @@ class BlueConicClientModule: RCTEventEmitter {
|
|
|
246
246
|
- parameter objectiveId: The ID of the objective to add to refused objectives.
|
|
247
247
|
*/
|
|
248
248
|
@objc func addRefusedObjective(_ objectiveId: String) -> Void {
|
|
249
|
-
self.getBlueConicClientInstance().addRefusedObjective(objectiveId)
|
|
249
|
+
self.getBlueConicClientInstance().getProfile().addRefusedObjective(objectiveId)
|
|
250
250
|
}
|
|
251
251
|
|
|
252
252
|
// MARK: SETTERS
|
|
@@ -256,7 +256,7 @@ class BlueConicClientModule: RCTEventEmitter {
|
|
|
256
256
|
- parameter values: An Array containing Strings to be set as the new values for the profile property.
|
|
257
257
|
*/
|
|
258
258
|
@objc func setProfileValue(_ property: String, withValue value: String) -> Void {
|
|
259
|
-
self.getBlueConicClientInstance().
|
|
259
|
+
self.getBlueConicClientInstance().getProfile().setValue(property, value: value)
|
|
260
260
|
}
|
|
261
261
|
|
|
262
262
|
/**
|
|
@@ -265,7 +265,7 @@ class BlueConicClientModule: RCTEventEmitter {
|
|
|
265
265
|
- parameter values: An Array containing Strings to be set as the new values for the profile property.
|
|
266
266
|
*/
|
|
267
267
|
@objc func setProfileValues(_ property: String, withValues values: [String]) -> Void {
|
|
268
|
-
self.getBlueConicClientInstance().
|
|
268
|
+
self.getBlueConicClientInstance().getProfile().setValues(property, values: values)
|
|
269
269
|
}
|
|
270
270
|
|
|
271
271
|
// MARK: INCREMENT
|
|
@@ -275,7 +275,7 @@ class BlueConicClientModule: RCTEventEmitter {
|
|
|
275
275
|
- parameter values: An Array containing Strings to be incremented to the profile property.
|
|
276
276
|
*/
|
|
277
277
|
@objc func incrementProfileValue(_ property: String, withValue value: String) -> Void {
|
|
278
|
-
self.getBlueConicClientInstance().
|
|
278
|
+
self.getBlueConicClientInstance().getProfile().incrementValue(property, value: value)
|
|
279
279
|
}
|
|
280
280
|
|
|
281
281
|
/**
|
|
@@ -283,7 +283,7 @@ class BlueConicClientModule: RCTEventEmitter {
|
|
|
283
283
|
- parameter privacyLegislation: The privacy legislation.
|
|
284
284
|
*/
|
|
285
285
|
@objc func setPrivacyLegislation(_ privacyLegislation: String) -> Void {
|
|
286
|
-
self.getBlueConicClientInstance().setPrivacyLegislation(privacyLegislation)
|
|
286
|
+
self.getBlueConicClientInstance().getProfile().setPrivacyLegislation(privacyLegislation)
|
|
287
287
|
}
|
|
288
288
|
|
|
289
289
|
/**
|
|
@@ -291,7 +291,7 @@ class BlueConicClientModule: RCTEventEmitter {
|
|
|
291
291
|
- parameter objectiveIds: An Array containing Strings to be set as the new objective IDs for the consented objectives list.
|
|
292
292
|
*/
|
|
293
293
|
@objc func setConsentedObjectives(_ objectiveIds: [String]) -> Void {
|
|
294
|
-
self.getBlueConicClientInstance().setConsentedObjectives(objectiveIds)
|
|
294
|
+
self.getBlueConicClientInstance().getProfile().setConsentedObjectives(objectiveIds)
|
|
295
295
|
}
|
|
296
296
|
|
|
297
297
|
/**
|
|
@@ -299,7 +299,7 @@ class BlueConicClientModule: RCTEventEmitter {
|
|
|
299
299
|
- parameter objectiveIds: An Array containing Strings to be set as the new objective IDs for the consented objectives list.
|
|
300
300
|
*/
|
|
301
301
|
@objc func setRefusedObjectives(_ objectiveIds: [String]) -> Void {
|
|
302
|
-
self.getBlueConicClientInstance().setRefusedObjectives(objectiveIds)
|
|
302
|
+
self.getBlueConicClientInstance().getProfile().setRefusedObjectives(objectiveIds)
|
|
303
303
|
}
|
|
304
304
|
|
|
305
305
|
// MARK: PUBLIC BLUECONIC FUNCTIONS
|
|
@@ -327,6 +327,32 @@ class BlueConicClientModule: RCTEventEmitter {
|
|
|
327
327
|
}
|
|
328
328
|
})
|
|
329
329
|
}
|
|
330
|
+
|
|
331
|
+
/**
|
|
332
|
+
Clears the profile ID from the BlueConic client locally (cache). A new profile ID will be generated.
|
|
333
|
+
*/
|
|
334
|
+
@objc func createProfile(_ callback: @escaping RCTResponseSenderBlock) -> Void {
|
|
335
|
+
self.getBlueConicClientInstance().createProfile { result in
|
|
336
|
+
if result.success {
|
|
337
|
+
callback([true, nil])
|
|
338
|
+
} else if let error = result.error {
|
|
339
|
+
callback([false, error.nsError.localizedDescription])
|
|
340
|
+
}
|
|
341
|
+
}
|
|
342
|
+
}
|
|
343
|
+
|
|
344
|
+
/**
|
|
345
|
+
Removes the profile from the BlueConic servers. The profile ID will be removed from the BlueConic client. A new profile ID will be generated.
|
|
346
|
+
*/
|
|
347
|
+
@objc func deleteProfile(_ callback: @escaping RCTResponseSenderBlock) -> Void {
|
|
348
|
+
self.getBlueConicClientInstance().deleteProfile { result in
|
|
349
|
+
if result.success {
|
|
350
|
+
callback([true, nil])
|
|
351
|
+
} else if let error = result.error {
|
|
352
|
+
callback([false, error.nsError.localizedDescription])
|
|
353
|
+
}
|
|
354
|
+
}
|
|
355
|
+
}
|
|
330
356
|
|
|
331
357
|
/**
|
|
332
358
|
Calls the updateProfile method of the BlueConicClient to sync/ update the profile properties from the Mobile app with the BlueConic server.
|
|
@@ -692,19 +718,6 @@ class BlueConicClientModule: RCTEventEmitter {
|
|
|
692
718
|
|
|
693
719
|
}
|
|
694
720
|
|
|
695
|
-
/**
|
|
696
|
-
Resets the BlueConic profile id. This will generate a new profile id for the current user.
|
|
697
|
-
*/
|
|
698
|
-
@objc func clearProfileId(_ callback: @escaping RCTResponseSenderBlock) -> Void {
|
|
699
|
-
self.getBlueConicClientInstance().clearProfileId { result in
|
|
700
|
-
if result.success {
|
|
701
|
-
callback([true, nil])
|
|
702
|
-
} else if let error = result.error {
|
|
703
|
-
callback([false, error.nsError.localizedDescription])
|
|
704
|
-
}
|
|
705
|
-
}
|
|
706
|
-
}
|
|
707
|
-
|
|
708
721
|
/**
|
|
709
722
|
Returns the current screen name.
|
|
710
723
|
- parameter promise: The promise to handle the obtained value. Promises are necessary in Native Modules
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@blueconic/blueconic-react-native",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "5.0.0",
|
|
4
4
|
"description": "The BlueConicClient Framework provides the basis for communicating with BlueConic.",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"files": [
|
|
@@ -26,8 +26,8 @@
|
|
|
26
26
|
"author": "BlueConic (info@blueconic.com)",
|
|
27
27
|
"license": "SEE LICENSE IN LICENSE",
|
|
28
28
|
"nativeDependencies": {
|
|
29
|
-
"android": "
|
|
30
|
-
"ios": "
|
|
29
|
+
"android": "7.0.0",
|
|
30
|
+
"ios": "5.0.0"
|
|
31
31
|
},
|
|
32
32
|
"peerDependencies": {
|
|
33
33
|
"react-native": "<1.0.0"
|