react-native-notifyvisitors 4.4.0 → 4.4.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/android/.classpath +6 -0
- package/android/.project +34 -0
- package/android/.settings/org.eclipse.buildship.core.prefs +3 -3
- package/android/.settings/org.eclipse.jdt.core.prefs +4 -0
- package/android/bin/.project +34 -0
- package/android/bin/.settings/org.eclipse.buildship.core.prefs +13 -0
- package/android/bin/build.gradle +45 -0
- package/android/bin/src/main/AndroidManifest.xml +24 -0
- package/android/bin/src/main/java/com/rn_notifyvisitors/RNNotifyvisitorsModule.class +0 -0
- package/android/bin/src/main/java/com/rn_notifyvisitors/RNNotifyvisitorsPackage.class +0 -0
- package/android/bin/src/main/res/values/strings.xml +3 -0
- package/android/build.gradle +4 -3
- package/android/src/main/AndroidManifest.xml +2 -1
- package/android/src/main/java/com/rn_notifyvisitors/RNNotifyvisitorsModule.java +384 -20
- package/index.d.ts +65 -29
- package/index.js +76 -2
- package/ios/RNNotifyvisitors/RCTNVEventEmitter.m +360 -339
- package/ios/RNNotifyvisitors/RNNotifyvisitors.h +10 -7
- package/ios/RNNotifyvisitors/RNNotifyvisitors.m +35 -1
- package/ios/RNNotifyvisitors.xcodeproj/project.pbxproj +4 -4
- package/ios/notifyvisitors.xcframework/ios-arm64/notifyvisitors.framework/Assets.car +0 -0
- package/ios/notifyvisitors.xcframework/ios-arm64/notifyvisitors.framework/Headers/notifyvisitors.h +3 -0
- package/ios/notifyvisitors.xcframework/ios-arm64/notifyvisitors.framework/Info.plist +0 -0
- package/ios/notifyvisitors.xcframework/ios-arm64/notifyvisitors.framework/PrivacyInfo.xcprivacy +61 -0
- package/ios/notifyvisitors.xcframework/ios-arm64/notifyvisitors.framework/_CodeSignature/CodeResources +16 -5
- package/ios/notifyvisitors.xcframework/ios-arm64/notifyvisitors.framework/notifyvisitors +0 -0
- package/ios/notifyvisitors.xcframework/ios-arm64_x86_64-maccatalyst/notifyvisitors.framework/Versions/A/Headers/notifyvisitors.h +3 -0
- package/ios/notifyvisitors.xcframework/ios-arm64_x86_64-maccatalyst/notifyvisitors.framework/Versions/A/Resources/Assets.car +0 -0
- package/ios/notifyvisitors.xcframework/ios-arm64_x86_64-maccatalyst/notifyvisitors.framework/Versions/A/Resources/Info.plist +5 -5
- package/ios/notifyvisitors.xcframework/ios-arm64_x86_64-maccatalyst/notifyvisitors.framework/Versions/A/Resources/PrivacyInfo.xcprivacy +61 -0
- package/ios/notifyvisitors.xcframework/ios-arm64_x86_64-maccatalyst/notifyvisitors.framework/Versions/A/_CodeSignature/CodeResources +16 -5
- package/ios/notifyvisitors.xcframework/ios-arm64_x86_64-maccatalyst/notifyvisitors.framework/Versions/A/notifyvisitors +0 -0
- package/ios/notifyvisitors.xcframework/ios-arm64_x86_64-simulator/notifyvisitors.framework/Assets.car +0 -0
- package/ios/notifyvisitors.xcframework/ios-arm64_x86_64-simulator/notifyvisitors.framework/Headers/notifyvisitors.h +3 -0
- package/ios/notifyvisitors.xcframework/ios-arm64_x86_64-simulator/notifyvisitors.framework/Info.plist +0 -0
- package/ios/notifyvisitors.xcframework/ios-arm64_x86_64-simulator/notifyvisitors.framework/PrivacyInfo.xcprivacy +61 -0
- package/ios/notifyvisitors.xcframework/ios-arm64_x86_64-simulator/notifyvisitors.framework/_CodeSignature/CodeResources +16 -5
- package/ios/notifyvisitors.xcframework/ios-arm64_x86_64-simulator/notifyvisitors.framework/notifyvisitors +0 -0
- package/package.json +1 -1
- package/react-native-notifyvisitors.podspec +1 -1
|
@@ -8,6 +8,8 @@ static BOOL hasListeners;
|
|
|
8
8
|
RCTResponseSenderBlock showCallback;
|
|
9
9
|
RCTResponseSenderBlock eventCallback;
|
|
10
10
|
RCTResponseSenderBlock commonCallback;
|
|
11
|
+
RCTResponseSenderBlock onKnownUserFoundCallback = NULL;
|
|
12
|
+
RCTResponseSenderBlock notificationCenterCallback = NULL;
|
|
11
13
|
|
|
12
14
|
BOOL nvInAppFound = false;
|
|
13
15
|
|
|
@@ -44,15 +46,17 @@ RCT_EXPORT_MODULE(RNNotifyvisitors);
|
|
|
44
46
|
}
|
|
45
47
|
|
|
46
48
|
|
|
49
|
+
#pragma mark - React-Native List of supported callback names
|
|
50
|
+
|
|
47
51
|
- (NSArray<NSString *> *)supportedEvents {
|
|
48
|
-
return @[@"nv_push_banner_click", @"nv_chat_bot_button_click", @"nv_show_callback", @"nv_event_callback", @"nv_common_show_event_callback"];
|
|
52
|
+
return @[@"nv_push_banner_click", @"nv_chat_bot_button_click", @"nv_show_callback", @"nv_event_callback", @"nv_common_show_event_callback", @"nv_center_callback", @"nv_known_user_identified_callback"];
|
|
49
53
|
}
|
|
50
54
|
|
|
51
55
|
// Will be called when this module's first listener is added.
|
|
52
56
|
- (void)startObserving {
|
|
53
57
|
hasListeners = YES;
|
|
54
58
|
NSLog(@"RN-NotifyVisitors : START OBSERVING !!");
|
|
55
|
-
[[NSNotificationCenter defaultCenter] postNotificationName
|
|
59
|
+
[[NSNotificationCenter defaultCenter] postNotificationName: @"didSetBridge" object: nil];
|
|
56
60
|
_startObserving = true;
|
|
57
61
|
}
|
|
58
62
|
|
|
@@ -62,8 +66,6 @@ RCT_EXPORT_MODULE(RNNotifyvisitors);
|
|
|
62
66
|
hasListeners = NO;
|
|
63
67
|
}
|
|
64
68
|
|
|
65
|
-
|
|
66
|
-
|
|
67
69
|
// Send Event Methods
|
|
68
70
|
- (void)emitEvent:(NSNotification *)notification {
|
|
69
71
|
if (!hasListeners) {
|
|
@@ -76,15 +78,39 @@ RCT_EXPORT_MODULE(RNNotifyvisitors);
|
|
|
76
78
|
+ (void)sendEventWithName:(NSString *)name withBody:(NSDictionary *)body {
|
|
77
79
|
if (hasListeners) {
|
|
78
80
|
NSLog(@"RN-NotifyVisitors : SEND EVENT WITH NAME !!");
|
|
79
|
-
[[NSNotificationCenter defaultCenter] postNotificationName:name object:nil userInfo:body];
|
|
81
|
+
[[NSNotificationCenter defaultCenter] postNotificationName: name object:nil userInfo:body];
|
|
80
82
|
}
|
|
81
83
|
}
|
|
82
84
|
|
|
83
85
|
// End of Send Event Methods
|
|
86
|
+
#pragma mark - Show inAppMessage (Banner/Survey methods)
|
|
87
|
+
|
|
88
|
+
/* 01 - Show inApp Banner & Serveys with callback*/
|
|
89
|
+
RCT_EXPORT_METHOD(showInAppMessage:(NSDictionary* _Nullable)nvUserToken customRules:(NSDictionary* _Nullable)nvCustomRule fragmentName:(NSString* _Nullable)fragmentName callback:(RCTResponseSenderBlock)nvcallback) {
|
|
90
|
+
|
|
91
|
+
NSLog(@"RN-NotifyVisitors : SHOW INAPP MESSAGE !!");
|
|
92
|
+
@try {
|
|
93
|
+
showCallback = nvcallback;
|
|
94
|
+
[self show: nvUserToken customRules: nvCustomRule fragmentName: fragmentName callback: nvcallback];
|
|
95
|
+
// NSError *nvError = nil;
|
|
96
|
+
// NSData *nvJsonData = nil;
|
|
97
|
+
// NSString *nvJsonString = nil;
|
|
98
|
+
// if([nvNotificationCenterData count] > 0){
|
|
99
|
+
// nvJsonData = [NSJSONSerialization dataWithJSONObject: nvNotificationCenterData options:NSJSONWritingPrettyPrinted error: &nvError];
|
|
100
|
+
// } else {
|
|
101
|
+
// NSDictionary *nvErrorDataResponse = @{@"message" : @"no notification(s)", @"notifications": @[]};
|
|
102
|
+
// nvJsonData = [NSJSONSerialization dataWithJSONObject: nvErrorDataResponse options:NSJSONWritingPrettyPrinted error: &nvError];
|
|
103
|
+
// }
|
|
104
|
+
//nvJsonString = [[NSString alloc] initWithData: nvJsonData encoding: NSUTF8StringEncoding];
|
|
105
|
+
// [self sendEventWithName:@"nv_show_callback" body:@{@"data": nvJsonString}];
|
|
106
|
+
|
|
107
|
+
} @catch(NSException *exception){
|
|
108
|
+
NSLog(@"RN-NotifyVisitors ERROR : %@", exception.reason);
|
|
109
|
+
}
|
|
110
|
+
}
|
|
84
111
|
|
|
85
|
-
/*
|
|
86
|
-
RCT_EXPORT_METHOD(show:(NSDictionary*_Nullable)nvUserToken customRules:(NSDictionary*_Nullable)nvCustomRule
|
|
87
|
-
mobile:(NSString*_Nullable)dummy callback:(RCTResponseSenderBlock)nvcallback ){
|
|
112
|
+
/* 02 - Show In App Banner, Alert, Serveys */
|
|
113
|
+
RCT_EXPORT_METHOD(show:(NSDictionary*_Nullable)nvUserToken customRules:(NSDictionary*_Nullable)nvCustomRule fragmentName:(NSString* _Nullable)fragmentName callback:(RCTResponseSenderBlock)nvcallback) {
|
|
88
114
|
@try{
|
|
89
115
|
NSLog(@"RN-NotifyVisitors : SHOW !!");
|
|
90
116
|
showCallback = nvcallback;
|
|
@@ -103,9 +129,6 @@ RCT_EXPORT_METHOD(show:(NSDictionary*_Nullable)nvUserToken customRules:(NSDicti
|
|
|
103
129
|
} else{
|
|
104
130
|
mCustomRule = nil;
|
|
105
131
|
}
|
|
106
|
-
|
|
107
|
-
//NSLog(@"Dictionary rule 1: %@", [mUserToken description]);
|
|
108
|
-
//NSLog(@"Dictionary token 2: %@", [mCustomRule description]);
|
|
109
132
|
dispatch_async(dispatch_get_main_queue(), ^{
|
|
110
133
|
[notifyvisitors Show:mUserToken CustomRule:mCustomRule];
|
|
111
134
|
[self checkForBannerNotFound];
|
|
@@ -116,7 +139,7 @@ RCT_EXPORT_METHOD(show:(NSDictionary*_Nullable)nvUserToken customRules:(NSDicti
|
|
|
116
139
|
}
|
|
117
140
|
}
|
|
118
141
|
|
|
119
|
-
- (void)checkForBannerNotFound{
|
|
142
|
+
- (void)checkForBannerNotFound {
|
|
120
143
|
@try{
|
|
121
144
|
NSLog(@"RN-NotifyVisitors : checkForBannerNotFound !!");
|
|
122
145
|
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, 1.2 * NSEC_PER_SEC), dispatch_get_main_queue(), ^{
|
|
@@ -138,8 +161,69 @@ RCT_EXPORT_METHOD(show:(NSDictionary*_Nullable)nvUserToken customRules:(NSDicti
|
|
|
138
161
|
}
|
|
139
162
|
}
|
|
140
163
|
|
|
164
|
+
/* 03 - Stop Inapp Banner serveyes */
|
|
165
|
+
RCT_EXPORT_METHOD(stopNotifications) {
|
|
166
|
+
@try{
|
|
167
|
+
NSLog(@"RN-NotifyVisitors : STOP NOTIFICATIONS !!");
|
|
168
|
+
[notifyvisitors DismissAllNotifyvisitorsInAppNotifications];
|
|
169
|
+
}
|
|
170
|
+
@catch(NSException *exception){
|
|
171
|
+
NSLog(@"RN-NotifyVisitors ERROR : %@", exception.reason);
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
/* 04 - SEPRATE CALLBACK OF EVENT SURVEY */
|
|
176
|
+
RCT_EXPORT_METHOD(getEventSurveyInfo: (RCTResponseSenderBlock)callback) {
|
|
177
|
+
@try{
|
|
178
|
+
NSLog(@"RN-NotifyVisitors : GET EVENT SURVERY INFO !!");
|
|
179
|
+
commonCallback = callback;
|
|
180
|
+
}
|
|
181
|
+
@catch(NSException *exception){
|
|
182
|
+
NSLog(@"RN-NotifyVisitors ERROR : %@", exception.reason);
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
/* 05 - scrollViewDidScroll (IOS Specific only) */
|
|
187
|
+
RCT_EXPORT_METHOD(scrollViewDidScroll_iOS_only) {
|
|
188
|
+
@try{
|
|
189
|
+
NSLog(@"RN-NotifyVisitors : SCROLL VIEW DID SCROLL IOS ONLY !!");
|
|
190
|
+
UIScrollView *nvScrollview;
|
|
191
|
+
[notifyvisitors scrollViewDidScroll: nvScrollview];
|
|
192
|
+
}
|
|
193
|
+
@catch(NSException *exception){
|
|
194
|
+
NSLog(@"RN-NotifyVisitors ERROR : %@", exception.reason);
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
|
|
199
|
+
#pragma mark - Open Notification Center old and new method with Close button Callback
|
|
200
|
+
|
|
201
|
+
/* 06 - Open Notification Center with callback */
|
|
202
|
+
RCT_EXPORT_METHOD(openNotificationCenter:(NSDictionary* _Nullable)tmpAppInboxInfo dismiss:(NSString* _Nullable)dismissValue callback:(RCTResponseSenderBlock)nvcallback) {
|
|
203
|
+
NSLog(@"RN-NotifyVisitors : OPEN NOTIFICATION CENTER !!");
|
|
204
|
+
notificationCenterCallback = nvcallback;
|
|
205
|
+
@try{
|
|
206
|
+
[self showNotifications: tmpAppInboxInfo dismiss: dismissValue];
|
|
207
|
+
// NSError *nvError = nil;
|
|
208
|
+
// NSData *nvJsonData = nil;
|
|
209
|
+
// NSString *nvJsonString = nil;
|
|
210
|
+
// if([nvNotificationCenterData count] > 0){
|
|
211
|
+
// nvJsonData = [NSJSONSerialization dataWithJSONObject: nvNotificationCenterData options:NSJSONWritingPrettyPrinted error: &nvError];
|
|
212
|
+
// } else {
|
|
213
|
+
// NSDictionary *nvErrorDataResponse = @{@"message" : @"no notification(s)", @"notifications": @[]};
|
|
214
|
+
// nvJsonData = [NSJSONSerialization dataWithJSONObject: nvErrorDataResponse options:NSJSONWritingPrettyPrinted error: &nvError];
|
|
215
|
+
// }
|
|
216
|
+
//nvJsonString = [[NSString alloc] initWithData: nvJsonData encoding: NSUTF8StringEncoding];
|
|
217
|
+
// [self sendEventWithName:@"nv_center_callback" body:@{@"data": nvJsonString}];
|
|
218
|
+
}
|
|
219
|
+
@catch(NSException *exception){
|
|
220
|
+
NSLog(@"RN-NotifyVisitors ERROR : %@", exception.reason);
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
}
|
|
141
224
|
|
|
142
|
-
|
|
225
|
+
/* 07 - show Notification Center */
|
|
226
|
+
RCT_EXPORT_METHOD(showNotifications:(NSDictionary*_Nullable)tmpAppInboxInfo dismiss:(NSString*_Nullable)dismissValue) {
|
|
143
227
|
NSLog(@"RN-NotifyVisitors : SHOW NOTIFICATIONS !!");
|
|
144
228
|
|
|
145
229
|
NSString * tab1Label;
|
|
@@ -184,9 +268,9 @@ RCT_EXPORT_METHOD(showNotifications:(NSDictionary*_Nullable)temp dismiss:(NSStri
|
|
|
184
268
|
mSelectedTabBgColor = nil;
|
|
185
269
|
mUnselectedTabBgColor = nil;
|
|
186
270
|
|
|
187
|
-
if ([
|
|
271
|
+
if ([tmpAppInboxInfo count] > 0){
|
|
188
272
|
appInboxInfo = [[NSMutableDictionary alloc] init];
|
|
189
|
-
appInboxInfo = [
|
|
273
|
+
appInboxInfo = [tmpAppInboxInfo mutableCopy];
|
|
190
274
|
|
|
191
275
|
|
|
192
276
|
if (appInboxInfo[@"label_one"] && ![appInboxInfo[@"label_one"] isEqual: [NSNull null]]) {
|
|
@@ -303,86 +387,8 @@ RCT_EXPORT_METHOD(showNotifications:(NSDictionary*_Nullable)temp dismiss:(NSStri
|
|
|
303
387
|
}
|
|
304
388
|
}
|
|
305
389
|
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
/*3 - Hit Event */
|
|
310
|
-
RCT_EXPORT_METHOD(event:(NSString*_Nullable)eventName Attributes:(NSDictionary*_Nullable)attributes
|
|
311
|
-
LifeTimeValue:(NSString*_Nullable)lifeTimeValue Scope:(NSString*_Nullable)scope callback:(RCTResponseSenderBlock)nvcallback) {
|
|
312
|
-
@try{
|
|
313
|
-
NSLog(@"RN-NotifyVisitors : EVENT !!");
|
|
314
|
-
eventCallback = nvcallback;
|
|
315
|
-
NSMutableDictionary *jAttributes = [[NSMutableDictionary alloc] init];
|
|
316
|
-
int nvScope = 0;
|
|
317
|
-
|
|
318
|
-
if([eventName isEqual:[NSNull null]] || [eventName length] == 0){
|
|
319
|
-
eventName = nil;
|
|
320
|
-
}
|
|
321
|
-
|
|
322
|
-
if (![attributes isEqual:[NSNull null]]){
|
|
323
|
-
jAttributes = [attributes mutableCopy];
|
|
324
|
-
}else{
|
|
325
|
-
jAttributes = nil;
|
|
326
|
-
}
|
|
327
|
-
|
|
328
|
-
if([lifeTimeValue isEqual:[NSNull null]] || [lifeTimeValue length] == 0){
|
|
329
|
-
lifeTimeValue = nil;
|
|
330
|
-
}
|
|
331
|
-
|
|
332
|
-
if([scope isEqual:[NSNull null]] ){
|
|
333
|
-
nvScope = 0;
|
|
334
|
-
} else if([scope length] == 0){
|
|
335
|
-
nvScope = 0;
|
|
336
|
-
}else{
|
|
337
|
-
nvScope = [scope intValue];
|
|
338
|
-
}
|
|
339
|
-
|
|
340
|
-
//NSLog(@"Dictionary: %@",jAttributes);
|
|
341
|
-
[notifyvisitors trackEvents:eventName Attributes:jAttributes lifetimeValue:lifeTimeValue Scope:nvScope];
|
|
342
|
-
|
|
343
|
-
}
|
|
344
|
-
@catch(NSException *exception){
|
|
345
|
-
NSLog(@"RN-NotifyVisitors ERROR : %@", exception.reason);
|
|
346
|
-
}
|
|
347
|
-
}
|
|
348
|
-
|
|
349
|
-
/* 4- user identifier method */
|
|
350
|
-
RCT_EXPORT_METHOD(userIdentifier:(NSString*_Nullable)nvUserID UserParams:(NSDictionary*_Nullable)nvUserParams) {
|
|
351
|
-
@try{
|
|
352
|
-
NSLog(@"RN-NotifyVisitors : USER IDENTIFIER !!");
|
|
353
|
-
NSMutableDictionary *mUserParams = [[NSMutableDictionary alloc] init];
|
|
354
|
-
|
|
355
|
-
if( [nvUserID isEqual:[NSNull null]] || [nvUserID length] == 0){
|
|
356
|
-
nvUserID = nil;
|
|
357
|
-
}
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
if (![nvUserParams isEqual:[NSNull null]]){
|
|
361
|
-
mUserParams = [nvUserParams mutableCopy];
|
|
362
|
-
} else{
|
|
363
|
-
mUserParams = nil;
|
|
364
|
-
}
|
|
365
|
-
|
|
366
|
-
[notifyvisitors UserIdentifier: nvUserID UserParams: mUserParams];
|
|
367
|
-
}
|
|
368
|
-
@catch(NSException *exception){
|
|
369
|
-
NSLog(@"RN-NotifyVisitors ERROR : %@", exception.reason);
|
|
370
|
-
}
|
|
371
|
-
}
|
|
372
|
-
|
|
373
|
-
/* 5- Start Chat Bot */
|
|
374
|
-
RCT_EXPORT_METHOD(startChatBot: (NSString*_Nullable)screenName) {
|
|
375
|
-
@try{
|
|
376
|
-
NSLog(@"RN-NotifyVisitors : START CHATBOT !!");
|
|
377
|
-
NSLog(@"This feature temporarily not available. Please contact our support team for more assistance");
|
|
378
|
-
}
|
|
379
|
-
@catch(NSException *exception){
|
|
380
|
-
NSLog(@"RN-NotifyVisitors ERROR : %@", exception.reason);
|
|
381
|
-
}
|
|
382
|
-
}
|
|
383
|
-
|
|
384
|
-
/* 10- GET NOTIFICATION CENTER COUNT */
|
|
385
|
-
RCT_EXPORT_METHOD(getNotificationCenterCount: (NSDictionary*_Nullable)tabCountInfo response:(RCTResponseSenderBlock) callback){
|
|
390
|
+
/* 08 - GET NOTIFICATION CENTER COUNT */
|
|
391
|
+
RCT_EXPORT_METHOD(getNotificationCenterCount: (NSDictionary*_Nullable)tabCountInfo response:(RCTResponseSenderBlock) callback) {
|
|
386
392
|
@try{
|
|
387
393
|
NSLog(@"RN-NotifyVisitors : GET NOTIFICATION CENTER COUNT !!");
|
|
388
394
|
NSString * tab1Label;
|
|
@@ -464,111 +470,7 @@ RCT_EXPORT_METHOD(getNotificationCenterCount: (NSDictionary*_Nullable)tabCountIn
|
|
|
464
470
|
}
|
|
465
471
|
}
|
|
466
472
|
|
|
467
|
-
|
|
468
|
-
NSError *nvError = nil;
|
|
469
|
-
NSData *nvJsonData = nil;
|
|
470
|
-
NSString *nvJsonString = nil;
|
|
471
|
-
nvJsonData = [NSJSONSerialization dataWithJSONObject: nvCenterCounts options:NSJSONWritingPrettyPrinted error: &nvError];
|
|
472
|
-
nvJsonString = [[NSString alloc] initWithData: nvJsonData encoding: NSUTF8StringEncoding];
|
|
473
|
-
callback(@[nvJsonString, [NSNull null]]);
|
|
474
|
-
}
|
|
475
|
-
|
|
476
|
-
/* 11- GET REGISTRATION TOKEN */
|
|
477
|
-
RCT_EXPORT_METHOD(getRegistrationToken: (RCTResponseSenderBlock) callback) {
|
|
478
|
-
@try{
|
|
479
|
-
NSLog(@"RN-NotifyVisitors : GET REGISTRATION TOKEN !!");
|
|
480
|
-
NSString *nvPushToken = [notifyvisitors getPushRegistrationToken];
|
|
481
|
-
if([nvPushToken length] > 0){
|
|
482
|
-
callback(@[nvPushToken, [NSNull null]]);
|
|
483
|
-
}else{
|
|
484
|
-
callback(@[@"null", [NSNull null]]);
|
|
485
|
-
}
|
|
486
|
-
}
|
|
487
|
-
@catch(NSException *exception){
|
|
488
|
-
NSLog(@"RN-NotifyVisitors ERROR : %@", exception.reason);
|
|
489
|
-
}
|
|
490
|
-
}
|
|
491
|
-
|
|
492
|
-
/* 12- REQUEST INAPP REVIEW */
|
|
493
|
-
RCT_EXPORT_METHOD(requestInAppReview: (RCTResponseSenderBlock) callback) {
|
|
494
|
-
@try{
|
|
495
|
-
NSLog(@"RN-NotifyVisitors : REQUEST IN APP REVIEW !!");
|
|
496
|
-
[notifyvisitors requestAppleAppStoreInAppReview];
|
|
497
|
-
}
|
|
498
|
-
@catch(NSException *exception){
|
|
499
|
-
NSLog(@"RN-NotifyVisitors ERROR : %@", exception.reason);
|
|
500
|
-
}
|
|
501
|
-
}
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
/* 13- GET SUBSCRIBE PUSH CATEGORY */
|
|
505
|
-
RCT_EXPORT_METHOD(subscribePushCategory: (NSArray *_Nullable)categoryInfo unsubscribe:(BOOL)unsubscribeSignal ) {
|
|
506
|
-
@try{
|
|
507
|
-
NSLog(@"RN-NotifyVisitors : SUBSCRIBE PUSH CATEGORY !!");
|
|
508
|
-
|
|
509
|
-
NSArray *categoryArray;
|
|
510
|
-
|
|
511
|
-
if (![categoryInfo isEqual:[NSNull null]]){
|
|
512
|
-
categoryArray = [categoryInfo mutableCopy];
|
|
513
|
-
} else{
|
|
514
|
-
categoryArray = nil;
|
|
515
|
-
}
|
|
516
|
-
|
|
517
|
-
dispatch_async(dispatch_get_main_queue(), ^{
|
|
518
|
-
[notifyvisitors pushPreferences: categoryArray isUnsubscribeFromAll: unsubscribeSignal ? YES : NO];
|
|
519
|
-
});
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
}
|
|
523
|
-
@catch(NSException *exception){
|
|
524
|
-
NSLog(@"RN-NotifyVisitors ERROR : %@", exception.reason);
|
|
525
|
-
}
|
|
526
|
-
}
|
|
527
|
-
|
|
528
|
-
/* 14- Get Landing Page Data */
|
|
529
|
-
RCT_EXPORT_METHOD(getLinkInfo) {
|
|
530
|
-
@try{
|
|
531
|
-
NSLog(@"RN-NotifyVisitors : GET LINK INFO !!");
|
|
532
|
-
nvPushObserverReady = YES;
|
|
533
|
-
[[NSNotificationCenter defaultCenter] addObserverForName: @"NVInAppViewConroller" object: nil queue: nil usingBlock: ^(NSNotification *notification) {
|
|
534
|
-
NSDictionary *nvUserInfo = [notification userInfo];
|
|
535
|
-
if ([nvUserInfo count] > 0) {
|
|
536
|
-
NSError *nvError = nil;
|
|
537
|
-
NSData *nvJsonData = [NSJSONSerialization dataWithJSONObject: nvUserInfo options: NSJSONWritingPrettyPrinted error: &nvError];
|
|
538
|
-
NSString *nvJsonString = [[NSString alloc] initWithData: nvJsonData encoding: NSUTF8StringEncoding];
|
|
539
|
-
//NSLog(@"getLinkInfo = %@", notification);
|
|
540
|
-
[self sendEventWithName:@"nv_push_banner_click" body:@{@"data":nvJsonString}];
|
|
541
|
-
}else {
|
|
542
|
-
//[self sendEventWithName:callbacksplit[0] body:@{@"_callbackName": callbackName, @"data":@""}];
|
|
543
|
-
}
|
|
544
|
-
}];
|
|
545
|
-
|
|
546
|
-
}
|
|
547
|
-
@catch(NSException *exception){
|
|
548
|
-
NSLog(@"RN-NotifyVisitors ERROR : %@", exception.reason);
|
|
549
|
-
}
|
|
550
|
-
}
|
|
551
|
-
|
|
552
|
-
/* 15- Get NvUid */
|
|
553
|
-
RCT_EXPORT_METHOD(getNvUID: (RCTResponseSenderBlock)callback) {
|
|
554
|
-
@try{
|
|
555
|
-
NSLog(@"RN-NotifyVisitors : GET NVUID !!");
|
|
556
|
-
[notifyvisitors getNvUid:^(NSString *nv_UIDStr){
|
|
557
|
-
//NSLog(@"notifyvisitors uid = %@", nv_UIDStr);
|
|
558
|
-
if([nv_UIDStr length] > 0){
|
|
559
|
-
callback(@[nv_UIDStr, [NSNull null]]);
|
|
560
|
-
}else{
|
|
561
|
-
callback(@[@"null", [NSNull null]]);
|
|
562
|
-
}
|
|
563
|
-
}];
|
|
564
|
-
|
|
565
|
-
}
|
|
566
|
-
@catch(NSException *exception){
|
|
567
|
-
NSLog(@"RN-NotifyVisitors ERROR : %@", exception.reason);
|
|
568
|
-
}
|
|
569
|
-
}
|
|
570
|
-
|
|
571
|
-
/* 16- Get notificvation Center data */
|
|
473
|
+
/* 09 - Get notificvation Center data */
|
|
572
474
|
RCT_EXPORT_METHOD(getNotificationDataListener:(RCTResponseSenderBlock)callback) {
|
|
573
475
|
@try{
|
|
574
476
|
NSLog(@"RN-NotifyVisitors : GET NOTIFICATION DATA LISTENER !!");
|
|
@@ -590,7 +492,7 @@ RCT_EXPORT_METHOD(getNotificationDataListener:(RCTResponseSenderBlock)callback)
|
|
|
590
492
|
}
|
|
591
493
|
}
|
|
592
494
|
|
|
593
|
-
/*
|
|
495
|
+
/* 10 - Get notificvation Center data in callback in new format */
|
|
594
496
|
RCT_EXPORT_METHOD(getNotificationCenterData:(RCTResponseSenderBlock)callback) {
|
|
595
497
|
@try{
|
|
596
498
|
NSLog(@"RN-NotifyVisitors : GET NOTIFICATION CENTER DATA !!");
|
|
@@ -618,19 +520,110 @@ RCT_EXPORT_METHOD(getNotificationCenterData:(RCTResponseSenderBlock)callback) {
|
|
|
618
520
|
}
|
|
619
521
|
}
|
|
620
522
|
|
|
621
|
-
/*
|
|
622
|
-
RCT_EXPORT_METHOD(
|
|
523
|
+
/* 11 - Depricated Function For Notification Count */
|
|
524
|
+
RCT_EXPORT_METHOD(getNotificationCount:(RCTResponseSenderBlock)callback) {
|
|
623
525
|
@try{
|
|
624
|
-
NSLog(@"RN-NotifyVisitors :
|
|
625
|
-
[notifyvisitors
|
|
526
|
+
NSLog(@"RN-NotifyVisitors : GET NOTIFICATION COUNT !!");
|
|
527
|
+
[notifyvisitors GetUnreadPushNotification:^(NSInteger nvUnreadPushCount) {
|
|
528
|
+
NSString *jCount = nil;
|
|
529
|
+
jCount = [@(nvUnreadPushCount) stringValue];
|
|
530
|
+
callback(@[jCount, [NSNull null]]);
|
|
531
|
+
}];
|
|
532
|
+
} @catch(NSException *exception){
|
|
533
|
+
NSLog(@"RN-NotifyVisitors ERROR : %@", exception.reason);
|
|
534
|
+
}
|
|
535
|
+
}
|
|
536
|
+
|
|
537
|
+
- (void) sendTabCountResponse : (NSDictionary *) nvCenterCounts responseToSend:(RCTResponseSenderBlock) callback {
|
|
538
|
+
NSError *nvError = nil;
|
|
539
|
+
NSData *nvJsonData = nil;
|
|
540
|
+
NSString *nvJsonString = nil;
|
|
541
|
+
nvJsonData = [NSJSONSerialization dataWithJSONObject: nvCenterCounts options:NSJSONWritingPrettyPrinted error: &nvError];
|
|
542
|
+
nvJsonString = [[NSString alloc] initWithData: nvJsonData encoding: NSUTF8StringEncoding];
|
|
543
|
+
callback(@[nvJsonString, [NSNull null]]);
|
|
544
|
+
}
|
|
545
|
+
|
|
546
|
+
#pragma mark - Track Events method
|
|
547
|
+
|
|
548
|
+
/* 12 - Hit Event */
|
|
549
|
+
RCT_EXPORT_METHOD(event:(NSString*_Nullable)eventName Attributes:(NSDictionary* _Nullable)attributes LifeTimeValue:(NSString* _Nullable)lifeTimeValue Scope:(NSString* _Nullable)scope callback:(RCTResponseSenderBlock)nvcallback) {
|
|
550
|
+
@try{
|
|
551
|
+
NSLog(@"RN-NotifyVisitors : EVENT !!");
|
|
552
|
+
eventCallback = nvcallback;
|
|
553
|
+
NSMutableDictionary *jAttributes = [[NSMutableDictionary alloc] init];
|
|
554
|
+
int nvScope = 0;
|
|
555
|
+
|
|
556
|
+
if([eventName isEqual:[NSNull null]] || [eventName length] == 0){
|
|
557
|
+
eventName = nil;
|
|
558
|
+
}
|
|
559
|
+
|
|
560
|
+
if (![attributes isEqual:[NSNull null]]){
|
|
561
|
+
jAttributes = [attributes mutableCopy];
|
|
562
|
+
}else{
|
|
563
|
+
jAttributes = nil;
|
|
564
|
+
}
|
|
565
|
+
|
|
566
|
+
if([lifeTimeValue isEqual:[NSNull null]] || [lifeTimeValue length] == 0){
|
|
567
|
+
lifeTimeValue = nil;
|
|
568
|
+
}
|
|
569
|
+
|
|
570
|
+
if([scope isEqual:[NSNull null]] ){
|
|
571
|
+
nvScope = 0;
|
|
572
|
+
} else if([scope length] == 0){
|
|
573
|
+
nvScope = 0;
|
|
574
|
+
}else{
|
|
575
|
+
nvScope = [scope intValue];
|
|
576
|
+
}
|
|
577
|
+
|
|
578
|
+
//NSLog(@"Dictionary: %@",jAttributes);
|
|
579
|
+
[notifyvisitors trackEvents:eventName Attributes:jAttributes lifetimeValue:lifeTimeValue Scope:nvScope];
|
|
580
|
+
|
|
626
581
|
}
|
|
627
582
|
@catch(NSException *exception){
|
|
628
583
|
NSLog(@"RN-NotifyVisitors ERROR : %@", exception.reason);
|
|
629
584
|
}
|
|
630
585
|
}
|
|
631
586
|
|
|
587
|
+
#pragma mark - Push Notifications related methods
|
|
588
|
+
|
|
589
|
+
/* 13 - Schedule Push Notification */
|
|
590
|
+
RCT_EXPORT_METHOD(scheduleNotification:(NSString *_Nullable)nid tag:(NSString *_Nullable)tag timeinSecond:(NSString *_Nullable)time title:(NSString *_Nullable)title message:(NSString *_Nullable)message url:(NSString *_Nullable)url icon:(NSString *_Nullable)icon) {
|
|
591
|
+
@try{
|
|
592
|
+
NSLog(@"RN-NotifyVisitors : SCHEDULE PUSH NOTIFICATION !!");
|
|
593
|
+
|
|
594
|
+
if([nid isEqual:[NSNull null]] || [nid length] == 0){
|
|
595
|
+
nid = nil;
|
|
596
|
+
}
|
|
597
|
+
|
|
598
|
+
if([tag isEqual:[NSNull null]] || [tag length] == 0){
|
|
599
|
+
tag = nil;
|
|
600
|
+
}
|
|
601
|
+
|
|
602
|
+
if([time isEqual:[NSNull null]] || [time length] == 0){
|
|
603
|
+
time = nil;
|
|
604
|
+
}
|
|
605
|
+
if([title isEqual:[NSNull null]] || [title length] == 0){
|
|
606
|
+
title = nil;
|
|
607
|
+
}
|
|
608
|
+
if([message isEqual:[NSNull null]] || [message length] == 0){
|
|
609
|
+
message = nil;
|
|
610
|
+
}
|
|
611
|
+
if([url isEqual:[NSNull null]] || [url length] == 0){
|
|
612
|
+
url = nil;
|
|
613
|
+
}
|
|
614
|
+
if([icon isEqual:[NSNull null]] || [icon length] == 0){
|
|
615
|
+
icon = nil;
|
|
616
|
+
}
|
|
617
|
+
|
|
618
|
+
[notifyvisitors schedulePushNotificationwithNotificationID: nid Tag: tag TimeinSecond: time Title: title Message: message URL: url Icon: icon];
|
|
619
|
+
|
|
620
|
+
}
|
|
621
|
+
@catch(NSException *exception){
|
|
622
|
+
NSLog(@"RN-NotifyVisitors ERROR : %@", exception.reason);
|
|
623
|
+
}
|
|
624
|
+
}
|
|
632
625
|
|
|
633
|
-
/*
|
|
626
|
+
/* 14 - stop geofence push for date and time */
|
|
634
627
|
RCT_EXPORT_METHOD(stopGeofencePushforDateTime:(NSString*_Nullable)nvDateTime AdditionalHours:(NSString*_Nullable)additionalHours) {
|
|
635
628
|
@try{
|
|
636
629
|
NSLog(@"RN-NotifyVisitors : STOP GEOFENCE PUSH FOR DATE TIME !!");
|
|
@@ -654,48 +647,139 @@ RCT_EXPORT_METHOD(stopGeofencePushforDateTime:(NSString*_Nullable)nvDateTime Ad
|
|
|
654
647
|
}
|
|
655
648
|
}
|
|
656
649
|
|
|
657
|
-
/*
|
|
658
|
-
RCT_EXPORT_METHOD(
|
|
650
|
+
/* 15 - GET SUBSCRIBE PUSH CATEGORY */
|
|
651
|
+
RCT_EXPORT_METHOD(subscribePushCategory: (NSArray *_Nullable)categoryInfo unsubscribe:(BOOL)unsubscribeSignal ) {
|
|
659
652
|
@try{
|
|
660
|
-
NSLog(@"RN-NotifyVisitors :
|
|
661
|
-
|
|
653
|
+
NSLog(@"RN-NotifyVisitors : SUBSCRIBE PUSH CATEGORY !!");
|
|
654
|
+
|
|
655
|
+
NSArray *categoryArray;
|
|
656
|
+
|
|
657
|
+
if (![categoryInfo isEqual:[NSNull null]]){
|
|
658
|
+
categoryArray = [categoryInfo mutableCopy];
|
|
659
|
+
} else{
|
|
660
|
+
categoryArray = nil;
|
|
661
|
+
}
|
|
662
|
+
|
|
663
|
+
dispatch_async(dispatch_get_main_queue(), ^{
|
|
664
|
+
[notifyvisitors pushPreferences: categoryArray isUnsubscribeFromAll: unsubscribeSignal ? YES : NO];
|
|
665
|
+
});
|
|
666
|
+
|
|
667
|
+
|
|
668
|
+
}
|
|
669
|
+
@catch(NSException *exception){
|
|
670
|
+
NSLog(@"RN-NotifyVisitors ERROR : %@", exception.reason);
|
|
671
|
+
}
|
|
672
|
+
}
|
|
673
|
+
|
|
674
|
+
/* 16 - GET REGISTRATION TOKEN */
|
|
675
|
+
RCT_EXPORT_METHOD(getRegistrationToken: (RCTResponseSenderBlock) callback) {
|
|
676
|
+
@try{
|
|
677
|
+
NSLog(@"RN-NotifyVisitors : GET REGISTRATION TOKEN !!");
|
|
678
|
+
NSString *nvPushToken = [notifyvisitors getPushRegistrationToken];
|
|
679
|
+
if([nvPushToken length] > 0){
|
|
680
|
+
callback(@[nvPushToken, [NSNull null]]);
|
|
681
|
+
}else{
|
|
682
|
+
callback(@[@"null", [NSNull null]]);
|
|
683
|
+
}
|
|
662
684
|
}
|
|
663
685
|
@catch(NSException *exception){
|
|
664
686
|
NSLog(@"RN-NotifyVisitors ERROR : %@", exception.reason);
|
|
665
687
|
}
|
|
666
688
|
}
|
|
667
689
|
|
|
690
|
+
#pragma mark - Track User Methods
|
|
668
691
|
|
|
669
|
-
/*
|
|
670
|
-
RCT_EXPORT_METHOD(
|
|
692
|
+
/* 17 - user identifier method */
|
|
693
|
+
RCT_EXPORT_METHOD(userIdentifier:(NSString*_Nullable)nvUserID UserParams:(NSDictionary*_Nullable)nvUserParams) {
|
|
671
694
|
@try{
|
|
672
|
-
NSLog(@"RN-NotifyVisitors :
|
|
673
|
-
[
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
695
|
+
NSLog(@"RN-NotifyVisitors : USER IDENTIFIER !!");
|
|
696
|
+
NSMutableDictionary *mUserParams = [[NSMutableDictionary alloc] init];
|
|
697
|
+
|
|
698
|
+
if( [nvUserID isEqual:[NSNull null]] || [nvUserID length] == 0){
|
|
699
|
+
nvUserID = nil;
|
|
700
|
+
}
|
|
701
|
+
|
|
702
|
+
|
|
703
|
+
if (![nvUserParams isEqual:[NSNull null]]){
|
|
704
|
+
mUserParams = [nvUserParams mutableCopy];
|
|
705
|
+
} else{
|
|
706
|
+
mUserParams = nil;
|
|
707
|
+
}
|
|
708
|
+
|
|
709
|
+
[notifyvisitors UserIdentifier: nvUserID UserParams: mUserParams];
|
|
710
|
+
}
|
|
711
|
+
@catch(NSException *exception){
|
|
712
|
+
NSLog(@"RN-NotifyVisitors ERROR : %@", exception.reason);
|
|
713
|
+
}
|
|
714
|
+
}
|
|
715
|
+
|
|
716
|
+
// static setUserIdentifier(sJsonObject, callback) {
|
|
717
|
+
RCT_EXPORT_METHOD(setUserIdentifier:(NSDictionary*_Nullable)nvUserParams onUserTrackListener:(RCTResponseSenderBlock)onUserTrackListener) {
|
|
718
|
+
NSLog(@"RN-NotifyVisitors : SET USER IDENTIFIER !!");
|
|
719
|
+
@try {
|
|
720
|
+
|
|
721
|
+
|
|
722
|
+
NSDictionary *nvFinalUserParams = nil;
|
|
723
|
+
if ([nvUserParams count] > 0) {
|
|
724
|
+
nvFinalUserParams = nvUserParams;
|
|
725
|
+
}
|
|
726
|
+
|
|
727
|
+
[notifyvisitors userIdentifierWithUserParams: nvFinalUserParams onUserTrackListener:^(NSDictionary * userTrackingResponseDict) {
|
|
728
|
+
|
|
729
|
+
NSError *nvError = nil;
|
|
730
|
+
NSData *nvUserTrackingResJsonData = [NSJSONSerialization dataWithJSONObject: userTrackingResponseDict options: NSJSONWritingPrettyPrinted error: &nvError];
|
|
731
|
+
NSString *nvUserTrackingResJsonStr = [[NSString alloc] initWithData: nvUserTrackingResJsonData encoding: NSUTF8StringEncoding];
|
|
732
|
+
onUserTrackListener(@[nvUserTrackingResJsonStr, [NSNull null]]);
|
|
733
|
+
|
|
677
734
|
}];
|
|
678
|
-
}
|
|
735
|
+
}
|
|
736
|
+
@catch(NSException *exception){
|
|
679
737
|
NSLog(@"RN-NotifyVisitors ERROR : %@", exception.reason);
|
|
680
738
|
}
|
|
681
739
|
}
|
|
682
740
|
|
|
683
|
-
/*
|
|
684
|
-
RCT_EXPORT_METHOD(
|
|
741
|
+
/* 19 - Get nvUid */
|
|
742
|
+
RCT_EXPORT_METHOD(getNvUID: (RCTResponseSenderBlock)callback) {
|
|
685
743
|
@try{
|
|
686
|
-
NSLog(@"RN-NotifyVisitors :
|
|
687
|
-
|
|
688
|
-
[notifyvisitors
|
|
744
|
+
NSLog(@"RN-NotifyVisitors : GET NVUID !!");
|
|
745
|
+
|
|
746
|
+
NSString * nvUIDStr = [notifyvisitors getNvUid];
|
|
747
|
+
if ([nvUIDStr length] > 0 && ![nvUIDStr isEqualToString: @""] && ![nvUIDStr isEqual: [NSNull null]] && ![nvUIDStr isEqualToString: @"(null)"]) {
|
|
748
|
+
callback(@[nvUIDStr, [NSNull null]]);
|
|
749
|
+
} else {
|
|
750
|
+
callback(@[@"null", [NSNull null]]);
|
|
751
|
+
}
|
|
752
|
+
}
|
|
753
|
+
@catch(NSException *exception){
|
|
754
|
+
NSLog(@"RN-NotifyVisitors ERROR : %@", exception.reason);
|
|
755
|
+
}
|
|
756
|
+
}
|
|
757
|
+
|
|
758
|
+
/* 20 - known user identified */
|
|
759
|
+
RCT_EXPORT_METHOD(knownUserIdentified:(RCTResponseSenderBlock)nvcallback) {
|
|
760
|
+
NSLog(@"RN-NotifyVisitors : GET KNOWN USER IDENTIFIED INFO !!");
|
|
761
|
+
@try{
|
|
762
|
+
onKnownUserFoundCallback = nvcallback;
|
|
689
763
|
}
|
|
690
764
|
@catch(NSException *exception){
|
|
691
765
|
NSLog(@"RN-NotifyVisitors ERROR : %@", exception.reason);
|
|
692
766
|
}
|
|
693
767
|
}
|
|
694
768
|
|
|
769
|
+
#pragma mark - ChatBot Methods
|
|
695
770
|
|
|
771
|
+
/* 21 - Start Chat Bot */
|
|
772
|
+
RCT_EXPORT_METHOD(startChatBot: (NSString*_Nullable)screenName) {
|
|
773
|
+
@try{
|
|
774
|
+
NSLog(@"RN-NotifyVisitors : START CHATBOT !!");
|
|
775
|
+
NSLog(@"This feature temporarily not available. Please contact our support team for more assistance");
|
|
776
|
+
}
|
|
777
|
+
@catch(NSException *exception){
|
|
778
|
+
NSLog(@"RN-NotifyVisitors ERROR : %@", exception.reason);
|
|
779
|
+
}
|
|
780
|
+
}
|
|
696
781
|
|
|
697
|
-
|
|
698
|
-
- (void)NotifyvisitorsChatBotActionCallbackWithUserInfo:(NSDictionary *)userInfo{
|
|
782
|
+
- (void)NotifyvisitorsChatBotActionCallbackWithUserInfo:(NSDictionary *)userInfo {
|
|
699
783
|
NSLog(@"RN-NotifyVisitors : NOTIFYVISITORS CHATBOT ACTION CALLBACK WITH USER INFO !!");
|
|
700
784
|
@try {
|
|
701
785
|
if ([userInfo count] > 0) {
|
|
@@ -712,12 +796,31 @@ RCT_EXPORT_METHOD(scrollViewDidScroll_iOS_only) {
|
|
|
712
796
|
|
|
713
797
|
}
|
|
714
798
|
|
|
799
|
+
#pragma mark - GetLinkInfo and other callbacks handler methods
|
|
715
800
|
|
|
716
|
-
/*
|
|
717
|
-
|
|
801
|
+
/* 22 - GetLinkInfo */
|
|
802
|
+
RCT_EXPORT_METHOD(getLinkInfo) {
|
|
803
|
+
@try{
|
|
804
|
+
NSLog(@"RN-NotifyVisitors : GET LINK INFO !!");
|
|
805
|
+
nvPushObserverReady = YES;
|
|
806
|
+
[[NSNotificationCenter defaultCenter] addObserverForName: @"nvNotificationClickCallback" object: nil queue: nil usingBlock: ^(NSNotification *notification) {
|
|
807
|
+
NSDictionary *nvUserInfo = [notification userInfo];
|
|
808
|
+
if ([nvUserInfo count] > 0) {
|
|
809
|
+
NSError *nvError = nil;
|
|
810
|
+
NSData *nvJsonData = [NSJSONSerialization dataWithJSONObject: nvUserInfo options: NSJSONWritingPrettyPrinted error: &nvError];
|
|
811
|
+
NSString *nvJsonString = [[NSString alloc] initWithData: nvJsonData encoding: NSUTF8StringEncoding];
|
|
812
|
+
[self sendEventWithName:@"nv_push_banner_click" body:@{@"data": nvJsonString}];
|
|
813
|
+
}
|
|
814
|
+
}];
|
|
815
|
+
|
|
816
|
+
}
|
|
817
|
+
@catch(NSException *exception){
|
|
818
|
+
NSLog(@"RN-NotifyVisitors ERROR : %@", exception.reason);
|
|
819
|
+
}
|
|
820
|
+
}
|
|
718
821
|
|
|
719
822
|
- (void)notifyvisitorsEventsResponseCallback:(NSDictionary *)callback {
|
|
720
|
-
NSLog(@"RN-NotifyVisitors : NOTIFYVISITORS
|
|
823
|
+
NSLog(@"RN-NotifyVisitors : NOTIFYVISITORS EVENTS RESPONSE CALLBACK!!");
|
|
721
824
|
@try {
|
|
722
825
|
if([callback count] > 0){
|
|
723
826
|
NSError *nvError = nil;
|
|
@@ -748,39 +851,37 @@ RCT_EXPORT_METHOD(scrollViewDidScroll_iOS_only) {
|
|
|
748
851
|
}
|
|
749
852
|
}
|
|
750
853
|
|
|
854
|
+
-(void)notifyvisitorsKnownUserIdentified:(NSDictionary*_Nullable)userInfo {
|
|
855
|
+
NSLog(@"RN-NotifyVisitors : GET DATA WHEN KNOWN USER IDENTIFIED !!");
|
|
856
|
+
@try {
|
|
857
|
+
if([userInfo count] > 0){
|
|
858
|
+
NSError *nvError = nil;
|
|
859
|
+
NSData *nvJsonData = [NSJSONSerialization dataWithJSONObject: userInfo options: NSJSONWritingPrettyPrinted error: &nvError];
|
|
860
|
+
NSString *nvJsonString = [[NSString alloc] initWithData: nvJsonData encoding: NSUTF8StringEncoding];
|
|
861
|
+
|
|
862
|
+
if(onKnownUserFoundCallback != NULL) {
|
|
863
|
+
[self sendEventWithName: @"nv_known_user_identified_callback" body: @{@"data": nvJsonString}];
|
|
864
|
+
}
|
|
865
|
+
|
|
866
|
+
}
|
|
867
|
+
}
|
|
868
|
+
@catch (NSException *exception) {
|
|
869
|
+
NSLog(@"RN-NotifyVisitors ERROR : %@", exception.reason);
|
|
870
|
+
}
|
|
871
|
+
}
|
|
751
872
|
|
|
873
|
+
#pragma mark - Other Methods
|
|
752
874
|
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
// if([eventName isEqualToString:@"Survey Submit"] || [eventName isEqualToString:@"Survey Attempt"] || [eventName isEqualToString:@"Banner Clicked"] ){
|
|
764
|
-
// if(showCallback != NULL){
|
|
765
|
-
// [self sendEventWithName:@"nv_show_callback" body:@{@"data":nvJsonString}];
|
|
766
|
-
// }
|
|
767
|
-
// }else{
|
|
768
|
-
// if(eventCallback != NULL){
|
|
769
|
-
// [self sendEventWithName:@"nv_event_callback" body:@{@"data":nvJsonString}];
|
|
770
|
-
// }
|
|
771
|
-
// }
|
|
772
|
-
//
|
|
773
|
-
// if(commonCallback != NULL){
|
|
774
|
-
// [self sendEventWithName:@"nv_common_show_event_callback" body:@{@"data":nvJsonString}];
|
|
775
|
-
// }
|
|
776
|
-
//
|
|
777
|
-
// }
|
|
778
|
-
// }
|
|
779
|
-
// @catch (NSException *exception) {
|
|
780
|
-
// NSLog(@"RN-NotifyVisitors ERROR : %@", exception.reason);
|
|
781
|
-
// }
|
|
782
|
-
//}
|
|
783
|
-
|
|
875
|
+
/* 23 - REQUEST INAPP REVIEW */
|
|
876
|
+
RCT_EXPORT_METHOD(requestInAppReview: (RCTResponseSenderBlock) callback) {
|
|
877
|
+
@try{
|
|
878
|
+
NSLog(@"RN-NotifyVisitors : REQUEST IN APP REVIEW !!");
|
|
879
|
+
[notifyvisitors requestAppleAppStoreInAppReview];
|
|
880
|
+
}
|
|
881
|
+
@catch(NSException *exception){
|
|
882
|
+
NSLog(@"RN-NotifyVisitors ERROR : %@", exception.reason);
|
|
883
|
+
}
|
|
884
|
+
}
|
|
784
885
|
|
|
785
886
|
-(UIColor*)GetColor:(NSString *)ColorString {
|
|
786
887
|
if ([[ColorString substringToIndex:1]isEqualToString:@"#"]) {
|
|
@@ -806,83 +907,3 @@ RCT_EXPORT_METHOD(scrollViewDidScroll_iOS_only) {
|
|
|
806
907
|
|
|
807
908
|
|
|
808
909
|
@end
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
// -(NSArray<NSString *> *)supportedEvents {
|
|
814
|
-
// NSMutableArray *events = [NSMutableArray new];
|
|
815
|
-
|
|
816
|
-
// for (int i = 0; i < OSNotificationEventTypesArray.count; i++)
|
|
817
|
-
// [events addObject:OSEventString(i)];
|
|
818
|
-
|
|
819
|
-
// return events;
|
|
820
|
-
// }
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
//for redirection method
|
|
825
|
-
//RCT_EXPORT_METHOD(getClickInfoCP:(NSString *)callbackName) {
|
|
826
|
-
// NSArray *callbacksplit = [callbackName componentsSeparatedByString:@"-"];
|
|
827
|
-
// @try{
|
|
828
|
-
// NSLog(@"getClickInfoCP triggered !!");
|
|
829
|
-
// nvPushObserverReady = YES;
|
|
830
|
-
// [[NSNotificationCenter defaultCenter] addObserverForName: @"NVInAppViewConroller" object: nil queue: nil usingBlock: ^(NSNotification *notification) {
|
|
831
|
-
// NSDictionary *nvUserInfo = [notification userInfo];
|
|
832
|
-
// if ([nvUserInfo count] > 0) {
|
|
833
|
-
// NSError *nvError = nil;
|
|
834
|
-
// NSData *nvJsonData = [NSJSONSerialization dataWithJSONObject: nvUserInfo options: NSJSONWritingPrettyPrinted error: &nvError];
|
|
835
|
-
// NSString *nvJsonString = [[NSString alloc] initWithData: nvJsonData encoding: NSUTF8StringEncoding];
|
|
836
|
-
// NSLog(@"getClickInfoCP = %@", notification);
|
|
837
|
-
// [self sendEventWithName:callbacksplit[0] body:@{@"_callbackName": callbackName, @"data":nvJsonString}];
|
|
838
|
-
// }else {
|
|
839
|
-
// //[self sendEventWithName:callbacksplit[0] body:@{@"_callbackName": callbackName, @"data":@""}];
|
|
840
|
-
// }
|
|
841
|
-
// }];
|
|
842
|
-
//
|
|
843
|
-
// }
|
|
844
|
-
// @catch(NSException *exception){
|
|
845
|
-
// //[self sendEventWithName:callbacksplit[0] body:@{@"_callbackName": callbackName, @"data":@""}];
|
|
846
|
-
// NSLog(@"getClickInfoCP Exception = %@", exception.reason);
|
|
847
|
-
// }
|
|
848
|
-
//}
|
|
849
|
-
|
|
850
|
-
//callback(@[exception.reason, [NSNull null]]);
|
|
851
|
-
|
|
852
|
-
/* 2 - Open Notification Center */
|
|
853
|
-
//RCT_EXPORT_METHOD(showNotifications:(NSMutableDictionary *)appInboxInfo dismiss:(NSString*_Nullable)dismissValue) {
|
|
854
|
-
// @try{
|
|
855
|
-
// NSLog(@"RN-NotifyVisitors : SHOW NOTIFICATIONS !!");
|
|
856
|
-
// [notifyvisitors NotifyVisitorsNotificationCentre];
|
|
857
|
-
//
|
|
858
|
-
// NSString *nvResourcePlistPath = [[NSBundle mainBundle] pathForResource: @"nvResourceValues" ofType: @"plist"];
|
|
859
|
-
// if ([[NSFileManager defaultManager] fileExistsAtPath: nvResourcePlistPath]) {
|
|
860
|
-
// NSDictionary *nvResourceData = [NSDictionary dictionaryWithContentsOfFile: nvResourcePlistPath];
|
|
861
|
-
// if ([nvResourceData count] > 0) {
|
|
862
|
-
// NSDictionary *nvResourceBooleans = [nvResourceData objectForKey: @"nvBooleans"];
|
|
863
|
-
//
|
|
864
|
-
// if ([nvResourceBooleans count] > 0) {
|
|
865
|
-
// if (nvResourceBooleans [@"DismissNotificationCenterOnAction"]) {
|
|
866
|
-
// nvDismissNCenterOnAction = [nvResourceBooleans [@"DismissNotificationCenterOnAction"] boolValue];
|
|
867
|
-
// } else {
|
|
868
|
-
// nvDismissNCenterOnAction = YES;
|
|
869
|
-
// }
|
|
870
|
-
// NSLog(@"NV DISMISS NOTIFICATION CENTER ON ACTION = %@", nvDismissNCenterOnAction ? @"YES" : @"NO");
|
|
871
|
-
//
|
|
872
|
-
// } else {
|
|
873
|
-
// NSLog(@"NV RESOURCE BOOLEANS NOT FOUND !!");
|
|
874
|
-
// }
|
|
875
|
-
//
|
|
876
|
-
// } else {
|
|
877
|
-
// NSLog(@"NV RESOURCE DATA NOT FOUND !!");
|
|
878
|
-
// }
|
|
879
|
-
//
|
|
880
|
-
// } else {
|
|
881
|
-
// NSLog(@"NV RESOURCE VALUES PLIST NOT FOUND !!");
|
|
882
|
-
// }
|
|
883
|
-
//
|
|
884
|
-
// }
|
|
885
|
-
// @catch(NSException *exception){
|
|
886
|
-
// NSLog(@"RN-NotifyVisitors ERROR : %@", exception.reason);
|
|
887
|
-
// }
|
|
888
|
-
//}
|