-
Notifications
You must be signed in to change notification settings - Fork 71
/
App.js
1774 lines (1662 loc) · 52.5 KB
/
App.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
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
599
600
601
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
760
761
762
763
764
765
766
767
768
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
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
/* eslint-disable */
import React, {Component} from 'react';
import {NavigationContainer} from '@react-navigation/native';
import {createNativeStackNavigator} from '@react-navigation/native-stack';
import {
Alert,
LayoutAnimation,
StyleSheet,
View,
Text,
ScrollView,
UIManager,
TouchableOpacity,
Platform,
Image,
Linking,
ToastAndroid,
} from 'react-native';
import {acc} from 'react-native-reanimated';
const CleverTap = require('clevertap-react-native');
const Stack = createNativeStackNavigator();
class Expandable_ListView extends Component {
constructor() {
super();
this.state = {
layout_Height: 0,
};
}
UNSAFE_componentWillReceiveProps(nextProps) {
if (nextProps.item.expanded) {
this.setState(() => {
return {
layout_Height: null,
};
});
} else {
this.setState(() => {
return {
layout_Height: 0,
};
});
}
}
shouldComponentUpdate(nextProps, nextState) {
if (this.state.layout_Height !== nextState.layout_Height) {
return true;
}
return false;
}
//In this Function You can write the items to be called w.r.t list id:
show_Selected_Category = (item) => {
switch (item.id) {
case 1:
set_userProfile();
break;
case 2:
CleverTap.profileSetMultiValuesForKey(['a', 'b', 'c'], 'letters');
break;
case 3:
CleverTap.profileRemoveMultiValueForKey('b', 'letters');
break;
case 4:
CleverTap.profileRemoveMultiValueForKey('b', 'letters');
break;
case 5:
CleverTap.profileAddMultiValueForKey('d', 'letters');
break;
case 500:
CleverTap.profileIncrementValueForKey(10, 'score');
CleverTap.profileIncrementValueForKey(3.141, 'PI_Float');
CleverTap.profileIncrementValueForKey(
3.141592653589793,
'PI_Double',
);
break;
case 501:
CleverTap.profileDecrementValueForKey(10, 'score');
CleverTap.profileDecrementValueForKey(3.141, 'PI_Float');
CleverTap.profileDecrementValueForKey(
3.141592653589793,
'PI_Double',
);
break;
case 6:
onUser_Login();
break;
case 7: //Removing a Value from the Multiple Values
removeMultiValuesForKey();
break;
case 8:
removeValueForKey();
break;
case 9:
getCleverTap_id();
break;
case 10:
set_userLocation();
break;
case 303:
set_Locale();
break;
case 11:
CleverTap.initializeInbox();
break;
case 12:
show_appInbox();
break;
case 55:
show_appInboxwithTabs();
break;
case 13:
get_TotalMessageCount();
break;
case 14:
get_UnreadMessageCount();
break;
case 15:
Get_All_InboxMessages();
break;
case 16:
get_All_InboxUnreadMessages();
break;
case 17:
Get_InboxMessageForId();
break;
case 18:
delete_InboxMessageForId();
break;
case 19:
markRead_InboxMessageForId();
break;
case 20:
pushInboxNotificationViewed();
break;
case 21:
pushInboxNotificationClicked();
break;
case 22:
pushevent();
break;
case 23:
pushChargedEvent();
break;
case 24:
CleverTap.setDebugLevel(3);
break;
case 25:
create_NotificationChannelGroup();
break;
case 26:
create_NotificationChannel();
break;
case 27:
delete_NotificationChannel();
break;
case 28:
delete_NotificationChannelGroup();
break;
case 29:
pushFcmRegistrationId();
break;
case 30:
create_notification();
break;
case 300:
createNotificationChannelWithSound();
break;
case 301:
createNotificationChannelWithGroupId();
break;
case 302:
createNotificationChannelWithGroupIdAndSound();
break;
case 31:
getUnitID();
break;
case 32:
getAllDisplayUnits();
break;
case 33:
fetch();
break;
case 34:
activate();
break;
case 35:
fetchAndActivate();
break;
case 36:
fetchwithMinIntervalinsec();
break;
case 37:
setMinimumFetchIntervalInSeconds();
break;
case 38:
getBoolean();
break;
case 39:
getDouble();
break;
case 40:
getLong();
break;
case 41:
getString();
break;
case 42:
getStrings();
break;
case 43:
reset_config();
break;
case 44:
getLastFetchTimeStampInMillis();
break;
case 45:
getFeatureFlag();
break;
case 450:
CleverTap.suspendInAppNotifications();
break;
case 451:
CleverTap.discardInAppNotifications();
break;
case 452:
CleverTap.resumeInAppNotifications();
break;
case 46:
enablePersonalization();
break;
case 47:
profile_getProperty();
break;
case 48:
GetCleverTapAttributionIdentifier();
break;
case 49:
CleverTap.setOptOut(false);
break;
case 50:
CleverTap.enableDeviceNetworkInfoReporting(true);
break;
case 51:
CleverTap.enablePersonalization();
break;
case 52:
CleverTap.setOffline(false);
break;
case 53:
addCleverTapAPIListeners(true);
break;
case 54:
removeCleverTapAPIListeners();
break;
case 60:
case 61:
case 62:
case 63:
case 64:
case 65:
case 66:
case 67:
case 68:
case 69:
case 690:
case 691:
case 692:
case 693:
case 694:
case 695:
case 696:
case 697:
case 698:
CleverTap.recordEvent(item.name);
break;
case 70:
CleverTap.isPushPermissionGranted((err, res) => {
console.log('isPushPermissionGranted', res, err);
if (res == true) {
alert('Push Notification permission is already granted');
}
else {
CleverTap.promptPushPrimer({
inAppType: 'half-interstitial',
titleText: 'Get Notified',
messageText:
'Please enable notifications on your device to use Push Notifications.',
followDeviceOrientation: true,
positiveBtnText: 'Allow',
negativeBtnText: 'Cancel',
backgroundColor: '#FFFFFF',
btnBorderColor: '#0000FF',
titleTextColor: '#0000FF',
messageTextColor: '#000000',
btnTextColor: '#FFFFFF',
btnBackgroundColor: '#0000FF',
btnBorderRadius: '2',
});
}
});
break;
case 71:
CleverTap.isPushPermissionGranted((err, res) => {
console.log('isPushPermissionGranted', res, err);
if (res == true) {
alert('Push Notification permission is already granted');
}
else {
CleverTap.promptPushPrimer({
inAppType: 'half-interstitial',
titleText: 'Get Notified',
messageText:
'Please enable notifications on your device to use Push Notifications.',
followDeviceOrientation: true,
positiveBtnText: 'Allow',
negativeBtnText: 'Cancel',
backgroundColor: '#FFFFFF',
btnBorderColor: '#0000FF',
titleTextColor: '#0000FF',
messageTextColor: '#000000',
btnTextColor: '#FFFFFF',
btnBackgroundColor: '#0000FF',
imageUrl:
'https://icons.iconarchive.com/icons/treetog/junior/64/camera-icon.png',
btnBorderRadius: '2',
});
}
});
break;
case 72:
CleverTap.isPushPermissionGranted((err, res) => {
console.log('isPushPermissionGranted', res, err);
if (res == true) {
alert('Push Notification permission is already granted');
}
else {
CleverTap.promptPushPrimer({
inAppType: 'half-interstitial',
titleText: 'Get Notified',
messageText:
'Please enable notifications on your device to use Push Notifications.',
followDeviceOrientation: true,
positiveBtnText: 'Allow',
negativeBtnText: 'Cancel',
backgroundColor: '#FFFFFF',
btnBorderColor: '#0000FF',
titleTextColor: '#0000FF',
messageTextColor: '#000000',
btnTextColor: '#FFFFFF',
btnBackgroundColor: '#0000FF',
btnBorderRadius: '2',
fallbackToSettings: true,
});
}
});
break;
case 73:
CleverTap.isPushPermissionGranted((err, res) => {
console.log('isPushPermissionGranted', res, err);
if (res == true) {
alert('Push Notification permission is already granted');
}
else {
CleverTap.promptPushPrimer({
inAppType: 'alert',
titleText: 'Get Notified',
messageText: 'Enable Notification permission',
followDeviceOrientation: true,
positiveBtnText: 'Allow',
negativeBtnText: 'Cancel',
});
}
});
break;
case 74:
CleverTap.isPushPermissionGranted((err, res) => {
console.log('isPushPermissionGranted', res, err);
if (res == true) {
alert('Push Notification permission is already granted');
}
else {
CleverTap.promptPushPrimer({
inAppType: 'alert',
titleText: 'Get Notified',
messageText: 'Enable Notification permission',
followDeviceOrientation: false,
positiveBtnText: 'Allow',
negativeBtnText: 'Cancel',
});
}
});
break;
case 75:
CleverTap.isPushPermissionGranted((err, res) => {
console.log('isPushPermissionGranted', res, err);
if (res == true) {
alert('Push Notification permission is already granted');
}
else {
CleverTap.promptPushPrimer({
inAppType: 'alert',
titleText: 'Get Notified',
messageText: 'Enable Notification permission',
followDeviceOrientation: false,
positiveBtnText: 'Allow',
negativeBtnText: 'Cancel',
fallbackToSettings: true,
});
}
});
break;
case 76:
CleverTap.isPushPermissionGranted((err, res) => {
console.log('isPushPermissionGranted', res, err);
if (res == false) {
CleverTap.promptForPushPermission(false);
}
else {
alert('Push Notification permission is already granted');
}
});
break;
case 77:
CleverTap.isPushPermissionGranted((err, res) => {
console.log('isPushPermissionGranted', res, err);
if (res == false) {
CleverTap.promptForPushPermission(true);
}
else{
alert('Push Notification permission is already granted');
}
});
break;
case 80:
CleverTap.syncVariables()
break;
case 81:
CleverTap.getVariables((err, variables) => {
console.log('getVariables: ', variables, err);
});
break;
case 82:
CleverTap.getVariable('reactnative_var_string', (err, variable) => {
console.log(`variable value for key \'reactnative_var_string\': ${variable}`);
});
break;
case 83:
let variables = {
'reactnative_var_string': 'reactnative_var_string_value',
'reactnative_var_map': {
'reactnative_var_map_string': 'reactnative_var_map_value'
},
'reactnative_var_int': 6,
'reactnative_var_float': 6.9,
'reactnative_var_boolean': true
};
console.log(`Creating variables: ${JSON.stringify(variables)}`);
CleverTap.defineVariables(variables);
break;
case 84:
CleverTap.fetchVariables((err, success) => {
console.log('fetchVariables result: ', success);
});
break;
case 85:
CleverTap.onVariablesChanged((variables) => {
console.log('onVariablesChanged: ', variables);
});
break;
case 86:
CleverTap.onValueChanged('reactnative_var_string', (variable) => {
console.log('onValueChanged: ', variable);
});
break;
case 87:
CleverTap.fetchInApps((err, success) => {
console.log('fetchInApps result: ', success);
});
break;
case 88:
CleverTap.clearInAppResources(false);
break;
case 89:
CleverTap.clearInAppResources(true);
break;
}
}
render() {
return (
<View style={styles.Panel_Holder}>
<TouchableOpacity
activeOpacity={0.8}
onPress={this.props.onClickFunction}
style={styles.category_View}>
<Text style={styles.category_Text}>
{this.props.item.category_Name}{' '}
</Text>
<Image
source={{
uri: 'https://reactnativecode.com/wp-content/uploads/2019/02/arrow_right_icon.png',
}}
style={styles.iconStyle}
/>
</TouchableOpacity>
<View style={{height: this.state.layout_Height, overflow: 'hidden'}}>
{this.props.item.sub_Category.map((item, key) => (
<TouchableOpacity
key={key}
style={styles.sub_Category_Text}
onPress={this.show_Selected_Category.bind(this, item)}>
<Text style={styles.setSubCategoryFontSizeOne}>
{' '}
{item.name}{' '}
</Text>
<View
style={{width: '100%', height: 1, backgroundColor: '#000'}}
/>
</TouchableOpacity>
))}
</View>
</View>
);
}
}
export default class App extends Component {
constructor() {
super();
if (Platform.OS === 'android') {
UIManager.setLayoutAnimationEnabledExperimental(true);
}
CleverTap.setDebugLevel(3);
// for iOS only: register for push notifications
CleverTap.registerForPush();
addCleverTapAPIListeners(false);
CleverTap.initializeInbox();
// Listener to handle incoming deep links
Linking.addEventListener('url', _handleOpenUrl);
/// this handles the case where a deep link launches the application
Linking.getInitialURL()
.then(url => {
if (url) {
console.log('launch url', url);
_handleOpenUrl({url});
}
})
.catch(err => console.error('launch url error', err));
// check to see if CleverTap has a launch deep link
// handles the case where the app is launched from a push notification containing a deep link
CleverTap.getInitialUrl((err, url) => {
const archUsed = global?.nativeFabricUIManager ? 'new' : 'old';
console.log(`Using RN ${archUsed} architecture`);
if (url) {
console.log('CleverTap launch url', url);
_handleOpenUrl({url}, 'CleverTap');
} else if (err) {
console.log('CleverTap launch url', err);
}
});
const array = [
{
expanded: false,
category_Name: 'Product Experiences: Vars',
sub_Category: [
{
id: 80,
name: 'Sync Variables'
},
{
id: 81,
name: 'Get Variables'
},
{
id: 82,
name: 'Get Variable Value for name \'reactnative_var_string\''
},
{
id: 83,
name: 'Define Variables'
},
{
id: 84,
name: 'Fetch Variables'
},
{
id: 85,
name: 'Add \'OnVariablesChanged\' listener'
},
{
id: 86,
name: 'Add \'OnValueChanged\' listener for name \'reactnative_var_string\''
}
],
},
{
expanded: false,
category_Name: 'Client Side InApps',
sub_Category: [
{id: 87, name: 'Fetch Client Side InApps'},
{id: 88, name: 'Clear All InApp Resources'},
{id: 89, name: 'Clear Expired Only InApp Resources'}
],
},
{
expanded: false,
category_Name: 'User Properties',
sub_Category: [
{id: 1, name: 'pushProfile'},
{id: 2, name: 'set Multi Values For Key'},
{
id: 3,
name: 'removeMultiValueForKey',
},
{id: 4, name: 'removeValueForKey'},
{id: 5, name: 'addMultiValueForKey'},
{id: 500, name: 'Increment Value'},
{id: 501, name: 'Decrement Value'},
],
},
{
expanded: false,
category_Name: 'Identity Management',
sub_Category: [
{id: 6, name: 'onUserLogin'},
{id: 7, name: 'removeMultiValueForKey'},
{
id: 8,
name: 'removeValueForKey',
},
{id: 9, name: 'getCleverTapID'},
],
},
{
expanded: false,
category_Name: 'Location ',
sub_Category: [
{id: 10, name: 'setLocation'},
{id: 303, name: 'setLocale'},
],
},
{
expanded: false,
category_Name: 'App Inbox',
sub_Category: [
{id: 11, name: 'initializeInbox'},
{id: 12, name: 'showAppInbox'},
{id: 55, name: 'showAppInboxwithTabs'},
{id: 13, name: 'getInboxMessageCount'},
{
id: 14,
name: 'getInboxMessageUnreadCount',
},
{id: 15, name: 'getAllInboxMessages'},
{id: 16, name: 'getUnreadInboxMessages'},
{id: 17, name: 'getInboxMessageForId'},
{
id: 18,
name: 'deleteInboxMessage',
},
{id: 19, name: 'markReadInboxMessage'},
{id: 20, name: 'pushInboxNotificationViewedEvent'},
{
id: 21,
name: 'pushInboxNotificationClickedEvent',
},
],
},
{
expanded: false,
category_Name: 'Events',
sub_Category: [
{id: 22, name: 'pushEvent'},
{id: 23, name: 'pushChargedEvent'},
],
},
{
expanded: false,
category_Name: 'Enable Debugging',
sub_Category: [{id: 24, name: 'Set Debug Level'}],
},
{
expanded: false,
category_Name: 'Push Notifications',
sub_Category: [
{id: 25, name: 'createNotificationChannelGroup'},
{id: 26, name: 'createNotificationChannel'},
{id: 27, name: 'deleteNotificationChannel'},
{
id: 28,
name: 'deleteNotificationChannelGroup',
},
{id: 29, name: 'pushFcmRegistrationId'},
{id: 30, name: 'createNotification'},
{id: 300, name: 'createNotificationChannelWithSound'},
{id: 301, name: 'createNotificationChannelWithGroupId'},
{id: 302, name: 'createNotificationChannelWithGroupIdAndSound'},
],
},
{
expanded: false,
category_Name: 'Native Display',
sub_Category: [
{id: 31, name: 'getUnitID'},
{id: 32, name: 'getAllDisplayUnits'},
],
},
{
expanded: false,
category_Name: 'Product Config',
sub_Category: [
{id: 33, name: 'productConfig setDefault'},
{id: 34, name: 'fetch()'},
{id: 35, name: 'activate'},
{id: 36, name: 'fetchAndActivate'},
{
id: 37,
name: 'setMinimumFetchIntervalInSeconds',
},
{id: 38, name: 'getBoolean'},
{id: 39, name: 'getDouble'},
{id: 40, name: 'getLong'},
{
id: 41,
name: 'getString',
},
{id: 42, name: 'getString'},
{id: 43, name: 'reset'},
,
{
id: 44,
name: 'getLastFetchTimeStampInMillis',
},
],
},
{
expanded: false,
category_Name: 'Feature Flag',
sub_Category: [{id: 45, name: 'getFeatureFlag'}],
},
{
expanded: false,
category_Name: 'InApp Controls',
sub_Category: [
{id: 450, name: 'suspendInAppNotifications'},
{id: 451, name: 'discardInAppNotifications'},
{id: 452, name: 'resumeInAppNotifications'},
],
},
{
expanded: false,
category_Name: 'App Personalisation',
sub_Category: [
{id: 46, name: 'enablePersonalization'},
{id: 47, name: 'get profile Property'},
],
},
{
expanded: false,
category_Name: 'Attributions',
sub_Category: [
{
id: 48,
name: '(Deprecated) get CleverTap Attribution Identifier',
},
],
},
{
expanded: false,
category_Name: 'GDPR',
sub_Category: [
{id: 49, name: 'setOptOut'},
{id: 50, name: 'enableDeviceNetworkInfoReporting'},
],
},
{
expanded: false,
category_Name: 'Multi-Instance',
sub_Category: [
{id: 51, name: 'enablePersonalization'},
{id: 52, name: 'setOffline'},
],
},
{
expanded: false,
category_Name: 'Listeners',
sub_Category: [
{id: 53, name: 'addCleverTapAPIListeners'},
{
id: 54,
name: 'removeCleverTapAPIListeners',
},
],
},
{
expanded: false,
category_Name: 'Push Templates',
sub_Category: [
{id: 60, name: 'Send Basic Push'},
{id: 61, name: 'Send Carousel Push'},
{id: 62, name: 'Send Manual Carousel Push'},
{id: 63, name: 'Send Filmstrip Carousel Push'},
{id: 64, name: 'Send Rating Push'},
{id: 65, name: 'Send Product Display Notification'},
{id: 66, name: 'Send Linear Product Display Push'},
{id: 67, name: 'Send CTA Notification'},
{id: 68, name: 'Send Zero Bezel Notification'},
{id: 69, name: 'Send Zero Bezel Text Only Notification'},
{id: 690, name: 'Send Timer Notification'},
{id: 691, name: 'Send Input Box Notification'},
{id: 692, name: 'Send Input Box Reply with Event Notification'},
{
id: 693,
name: 'Send Input Box Reply with Auto Open Notification',
},
{id: 694, name: 'Send Input Box Remind Notification DOC FALSE'},
{id: 695, name: 'Send Input Box CTA DOC true'},
{id: 696, name: 'Send Input Box CTA DOC false'},
{id: 697, name: 'Send Input Box Reminder DOC true'},
{id: 698, name: 'Send Input Box Reminder DOC false'},
],
},
{
expanded: false,
category_Name: 'PROMPT LOCAL IAM',
sub_Category: [
{id: 70, name: 'Half-Interstitial Local IAM'},
{id: 71, name: 'Half-Interstitial Local IAM with image URL'},
{
id: 72,
name: 'Half-Interstitial Local IAM with fallbackToSettings - true',
},
{id: 73, name: 'Alert Local IAM'},
{
id: 74,
name: 'Alert Local IAM with followDeviceOrientation - false',
},
{id: 75, name: 'Alert Local IAM with fallbackToSettings - true'},
{
id: 76,
name: 'Hard permission dialog with fallbackToSettings - false',
},
{
id: 77,
name: 'Hard permission dialog with fallbackToSettings - true',
},
],
},
];
this.state = {AccordionData: [...array]};
}
update_Layout = index => {
LayoutAnimation.configureNext(LayoutAnimation.Presets.easeInEaseOut);
const array = [...this.state.AccordionData];
array[index]['expanded'] = !array[index]['expanded'];
this.setState(() => {
return {
AccordionData: array,
};
});
};
render() {
return (
<View style={styles.MainContainer}>
<ScrollView
contentContainerStyle={{paddingHorizontal: 8, paddingVertical: 5}}>
<TouchableOpacity style={styles.button}>
<Text style={styles.button_Text}>CleverTap Example</Text>
</TouchableOpacity>
{this.state.AccordionData.map((item, key) => (
<Expandable_ListView
key={item.category_Name}
onClickFunction={this.update_Layout.bind(this, key)}
item={item}
/>
))}
</ScrollView>
</View>
);
}
}
set_userProfile = () => {
alert('User Profile Updated');
CleverTap.profileSet({
Name: 'testUserA1',
Identity: '123456',
Email: '[email protected]',
custom1: 123,
birthdate: new Date('2020-03-03T06:35:31'),
});
};
//Identity_Management
onUser_Login = () => {
alert('User Profile Updated');
//On user Login
CleverTap.onUserLogin({
Name: 'testUserA1',
Identity: new Date().getTime() + '',
Email: new Date().getTime() + '[email protected]',
custom1: 123,
birthdate: new Date('1992-12-22T06:35:31'),
});
};
removeMultiValuesForKey = () => {
alert('User Profile Updated');
//Removing Multiple Values
CleverTap.profileRemoveMultiValuesForKey(['a', 'c'], 'letters');
};
removeValueForKey = () => {
alert('User Profile Updated');
//Removing Value for key
CleverTap.profileRemoveValueForKey('letters');
};
getCleverTap_id = () => {
// Below method is deprecated since 0.6.0, please check index.js for deprecation, instead use CleverTap.getCleverTapID()
/*CleverTap.profileGetCleverTapID((err, res) => {
console.log('CleverTapID', res, err);
alert(`CleverTapID: \n ${res}`);
});*/
// Use below newly added method
CleverTap.getCleverTapID((err, res) => {
console.log('CleverTapID', res, err);
alert(`CleverTapID: \n ${res}`);
});
};
// Location
set_userLocation = () => {
alert('User Location set');
CleverTap.setLocation(34.15, -118.2);
};
// Location
set_Locale = () => {
alert('User Locale set');
CleverTap.setLocale("en_IN");
};
///Events
pushevent = () => {
alert('Event Recorded');
//Recording an Event
CleverTap.recordEvent('testEvent');
CleverTap.recordEvent('Send Basic Push');
CleverTap.recordEvent('testEventWithProps', {start: new Date(), foo: 'bar'});
};
pushChargedEvent = () => {
alert('Charged Event Recorded');
//Recording an Event
CleverTap.recordChargedEvent(
{totalValue: 20, category: 'books', purchase_date: new Date()},
[
{
title: 'book1',
published_date: new Date('2010-12-12T06:35:31'),
author: 'ABC',
},
{title: 'book2', published_date: new Date('2000-12-12T06:35:31')},
{title: 'book3', published_date: new Date(), author: 'XYZ'},
],