reactnative-plugin-appice 1.7.14 → 1.7.16

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