@blueconic/blueconic-react-native 2.0.0 → 3.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/BlueConicReactNative.podspec +23 -23
- package/CHANGELOG.md +105 -88
- package/LICENSE +3 -3
- package/README.md +11 -484
- package/android/build.gradle +40 -38
- package/android/gradle.properties +9 -0
- package/android/src/main/AndroidManifest.xml +4 -5
- package/android/src/main/java/com/blueconic/{blueconicreactnative → reactnative}/BlueConicClientModule.java +918 -870
- package/android/src/main/java/com/blueconic/{blueconicreactnative → reactnative}/BlueConicClientModuleHelper.java +17 -17
- package/android/src/main/java/com/blueconic/{blueconicreactnative → reactnative}/BlueConicClientPackage.java +29 -29
- package/android/src/main/java/com/blueconic/{blueconicreactnative → reactnative}/BlueConicInteraction.java +67 -68
- package/index.js +6 -6
- package/ios/BlueConicClient-Bridging-Header.h +6 -6
- package/ios/BlueConicClient.xcodeproj/project.xcworkspace/contents.xcworkspacedata +7 -7
- package/ios/BlueConicClient.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +8 -8
- package/ios/BlueConicClientModule.m +79 -74
- package/ios/BlueConicClientModule.swift +545 -516
- package/ios/BlueConicInteraction.swift +63 -63
- package/package.json +35 -18
- package/.gitattributes +0 -1
- package/android/gradle/wrapper/gradle-wrapper.jar +0 -0
- package/android/gradle/wrapper/gradle-wrapper.properties +0 -6
- package/android/gradlew +0 -172
- package/android/gradlew.bat +0 -84
- package/android/local.properties +0 -8
- package/ios/BlueConicClient.xcodeproj/project.xcworkspace/xcuserdata/youri.xcuserdatad/UserInterfaceState.xcuserstate +0 -0
- package/ios/BlueConicClient.xcodeproj/xcuserdata/youri.xcuserdatad/xcschemes/xcschememanagement.plist +0 -14
|
@@ -1,871 +1,919 @@
|
|
|
1
|
-
|
|
2
|
-
package com.blueconic.
|
|
3
|
-
|
|
4
|
-
import android.app.Activity;
|
|
5
|
-
import android.
|
|
6
|
-
import android.
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
import com.facebook.react.bridge.
|
|
11
|
-
|
|
12
|
-
import com.facebook.react.bridge.
|
|
13
|
-
import com.facebook.react.bridge.
|
|
14
|
-
import com.facebook.react.bridge.
|
|
15
|
-
import com.facebook.react.bridge.
|
|
16
|
-
import com.facebook.react.bridge.
|
|
17
|
-
import com.facebook.react.bridge.
|
|
18
|
-
import com.facebook.react.bridge.
|
|
19
|
-
import com.facebook.react.bridge.
|
|
20
|
-
import com.facebook.react.bridge.
|
|
21
|
-
import com.facebook.react.
|
|
22
|
-
|
|
23
|
-
import
|
|
24
|
-
|
|
25
|
-
import java.util.
|
|
26
|
-
import java.util.
|
|
27
|
-
import java.util.
|
|
28
|
-
import java.util.
|
|
29
|
-
|
|
30
|
-
import
|
|
31
|
-
|
|
32
|
-
import
|
|
33
|
-
|
|
34
|
-
import com.blueconic.
|
|
35
|
-
import com.blueconic.
|
|
36
|
-
import com.blueconic.plugin.events.
|
|
37
|
-
import com.blueconic.plugin.events.
|
|
38
|
-
import com.blueconic.plugin.events.
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
*
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
*
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
*
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
*
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
@
|
|
597
|
-
|
|
598
|
-
final
|
|
599
|
-
|
|
600
|
-
if (blueConicClient != null) {
|
|
601
|
-
blueConicClient.
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
}
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
*
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
*
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
*
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
*
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
getBlueConicEventManagerInstance().publish(
|
|
760
|
-
}
|
|
761
|
-
|
|
762
|
-
/**
|
|
763
|
-
* Creates
|
|
764
|
-
* @param
|
|
765
|
-
* @param values The values to pass to BlueConic as context of the event.
|
|
766
|
-
*/
|
|
767
|
-
@ReactMethod
|
|
768
|
-
public void
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
*
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
*
|
|
829
|
-
*
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
*
|
|
858
|
-
* @
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
1
|
+
|
|
2
|
+
package com.blueconic.reactnative;
|
|
3
|
+
|
|
4
|
+
import android.app.Activity;
|
|
5
|
+
import android.os.Handler;
|
|
6
|
+
import android.os.Looper;
|
|
7
|
+
import android.util.Log;
|
|
8
|
+
|
|
9
|
+
import com.blueconic.impl.BlueConicClientImpl;
|
|
10
|
+
import com.facebook.react.bridge.ReactApplicationContext;
|
|
11
|
+
|
|
12
|
+
import com.facebook.react.bridge.ReactContextBaseJavaModule;
|
|
13
|
+
import com.facebook.react.bridge.ReactMethod;
|
|
14
|
+
import com.facebook.react.bridge.ReadableArray;
|
|
15
|
+
import com.facebook.react.bridge.Callback;
|
|
16
|
+
import com.facebook.react.bridge.Promise;
|
|
17
|
+
import com.facebook.react.bridge.Arguments;
|
|
18
|
+
import com.facebook.react.bridge.ReadableMap;
|
|
19
|
+
import com.facebook.react.bridge.WritableArray;
|
|
20
|
+
import com.facebook.react.bridge.WritableMap;
|
|
21
|
+
import com.facebook.react.bridge.WritableNativeArray;
|
|
22
|
+
import com.facebook.react.bridge.WritableNativeMap;
|
|
23
|
+
import com.facebook.react.modules.core.DeviceEventManagerModule;
|
|
24
|
+
|
|
25
|
+
import java.util.Map;
|
|
26
|
+
import java.util.HashMap;
|
|
27
|
+
import java.util.Collections;
|
|
28
|
+
import java.util.Collection;
|
|
29
|
+
import java.util.List;
|
|
30
|
+
import java.util.ArrayList;
|
|
31
|
+
|
|
32
|
+
import javax.annotation.Nonnull;
|
|
33
|
+
|
|
34
|
+
import com.blueconic.BlueConicClient;
|
|
35
|
+
import com.blueconic.BlueConicClientFactory;
|
|
36
|
+
import com.blueconic.plugin.events.BlueConicEventFactory;
|
|
37
|
+
import com.blueconic.plugin.events.BlueConicEventManager;
|
|
38
|
+
import com.blueconic.plugin.events.ClickEvent;
|
|
39
|
+
import com.blueconic.plugin.events.UpdateValuesEvent;
|
|
40
|
+
import com.blueconic.plugin.events.FormSubmitEvent;
|
|
41
|
+
import com.blueconic.plugin.events.UpdateContentEvent;
|
|
42
|
+
import com.blueconic.plugin.events.AdvancedEvent;
|
|
43
|
+
|
|
44
|
+
public class BlueConicClientModule extends ReactContextBaseJavaModule {
|
|
45
|
+
private static BlueConicClientModuleHelper helper;
|
|
46
|
+
private ReactApplicationContext reactContext;
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* The constructor calls the constructor of the superclass and creates an instance of
|
|
50
|
+
* the BlueConicClientModuleHelper class which is referred to by a static instance variable. This helper stores the
|
|
51
|
+
* reactContext, making it available for use by the static publishReceivedParametersEvent method.
|
|
52
|
+
* @param reactContext The application context.
|
|
53
|
+
*/
|
|
54
|
+
public BlueConicClientModule(ReactApplicationContext reactContext) {
|
|
55
|
+
super(reactContext);
|
|
56
|
+
this.reactContext = reactContext;
|
|
57
|
+
helper = new BlueConicClientModuleHelper(reactContext);
|
|
58
|
+
|
|
59
|
+
// Delayed plugin class register due to availability of activity context
|
|
60
|
+
new Handler(Looper.getMainLooper()).postDelayed(() -> {
|
|
61
|
+
BlueConicClient blueConicClient = getBlueConicClientInstance();
|
|
62
|
+
if (blueConicClient != null) {
|
|
63
|
+
blueConicClient.registerPluginClass(BlueConicInteraction.class, "BlueConicClient.BlueConicInteraction");
|
|
64
|
+
}
|
|
65
|
+
}, 2000);
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
/**
|
|
69
|
+
* The superclass ReactContextBaseJavaModule requires that the getName method is implemented.
|
|
70
|
+
* The purpose of this method is to return the name of the Native Module which represents this class in JavaScript.
|
|
71
|
+
* Hence, this method allows us to access the native module through NativeModules.BlueConic in JavaScript.
|
|
72
|
+
* @return String representing the name of this module.
|
|
73
|
+
*/
|
|
74
|
+
@Override
|
|
75
|
+
public String getName() {
|
|
76
|
+
return "BlueConicClient";
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
|
|
80
|
+
// MARK: GETTERS
|
|
81
|
+
/**
|
|
82
|
+
* Gets the ID of the BlueConic profile. The value is passed to the provided promiseas a String.
|
|
83
|
+
* @param promise The promise to handle the obtained value. Promises are necessary in Native Modules
|
|
84
|
+
* to pass values back to the JavaScript.
|
|
85
|
+
*/
|
|
86
|
+
@ReactMethod
|
|
87
|
+
public void getProfileId(@Nonnull Promise promise) {
|
|
88
|
+
final BlueConicClient blueConicClient = getBlueConicClientInstance();
|
|
89
|
+
String profileId = "";
|
|
90
|
+
if (blueConicClient != null) {
|
|
91
|
+
profileId = blueConicClient.getProfileId();
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
promise.resolve(profileId);
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
/**
|
|
98
|
+
* Gets the values of the specified profile property. The values are passed to the provided promise
|
|
99
|
+
* as separate Strings.
|
|
100
|
+
* @param property The profile property for which to get the values.
|
|
101
|
+
* @param promise The Promise to handle the obtained values. Promises are necessary in Native Modules
|
|
102
|
+
* to pass values back to the JavaScript.
|
|
103
|
+
*/
|
|
104
|
+
@ReactMethod
|
|
105
|
+
public void getProfileValue(@Nonnull String property, @Nonnull Promise promise) {
|
|
106
|
+
final List<String> result = new ArrayList<String>();
|
|
107
|
+
final BlueConicClient blueConicClient = getBlueConicClientInstance();
|
|
108
|
+
|
|
109
|
+
if (blueConicClient != null) {
|
|
110
|
+
result.add(blueConicClient.getProfileValue(property));
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
promise.resolve(result);
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
/**
|
|
117
|
+
* Gets the values of the specified profile property. The values are passed to the provided promise
|
|
118
|
+
* as separate Strings.
|
|
119
|
+
* @param property The profile property for which to get the values.
|
|
120
|
+
* @param promise The Promise to handle the obtained values. Promises are necessary in Native Modules
|
|
121
|
+
* to pass values back to the JavaScript.
|
|
122
|
+
*/
|
|
123
|
+
@ReactMethod
|
|
124
|
+
public void getProfileValues(@Nonnull String property, @Nonnull Promise promise) {
|
|
125
|
+
final BlueConicClient blueConicClient = getBlueConicClientInstance();
|
|
126
|
+
|
|
127
|
+
if (blueConicClient != null) {
|
|
128
|
+
Collection<String> values = blueConicClient.getProfileValues(property);
|
|
129
|
+
promise.resolve(Arguments.fromList(new ArrayList<String>(values)));
|
|
130
|
+
} else {
|
|
131
|
+
promise.resolve(Arguments.createArray());
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
/**
|
|
136
|
+
* Gets the ID of the BlueConic profile. The value is passed to the provided callback function as a String.
|
|
137
|
+
* @param callback The Callback function to handle the obtained value. Callbacks are necessary in Native Modules
|
|
138
|
+
* to pass values back to the JavaScript.
|
|
139
|
+
*/
|
|
140
|
+
@ReactMethod
|
|
141
|
+
public void getProfileIdWithCallback(@Nonnull Callback callback) {
|
|
142
|
+
final BlueConicClient blueConicClient = getBlueConicClientInstance();
|
|
143
|
+
String profileId = "";
|
|
144
|
+
if (blueConicClient != null) {
|
|
145
|
+
profileId = blueConicClient.getProfileId();
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
callback.invoke(profileId);
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
/**
|
|
152
|
+
* Gets the values of the specified profile property. The values are passed to the provided callback function
|
|
153
|
+
* as separate Strings.
|
|
154
|
+
* @param property The profile property for which to get the values.
|
|
155
|
+
* @param callback The Callback function to handle the obtained values. Callbacks are necessary in Native Modules
|
|
156
|
+
* to pass values back to the JavaScript.
|
|
157
|
+
*/
|
|
158
|
+
@ReactMethod
|
|
159
|
+
public void getProfileValueWithCallback(@Nonnull String property, @Nonnull Callback callback) {
|
|
160
|
+
final List<String> result = new ArrayList<String>();
|
|
161
|
+
final BlueConicClient blueConicClient = getBlueConicClientInstance();
|
|
162
|
+
|
|
163
|
+
if (blueConicClient != null) {
|
|
164
|
+
result.add(blueConicClient.getProfileValue(property));
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
callback.invoke(result);
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
/**
|
|
171
|
+
* Gets the values of the specified profile property. The values are passed to the provided callback function
|
|
172
|
+
* as separate Strings.
|
|
173
|
+
* @param property The profile property for which to get the values.
|
|
174
|
+
* @param callback The Callback function to handle the obtained values. Callbacks are necessary in Native Modules
|
|
175
|
+
* to pass values back to the JavaScript.
|
|
176
|
+
*/
|
|
177
|
+
@ReactMethod
|
|
178
|
+
public void getProfileValuesWithCallback(@Nonnull String property, @Nonnull Callback callback) {
|
|
179
|
+
final BlueConicClient blueConicClient = getBlueConicClientInstance();
|
|
180
|
+
|
|
181
|
+
if (blueConicClient != null) {
|
|
182
|
+
Collection<String> values = blueConicClient.getProfileValues(property);
|
|
183
|
+
callback.invoke(values.toArray());
|
|
184
|
+
} else {
|
|
185
|
+
callback.invoke(new ArrayList<String>());
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
/**
|
|
190
|
+
* Gets the privacy legislation. The values are passed to the provided promise
|
|
191
|
+
* as separate String.
|
|
192
|
+
* @param promise The Promise to handle the obtained values. Promises are necessary in Native Modules
|
|
193
|
+
* to pass values back to the JavaScript.
|
|
194
|
+
*/
|
|
195
|
+
@ReactMethod
|
|
196
|
+
public void getPrivacyLegislation(@Nonnull Promise promise) {
|
|
197
|
+
final List<String> result = new ArrayList<String>();
|
|
198
|
+
final BlueConicClient blueConicClient = getBlueConicClientInstance();
|
|
199
|
+
|
|
200
|
+
if (blueConicClient != null) {
|
|
201
|
+
result.add(blueConicClient.getPrivacyLegislation());
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
promise.resolve(result);
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
/**
|
|
208
|
+
* Gets the privacy legislation. The values are passed to the provided callback function
|
|
209
|
+
* as separate String.
|
|
210
|
+
* @param callback The Callback function to handle the obtained values. Callbacks are necessary in Native Modules
|
|
211
|
+
* to pass values back to the JavaScript.
|
|
212
|
+
*/
|
|
213
|
+
@ReactMethod
|
|
214
|
+
public void getPrivacyLegislationWithCallback(@Nonnull Callback callback) {
|
|
215
|
+
final List<String> result = new ArrayList<String>();
|
|
216
|
+
final BlueConicClient blueConicClient = getBlueConicClientInstance();
|
|
217
|
+
|
|
218
|
+
if (blueConicClient != null) {
|
|
219
|
+
result.add(blueConicClient.getPrivacyLegislation());
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
callback.invoke(result);
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
/**
|
|
226
|
+
* Gets the consented objectives. The values are passed to the provided promise
|
|
227
|
+
* as separate Strings.
|
|
228
|
+
* @param promise The Promise to handle the obtained values. Promises are necessary in Native Modules
|
|
229
|
+
* to pass values back to the JavaScript.
|
|
230
|
+
*/
|
|
231
|
+
@ReactMethod
|
|
232
|
+
public void getConsentedObjectives(@Nonnull Promise promise) {
|
|
233
|
+
final BlueConicClient blueConicClient = getBlueConicClientInstance();
|
|
234
|
+
|
|
235
|
+
if (blueConicClient != null) {
|
|
236
|
+
Collection<String> values = blueConicClient.getConsentedObjectives();
|
|
237
|
+
promise.resolve(Arguments.fromList(new ArrayList<String>(values)));
|
|
238
|
+
} else {
|
|
239
|
+
promise.resolve(Arguments.createArray());
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
/**
|
|
244
|
+
* Gets the consented objectives. The values are passed to the provided callback function
|
|
245
|
+
* as separate Strings.
|
|
246
|
+
* @param callback The Callback function to handle the obtained values. Callbacks are necessary in Native Modules
|
|
247
|
+
* to pass values back to the JavaScript.
|
|
248
|
+
*/
|
|
249
|
+
@ReactMethod
|
|
250
|
+
public void getConsentedObjectivesWithCallback(@Nonnull Callback callback) {
|
|
251
|
+
final BlueConicClient blueConicClient = getBlueConicClientInstance();
|
|
252
|
+
|
|
253
|
+
if (blueConicClient != null) {
|
|
254
|
+
Collection<String> values = blueConicClient.getConsentedObjectives();
|
|
255
|
+
callback.invoke(values.toArray());
|
|
256
|
+
} else {
|
|
257
|
+
callback.invoke(new ArrayList<String>());
|
|
258
|
+
}
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
/**
|
|
262
|
+
* Gets the refused objectives. The values are passed to the provided promise
|
|
263
|
+
* as separate Strings.
|
|
264
|
+
* @param promise The Promise to handle the obtained values. Promises are necessary in Native Modules
|
|
265
|
+
* to pass values back to the JavaScript.
|
|
266
|
+
*/
|
|
267
|
+
@ReactMethod
|
|
268
|
+
public void getRefusedObjectives(@Nonnull Promise promise) {
|
|
269
|
+
final BlueConicClient blueConicClient = getBlueConicClientInstance();
|
|
270
|
+
|
|
271
|
+
if (blueConicClient != null) {
|
|
272
|
+
Collection<String> values = blueConicClient.getRefusedObjectives();
|
|
273
|
+
promise.resolve(Arguments.fromList(new ArrayList<String>(values)));
|
|
274
|
+
} else {
|
|
275
|
+
promise.resolve(Arguments.createArray());
|
|
276
|
+
}
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
/**
|
|
280
|
+
* Gets the refused objectives. The values are passed to the provided callback function
|
|
281
|
+
* as separate Strings.
|
|
282
|
+
* @param callback The Callback function to handle the obtained values. Callbacks are necessary in Native Modules
|
|
283
|
+
* to pass values back to the JavaScript.
|
|
284
|
+
*/
|
|
285
|
+
@ReactMethod
|
|
286
|
+
public void getRefusedObjectivesWithCallback(@Nonnull Callback callback) {
|
|
287
|
+
final BlueConicClient blueConicClient = getBlueConicClientInstance();
|
|
288
|
+
|
|
289
|
+
if (blueConicClient != null) {
|
|
290
|
+
Collection<String> values = blueConicClient.getRefusedObjectives();
|
|
291
|
+
callback.invoke(values.toArray());
|
|
292
|
+
} else {
|
|
293
|
+
callback.invoke(new ArrayList<String>());
|
|
294
|
+
}
|
|
295
|
+
}
|
|
296
|
+
|
|
297
|
+
/**
|
|
298
|
+
* Setter for the locale to get the parameters for. By default, the default locale configured in BlueConic is used.
|
|
299
|
+
* @param locale the locale, e.g. 'en_US'.
|
|
300
|
+
*/
|
|
301
|
+
@ReactMethod
|
|
302
|
+
public void setLocale(@Nonnull String locale) {
|
|
303
|
+
final BlueConicClient blueConicClient = getBlueConicClientInstance();
|
|
304
|
+
if (blueConicClient != null) {
|
|
305
|
+
blueConicClient.setLocale(locale);
|
|
306
|
+
}
|
|
307
|
+
}
|
|
308
|
+
|
|
309
|
+
/**
|
|
310
|
+
* Gets the segments of the profile.
|
|
311
|
+
* To retrieve and update the Segments you have to register a pageview first.
|
|
312
|
+
* The values are passed to the provided promise
|
|
313
|
+
* as a list of Objects containing id and name.
|
|
314
|
+
* @param promise The Promise to handle the obtained values. Promises are necessary in Native Modules
|
|
315
|
+
* to pass values back to the JavaScript.
|
|
316
|
+
*/
|
|
317
|
+
@ReactMethod
|
|
318
|
+
public void getSegments(@Nonnull Promise promise) {
|
|
319
|
+
promise.resolve(getFormattedSegments());
|
|
320
|
+
}
|
|
321
|
+
|
|
322
|
+
/**
|
|
323
|
+
* Gets the segments of the profile.
|
|
324
|
+
* To retrieve and update the Segments you have to register a pageview first.
|
|
325
|
+
* The values are passed to the provided promise
|
|
326
|
+
* as a list of Objects containing id and name.
|
|
327
|
+
* @param callback The Callback function to handle the obtained values. Callbacks are necessary in Native Modules
|
|
328
|
+
* to pass values back to the JavaScript.
|
|
329
|
+
*/
|
|
330
|
+
@ReactMethod
|
|
331
|
+
public void getSegmentsWithCallback(@Nonnull Callback callback) {
|
|
332
|
+
callback.invoke(getFormattedSegments());
|
|
333
|
+
}
|
|
334
|
+
|
|
335
|
+
// MARK: ADDERS
|
|
336
|
+
/**
|
|
337
|
+
* Adds the given values to the specified profile property.
|
|
338
|
+
* @param property The profile property to which to add the values.
|
|
339
|
+
* @param values A ReadableArray containing Strings that will be added to the profile property.
|
|
340
|
+
*/
|
|
341
|
+
@ReactMethod
|
|
342
|
+
public void addProfileValues(@Nonnull String property, @Nonnull ReadableArray values) {
|
|
343
|
+
final BlueConicClient blueConicClient = getBlueConicClientInstance();
|
|
344
|
+
if (blueConicClient != null) {
|
|
345
|
+
blueConicClient.addProfileValues(property, Arguments.toList(values));
|
|
346
|
+
}
|
|
347
|
+
}
|
|
348
|
+
|
|
349
|
+
/**
|
|
350
|
+
* Adds the given values to the specified profile property.
|
|
351
|
+
* @param property The profile property to which to add the values.
|
|
352
|
+
* @param value A ReadableArray containing Strings that will be added to the profile property.
|
|
353
|
+
*/
|
|
354
|
+
@ReactMethod
|
|
355
|
+
public void addProfileValue(@Nonnull String property, @Nonnull String value) {
|
|
356
|
+
final BlueConicClient blueConicClient = getBlueConicClientInstance();
|
|
357
|
+
if (blueConicClient != null) {
|
|
358
|
+
blueConicClient.addProfileValue(property, value);
|
|
359
|
+
}
|
|
360
|
+
}
|
|
361
|
+
|
|
362
|
+
/**
|
|
363
|
+
* Adds an objective to the consented objectives list.
|
|
364
|
+
* @param objectiveId The id of the objective to add to consented objectives.
|
|
365
|
+
*/
|
|
366
|
+
@ReactMethod
|
|
367
|
+
public void addConsentedObjective(@Nonnull String objectiveId) {
|
|
368
|
+
final BlueConicClient blueConicClient = getBlueConicClientInstance();
|
|
369
|
+
if (blueConicClient != null) {
|
|
370
|
+
blueConicClient.addConsentedObjective(objectiveId);
|
|
371
|
+
}
|
|
372
|
+
}
|
|
373
|
+
|
|
374
|
+
/**
|
|
375
|
+
* Adds an objective to the refused objectives list.
|
|
376
|
+
* @param objectiveId The id of the objective to add to refused objectives.
|
|
377
|
+
*/
|
|
378
|
+
@ReactMethod
|
|
379
|
+
public void addRefusedObjective(@Nonnull String objectiveId) {
|
|
380
|
+
final BlueConicClient blueConicClient = getBlueConicClientInstance();
|
|
381
|
+
if (blueConicClient != null) {
|
|
382
|
+
blueConicClient.addRefusedObjective(objectiveId);
|
|
383
|
+
}
|
|
384
|
+
}
|
|
385
|
+
|
|
386
|
+
// MARK: SETTERS
|
|
387
|
+
/**
|
|
388
|
+
* Sets the given values for the specified profile property.
|
|
389
|
+
* @param property The profile property for which to set the values.
|
|
390
|
+
* @param values A ReadableArray containing Strings that will be set as the new values for the profile property.
|
|
391
|
+
*/
|
|
392
|
+
@ReactMethod
|
|
393
|
+
public void setProfileValues(@Nonnull String property, @Nonnull ReadableArray values) {
|
|
394
|
+
final BlueConicClient blueConicClient = getBlueConicClientInstance();
|
|
395
|
+
if (blueConicClient != null) {
|
|
396
|
+
blueConicClient.setProfileValues(property, Arguments.toList(values));
|
|
397
|
+
}
|
|
398
|
+
}
|
|
399
|
+
|
|
400
|
+
/**
|
|
401
|
+
* Set the given value for the specified profile property.
|
|
402
|
+
* @param property The profile property for which to set the values.
|
|
403
|
+
* @param value A ReadableArray containing Strings that will be set as the new values for the profile property.
|
|
404
|
+
*/
|
|
405
|
+
@ReactMethod
|
|
406
|
+
public void setProfileValue(@Nonnull String property, @Nonnull String value) {
|
|
407
|
+
final BlueConicClient blueConicClient = getBlueConicClientInstance();
|
|
408
|
+
if (blueConicClient != null) {
|
|
409
|
+
blueConicClient.setProfileValue(property, value);
|
|
410
|
+
}
|
|
411
|
+
}
|
|
412
|
+
|
|
413
|
+
/**
|
|
414
|
+
* Increments the given values to the specified profile property.
|
|
415
|
+
* @param property The profile property to which to increment the values.
|
|
416
|
+
* @param value A ReadableArray containing Strings that will be incremented to the profile property.
|
|
417
|
+
*/
|
|
418
|
+
@ReactMethod
|
|
419
|
+
public void incrementProfileValue(@Nonnull String property, @Nonnull String value) {
|
|
420
|
+
final BlueConicClient blueConicClient = getBlueConicClientInstance();
|
|
421
|
+
if (blueConicClient != null) {
|
|
422
|
+
blueConicClient.incrementProfileValue(property, value);
|
|
423
|
+
}
|
|
424
|
+
}
|
|
425
|
+
|
|
426
|
+
/**
|
|
427
|
+
* Set the privacy legislation.
|
|
428
|
+
* @param privacyLegislation The privacy legislation.
|
|
429
|
+
*/
|
|
430
|
+
@ReactMethod
|
|
431
|
+
public void setPrivacyLegislation(@Nonnull String privacyLegislation) {
|
|
432
|
+
final BlueConicClient blueConicClient = getBlueConicClientInstance();
|
|
433
|
+
if (blueConicClient != null) {
|
|
434
|
+
blueConicClient.setPrivacyLegislation(privacyLegislation);
|
|
435
|
+
}
|
|
436
|
+
}
|
|
437
|
+
|
|
438
|
+
/**
|
|
439
|
+
* Sets the given objectives for consented objectives.
|
|
440
|
+
* @param objectiveIds A ReadableArray containing IDs of Objectives that will be set as the new values for Consented objectives.
|
|
441
|
+
*/
|
|
442
|
+
@ReactMethod
|
|
443
|
+
public void setConsentedObjectives(@Nonnull ReadableArray objectiveIds) {
|
|
444
|
+
final BlueConicClient blueConicClient = getBlueConicClientInstance();
|
|
445
|
+
if (blueConicClient != null) {
|
|
446
|
+
blueConicClient.setConsentedObjectives(Arguments.toList(objectiveIds));
|
|
447
|
+
}
|
|
448
|
+
}
|
|
449
|
+
|
|
450
|
+
/**
|
|
451
|
+
* Sets the given objectives for consented objectives.
|
|
452
|
+
* @param objectiveIds A ReadableArray containing IDs of Objectives that will be set as the new values for Consented objectives.
|
|
453
|
+
*/
|
|
454
|
+
@ReactMethod
|
|
455
|
+
public void setRefusedObjectives(@Nonnull ReadableArray objectiveIds) {
|
|
456
|
+
final BlueConicClient blueConicClient = getBlueConicClientInstance();
|
|
457
|
+
if (blueConicClient != null) {
|
|
458
|
+
blueConicClient.setRefusedObjectives(Arguments.toList(objectiveIds));
|
|
459
|
+
}
|
|
460
|
+
}
|
|
461
|
+
|
|
462
|
+
/**
|
|
463
|
+
* Set enabled.
|
|
464
|
+
* Define to enable and disable the BlueConicClient
|
|
465
|
+
* To prevent or re-activate tracking data
|
|
466
|
+
* @param isEnabled to enable or disable the BlueConicClient.
|
|
467
|
+
*/
|
|
468
|
+
@ReactMethod
|
|
469
|
+
public void setEnabled(@Nonnull Boolean isEnabled) {
|
|
470
|
+
final BlueConicClient blueConicClient = getBlueConicClientInstance();
|
|
471
|
+
if (blueConicClient != null) {
|
|
472
|
+
blueConicClient.setEnabled(isEnabled == null ? false : isEnabled.booleanValue());
|
|
473
|
+
}
|
|
474
|
+
|
|
475
|
+
}
|
|
476
|
+
|
|
477
|
+
/**
|
|
478
|
+
* Return is BlueConicClient enabled. The value is passed to the provided callback function as seperated Strings.
|
|
479
|
+
* @param promise The promise to handle the obtained value. Promises are necessary in Native Modules
|
|
480
|
+
* Native Modules to pass values back to the JavaScript.
|
|
481
|
+
*/
|
|
482
|
+
@ReactMethod
|
|
483
|
+
public void isEnabled(@Nonnull Promise promise) {
|
|
484
|
+
final List<Boolean> result = new ArrayList<Boolean>();
|
|
485
|
+
final BlueConicClient blueConicClient = getBlueConicClientInstance();
|
|
486
|
+
|
|
487
|
+
if (blueConicClient != null) {
|
|
488
|
+
result.add(Boolean.valueOf(blueConicClient.isEnabled()));
|
|
489
|
+
}
|
|
490
|
+
|
|
491
|
+
promise.resolve(result);
|
|
492
|
+
}
|
|
493
|
+
|
|
494
|
+
/**
|
|
495
|
+
* Return is BlueConicClient enabled. The value is passed to the provided callback function as seperated Strings
|
|
496
|
+
* @param callback: The callback function to handle the obtained value. Callbacks are necessary in
|
|
497
|
+
* Native Modules to pass values back to the JavaScript.
|
|
498
|
+
*/
|
|
499
|
+
@ReactMethod
|
|
500
|
+
public void isEnabledWithCallback(@Nonnull Callback callback) {
|
|
501
|
+
final List<Boolean> result = new ArrayList<Boolean>();
|
|
502
|
+
final BlueConicClient blueConicClient = getBlueConicClientInstance();
|
|
503
|
+
|
|
504
|
+
if (blueConicClient != null) {
|
|
505
|
+
result.add(Boolean.valueOf(blueConicClient.isEnabled()));
|
|
506
|
+
}
|
|
507
|
+
|
|
508
|
+
callback.invoke(result);
|
|
509
|
+
}
|
|
510
|
+
|
|
511
|
+
/**
|
|
512
|
+
* Return whether the BlueConic profile is part of the BlueConic segment. The value is passed to the provided callback function as Boolean.
|
|
513
|
+
* @param segmentId The id of the segment
|
|
514
|
+
* @param promise The promise to handle the obtained value. Promises are necessary in Native Modules
|
|
515
|
+
* Native Modules to pass values back to the JavaScript.
|
|
516
|
+
*/
|
|
517
|
+
@ReactMethod
|
|
518
|
+
public void hasSegment(@Nonnull String segmentId, @Nonnull Promise promise) {
|
|
519
|
+
final List<Boolean> result = new ArrayList<Boolean>();
|
|
520
|
+
final BlueConicClient blueConicClient = getBlueConicClientInstance();
|
|
521
|
+
|
|
522
|
+
if (blueConicClient != null) {
|
|
523
|
+
result.add(Boolean.valueOf(blueConicClient.hasSegment(segmentId)));
|
|
524
|
+
}
|
|
525
|
+
|
|
526
|
+
promise.resolve(result);
|
|
527
|
+
}
|
|
528
|
+
|
|
529
|
+
/**
|
|
530
|
+
* Return whether the BlueConic profile is part of the BlueConic segment. The value is passed to the provided callback function as Boolean.
|
|
531
|
+
* @param segmentId The id of the segment
|
|
532
|
+
* @param callback: The callback function to handle the obtained value. Callbacks are necessary in
|
|
533
|
+
* Native Modules to pass values back to the JavaScript.
|
|
534
|
+
*/
|
|
535
|
+
@ReactMethod
|
|
536
|
+
public void hasSegmentWithCallback(@Nonnull String segmentId, @Nonnull Callback callback) {
|
|
537
|
+
final List<Boolean> result = new ArrayList<Boolean>();
|
|
538
|
+
final BlueConicClient blueConicClient = getBlueConicClientInstance();
|
|
539
|
+
|
|
540
|
+
if (blueConicClient != null) {
|
|
541
|
+
result.add(Boolean.valueOf(blueConicClient.hasSegment(segmentId)));
|
|
542
|
+
}
|
|
543
|
+
|
|
544
|
+
callback.invoke(result);
|
|
545
|
+
}
|
|
546
|
+
|
|
547
|
+
// MARK: REGISTERS
|
|
548
|
+
/**
|
|
549
|
+
* Create Event.
|
|
550
|
+
* @param eventName The name of the event
|
|
551
|
+
* @param readableMap The readable map retrieved from React native
|
|
552
|
+
*/
|
|
553
|
+
@ReactMethod
|
|
554
|
+
public void createEvent(@Nonnull String eventName, ReadableMap readableMap) {
|
|
555
|
+
final BlueConicClient blueConicClient = getBlueConicClientInstance();
|
|
556
|
+
final Map<String, Object> properties = readableMap.toHashMap();
|
|
557
|
+
|
|
558
|
+
if (blueConicClient != null) {
|
|
559
|
+
blueConicClient.createEventWithData(eventName, properties);
|
|
560
|
+
}
|
|
561
|
+
}
|
|
562
|
+
|
|
563
|
+
/**
|
|
564
|
+
* Create Event.
|
|
565
|
+
* @param eventName The name of the event
|
|
566
|
+
* @param readableMap The readable map retrieved from React native
|
|
567
|
+
* @param promise The promise to handle the obtained value. Promises are necessary in Native Modules
|
|
568
|
+
* Native Modules to pass values back to the JavaScript.
|
|
569
|
+
*/
|
|
570
|
+
@ReactMethod
|
|
571
|
+
public void createEventSync(@Nonnull String eventName, ReadableMap readableMap, @Nonnull final Promise promise) {
|
|
572
|
+
final BlueConicClient blueConicClient = getBlueConicClientInstance();
|
|
573
|
+
final Map<String, Object> properties = readableMap.toHashMap();
|
|
574
|
+
|
|
575
|
+
if (blueConicClient != null) {
|
|
576
|
+
blueConicClient.createEventWithData(eventName, properties, new Runnable() {
|
|
577
|
+
@Override
|
|
578
|
+
public void run() {
|
|
579
|
+
promise.resolve(Arguments.createArray());
|
|
580
|
+
}
|
|
581
|
+
});
|
|
582
|
+
return;
|
|
583
|
+
}
|
|
584
|
+
|
|
585
|
+
promise.resolve(Arguments.createArray());
|
|
586
|
+
}
|
|
587
|
+
|
|
588
|
+
/**
|
|
589
|
+
* Create Event.
|
|
590
|
+
* @param eventName The name of the event
|
|
591
|
+
* @param readableMap The readable map retrieved from React native
|
|
592
|
+
* @param callback The Callback function to handle the obtained values. Callbacks are necessary in Native Modules
|
|
593
|
+
* to pass values back to the JavaScript.
|
|
594
|
+
*/
|
|
595
|
+
@ReactMethod
|
|
596
|
+
public void createEventSyncWithCallback(@Nonnull String eventName, ReadableMap readableMap, @Nonnull final Callback callback) {
|
|
597
|
+
final BlueConicClient blueConicClient = getBlueConicClientInstance();
|
|
598
|
+
final Map<String, Object> properties = readableMap.toHashMap();
|
|
599
|
+
|
|
600
|
+
if (blueConicClient != null) {
|
|
601
|
+
blueConicClient.createEventWithData(eventName, properties, new Runnable() {
|
|
602
|
+
@Override
|
|
603
|
+
public void run() {
|
|
604
|
+
callback.invoke(Arguments.createArray());
|
|
605
|
+
}
|
|
606
|
+
});
|
|
607
|
+
return;
|
|
608
|
+
}
|
|
609
|
+
|
|
610
|
+
callback.invoke(Arguments.createArray());
|
|
611
|
+
}
|
|
612
|
+
|
|
613
|
+
|
|
614
|
+
/**
|
|
615
|
+
* Update sync the BlueConic Profile
|
|
616
|
+
*/
|
|
617
|
+
@ReactMethod
|
|
618
|
+
public void updateProfile() {
|
|
619
|
+
final BlueConicClient blueConicClient = getBlueConicClientInstance();
|
|
620
|
+
|
|
621
|
+
if (blueConicClient != null) {
|
|
622
|
+
blueConicClient.updateProfile();
|
|
623
|
+
}
|
|
624
|
+
}
|
|
625
|
+
|
|
626
|
+
/**
|
|
627
|
+
* Update sync the BlueConic Profile
|
|
628
|
+
* @param promise The promise to handle the obtained value. Promises are necessary in Native Modules
|
|
629
|
+
* Native Modules to pass values back to the JavaScript.
|
|
630
|
+
*/
|
|
631
|
+
@ReactMethod
|
|
632
|
+
public void updateProfileSync(@Nonnull final Promise promise) {
|
|
633
|
+
final BlueConicClient blueConicClient = getBlueConicClientInstance();
|
|
634
|
+
|
|
635
|
+
if (blueConicClient != null) {
|
|
636
|
+
blueConicClient.updateProfile(new Runnable() {
|
|
637
|
+
@Override
|
|
638
|
+
public void run() {
|
|
639
|
+
promise.resolve(Arguments.createArray());
|
|
640
|
+
}
|
|
641
|
+
});
|
|
642
|
+
|
|
643
|
+
return;
|
|
644
|
+
}
|
|
645
|
+
|
|
646
|
+
promise.resolve(Arguments.createArray());
|
|
647
|
+
}
|
|
648
|
+
|
|
649
|
+
/**
|
|
650
|
+
* Update sync the BlueConic Profile
|
|
651
|
+
* @param callback The Callback function to handle the obtained values. Callbacks are necessary in Native Modules
|
|
652
|
+
* to pass values back to the JavaScript.
|
|
653
|
+
*/
|
|
654
|
+
@ReactMethod
|
|
655
|
+
public void updateProfileSyncWithCallback(@Nonnull final Callback callback) {
|
|
656
|
+
final BlueConicClient blueConicClient = getBlueConicClientInstance();
|
|
657
|
+
|
|
658
|
+
if (blueConicClient != null) {
|
|
659
|
+
blueConicClient.updateProfile(new Runnable() {
|
|
660
|
+
@Override
|
|
661
|
+
public void run() {
|
|
662
|
+
callback.invoke(Arguments.createArray());
|
|
663
|
+
}
|
|
664
|
+
});
|
|
665
|
+
|
|
666
|
+
return;
|
|
667
|
+
}
|
|
668
|
+
|
|
669
|
+
callback.invoke(Arguments.createArray());
|
|
670
|
+
}
|
|
671
|
+
|
|
672
|
+
/**
|
|
673
|
+
* Calls the createEvent method of the BlueConicClient to register a PAGEVIEW event. This must be called on every
|
|
674
|
+
* screen change as it triggers the BlueConic SDK to load all plugins (i.e. listeners, dialogues) for the screen.
|
|
675
|
+
* @param screenName The name of the screen.
|
|
676
|
+
*/
|
|
677
|
+
@ReactMethod
|
|
678
|
+
public void registerPageView(@Nonnull String screenName) {
|
|
679
|
+
final BlueConicClient blueConicClient = getBlueConicClientInstance();
|
|
680
|
+
if (blueConicClient != null) {
|
|
681
|
+
// blueConicClient instance must have an activity or application
|
|
682
|
+
final Map<String, String> properties = new HashMap<>();
|
|
683
|
+
properties.put("screenName", screenName);
|
|
684
|
+
Activity activity = getCurrentActivity();
|
|
685
|
+
if (activity == null) {
|
|
686
|
+
activity = new Activity();
|
|
687
|
+
}
|
|
688
|
+
|
|
689
|
+
blueConicClient.createEvent("PAGEVIEW", properties, activity);
|
|
690
|
+
} else {
|
|
691
|
+
Log.e("BlueConic", "Unable to register a PAGEVIEW-event: Activity not available.");
|
|
692
|
+
}
|
|
693
|
+
}
|
|
694
|
+
|
|
695
|
+
/**
|
|
696
|
+
* Calls the createEvent method of the BlueConicClient to register a PAGEVIEW event. This must be called on every
|
|
697
|
+
* screen change as it triggers the BlueConic SDK to load all plugins (i.e. listeners, dialogues) for the screen.
|
|
698
|
+
* @param screenName The name of the screen.
|
|
699
|
+
*/
|
|
700
|
+
@ReactMethod
|
|
701
|
+
public void registerPageViewSync(@Nonnull String screenName, @Nonnull final Promise promise) {
|
|
702
|
+
final BlueConicClient blueConicClient = getBlueConicClientInstance();
|
|
703
|
+
if (blueConicClient != null) {
|
|
704
|
+
// blueConicClient instance must have an activity or application
|
|
705
|
+
final Map<String, String> properties = new HashMap<>();
|
|
706
|
+
properties.put("screenName", screenName);
|
|
707
|
+
Activity activity = getCurrentActivity();
|
|
708
|
+
if (activity == null) {
|
|
709
|
+
activity = new Activity();
|
|
710
|
+
}
|
|
711
|
+
|
|
712
|
+
blueConicClient.createEvent("PAGEVIEW", properties, activity, new Runnable() {
|
|
713
|
+
@Override
|
|
714
|
+
public void run() {
|
|
715
|
+
promise.resolve(Arguments.createArray());
|
|
716
|
+
}
|
|
717
|
+
});
|
|
718
|
+
} else {
|
|
719
|
+
Log.e("BlueConic", "Unable to register a PAGEVIEW-event: Activity not available.");
|
|
720
|
+
promise.resolve(Arguments.createArray());
|
|
721
|
+
}
|
|
722
|
+
}
|
|
723
|
+
|
|
724
|
+
/**
|
|
725
|
+
* Calls the createEvent method of the BlueConicClient to register a PAGEVIEW event. This must be called on every
|
|
726
|
+
* screen change as it triggers the BlueConic SDK to load all plugins (i.e. listeners, dialogues) for the screen.
|
|
727
|
+
* @param screenName The name of the screen.
|
|
728
|
+
*/
|
|
729
|
+
@ReactMethod
|
|
730
|
+
public void registerPageViewSyncCallback(@Nonnull String screenName, @Nonnull final Callback callback) {
|
|
731
|
+
final BlueConicClient blueConicClient = getBlueConicClientInstance();
|
|
732
|
+
if (blueConicClient != null) {
|
|
733
|
+
// blueConicClient instance must have an activity or application
|
|
734
|
+
final Map<String, String> properties = new HashMap<>();
|
|
735
|
+
properties.put("screenName", screenName);
|
|
736
|
+
Activity activity = getCurrentActivity();
|
|
737
|
+
if (activity == null) {
|
|
738
|
+
activity = new Activity();
|
|
739
|
+
}
|
|
740
|
+
|
|
741
|
+
blueConicClient.createEvent("PAGEVIEW", properties, activity, new Runnable() {
|
|
742
|
+
@Override
|
|
743
|
+
public void run() {
|
|
744
|
+
callback.invoke(Arguments.createArray());
|
|
745
|
+
}
|
|
746
|
+
});
|
|
747
|
+
} else {
|
|
748
|
+
Log.e("BlueConic", "Unable to register a PAGEVIEW-event: Activity not available.");
|
|
749
|
+
callback.invoke(Arguments.createArray());
|
|
750
|
+
}
|
|
751
|
+
}
|
|
752
|
+
|
|
753
|
+
/**
|
|
754
|
+
* Creates a ClickEvent for the given selector and publishes the event to BlueConic using the EventManager.
|
|
755
|
+
* @param selector The selector to identify the clicked component.
|
|
756
|
+
*/
|
|
757
|
+
@ReactMethod
|
|
758
|
+
public void registerClickEvent(@Nonnull String selector) {
|
|
759
|
+
getBlueConicEventManagerInstance().publish(new ClickEvent(selector));
|
|
760
|
+
}
|
|
761
|
+
|
|
762
|
+
/**
|
|
763
|
+
* Creates a ClickEvent for the given selector and values, and publishes the event using the EventManager.
|
|
764
|
+
* @param selector The selector to identify the clicked component.
|
|
765
|
+
* @param values The values to pass to BlueConic as context of the event.
|
|
766
|
+
*/
|
|
767
|
+
@ReactMethod
|
|
768
|
+
public void registerClickEventWithContext(@Nonnull String selector, @Nonnull ReadableArray values) {
|
|
769
|
+
getBlueConicEventManagerInstance().publish(new ClickEvent(selector, Arguments.toList(values)));
|
|
770
|
+
}
|
|
771
|
+
|
|
772
|
+
/**
|
|
773
|
+
* Creates a ClickEvent for the given selector and publishes the event to BlueConic using the EventManager.
|
|
774
|
+
* @param selector The selector to identify the clicked component.
|
|
775
|
+
*/
|
|
776
|
+
@ReactMethod
|
|
777
|
+
public void registerFormSubmitEvent(@Nonnull String selector) {
|
|
778
|
+
getBlueConicEventManagerInstance().publish(new FormSubmitEvent(selector));
|
|
779
|
+
}
|
|
780
|
+
|
|
781
|
+
/**
|
|
782
|
+
* Creates a ClickEvent for the given selector and values, and publishes the event using the EventManager.
|
|
783
|
+
* @param selector The selector to identify the clicked component.
|
|
784
|
+
* @param values The values to pass to BlueConic as context of the event.
|
|
785
|
+
*/
|
|
786
|
+
@ReactMethod
|
|
787
|
+
public void registerFormSubmitEventWithContext(@Nonnull String selector, @Nonnull ReadableArray values) {
|
|
788
|
+
getBlueConicEventManagerInstance().publish(new FormSubmitEvent(selector, Arguments.toList(values)));
|
|
789
|
+
}
|
|
790
|
+
|
|
791
|
+
/**
|
|
792
|
+
* Creates an UpdateContentEvent for the given selector and value, and publishes the event using the EventManager.
|
|
793
|
+
* @param selector The selector to identify the component with updated values.
|
|
794
|
+
* @param value The value to be passed on to BlueConic.
|
|
795
|
+
*/
|
|
796
|
+
@ReactMethod
|
|
797
|
+
public void registerUpdateContentEvent(@Nonnull String selector, @Nonnull String value) {
|
|
798
|
+
UpdateContentEvent event = new UpdateContentEvent(selector, value);
|
|
799
|
+
getBlueConicEventManagerInstance().publish(event);
|
|
800
|
+
}
|
|
801
|
+
|
|
802
|
+
/**
|
|
803
|
+
* Creates an UpdateValuesEvent for the given selector and value, and publishes the event using the EventManager.
|
|
804
|
+
* @param selector The selector to identify the component with updated values.
|
|
805
|
+
* @param value The value to be passed on to BlueConic.
|
|
806
|
+
*/
|
|
807
|
+
@ReactMethod
|
|
808
|
+
public void registerUpdateValuesEvent(@Nonnull String selector, @Nonnull String value) {
|
|
809
|
+
UpdateValuesEvent event = new UpdateValuesEvent(selector, Collections.singletonList(value));
|
|
810
|
+
getBlueConicEventManagerInstance().publish(event);
|
|
811
|
+
}
|
|
812
|
+
|
|
813
|
+
/**
|
|
814
|
+
* Creates an AdvancedEvent with the given name and values, and publishes the event using the EventManager.
|
|
815
|
+
* @param name The name to identify the event.
|
|
816
|
+
* @param values The values to pass to BlueConic as context of the event.
|
|
817
|
+
*/
|
|
818
|
+
@ReactMethod
|
|
819
|
+
public void registerAdvancedEvent(@Nonnull String name, @Nonnull ReadableArray values) {
|
|
820
|
+
AdvancedEvent event = new AdvancedEvent(name, Arguments.toList(values));
|
|
821
|
+
getBlueConicEventManagerInstance().publish(event);
|
|
822
|
+
}
|
|
823
|
+
|
|
824
|
+
|
|
825
|
+
|
|
826
|
+
/**
|
|
827
|
+
* Destroys all active BlueConic plugins (i.e. instances of listeners and dialogues). This method must be called
|
|
828
|
+
* in the onPause of an activity if the app targets Android API versions before API 14. It should also be called if
|
|
829
|
+
* one switches screens in the app without calling the onPause of the previous Activity.
|
|
830
|
+
*
|
|
831
|
+
*/
|
|
832
|
+
@ReactMethod
|
|
833
|
+
public void destroyPlugins() {
|
|
834
|
+
final BlueConicClient blueConicClient = getBlueConicClientInstance();
|
|
835
|
+
if (blueConicClient != null) {
|
|
836
|
+
blueConicClient.destroyPlugins();
|
|
837
|
+
}
|
|
838
|
+
}
|
|
839
|
+
|
|
840
|
+
/**
|
|
841
|
+
* Sends an event to the BlueConic server, indicating that a certain interaction was viewed, clicked, or converted for.
|
|
842
|
+
* @param eventType The event type to register for the interaction. Possible events are "VIEW", "CLICK" and "CONVERSION".
|
|
843
|
+
* @param interactionId The unique identifier of the interaction.
|
|
844
|
+
*/
|
|
845
|
+
@ReactMethod
|
|
846
|
+
public void registerDialogueEvent(@Nonnull String eventType, @Nonnull String interactionId) {
|
|
847
|
+
final BlueConicClient blueConicClient = getBlueConicClientInstance();
|
|
848
|
+
if (blueConicClient != null) {
|
|
849
|
+
final Map<String, String> interactionIdMap = new HashMap<>();
|
|
850
|
+
interactionIdMap.put("interactionId", interactionId);
|
|
851
|
+
blueConicClient.createEvent(eventType, interactionIdMap);
|
|
852
|
+
}
|
|
853
|
+
}
|
|
854
|
+
|
|
855
|
+
|
|
856
|
+
/**
|
|
857
|
+
* Returns an instance of the BlueConicClient
|
|
858
|
+
* @return BlueConicClient
|
|
859
|
+
*/
|
|
860
|
+
private BlueConicClient getBlueConicClientInstance() {
|
|
861
|
+
// Retrieve current Activity from ReactContextBaseJavaModule
|
|
862
|
+
final Activity currentActivity = getCurrentActivity();
|
|
863
|
+
if (currentActivity != null) {
|
|
864
|
+
// Activity found and return a BlueConicClient instance
|
|
865
|
+
BlueConicClient instance = BlueConicClientFactory.INSTANCE.getInstance(currentActivity);
|
|
866
|
+
//Set platform information
|
|
867
|
+
BlueConicClientImpl implInstance = (BlueConicClientImpl) instance;
|
|
868
|
+
//implInstance.setPlatformInformation(BuildConfig.PLATFORM_NAME, BuildConfig.PLATFORM_VERSION);
|
|
869
|
+
return instance;
|
|
870
|
+
}
|
|
871
|
+
|
|
872
|
+
return null;
|
|
873
|
+
}
|
|
874
|
+
|
|
875
|
+
/**
|
|
876
|
+
* Returns an instance of the BlueConicEventManager
|
|
877
|
+
* @return BlueConicClient
|
|
878
|
+
*/
|
|
879
|
+
private BlueConicEventManager getBlueConicEventManagerInstance() {
|
|
880
|
+
return BlueConicEventFactory.INSTANCE.getInstance(getBlueConicClientInstance());
|
|
881
|
+
}
|
|
882
|
+
|
|
883
|
+
private WritableArray getFormattedSegments() {
|
|
884
|
+
final WritableArray result = new WritableNativeArray();
|
|
885
|
+
final BlueConicClient blueConicClient = getBlueConicClientInstance();
|
|
886
|
+
|
|
887
|
+
if (blueConicClient == null) {
|
|
888
|
+
return result;
|
|
889
|
+
}
|
|
890
|
+
final Collection<BlueConicClient.Segment> segments = blueConicClient.getSegments();
|
|
891
|
+
|
|
892
|
+
for (BlueConicClient.Segment segment : segments) {
|
|
893
|
+
final WritableMap item = new WritableNativeMap();
|
|
894
|
+
item.putString("id", segment.getId());
|
|
895
|
+
item.putString("name", segment.getName());
|
|
896
|
+
result.pushMap(item);
|
|
897
|
+
}
|
|
898
|
+
|
|
899
|
+
return result;
|
|
900
|
+
}
|
|
901
|
+
|
|
902
|
+
/**
|
|
903
|
+
* Static method that is called by the BlueConicInteraction when it receives the parameters of the dialogue,
|
|
904
|
+
* and when the dialogue is destroyed by the BlueConic SDK. An event is published to which the JavaScript of the
|
|
905
|
+
* app should subscribe.
|
|
906
|
+
* @param properties The properties of the dialogues as received from BlueConic.
|
|
907
|
+
* @param eventName The name of the event to be published.
|
|
908
|
+
*/
|
|
909
|
+
static void publishDialogueEvent(@Nonnull Map<String, Object> properties, String eventName) {
|
|
910
|
+
WritableMap map = Arguments.makeNativeMap(properties);
|
|
911
|
+
|
|
912
|
+
if (helper != null) {
|
|
913
|
+
helper
|
|
914
|
+
.getReactContext()
|
|
915
|
+
.getJSModule(DeviceEventManagerModule.RCTDeviceEventEmitter.class)
|
|
916
|
+
.emit(eventName, map);
|
|
917
|
+
}
|
|
918
|
+
}
|
|
871
919
|
}
|