reactnative-plugin-appice 1.7.13 → 1.7.14

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