reactnative-plugin-appice 1.7.10 → 1.7.12
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/android/build.gradle +1 -2
- package/android/src/main/AndroidManifest.xml +0 -1
- package/android/src/main/java/com/reactlibrary/AppICEUtils.java +55 -10
- package/android/src/main/java/com/reactlibrary/AppIceReactPluginModule.java +108 -57
- package/android/src/main/java/com/reactlibrary/EnumConstants.java +2 -5
- package/android/src/main/java/com/reactlibrary/StringConstants.java +8 -3
- package/example/App.js +181 -218
- package/example/HelloWorldApp.js +483 -0
- package/example/ancilliary.js +327 -0
- package/example/android/app/build.gradle +2 -0
- package/example/android/app/google-services.json +275 -0
- package/example/android/app/src/main/java/com/example/MainApplication.java +4 -0
- package/example/android/build.gradle +20 -0
- package/example/android/local.properties +8 -0
- package/example/package-lock.json +16722 -0
- package/example/package.json +1 -1
- package/index.js +1 -1
- package/ios/AppIceReactPlugin.m +2 -2
- package/package.json +1 -1
- package/example/android/.gradle/7.3.3/checksums/checksums.lock +0 -0
- package/example/android/.gradle/7.3.3/fileChanges/last-build.bin +0 -0
- package/example/android/.gradle/7.3.3/fileHashes/fileHashes.lock +0 -0
- package/example/android/.gradle/7.3.3/gc.properties +0 -0
- package/example/android/.gradle/vcs-1/gc.properties +0 -0
- package/example/yarn.lock +0 -7176
package/example/App.js
CHANGED
|
@@ -9,272 +9,230 @@
|
|
|
9
9
|
import React from 'react';
|
|
10
10
|
import { Alert,
|
|
11
11
|
Text,
|
|
12
|
-
Platform,
|
|
13
|
-
Image,
|
|
14
|
-
Linking,
|
|
15
12
|
Button,
|
|
16
|
-
|
|
17
|
-
|
|
13
|
+
View,
|
|
14
|
+
AppState
|
|
18
15
|
} from 'react-native';
|
|
19
|
-
|
|
16
|
+
|
|
17
|
+
import { getInboxMessages, getMessageCounts, setUser, updatedInboxMessage } from './ancilliary';
|
|
20
18
|
const AppICE = require('reactnative-plugin-appice');
|
|
21
19
|
const HelloWorldApp = () => {
|
|
22
|
-
const certs = [];
|
|
20
|
+
const certs: never[] = [];
|
|
23
21
|
if (AppICE) {
|
|
24
22
|
console.log('AppICE is available');
|
|
23
|
+
AppICE.preInitialise();
|
|
24
|
+
console.log('preInitialize completed');
|
|
25
|
+
|
|
25
26
|
AppICE.startContext(
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
else if (nextAppState === 'background'){
|
|
47
|
-
// this state handle both backgroung and kill state
|
|
48
|
-
AppICE.isDeviceReady(false);
|
|
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
|
+
|
|
49
47
|
}
|
|
50
|
-
});
|
|
51
48
|
|
|
52
|
-
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
|
|
53
53
|
return (
|
|
54
54
|
<View
|
|
55
55
|
style={{
|
|
56
56
|
flex: 1,
|
|
57
|
-
justifyContent:
|
|
58
|
-
alignItems:
|
|
57
|
+
justifyContent: 'center',
|
|
58
|
+
alignItems: 'center',
|
|
59
59
|
marginBottom: 10,
|
|
60
|
-
|
|
61
60
|
}}>
|
|
62
61
|
<Text>AppICE React Demo</Text>
|
|
63
|
-
<Button
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
/>
|
|
69
|
-
<
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
<Button
|
|
74
|
-
|
|
75
|
-
|
|
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
|
-
/>
|
|
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" />
|
|
130
75
|
</View>
|
|
131
|
-
)
|
|
76
|
+
);
|
|
132
77
|
|
|
133
78
|
}
|
|
134
79
|
|
|
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
80
|
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
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
|
+
);
|
|
155
110
|
}
|
|
156
111
|
const sendEvent = () => {
|
|
157
|
-
console.log(
|
|
112
|
+
console.log('inside sendEvent');
|
|
158
113
|
var dataObj = {
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
114
|
+
ClickedMenuBtn: 'false',
|
|
115
|
+
CLickedSubmitBtn: 'false',
|
|
116
|
+
AppName: 'ReactSampleApp',
|
|
162
117
|
};
|
|
163
|
-
AppICE.tagEvent(
|
|
164
|
-
|
|
165
|
-
}
|
|
166
|
-
|
|
118
|
+
AppICE.tagEvent('ReactSampleApp', dataObj);
|
|
119
|
+
};
|
|
167
120
|
|
|
168
121
|
const setUserProfile = () => {
|
|
169
|
-
AppICE.
|
|
170
|
-
|
|
171
|
-
|
|
122
|
+
var user = AppICE.User("Amit@getstream.io")
|
|
123
|
+
console.log("userid user "+user)
|
|
124
|
+
AppICE.setUser(user);
|
|
172
125
|
};
|
|
173
126
|
|
|
174
127
|
const setSampleUserID = () => {
|
|
175
|
-
|
|
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", {});
|
|
128
|
+
AppICE.setUserId(['181166344']);
|
|
190
129
|
};
|
|
191
130
|
|
|
192
131
|
const getUserId = () => {
|
|
193
132
|
AppICE.getUserId((userIds: any[]) => {
|
|
194
133
|
console.log('User IDs:', userIds);
|
|
134
|
+
const inboxMessageString = JSON.stringify(userIds, null, 2);
|
|
135
|
+
|
|
136
|
+
Alert.alert(`getInboxMessageForId: \n ${inboxMessageString}`);
|
|
195
137
|
});
|
|
196
138
|
};
|
|
197
139
|
|
|
198
|
-
const
|
|
199
|
-
|
|
140
|
+
const setLanguage = () => {
|
|
141
|
+
AppICE.setCustomVariable('_lang', 'ar-AE');
|
|
142
|
+
};
|
|
200
143
|
|
|
201
|
-
const
|
|
202
|
-
|
|
203
|
-
|
|
144
|
+
const getUserDetails = () => {
|
|
145
|
+
console.log('GET USER Details:');
|
|
146
|
+
AppICE.getUser((user: any) => {
|
|
147
|
+
const inboxMessageString = JSON.stringify(user);
|
|
148
|
+
console.log('GET USER Details:' + inboxMessageString);
|
|
149
|
+
});
|
|
150
|
+
};
|
|
151
|
+
const getUser = () => {
|
|
152
|
+
console.log('GET USER:');
|
|
204
153
|
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
154
|
+
const userData = AppICE.getUser((res: any) => {
|
|
155
|
+
if (res) {
|
|
156
|
+
var response;
|
|
157
|
+
const resData = JSON.stringify(res);
|
|
158
|
+
console.log('res ' + resData);
|
|
209
159
|
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
});
|
|
160
|
+
const data = JSON.parse(resData);
|
|
161
|
+
response = data;
|
|
213
162
|
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
163
|
+
const customProperties = response[AppICE.DEMOGRAPHIC_INFO];
|
|
164
|
+
console.log('customProperties ' + customProperties);
|
|
165
|
+
}
|
|
166
|
+
});
|
|
167
|
+
};
|
|
217
168
|
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
169
|
+
function callbackInApp(payload: any) {
|
|
170
|
+
console.log('Call BAck payload:', payload);
|
|
171
|
+
|
|
172
|
+
if (payload) {
|
|
173
|
+
const screen = JSON.parse(payload);
|
|
174
|
+
console.log('Call BAck Screen:', screen);
|
|
175
|
+
}
|
|
224
176
|
}
|
|
225
177
|
|
|
226
|
-
const
|
|
227
|
-
|
|
228
|
-
|
|
178
|
+
const getInboxMessage = () => {
|
|
179
|
+
console.log('Call getInboxMessage');
|
|
180
|
+
const userId = ['181166344'];
|
|
181
|
+
getInboxMessages(1, userId, 'Alerts', 10, 0, 10, false, (result: any) => {
|
|
182
|
+
console.log('Inbox data set: ', result);
|
|
183
|
+
Alert.alert(`Inbox Data: \n ${result}`);
|
|
229
184
|
});
|
|
230
|
-
|
|
185
|
+
};
|
|
231
186
|
|
|
232
|
-
|
|
233
|
-
const
|
|
234
|
-
|
|
235
|
-
|
|
187
|
+
const getMessageCount = () => {
|
|
188
|
+
const userId = ['181166344'];
|
|
189
|
+
const count = getMessageCounts(1, userId, 10, (result: number) => {
|
|
190
|
+
Alert.alert(`getMessageCounts count : \n ${result}`);
|
|
191
|
+
console.log(count);
|
|
192
|
+
});
|
|
193
|
+
};
|
|
236
194
|
|
|
237
|
-
AppICE.getInboxMessageForId(messageId, userIds, (inboxMessage: any) => {
|
|
238
|
-
console.log('getInboxMessageForId in JS:', inboxMessage);
|
|
239
|
-
});
|
|
240
|
-
}
|
|
241
195
|
|
|
242
|
-
|
|
196
|
+
const getInboxMessageForId = () => {
|
|
197
|
+
console.log('call getInboxMessageForId Entry:');
|
|
198
|
+
const messageId = '1715782030369-3894c943-b47d-456c-b530-7c2eb8820af4';
|
|
199
|
+
const useIds = '181166344';
|
|
243
200
|
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
console.log('Update Inbox Message Success:', isSuccess);
|
|
249
|
-
});
|
|
250
|
-
}
|
|
201
|
+
AppICE.getInboxMessageForId(messageId, useIds, (inboxMessage: any) => {
|
|
202
|
+
console.log('getInboxMessageForId in JS:', inboxMessage);
|
|
203
|
+
});
|
|
204
|
+
};
|
|
251
205
|
|
|
252
|
-
|
|
206
|
+
const updateInboxMessage = () => {
|
|
207
|
+
const messageId = '1715782030369-3894c943-b47d-456c-b530-7c2eb8820af4';
|
|
208
|
+
updatedInboxMessage(messageId, 3, '181166344', (result: boolean) => {
|
|
209
|
+
Alert.alert("Update Inbox Result : "+result
|
|
210
|
+
);
|
|
211
|
+
});
|
|
212
|
+
};
|
|
253
213
|
|
|
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
214
|
|
|
215
|
+
const synchronizeInbox = () => {
|
|
216
|
+
AppICE.synchronizeInbox(10, (success: boolean) => {
|
|
217
|
+
console.log('Inbox synchronization success:', success);
|
|
218
|
+
const useIds = ['181166344'];
|
|
219
|
+
AppICE.getInboxMessages(1, useIds, (inboxMessages: any[]) => {
|
|
220
|
+
console.log('Inbox Messages:', inboxMessages);
|
|
264
221
|
});
|
|
265
|
-
}
|
|
222
|
+
});
|
|
223
|
+
};
|
|
266
224
|
|
|
267
|
-
|
|
268
|
-
AppICE.synchronizeData(
|
|
269
|
-
console.log('Profile
|
|
225
|
+
const getUserData = () => {
|
|
226
|
+
AppICE.synchronizeData(100, (success: boolean) => {
|
|
227
|
+
console.log('Profile synchronizeData success:', success);
|
|
270
228
|
Alert.alert(`synchronizeData: \n ${success}`);
|
|
271
|
-
const userIds = ['
|
|
272
|
-
AppICE.getUserForIds(userIds, (res:any
|
|
273
|
-
|
|
274
|
-
|
|
229
|
+
const userIds = ['181166344'];
|
|
230
|
+
AppICE.getUserForIds(userIds, (res: any) => {
|
|
231
|
+
console.log('Receive getUser:', res);
|
|
232
|
+
Alert.alert('Receive getUser Alert:' + JSON.stringify(res));
|
|
275
233
|
for (var index = 0; index < res.length; index++) {
|
|
276
234
|
let userData = res[index];
|
|
277
|
-
console.log('Received Inbox:', userData);
|
|
235
|
+
console.log('Received Inbox:', userData);
|
|
278
236
|
const name = userData[AppICE.name];
|
|
279
237
|
const phone = userData[AppICE.phone];
|
|
280
238
|
const gender = userData[AppICE.gender];
|
|
@@ -286,25 +244,30 @@ const getMessageCount = () => {
|
|
|
286
244
|
const marriage = userData[AppICE.married];
|
|
287
245
|
const isEmployed = userData[AppICE.isEmployed];
|
|
288
246
|
|
|
289
|
-
console.log('GetUser
|
|
290
|
-
console.log('GetUser
|
|
247
|
+
console.log('GetUser Name:', name);
|
|
248
|
+
console.log('GetUser PHONE:', phone);
|
|
291
249
|
console.log('GetUser gender:', gender);
|
|
292
250
|
console.log('GetUser dob:', dob);
|
|
293
|
-
console.log('GetUser
|
|
251
|
+
console.log('GetUser edt:', edt);
|
|
294
252
|
console.log('GetUser email:', email);
|
|
295
253
|
console.log('GetUser employment:', employment);
|
|
296
254
|
console.log('GetUser age:', age);
|
|
297
255
|
console.log('GetUser marriage:', marriage);
|
|
298
|
-
console.log('GetUser
|
|
299
|
-
|
|
256
|
+
console.log('GetUser ISEMPLOYED:', isEmployed);
|
|
300
257
|
|
|
301
258
|
const customProperties = userData[AppICE.DEMOGRAPHIC_INFO];
|
|
302
|
-
const customPropertiesObj = JSON.parse(customProperties);
|
|
303
|
-
console.log(
|
|
304
|
-
|
|
305
|
-
|
|
259
|
+
const customPropertiesObj = JSON.parse(customProperties);
|
|
260
|
+
console.log(
|
|
261
|
+
'customPropertiesObj ' + JSON.stringify(customPropertiesObj),
|
|
262
|
+
);
|
|
263
|
+
|
|
264
|
+
console.log(
|
|
265
|
+
'user Profile, top_n_product_viewed = ' +
|
|
266
|
+
customPropertiesObj[AppICE.TOP_N_PRODUCTS_VIEWED],
|
|
267
|
+
);
|
|
268
|
+
}
|
|
306
269
|
});
|
|
307
270
|
});
|
|
308
|
-
}
|
|
271
|
+
};
|
|
309
272
|
|
|
310
273
|
export default HelloWorldApp;
|