reactnative-plugin-appice 1.7.27 → 1.7.28

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.
Files changed (106) hide show
  1. package/README.md +37 -37
  2. package/android/README.md +14 -14
  3. package/android/build.gradle +158 -158
  4. package/android/gitignore +47 -47
  5. package/android/gradle/wrapper/gradle-wrapper.properties +5 -5
  6. package/android/gradlew +234 -234
  7. package/android/local.properties +8 -8
  8. package/android/src/main/AndroidManifest.xml +164 -138
  9. package/android/src/main/java/com/reactlibrary/AppICEUtils.java +274 -274
  10. package/android/src/main/java/com/reactlibrary/AppIceReactPluginModule.java +778 -778
  11. package/android/src/main/java/com/reactlibrary/AppIceReactPluginPackage.java +28 -28
  12. package/android/src/main/java/com/reactlibrary/CampaignCampsReceiver.java +56 -56
  13. package/android/src/main/java/com/reactlibrary/EnumConstants.java +282 -282
  14. package/android/src/main/java/com/reactlibrary/NotificationEventService.java +59 -59
  15. package/android/src/main/java/com/reactlibrary/StringConstants.java +24 -24
  16. package/campaign.js +25 -25
  17. package/example/App.js +332 -332
  18. package/example/Gemfile +6 -6
  19. package/example/PageA.tsx +15 -15
  20. package/example/__tests__/App-test.js +14 -14
  21. package/example/ancilliary.js +486 -486
  22. package/example/android/.gradle/7.3.3/checksums/checksums.lock +0 -0
  23. package/example/android/.gradle/7.3.3/fileChanges/last-build.bin +0 -0
  24. package/example/android/.gradle/7.3.3/fileHashes/fileHashes.lock +0 -0
  25. package/example/android/.gradle/7.3.3/gc.properties +0 -0
  26. package/example/android/.gradle/vcs-1/gc.properties +0 -0
  27. package/example/android/app/_BUCK +55 -55
  28. package/example/android/app/build.gradle +320 -320
  29. package/example/android/app/build_defs.bzl +19 -19
  30. package/example/android/app/proguard-rules.pro +10 -10
  31. package/example/android/app/src/debug/AndroidManifest.xml +13 -13
  32. package/example/android/app/src/debug/java/com/example/ReactNativeFlipper.java +73 -73
  33. package/example/android/app/src/main/AndroidManifest.xml +72 -72
  34. package/example/android/app/src/main/java/com/example/MainActivity.java +48 -48
  35. package/example/android/app/src/main/java/com/example/MainApplication.java +91 -91
  36. package/example/android/app/src/main/java/com/example/newarchitecture/MainApplicationReactNativeHost.java +116 -116
  37. package/example/android/app/src/main/java/com/example/newarchitecture/components/MainComponentsRegistry.java +36 -36
  38. package/example/android/app/src/main/java/com/example/newarchitecture/modules/MainApplicationTurboModuleManagerDelegate.java +48 -48
  39. package/example/android/app/src/main/jni/Android.mk +48 -48
  40. package/example/android/app/src/main/jni/MainApplicationModuleProvider.cpp +24 -24
  41. package/example/android/app/src/main/jni/MainApplicationModuleProvider.h +16 -16
  42. package/example/android/app/src/main/jni/MainApplicationTurboModuleManagerDelegate.cpp +45 -45
  43. package/example/android/app/src/main/jni/MainApplicationTurboModuleManagerDelegate.h +38 -38
  44. package/example/android/app/src/main/jni/MainComponentsRegistry.cpp +61 -61
  45. package/example/android/app/src/main/jni/MainComponentsRegistry.h +32 -32
  46. package/example/android/app/src/main/jni/OnLoad.cpp +11 -11
  47. package/example/android/app/src/main/res/drawable/rn_edit_text_material.xml +36 -36
  48. package/example/android/app/src/main/res/values/strings.xml +3 -3
  49. package/example/android/app/src/main/res/values/styles.xml +9 -9
  50. package/example/android/build.gradle +73 -73
  51. package/example/android/gradle/wrapper/gradle-wrapper.properties +5 -5
  52. package/example/android/gradle.properties +40 -40
  53. package/example/android/gradlew +234 -234
  54. package/example/android/settings.gradle +11 -11
  55. package/example/app.json +3 -3
  56. package/example/babel.config.js +3 -3
  57. package/example/index.js +9 -9
  58. package/example/ios/Podfile +44 -44
  59. package/example/ios/Podfile.lock +561 -561
  60. package/example/ios/_xcode.env +11 -11
  61. package/example/ios/example/AppDelegate.h +8 -8
  62. package/example/ios/example/AppDelegate.mm +174 -174
  63. package/example/ios/example/Images.xcassets/AppIcon.appiconset/Contents.json +53 -53
  64. package/example/ios/example/Images.xcassets/Contents.json +6 -6
  65. package/example/ios/example/Info.plist +62 -62
  66. package/example/ios/example/LaunchScreen.storyboard +47 -47
  67. package/example/ios/example/example.entitlements +8 -8
  68. package/example/ios/example/main.m +10 -10
  69. package/example/ios/example.xcodeproj/project.pbxproj +712 -712
  70. package/example/ios/example.xcodeproj/xcshareddata/xcschemes/example.xcscheme +88 -88
  71. package/example/ios/example.xcworkspace/contents.xcworkspacedata +10 -10
  72. package/example/ios/example.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +8 -8
  73. package/example/ios/exampleTests/Info.plist +24 -24
  74. package/example/ios/exampleTests/exampleTests.m +66 -66
  75. package/example/metro.config.js +17 -17
  76. package/example/package.json +36 -36
  77. package/example/yarn.lock +7176 -7176
  78. package/index.js +590 -590
  79. package/ios/AppICEReactEvent.h +23 -23
  80. package/ios/AppICEReactEvent.m +86 -86
  81. package/ios/AppIceReactPlugin.h +65 -65
  82. package/ios/AppIceReactPlugin.m +683 -683
  83. package/ios/AppIceReactPlugin.xcodeproj/project.pbxproj +364 -364
  84. package/ios/AppIceReactPlugin.xcodeproj/project.xcworkspace/contents.xcworkspacedata +4 -4
  85. package/ios/AppIceReactPlugin.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +8 -8
  86. package/ios/AppIceReactPlugin.xcodeproj/xcuserdata/Adi.xcuserdatad/xcschemes/xcschememanagement.plist +14 -14
  87. package/ios/AppIceReactPlugin.xcodeproj/xcuserdata/artherajesh.xcuserdatad/xcschemes/xcschememanagement.plist +14 -14
  88. package/ios/AppIceReactPlugin.xcworkspace/contents.xcworkspacedata +10 -10
  89. package/ios/AppIceReactPlugin.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +8 -8
  90. package/ios/Podfile +10 -10
  91. package/ios/Podfile.lock +3 -3
  92. package/ios/Pods/Manifest.lock +3 -3
  93. package/ios/Pods/Pods.xcodeproj/project.pbxproj +395 -395
  94. package/ios/Pods/Pods.xcodeproj/xcuserdata/Adi.xcuserdatad/xcschemes/Pods-AppIceReactPlugin.xcscheme +58 -58
  95. package/ios/Pods/Pods.xcodeproj/xcuserdata/Adi.xcuserdatad/xcschemes/xcschememanagement.plist +18 -18
  96. package/ios/Pods/Pods.xcodeproj/xcuserdata/artherajesh.xcuserdatad/xcschemes/xcschememanagement.plist +14 -14
  97. package/ios/Pods/Target Support Files/Pods-AppIceReactPlugin/Pods-AppIceReactPlugin-Info.plist +26 -26
  98. package/ios/Pods/Target Support Files/Pods-AppIceReactPlugin/Pods-AppIceReactPlugin-acknowledgements.markdown +3 -3
  99. package/ios/Pods/Target Support Files/Pods-AppIceReactPlugin/Pods-AppIceReactPlugin-acknowledgements.plist +29 -29
  100. package/ios/Pods/Target Support Files/Pods-AppIceReactPlugin/Pods-AppIceReactPlugin-dummy.m +5 -5
  101. package/ios/Pods/Target Support Files/Pods-AppIceReactPlugin/Pods-AppIceReactPlugin-umbrella.h +16 -16
  102. package/ios/Pods/Target Support Files/Pods-AppIceReactPlugin/Pods-AppIceReactPlugin.debug.xcconfig +6 -6
  103. package/ios/Pods/Target Support Files/Pods-AppIceReactPlugin/Pods-AppIceReactPlugin.modulemap +6 -6
  104. package/ios/Pods/Target Support Files/Pods-AppIceReactPlugin/Pods-AppIceReactPlugin.release.xcconfig +6 -6
  105. package/package.json +9 -6
  106. package/reactnative-plugin-appice.podspec +30 -30
