reactnative-plugin-appice 1.7.0 → 1.7.3
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 -152
- 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 +196 -196
- package/android/src/main/java/com/reactlibrary/AppIceReactPluginModule.java +697 -697
- 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 +259 -259
- package/android/src/main/java/com/reactlibrary/NotificationEventService.java +59 -59
- package/android/src/main/java/com/reactlibrary/StringConstants.java +4 -4
- package/example/App.js +310 -310
- 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 +53 -53
- 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,310 +1,310 @@
|
|
|
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
|
-
AppState,
|
|
17
|
-
View
|
|
18
|
-
} from 'react-native';
|
|
19
|
-
|
|
20
|
-
const AppICE = require('reactnative-plugin-appice');
|
|
21
|
-
const HelloWorldApp = () => {
|
|
22
|
-
const certs = [];
|
|
23
|
-
if (AppICE) {
|
|
24
|
-
console.log('AppICE is available');
|
|
25
|
-
AppICE.startContext(
|
|
26
|
-
// '5bebe93c25d705690ffbc758',
|
|
27
|
-
// '9e9ec60197c8373a11ac15ce4dae80e973608ab2',
|
|
28
|
-
// 'd985715d1bb48942d36d5d08de3b6a8c',
|
|
29
|
-
// '7a55ba2f-52c3-4d88-917d-0365e2f7c9cf',
|
|
30
|
-
// "US",
|
|
31
|
-
// "https://stagingapi.appice.io",
|
|
32
|
-
"5bebe93c25d705690ffbc758",
|
|
33
|
-
"9e9ec60197c8373a11ac15ce4dae80e973608ab2",
|
|
34
|
-
"844770e0edf3b795cd7508fa71789572",
|
|
35
|
-
"",
|
|
36
|
-
"US",
|
|
37
|
-
"https://a.appice.io",
|
|
38
|
-
|
|
39
|
-
certs);
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
AppState.addEventListener('change', (nextAppState) => {
|
|
43
|
-
if (nextAppState === 'active') {
|
|
44
|
-
AppICE.isDeviceReady(true);
|
|
45
|
-
}
|
|
46
|
-
else if (nextAppState === 'background'){
|
|
47
|
-
// this state handle both backgroung and kill state
|
|
48
|
-
AppICE.isDeviceReady(false);
|
|
49
|
-
}
|
|
50
|
-
});
|
|
51
|
-
|
|
52
|
-
addAppICEAPIListeners();
|
|
53
|
-
return (
|
|
54
|
-
<View
|
|
55
|
-
style={{
|
|
56
|
-
flex: 1,
|
|
57
|
-
justifyContent: "center",
|
|
58
|
-
alignItems: "center",
|
|
59
|
-
marginBottom: 10,
|
|
60
|
-
|
|
61
|
-
}}>
|
|
62
|
-
<Text>AppICE React Demo</Text>
|
|
63
|
-
<Button
|
|
64
|
-
onPress={sendEvent}
|
|
65
|
-
title="Send Event"
|
|
66
|
-
color="#841584"
|
|
67
|
-
|
|
68
|
-
/>
|
|
69
|
-
<View
|
|
70
|
-
>
|
|
71
|
-
|
|
72
|
-
</View>
|
|
73
|
-
<Button
|
|
74
|
-
onPress={setUserProfile}
|
|
75
|
-
title="set User Profile"
|
|
76
|
-
color="#841584"
|
|
77
|
-
|
|
78
|
-
/>
|
|
79
|
-
|
|
80
|
-
<Button
|
|
81
|
-
onPress={setSampleUserID}
|
|
82
|
-
title="set Sample User ID"
|
|
83
|
-
color="#841584"
|
|
84
|
-
|
|
85
|
-
/>
|
|
86
|
-
<Button
|
|
87
|
-
onPress={setLanguage}
|
|
88
|
-
title="set Language"
|
|
89
|
-
color="#841584"
|
|
90
|
-
|
|
91
|
-
/>
|
|
92
|
-
<Button
|
|
93
|
-
onPress={sendView}
|
|
94
|
-
title="Send View"
|
|
95
|
-
color="#841584"
|
|
96
|
-
|
|
97
|
-
/>
|
|
98
|
-
<Button
|
|
99
|
-
onPress={getUserId}
|
|
100
|
-
title="getUserId"
|
|
101
|
-
color="#841584"
|
|
102
|
-
|
|
103
|
-
/>
|
|
104
|
-
<Button
|
|
105
|
-
onPress={getInboxMessage}
|
|
106
|
-
title="getInboxMessage"
|
|
107
|
-
color="#841584"
|
|
108
|
-
|
|
109
|
-
/>
|
|
110
|
-
<Button
|
|
111
|
-
onPress={getMessageCount}
|
|
112
|
-
title="getMessageCount"
|
|
113
|
-
color="#841584"
|
|
114
|
-
/>
|
|
115
|
-
<Button
|
|
116
|
-
onPress={getInboxMessageForId}
|
|
117
|
-
title="getInboxMessageForId"
|
|
118
|
-
color="#841584"
|
|
119
|
-
/>
|
|
120
|
-
<Button
|
|
121
|
-
onPress={updateInboxMessage}
|
|
122
|
-
title="updateInboxMessage"
|
|
123
|
-
color="#841584"
|
|
124
|
-
/>
|
|
125
|
-
<Button
|
|
126
|
-
onPress={synchronizeInbox}
|
|
127
|
-
title="synchronizeInbox"
|
|
128
|
-
color="#841584"
|
|
129
|
-
/>
|
|
130
|
-
</View>
|
|
131
|
-
)
|
|
132
|
-
|
|
133
|
-
}
|
|
134
|
-
|
|
135
|
-
function addAppICEAPIListeners() {
|
|
136
|
-
|
|
137
|
-
console.log('handleAppICETapEvent');
|
|
138
|
-
|
|
139
|
-
AppICE.addListener(AppICE.AppICEPushNotificationClicked, (event) => {
|
|
140
|
-
if (typeof event !== 'undefined'){
|
|
141
|
-
console.log('handleAppICETapEvent', AppICE.AppICEPushNotificationClicked, event.AppICEPushNotificationClicked);
|
|
142
|
-
AppICE.pushNotificationClicked(event.AppICEPushNotificationClicked);
|
|
143
|
-
//fetching custom data from push payload
|
|
144
|
-
var data = AppICE.getCustomDataFromPayload(event.AppICEPushNotificationClicked);
|
|
145
|
-
console.log(data);
|
|
146
|
-
}
|
|
147
|
-
});
|
|
148
|
-
|
|
149
|
-
AppICE.addListener(AppICE.AppICEInAppClicked, (event) => {
|
|
150
|
-
if (typeof event !== 'undefined'){
|
|
151
|
-
console.log('handleAppICETapEvent', AppICE.AppICEInAppClicked, event.AppICEInAppClicked);
|
|
152
|
-
// AppICE.pushNotificationClicked(event.AppICEInAppClicked);
|
|
153
|
-
}
|
|
154
|
-
});
|
|
155
|
-
}
|
|
156
|
-
const sendEvent = () => {
|
|
157
|
-
console.log("inside sendEvent");
|
|
158
|
-
var dataObj = {
|
|
159
|
-
"ClickedMenuBtn": "false",
|
|
160
|
-
"CLickedSubmitBtn": "false",
|
|
161
|
-
"AppName": "ReactSampleApp"
|
|
162
|
-
};
|
|
163
|
-
AppICE.tagEvent("ReactSampleApp", dataObj);
|
|
164
|
-
//Recording an Event
|
|
165
|
-
}
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
const setUserProfile = () => {
|
|
169
|
-
AppICE.setUser({
|
|
170
|
-
[AppICE.name]: 'testUserA1', [AppICE.phone]: '123456', [AppICE.email]: 'test@test.com', [AppICE.age]: 23
|
|
171
|
-
});
|
|
172
|
-
};
|
|
173
|
-
|
|
174
|
-
const setSampleUserID = () => {
|
|
175
|
-
AppICE.setUserId(['1232323','kuOEN8bCqdrROmJPVCeKSg==']);
|
|
176
|
-
|
|
177
|
-
};
|
|
178
|
-
|
|
179
|
-
const setLanguage = () => {
|
|
180
|
-
AppICE.setCustomVariable("_lang", "ar-AE");
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
AppICE.sendClickCallback((value) => {
|
|
184
|
-
console.log(`INAPP callback`, value);
|
|
185
|
-
});
|
|
186
|
-
|
|
187
|
-
};
|
|
188
|
-
const sendView = () => {
|
|
189
|
-
AppICE.tagEvent("HomeScreen", {});
|
|
190
|
-
};
|
|
191
|
-
|
|
192
|
-
const getUserId = () => {
|
|
193
|
-
AppICE.getUserId((userIds: any[]) => {
|
|
194
|
-
console.log('User IDs:', userIds);
|
|
195
|
-
});
|
|
196
|
-
};
|
|
197
|
-
|
|
198
|
-
const type = 1;
|
|
199
|
-
const userIds = ['1232323' , 'kuOEN8bCqdrROmJPVCeKSg=='];
|
|
200
|
-
|
|
201
|
-
const getInboxMessage = () => {
|
|
202
|
-
AppICE.getInboxMessages(type, userIds, (inboxMessages: any[]) => {
|
|
203
|
-
console.log('Received Inbox Messages:', inboxMessages);
|
|
204
|
-
|
|
205
|
-
inboxMessages.forEach((message) => {
|
|
206
|
-
const mediaKey = 'imageUrl';
|
|
207
|
-
AppICE.getMediaData(message, mediaKey, (mediaData: any) => {
|
|
208
|
-
console.log('Media Data:', mediaData);
|
|
209
|
-
|
|
210
|
-
AppICE.getMediaUrl(mediaData,(mediaUrl:any) => {
|
|
211
|
-
console.log('getMediaUrl is :', mediaUrl);
|
|
212
|
-
});
|
|
213
|
-
|
|
214
|
-
AppICE.getMediaType(mediaData,(mediaType:any) => {
|
|
215
|
-
console.log('getmediaType is:', mediaType);
|
|
216
|
-
});
|
|
217
|
-
|
|
218
|
-
AppICE.getMediaThumbnail(mediaData,(mediaThumbnail:any) => {
|
|
219
|
-
console.log('getMediaThumbnail is:', mediaThumbnail);
|
|
220
|
-
});
|
|
221
|
-
});
|
|
222
|
-
|
|
223
|
-
});
|
|
224
|
-
}
|
|
225
|
-
|
|
226
|
-
const getMessageCount = () => {
|
|
227
|
-
AppICE.getMessageCount(type, userIds, (count: number) => {
|
|
228
|
-
console.log('Messages count :', count);
|
|
229
|
-
});
|
|
230
|
-
}
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
const getInboxMessageForId = () => {
|
|
234
|
-
const messageId = "df73e314-2a61-4615-9fa5-348419e3fc82";
|
|
235
|
-
const userIds = ['1232323' , 'kuOEN8bCqdrROmJPVCeKSg=='];
|
|
236
|
-
|
|
237
|
-
AppICE.getInboxMessageForId(messageId, userIds, (inboxMessage: any) => {
|
|
238
|
-
console.log('getInboxMessageForId in JS:', inboxMessage);
|
|
239
|
-
});
|
|
240
|
-
}
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
const updateInboxMessage = () => {
|
|
245
|
-
const messageId = "df73e314-2a61-4615-9fa5-348419e3fc82";
|
|
246
|
-
const userId = ['1232323' , 'kuOEN8bCqdrROmJPVCeKSg=='];
|
|
247
|
-
AppICE.updateInboxMessage(messageId, 1, userId, (isSuccess: boolean) => {
|
|
248
|
-
console.log('Update Inbox Message Success:', isSuccess);
|
|
249
|
-
});
|
|
250
|
-
}
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
const synchronizeInbox = () => {
|
|
255
|
-
AppICE.synchronizeInbox(10, (success: boolean) => {
|
|
256
|
-
console.log('Inbox synchronization success:', success);
|
|
257
|
-
const userIds = ['1232323' , 'kuOEN8bCqdrROmJPVCeKSg=='];
|
|
258
|
-
AppICE.getInboxMessages( 1, userIds, (inboxMessages: any[]) => {
|
|
259
|
-
console.log('Inbox Messages:', inboxMessages);
|
|
260
|
-
// everytime will return next set of data from payload
|
|
261
|
-
// var inbox = getInboxFilteredData (inbox, key= "Transaction", limit=10, offset=1 );
|
|
262
|
-
});
|
|
263
|
-
|
|
264
|
-
});
|
|
265
|
-
}
|
|
266
|
-
|
|
267
|
-
const getUserData = () => {
|
|
268
|
-
AppICE.synchronizeData(10,(success: boolean) => {
|
|
269
|
-
console.log('Profile synchronization success:', success);
|
|
270
|
-
Alert.alert(`synchronizeData: \n ${success}`);
|
|
271
|
-
const userIds = ['160840156'];
|
|
272
|
-
AppICE.getUserForIds(userIds, (res:any[]) => {
|
|
273
|
-
|
|
274
|
-
console.log('Receive getUser:', res);
|
|
275
|
-
for (var index = 0; index < res.length; index++) {
|
|
276
|
-
let userData = res[index];
|
|
277
|
-
console.log('Received Inbox:', userData);
|
|
278
|
-
const name = userData[AppICE.name];
|
|
279
|
-
const phone = userData[AppICE.phone];
|
|
280
|
-
const gender = userData[AppICE.gender];
|
|
281
|
-
const dob = userData[AppICE.dob];
|
|
282
|
-
const edt = userData[AppICE.educationType];
|
|
283
|
-
const email = userData[AppICE.email];
|
|
284
|
-
const employment = userData[AppICE.employmentType];
|
|
285
|
-
const age = userData[AppICE.age];
|
|
286
|
-
const marriage = userData[AppICE.married];
|
|
287
|
-
const isEmployed = userData[AppICE.isEmployed];
|
|
288
|
-
|
|
289
|
-
console.log('GetUser name:', name);
|
|
290
|
-
console.log('GetUser phone:', phone);
|
|
291
|
-
console.log('GetUser gender:', gender);
|
|
292
|
-
console.log('GetUser dob:', dob);
|
|
293
|
-
console.log('GetUser educationType:', edt);
|
|
294
|
-
console.log('GetUser email:', email);
|
|
295
|
-
console.log('GetUser employment:', employment);
|
|
296
|
-
console.log('GetUser age:', age);
|
|
297
|
-
console.log('GetUser marriage:', marriage);
|
|
298
|
-
console.log('GetUser isEmployed:', isEmployed);
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
const customProperties = userData[AppICE.DEMOGRAPHIC_INFO];
|
|
302
|
-
const customPropertiesObj = JSON.parse(customProperties);
|
|
303
|
-
console.log("user Profile, top_n_product_viewed = "+customPropertiesObj[AppICE.TOP_N_PRODUCTS_VIEWED]);
|
|
304
|
-
|
|
305
|
-
}
|
|
306
|
-
});
|
|
307
|
-
});
|
|
308
|
-
}
|
|
309
|
-
|
|
310
|
-
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
|
+
Platform,
|
|
13
|
+
Image,
|
|
14
|
+
Linking,
|
|
15
|
+
Button,
|
|
16
|
+
AppState,
|
|
17
|
+
View
|
|
18
|
+
} from 'react-native';
|
|
19
|
+
|
|
20
|
+
const AppICE = require('reactnative-plugin-appice');
|
|
21
|
+
const HelloWorldApp = () => {
|
|
22
|
+
const certs = [];
|
|
23
|
+
if (AppICE) {
|
|
24
|
+
console.log('AppICE is available');
|
|
25
|
+
AppICE.startContext(
|
|
26
|
+
// '5bebe93c25d705690ffbc758',
|
|
27
|
+
// '9e9ec60197c8373a11ac15ce4dae80e973608ab2',
|
|
28
|
+
// 'd985715d1bb48942d36d5d08de3b6a8c',
|
|
29
|
+
// '7a55ba2f-52c3-4d88-917d-0365e2f7c9cf',
|
|
30
|
+
// "US",
|
|
31
|
+
// "https://stagingapi.appice.io",
|
|
32
|
+
"5bebe93c25d705690ffbc758",
|
|
33
|
+
"9e9ec60197c8373a11ac15ce4dae80e973608ab2",
|
|
34
|
+
"844770e0edf3b795cd7508fa71789572",
|
|
35
|
+
"",
|
|
36
|
+
"US",
|
|
37
|
+
"https://a.appice.io",
|
|
38
|
+
|
|
39
|
+
certs);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
AppState.addEventListener('change', (nextAppState) => {
|
|
43
|
+
if (nextAppState === 'active') {
|
|
44
|
+
AppICE.isDeviceReady(true);
|
|
45
|
+
}
|
|
46
|
+
else if (nextAppState === 'background'){
|
|
47
|
+
// this state handle both backgroung and kill state
|
|
48
|
+
AppICE.isDeviceReady(false);
|
|
49
|
+
}
|
|
50
|
+
});
|
|
51
|
+
|
|
52
|
+
addAppICEAPIListeners();
|
|
53
|
+
return (
|
|
54
|
+
<View
|
|
55
|
+
style={{
|
|
56
|
+
flex: 1,
|
|
57
|
+
justifyContent: "center",
|
|
58
|
+
alignItems: "center",
|
|
59
|
+
marginBottom: 10,
|
|
60
|
+
|
|
61
|
+
}}>
|
|
62
|
+
<Text>AppICE React Demo</Text>
|
|
63
|
+
<Button
|
|
64
|
+
onPress={sendEvent}
|
|
65
|
+
title="Send Event"
|
|
66
|
+
color="#841584"
|
|
67
|
+
|
|
68
|
+
/>
|
|
69
|
+
<View
|
|
70
|
+
>
|
|
71
|
+
|
|
72
|
+
</View>
|
|
73
|
+
<Button
|
|
74
|
+
onPress={setUserProfile}
|
|
75
|
+
title="set User Profile"
|
|
76
|
+
color="#841584"
|
|
77
|
+
|
|
78
|
+
/>
|
|
79
|
+
|
|
80
|
+
<Button
|
|
81
|
+
onPress={setSampleUserID}
|
|
82
|
+
title="set Sample User ID"
|
|
83
|
+
color="#841584"
|
|
84
|
+
|
|
85
|
+
/>
|
|
86
|
+
<Button
|
|
87
|
+
onPress={setLanguage}
|
|
88
|
+
title="set Language"
|
|
89
|
+
color="#841584"
|
|
90
|
+
|
|
91
|
+
/>
|
|
92
|
+
<Button
|
|
93
|
+
onPress={sendView}
|
|
94
|
+
title="Send View"
|
|
95
|
+
color="#841584"
|
|
96
|
+
|
|
97
|
+
/>
|
|
98
|
+
<Button
|
|
99
|
+
onPress={getUserId}
|
|
100
|
+
title="getUserId"
|
|
101
|
+
color="#841584"
|
|
102
|
+
|
|
103
|
+
/>
|
|
104
|
+
<Button
|
|
105
|
+
onPress={getInboxMessage}
|
|
106
|
+
title="getInboxMessage"
|
|
107
|
+
color="#841584"
|
|
108
|
+
|
|
109
|
+
/>
|
|
110
|
+
<Button
|
|
111
|
+
onPress={getMessageCount}
|
|
112
|
+
title="getMessageCount"
|
|
113
|
+
color="#841584"
|
|
114
|
+
/>
|
|
115
|
+
<Button
|
|
116
|
+
onPress={getInboxMessageForId}
|
|
117
|
+
title="getInboxMessageForId"
|
|
118
|
+
color="#841584"
|
|
119
|
+
/>
|
|
120
|
+
<Button
|
|
121
|
+
onPress={updateInboxMessage}
|
|
122
|
+
title="updateInboxMessage"
|
|
123
|
+
color="#841584"
|
|
124
|
+
/>
|
|
125
|
+
<Button
|
|
126
|
+
onPress={synchronizeInbox}
|
|
127
|
+
title="synchronizeInbox"
|
|
128
|
+
color="#841584"
|
|
129
|
+
/>
|
|
130
|
+
</View>
|
|
131
|
+
)
|
|
132
|
+
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
function addAppICEAPIListeners() {
|
|
136
|
+
|
|
137
|
+
console.log('handleAppICETapEvent');
|
|
138
|
+
|
|
139
|
+
AppICE.addListener(AppICE.AppICEPushNotificationClicked, (event) => {
|
|
140
|
+
if (typeof event !== 'undefined'){
|
|
141
|
+
console.log('handleAppICETapEvent', AppICE.AppICEPushNotificationClicked, event.AppICEPushNotificationClicked);
|
|
142
|
+
AppICE.pushNotificationClicked(event.AppICEPushNotificationClicked);
|
|
143
|
+
//fetching custom data from push payload
|
|
144
|
+
var data = AppICE.getCustomDataFromPayload(event.AppICEPushNotificationClicked);
|
|
145
|
+
console.log(data);
|
|
146
|
+
}
|
|
147
|
+
});
|
|
148
|
+
|
|
149
|
+
AppICE.addListener(AppICE.AppICEInAppClicked, (event) => {
|
|
150
|
+
if (typeof event !== 'undefined'){
|
|
151
|
+
console.log('handleAppICETapEvent', AppICE.AppICEInAppClicked, event.AppICEInAppClicked);
|
|
152
|
+
// AppICE.pushNotificationClicked(event.AppICEInAppClicked);
|
|
153
|
+
}
|
|
154
|
+
});
|
|
155
|
+
}
|
|
156
|
+
const sendEvent = () => {
|
|
157
|
+
console.log("inside sendEvent");
|
|
158
|
+
var dataObj = {
|
|
159
|
+
"ClickedMenuBtn": "false",
|
|
160
|
+
"CLickedSubmitBtn": "false",
|
|
161
|
+
"AppName": "ReactSampleApp"
|
|
162
|
+
};
|
|
163
|
+
AppICE.tagEvent("ReactSampleApp", dataObj);
|
|
164
|
+
//Recording an Event
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
|
|
168
|
+
const setUserProfile = () => {
|
|
169
|
+
AppICE.setUser({
|
|
170
|
+
[AppICE.name]: 'testUserA1', [AppICE.phone]: '123456', [AppICE.email]: 'test@test.com', [AppICE.age]: 23
|
|
171
|
+
});
|
|
172
|
+
};
|
|
173
|
+
|
|
174
|
+
const setSampleUserID = () => {
|
|
175
|
+
AppICE.setUserId(['1232323','kuOEN8bCqdrROmJPVCeKSg==']);
|
|
176
|
+
|
|
177
|
+
};
|
|
178
|
+
|
|
179
|
+
const setLanguage = () => {
|
|
180
|
+
AppICE.setCustomVariable("_lang", "ar-AE");
|
|
181
|
+
|
|
182
|
+
|
|
183
|
+
AppICE.sendClickCallback((value) => {
|
|
184
|
+
console.log(`INAPP callback`, value);
|
|
185
|
+
});
|
|
186
|
+
|
|
187
|
+
};
|
|
188
|
+
const sendView = () => {
|
|
189
|
+
AppICE.tagEvent("HomeScreen", {});
|
|
190
|
+
};
|
|
191
|
+
|
|
192
|
+
const getUserId = () => {
|
|
193
|
+
AppICE.getUserId((userIds: any[]) => {
|
|
194
|
+
console.log('User IDs:', userIds);
|
|
195
|
+
});
|
|
196
|
+
};
|
|
197
|
+
|
|
198
|
+
const type = 1;
|
|
199
|
+
const userIds = ['1232323' , 'kuOEN8bCqdrROmJPVCeKSg=='];
|
|
200
|
+
|
|
201
|
+
const getInboxMessage = () => {
|
|
202
|
+
AppICE.getInboxMessages(type, userIds, (inboxMessages: any[]) => {
|
|
203
|
+
console.log('Received Inbox Messages:', inboxMessages);
|
|
204
|
+
|
|
205
|
+
inboxMessages.forEach((message) => {
|
|
206
|
+
const mediaKey = 'imageUrl';
|
|
207
|
+
AppICE.getMediaData(message, mediaKey, (mediaData: any) => {
|
|
208
|
+
console.log('Media Data:', mediaData);
|
|
209
|
+
|
|
210
|
+
AppICE.getMediaUrl(mediaData,(mediaUrl:any) => {
|
|
211
|
+
console.log('getMediaUrl is :', mediaUrl);
|
|
212
|
+
});
|
|
213
|
+
|
|
214
|
+
AppICE.getMediaType(mediaData,(mediaType:any) => {
|
|
215
|
+
console.log('getmediaType is:', mediaType);
|
|
216
|
+
});
|
|
217
|
+
|
|
218
|
+
AppICE.getMediaThumbnail(mediaData,(mediaThumbnail:any) => {
|
|
219
|
+
console.log('getMediaThumbnail is:', mediaThumbnail);
|
|
220
|
+
});
|
|
221
|
+
});
|
|
222
|
+
|
|
223
|
+
});
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
const getMessageCount = () => {
|
|
227
|
+
AppICE.getMessageCount(type, userIds, (count: number) => {
|
|
228
|
+
console.log('Messages count :', count);
|
|
229
|
+
});
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
|
|
233
|
+
const getInboxMessageForId = () => {
|
|
234
|
+
const messageId = "df73e314-2a61-4615-9fa5-348419e3fc82";
|
|
235
|
+
const userIds = ['1232323' , 'kuOEN8bCqdrROmJPVCeKSg=='];
|
|
236
|
+
|
|
237
|
+
AppICE.getInboxMessageForId(messageId, userIds, (inboxMessage: any) => {
|
|
238
|
+
console.log('getInboxMessageForId in JS:', inboxMessage);
|
|
239
|
+
});
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
|
|
243
|
+
|
|
244
|
+
const updateInboxMessage = () => {
|
|
245
|
+
const messageId = "df73e314-2a61-4615-9fa5-348419e3fc82";
|
|
246
|
+
const userId = ['1232323' , 'kuOEN8bCqdrROmJPVCeKSg=='];
|
|
247
|
+
AppICE.updateInboxMessage(messageId, 1, userId, (isSuccess: boolean) => {
|
|
248
|
+
console.log('Update Inbox Message Success:', isSuccess);
|
|
249
|
+
});
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
|
|
253
|
+
|
|
254
|
+
const synchronizeInbox = () => {
|
|
255
|
+
AppICE.synchronizeInbox(10, (success: boolean) => {
|
|
256
|
+
console.log('Inbox synchronization success:', success);
|
|
257
|
+
const userIds = ['1232323' , 'kuOEN8bCqdrROmJPVCeKSg=='];
|
|
258
|
+
AppICE.getInboxMessages( 1, userIds, (inboxMessages: any[]) => {
|
|
259
|
+
console.log('Inbox Messages:', inboxMessages);
|
|
260
|
+
// everytime will return next set of data from payload
|
|
261
|
+
// var inbox = getInboxFilteredData (inbox, key= "Transaction", limit=10, offset=1 );
|
|
262
|
+
});
|
|
263
|
+
|
|
264
|
+
});
|
|
265
|
+
}
|
|
266
|
+
|
|
267
|
+
const getUserData = () => {
|
|
268
|
+
AppICE.synchronizeData(10,(success: boolean) => {
|
|
269
|
+
console.log('Profile synchronization success:', success);
|
|
270
|
+
Alert.alert(`synchronizeData: \n ${success}`);
|
|
271
|
+
const userIds = ['160840156'];
|
|
272
|
+
AppICE.getUserForIds(userIds, (res:any[]) => {
|
|
273
|
+
|
|
274
|
+
console.log('Receive getUser:', res);
|
|
275
|
+
for (var index = 0; index < res.length; index++) {
|
|
276
|
+
let userData = res[index];
|
|
277
|
+
console.log('Received Inbox:', userData);
|
|
278
|
+
const name = userData[AppICE.name];
|
|
279
|
+
const phone = userData[AppICE.phone];
|
|
280
|
+
const gender = userData[AppICE.gender];
|
|
281
|
+
const dob = userData[AppICE.dob];
|
|
282
|
+
const edt = userData[AppICE.educationType];
|
|
283
|
+
const email = userData[AppICE.email];
|
|
284
|
+
const employment = userData[AppICE.employmentType];
|
|
285
|
+
const age = userData[AppICE.age];
|
|
286
|
+
const marriage = userData[AppICE.married];
|
|
287
|
+
const isEmployed = userData[AppICE.isEmployed];
|
|
288
|
+
|
|
289
|
+
console.log('GetUser name:', name);
|
|
290
|
+
console.log('GetUser phone:', phone);
|
|
291
|
+
console.log('GetUser gender:', gender);
|
|
292
|
+
console.log('GetUser dob:', dob);
|
|
293
|
+
console.log('GetUser educationType:', edt);
|
|
294
|
+
console.log('GetUser email:', email);
|
|
295
|
+
console.log('GetUser employment:', employment);
|
|
296
|
+
console.log('GetUser age:', age);
|
|
297
|
+
console.log('GetUser marriage:', marriage);
|
|
298
|
+
console.log('GetUser isEmployed:', isEmployed);
|
|
299
|
+
|
|
300
|
+
|
|
301
|
+
const customProperties = userData[AppICE.DEMOGRAPHIC_INFO];
|
|
302
|
+
const customPropertiesObj = JSON.parse(customProperties);
|
|
303
|
+
console.log("user Profile, top_n_product_viewed = "+customPropertiesObj[AppICE.TOP_N_PRODUCTS_VIEWED]);
|
|
304
|
+
|
|
305
|
+
}
|
|
306
|
+
});
|
|
307
|
+
});
|
|
308
|
+
}
|
|
309
|
+
|
|
310
|
+
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
|
+
});
|