reactnative-plugin-appice 1.7.8 → 1.7.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +37 -37
- package/android/README.md +14 -14
- package/android/build.gradle +151 -151
- package/android/gitignore +47 -47
- package/android/gradle/wrapper/gradle-wrapper.properties +5 -5
- package/android/gradlew +234 -234
- package/android/local.properties +8 -8
- package/android/src/main/AndroidManifest.xml +154 -154
- package/android/src/main/java/com/reactlibrary/AppICEUtils.java +241 -241
- package/android/src/main/java/com/reactlibrary/AppIceReactPluginModule.java +748 -748
- package/android/src/main/java/com/reactlibrary/AppIceReactPluginPackage.java +28 -28
- package/android/src/main/java/com/reactlibrary/CampaignCampsReceiver.java +56 -56
- package/android/src/main/java/com/reactlibrary/EnumConstants.java +256 -256
- package/android/src/main/java/com/reactlibrary/NotificationEventService.java +59 -59
- package/android/src/main/java/com/reactlibrary/StringConstants.java +9 -9
- package/example/App.js +660 -660
- package/example/Gemfile +6 -6
- package/example/__tests__/App-test.js +14 -14
- package/example/android/app/_BUCK +55 -55
- package/example/android/app/build.gradle +320 -320
- package/example/android/app/build_defs.bzl +19 -19
- package/example/android/app/proguard-rules.pro +10 -10
- package/example/android/app/src/debug/AndroidManifest.xml +13 -13
- package/example/android/app/src/debug/java/com/example/ReactNativeFlipper.java +73 -73
- package/example/android/app/src/main/AndroidManifest.xml +72 -72
- package/example/android/app/src/main/java/com/example/MainActivity.java +48 -48
- package/example/android/app/src/main/java/com/example/MainApplication.java +91 -91
- package/example/android/app/src/main/java/com/example/newarchitecture/MainApplicationReactNativeHost.java +116 -116
- package/example/android/app/src/main/java/com/example/newarchitecture/components/MainComponentsRegistry.java +36 -36
- package/example/android/app/src/main/java/com/example/newarchitecture/modules/MainApplicationTurboModuleManagerDelegate.java +48 -48
- package/example/android/app/src/main/jni/Android.mk +48 -48
- package/example/android/app/src/main/jni/MainApplicationModuleProvider.cpp +24 -24
- package/example/android/app/src/main/jni/MainApplicationModuleProvider.h +16 -16
- package/example/android/app/src/main/jni/MainApplicationTurboModuleManagerDelegate.cpp +45 -45
- package/example/android/app/src/main/jni/MainApplicationTurboModuleManagerDelegate.h +38 -38
- package/example/android/app/src/main/jni/MainComponentsRegistry.cpp +61 -61
- package/example/android/app/src/main/jni/MainComponentsRegistry.h +32 -32
- package/example/android/app/src/main/jni/OnLoad.cpp +11 -11
- package/example/android/app/src/main/res/drawable/rn_edit_text_material.xml +36 -36
- package/example/android/app/src/main/res/values/strings.xml +3 -3
- package/example/android/app/src/main/res/values/styles.xml +9 -9
- package/example/android/build.gradle +73 -73
- package/example/android/gradle/wrapper/gradle-wrapper.properties +5 -5
- package/example/android/gradle.properties +40 -40
- package/example/android/gradlew +234 -234
- package/example/android/settings.gradle +11 -11
- package/example/app.json +3 -3
- package/example/babel.config.js +3 -3
- package/example/index.js +9 -9
- package/example/ios/Podfile +44 -44
- package/example/ios/Podfile.lock +561 -561
- package/example/ios/_xcode.env +11 -11
- package/example/ios/example/AppDelegate.h +8 -8
- package/example/ios/example/AppDelegate.mm +174 -174
- package/example/ios/example/Images.xcassets/AppIcon.appiconset/Contents.json +53 -53
- package/example/ios/example/Images.xcassets/Contents.json +6 -6
- package/example/ios/example/Info.plist +62 -62
- package/example/ios/example/LaunchScreen.storyboard +47 -47
- package/example/ios/example/example.entitlements +8 -8
- package/example/ios/example/main.m +10 -10
- package/example/ios/example.xcodeproj/project.pbxproj +712 -712
- package/example/ios/example.xcodeproj/xcshareddata/xcschemes/example.xcscheme +88 -88
- package/example/ios/example.xcworkspace/contents.xcworkspacedata +10 -10
- package/example/ios/example.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +8 -8
- package/example/ios/exampleTests/Info.plist +24 -24
- package/example/ios/exampleTests/exampleTests.m +66 -66
- package/example/metro.config.js +17 -17
- package/example/package.json +34 -34
- package/example/yarn.lock +7176 -7176
- package/index.js +401 -401
- package/ios/AppICEReactEvent.h +23 -23
- package/ios/AppICEReactEvent.m +86 -86
- package/ios/AppIceReactPlugin.h +59 -59
- package/ios/AppIceReactPlugin.m +641 -641
- package/ios/AppIceReactPlugin.xcodeproj/project.pbxproj +364 -364
- package/ios/AppIceReactPlugin.xcodeproj/project.xcworkspace/contents.xcworkspacedata +4 -4
- package/ios/AppIceReactPlugin.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +8 -8
- package/ios/AppIceReactPlugin.xcodeproj/xcuserdata/Adi.xcuserdatad/xcschemes/xcschememanagement.plist +14 -14
- package/ios/AppIceReactPlugin.xcodeproj/xcuserdata/artherajesh.xcuserdatad/xcschemes/xcschememanagement.plist +14 -14
- package/ios/AppIceReactPlugin.xcworkspace/contents.xcworkspacedata +10 -10
- package/ios/AppIceReactPlugin.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +8 -8
- package/ios/Podfile +10 -10
- package/ios/Podfile.lock +3 -3
- package/ios/Pods/Manifest.lock +3 -3
- package/ios/Pods/Pods.xcodeproj/project.pbxproj +395 -395
- package/ios/Pods/Pods.xcodeproj/xcuserdata/Adi.xcuserdatad/xcschemes/Pods-AppIceReactPlugin.xcscheme +58 -58
- package/ios/Pods/Pods.xcodeproj/xcuserdata/Adi.xcuserdatad/xcschemes/xcschememanagement.plist +18 -18
- package/ios/Pods/Pods.xcodeproj/xcuserdata/artherajesh.xcuserdatad/xcschemes/xcschememanagement.plist +14 -14
- package/ios/Pods/Target Support Files/Pods-AppIceReactPlugin/Pods-AppIceReactPlugin-Info.plist +26 -26
- package/ios/Pods/Target Support Files/Pods-AppIceReactPlugin/Pods-AppIceReactPlugin-acknowledgements.markdown +3 -3
- package/ios/Pods/Target Support Files/Pods-AppIceReactPlugin/Pods-AppIceReactPlugin-acknowledgements.plist +29 -29
- package/ios/Pods/Target Support Files/Pods-AppIceReactPlugin/Pods-AppIceReactPlugin-dummy.m +5 -5
- package/ios/Pods/Target Support Files/Pods-AppIceReactPlugin/Pods-AppIceReactPlugin-umbrella.h +16 -16
- package/ios/Pods/Target Support Files/Pods-AppIceReactPlugin/Pods-AppIceReactPlugin.debug.xcconfig +6 -6
- package/ios/Pods/Target Support Files/Pods-AppIceReactPlugin/Pods-AppIceReactPlugin.modulemap +6 -6
- package/ios/Pods/Target Support Files/Pods-AppIceReactPlugin/Pods-AppIceReactPlugin.release.xcconfig +6 -6
- package/package.json +40 -40
- package/reactnative-plugin-appice.podspec +30 -30
package/example/App.js
CHANGED
|
@@ -1,660 +1,660 @@
|
|
|
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
|
-
Platform,
|
|
13
|
-
Image,
|
|
14
|
-
Linking,
|
|
15
|
-
Button,
|
|
16
|
-
TextInput,
|
|
17
|
-
ScrollView,
|
|
18
|
-
View,
|
|
19
|
-
AppState
|
|
20
|
-
} from 'react-native';
|
|
21
|
-
|
|
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
|
-
|
|
32
|
-
/* "63ff2f6656903ac80342836f",
|
|
33
|
-
"f77142c61559d217188336610f0d4e432063e0c8",
|
|
34
|
-
"869a33728bd9b54fb920cee790062f6c",
|
|
35
|
-
"",
|
|
36
|
-
"BOI-UAT",
|
|
37
|
-
"https://uaappiceuatapi.bankofindia.co.in:11443/uat/api",
|
|
38
|
-
certs*/
|
|
39
|
-
|
|
40
|
-
"5bebe93c25d705690ffbc758",
|
|
41
|
-
"9e9ec60197c8373a11ac15ce4dae80e973608ab2",
|
|
42
|
-
"e5aa4b293f3188fac9cb1a4017963604",
|
|
43
|
-
"",
|
|
44
|
-
"US",
|
|
45
|
-
"https://a.appice.io",
|
|
46
|
-
certs
|
|
47
|
-
|
|
48
|
-
/*
|
|
49
|
-
"63da0ecb29610f3d31365d55",
|
|
50
|
-
"2e0c99435744e47ee673f6105360c4d9c8b135e6",
|
|
51
|
-
"c5d88b2aadaea30d5e0c4f153125a12c",
|
|
52
|
-
"",
|
|
53
|
-
"BOI-SIT",
|
|
54
|
-
"https://uaappiceuatapi.bankofindia.co.in:11443/sit/api",
|
|
55
|
-
certs
|
|
56
|
-
*/
|
|
57
|
-
);
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
/*
|
|
62
|
-
AppICE.startContext(
|
|
63
|
-
// '5bebe93c25d705690ffbc758',
|
|
64
|
-
// '9e9ec60197c8373a11ac15ce4dae80e973608ab2',
|
|
65
|
-
// 'd985715d1bb48942d36d5d08de3b6a8c',
|
|
66
|
-
// '7a55ba2f-52c3-4d88-917d-0365e2f7c9cf',
|
|
67
|
-
// "US",
|
|
68
|
-
// "https://stagingapi.appice.io",
|
|
69
|
-
"5bebe93c25d705690ffbc758",
|
|
70
|
-
"9e9ec60197c8373a11ac15ce4dae80e973608ab2",
|
|
71
|
-
"e5aa4b293f3188fac9cb1a4017963604",
|
|
72
|
-
"",
|
|
73
|
-
"US",
|
|
74
|
-
"https://a.appice.io",
|
|
75
|
-
|
|
76
|
-
certs);
|
|
77
|
-
*/
|
|
78
|
-
addAppICEAPIListeners();
|
|
79
|
-
|
|
80
|
-
AppState.addEventListener('change', (nextAppState) => {
|
|
81
|
-
if (nextAppState === 'active') {
|
|
82
|
-
AppICE.isDeviceReady(true);
|
|
83
|
-
}
|
|
84
|
-
else if (nextAppState === 'background'){
|
|
85
|
-
AppICE.isDeviceReady(false);
|
|
86
|
-
}
|
|
87
|
-
});
|
|
88
|
-
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
return (
|
|
96
|
-
<View
|
|
97
|
-
style={{
|
|
98
|
-
flex: 1,
|
|
99
|
-
justifyContent: "center",
|
|
100
|
-
alignItems: "center",
|
|
101
|
-
marginBottom: 10,
|
|
102
|
-
|
|
103
|
-
}}>
|
|
104
|
-
<Text>AppICE React Demo</Text>
|
|
105
|
-
|
|
106
|
-
<Button
|
|
107
|
-
onPress={sendEvent}
|
|
108
|
-
title="Send Event"
|
|
109
|
-
color="#841584"
|
|
110
|
-
|
|
111
|
-
/>
|
|
112
|
-
<View
|
|
113
|
-
>
|
|
114
|
-
|
|
115
|
-
</View>
|
|
116
|
-
<TextInput
|
|
117
|
-
style={{ height: 30,width:150, borderColor: 'gray', borderWidth: 1, marginBottom: 5, paddingHorizontal: 10 }}
|
|
118
|
-
placeholder="setUserID"
|
|
119
|
-
onChangeText={handlesetIDText}
|
|
120
|
-
/>
|
|
121
|
-
<View style={{ flexDirection: 'row', marginTop: 5 }}>
|
|
122
|
-
<Button title="setUserID" onPress={setSampleUserID} />
|
|
123
|
-
<View style={{ marginLeft: 10 }}>
|
|
124
|
-
<Button title="getUserId" onPress={getUserId} />
|
|
125
|
-
</View>
|
|
126
|
-
</View>
|
|
127
|
-
|
|
128
|
-
<View style={{ flexDirection: 'row', marginTop: 5 }}>
|
|
129
|
-
<Button title="setUserProfile" onPress={setUserProfile} />
|
|
130
|
-
<View style={{ marginLeft: 10 }}>
|
|
131
|
-
<Button title="getUserProfile" onPress={getUser} />
|
|
132
|
-
</View>
|
|
133
|
-
</View>
|
|
134
|
-
|
|
135
|
-
<View style={{ flexDirection: 'row', marginTop: 5 }}>
|
|
136
|
-
<Button title="set Custom Variable" onPress={setLanguage} />
|
|
137
|
-
<View style={{ marginLeft: 10 }}>
|
|
138
|
-
<Button title="Send View" onPress={sendView} />
|
|
139
|
-
</View>
|
|
140
|
-
</View>
|
|
141
|
-
|
|
142
|
-
<TextInput
|
|
143
|
-
style={{ height: 30,width:300, borderColor: 'gray', borderWidth: 1, marginBottom: 10, paddingHorizontal: 10 }}
|
|
144
|
-
placeholder="mid"
|
|
145
|
-
onChangeText={handleTextChange}
|
|
146
|
-
/>
|
|
147
|
-
|
|
148
|
-
<View style={{ flexDirection: 'row', marginTop: 5 }}>
|
|
149
|
-
<Button title="getInboxMessage" onPress={getInboxMessage} />
|
|
150
|
-
<View style={{ marginLeft: 5 }}>
|
|
151
|
-
<Button title="getMessageCount" onPress={getMessageCount} />
|
|
152
|
-
</View>
|
|
153
|
-
<View style={{ marginLeft: 5 }}>
|
|
154
|
-
</View>
|
|
155
|
-
</View>
|
|
156
|
-
|
|
157
|
-
<View style={{ flexDirection: 'row', marginTop: 5 }}>
|
|
158
|
-
<Button title="getInboxMessageId" onPress={getInboxMessageForId} />
|
|
159
|
-
<View style={{ marginLeft: 10 }}>
|
|
160
|
-
<Button title="updateInbox" onPress={updateInboxMessage} />
|
|
161
|
-
</View>
|
|
162
|
-
</View>
|
|
163
|
-
|
|
164
|
-
<Button
|
|
165
|
-
onPress={synchronizeInbox}
|
|
166
|
-
title="synchronizeInbox"
|
|
167
|
-
color="#841584"
|
|
168
|
-
/>
|
|
169
|
-
<Button
|
|
170
|
-
onPress={getUserDetails}
|
|
171
|
-
title="getUserDetails"
|
|
172
|
-
color="#841584"
|
|
173
|
-
/>
|
|
174
|
-
<Button
|
|
175
|
-
onPress={getUserData}
|
|
176
|
-
title="getUserData"
|
|
177
|
-
color="#841584"
|
|
178
|
-
/>
|
|
179
|
-
</View>
|
|
180
|
-
)
|
|
181
|
-
|
|
182
|
-
}
|
|
183
|
-
|
|
184
|
-
function addAppICEAPIListeners() {
|
|
185
|
-
AppICE.addListener(AppICE.AppICEPushNotificationClicked, (event: { AppICEPushNotificationClicked: any; }) => {
|
|
186
|
-
if (typeof event !== 'undefined') {
|
|
187
|
-
console.log(
|
|
188
|
-
'handleAppICETapEvent',
|
|
189
|
-
AppICE.AppICEPushNotificationClicked,
|
|
190
|
-
event.AppICEPushNotificationClicked,
|
|
191
|
-
);
|
|
192
|
-
AppICE.pushNotificationClicked(event.AppICEPushNotificationClicked);
|
|
193
|
-
}
|
|
194
|
-
});
|
|
195
|
-
|
|
196
|
-
AppICE.addListener(AppICE.AppICEInAppClicked, (event: { AppICEInAppClicked: any; }) => {
|
|
197
|
-
if (typeof event !== 'undefined') {
|
|
198
|
-
console.log("event AppICEInAppClicked: " + event);
|
|
199
|
-
console.log("event is from AppICEInAppClicked is " + event.AppICEInAppClicked);
|
|
200
|
-
console.log('handleAppICETapEvent', AppICE.AppICEInAppClicked);
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
callbackInApp(event.AppICEInAppClicked)
|
|
204
|
-
}
|
|
205
|
-
});
|
|
206
|
-
}
|
|
207
|
-
const sendEvent = () => {
|
|
208
|
-
console.log("inside sendEvent");
|
|
209
|
-
var dataObj = {
|
|
210
|
-
"ClickedMenuBtn": "false",
|
|
211
|
-
"CLickedSubmitBtn": "false",
|
|
212
|
-
"AppName": "ReactSampleApp"
|
|
213
|
-
};
|
|
214
|
-
AppICE.tagEvent("ReactSampleApp", dataObj);
|
|
215
|
-
|
|
216
|
-
}
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
const setUserProfile = () => {
|
|
220
|
-
AppICE.setUser({
|
|
221
|
-
[AppICE.name]: 'arthe',
|
|
222
|
-
[AppICE.phone]: '',
|
|
223
|
-
[AppICE.email]: '',
|
|
224
|
-
[AppICE.age]: 0,
|
|
225
|
-
[AppICE.gender]: '',
|
|
226
|
-
[AppICE.dob]: 0,
|
|
227
|
-
[AppICE.educationType]: '',
|
|
228
|
-
[AppICE.employmentType]: '',
|
|
229
|
-
[AppICE.married]:1,
|
|
230
|
-
[AppICE.isEmployed]:1,
|
|
231
|
-
});
|
|
232
|
-
console.log("[AppICE.name] "+[AppICE.name]);
|
|
233
|
-
console.log("[AppICE.phone] "+[AppICE.phone]);
|
|
234
|
-
console.log("[AppICE.email] "+[AppICE.email]);
|
|
235
|
-
console.log("[AppICE.age] "+[AppICE.age]);
|
|
236
|
-
console.log("[AppICE.gender] "+[AppICE.gender]);
|
|
237
|
-
};
|
|
238
|
-
|
|
239
|
-
const setSampleUserID = () => {
|
|
240
|
-
AppICE.setUserId(['16084015600']);
|
|
241
|
-
//181166344
|
|
242
|
-
//AppICE.setUserId(['181166344']);
|
|
243
|
-
//AppICE.setUserId(['kuOEN8bCqdrROmJPVCeKSg==']);
|
|
244
|
-
|
|
245
|
-
};
|
|
246
|
-
|
|
247
|
-
const getUserId = () => {
|
|
248
|
-
AppICE.getUserId((userIds: any[]) => {
|
|
249
|
-
console.log('User IDs:', userIds);
|
|
250
|
-
const inboxMessageString = JSON.stringify(userIds, null, 2);
|
|
251
|
-
|
|
252
|
-
Alert.alert(`getInboxMessageForId: \n ${inboxMessageString}`);
|
|
253
|
-
});
|
|
254
|
-
};
|
|
255
|
-
|
|
256
|
-
const setLanguage = () => {
|
|
257
|
-
AppICE.setCustomVariable("_lang", "ar-AE");
|
|
258
|
-
|
|
259
|
-
};
|
|
260
|
-
//getUserDetails
|
|
261
|
-
const getUserDetails = () => {
|
|
262
|
-
console.log('GET USER Details:');
|
|
263
|
-
AppICE.getUser((user:any) => {
|
|
264
|
-
|
|
265
|
-
});
|
|
266
|
-
|
|
267
|
-
};
|
|
268
|
-
const getUser = () => {
|
|
269
|
-
console.log('GET USER:');
|
|
270
|
-
|
|
271
|
-
const userData = AppICE.getUser((res: any)=>{
|
|
272
|
-
console.log("userData getUser "+userData);
|
|
273
|
-
|
|
274
|
-
if(res){
|
|
275
|
-
var response;
|
|
276
|
-
const resData = JSON.stringify(res);
|
|
277
|
-
console.log("res "+resData);
|
|
278
|
-
|
|
279
|
-
const data = JSON.parse(resData);
|
|
280
|
-
response = data;
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
const customProperties = response[AppICE.DEMOGRAPHIC_INFO];
|
|
284
|
-
console.log("customProperties "+customProperties);
|
|
285
|
-
|
|
286
|
-
}
|
|
287
|
-
});
|
|
288
|
-
}
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
function callbackInApp(payload: any) {
|
|
292
|
-
|
|
293
|
-
console.log('Call BAck payload:', payload);
|
|
294
|
-
|
|
295
|
-
if (payload) {
|
|
296
|
-
const screen = JSON.parse(payload)
|
|
297
|
-
console.log('Call BAck Screen:',screen);
|
|
298
|
-
|
|
299
|
-
}
|
|
300
|
-
|
|
301
|
-
};
|
|
302
|
-
|
|
303
|
-
function callbackInApp1(payload: any) {
|
|
304
|
-
|
|
305
|
-
if (Platform.OS === 'ios') {
|
|
306
|
-
console.log('Call BAck Screen for IOS:');
|
|
307
|
-
console.log('Call BAck payload :',payload);
|
|
308
|
-
|
|
309
|
-
if (payload) {
|
|
310
|
-
const screen = JSON.parse(payload)
|
|
311
|
-
console.log('Call BAck Screen :',screen);
|
|
312
|
-
Alert.alert('Call BAck Screen : ' +screen);
|
|
313
|
-
}
|
|
314
|
-
}
|
|
315
|
-
else
|
|
316
|
-
{
|
|
317
|
-
console.log("Please use Android logic here.");
|
|
318
|
-
}
|
|
319
|
-
};
|
|
320
|
-
|
|
321
|
-
const sendView = () => {
|
|
322
|
-
AppICE.tagEvent("HomeScreen", {});
|
|
323
|
-
};
|
|
324
|
-
/*
|
|
325
|
-
===================
|
|
326
|
-
APPINBOX
|
|
327
|
-
===================
|
|
328
|
-
*/
|
|
329
|
-
const type = 1;
|
|
330
|
-
//kuOEN8bCqdrROmJPVCeKSg==
|
|
331
|
-
const userIds = ['16084015600'];
|
|
332
|
-
let inputValue = '';
|
|
333
|
-
const handlesetIDText = (text: string) => {
|
|
334
|
-
|
|
335
|
-
};
|
|
336
|
-
|
|
337
|
-
const handleTextChange = (text: string) => {
|
|
338
|
-
inputValue = text;
|
|
339
|
-
};
|
|
340
|
-
|
|
341
|
-
let textInput: TextInput | null = null;
|
|
342
|
-
|
|
343
|
-
const getInboxMessage = () => {
|
|
344
|
-
const userId = ['16084015600'];
|
|
345
|
-
getInboxMessages(1, userId, "Bank Communications", 10, 0, 10, false, (result:any) => {
|
|
346
|
-
console.log("Inbox data set: ", result);
|
|
347
|
-
Alert.alert(`Inbox Data: \n ${result}`);
|
|
348
|
-
})
|
|
349
|
-
};
|
|
350
|
-
|
|
351
|
-
function getInboxMessages(type: number, userids: string[], category: string, limit: number, offset: number, timeout: number, withServerHit: boolean, callback: { (result: any): void; (arg0: string): void; }) {
|
|
352
|
-
|
|
353
|
-
if (withServerHit) {
|
|
354
|
-
AppICE.synchronizeInbox(timeout, (res: any) => {
|
|
355
|
-
if (res) {
|
|
356
|
-
AppICE.getInboxMessages(type, userids, async (res: any) => {
|
|
357
|
-
console.log("getInboxMessages " + res)
|
|
358
|
-
if (res) {
|
|
359
|
-
const newData = JSON.stringify(res);
|
|
360
|
-
const result = await getFilteredData(newData, category, limit, offset);
|
|
361
|
-
console.log("getFilteredData 2: ", result);
|
|
362
|
-
const val = JSON.stringify(result);
|
|
363
|
-
console.log("getFilteredData 2: ", val);
|
|
364
|
-
if (val) {
|
|
365
|
-
console.log("internalGetInboxMessage 2" + val)
|
|
366
|
-
callback(val);
|
|
367
|
-
// getMediaDataKeys(res);
|
|
368
|
-
}
|
|
369
|
-
}
|
|
370
|
-
})
|
|
371
|
-
} else {
|
|
372
|
-
AppICE.getInboxMessages(type, userids, async (res: any) => {
|
|
373
|
-
console.log("getInboxMessages " + res)
|
|
374
|
-
if (res) {
|
|
375
|
-
const newData = JSON.stringify(res);
|
|
376
|
-
const result = await getFilteredData(newData, category, limit, offset);
|
|
377
|
-
console.log("getFilteredData 3: ", result);
|
|
378
|
-
const val = JSON.stringify(result);
|
|
379
|
-
console.log("getFilteredData 3: ", val);
|
|
380
|
-
if (val) {
|
|
381
|
-
console.log("internalGetInboxMessage 3" + val)
|
|
382
|
-
callback(val);
|
|
383
|
-
|
|
384
|
-
}
|
|
385
|
-
}
|
|
386
|
-
})
|
|
387
|
-
}
|
|
388
|
-
});
|
|
389
|
-
} else {
|
|
390
|
-
AppICE.getInboxMessages(type, userids,async (res: any) => {
|
|
391
|
-
if (res) {
|
|
392
|
-
try {
|
|
393
|
-
const newData = JSON.stringify(res);
|
|
394
|
-
console.log("getInboxMessages newData" + newData)
|
|
395
|
-
const result = await getFilteredData(newData, category, limit, offset);
|
|
396
|
-
console.log("getFilteredData result" + result)
|
|
397
|
-
|
|
398
|
-
const val = JSON.stringify(result);
|
|
399
|
-
console.log("getFilteredData stringify result val" + val)
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
if (val) {
|
|
403
|
-
console.log("internalGetInboxMessage 4" + val)
|
|
404
|
-
callback(val);
|
|
405
|
-
|
|
406
|
-
}
|
|
407
|
-
} catch (error) {
|
|
408
|
-
console.log("internalGetInboxMessage error" + error)
|
|
409
|
-
}
|
|
410
|
-
|
|
411
|
-
}
|
|
412
|
-
})
|
|
413
|
-
}
|
|
414
|
-
}
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
async function getMediaDataKeys(inboxMessages: any) {
|
|
418
|
-
const newInboxMessageData: any[] = [];
|
|
419
|
-
|
|
420
|
-
// Iterate over all messages in inboxMessages array
|
|
421
|
-
inboxMessages.forEach(async (message: any) => {
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
const mediaKey = 'imageUrl'; // Adjust media key as needed
|
|
425
|
-
const singleInboxMessage = Object.assign({}, message);
|
|
426
|
-
|
|
427
|
-
console.log('from server ', singleInboxMessage);
|
|
428
|
-
try {
|
|
429
|
-
const mediaData = await new Promise((resolve, reject) => {
|
|
430
|
-
AppICE.getMediaData(message, mediaKey, (mediaData: any) => {
|
|
431
|
-
resolve(mediaData);
|
|
432
|
-
});
|
|
433
|
-
});
|
|
434
|
-
// We have to check mediaData if it is valid only then we should call rest of the functions
|
|
435
|
-
const mediaUrl = await new Promise((resolve, reject) => {
|
|
436
|
-
AppICE.getMediaUrl(message, mediaData, (mediaUrl: any) => {
|
|
437
|
-
resolve(mediaUrl);
|
|
438
|
-
});
|
|
439
|
-
});
|
|
440
|
-
const mediaType = await new Promise((resolve, reject) => {
|
|
441
|
-
AppICE.getMediaType(message, mediaData, (mediaType: any) => {
|
|
442
|
-
resolve(mediaType);
|
|
443
|
-
});
|
|
444
|
-
});
|
|
445
|
-
const mediaThumbnail = await new Promise((resolve, reject) => {
|
|
446
|
-
AppICE.getMediaThumbnail(message, mediaData, (mediaThumbnail: any) => {
|
|
447
|
-
resolve(mediaThumbnail);
|
|
448
|
-
});
|
|
449
|
-
});
|
|
450
|
-
console.log('==================================================',);
|
|
451
|
-
console.log('singleInboxMessage:', singleInboxMessage);
|
|
452
|
-
console.log('mediaUrl:', mediaUrl);
|
|
453
|
-
console.log('mediaType:', mediaType);
|
|
454
|
-
console.log('mediaThumbnail:', mediaThumbnail);
|
|
455
|
-
// Add media data to singleInboxMessage
|
|
456
|
-
singleInboxMessage.mediaUrl = mediaUrl;
|
|
457
|
-
singleInboxMessage.mediaType = mediaType;
|
|
458
|
-
singleInboxMessage.mediaThumbnail = mediaThumbnail;
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
// Push singleInboxMessage to newInboxMessageData
|
|
462
|
-
newInboxMessageData.push(singleInboxMessage);
|
|
463
|
-
|
|
464
|
-
console.log('final Media newInboxMessageData push:', newInboxMessageData);
|
|
465
|
-
console.log('==================================================',);
|
|
466
|
-
} catch (error) {
|
|
467
|
-
console.error('Error fetching media data:', error);
|
|
468
|
-
}
|
|
469
|
-
});
|
|
470
|
-
|
|
471
|
-
// Wait for all asynchronous operations to complete before returning
|
|
472
|
-
return new Promise((resolve) => {
|
|
473
|
-
setTimeout(() => {
|
|
474
|
-
resolve(newInboxMessageData);
|
|
475
|
-
console.log('Media newInboxMessageData promise:', newInboxMessageData);
|
|
476
|
-
}, 500); //millisecond
|
|
477
|
-
});
|
|
478
|
-
|
|
479
|
-
}
|
|
480
|
-
|
|
481
|
-
async function getFilteredData(newData: string, category: string, limit: number, offset: number | undefined) {
|
|
482
|
-
const jsonArray = JSON.parse(newData);
|
|
483
|
-
if (!jsonArray || !Array.isArray(jsonArray)) {
|
|
484
|
-
console.error('Invalid jsonArray:', jsonArray);
|
|
485
|
-
return null;
|
|
486
|
-
}
|
|
487
|
-
|
|
488
|
-
// Convert the provided category to lowercase for case-insensitive comparison
|
|
489
|
-
const lowerCaseCategory = category.toLowerCase();
|
|
490
|
-
|
|
491
|
-
// Count occurrences of each category with original case for the entire array
|
|
492
|
-
const categoryCount = jsonArray.reduce((acc, item) => {
|
|
493
|
-
const categoryName = item?.cdata?.category; // Added null checks
|
|
494
|
-
if (categoryName) {
|
|
495
|
-
acc[categoryName] = (acc[categoryName] || 0) + 1;
|
|
496
|
-
}
|
|
497
|
-
return acc;
|
|
498
|
-
}, {});
|
|
499
|
-
|
|
500
|
-
// Ensure that "chip A" and "chip B" are in the count array, even if they are not present in the filtered array
|
|
501
|
-
["Offers & Promotions", "Bank Communications"].forEach(chip => {
|
|
502
|
-
if (!categoryCount[chip]) {
|
|
503
|
-
categoryCount[chip] = 0;
|
|
504
|
-
}
|
|
505
|
-
});
|
|
506
|
-
|
|
507
|
-
// Filter the array based on the provided category (case-insensitive)
|
|
508
|
-
const filteredArray = jsonArray.filter(item => item?.cdata?.category?.toLowerCase() === lowerCaseCategory);
|
|
509
|
-
console.log("slicedArray filteredArray " +filteredArray);
|
|
510
|
-
|
|
511
|
-
// Apply limit and offset to the filtered array
|
|
512
|
-
const slicedArray = filteredArray.slice(offset, offset + limit);
|
|
513
|
-
console.log("slicedArray " + JSON.stringify(slicedArray));
|
|
514
|
-
|
|
515
|
-
// Prepare the result object without assigning new values
|
|
516
|
-
const result = {
|
|
517
|
-
count: Object.entries(categoryCount).map(([key, value]) => ({ [key]: value })),
|
|
518
|
-
inboxData: await getMediaDataKeys(slicedArray)
|
|
519
|
-
/*slicedArray.map(item => ({
|
|
520
|
-
cdata: item?.cdata,
|
|
521
|
-
campId: item?.campId,
|
|
522
|
-
campType: item?.campType,
|
|
523
|
-
icon: item?.icon,
|
|
524
|
-
id: item?.id,
|
|
525
|
-
message: item?.message,
|
|
526
|
-
messageExpiryTime: item?.messageExpiryTime,
|
|
527
|
-
messageLanguage: item?.messageLanguage,
|
|
528
|
-
messageStatus: item?.messageStatus,
|
|
529
|
-
title: item?.title
|
|
530
|
-
|
|
531
|
-
}))*/
|
|
532
|
-
};
|
|
533
|
-
console.log("filtered data " + JSON.stringify(result));
|
|
534
|
-
return result;
|
|
535
|
-
}
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
const getMessageCount = () => {
|
|
539
|
-
const userId = ['16084015600'];
|
|
540
|
-
const count = getMessageCounts(1, userId, 10, (result: number) => {
|
|
541
|
-
Alert.alert(`getMessageCounts count : \n ${result}`);
|
|
542
|
-
})
|
|
543
|
-
}
|
|
544
|
-
function getMessageCounts(type: number, userids:string[], timeout: number, callback: { (result: number): void; (arg0: any): void; }) {
|
|
545
|
-
AppICE.synchronizeInbox(timeout, (res: any) => {
|
|
546
|
-
if (res) {
|
|
547
|
-
console.log("getMessageCounts inside the sync type = "+type+", userid = "+userids)
|
|
548
|
-
AppICE.getMessageCount(1, userids, (res: string) => {
|
|
549
|
-
if (res) {
|
|
550
|
-
console.log("getMessageCounts inside the sync res = "+res)
|
|
551
|
-
callback(res);
|
|
552
|
-
}
|
|
553
|
-
});
|
|
554
|
-
} else {
|
|
555
|
-
console.log("getMessageCounts outside the sync type = "+type+", userid = "+userids)
|
|
556
|
-
console.log("inbox is not synced with server, showing old stored data")
|
|
557
|
-
AppICE.getMessageCount(1, userids, (res: any) => {
|
|
558
|
-
if (res) {
|
|
559
|
-
callback(res);
|
|
560
|
-
}
|
|
561
|
-
});
|
|
562
|
-
}
|
|
563
|
-
})
|
|
564
|
-
}
|
|
565
|
-
|
|
566
|
-
const getInboxMessageForId = () => {
|
|
567
|
-
const messageId = "2808bed2-11e7-4352-ac5a-b22a7dec9ca5";
|
|
568
|
-
const useIds = 'kuOEN8bCqdrROmJPVCeKSg==';
|
|
569
|
-
|
|
570
|
-
AppICE.getInboxMessageForId(messageId, useIds, (inboxMessage: any) => {
|
|
571
|
-
console.log('getInboxMessageForId in JS:', inboxMessage);
|
|
572
|
-
});
|
|
573
|
-
}
|
|
574
|
-
|
|
575
|
-
const updateInboxMessage = () => {
|
|
576
|
-
const messageId = "13f6a43b-6618-4918-addf-d9d341984e23";
|
|
577
|
-
updatedInboxMessage(messageId, 3, 'kuOEN8bCqdrROmJPVCeKSg==', (result: boolean) => {
|
|
578
|
-
Alert.alert('Update Inbox Message:', `Entered value: ${inputValue} \n ${result}`);
|
|
579
|
-
});
|
|
580
|
-
}
|
|
581
|
-
function updatedInboxMessage(messageId: string, type: number, userid: string, callback: { (result: boolean): void; (arg0: any): void; }) {
|
|
582
|
-
AppICE.updateInboxMessage(messageId, type, userid, (res: boolean) => {
|
|
583
|
-
callback(res);
|
|
584
|
-
console.log("updateInboxMessage res : " + res)
|
|
585
|
-
});
|
|
586
|
-
}
|
|
587
|
-
|
|
588
|
-
const synchronizeInbox = () => {
|
|
589
|
-
AppICE.synchronizeInbox(10, (success: boolean) => {
|
|
590
|
-
console.log('Inbox synchronization success:', success);
|
|
591
|
-
const useIds = ['16084015600'];
|
|
592
|
-
AppICE.getInboxMessages( 1, useIds, (inboxMessages: any[]) => {
|
|
593
|
-
console.log('Inbox Messages:', inboxMessages);
|
|
594
|
-
});
|
|
595
|
-
|
|
596
|
-
});
|
|
597
|
-
}
|
|
598
|
-
|
|
599
|
-
const getUserData = () => {
|
|
600
|
-
AppICE.synchronizeData(10,(success: boolean) => {
|
|
601
|
-
console.log('Profile synchronization success:', success);
|
|
602
|
-
Alert.alert(`synchronizeData: \n ${success}`);
|
|
603
|
-
const userIds = ['16084015600'];
|
|
604
|
-
AppICE.getUserForIds(userIds, (res:any) => {
|
|
605
|
-
|
|
606
|
-
console.log('Receive getUser:', res);
|
|
607
|
-
Alert.alert('Receive getUser Alert:' + JSON.stringify(res));
|
|
608
|
-
for (var index = 0; index < res.length; index++) {
|
|
609
|
-
let userData = res[index];
|
|
610
|
-
console.log('Received Inbox:', userData);
|
|
611
|
-
const name = userData[AppICE.name];
|
|
612
|
-
const phone = userData[AppICE.phone];
|
|
613
|
-
const gender = userData[AppICE.gender];
|
|
614
|
-
const dob = userData[AppICE.dob];
|
|
615
|
-
const edt = userData[AppICE.educationType];
|
|
616
|
-
const email = userData[AppICE.email];
|
|
617
|
-
const employment = userData[AppICE.employmentType];
|
|
618
|
-
const age = userData[AppICE.age];
|
|
619
|
-
const marriage = userData[AppICE.married];
|
|
620
|
-
const isEmployed = userData[AppICE.isEmployed];
|
|
621
|
-
|
|
622
|
-
console.log('GetUser Name:', name);
|
|
623
|
-
console.log('GetUser PHONE:', phone);
|
|
624
|
-
console.log('GetUser gender:', gender);
|
|
625
|
-
console.log('GetUser dob:', dob);
|
|
626
|
-
console.log('GetUser edt:', edt);
|
|
627
|
-
console.log('GetUser email:', email);
|
|
628
|
-
console.log('GetUser employment:', employment);
|
|
629
|
-
console.log('GetUser age:', age);
|
|
630
|
-
console.log('GetUser marriage:', marriage);
|
|
631
|
-
console.log('GetUser ISEMPLOYED:', isEmployed);
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
const customProperties = userData[AppICE.DEMOGRAPHIC_INFO];
|
|
635
|
-
const customPropertiesObj = JSON.parse(customProperties);
|
|
636
|
-
console.log("customPropertiesObj "+customPropertiesObj);
|
|
637
|
-
|
|
638
|
-
console.log("user Profile, top_n_product_viewed = "+customPropertiesObj[AppICE.TOP_N_PRODUCTS_VIEWED]);
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
}
|
|
643
|
-
});
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
});
|
|
647
|
-
}
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
export default HelloWorldApp;
|
|
651
|
-
|
|
652
|
-
function showAlert(arg0: string, arg1: string) {
|
|
653
|
-
throw new Error('Function not implemented.');
|
|
654
|
-
}
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
function callback(arg0: string) {
|
|
658
|
-
throw new Error('Function not implemented.');
|
|
659
|
-
}
|
|
660
|
-
|
|
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
|
+
Platform,
|
|
13
|
+
Image,
|
|
14
|
+
Linking,
|
|
15
|
+
Button,
|
|
16
|
+
TextInput,
|
|
17
|
+
ScrollView,
|
|
18
|
+
View,
|
|
19
|
+
AppState
|
|
20
|
+
} from 'react-native';
|
|
21
|
+
|
|
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
|
+
|
|
32
|
+
/* "63ff2f6656903ac80342836f",
|
|
33
|
+
"f77142c61559d217188336610f0d4e432063e0c8",
|
|
34
|
+
"869a33728bd9b54fb920cee790062f6c",
|
|
35
|
+
"",
|
|
36
|
+
"BOI-UAT",
|
|
37
|
+
"https://uaappiceuatapi.bankofindia.co.in:11443/uat/api",
|
|
38
|
+
certs*/
|
|
39
|
+
|
|
40
|
+
"5bebe93c25d705690ffbc758",
|
|
41
|
+
"9e9ec60197c8373a11ac15ce4dae80e973608ab2",
|
|
42
|
+
"e5aa4b293f3188fac9cb1a4017963604",
|
|
43
|
+
"",
|
|
44
|
+
"US",
|
|
45
|
+
"https://a.appice.io",
|
|
46
|
+
certs
|
|
47
|
+
|
|
48
|
+
/*
|
|
49
|
+
"63da0ecb29610f3d31365d55",
|
|
50
|
+
"2e0c99435744e47ee673f6105360c4d9c8b135e6",
|
|
51
|
+
"c5d88b2aadaea30d5e0c4f153125a12c",
|
|
52
|
+
"",
|
|
53
|
+
"BOI-SIT",
|
|
54
|
+
"https://uaappiceuatapi.bankofindia.co.in:11443/sit/api",
|
|
55
|
+
certs
|
|
56
|
+
*/
|
|
57
|
+
);
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
/*
|
|
62
|
+
AppICE.startContext(
|
|
63
|
+
// '5bebe93c25d705690ffbc758',
|
|
64
|
+
// '9e9ec60197c8373a11ac15ce4dae80e973608ab2',
|
|
65
|
+
// 'd985715d1bb48942d36d5d08de3b6a8c',
|
|
66
|
+
// '7a55ba2f-52c3-4d88-917d-0365e2f7c9cf',
|
|
67
|
+
// "US",
|
|
68
|
+
// "https://stagingapi.appice.io",
|
|
69
|
+
"5bebe93c25d705690ffbc758",
|
|
70
|
+
"9e9ec60197c8373a11ac15ce4dae80e973608ab2",
|
|
71
|
+
"e5aa4b293f3188fac9cb1a4017963604",
|
|
72
|
+
"",
|
|
73
|
+
"US",
|
|
74
|
+
"https://a.appice.io",
|
|
75
|
+
|
|
76
|
+
certs);
|
|
77
|
+
*/
|
|
78
|
+
addAppICEAPIListeners();
|
|
79
|
+
|
|
80
|
+
AppState.addEventListener('change', (nextAppState) => {
|
|
81
|
+
if (nextAppState === 'active') {
|
|
82
|
+
AppICE.isDeviceReady(true);
|
|
83
|
+
}
|
|
84
|
+
else if (nextAppState === 'background'){
|
|
85
|
+
AppICE.isDeviceReady(false);
|
|
86
|
+
}
|
|
87
|
+
});
|
|
88
|
+
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
|
|
92
|
+
|
|
93
|
+
|
|
94
|
+
|
|
95
|
+
return (
|
|
96
|
+
<View
|
|
97
|
+
style={{
|
|
98
|
+
flex: 1,
|
|
99
|
+
justifyContent: "center",
|
|
100
|
+
alignItems: "center",
|
|
101
|
+
marginBottom: 10,
|
|
102
|
+
|
|
103
|
+
}}>
|
|
104
|
+
<Text>AppICE React Demo</Text>
|
|
105
|
+
|
|
106
|
+
<Button
|
|
107
|
+
onPress={sendEvent}
|
|
108
|
+
title="Send Event"
|
|
109
|
+
color="#841584"
|
|
110
|
+
|
|
111
|
+
/>
|
|
112
|
+
<View
|
|
113
|
+
>
|
|
114
|
+
|
|
115
|
+
</View>
|
|
116
|
+
<TextInput
|
|
117
|
+
style={{ height: 30,width:150, borderColor: 'gray', borderWidth: 1, marginBottom: 5, paddingHorizontal: 10 }}
|
|
118
|
+
placeholder="setUserID"
|
|
119
|
+
onChangeText={handlesetIDText}
|
|
120
|
+
/>
|
|
121
|
+
<View style={{ flexDirection: 'row', marginTop: 5 }}>
|
|
122
|
+
<Button title="setUserID" onPress={setSampleUserID} />
|
|
123
|
+
<View style={{ marginLeft: 10 }}>
|
|
124
|
+
<Button title="getUserId" onPress={getUserId} />
|
|
125
|
+
</View>
|
|
126
|
+
</View>
|
|
127
|
+
|
|
128
|
+
<View style={{ flexDirection: 'row', marginTop: 5 }}>
|
|
129
|
+
<Button title="setUserProfile" onPress={setUserProfile} />
|
|
130
|
+
<View style={{ marginLeft: 10 }}>
|
|
131
|
+
<Button title="getUserProfile" onPress={getUser} />
|
|
132
|
+
</View>
|
|
133
|
+
</View>
|
|
134
|
+
|
|
135
|
+
<View style={{ flexDirection: 'row', marginTop: 5 }}>
|
|
136
|
+
<Button title="set Custom Variable" onPress={setLanguage} />
|
|
137
|
+
<View style={{ marginLeft: 10 }}>
|
|
138
|
+
<Button title="Send View" onPress={sendView} />
|
|
139
|
+
</View>
|
|
140
|
+
</View>
|
|
141
|
+
|
|
142
|
+
<TextInput
|
|
143
|
+
style={{ height: 30,width:300, borderColor: 'gray', borderWidth: 1, marginBottom: 10, paddingHorizontal: 10 }}
|
|
144
|
+
placeholder="mid"
|
|
145
|
+
onChangeText={handleTextChange}
|
|
146
|
+
/>
|
|
147
|
+
|
|
148
|
+
<View style={{ flexDirection: 'row', marginTop: 5 }}>
|
|
149
|
+
<Button title="getInboxMessage" onPress={getInboxMessage} />
|
|
150
|
+
<View style={{ marginLeft: 5 }}>
|
|
151
|
+
<Button title="getMessageCount" onPress={getMessageCount} />
|
|
152
|
+
</View>
|
|
153
|
+
<View style={{ marginLeft: 5 }}>
|
|
154
|
+
</View>
|
|
155
|
+
</View>
|
|
156
|
+
|
|
157
|
+
<View style={{ flexDirection: 'row', marginTop: 5 }}>
|
|
158
|
+
<Button title="getInboxMessageId" onPress={getInboxMessageForId} />
|
|
159
|
+
<View style={{ marginLeft: 10 }}>
|
|
160
|
+
<Button title="updateInbox" onPress={updateInboxMessage} />
|
|
161
|
+
</View>
|
|
162
|
+
</View>
|
|
163
|
+
|
|
164
|
+
<Button
|
|
165
|
+
onPress={synchronizeInbox}
|
|
166
|
+
title="synchronizeInbox"
|
|
167
|
+
color="#841584"
|
|
168
|
+
/>
|
|
169
|
+
<Button
|
|
170
|
+
onPress={getUserDetails}
|
|
171
|
+
title="getUserDetails"
|
|
172
|
+
color="#841584"
|
|
173
|
+
/>
|
|
174
|
+
<Button
|
|
175
|
+
onPress={getUserData}
|
|
176
|
+
title="getUserData"
|
|
177
|
+
color="#841584"
|
|
178
|
+
/>
|
|
179
|
+
</View>
|
|
180
|
+
)
|
|
181
|
+
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
function addAppICEAPIListeners() {
|
|
185
|
+
AppICE.addListener(AppICE.AppICEPushNotificationClicked, (event: { AppICEPushNotificationClicked: any; }) => {
|
|
186
|
+
if (typeof event !== 'undefined') {
|
|
187
|
+
console.log(
|
|
188
|
+
'handleAppICETapEvent',
|
|
189
|
+
AppICE.AppICEPushNotificationClicked,
|
|
190
|
+
event.AppICEPushNotificationClicked,
|
|
191
|
+
);
|
|
192
|
+
AppICE.pushNotificationClicked(event.AppICEPushNotificationClicked);
|
|
193
|
+
}
|
|
194
|
+
});
|
|
195
|
+
|
|
196
|
+
AppICE.addListener(AppICE.AppICEInAppClicked, (event: { AppICEInAppClicked: any; }) => {
|
|
197
|
+
if (typeof event !== 'undefined') {
|
|
198
|
+
console.log("event AppICEInAppClicked: " + event);
|
|
199
|
+
console.log("event is from AppICEInAppClicked is " + event.AppICEInAppClicked);
|
|
200
|
+
console.log('handleAppICETapEvent', AppICE.AppICEInAppClicked);
|
|
201
|
+
|
|
202
|
+
|
|
203
|
+
callbackInApp(event.AppICEInAppClicked)
|
|
204
|
+
}
|
|
205
|
+
});
|
|
206
|
+
}
|
|
207
|
+
const sendEvent = () => {
|
|
208
|
+
console.log("inside sendEvent");
|
|
209
|
+
var dataObj = {
|
|
210
|
+
"ClickedMenuBtn": "false",
|
|
211
|
+
"CLickedSubmitBtn": "false",
|
|
212
|
+
"AppName": "ReactSampleApp"
|
|
213
|
+
};
|
|
214
|
+
AppICE.tagEvent("ReactSampleApp", dataObj);
|
|
215
|
+
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
|
|
219
|
+
const setUserProfile = () => {
|
|
220
|
+
AppICE.setUser({
|
|
221
|
+
[AppICE.name]: 'arthe',
|
|
222
|
+
[AppICE.phone]: '',
|
|
223
|
+
[AppICE.email]: '',
|
|
224
|
+
[AppICE.age]: 0,
|
|
225
|
+
[AppICE.gender]: '',
|
|
226
|
+
[AppICE.dob]: 0,
|
|
227
|
+
[AppICE.educationType]: '',
|
|
228
|
+
[AppICE.employmentType]: '',
|
|
229
|
+
[AppICE.married]:1,
|
|
230
|
+
[AppICE.isEmployed]:1,
|
|
231
|
+
});
|
|
232
|
+
console.log("[AppICE.name] "+[AppICE.name]);
|
|
233
|
+
console.log("[AppICE.phone] "+[AppICE.phone]);
|
|
234
|
+
console.log("[AppICE.email] "+[AppICE.email]);
|
|
235
|
+
console.log("[AppICE.age] "+[AppICE.age]);
|
|
236
|
+
console.log("[AppICE.gender] "+[AppICE.gender]);
|
|
237
|
+
};
|
|
238
|
+
|
|
239
|
+
const setSampleUserID = () => {
|
|
240
|
+
AppICE.setUserId(['16084015600']);
|
|
241
|
+
//181166344
|
|
242
|
+
//AppICE.setUserId(['181166344']);
|
|
243
|
+
//AppICE.setUserId(['kuOEN8bCqdrROmJPVCeKSg==']);
|
|
244
|
+
|
|
245
|
+
};
|
|
246
|
+
|
|
247
|
+
const getUserId = () => {
|
|
248
|
+
AppICE.getUserId((userIds: any[]) => {
|
|
249
|
+
console.log('User IDs:', userIds);
|
|
250
|
+
const inboxMessageString = JSON.stringify(userIds, null, 2);
|
|
251
|
+
|
|
252
|
+
Alert.alert(`getInboxMessageForId: \n ${inboxMessageString}`);
|
|
253
|
+
});
|
|
254
|
+
};
|
|
255
|
+
|
|
256
|
+
const setLanguage = () => {
|
|
257
|
+
AppICE.setCustomVariable("_lang", "ar-AE");
|
|
258
|
+
|
|
259
|
+
};
|
|
260
|
+
//getUserDetails
|
|
261
|
+
const getUserDetails = () => {
|
|
262
|
+
console.log('GET USER Details:');
|
|
263
|
+
AppICE.getUser((user:any) => {
|
|
264
|
+
|
|
265
|
+
});
|
|
266
|
+
|
|
267
|
+
};
|
|
268
|
+
const getUser = () => {
|
|
269
|
+
console.log('GET USER:');
|
|
270
|
+
|
|
271
|
+
const userData = AppICE.getUser((res: any)=>{
|
|
272
|
+
console.log("userData getUser "+userData);
|
|
273
|
+
|
|
274
|
+
if(res){
|
|
275
|
+
var response;
|
|
276
|
+
const resData = JSON.stringify(res);
|
|
277
|
+
console.log("res "+resData);
|
|
278
|
+
|
|
279
|
+
const data = JSON.parse(resData);
|
|
280
|
+
response = data;
|
|
281
|
+
|
|
282
|
+
|
|
283
|
+
const customProperties = response[AppICE.DEMOGRAPHIC_INFO];
|
|
284
|
+
console.log("customProperties "+customProperties);
|
|
285
|
+
|
|
286
|
+
}
|
|
287
|
+
});
|
|
288
|
+
}
|
|
289
|
+
|
|
290
|
+
|
|
291
|
+
function callbackInApp(payload: any) {
|
|
292
|
+
|
|
293
|
+
console.log('Call BAck payload:', payload);
|
|
294
|
+
|
|
295
|
+
if (payload) {
|
|
296
|
+
const screen = JSON.parse(payload)
|
|
297
|
+
console.log('Call BAck Screen:',screen);
|
|
298
|
+
|
|
299
|
+
}
|
|
300
|
+
|
|
301
|
+
};
|
|
302
|
+
|
|
303
|
+
function callbackInApp1(payload: any) {
|
|
304
|
+
|
|
305
|
+
if (Platform.OS === 'ios') {
|
|
306
|
+
console.log('Call BAck Screen for IOS:');
|
|
307
|
+
console.log('Call BAck payload :',payload);
|
|
308
|
+
|
|
309
|
+
if (payload) {
|
|
310
|
+
const screen = JSON.parse(payload)
|
|
311
|
+
console.log('Call BAck Screen :',screen);
|
|
312
|
+
Alert.alert('Call BAck Screen : ' +screen);
|
|
313
|
+
}
|
|
314
|
+
}
|
|
315
|
+
else
|
|
316
|
+
{
|
|
317
|
+
console.log("Please use Android logic here.");
|
|
318
|
+
}
|
|
319
|
+
};
|
|
320
|
+
|
|
321
|
+
const sendView = () => {
|
|
322
|
+
AppICE.tagEvent("HomeScreen", {});
|
|
323
|
+
};
|
|
324
|
+
/*
|
|
325
|
+
===================
|
|
326
|
+
APPINBOX
|
|
327
|
+
===================
|
|
328
|
+
*/
|
|
329
|
+
const type = 1;
|
|
330
|
+
//kuOEN8bCqdrROmJPVCeKSg==
|
|
331
|
+
const userIds = ['16084015600'];
|
|
332
|
+
let inputValue = '';
|
|
333
|
+
const handlesetIDText = (text: string) => {
|
|
334
|
+
|
|
335
|
+
};
|
|
336
|
+
|
|
337
|
+
const handleTextChange = (text: string) => {
|
|
338
|
+
inputValue = text;
|
|
339
|
+
};
|
|
340
|
+
|
|
341
|
+
let textInput: TextInput | null = null;
|
|
342
|
+
|
|
343
|
+
const getInboxMessage = () => {
|
|
344
|
+
const userId = ['16084015600'];
|
|
345
|
+
getInboxMessages(1, userId, "Bank Communications", 10, 0, 10, false, (result:any) => {
|
|
346
|
+
console.log("Inbox data set: ", result);
|
|
347
|
+
Alert.alert(`Inbox Data: \n ${result}`);
|
|
348
|
+
})
|
|
349
|
+
};
|
|
350
|
+
|
|
351
|
+
function getInboxMessages(type: number, userids: string[], category: string, limit: number, offset: number, timeout: number, withServerHit: boolean, callback: { (result: any): void; (arg0: string): void; }) {
|
|
352
|
+
|
|
353
|
+
if (withServerHit) {
|
|
354
|
+
AppICE.synchronizeInbox(timeout, (res: any) => {
|
|
355
|
+
if (res) {
|
|
356
|
+
AppICE.getInboxMessages(type, userids, async (res: any) => {
|
|
357
|
+
console.log("getInboxMessages " + res)
|
|
358
|
+
if (res) {
|
|
359
|
+
const newData = JSON.stringify(res);
|
|
360
|
+
const result = await getFilteredData(newData, category, limit, offset);
|
|
361
|
+
console.log("getFilteredData 2: ", result);
|
|
362
|
+
const val = JSON.stringify(result);
|
|
363
|
+
console.log("getFilteredData 2: ", val);
|
|
364
|
+
if (val) {
|
|
365
|
+
console.log("internalGetInboxMessage 2" + val)
|
|
366
|
+
callback(val);
|
|
367
|
+
// getMediaDataKeys(res);
|
|
368
|
+
}
|
|
369
|
+
}
|
|
370
|
+
})
|
|
371
|
+
} else {
|
|
372
|
+
AppICE.getInboxMessages(type, userids, async (res: any) => {
|
|
373
|
+
console.log("getInboxMessages " + res)
|
|
374
|
+
if (res) {
|
|
375
|
+
const newData = JSON.stringify(res);
|
|
376
|
+
const result = await getFilteredData(newData, category, limit, offset);
|
|
377
|
+
console.log("getFilteredData 3: ", result);
|
|
378
|
+
const val = JSON.stringify(result);
|
|
379
|
+
console.log("getFilteredData 3: ", val);
|
|
380
|
+
if (val) {
|
|
381
|
+
console.log("internalGetInboxMessage 3" + val)
|
|
382
|
+
callback(val);
|
|
383
|
+
|
|
384
|
+
}
|
|
385
|
+
}
|
|
386
|
+
})
|
|
387
|
+
}
|
|
388
|
+
});
|
|
389
|
+
} else {
|
|
390
|
+
AppICE.getInboxMessages(type, userids,async (res: any) => {
|
|
391
|
+
if (res) {
|
|
392
|
+
try {
|
|
393
|
+
const newData = JSON.stringify(res);
|
|
394
|
+
console.log("getInboxMessages newData" + newData)
|
|
395
|
+
const result = await getFilteredData(newData, category, limit, offset);
|
|
396
|
+
console.log("getFilteredData result" + result)
|
|
397
|
+
|
|
398
|
+
const val = JSON.stringify(result);
|
|
399
|
+
console.log("getFilteredData stringify result val" + val)
|
|
400
|
+
|
|
401
|
+
|
|
402
|
+
if (val) {
|
|
403
|
+
console.log("internalGetInboxMessage 4" + val)
|
|
404
|
+
callback(val);
|
|
405
|
+
|
|
406
|
+
}
|
|
407
|
+
} catch (error) {
|
|
408
|
+
console.log("internalGetInboxMessage error" + error)
|
|
409
|
+
}
|
|
410
|
+
|
|
411
|
+
}
|
|
412
|
+
})
|
|
413
|
+
}
|
|
414
|
+
}
|
|
415
|
+
|
|
416
|
+
|
|
417
|
+
async function getMediaDataKeys(inboxMessages: any) {
|
|
418
|
+
const newInboxMessageData: any[] = [];
|
|
419
|
+
|
|
420
|
+
// Iterate over all messages in inboxMessages array
|
|
421
|
+
inboxMessages.forEach(async (message: any) => {
|
|
422
|
+
|
|
423
|
+
|
|
424
|
+
const mediaKey = 'imageUrl'; // Adjust media key as needed
|
|
425
|
+
const singleInboxMessage = Object.assign({}, message);
|
|
426
|
+
|
|
427
|
+
console.log('from server ', singleInboxMessage);
|
|
428
|
+
try {
|
|
429
|
+
const mediaData = await new Promise((resolve, reject) => {
|
|
430
|
+
AppICE.getMediaData(message, mediaKey, (mediaData: any) => {
|
|
431
|
+
resolve(mediaData);
|
|
432
|
+
});
|
|
433
|
+
});
|
|
434
|
+
// We have to check mediaData if it is valid only then we should call rest of the functions
|
|
435
|
+
const mediaUrl = await new Promise((resolve, reject) => {
|
|
436
|
+
AppICE.getMediaUrl(message, mediaData, (mediaUrl: any) => {
|
|
437
|
+
resolve(mediaUrl);
|
|
438
|
+
});
|
|
439
|
+
});
|
|
440
|
+
const mediaType = await new Promise((resolve, reject) => {
|
|
441
|
+
AppICE.getMediaType(message, mediaData, (mediaType: any) => {
|
|
442
|
+
resolve(mediaType);
|
|
443
|
+
});
|
|
444
|
+
});
|
|
445
|
+
const mediaThumbnail = await new Promise((resolve, reject) => {
|
|
446
|
+
AppICE.getMediaThumbnail(message, mediaData, (mediaThumbnail: any) => {
|
|
447
|
+
resolve(mediaThumbnail);
|
|
448
|
+
});
|
|
449
|
+
});
|
|
450
|
+
console.log('==================================================',);
|
|
451
|
+
console.log('singleInboxMessage:', singleInboxMessage);
|
|
452
|
+
console.log('mediaUrl:', mediaUrl);
|
|
453
|
+
console.log('mediaType:', mediaType);
|
|
454
|
+
console.log('mediaThumbnail:', mediaThumbnail);
|
|
455
|
+
// Add media data to singleInboxMessage
|
|
456
|
+
singleInboxMessage.mediaUrl = mediaUrl;
|
|
457
|
+
singleInboxMessage.mediaType = mediaType;
|
|
458
|
+
singleInboxMessage.mediaThumbnail = mediaThumbnail;
|
|
459
|
+
|
|
460
|
+
|
|
461
|
+
// Push singleInboxMessage to newInboxMessageData
|
|
462
|
+
newInboxMessageData.push(singleInboxMessage);
|
|
463
|
+
|
|
464
|
+
console.log('final Media newInboxMessageData push:', newInboxMessageData);
|
|
465
|
+
console.log('==================================================',);
|
|
466
|
+
} catch (error) {
|
|
467
|
+
console.error('Error fetching media data:', error);
|
|
468
|
+
}
|
|
469
|
+
});
|
|
470
|
+
|
|
471
|
+
// Wait for all asynchronous operations to complete before returning
|
|
472
|
+
return new Promise((resolve) => {
|
|
473
|
+
setTimeout(() => {
|
|
474
|
+
resolve(newInboxMessageData);
|
|
475
|
+
console.log('Media newInboxMessageData promise:', newInboxMessageData);
|
|
476
|
+
}, 500); //millisecond
|
|
477
|
+
});
|
|
478
|
+
|
|
479
|
+
}
|
|
480
|
+
|
|
481
|
+
async function getFilteredData(newData: string, category: string, limit: number, offset: number | undefined) {
|
|
482
|
+
const jsonArray = JSON.parse(newData);
|
|
483
|
+
if (!jsonArray || !Array.isArray(jsonArray)) {
|
|
484
|
+
console.error('Invalid jsonArray:', jsonArray);
|
|
485
|
+
return null;
|
|
486
|
+
}
|
|
487
|
+
|
|
488
|
+
// Convert the provided category to lowercase for case-insensitive comparison
|
|
489
|
+
const lowerCaseCategory = category.toLowerCase();
|
|
490
|
+
|
|
491
|
+
// Count occurrences of each category with original case for the entire array
|
|
492
|
+
const categoryCount = jsonArray.reduce((acc, item) => {
|
|
493
|
+
const categoryName = item?.cdata?.category; // Added null checks
|
|
494
|
+
if (categoryName) {
|
|
495
|
+
acc[categoryName] = (acc[categoryName] || 0) + 1;
|
|
496
|
+
}
|
|
497
|
+
return acc;
|
|
498
|
+
}, {});
|
|
499
|
+
|
|
500
|
+
// Ensure that "chip A" and "chip B" are in the count array, even if they are not present in the filtered array
|
|
501
|
+
["Offers & Promotions", "Bank Communications"].forEach(chip => {
|
|
502
|
+
if (!categoryCount[chip]) {
|
|
503
|
+
categoryCount[chip] = 0;
|
|
504
|
+
}
|
|
505
|
+
});
|
|
506
|
+
|
|
507
|
+
// Filter the array based on the provided category (case-insensitive)
|
|
508
|
+
const filteredArray = jsonArray.filter(item => item?.cdata?.category?.toLowerCase() === lowerCaseCategory);
|
|
509
|
+
console.log("slicedArray filteredArray " +filteredArray);
|
|
510
|
+
|
|
511
|
+
// Apply limit and offset to the filtered array
|
|
512
|
+
const slicedArray = filteredArray.slice(offset, offset + limit);
|
|
513
|
+
console.log("slicedArray " + JSON.stringify(slicedArray));
|
|
514
|
+
|
|
515
|
+
// Prepare the result object without assigning new values
|
|
516
|
+
const result = {
|
|
517
|
+
count: Object.entries(categoryCount).map(([key, value]) => ({ [key]: value })),
|
|
518
|
+
inboxData: await getMediaDataKeys(slicedArray)
|
|
519
|
+
/*slicedArray.map(item => ({
|
|
520
|
+
cdata: item?.cdata,
|
|
521
|
+
campId: item?.campId,
|
|
522
|
+
campType: item?.campType,
|
|
523
|
+
icon: item?.icon,
|
|
524
|
+
id: item?.id,
|
|
525
|
+
message: item?.message,
|
|
526
|
+
messageExpiryTime: item?.messageExpiryTime,
|
|
527
|
+
messageLanguage: item?.messageLanguage,
|
|
528
|
+
messageStatus: item?.messageStatus,
|
|
529
|
+
title: item?.title
|
|
530
|
+
|
|
531
|
+
}))*/
|
|
532
|
+
};
|
|
533
|
+
console.log("filtered data " + JSON.stringify(result));
|
|
534
|
+
return result;
|
|
535
|
+
}
|
|
536
|
+
|
|
537
|
+
|
|
538
|
+
const getMessageCount = () => {
|
|
539
|
+
const userId = ['16084015600'];
|
|
540
|
+
const count = getMessageCounts(1, userId, 10, (result: number) => {
|
|
541
|
+
Alert.alert(`getMessageCounts count : \n ${result}`);
|
|
542
|
+
})
|
|
543
|
+
}
|
|
544
|
+
function getMessageCounts(type: number, userids:string[], timeout: number, callback: { (result: number): void; (arg0: any): void; }) {
|
|
545
|
+
AppICE.synchronizeInbox(timeout, (res: any) => {
|
|
546
|
+
if (res) {
|
|
547
|
+
console.log("getMessageCounts inside the sync type = "+type+", userid = "+userids)
|
|
548
|
+
AppICE.getMessageCount(1, userids, (res: string) => {
|
|
549
|
+
if (res) {
|
|
550
|
+
console.log("getMessageCounts inside the sync res = "+res)
|
|
551
|
+
callback(res);
|
|
552
|
+
}
|
|
553
|
+
});
|
|
554
|
+
} else {
|
|
555
|
+
console.log("getMessageCounts outside the sync type = "+type+", userid = "+userids)
|
|
556
|
+
console.log("inbox is not synced with server, showing old stored data")
|
|
557
|
+
AppICE.getMessageCount(1, userids, (res: any) => {
|
|
558
|
+
if (res) {
|
|
559
|
+
callback(res);
|
|
560
|
+
}
|
|
561
|
+
});
|
|
562
|
+
}
|
|
563
|
+
})
|
|
564
|
+
}
|
|
565
|
+
|
|
566
|
+
const getInboxMessageForId = () => {
|
|
567
|
+
const messageId = "2808bed2-11e7-4352-ac5a-b22a7dec9ca5";
|
|
568
|
+
const useIds = 'kuOEN8bCqdrROmJPVCeKSg==';
|
|
569
|
+
|
|
570
|
+
AppICE.getInboxMessageForId(messageId, useIds, (inboxMessage: any) => {
|
|
571
|
+
console.log('getInboxMessageForId in JS:', inboxMessage);
|
|
572
|
+
});
|
|
573
|
+
}
|
|
574
|
+
|
|
575
|
+
const updateInboxMessage = () => {
|
|
576
|
+
const messageId = "13f6a43b-6618-4918-addf-d9d341984e23";
|
|
577
|
+
updatedInboxMessage(messageId, 3, 'kuOEN8bCqdrROmJPVCeKSg==', (result: boolean) => {
|
|
578
|
+
Alert.alert('Update Inbox Message:', `Entered value: ${inputValue} \n ${result}`);
|
|
579
|
+
});
|
|
580
|
+
}
|
|
581
|
+
function updatedInboxMessage(messageId: string, type: number, userid: string, callback: { (result: boolean): void; (arg0: any): void; }) {
|
|
582
|
+
AppICE.updateInboxMessage(messageId, type, userid, (res: boolean) => {
|
|
583
|
+
callback(res);
|
|
584
|
+
console.log("updateInboxMessage res : " + res)
|
|
585
|
+
});
|
|
586
|
+
}
|
|
587
|
+
|
|
588
|
+
const synchronizeInbox = () => {
|
|
589
|
+
AppICE.synchronizeInbox(10, (success: boolean) => {
|
|
590
|
+
console.log('Inbox synchronization success:', success);
|
|
591
|
+
const useIds = ['16084015600'];
|
|
592
|
+
AppICE.getInboxMessages( 1, useIds, (inboxMessages: any[]) => {
|
|
593
|
+
console.log('Inbox Messages:', inboxMessages);
|
|
594
|
+
});
|
|
595
|
+
|
|
596
|
+
});
|
|
597
|
+
}
|
|
598
|
+
|
|
599
|
+
const getUserData = () => {
|
|
600
|
+
AppICE.synchronizeData(10,(success: boolean) => {
|
|
601
|
+
console.log('Profile synchronization success:', success);
|
|
602
|
+
Alert.alert(`synchronizeData: \n ${success}`);
|
|
603
|
+
const userIds = ['16084015600'];
|
|
604
|
+
AppICE.getUserForIds(userIds, (res:any) => {
|
|
605
|
+
|
|
606
|
+
console.log('Receive getUser:', res);
|
|
607
|
+
Alert.alert('Receive getUser Alert:' + JSON.stringify(res));
|
|
608
|
+
for (var index = 0; index < res.length; index++) {
|
|
609
|
+
let userData = res[index];
|
|
610
|
+
console.log('Received Inbox:', userData);
|
|
611
|
+
const name = userData[AppICE.name];
|
|
612
|
+
const phone = userData[AppICE.phone];
|
|
613
|
+
const gender = userData[AppICE.gender];
|
|
614
|
+
const dob = userData[AppICE.dob];
|
|
615
|
+
const edt = userData[AppICE.educationType];
|
|
616
|
+
const email = userData[AppICE.email];
|
|
617
|
+
const employment = userData[AppICE.employmentType];
|
|
618
|
+
const age = userData[AppICE.age];
|
|
619
|
+
const marriage = userData[AppICE.married];
|
|
620
|
+
const isEmployed = userData[AppICE.isEmployed];
|
|
621
|
+
|
|
622
|
+
console.log('GetUser Name:', name);
|
|
623
|
+
console.log('GetUser PHONE:', phone);
|
|
624
|
+
console.log('GetUser gender:', gender);
|
|
625
|
+
console.log('GetUser dob:', dob);
|
|
626
|
+
console.log('GetUser edt:', edt);
|
|
627
|
+
console.log('GetUser email:', email);
|
|
628
|
+
console.log('GetUser employment:', employment);
|
|
629
|
+
console.log('GetUser age:', age);
|
|
630
|
+
console.log('GetUser marriage:', marriage);
|
|
631
|
+
console.log('GetUser ISEMPLOYED:', isEmployed);
|
|
632
|
+
|
|
633
|
+
|
|
634
|
+
const customProperties = userData[AppICE.DEMOGRAPHIC_INFO];
|
|
635
|
+
const customPropertiesObj = JSON.parse(customProperties);
|
|
636
|
+
console.log("customPropertiesObj "+customPropertiesObj);
|
|
637
|
+
|
|
638
|
+
console.log("user Profile, top_n_product_viewed = "+customPropertiesObj[AppICE.TOP_N_PRODUCTS_VIEWED]);
|
|
639
|
+
|
|
640
|
+
|
|
641
|
+
|
|
642
|
+
}
|
|
643
|
+
});
|
|
644
|
+
|
|
645
|
+
|
|
646
|
+
});
|
|
647
|
+
}
|
|
648
|
+
|
|
649
|
+
|
|
650
|
+
export default HelloWorldApp;
|
|
651
|
+
|
|
652
|
+
function showAlert(arg0: string, arg1: string) {
|
|
653
|
+
throw new Error('Function not implemented.');
|
|
654
|
+
}
|
|
655
|
+
|
|
656
|
+
|
|
657
|
+
function callback(arg0: string) {
|
|
658
|
+
throw new Error('Function not implemented.');
|
|
659
|
+
}
|
|
660
|
+
|