package/example/App.js CHANGED
@@ -1,332 +1,332 @@
1
- /**
2
- * Sample React Native App
3
- * https://github.com/facebook/react-native
4
- *
5
- * @format
6
- * @flow strict-local
7
- */
8
-
9
- import React from 'react';
10
- import { Alert,
11
- Text,
12
- Button,
13
- View,
14
- AppState
15
- } from 'react-native';
16
- // Define a type for the props parameter
17
- type EventProps = {
18
- [key: string]: string; // all values are strings
19
- };
20
- import { getInboxMessages, getMessageCounts, setUser, updatedInboxMessage } from './ancilliary';
21
- import { handleUrl,receiveDeepLink } from './offerIdhandler';
22
- const AppICE = require('reactnative-plugin-appice');
23
- const HelloWorldApp = () => {
24
-
25
-
26
-
27
- const certs: never[] = [];
28
- if (AppICE) {
29
- console.log('AppICE is available');
30
- AppICE.preInitialise();
31
- console.log('preInitialize completed');
32
-
33
- AppICE.startContext( //keys here
34
- "",
35
- "",
36
- "",
37
- "",
38
- "",
39
- "",
40
- certs
41
- );
42
-
43
- addAppICEAPIListeners();
44
-
45
- AppState.addEventListener('change', (nextAppState) => {
46
- if (nextAppState === 'active') {
47
- AppICE.registerLifeCycle()
48
-
49
- AppICE.isDeviceReady(true);
50
- }
51
- });
52
-
53
- }
54
-
55
-
56
-
57
-
58
-
59
- return (
60
- <View
61
- style={{
62
- flex: 1,
63
- justifyContent: 'center',
64
- alignItems: 'center',
65
- marginBottom: 10,
66
- }}>
67
- <Text>AppICE React Demo</Text>
68
- <Button onPress={sendEvent} title="Send Event" color="#841584" />
69
- <Button onPress={setSampleUserID} title="setUserID" color="#841584" />
70
- <Button onPress={getUserId} title="getUserId" color="#841584" />
71
- <Button onPress={setUserProfile} title="setUserProfile" color="#841584" />
72
- <Button onPress={getUser} title="getUserProfile" color="#841584" />
73
- <Button onPress={setLanguage} title="set Custom Variable" color="#841584" />
74
- <Button onPress={getInboxMessage} title="getInboxMessage" color="#841584" />
75
- <Button onPress={getInboxMessageForId} title="getInboxMessageForId" color="#841584" />
76
- <Button onPress={getMessageCount} title="getMessageCount" color="#841584" />
77
- <Button onPress={updateInboxMessage} title="updateInbox" color="#841584" />
78
- <Button onPress={synchronizeInbox} title="synchronizeInbox" color="#841584" />
79
- <Button onPress={getUserDetails} title="getUserDetails" color="#841584" />
80
- <Button onPress={getUserData} title="getUserData" color="#841584" />
81
- <Button onPress={getCampaignById} title="getCampaignById" color="#841584" />
82
- <Button onPress={getCampaigns} title="getCampaigns" color="#841584" />
83
-
84
- </View>
85
- );
86
-
87
- }
88
-
89
-
90
- function addAppICEAPIListeners() {
91
- AppICE.addListener(
92
- AppICE.AppICEPushNotificationClicked,
93
- (event: {AppICEPushNotificationClicked: any}) => {
94
- if (typeof event !== 'undefined') {
95
- console.log(
96
- 'handleAppICETapEvent',
97
- AppICE.AppICEPushNotificationClicked,
98
- event.AppICEPushNotificationClicked,
99
- );
100
- AppICE.pushNotificationClicked(event.AppICEPushNotificationClicked);
101
- }
102
- },
103
- );
104
-
105
- AppICE.addListener(
106
- AppICE.AppICEInAppClicked,
107
- (event: {AppICEInAppClicked: any}) => {
108
- if (typeof event !== 'undefined') {
109
- console.log('event AppICEInAppClicked: ' + event);
110
- console.log(
111
- 'event is from AppICEInAppClicked is ' + event.AppICEInAppClicked,
112
- );
113
- console.log('handleAppICETapEvent', AppICE.AppICEInAppClicked);
114
-
115
- callbackInApp(event.AppICEInAppClicked);
116
- }
117
- },
118
- );
119
- }
120
-
121
-
122
- const sendEvent = () => {
123
- console.log('inside sendEvent');
124
- var dataObj = {
125
- ClickedMenuBtn: 'false',
126
- CLickedSubmitBtn: 'false',
127
- AppName: 'ReactSampleApp',
128
- };
129
- AppICE.tagEvent('ReactSampleApp', dataObj);
130
- };
131
-
132
- const setUserProfile = () => {
133
- const userProfile = {
134
- name: 'Rahul K',
135
- dob: '09091992',
136
- age:'1992',
137
- email: 'testemail@sample.com',
138
- phone: '9000900006',
139
- gender: 'M',
140
- educationType: '12th',
141
- employmentType: 'full time',
142
- married: true,
143
- isEmployed: true,
144
- };
145
- setUser(userProfile);
146
- };
147
-
148
- const setSampleUserID = () => {
149
- AppICE.setUserId(['181166344']);
150
- };
151
-
152
- const getUserId = () => {
153
- AppICE.getUserId((userIds: any[]) => {
154
- console.log('User IDs:', userIds);
155
- const inboxMessageString = JSON.stringify(userIds, null, 2);
156
-
157
- Alert.alert(`getInboxMessageForId: \n ${inboxMessageString}`);
158
- });
159
- };
160
-
161
- const setLanguage = () => {
162
- AppICE.setCustomVariable('_lang', 'ar-AE');
163
- };
164
-
165
- const getUserDetails = () => {
166
- console.log('GET USER Details:');
167
- AppICE.getUser((user: any) => {
168
- const inboxMessageString = JSON.stringify(user);
169
- console.log('GET USER Details:' + inboxMessageString);
170
- });
171
- };
172
- const getUser = () => {
173
- console.log('GET USER:');
174
-
175
- const userData = AppICE.getUser((res: any) => {
176
- if (res) {
177
- var response;
178
- const resData = JSON.stringify(res);
179
- console.log('res ' + resData);
180
-
181
- const data = JSON.parse(resData);
182
- response = data;
183
-
184
- const customProperties = response[AppICE.DEMOGRAPHIC_INFO];
185
- console.log('customProperties ' + customProperties);
186
- }
187
- });
188
- };
189
-
190
- function callbackInApp(payload: any) {
191
- console.log('Call BAck payload:', payload);
192
-
193
- if (payload) {
194
- const screen = JSON.parse(payload);
195
- console.log('Call BAck Screen:', screen);
196
- }
197
- }
198
-
199
- const getInboxMessage = () => {
200
- console.log('Call getInboxMessage');
201
- const userId = ['181166344'];
202
- getInboxMessages(1, userId, 'Alerts', 10, 0, 10, false, (result: any) => {
203
- console.log('Inbox data set: ', result);
204
- Alert.alert(`Inbox Data: \n ${result}`);
205
- });
206
- };
207
-
208
- const getMessageCount = () => {
209
- const userId = ['181166344'];
210
- const count = getMessageCounts(1, userId, 10, (result: number) => {
211
- Alert.alert(`getMessageCounts count : \n ${result}`);
212
- console.log(count);
213
- });
214
- };
215
-
216
-
217
- const getInboxMessageForId = () => {
218
- console.log('call getInboxMessageForId Entry:');
219
- const messageId = '1715782030369-3894c943-b47d-456c-b530-7c2eb8820af4';
220
- const useIds = '181166344';
221
-
222
- AppICE.getInboxMessageForId(messageId, useIds, (inboxMessage: any) => {
223
- console.log('getInboxMessageForId in JS:', inboxMessage);
224
- });
225
- };
226
-
227
- const updateInboxMessage = () => {
228
- const messageId = '1715782030369-3894c943-b47d-456c-b530-7c2eb8820af4';
229
- updatedInboxMessage(messageId, 3, '181166344', (result: boolean) => {
230
- Alert.alert("Update Inbox Result : "+result
231
- );
232
- });
233
- };
234
-
235
-
236
- const synchronizeInbox = () => {
237
- AppICE.synchronizeInbox(10, (success: boolean) => {
238
- console.log('Inbox synchronization success:', success);
239
- const useIds = ['181166344'];
240
- AppICE.getInboxMessages(1, useIds, (inboxMessages: any[]) => {
241
- console.log('Inbox Messages:', inboxMessages);
242
- });
243
- });
244
- };
245
-
246
- const getUserData = () => {
247
- AppICE.synchronizeData(100, (success: boolean) => {
248
- console.log('Profile synchronizeData success:', success);
249
- Alert.alert(`synchronizeData: \n ${success}`);
250
- const userIds = ['181166344'];
251
- AppICE.getUserForIds(userIds, (res: any) => {
252
- console.log('Receive getUser:', res);
253
- Alert.alert('Receive getUser Alert:' + JSON.stringify(res));
254
- for (var index = 0; index < res.length; index++) {
255
- let userData = res[index];
256
- console.log('Received Inbox:', userData);
257
- const name = userData[AppICE.name];
258
- const phone = userData[AppICE.phone];
259
- const gender = userData[AppICE.gender];
260
- const dob = userData[AppICE.dob];
261
- const edt = userData[AppICE.educationType];
262
- const email = userData[AppICE.email];
263
- const employment = userData[AppICE.employmentType];
264
- const age = userData[AppICE.age];
265
- const marriage = userData[AppICE.married];
266
- const isEmployed = userData[AppICE.isEmployed];
267
-
268
- console.log('GetUser Name:', name);
269
- console.log('GetUser PHONE:', phone);
270
- console.log('GetUser gender:', gender);
271
- console.log('GetUser dob:', dob);
272
- console.log('GetUser edt:', edt);
273
- console.log('GetUser email:', email);
274
- console.log('GetUser employment:', employment);
275
- console.log('GetUser age:', age);
276
- console.log('GetUser marriage:', marriage);
277
- console.log('GetUser ISEMPLOYED:', isEmployed);
278
-
279
- const customProperties = userData[AppICE.DEMOGRAPHIC_INFO];
280
- const customPropertiesObj = JSON.parse(customProperties);
281
- console.log(
282
- 'customPropertiesObj ' + JSON.stringify(customPropertiesObj),
283
- );
284
-
285
- console.log(
286
- 'user Profile, top_n_product_viewed = ' +
287
- customPropertiesObj[AppICE.TOP_N_PRODUCTS_VIEWED],
288
- );
289
- }
290
- });
291
- });
292
- };
293
-
294
- const cacheOrFlushEvent = (event, segment, flush ) => {
295
- AppICE.tagEvent(event, segment, flush)
296
- }
297
-
298
- // getCampaigns
299
-
300
- const getCampaigns = () => {
301
-
302
- const type = AppICE.CampaignType.NATIVE;
303
-
304
- AppICE.getCampaigns(type, (campaigns: any[]) => {
305
- console.log('Campaigns:', campaigns);
306
-
307
- campaigns.forEach((campaign) => {
308
-
309
- console.log('getCampaigns of Campaign ID:', campaign.getCampaignId());
310
- console.log('Action URL is :', campaign.getActionUrl());
311
- console.log('Action Type is :', campaign.getActionType());
312
- console.log('Custom Data is :', campaign.getCustomData());
313
-
314
- });
315
- });
316
- };
317
-
318
- const getCampaignById = () => {
319
-
320
- const cmpId = '1234';
321
- AppICE.getCampaignById(cmpId, (campaign: any) => {
322
-
323
- console.log('getCampaignById of Campaign ID:', campaign.getCampaignId());
324
- console.log('Action URL is :', campaign.getActionUrl());
325
- console.log('Action Type is :', campaign.getActionType());
326
- console.log('Custom Data is :', campaign.getCustomData());
327
-
328
- });
329
- };
330
-
331
-
332
- export default HelloWorldApp;
1
+ /**
2
+ * Sample React Native App
3
+ * https://github.com/facebook/react-native
4
+ *
5
+ * @format
6
+ * @flow strict-local
7
+ */
8
+
9
+ import React from 'react';
10
+ import { Alert,
11
+ Text,
12
+ Button,
13
+ View,
14
+ AppState
15
+ } from 'react-native';
16
+ // Define a type for the props parameter
17
+ type EventProps = {
18
+ [key: string]: string; // all values are strings
19
+ };
20
+ import { getInboxMessages, getMessageCounts, setUser, updatedInboxMessage } from './ancilliary';
21
+ import { handleUrl,receiveDeepLink } from './offerIdhandler';
22
+ const AppICE = require('reactnative-plugin-appice');
23
+ const HelloWorldApp = () => {
24
+
25
+
26
+
27
+ const certs: never[] = [];
28
+ if (AppICE) {
29
+ console.log('AppICE is available');
30
+ AppICE.preInitialise();
31
+ console.log('preInitialize completed');
32
+
33
+ AppICE.startContext( //keys here
34
+ "",
35
+ "",
36
+ "",
37
+ "",
38
+ "",
39
+ "",
40
+ certs
41
+ );
42
+
43
+ addAppICEAPIListeners();
44
+
45
+ AppState.addEventListener('change', (nextAppState) => {
46
+ if (nextAppState === 'active') {
47
+ AppICE.registerLifeCycle()
48
+
49
+ AppICE.isDeviceReady(true);
50
+ }
51
+ });
52
+
53
+ }
54
+
55
+
56
+
57
+
58
+
59
+ return (
60
+ <View
61
+ style={{
62
+ flex: 1,
63
+ justifyContent: 'center',
64
+ alignItems: 'center',
65
+ marginBottom: 10,
66
+ }}>
67
+ <Text>AppICE React Demo</Text>
68
+ <Button onPress={sendEvent} title="Send Event" color="#841584" />
69
+ <Button onPress={setSampleUserID} title="setUserID" color="#841584" />
70
+ <Button onPress={getUserId} title="getUserId" color="#841584" />
71
+ <Button onPress={setUserProfile} title="setUserProfile" color="#841584" />
72
+ <Button onPress={getUser} title="getUserProfile" color="#841584" />
73
+ <Button onPress={setLanguage} title="set Custom Variable" color="#841584" />
74
+ <Button onPress={getInboxMessage} title="getInboxMessage" color="#841584" />
75
+ <Button onPress={getInboxMessageForId} title="getInboxMessageForId" color="#841584" />
76
+ <Button onPress={getMessageCount} title="getMessageCount" color="#841584" />
77
+ <Button onPress={updateInboxMessage} title="updateInbox" color="#841584" />
78
+ <Button onPress={synchronizeInbox} title="synchronizeInbox" color="#841584" />
79
+ <Button onPress={getUserDetails} title="getUserDetails" color="#841584" />
80
+ <Button onPress={getUserData} title="getUserData" color="#841584" />
81
+ <Button onPress={getCampaignById} title="getCampaignById" color="#841584" />
82
+ <Button onPress={getCampaigns} title="getCampaigns" color="#841584" />
83
+
84
+ </View>
85
+ );
86
+
87
+ }
88
+
89
+
90
+ function addAppICEAPIListeners() {
91
+ AppICE.addListener(
92
+ AppICE.AppICEPushNotificationClicked,
93
+ (event: {AppICEPushNotificationClicked: any}) => {
94
+ if (typeof event !== 'undefined') {
95
+ console.log(
96
+ 'handleAppICETapEvent',
97
+ AppICE.AppICEPushNotificationClicked,
98
+ event.AppICEPushNotificationClicked,
99
+ );
100
+ AppICE.pushNotificationClicked(event.AppICEPushNotificationClicked);
101
+ }
102
+ },
103
+ );
104
+
105
+ AppICE.addListener(
106
+ AppICE.AppICEInAppClicked,
107
+ (event: {AppICEInAppClicked: any}) => {
108
+ if (typeof event !== 'undefined') {
109
+ console.log('event AppICEInAppClicked: ' + event);
110
+ console.log(
111
+ 'event is from AppICEInAppClicked is ' + event.AppICEInAppClicked,
112
+ );
113
+ console.log('handleAppICETapEvent', AppICE.AppICEInAppClicked);
114
+
115
+ callbackInApp(event.AppICEInAppClicked);
116
+ }
117
+ },
118
+ );
119
+ }
120
+
121
+
122
+ const sendEvent = () => {
123
+ console.log('inside sendEvent');
124
+ var dataObj = {
125
+ ClickedMenuBtn: 'false',
126
+ CLickedSubmitBtn: 'false',
127
+ AppName: 'ReactSampleApp',
128
+ };
129
+ AppICE.tagEvent('ReactSampleApp', dataObj);
130
+ };
131
+
132
+ const setUserProfile = () => {
133
+ const userProfile = {
134
+ name: 'Rahul K',
135
+ dob: '09091992',
136
+ age:'1992',
137
+ email: 'testemail@sample.com',
138
+ phone: '9000900006',
139
+ gender: 'M',
140
+ educationType: '12th',
141
+ employmentType: 'full time',
142
+ married: true,
143
+ isEmployed: true,
144
+ };
145
+ setUser(userProfile);
146
+ };
147
+
148
+ const setSampleUserID = () => {
149
+ AppICE.setUserId(['181166344']);
150
+ };
151
+
152
+ const getUserId = () => {
153
+ AppICE.getUserId((userIds: any[]) => {
154
+ console.log('User IDs:', userIds);
155
+ const inboxMessageString = JSON.stringify(userIds, null, 2);
156
+
157
+ Alert.alert(`getInboxMessageForId: \n ${inboxMessageString}`);
158
+ });
159
+ };
160
+
161
+ const setLanguage = () => {
162
+ AppICE.setCustomVariable('_lang', 'ar-AE');
163
+ };
164
+
165
+ const getUserDetails = () => {
166
+ console.log('GET USER Details:');
167
+ AppICE.getUser((user: any) => {
168
+ const inboxMessageString = JSON.stringify(user);
169
+ console.log('GET USER Details:' + inboxMessageString);
170
+ });
171
+ };
172
+ const getUser = () => {
173
+ console.log('GET USER:');
174
+
175
+ const userData = AppICE.getUser((res: any) => {
176
+ if (res) {
177
+ var response;
178
+ const resData = JSON.stringify(res);
179
+ console.log('res ' + resData);
180
+
181
+ const data = JSON.parse(resData);
182
+ response = data;
183
+
184
+ const customProperties = response[AppICE.DEMOGRAPHIC_INFO];
185
+ console.log('customProperties ' + customProperties);
186
+ }
187
+ });
188
+ };
189
+
190
+ function callbackInApp(payload: any) {
191
+ console.log('Call BAck payload:', payload);
192
+
193
+ if (payload) {
194
+ const screen = JSON.parse(payload);
195
+ console.log('Call BAck Screen:', screen);
196
+ }
197
+ }
198
+
199
+ const getInboxMessage = () => {
200
+ console.log('Call getInboxMessage');
201
+ const userId = ['181166344'];
202
+ getInboxMessages(1, userId, 'Alerts', 10, 0, 10, false, (result: any) => {
203
+ console.log('Inbox data set: ', result);
204
+ Alert.alert(`Inbox Data: \n ${result}`);
205
+ });
206
+ };
207
+
208
+ const getMessageCount = () => {
209
+ const userId = ['181166344'];
210
+ const count = getMessageCounts(1, userId, 10, (result: number) => {
211
+ Alert.alert(`getMessageCounts count : \n ${result}`);
212
+ console.log(count);
213
+ });
214
+ };
215
+
216
+
217
+ const getInboxMessageForId = () => {
218
+ console.log('call getInboxMessageForId Entry:');
219
+ const messageId = '1715782030369-3894c943-b47d-456c-b530-7c2eb8820af4';
220
+ const useIds = '181166344';
221
+
222
+ AppICE.getInboxMessageForId(messageId, useIds, (inboxMessage: any) => {
223
+ console.log('getInboxMessageForId in JS:', inboxMessage);
224
+ });
225
+ };
226
+
227
+ const updateInboxMessage = () => {
228
+ const messageId = '1715782030369-3894c943-b47d-456c-b530-7c2eb8820af4';
229
+ updatedInboxMessage(messageId, 3, '181166344', (result: boolean) => {
230
+ Alert.alert("Update Inbox Result : "+result
231
+ );
232
+ });
233
+ };
234
+
235
+
236
+ const synchronizeInbox = () => {
237
+ AppICE.synchronizeInbox(10, (success: boolean) => {
238
+ console.log('Inbox synchronization success:', success);
239
+ const useIds = ['181166344'];
240
+ AppICE.getInboxMessages(1, useIds, (inboxMessages: any[]) => {
241
+ console.log('Inbox Messages:', inboxMessages);
242
+ });
243
+ });
244
+ };
245
+
246
+ const getUserData = () => {
247
+ AppICE.synchronizeData(100, (success: boolean) => {
248
+ console.log('Profile synchronizeData success:', success);
249
+ Alert.alert(`synchronizeData: \n ${success}`);
250
+ const userIds = ['181166344'];
251
+ AppICE.getUserForIds(userIds, (res: any) => {
252
+ console.log('Receive getUser:', res);
253
+ Alert.alert('Receive getUser Alert:' + JSON.stringify(res));
254
+ for (var index = 0; index < res.length; index++) {
255
+ let userData = res[index];
256
+ console.log('Received Inbox:', userData);
257
+ const name = userData[AppICE.name];
258
+ const phone = userData[AppICE.phone];
259
+ const gender = userData[AppICE.gender];
260
+ const dob = userData[AppICE.dob];
261
+ const edt = userData[AppICE.educationType];
262
+ const email = userData[AppICE.email];
263
+ const employment = userData[AppICE.employmentType];
264
+ const age = userData[AppICE.age];
265
+ const marriage = userData[AppICE.married];
266
+ const isEmployed = userData[AppICE.isEmployed];
267
+
268
+ console.log('GetUser Name:', name);
269
+ console.log('GetUser PHONE:', phone);
270
+ console.log('GetUser gender:', gender);
271
+ console.log('GetUser dob:', dob);
272
+ console.log('GetUser edt:', edt);
273
+ console.log('GetUser email:', email);
274
+ console.log('GetUser employment:', employment);
275
+ console.log('GetUser age:', age);
276
+ console.log('GetUser marriage:', marriage);
277
+ console.log('GetUser ISEMPLOYED:', isEmployed);
278
+
279
+ const customProperties = userData[AppICE.DEMOGRAPHIC_INFO];
280
+ const customPropertiesObj = JSON.parse(customProperties);
281
+ console.log(
282
+ 'customPropertiesObj ' + JSON.stringify(customPropertiesObj),
283
+ );
284
+
285
+ console.log(
286
+ 'user Profile, top_n_product_viewed = ' +
287
+ customPropertiesObj[AppICE.TOP_N_PRODUCTS_VIEWED],
288
+ );
289
+ }
290
+ });
291
+ });
292
+ };
293
+
294
+ const cacheOrFlushEvent = (event, segment, flush ) => {
295
+ AppICE.tagEvent(event, segment, flush)
296
+ }
297
+
298
+ // getCampaigns
299
+
300
+ const getCampaigns = () => {
301
+
302
+ const type = AppICE.CampaignType.NATIVE;
303
+
304
+ AppICE.getCampaigns(type, (campaigns: any[]) => {
305
+ console.log('Campaigns:', campaigns);
306
+
307
+ campaigns.forEach((campaign) => {
308
+
309
+ console.log('getCampaigns of Campaign ID:', campaign.getCampaignId());
310
+ console.log('Action URL is :', campaign.getActionUrl());
311
+ console.log('Action Type is :', campaign.getActionType());
312
+ console.log('Custom Data is :', campaign.getCustomData());
313
+
314
+ });
315
+ });
316
+ };
317
+
318
+ const getCampaignById = () => {
319
+
320
+ const cmpId = '1234';
321
+ AppICE.getCampaignById(cmpId, (campaign: any) => {
322
+
323
+ console.log('getCampaignById of Campaign ID:', campaign.getCampaignId());
324
+ console.log('Action URL is :', campaign.getActionUrl());
325
+ console.log('Action Type is :', campaign.getActionType());
326
+ console.log('Custom Data is :', campaign.getCustomData());
327
+
328
+ });
329
+ };
330
+
331
+
332
+ export default HelloWorldApp;
package/example/Gemfile CHANGED
@@ -1,6 +1,6 @@
1
- source 'https://rubygems.org'
2
-
3
- # You may use http://rbenv.org/ or https://rvm.io/ to install and use this version
4
- ruby '2.7.5'
5
-
6
- gem 'cocoapods', '~> 1.11', '>= 1.11.2'
1
+ source 'https://rubygems.org'
2
+
3
+ # You may use http://rbenv.org/ or https://rvm.io/ to install and use this version
4
+ ruby '2.7.5'
5
+
6
+ gem 'cocoapods', '~> 1.11', '>= 1.11.2'