reactnative-plugin-appice 1.6.3 → 1.6.4
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 -1
- package/android/src/main/java/com/reactlibrary/AppICEUtils.java +213 -0
- package/android/src/main/java/com/reactlibrary/AppIceReactPluginModule.java +185 -190
- package/android/src/main/java/com/reactlibrary/CampaignCampsReceiver.java +6 -11
- package/android/src/main/java/com/reactlibrary/Constants.java +42 -0
- package/example/App.js +76 -0
- package/example/package.json +1 -1
- package/index.js +98 -10
- package/ios/AppIceReactPlugin.h +11 -0
- package/ios/AppIceReactPlugin.m +147 -1
- package/ios/AppIceReactPlugin.xcodeproj/xcuserdata/artherajesh.xcuserdatad/xcschemes/xcschememanagement.plist +14 -0
- package/ios/AppIceReactPlugin.xcworkspace/xcuserdata/artherajesh.xcuserdatad/UserInterfaceState.xcuserstate +0 -0
- package/ios/Pods/Pods.xcodeproj/xcuserdata/artherajesh.xcuserdatad/xcschemes/xcschememanagement.plist +14 -0
- package/package.json +1 -1
- package/android/src/main/java/com/reactlibrary/ClickCallback.java +0 -5
- package/android/src/main/java/com/reactlibrary/InAppWebView.java +0 -68
package/example/App.js
CHANGED
|
@@ -89,6 +89,32 @@ addAppICEAPIListeners();
|
|
|
89
89
|
color="#841584"
|
|
90
90
|
|
|
91
91
|
/>
|
|
92
|
+
<Button
|
|
93
|
+
onPress={getInboxMessage}
|
|
94
|
+
title="getInboxMessage"
|
|
95
|
+
color="#841584"
|
|
96
|
+
|
|
97
|
+
/>
|
|
98
|
+
<Button
|
|
99
|
+
onPress={getMessageCount}
|
|
100
|
+
title="getMessageCount"
|
|
101
|
+
color="#841584"
|
|
102
|
+
/>
|
|
103
|
+
<Button
|
|
104
|
+
onPress={getInboxMessageForId}
|
|
105
|
+
title="getInboxMessageForId"
|
|
106
|
+
color="#841584"
|
|
107
|
+
/>
|
|
108
|
+
<Button
|
|
109
|
+
onPress={updateInboxMessage}
|
|
110
|
+
title="updateInboxMessage"
|
|
111
|
+
color="#841584"
|
|
112
|
+
/>
|
|
113
|
+
<Button
|
|
114
|
+
onPress={synchronizeInbox}
|
|
115
|
+
title="synchronizeInbox"
|
|
116
|
+
color="#841584"
|
|
117
|
+
/>
|
|
92
118
|
</View>
|
|
93
119
|
)
|
|
94
120
|
|
|
@@ -157,4 +183,54 @@ const getUserId = () => {
|
|
|
157
183
|
});
|
|
158
184
|
};
|
|
159
185
|
|
|
186
|
+
const type = 1;
|
|
187
|
+
const userIds = ['1232323' , 'kuOEN8bCqdrROmJPVCeKSg=='];
|
|
188
|
+
|
|
189
|
+
const getInboxMessage = () => {
|
|
190
|
+
AppICE.getInboxMessages(type, userIds, (inboxMessages: any[]) => {
|
|
191
|
+
console.log('Received Inbox Messages:', inboxMessages);
|
|
192
|
+
});
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
const getMessageCount = () => {
|
|
196
|
+
AppICE.getMessageCount(type, userIds, (count: number) => {
|
|
197
|
+
console.log('Messages count :', count);
|
|
198
|
+
});
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
|
|
202
|
+
const getInboxMessageForId = () => {
|
|
203
|
+
const messageId = "df73e314-2a61-4615-9fa5-348419e3fc82";
|
|
204
|
+
const userIds = ['1232323' , 'kuOEN8bCqdrROmJPVCeKSg=='];
|
|
205
|
+
|
|
206
|
+
AppICE.getInboxMessageForId(messageId, userIds, (inboxMessage: any) => {
|
|
207
|
+
console.log('getInboxMessageForId in JS:', inboxMessage);
|
|
208
|
+
});
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
|
|
212
|
+
|
|
213
|
+
const updateInboxMessage = () => {
|
|
214
|
+
const messageId = "df73e314-2a61-4615-9fa5-348419e3fc82";
|
|
215
|
+
const userId = ['1232323' , 'kuOEN8bCqdrROmJPVCeKSg=='];
|
|
216
|
+
AppICE.updateInboxMessage(messageId, 1, userId, (isSuccess: boolean) => {
|
|
217
|
+
console.log('Update Inbox Message Success:', isSuccess);
|
|
218
|
+
});
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
|
|
222
|
+
|
|
223
|
+
const synchronizeInbox = () => {
|
|
224
|
+
AppICE.synchronizeInbox(10, (success: boolean) => {
|
|
225
|
+
console.log('Inbox synchronization success:', success);
|
|
226
|
+
const userIds = ['1232323' , 'kuOEN8bCqdrROmJPVCeKSg=='];
|
|
227
|
+
AppICE.getInboxMessages( 1, userIds, (inboxMessages: any[]) => {
|
|
228
|
+
console.log('Inbox Messages:', inboxMessages);
|
|
229
|
+
// everytime will return next set of data from payload
|
|
230
|
+
// var inbox = getInboxFilteredData (inbox, key= "Transaction", limit=10, offset=1 );
|
|
231
|
+
});
|
|
232
|
+
|
|
233
|
+
});
|
|
234
|
+
}
|
|
235
|
+
|
|
160
236
|
export default HelloWorldApp;
|
package/example/package.json
CHANGED
package/index.js
CHANGED
|
@@ -3,7 +3,6 @@ import { Platform, Component } from 'react-native';
|
|
|
3
3
|
|
|
4
4
|
const AppIceReactPlugin = NativeModules.AppIceReactPlugin;
|
|
5
5
|
var eventEmitter;
|
|
6
|
-
|
|
7
6
|
if(Platform.OS === 'ios')
|
|
8
7
|
{
|
|
9
8
|
eventEmitter = NativeModules.AppICEReactEvent ? new NativeEventEmitter(NativeModules.AppICEReactEvent) : DeviceEventEmitter;
|
|
@@ -13,8 +12,13 @@ else
|
|
|
13
12
|
eventEmitter = new NativeEventEmitter(NativeModules.AppIceReactPlugin);
|
|
14
13
|
}
|
|
15
14
|
var AppICEReact = {
|
|
15
|
+
// Push Notification
|
|
16
16
|
AppICEPushNotificationClicked: AppIceReactPlugin.AppICEPushNotificationClicked,
|
|
17
|
+
|
|
18
|
+
// InApp Notification
|
|
17
19
|
AppICEInAppClicked: AppIceReactPlugin.AppICEInAppClicked,
|
|
20
|
+
|
|
21
|
+
// User Profile
|
|
18
22
|
name: AppIceReactPlugin.n,
|
|
19
23
|
email: AppIceReactPlugin.em,
|
|
20
24
|
phone: AppIceReactPlugin.ph,
|
|
@@ -26,6 +30,17 @@ var AppICEReact = {
|
|
|
26
30
|
isEmployed: AppIceReactPlugin.is_emp,
|
|
27
31
|
validateIntegration: AppIceReactPlugin.validateIntegration,
|
|
28
32
|
|
|
33
|
+
// App Inbox
|
|
34
|
+
INBOX_MESSAGE: AppIceReactPlugin.INBOX_MESSAGE,
|
|
35
|
+
INBOX_TITLE : AppIceReactPlugin.INBOX_TITLE,
|
|
36
|
+
INBOX_MESSAGE_STATUS: AppIceReactPlugin.INBOX_MESSAGE_STATUS,
|
|
37
|
+
INBOX_CAMPAIGN_TYPE :AppIceReactPlugin.INBOX_CAMPAIGN_TYPE,
|
|
38
|
+
INBOX_MESSAGE_LANGUAGE: AppIceReactPlugin.INBOX_MESSAGE_LANGUAGE,
|
|
39
|
+
INBOX_MESSAGE_ID : AppIceReactPlugin.INBOX_MESSAGE_ID,
|
|
40
|
+
INBOX_CAMPAIGN_ID : AppIceReactPlugin.INBOX_CAMPAIGN_ID,
|
|
41
|
+
INBOX_MESSAGE_ICON : AppIceReactPlugin.INBOX_MESSAGE_ICON,
|
|
42
|
+
INBOX_CUSTOM_DATA: AppIceReactPlugin.INBOX_CUSTOM_DATA,
|
|
43
|
+
|
|
29
44
|
|
|
30
45
|
/**
|
|
31
46
|
* add all of the registered listeners for given eventName.
|
|
@@ -50,7 +65,19 @@ var AppICEReact = {
|
|
|
50
65
|
}
|
|
51
66
|
},
|
|
52
67
|
|
|
53
|
-
|
|
68
|
+
/**
|
|
69
|
+
* call this function before clearing old data from db/keychain
|
|
70
|
+
*/
|
|
71
|
+
preInitialise: function(){
|
|
72
|
+
this.getDeviceId(( res ) =>
|
|
73
|
+
{
|
|
74
|
+
if(res){
|
|
75
|
+
this.setInternalId(res);
|
|
76
|
+
}
|
|
77
|
+
});
|
|
78
|
+
},
|
|
79
|
+
|
|
80
|
+
/**
|
|
54
81
|
* Meta data of the apps that is needed for sdk setting
|
|
55
82
|
* @param {string} appID - meta key
|
|
56
83
|
* @param {string} appKey - meta key
|
|
@@ -66,10 +93,8 @@ var AppICEReact = {
|
|
|
66
93
|
this.getDeviceId(( res ) =>
|
|
67
94
|
{
|
|
68
95
|
if(res){
|
|
69
|
-
console.log('Res variable'+res);
|
|
70
96
|
AppIceReactPlugin.startContext(appID, appKey, apiKey, res, region, baseUrl, certs)
|
|
71
97
|
}else{
|
|
72
|
-
console.log('deviceID variable'+deviceID);
|
|
73
98
|
AppIceReactPlugin.startContext(appID, appKey, apiKey, deviceID, region, baseUrl, certs)
|
|
74
99
|
}
|
|
75
100
|
});
|
|
@@ -85,7 +110,7 @@ var AppICEReact = {
|
|
|
85
110
|
AppIceReactPlugin.tagEvent(eventName, props);
|
|
86
111
|
},
|
|
87
112
|
|
|
88
|
-
|
|
113
|
+
/**
|
|
89
114
|
* Record an click event
|
|
90
115
|
* @param {string} eventName - the name of the event
|
|
91
116
|
*/
|
|
@@ -108,7 +133,6 @@ var AppICEReact = {
|
|
|
108
133
|
* @param {object} profile - key-value profile properties. keys are strings and values can be string, number or boolean.
|
|
109
134
|
*/
|
|
110
135
|
setUser: function (profile) {
|
|
111
|
-
console.log(profile);
|
|
112
136
|
AppIceReactPlugin.setUser(profile);
|
|
113
137
|
},
|
|
114
138
|
|
|
@@ -149,9 +173,7 @@ var AppICEReact = {
|
|
|
149
173
|
|
|
150
174
|
this.getDeviceId(( res ) =>
|
|
151
175
|
{
|
|
152
|
-
|
|
153
176
|
if(res){
|
|
154
|
-
console.log('setInternalId');
|
|
155
177
|
this.setInternalId(res);
|
|
156
178
|
}
|
|
157
179
|
});
|
|
@@ -169,11 +191,77 @@ var AppICEReact = {
|
|
|
169
191
|
setInternalId: function (deviceId){
|
|
170
192
|
AppIceReactPlugin.setInternalId(deviceId);
|
|
171
193
|
},
|
|
172
|
-
|
|
194
|
+
|
|
195
|
+
//===============================================
|
|
196
|
+
// AppInbox
|
|
197
|
+
//===============================================
|
|
198
|
+
|
|
199
|
+
/**
|
|
200
|
+
* Get inbox messages list.
|
|
201
|
+
*
|
|
202
|
+
* @param type the message type
|
|
203
|
+
* 1 = ALL
|
|
204
|
+
* 2 = UNREAD
|
|
205
|
+
* 3 = READ
|
|
206
|
+
* 4 = VIEWED
|
|
207
|
+
* 5 = DELETED
|
|
208
|
+
* @param userIds the same way we are passing the value in setUserId same value we need here. ie. [ "useridA" ]
|
|
209
|
+
* @callback will have the string json array
|
|
210
|
+
*/
|
|
211
|
+
getInboxMessages: function(type, userIds, callback){
|
|
212
|
+
callWithCallback('getInboxMessages', [type, userIds], callback);
|
|
213
|
+
},
|
|
214
|
+
|
|
215
|
+
|
|
216
|
+
/**
|
|
217
|
+
* Get inbox messages count.
|
|
218
|
+
*
|
|
219
|
+
* @param type the message type is integer
|
|
220
|
+
* 1 = ALL
|
|
221
|
+
* 2 = UNREAD
|
|
222
|
+
* 3 = READ
|
|
223
|
+
* 4 = VIEWED
|
|
224
|
+
* 5 = DELETED
|
|
225
|
+
* @param userIds the same way we are passing the value in setUserId same value we need here. ie. [ "useridA" ]
|
|
226
|
+
* @callback will have the integer
|
|
227
|
+
*/
|
|
228
|
+
getMessageCount: function(type, userIds, callback){
|
|
229
|
+
callWithCallback('getMessageCount', [type, userIds], callback);
|
|
230
|
+
},
|
|
231
|
+
|
|
232
|
+
/**
|
|
233
|
+
* Get messages payload based on message id.
|
|
234
|
+
*
|
|
235
|
+
* @param messageId - message id of the notification
|
|
236
|
+
* @param userId - single userid in string ie. "useridA"
|
|
237
|
+
* @callback will have the json object
|
|
238
|
+
*/
|
|
239
|
+
getInboxMessageForId: function(messageId, userId, callback){
|
|
240
|
+
callWithCallback('getMessageCount', [messageId, userId], callback);
|
|
241
|
+
},
|
|
242
|
+
|
|
243
|
+
/**
|
|
244
|
+
* update message status ex. UNREAD to READ.
|
|
245
|
+
*
|
|
246
|
+
* @param messageId - message id of the notification
|
|
247
|
+
* @param type - integer value for status
|
|
248
|
+
* @param userId - single userid in string
|
|
249
|
+
* @callback will have the boolean
|
|
250
|
+
*/
|
|
251
|
+
updateInboxMessage: function(messageId, type, userId, callback){
|
|
252
|
+
callWithCallback('updateInboxMessage', [messageId, type, userId], callback);
|
|
253
|
+
},
|
|
254
|
+
|
|
255
|
+
synchronizeInbox: function( timeout, callback){
|
|
256
|
+
callWithCallback('synchronizeInbox', [timeout], callback)
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
//========================================
|
|
260
|
+
|
|
173
261
|
};
|
|
174
262
|
|
|
175
263
|
// internal function for callback
|
|
176
|
-
|
|
264
|
+
function callWithCallback(method, args, callback) {
|
|
177
265
|
if (typeof callback === 'undefined' || callback == null || typeof callback !== 'function') {
|
|
178
266
|
callback = (err, res) => {
|
|
179
267
|
defaultCallback(method, err, res);
|
package/ios/AppIceReactPlugin.h
CHANGED
|
@@ -14,6 +14,17 @@ static NSString *const km = @"m";
|
|
|
14
14
|
static NSString *const kis_emp = @"is_emp";
|
|
15
15
|
static NSString *const kappICEToken = @"appICEToken";
|
|
16
16
|
|
|
17
|
+
static NSString *const INBOX_MESSAGE = @"INBOX_MESSAGE";
|
|
18
|
+
static NSString *const INBOX_TITLE = @"INBOX_TITLE";
|
|
19
|
+
static NSString *const INBOX_MESSAGE_STATUS = @"INBOX_MESSAGE_STATUS";
|
|
20
|
+
static NSString *const INBOX_CAMPAIGN_TYPE = @"INBOX_CAMPAIGN_TYPE";
|
|
21
|
+
static NSString *const INBOX_MESSAGE_LANGUAGE = @"INBOX_MESSAGE_LANGUAGE";
|
|
22
|
+
static NSString *const INBOX_MESSAGE_ID = @"INBOX_MESSAGE_ID";
|
|
23
|
+
static NSString *const INBOX_CAMPAIGN_ID = @"INBOX_CAMPAIGN_ID";
|
|
24
|
+
static NSString *const INBOX_MESSAGE_CATEGORY = @"INBOX_MESSAGE_CATEGORY";
|
|
25
|
+
static NSString *const INBOX_MESSAGE_ICON = @"INBOX_MESSAGE_ICON";
|
|
26
|
+
static NSString *const INBOX_CUSTOM_DATA = @"INBOX_CUSTOM_DATA";
|
|
27
|
+
|
|
17
28
|
@interface AppIceReactPlugin : NSObject <RCTBridgeModule,UNUserNotificationCenterDelegate>
|
|
18
29
|
+(void)didRegisterForRemoteNotificationsWithDeviceToken:(NSData*)deviceToken;
|
|
19
30
|
+ (void)pushNotificationClicked:(NSDictionary *)userInfo;
|
package/ios/AppIceReactPlugin.m
CHANGED
|
@@ -23,7 +23,17 @@ RCT_EXPORT_MODULE()
|
|
|
23
23
|
ked : @"edt",
|
|
24
24
|
ket : @"emt",
|
|
25
25
|
km : km,
|
|
26
|
-
kis_emp : @"em"
|
|
26
|
+
kis_emp : @"em",
|
|
27
|
+
INBOX_MESSAGE : @"message",
|
|
28
|
+
INBOX_TITLE : @"title",
|
|
29
|
+
INBOX_MESSAGE_STATUS : @"messageStatus",
|
|
30
|
+
INBOX_CAMPAIGN_TYPE : @"campType",
|
|
31
|
+
INBOX_MESSAGE_LANGUAGE : @"messageLanguage",
|
|
32
|
+
INBOX_MESSAGE_ID : @"id",
|
|
33
|
+
INBOX_CAMPAIGN_ID : @"campId",
|
|
34
|
+
INBOX_MESSAGE_CATEGORY : @"category",
|
|
35
|
+
INBOX_MESSAGE_ICON : @"icon",
|
|
36
|
+
INBOX_CUSTOM_DATA : @"cdata"
|
|
27
37
|
};
|
|
28
38
|
}
|
|
29
39
|
- (dispatch_queue_t)methodQueue {
|
|
@@ -233,5 +243,141 @@ RCT_EXPORT_METHOD(getDeviceId:(RCTResponseSenderBlock)callback)
|
|
|
233
243
|
}
|
|
234
244
|
}
|
|
235
245
|
|
|
246
|
+
/**
|
|
247
|
+
* Get inbox messages list.
|
|
248
|
+
* @param type the message type
|
|
249
|
+
* 1 = ALL
|
|
250
|
+
* 2 = UNREAD
|
|
251
|
+
* 3 = READ
|
|
252
|
+
* 4 = VIEWED
|
|
253
|
+
* 5 = DELETED
|
|
254
|
+
* @param userIds the same way we are passing the value in setUserId same value we need here. ie. [ "useridA" ]
|
|
255
|
+
* @callback will have the string json array
|
|
256
|
+
*/
|
|
257
|
+
|
|
258
|
+
RCT_EXPORT_METHOD(getInboxMessages:(int)type userId:(NSArray*)userIds callback:(RCTResponseSenderBlock)callback)
|
|
259
|
+
{
|
|
260
|
+
NSMutableArray *inboxMessagesArray = [[appICE sharedInstance] getInboxMessages:type userId:userIds];
|
|
261
|
+
// Convert AppICEInboxMessage objects to dictionaries
|
|
262
|
+
|
|
263
|
+
NSMutableArray *formattedinboxMessages = [NSMutableArray array];
|
|
264
|
+
for (AppICEInboxMessage *inboxMessage in inboxMessagesArray) {
|
|
265
|
+
NSDictionary *formattedMessage = [self formatInboxMessage:inboxMessage];
|
|
266
|
+
[formattedinboxMessages addObject:formattedMessage];
|
|
267
|
+
}
|
|
268
|
+
RCTLog(@"Formatted Inbox Messages: %@", formattedinboxMessages);
|
|
269
|
+
[self returnResult:formattedinboxMessages withCallback:callback andError:nil];
|
|
270
|
+
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
/**
|
|
274
|
+
---------------
|
|
275
|
+
APPINBOX
|
|
276
|
+
---------------
|
|
277
|
+
* Get inbox messages count.
|
|
278
|
+
* @param type the message type
|
|
279
|
+
* 1 = ALL
|
|
280
|
+
* 2 = UNREAD
|
|
281
|
+
* 3 = READ
|
|
282
|
+
* 4 = VIEWED
|
|
283
|
+
* 5 = DELETED
|
|
284
|
+
* @param userIds the same way we are passing the value in setUserId same value we need here. ie. [ "useridA" ]
|
|
285
|
+
* @callback will have the integer
|
|
286
|
+
*/
|
|
287
|
+
|
|
288
|
+
RCT_EXPORT_METHOD(getMessageCount:(int)type userId:(NSArray*)userId callback:(RCTResponseSenderBlock)callback)
|
|
289
|
+
{
|
|
290
|
+
int inboxMessageCount = [[appICE sharedInstance] getMessageCount:type userId:userId];
|
|
291
|
+
RCTLog(@"Inbox Messages Count: %d", inboxMessageCount);
|
|
292
|
+
|
|
293
|
+
[self returnResult:@(inboxMessageCount) withCallback:callback andError:nil];
|
|
294
|
+
}
|
|
295
|
+
|
|
296
|
+
/**
|
|
297
|
+
* Get messages payload based on message id.
|
|
298
|
+
* @param messageId - message id of the notification
|
|
299
|
+
* @param userId - single userid in string ie. "useridA"
|
|
300
|
+
* @callback will have the json object
|
|
301
|
+
*/
|
|
302
|
+
RCT_EXPORT_METHOD(getInboxMessageForId:(NSString*)messageId userId:(NSArray*)userId callback:(RCTResponseSenderBlock)callback)
|
|
303
|
+
{
|
|
304
|
+
|
|
305
|
+
AppICEInboxMessage *inboxMessageId = [[appICE sharedInstance] getInboxMessageForId:messageId userId:userId];
|
|
306
|
+
RCTLog(@"Inbox Messages id: %@", inboxMessageId);
|
|
307
|
+
NSDictionary *formattedMessageforId = [self formatInboxMessage:inboxMessageId];
|
|
308
|
+
RCTLog(@"Formatted Inbox Message id: %@", formattedMessageforId);
|
|
309
|
+
|
|
310
|
+
[self returnResult:formattedMessageforId withCallback:callback andError:nil];
|
|
311
|
+
}
|
|
312
|
+
|
|
313
|
+
/**
|
|
314
|
+
* update message status ex. UNREAD to READ.
|
|
315
|
+
* @param messageId - message id of the notification
|
|
316
|
+
* @param type - integer value for status
|
|
317
|
+
* @param userId - single userid in string
|
|
318
|
+
* @callback will have the boolean
|
|
319
|
+
*/
|
|
320
|
+
|
|
321
|
+
RCT_EXPORT_METHOD(updateInboxMessage:(NSString *)messageId type:(int)type userId:(NSString *)userId callback:(RCTResponseSenderBlock)callback)
|
|
322
|
+
{
|
|
323
|
+
BOOL isSuccess = [[appICE sharedInstance] updateInboxMessage:type messageId:messageId userid:userId];
|
|
324
|
+
RCTLog(@"Update Inbox Message Success: %@", isSuccess ? @"YES" : @"NO");
|
|
325
|
+
|
|
326
|
+
[self returnResult:@(isSuccess) withCallback:callback andError:nil];
|
|
327
|
+
}
|
|
328
|
+
|
|
329
|
+
/**
|
|
330
|
+
* synchronizeInbox message Ttue or False.
|
|
331
|
+
* @param messageId - message id of the notification
|
|
332
|
+
* @param type - integer value for status
|
|
333
|
+
* @param userId - single userid in string
|
|
334
|
+
* @callback will have the boolean
|
|
335
|
+
*/
|
|
336
|
+
RCT_EXPORT_METHOD(synchronizeInbox:(int)timeout callback:(RCTResponseSenderBlock)callback)
|
|
337
|
+
{
|
|
338
|
+
// Save the callback for later use
|
|
339
|
+
RCTLog(@"synchronizeInbox");
|
|
340
|
+
|
|
341
|
+
[[appICE sharedInstance] synchronizeInbox:^(BOOL success) {
|
|
342
|
+
|
|
343
|
+
[self returnResult:@(success) withCallback:callback andError:nil];
|
|
344
|
+
|
|
345
|
+
} timeoutinSec:timeout];
|
|
346
|
+
|
|
347
|
+
}
|
|
348
|
+
|
|
349
|
+
// Add a method to format AppICEInboxMessage to a dictionary
|
|
350
|
+
- (NSDictionary *)formatInboxMessage:(AppICEInboxMessage *)inboxMessage {
|
|
351
|
+
if (inboxMessage) {
|
|
352
|
+
return @{
|
|
353
|
+
@"messageId": inboxMessage.messageId,
|
|
354
|
+
@"id": inboxMessage.messageMid,
|
|
355
|
+
@"icon": inboxMessage.messageImage,
|
|
356
|
+
@"message": inboxMessage.messageBody,
|
|
357
|
+
@"title": inboxMessage.messageTitle,
|
|
358
|
+
@"messageStatus": inboxMessage.messageStatus,
|
|
359
|
+
@"messageLanguage": inboxMessage.messageLanguage,
|
|
360
|
+
@"campId": inboxMessage.messageCampid,
|
|
361
|
+
@"cdata": inboxMessage.customData,
|
|
362
|
+
@"messageExpiryTime": @(inboxMessage.messageExpiryTime),
|
|
363
|
+
@"campType": inboxMessage.campType
|
|
364
|
+
};
|
|
365
|
+
} else {
|
|
366
|
+
return @{};
|
|
367
|
+
}
|
|
368
|
+
}
|
|
369
|
+
|
|
370
|
+
- (void)returnResult:(id)result withCallback:(RCTResponseSenderBlock)callback andError:(NSString *)error {
|
|
371
|
+
|
|
372
|
+
if (callback == nil) {
|
|
373
|
+
RCTLog(@"callback was nil");
|
|
374
|
+
return;
|
|
375
|
+
}
|
|
376
|
+
// id e = error != nil ? error : [NSNull null];
|
|
377
|
+
id r = result != nil ? result : [NSNull null];
|
|
378
|
+
RCTLog(@"r: %@",r);
|
|
379
|
+
callback(@[r]);
|
|
380
|
+
}
|
|
381
|
+
|
|
236
382
|
@end
|
|
237
383
|
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
|
3
|
+
<plist version="1.0">
|
|
4
|
+
<dict>
|
|
5
|
+
<key>SchemeUserState</key>
|
|
6
|
+
<dict>
|
|
7
|
+
<key>AppIceReactPlugin.xcscheme_^#shared#^_</key>
|
|
8
|
+
<dict>
|
|
9
|
+
<key>orderHint</key>
|
|
10
|
+
<integer>0</integer>
|
|
11
|
+
</dict>
|
|
12
|
+
</dict>
|
|
13
|
+
</dict>
|
|
14
|
+
</plist>
|
|
Binary file
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
|
3
|
+
<plist version="1.0">
|
|
4
|
+
<dict>
|
|
5
|
+
<key>SchemeUserState</key>
|
|
6
|
+
<dict>
|
|
7
|
+
<key>Pods-AppIceReactPlugin.xcscheme_^#shared#^_</key>
|
|
8
|
+
<dict>
|
|
9
|
+
<key>orderHint</key>
|
|
10
|
+
<integer>1</integer>
|
|
11
|
+
</dict>
|
|
12
|
+
</dict>
|
|
13
|
+
</dict>
|
|
14
|
+
</plist>
|
package/package.json
CHANGED
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
package com.reactlibrary;
|
|
2
|
-
import android.annotation.SuppressLint;
|
|
3
|
-
import android.content.Context;
|
|
4
|
-
import android.graphics.Point;
|
|
5
|
-
import android.util.DisplayMetrics;
|
|
6
|
-
import android.util.TypedValue;
|
|
7
|
-
import android.view.View;
|
|
8
|
-
import android.webkit.WebView;
|
|
9
|
-
|
|
10
|
-
@SuppressLint("ViewConstructor")
|
|
11
|
-
class InAppWebView extends WebView {
|
|
12
|
-
|
|
13
|
-
final Point dim = new Point();
|
|
14
|
-
|
|
15
|
-
private int height;
|
|
16
|
-
|
|
17
|
-
private int heightPercentage;
|
|
18
|
-
|
|
19
|
-
private int width;
|
|
20
|
-
|
|
21
|
-
private int widthPercentage;
|
|
22
|
-
|
|
23
|
-
@SuppressLint("ResourceType")
|
|
24
|
-
public InAppWebView(Context context, int width, int height, int widthPercentage, int heightPercentage) {
|
|
25
|
-
super(context);
|
|
26
|
-
this.width = width;
|
|
27
|
-
this.height = height;
|
|
28
|
-
this.widthPercentage = widthPercentage;
|
|
29
|
-
this.heightPercentage = heightPercentage;
|
|
30
|
-
setHorizontalScrollBarEnabled(false);
|
|
31
|
-
setVerticalScrollBarEnabled(false);
|
|
32
|
-
setHorizontalFadingEdgeEnabled(false);
|
|
33
|
-
setVerticalFadingEdgeEnabled(false);
|
|
34
|
-
setOverScrollMode(View.OVER_SCROLL_NEVER);
|
|
35
|
-
setBackgroundColor(0x00000000);
|
|
36
|
-
//noinspection ResourceType
|
|
37
|
-
setId(188293);
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
@Override
|
|
41
|
-
public boolean performClick() {
|
|
42
|
-
return super.performClick();
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
@Override
|
|
46
|
-
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
|
|
47
|
-
super.onMeasure(widthMeasureSpec, heightMeasureSpec);
|
|
48
|
-
updateDimension();
|
|
49
|
-
setMeasuredDimension(dim.x, dim.y);
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
void updateDimension() {
|
|
53
|
-
if (width != 0) {
|
|
54
|
-
dim.x = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP,
|
|
55
|
-
width, getResources().getDisplayMetrics());
|
|
56
|
-
} else {
|
|
57
|
-
DisplayMetrics metrics = getResources().getDisplayMetrics();
|
|
58
|
-
dim.x = (int) (metrics.widthPixels * widthPercentage / 100f);
|
|
59
|
-
}
|
|
60
|
-
if (height != 0) {
|
|
61
|
-
dim.y = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP,
|
|
62
|
-
height, getResources().getDisplayMetrics());
|
|
63
|
-
} else {
|
|
64
|
-
DisplayMetrics metrics = getResources().getDisplayMetrics();
|
|
65
|
-
dim.y = (int) (metrics.heightPixels * heightPercentage / 100f);
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
}
|