react-native-notifyvisitors 4.1.1 → 4.1.2
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 +0 -41
- package/android/.gradle/7.1.1/dependencies-accessors/dependencies-accessors.lock +0 -0
- package/android/.gradle/{6.3 → 7.1.1/dependencies-accessors}/gc.properties +0 -0
- package/android/.gradle/7.1.1/executionHistory/executionHistory.lock +0 -0
- package/android/.gradle/{6.3 → 7.1.1}/fileChanges/last-build.bin +0 -0
- package/android/.gradle/7.1.1/fileHashes/fileHashes.lock +0 -0
- package/android/.gradle/7.1.1/gc.properties +0 -0
- package/android/.gradle/buildOutputCleanup/buildOutputCleanup.lock +0 -0
- package/android/.gradle/buildOutputCleanup/cache.properties +2 -2
- package/android/.settings/org.eclipse.buildship.core.prefs +2 -2
- package/android/build.gradle +1 -1
- package/android/src/main/java/com/rn_notifyvisitors/RNNotifyvisitorsModule.java +578 -201
- package/index.js +212 -207
- package/ios/RNNotifyvisitors/RCTNVEventEmitter.m +504 -187
- package/ios/RNNotifyvisitors/RNNotifyvisitors.m +1 -1
- package/ios/RNNotifyvisitors.xcodeproj/project.pbxproj +8 -8
- package/ios/RNNotifyvisitors.xcodeproj/project.xcworkspace/xcuserdata/tagnpinwebsolutionsllp.xcuserdatad/UserInterfaceState.xcuserstate +0 -0
- package/ios/{libnotifyvisitors_6_0_3.a → libnotifyvisitors_6_3_1.a} +0 -0
- package/ios/notifyvisitors.h +41 -14
- package/package.json +1 -1
- package/react-native-notifyvisitors.podspec +1 -1
- package/android/.gradle/6.3/executionHistory/executionHistory.lock +0 -0
- package/android/.gradle/6.3/fileHashes/fileHashes.lock +0 -0
|
@@ -10,7 +10,7 @@ RCTResponseSenderBlock eventCallback;
|
|
|
10
10
|
RCTResponseSenderBlock commonCallback;
|
|
11
11
|
|
|
12
12
|
@implementation RCTEventEmitterDemo{
|
|
13
|
-
|
|
13
|
+
BOOL hasListeners;
|
|
14
14
|
}
|
|
15
15
|
|
|
16
16
|
- (dispatch_queue_t)methodQueue{
|
|
@@ -56,8 +56,8 @@ RCT_EXPORT_MODULE(RNNotifyvisitors);
|
|
|
56
56
|
|
|
57
57
|
// Will be called when this module's last listener is removed, or on dealloc.
|
|
58
58
|
- (void)stopObserving {
|
|
59
|
-
|
|
60
|
-
|
|
59
|
+
NSLog(@"STOP OBSERVING !");
|
|
60
|
+
hasListeners = NO;
|
|
61
61
|
}
|
|
62
62
|
|
|
63
63
|
|
|
@@ -80,16 +80,16 @@ RCT_EXPORT_MODULE(RNNotifyvisitors);
|
|
|
80
80
|
|
|
81
81
|
// End of Send Event Methods
|
|
82
82
|
|
|
83
|
-
|
|
83
|
+
/* 1- Show In App Banner, Alert, Serveys */
|
|
84
84
|
RCT_EXPORT_METHOD(show:(NSDictionary*_Nullable)nvUserToken customRules:(NSDictionary*_Nullable)nvCustomRule
|
|
85
|
-
|
|
85
|
+
mobile:(NSString*_Nullable)dummy callback:(RCTResponseSenderBlock)nvcallback ){
|
|
86
86
|
@try{
|
|
87
87
|
NSLog(@"RN-NotifyVisitors : SHOW !!");
|
|
88
88
|
showCallback = nvcallback;
|
|
89
89
|
|
|
90
90
|
NSMutableDictionary *mUserToken = [[NSMutableDictionary alloc] init];
|
|
91
91
|
NSMutableDictionary *mCustomRule = [[NSMutableDictionary alloc] init];
|
|
92
|
-
|
|
92
|
+
|
|
93
93
|
if (![nvUserToken isEqual:[NSNull null]]){
|
|
94
94
|
mUserToken = [nvUserToken mutableCopy];
|
|
95
95
|
} else{
|
|
@@ -101,7 +101,7 @@ RCT_EXPORT_METHOD(show:(NSDictionary*_Nullable)nvUserToken customRules:(NSDicti
|
|
|
101
101
|
} else{
|
|
102
102
|
mCustomRule = nil;
|
|
103
103
|
}
|
|
104
|
-
|
|
104
|
+
|
|
105
105
|
//NSLog(@"Dictionary rule 1: %@", [mUserToken description]);
|
|
106
106
|
//NSLog(@"Dictionary token 2: %@", [mCustomRule description]);
|
|
107
107
|
dispatch_async(dispatch_get_main_queue(), ^{
|
|
@@ -114,45 +114,213 @@ RCT_EXPORT_METHOD(show:(NSDictionary*_Nullable)nvUserToken customRules:(NSDicti
|
|
|
114
114
|
}
|
|
115
115
|
|
|
116
116
|
|
|
117
|
-
|
|
118
|
-
RCT_EXPORT_METHOD(showNotifications:(NSString*_Nullable)dismissValue) {
|
|
117
|
+
/* 2 - Open Notification Center */
|
|
118
|
+
//RCT_EXPORT_METHOD(showNotifications:(NSMutableDictionary *)appInboxInfo dismiss:(NSString*_Nullable)dismissValue) {
|
|
119
|
+
// @try{
|
|
120
|
+
// NSLog(@"RN-NotifyVisitors : SHOW NOTIFICATIONS !!");
|
|
121
|
+
// [notifyvisitors NotifyVisitorsNotificationCentre];
|
|
122
|
+
//
|
|
123
|
+
// NSString *nvResourcePlistPath = [[NSBundle mainBundle] pathForResource: @"nvResourceValues" ofType: @"plist"];
|
|
124
|
+
// if ([[NSFileManager defaultManager] fileExistsAtPath: nvResourcePlistPath]) {
|
|
125
|
+
// NSDictionary *nvResourceData = [NSDictionary dictionaryWithContentsOfFile: nvResourcePlistPath];
|
|
126
|
+
// if ([nvResourceData count] > 0) {
|
|
127
|
+
// NSDictionary *nvResourceBooleans = [nvResourceData objectForKey: @"nvBooleans"];
|
|
128
|
+
//
|
|
129
|
+
// if ([nvResourceBooleans count] > 0) {
|
|
130
|
+
// if (nvResourceBooleans [@"DismissNotificationCenterOnAction"]) {
|
|
131
|
+
// nvDismissNCenterOnAction = [nvResourceBooleans [@"DismissNotificationCenterOnAction"] boolValue];
|
|
132
|
+
// } else {
|
|
133
|
+
// nvDismissNCenterOnAction = YES;
|
|
134
|
+
// }
|
|
135
|
+
// NSLog(@"NV DISMISS NOTIFICATION CENTER ON ACTION = %@", nvDismissNCenterOnAction ? @"YES" : @"NO");
|
|
136
|
+
//
|
|
137
|
+
// } else {
|
|
138
|
+
// NSLog(@"NV RESOURCE BOOLEANS NOT FOUND !!");
|
|
139
|
+
// }
|
|
140
|
+
//
|
|
141
|
+
// } else {
|
|
142
|
+
// NSLog(@"NV RESOURCE DATA NOT FOUND !!");
|
|
143
|
+
// }
|
|
144
|
+
//
|
|
145
|
+
// } else {
|
|
146
|
+
// NSLog(@"NV RESOURCE VALUES PLIST NOT FOUND !!");
|
|
147
|
+
// }
|
|
148
|
+
//
|
|
149
|
+
// }
|
|
150
|
+
// @catch(NSException *exception){
|
|
151
|
+
// NSLog(@"RN-NotifyVisitors ERROR : %@", exception.reason);
|
|
152
|
+
// }
|
|
153
|
+
//}
|
|
154
|
+
|
|
155
|
+
|
|
156
|
+
RCT_EXPORT_METHOD(showNotifications:(NSDictionary*_Nullable)temp dismiss:(NSString*_Nullable)dismissValue) {
|
|
157
|
+
NSLog(@"RN-NotifyVisitors : SHOW NOTIFICATIONS !!");
|
|
158
|
+
|
|
159
|
+
NSString * tab1Label;
|
|
160
|
+
NSString * tab1Name;
|
|
161
|
+
NSString * tab2Label;
|
|
162
|
+
NSString * tab2Name;
|
|
163
|
+
NSString * tab3Label;
|
|
164
|
+
NSString * tab3Name;
|
|
165
|
+
|
|
166
|
+
NSString * selectedTabTextColor;
|
|
167
|
+
NSString * unselectedTabTextColor;
|
|
168
|
+
NSString * selectedTabBgColor;
|
|
169
|
+
NSString * unselectedTabBgColor;
|
|
170
|
+
|
|
171
|
+
NSString * tabTextFontName;
|
|
172
|
+
NSInteger tabTextFontSize;
|
|
173
|
+
NSInteger selectedTabIndex;
|
|
174
|
+
|
|
175
|
+
UIColor * mSelectedTabTextColor;
|
|
176
|
+
UIColor * mUnselectedTabTextColor;
|
|
177
|
+
UIColor * mSelectedTabBgColor;
|
|
178
|
+
UIColor * mUnselectedTabBgColor;
|
|
179
|
+
|
|
180
|
+
NSMutableDictionary * appInboxInfo;
|
|
181
|
+
|
|
119
182
|
@try{
|
|
120
|
-
|
|
121
|
-
|
|
183
|
+
tab1Label = nil;
|
|
184
|
+
tab1Name = nil;
|
|
185
|
+
tab2Label = nil;
|
|
186
|
+
tab2Name = nil;
|
|
187
|
+
tab3Label = nil;
|
|
188
|
+
tab3Name = nil;
|
|
189
|
+
selectedTabTextColor = nil;
|
|
190
|
+
unselectedTabTextColor = nil;
|
|
191
|
+
selectedTabBgColor = nil;
|
|
192
|
+
unselectedTabBgColor = nil;
|
|
193
|
+
tabTextFontName = nil;
|
|
194
|
+
tabTextFontSize = 13;
|
|
195
|
+
selectedTabIndex = 0;
|
|
196
|
+
mSelectedTabTextColor = nil;
|
|
197
|
+
mUnselectedTabTextColor = nil;
|
|
198
|
+
mSelectedTabBgColor = nil;
|
|
199
|
+
mUnselectedTabBgColor = nil;
|
|
122
200
|
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
201
|
+
if ([temp count] > 0){
|
|
202
|
+
appInboxInfo = [[NSMutableDictionary alloc] init];
|
|
203
|
+
appInboxInfo = [temp mutableCopy];
|
|
204
|
+
|
|
205
|
+
|
|
206
|
+
if (appInboxInfo[@"label_one"] && ![appInboxInfo[@"label_one"] isEqual: [NSNull null]]) {
|
|
207
|
+
tab1Label = appInboxInfo[@"label_one"];
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
if (appInboxInfo[@"name_one"] && ![appInboxInfo[@"name_one"] isEqual: [NSNull null]]) {
|
|
211
|
+
tab1Name = appInboxInfo[@"name_one"];
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
if (appInboxInfo[@"label_two"] && ![appInboxInfo[@"label_two"] isEqual: [NSNull null]]) {
|
|
215
|
+
tab2Label = appInboxInfo[@"label_two"];
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
if (appInboxInfo[@"name_two"] && ![appInboxInfo[@"name_two"] isEqual: [NSNull null]]) {
|
|
219
|
+
tab2Name = appInboxInfo[@"name_two"];
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
if (appInboxInfo[@"label_three"] && ![appInboxInfo[@"label_three"] isEqual: [NSNull null]]) {
|
|
223
|
+
tab3Label = appInboxInfo[@"label_three"];
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
if (appInboxInfo[@"name_three"] && ![appInboxInfo[@"name_three"] isEqual: [NSNull null]]) {
|
|
227
|
+
tab3Name = appInboxInfo[@"name_three"];
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
if (appInboxInfo[@"selectedTabTextColor"] && ![appInboxInfo[@"selectedTabTextColor"] isEqual: [NSNull null]]) {
|
|
231
|
+
selectedTabTextColor = appInboxInfo[@"selectedTabTextColor"];
|
|
232
|
+
mSelectedTabTextColor = [self GetColor:selectedTabTextColor];
|
|
128
233
|
|
|
129
|
-
|
|
130
|
-
if (nvResourceBooleans [@"DismissNotificationCenterOnAction"]) {
|
|
131
|
-
nvDismissNCenterOnAction = [nvResourceBooleans [@"DismissNotificationCenterOnAction"] boolValue];
|
|
132
|
-
} else {
|
|
133
|
-
nvDismissNCenterOnAction = YES;
|
|
134
|
-
}
|
|
135
|
-
NSLog(@"NV DISMISS NOTIFICATION CENTER ON ACTION = %@", nvDismissNCenterOnAction ? @"YES" : @"NO");
|
|
136
|
-
|
|
137
|
-
} else {
|
|
138
|
-
NSLog(@"NV RESOURCE BOOLEANS NOT FOUND !!");
|
|
139
|
-
}
|
|
234
|
+
}
|
|
140
235
|
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
236
|
+
if (appInboxInfo[@"unselectedTabTextColor"] && ![appInboxInfo[@"unselectedTabTextColor"] isEqual: [NSNull null]]) {
|
|
237
|
+
unselectedTabTextColor = appInboxInfo[@"unselectedTabTextColor"];
|
|
238
|
+
mUnselectedTabTextColor = [self GetColor:unselectedTabTextColor];
|
|
239
|
+
}
|
|
144
240
|
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
241
|
+
if (appInboxInfo[@"selectedTabBgColor"] && ![appInboxInfo[@"selectedTabBgColor"] isEqual: [NSNull null]]) {
|
|
242
|
+
selectedTabBgColor = appInboxInfo[@"selectedTabBgColor"];
|
|
243
|
+
mSelectedTabBgColor = [self GetColor:selectedTabBgColor];
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
if (appInboxInfo[@"unselectedTabBgColor_ios"] && ![appInboxInfo[@"unselectedTabBgColor_ios"] isEqual: [NSNull null]]) {
|
|
247
|
+
unselectedTabBgColor = appInboxInfo[@"unselectedTabBgColor_ios"];
|
|
248
|
+
mUnselectedTabBgColor = [self GetColor:unselectedTabBgColor];
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
if (appInboxInfo[@"selectedTabIndex_ios"] && ![appInboxInfo[@"selectedTabIndex_ios"] isEqual: [NSNull null]]) {
|
|
252
|
+
selectedTabIndex = [appInboxInfo[@"selectedTabIndex_ios"]integerValue];
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
if (appInboxInfo[@"tabTextFontName_ios"] && ![appInboxInfo[@"tabTextFontName_ios"] isEqual: [NSNull null]]) {
|
|
256
|
+
tabTextFontName = appInboxInfo[@"tabTextFontName_ios"];
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
if (appInboxInfo[@"tabTextFontSize_ios"] && ![appInboxInfo[@"tabTextFontSize_ios"] isEqual: [NSNull null]]) {
|
|
260
|
+
tabTextFontSize = [appInboxInfo[@"tabTextFontSize_ios"]integerValue];
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
NVCenterStyleConfig *nvConfig = [[NVCenterStyleConfig alloc] init];
|
|
264
|
+
|
|
265
|
+
if (tab1Label != nil && [tab1Label length] > 0 && ![tab1Label isEqual: [NSNull null]]){
|
|
266
|
+
if(tab1Name!= nil && [tab1Name length] > 0 && ![tab1Name isEqual: [NSNull null]]){
|
|
267
|
+
[nvConfig setFirstTabWithTabLable: tab1Label TagDisplayName: tab1Name];
|
|
268
|
+
}
|
|
269
|
+
}
|
|
270
|
+
|
|
271
|
+
if (tab2Label != nil && [tab2Label length] > 0 && ![tab2Label isEqual: [NSNull null]]){
|
|
272
|
+
if(tab2Name!= nil && [tab2Name length] > 0 && ![tab2Name isEqual: [NSNull null]]){
|
|
273
|
+
[nvConfig setSecondTabWithTabLable: tab2Label TagDisplayName: tab2Name];
|
|
274
|
+
}
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
if (tab3Label != nil && [tab3Label length] > 0 && ![tab3Label isEqual: [NSNull null]]){
|
|
278
|
+
if(tab3Name!= nil && [tab3Name length] > 0 && ![tab3Name isEqual: [NSNull null]]){
|
|
279
|
+
[nvConfig setThirdTabWithTabLable: tab3Label TagDisplayName: tab3Name];
|
|
280
|
+
}
|
|
281
|
+
}
|
|
282
|
+
|
|
283
|
+
|
|
284
|
+
if (mSelectedTabTextColor != nil && ![mSelectedTabTextColor isEqual: [NSNull null]]){
|
|
285
|
+
nvConfig.selectedTabTextColor = mSelectedTabTextColor;
|
|
286
|
+
}
|
|
287
|
+
|
|
288
|
+
if (mUnselectedTabTextColor != nil && ![mUnselectedTabTextColor isEqual: [NSNull null]]){
|
|
289
|
+
nvConfig.unselectedTabTextColor = mUnselectedTabTextColor;
|
|
290
|
+
}
|
|
291
|
+
|
|
292
|
+
if (mSelectedTabBgColor != nil && ![mSelectedTabBgColor isEqual: [NSNull null]]){
|
|
293
|
+
nvConfig.selectedTabBgColor = mSelectedTabBgColor;
|
|
294
|
+
}
|
|
295
|
+
|
|
296
|
+
if (mUnselectedTabBgColor != nil && ![mUnselectedTabBgColor isEqual: [NSNull null]]){
|
|
297
|
+
nvConfig.unselectedTabBgColor = mUnselectedTabBgColor;
|
|
298
|
+
}
|
|
299
|
+
|
|
300
|
+
if(selectedTabIndex != 0){
|
|
301
|
+
nvConfig.selectedTabIndex = selectedTabIndex;
|
|
302
|
+
}
|
|
303
|
+
|
|
304
|
+
if (tabTextFontName != nil && [tabTextFontName length] > 0 && ![tabTextFontName isEqual: [NSNull null]]){
|
|
305
|
+
nvConfig.tabTextfont = [UIFont fontWithName: tabTextFontName size: tabTextFontSize];
|
|
306
|
+
}
|
|
307
|
+
|
|
308
|
+
[notifyvisitors notificationCenterWithConfiguration: nvConfig];
|
|
309
|
+
|
|
310
|
+
} else{
|
|
311
|
+
NSLog(@"Empty JSON Object ! Going for Standard App Inbox ");
|
|
312
|
+
[notifyvisitors NotifyVisitorsNotificationCentre];
|
|
313
|
+
}
|
|
149
314
|
}
|
|
150
315
|
@catch(NSException *exception){
|
|
151
316
|
NSLog(@"RN-NotifyVisitors ERROR : %@", exception.reason);
|
|
152
317
|
}
|
|
153
318
|
}
|
|
154
319
|
|
|
155
|
-
|
|
320
|
+
|
|
321
|
+
|
|
322
|
+
|
|
323
|
+
/*3 - Hit Event */
|
|
156
324
|
RCT_EXPORT_METHOD(event:(NSString*_Nullable)eventName Attributes:(NSDictionary*_Nullable)attributes
|
|
157
325
|
LifeTimeValue:(NSString*_Nullable)lifeTimeValue Scope:(NSString*_Nullable)scope callback:(RCTResponseSenderBlock)nvcallback) {
|
|
158
326
|
@try{
|
|
@@ -160,23 +328,23 @@ RCT_EXPORT_METHOD(event:(NSString*_Nullable)eventName Attributes:(NSDictionary*
|
|
|
160
328
|
eventCallback = nvcallback;
|
|
161
329
|
NSMutableDictionary *jAttributes = [[NSMutableDictionary alloc] init];
|
|
162
330
|
int nvScope = 0;
|
|
163
|
-
|
|
331
|
+
|
|
164
332
|
if([eventName isEqual:[NSNull null]] || [eventName length] == 0){
|
|
165
|
-
|
|
333
|
+
eventName = nil;
|
|
166
334
|
}
|
|
167
|
-
|
|
335
|
+
|
|
168
336
|
if (![attributes isEqual:[NSNull null]]){
|
|
169
337
|
jAttributes = [attributes mutableCopy];
|
|
170
338
|
}else{
|
|
171
|
-
|
|
339
|
+
jAttributes = nil;
|
|
172
340
|
}
|
|
173
|
-
|
|
341
|
+
|
|
174
342
|
if([lifeTimeValue isEqual:[NSNull null]] || [lifeTimeValue length] == 0){
|
|
175
|
-
|
|
343
|
+
lifeTimeValue = nil;
|
|
176
344
|
}
|
|
177
|
-
|
|
345
|
+
|
|
178
346
|
if([scope isEqual:[NSNull null]] ){
|
|
179
|
-
|
|
347
|
+
nvScope = 0;
|
|
180
348
|
} else if([scope length] == 0){
|
|
181
349
|
nvScope = 0;
|
|
182
350
|
}else{
|
|
@@ -184,104 +352,187 @@ RCT_EXPORT_METHOD(event:(NSString*_Nullable)eventName Attributes:(NSDictionary*
|
|
|
184
352
|
}
|
|
185
353
|
|
|
186
354
|
//NSLog(@"Dictionary: %@",jAttributes);
|
|
187
|
-
|
|
188
|
-
|
|
355
|
+
[notifyvisitors trackEvents:eventName Attributes:jAttributes lifetimeValue:lifeTimeValue Scope:nvScope];
|
|
356
|
+
|
|
189
357
|
}
|
|
190
358
|
@catch(NSException *exception){
|
|
191
359
|
NSLog(@"RN-NotifyVisitors ERROR : %@", exception.reason);
|
|
192
360
|
}
|
|
193
361
|
}
|
|
194
362
|
|
|
195
|
-
|
|
363
|
+
/* 4- user identifier method */
|
|
196
364
|
RCT_EXPORT_METHOD(userIdentifier:(NSString*_Nullable)nvUserID UserParams:(NSDictionary*_Nullable)nvUserParams) {
|
|
197
365
|
@try{
|
|
198
366
|
NSLog(@"RN-NotifyVisitors : USER IDENTIFIER !!");
|
|
199
367
|
NSMutableDictionary *mUserParams = [[NSMutableDictionary alloc] init];
|
|
200
368
|
|
|
201
369
|
if( [nvUserID isEqual:[NSNull null]] || [nvUserID length] == 0){
|
|
202
|
-
|
|
370
|
+
nvUserID = nil;
|
|
203
371
|
}
|
|
204
372
|
|
|
205
|
-
|
|
373
|
+
|
|
206
374
|
if (![nvUserParams isEqual:[NSNull null]]){
|
|
207
375
|
mUserParams = [nvUserParams mutableCopy];
|
|
208
376
|
} else{
|
|
209
377
|
mUserParams = nil;
|
|
210
378
|
}
|
|
211
|
-
|
|
212
|
-
|
|
379
|
+
|
|
380
|
+
[notifyvisitors UserIdentifier: nvUserID UserParams: mUserParams];
|
|
213
381
|
}
|
|
214
382
|
@catch(NSException *exception){
|
|
215
383
|
NSLog(@"RN-NotifyVisitors ERROR : %@", exception.reason);
|
|
216
384
|
}
|
|
217
385
|
}
|
|
218
386
|
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
// 5- Stop Inapp Banner serveyes
|
|
222
|
-
RCT_EXPORT_METHOD(stopNotifications) {
|
|
387
|
+
/* 5- Start Chat Bot */
|
|
388
|
+
RCT_EXPORT_METHOD(startChatBot: (NSString*_Nullable)screenName) {
|
|
223
389
|
@try{
|
|
224
|
-
NSLog(@"RN-NotifyVisitors :
|
|
225
|
-
[notifyvisitors
|
|
390
|
+
NSLog(@"RN-NotifyVisitors : START CHATBOT !!");
|
|
391
|
+
[notifyvisitors startChatBotWithScreenName: screenName];
|
|
392
|
+
//callback(@[@"No Notification Found", [NSNull null]]);
|
|
226
393
|
}
|
|
227
394
|
@catch(NSException *exception){
|
|
228
395
|
NSLog(@"RN-NotifyVisitors ERROR : %@", exception.reason);
|
|
229
396
|
}
|
|
230
397
|
}
|
|
231
398
|
|
|
232
|
-
|
|
233
|
-
RCT_EXPORT_METHOD(
|
|
399
|
+
/* 10- GET NOTIFICATION CENTER COUNT */
|
|
400
|
+
RCT_EXPORT_METHOD(getNotificationCenterCount: (NSDictionary*_Nullable)tabCountInfo response:(RCTResponseSenderBlock) callback){
|
|
234
401
|
@try{
|
|
235
|
-
NSLog(@"RN-NotifyVisitors :
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
402
|
+
NSLog(@"RN-NotifyVisitors : GET NOTIFICATION CENTER COUNT !!");
|
|
403
|
+
NSString * tab1Label;
|
|
404
|
+
NSString * tab1Name;
|
|
405
|
+
NSString * tab2Label;
|
|
406
|
+
NSString * tab2Name;
|
|
407
|
+
NSString * tab3Label;
|
|
408
|
+
NSString * tab3Name;
|
|
409
|
+
|
|
410
|
+
NSMutableDictionary *appInboxInfo = [[NSMutableDictionary alloc] init];
|
|
411
|
+
//NSLog(@"tabCountInfo Object %lu",[tabCountInfo count]);
|
|
412
|
+
if ([tabCountInfo count] > 0){
|
|
413
|
+
appInboxInfo = [tabCountInfo mutableCopy];
|
|
414
|
+
tab1Label = nil;
|
|
415
|
+
tab1Name = nil;
|
|
416
|
+
tab2Label = nil;
|
|
417
|
+
tab2Name = nil;
|
|
418
|
+
tab3Label = nil;
|
|
419
|
+
tab3Name = nil;
|
|
420
|
+
|
|
421
|
+
if (appInboxInfo[@"label_one"] && ![appInboxInfo[@"label_one"] isEqual: [NSNull null]]) {
|
|
422
|
+
tab1Label = appInboxInfo[@"label_one"];
|
|
242
423
|
}
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
424
|
+
|
|
425
|
+
if (appInboxInfo[@"name_one"] && ![appInboxInfo[@"name_one"] isEqual: [NSNull null]]) {
|
|
426
|
+
tab1Name = appInboxInfo[@"name_one"];
|
|
427
|
+
}
|
|
428
|
+
|
|
429
|
+
if (appInboxInfo[@"label_two"] && ![appInboxInfo[@"label_two"] isEqual: [NSNull null]]) {
|
|
430
|
+
tab2Label = appInboxInfo[@"label_two"];
|
|
431
|
+
}
|
|
432
|
+
|
|
433
|
+
if (appInboxInfo[@"name_two"] && ![appInboxInfo[@"name_two"] isEqual: [NSNull null]]) {
|
|
434
|
+
tab2Name = appInboxInfo[@"name_two"];
|
|
435
|
+
}
|
|
436
|
+
|
|
437
|
+
if (appInboxInfo[@"label_three"] && ![appInboxInfo[@"label_three"] isEqual: [NSNull null]]) {
|
|
438
|
+
tab3Label = appInboxInfo[@"label_three"];
|
|
439
|
+
}
|
|
440
|
+
|
|
441
|
+
if (appInboxInfo[@"name_three"] && ![appInboxInfo[@"name_three"] isEqual: [NSNull null]]) {
|
|
442
|
+
tab3Name = appInboxInfo[@"name_three"];
|
|
443
|
+
}
|
|
444
|
+
|
|
445
|
+
NVCenterStyleConfig *nvConfig = [[NVCenterStyleConfig alloc] init];
|
|
446
|
+
|
|
447
|
+
if (tab1Label != nil && [tab1Label length] > 0 && ![tab1Label isEqual: [NSNull null]]){
|
|
448
|
+
if(tab1Name!= nil && [tab1Name length] > 0 && ![tab1Name isEqual: [NSNull null]]){
|
|
449
|
+
[nvConfig setFirstTabWithTabLable: tab1Label TagDisplayName: tab1Name];
|
|
450
|
+
}
|
|
451
|
+
}
|
|
452
|
+
|
|
453
|
+
if (tab2Label != nil && [tab2Label length] > 0 && ![tab2Label isEqual: [NSNull null]]){
|
|
454
|
+
if(tab2Name!= nil && [tab2Name length] > 0 && ![tab2Name isEqual: [NSNull null]]){
|
|
455
|
+
[nvConfig setSecondTabWithTabLable: tab2Label TagDisplayName: tab2Name];
|
|
456
|
+
}
|
|
457
|
+
}
|
|
458
|
+
|
|
459
|
+
if (tab3Label != nil && [tab3Label length] > 0 && ![tab3Label isEqual: [NSNull null]]){
|
|
460
|
+
if(tab3Name!= nil && [tab3Name length] > 0 && ![tab3Name isEqual: [NSNull null]]){
|
|
461
|
+
[nvConfig setThirdTabWithTabLable: tab3Label TagDisplayName: tab3Name];
|
|
462
|
+
}
|
|
463
|
+
}
|
|
464
|
+
|
|
465
|
+
[notifyvisitors getNotificationCenterCountWithConfiguration: nvConfig countResult:^(NSDictionary * nvCenterCounts) {
|
|
466
|
+
[self sendTabCountResponse:nvCenterCounts responseToSend:callback];
|
|
467
|
+
}];
|
|
468
|
+
|
|
469
|
+
} else{
|
|
470
|
+
NSLog(@"Empty JSON Object ! Going for Standard Tab count ");
|
|
471
|
+
[notifyvisitors getNotificationCenterCountWithConfiguration: Nil countResult:^(NSDictionary * nvCenterCounts) {
|
|
472
|
+
[self sendTabCountResponse:nvCenterCounts responseToSend:callback];
|
|
473
|
+
}];
|
|
246
474
|
}
|
|
475
|
+
|
|
247
476
|
}
|
|
248
477
|
@catch(NSException *exception){
|
|
249
478
|
NSLog(@"RN-NotifyVisitors ERROR : %@", exception.reason);
|
|
250
479
|
}
|
|
251
480
|
}
|
|
252
481
|
|
|
253
|
-
|
|
254
|
-
|
|
482
|
+
- (void) sendTabCountResponse : (NSDictionary *) nvCenterCounts responseToSend:(RCTResponseSenderBlock) callback{
|
|
483
|
+
NSError *nvError = nil;
|
|
484
|
+
NSData *nvJsonData = nil;
|
|
485
|
+
NSString *nvJsonString = nil;
|
|
486
|
+
nvJsonData = [NSJSONSerialization dataWithJSONObject: nvCenterCounts options:NSJSONWritingPrettyPrinted error: &nvError];
|
|
487
|
+
nvJsonString = [[NSString alloc] initWithData: nvJsonData encoding: NSUTF8StringEncoding];
|
|
488
|
+
callback(@[nvJsonString, [NSNull null]]);
|
|
489
|
+
}
|
|
490
|
+
|
|
491
|
+
/* 11- GET REGISTRATION TOKEN */
|
|
492
|
+
RCT_EXPORT_METHOD(getRegistrationToken: (RCTResponseSenderBlock) callback) {
|
|
255
493
|
@try{
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
494
|
+
NSLog(@"RN-NotifyVisitors : GET REGISTRATION TOKEN !!");
|
|
495
|
+
NSString *nvPushToken = [notifyvisitors getPushRegistrationToken];
|
|
496
|
+
if([nvPushToken length] > 0){
|
|
497
|
+
callback(@[nvPushToken, [NSNull null]]);
|
|
498
|
+
}else{
|
|
499
|
+
callback(@[@"null", [NSNull null]]);
|
|
500
|
+
}
|
|
501
|
+
}
|
|
502
|
+
@catch(NSException *exception){
|
|
263
503
|
NSLog(@"RN-NotifyVisitors ERROR : %@", exception.reason);
|
|
264
504
|
}
|
|
265
505
|
}
|
|
266
506
|
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
RCT_EXPORT_METHOD(stopGeofencePushforDateTime:(NSString*_Nullable)nvDateTime AdditionalHours:(NSString*_Nullable)additionalHours) {
|
|
507
|
+
/* 12- REQUEST INAPP REVIEW */
|
|
508
|
+
RCT_EXPORT_METHOD(requestInAppReview: (RCTResponseSenderBlock) callback) {
|
|
270
509
|
@try{
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
510
|
+
NSLog(@"RN-NotifyVisitors : REQUEST IN APP REVIEW !!");
|
|
511
|
+
[notifyvisitors requestAppleAppStoreInAppReview];
|
|
512
|
+
}
|
|
513
|
+
@catch(NSException *exception){
|
|
514
|
+
NSLog(@"RN-NotifyVisitors ERROR : %@", exception.reason);
|
|
515
|
+
}
|
|
516
|
+
}
|
|
277
517
|
|
|
278
|
-
if ([additionalHours isEqual:[NSNull null]] || [additionalHours length] == 0){
|
|
279
|
-
nvAdditionalHours = 0;
|
|
280
|
-
}else{
|
|
281
|
-
nvAdditionalHours = [additionalHours intValue];
|
|
282
|
-
}
|
|
283
518
|
|
|
284
|
-
|
|
519
|
+
/* 13- GET SUBSCRIBE PUSH CATEGORY */
|
|
520
|
+
RCT_EXPORT_METHOD(subscribePushCategory: (NSArray *_Nullable)categoryInfo unsubscribe:(BOOL)unsubscribeSignal ) {
|
|
521
|
+
@try{
|
|
522
|
+
NSLog(@"RN-NotifyVisitors : SUBSCRIBE PUSH CATEGORY !!");
|
|
523
|
+
|
|
524
|
+
NSArray *categoryArray;
|
|
525
|
+
|
|
526
|
+
if (![categoryInfo isEqual:[NSNull null]]){
|
|
527
|
+
categoryArray = [categoryInfo mutableCopy];
|
|
528
|
+
} else{
|
|
529
|
+
categoryArray = nil;
|
|
530
|
+
}
|
|
531
|
+
|
|
532
|
+
dispatch_async(dispatch_get_main_queue(), ^{
|
|
533
|
+
[notifyvisitors pushPreferences: categoryArray isUnsubscribeFromAll: unsubscribeSignal ? YES : NO];
|
|
534
|
+
});
|
|
535
|
+
|
|
285
536
|
|
|
286
537
|
}
|
|
287
538
|
@catch(NSException *exception){
|
|
@@ -289,51 +540,63 @@ RCT_EXPORT_METHOD(stopGeofencePushforDateTime:(NSString*_Nullable)nvDateTime Ad
|
|
|
289
540
|
}
|
|
290
541
|
}
|
|
291
542
|
|
|
292
|
-
|
|
293
|
-
RCT_EXPORT_METHOD(
|
|
543
|
+
/* 14- Get Landing Page Data */
|
|
544
|
+
RCT_EXPORT_METHOD(getLinkInfo) {
|
|
294
545
|
@try{
|
|
295
|
-
NSLog(@"RN-NotifyVisitors : GET
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
546
|
+
NSLog(@"RN-NotifyVisitors : GET LINK INFO !!");
|
|
547
|
+
nvPushObserverReady = YES;
|
|
548
|
+
[[NSNotificationCenter defaultCenter] addObserverForName: @"NVInAppViewConroller" object: nil queue: nil usingBlock: ^(NSNotification *notification) {
|
|
549
|
+
NSDictionary *nvUserInfo = [notification userInfo];
|
|
550
|
+
if ([nvUserInfo count] > 0) {
|
|
551
|
+
NSError *nvError = nil;
|
|
552
|
+
NSData *nvJsonData = [NSJSONSerialization dataWithJSONObject: nvUserInfo options: NSJSONWritingPrettyPrinted error: &nvError];
|
|
553
|
+
NSString *nvJsonString = [[NSString alloc] initWithData: nvJsonData encoding: NSUTF8StringEncoding];
|
|
554
|
+
//NSLog(@"getLinkInfo = %@", notification);
|
|
555
|
+
[self sendEventWithName:@"nv_push_banner_click" body:@{@"data":nvJsonString}];
|
|
556
|
+
}else {
|
|
557
|
+
//[self sendEventWithName:callbacksplit[0] body:@{@"_callbackName": callbackName, @"data":@""}];
|
|
558
|
+
}
|
|
306
559
|
}];
|
|
307
|
-
|
|
560
|
+
|
|
308
561
|
}
|
|
309
562
|
@catch(NSException *exception){
|
|
310
563
|
NSLog(@"RN-NotifyVisitors ERROR : %@", exception.reason);
|
|
311
564
|
}
|
|
312
565
|
}
|
|
313
566
|
|
|
314
|
-
|
|
315
|
-
RCT_EXPORT_METHOD(
|
|
567
|
+
/* 15- Get NvUid */
|
|
568
|
+
RCT_EXPORT_METHOD(getNvUID: (RCTResponseSenderBlock)callback) {
|
|
316
569
|
@try{
|
|
317
|
-
NSLog(@"RN-NotifyVisitors :
|
|
318
|
-
[notifyvisitors
|
|
319
|
-
|
|
570
|
+
NSLog(@"RN-NotifyVisitors : GET NVUID !!");
|
|
571
|
+
[notifyvisitors getNvUid:^(NSString *nv_UIDStr){
|
|
572
|
+
//NSLog(@"notifyvisitors uid = %@", nv_UIDStr);
|
|
573
|
+
if([nv_UIDStr length] > 0){
|
|
574
|
+
callback(@[nv_UIDStr, [NSNull null]]);
|
|
575
|
+
}else{
|
|
576
|
+
callback(@[@"null", [NSNull null]]);
|
|
577
|
+
}
|
|
578
|
+
}];
|
|
579
|
+
|
|
320
580
|
}
|
|
321
581
|
@catch(NSException *exception){
|
|
322
582
|
NSLog(@"RN-NotifyVisitors ERROR : %@", exception.reason);
|
|
323
583
|
}
|
|
324
584
|
}
|
|
325
585
|
|
|
326
|
-
|
|
327
|
-
RCT_EXPORT_METHOD(
|
|
586
|
+
/* 16- Get notificvation Center data */
|
|
587
|
+
RCT_EXPORT_METHOD(getNotificationDataListener:(RCTResponseSenderBlock)callback) {
|
|
328
588
|
@try{
|
|
329
|
-
NSLog(@"RN-NotifyVisitors : GET
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
589
|
+
NSLog(@"RN-NotifyVisitors : GET NOTIFICATION DATA LISTENER !!");
|
|
590
|
+
[notifyvisitors GetNotificationCentreData:^(NSMutableArray * nvNotificationCenterData) {
|
|
591
|
+
|
|
592
|
+
if([nvNotificationCenterData count] > 0){
|
|
593
|
+
NSError *nvError = nil;
|
|
594
|
+
NSData *nvJsonData = [NSJSONSerialization dataWithJSONObject: nvNotificationCenterData options:NSJSONWritingPrettyPrinted error: &nvError];
|
|
595
|
+
NSString *nvJsonString = [[NSString alloc] initWithData: nvJsonData encoding: NSUTF8StringEncoding];
|
|
596
|
+
callback(@[nvJsonString, [NSNull null]]);
|
|
597
|
+
}else{
|
|
598
|
+
callback(@[@"No Notification Found", [NSNull null]]);
|
|
599
|
+
}
|
|
337
600
|
}];
|
|
338
601
|
|
|
339
602
|
}
|
|
@@ -342,102 +605,156 @@ RCT_EXPORT_METHOD(getNvUID: (RCTResponseSenderBlock)callback) {
|
|
|
342
605
|
}
|
|
343
606
|
}
|
|
344
607
|
|
|
345
|
-
|
|
346
|
-
|
|
608
|
+
|
|
609
|
+
/* 18- Stop Inapp Banner serveyes */
|
|
610
|
+
RCT_EXPORT_METHOD(stopNotifications) {
|
|
347
611
|
@try{
|
|
348
|
-
NSLog(@"RN-NotifyVisitors :
|
|
349
|
-
|
|
350
|
-
[notifyvisitors scrollViewDidScroll: nvScrollview];
|
|
612
|
+
NSLog(@"RN-NotifyVisitors : STOP NOTIFICATIONS !!");
|
|
613
|
+
[notifyvisitors DismissAllNotifyvisitorsInAppNotifications];
|
|
351
614
|
}
|
|
352
615
|
@catch(NSException *exception){
|
|
353
616
|
NSLog(@"RN-NotifyVisitors ERROR : %@", exception.reason);
|
|
354
617
|
}
|
|
355
618
|
}
|
|
356
619
|
|
|
357
|
-
|
|
620
|
+
|
|
621
|
+
/* 19- stop geofence push for date and time */
|
|
622
|
+
RCT_EXPORT_METHOD(stopGeofencePushforDateTime:(NSString*_Nullable)nvDateTime AdditionalHours:(NSString*_Nullable)additionalHours) {
|
|
623
|
+
@try{
|
|
624
|
+
NSLog(@"RN-NotifyVisitors : STOP GEOFENCE PUSH FOR DATE TIME !!");
|
|
625
|
+
NSInteger nvAdditionalHours = 0;
|
|
626
|
+
|
|
627
|
+
if ([nvDateTime isEqual:[NSNull null]] || [nvDateTime length] == 0){
|
|
628
|
+
nvDateTime = nil;
|
|
629
|
+
}
|
|
630
|
+
|
|
631
|
+
if ([additionalHours isEqual:[NSNull null]] || [additionalHours length] == 0){
|
|
632
|
+
nvAdditionalHours = 0;
|
|
633
|
+
}else{
|
|
634
|
+
nvAdditionalHours = [additionalHours intValue];
|
|
635
|
+
}
|
|
636
|
+
|
|
637
|
+
[notifyvisitors stopGeofencePushforDateTime: nvDateTime additionalHours: nvAdditionalHours];
|
|
638
|
+
|
|
639
|
+
}
|
|
640
|
+
@catch(NSException *exception){
|
|
641
|
+
NSLog(@"RN-NotifyVisitors ERROR : %@", exception.reason);
|
|
642
|
+
}
|
|
643
|
+
}
|
|
644
|
+
|
|
645
|
+
/* 21- SEPRATE CALLBACK OF EVENT SURVEY */
|
|
358
646
|
RCT_EXPORT_METHOD(getEventSurveyInfo: (RCTResponseSenderBlock)callback) {
|
|
359
647
|
@try{
|
|
360
648
|
NSLog(@"RN-NotifyVisitors : GET EVENT SURVERY INFO !!");
|
|
361
|
-
|
|
649
|
+
commonCallback = callback;
|
|
362
650
|
}
|
|
363
651
|
@catch(NSException *exception){
|
|
364
652
|
NSLog(@"RN-NotifyVisitors ERROR : %@", exception.reason);
|
|
365
653
|
}
|
|
366
654
|
}
|
|
367
655
|
|
|
368
|
-
|
|
369
|
-
|
|
656
|
+
|
|
657
|
+
/* 22 - Depricated Function For Notification Count */
|
|
658
|
+
RCT_EXPORT_METHOD(getNotificationCount:(RCTResponseSenderBlock)callback) {
|
|
370
659
|
@try{
|
|
371
|
-
NSLog(@"RN-NotifyVisitors : GET
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
660
|
+
NSLog(@"RN-NotifyVisitors : GET NOTIFICATION COUNT !!");
|
|
661
|
+
[notifyvisitors GetUnreadPushNotification:^(NSInteger nvUnreadPushCount) {
|
|
662
|
+
NSString *jCount = nil;
|
|
663
|
+
jCount = [@(nvUnreadPushCount) stringValue];
|
|
664
|
+
callback(@[jCount, [NSNull null]]);
|
|
665
|
+
}];
|
|
666
|
+
} @catch(NSException *exception){
|
|
667
|
+
NSLog(@"RN-NotifyVisitors ERROR : %@", exception.reason);
|
|
668
|
+
}
|
|
669
|
+
}
|
|
670
|
+
|
|
671
|
+
|
|
672
|
+
/* 23 - IOS Specific */
|
|
673
|
+
RCT_EXPORT_METHOD(scrollViewDidScroll_iOS_only) {
|
|
674
|
+
@try{
|
|
675
|
+
NSLog(@"RN-NotifyVisitors : SCROLL VIEW DID SCROLL IOS ONLY !!");
|
|
676
|
+
UIScrollView *nvScrollview;
|
|
677
|
+
[notifyvisitors scrollViewDidScroll: nvScrollview];
|
|
386
678
|
}
|
|
387
679
|
@catch(NSException *exception){
|
|
388
680
|
NSLog(@"RN-NotifyVisitors ERROR : %@", exception.reason);
|
|
389
681
|
}
|
|
390
682
|
}
|
|
391
683
|
|
|
684
|
+
|
|
685
|
+
|
|
392
686
|
/* internal method */
|
|
393
687
|
- (void)NotifyvisitorsChatBotActionCallbackWithUserInfo:(NSDictionary *)userInfo{
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
688
|
+
NSLog(@"RN-NotifyVisitors : NOTIFYVISITORS CHATBOT ACTION CALLBACK WITH USER INFO !!");
|
|
689
|
+
@try {
|
|
690
|
+
if ([userInfo count] > 0) {
|
|
691
|
+
NSError *nvError = nil;
|
|
692
|
+
NSData *nvJsonData = [NSJSONSerialization dataWithJSONObject: userInfo options: NSJSONWritingPrettyPrinted error: &nvError];
|
|
693
|
+
NSString *nvJsonString = [[NSString alloc] initWithData: nvJsonData encoding: NSUTF8StringEncoding];
|
|
694
|
+
[self sendEventWithName:@"nv_chat_bot_button_click" body:@{@"data":nvJsonString}];
|
|
695
|
+
}
|
|
402
696
|
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
697
|
+
}
|
|
698
|
+
@catch (NSException *exception) {
|
|
699
|
+
NSLog(@"RN-NotifyVisitors ERROR : %@", exception.reason);
|
|
700
|
+
}
|
|
701
|
+
|
|
408
702
|
}
|
|
409
703
|
|
|
410
704
|
|
|
411
705
|
/* internal method */
|
|
412
706
|
- (void)NotifyvisitorsGetEventResponseWithUserInfo:(NSDictionary *)userInfo{
|
|
413
707
|
NSLog(@"RN-NotifyVisitors : NOTIFYVISITORS GET EVENT RESPONSE WITH USER INFO!!");
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
708
|
+
@try {
|
|
709
|
+
if([userInfo count] > 0){
|
|
710
|
+
NSError *nvError = nil;
|
|
711
|
+
NSData *nvJsonData = [NSJSONSerialization dataWithJSONObject: userInfo options: NSJSONWritingPrettyPrinted error: &nvError];
|
|
712
|
+
NSString *nvJsonString = [[NSString alloc] initWithData: nvJsonData encoding: NSUTF8StringEncoding];
|
|
713
|
+
|
|
714
|
+
NSString * eventName = userInfo[@"eventName"];
|
|
715
|
+
// clicked is event or survey
|
|
716
|
+
if([eventName isEqualToString:@"Survey Submit"] || [eventName isEqualToString:@"Survey Attempt"] || [eventName isEqualToString:@"Banner Clicked"] ){
|
|
717
|
+
if(showCallback != NULL){
|
|
718
|
+
[self sendEventWithName:@"nv_show_callback" body:@{@"data":nvJsonString}];
|
|
719
|
+
}
|
|
720
|
+
}else{
|
|
721
|
+
if(eventCallback != NULL){
|
|
722
|
+
[self sendEventWithName:@"nv_event_callback" body:@{@"data":nvJsonString}];
|
|
723
|
+
}
|
|
724
|
+
}
|
|
725
|
+
|
|
726
|
+
if(commonCallback != NULL){
|
|
727
|
+
[self sendEventWithName:@"nv_common_show_event_callback" body:@{@"data":nvJsonString}];
|
|
728
|
+
}
|
|
729
|
+
|
|
730
|
+
}
|
|
731
|
+
}
|
|
732
|
+
@catch (NSException *exception) {
|
|
733
|
+
NSLog(@"RN-NotifyVisitors ERROR : %@", exception.reason);
|
|
734
|
+
}
|
|
735
|
+
}
|
|
736
|
+
|
|
737
|
+
|
|
738
|
+
-(UIColor*)GetColor:(NSString *)ColorString {
|
|
739
|
+
if ([[ColorString substringToIndex:1]isEqualToString:@"#"]) {
|
|
740
|
+
unsigned int c;
|
|
741
|
+
if ([ColorString characterAtIndex:0] == '#') {
|
|
742
|
+
[[NSScanner scannerWithString:[ColorString substringFromIndex:1]] scanHexInt:&c];
|
|
743
|
+
} else {
|
|
744
|
+
[[NSScanner scannerWithString:ColorString] scanHexInt:&c];
|
|
745
|
+
}
|
|
746
|
+
return [UIColor colorWithRed:((c & 0xff0000) >> 16)/255.0 green:((c & 0xff00) >> 8)/255.0 blue:(c & 0xff)/255.0 alpha:1.0];
|
|
747
|
+
} else {
|
|
748
|
+
NSString *sep = @"()";
|
|
749
|
+
NSCharacterSet *set = [NSCharacterSet characterSetWithCharactersInString:sep];
|
|
750
|
+
NSString *rgba = [ColorString componentsSeparatedByCharactersInSet:set][1];
|
|
751
|
+
CGFloat R = [[rgba componentsSeparatedByString:@","][0] floatValue];
|
|
752
|
+
CGFloat G = [[rgba componentsSeparatedByString:@","][1] floatValue];
|
|
753
|
+
CGFloat B = [[rgba componentsSeparatedByString:@","][2] floatValue];
|
|
754
|
+
CGFloat alpha = [[rgba componentsSeparatedByString:@","][3] floatValue];
|
|
755
|
+
UIColor *ResultColor = [UIColor colorWithRed:R/255 green:G/255 blue:B/255 alpha:alpha];
|
|
756
|
+
return ResultColor;
|
|
757
|
+
}
|
|
441
758
|
}
|
|
442
759
|
|
|
443
760
|
|
|
@@ -448,10 +765,10 @@ RCT_EXPORT_METHOD(getLinkInfo) {
|
|
|
448
765
|
|
|
449
766
|
// -(NSArray<NSString *> *)supportedEvents {
|
|
450
767
|
// NSMutableArray *events = [NSMutableArray new];
|
|
451
|
-
|
|
768
|
+
|
|
452
769
|
// for (int i = 0; i < OSNotificationEventTypesArray.count; i++)
|
|
453
770
|
// [events addObject:OSEventString(i)];
|
|
454
|
-
|
|
771
|
+
|
|
455
772
|
// return events;
|
|
456
773
|
// }
|
|
457
774
|
|