react-native-notifyvisitors 4.0.7 → 4.1.1
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 -8
- package/android/build.gradle +1 -4
- package/android/src/main/AndroidManifest.xml +1 -0
- package/android/src/main/java/com/rn_notifyvisitors/RNNotifyvisitorsModule.java +131 -35
- package/index.js +134 -21
- package/ios/Assets/nvResourceValues.plist +4 -0
- package/ios/RNNotifyvisitors/{RCTEventEmitterDemo.h → RCTNVEventEmitter.h} +7 -1
- package/ios/RNNotifyvisitors/{RCTEventEmitterDemo.m → RCTNVEventEmitter.m} +262 -249
- package/ios/RNNotifyvisitors/{RNNotifyvisitorExtensionService.h → RNNVExtensionService.h} +1 -1
- package/ios/RNNotifyvisitors/RNNVExtensionService.m +19 -0
- package/ios/RNNotifyvisitors/RNNotifyvisitors.h +2 -2
- package/ios/RNNotifyvisitors/RNNotifyvisitors.m +45 -55
- package/ios/RNNotifyvisitors.xcodeproj/project.pbxproj +48 -48
- package/ios/RNNotifyvisitors.xcodeproj/project.xcworkspace/xcuserdata/tagnpinwebsolutionsllp.xcuserdatad/UserInterfaceState.xcuserstate +0 -0
- package/ios/libnotifyvisitors_6_0_3.a +0 -0
- package/ios/notifyvisitors.h +12 -10
- package/package.json +1 -1
- package/react-native-notifyvisitors.podspec +1 -1
- package/ios/RNNotifyvisitors/RNNotifyvisitorExtensionService.m +0 -25
- package/ios/libnotifyvisitors_5_3_2.a +0 -0
package/README.md
CHANGED
|
@@ -34,14 +34,6 @@
|
|
|
34
34
|
compile project(':react-native-notifyvisitors')
|
|
35
35
|
```
|
|
36
36
|
|
|
37
|
-
#### Windows
|
|
38
|
-
[Read it! :D](https://github.com/ReactWindows/react-native)
|
|
39
|
-
|
|
40
|
-
1. In Visual Studio add the `RNNotifyvisitors.sln` in `node_modules/react-native-notifyvisitors/windows/RNNotifyvisitors.sln` folder to their solution, reference from their app.
|
|
41
|
-
2. Open up your `MainPage.cs` app
|
|
42
|
-
- Add `using Notifyvisitors.RNNotifyvisitors;` to the usings at the top of the file
|
|
43
|
-
- Add `new RNNotifyvisitorsPackage()` to the `List<IReactPackage>` returned by the `Packages` method
|
|
44
|
-
|
|
45
37
|
|
|
46
38
|
## Usage
|
|
47
39
|
```javascript
|
package/android/build.gradle
CHANGED
|
@@ -27,16 +27,13 @@ android {
|
|
|
27
27
|
|
|
28
28
|
repositories {
|
|
29
29
|
mavenCentral()
|
|
30
|
-
maven {
|
|
31
|
-
url "https://dl.bintray.com/notifyvisitors/notifyvisitors"
|
|
32
|
-
}
|
|
33
30
|
}
|
|
34
31
|
|
|
35
32
|
dependencies {
|
|
36
33
|
implementation fileTree(dir: 'libs', include: ['*.jar'])
|
|
37
34
|
implementation 'com.facebook.react:react-native:+'
|
|
38
35
|
|
|
39
|
-
implementation 'com.notifyvisitors.notifyvisitors:notifyvisitors:5.1.
|
|
36
|
+
implementation 'com.notifyvisitors.notifyvisitors:notifyvisitors:v28-5.1.7'
|
|
40
37
|
implementation 'com.android.installreferrer:installreferrer:2.1'
|
|
41
38
|
|
|
42
39
|
implementation 'com.android.support:design:28.0.0'
|
|
@@ -14,17 +14,20 @@ import com.facebook.react.bridge.Callback;
|
|
|
14
14
|
import com.facebook.react.bridge.ReactApplicationContext;
|
|
15
15
|
import com.facebook.react.bridge.ReactContextBaseJavaModule;
|
|
16
16
|
import com.facebook.react.bridge.ReactMethod;
|
|
17
|
+
import com.facebook.react.bridge.ReadableMap;
|
|
17
18
|
import com.facebook.react.modules.core.DeviceEventManagerModule;
|
|
18
19
|
import com.notifyvisitors.notifyvisitors.NotifyVisitorsApi;
|
|
19
20
|
import com.notifyvisitors.notifyvisitors.NotifyVisitorsApplication;
|
|
20
21
|
import com.notifyvisitors.notifyvisitors.interfaces.NotificationCountInterface;
|
|
21
22
|
import com.notifyvisitors.notifyvisitors.interfaces.NotificationListDetailsCallback;
|
|
23
|
+
import com.notifyvisitors.notifyvisitors.interfaces.OnEventTrackListener;
|
|
22
24
|
import com.notifyvisitors.notifyvisitors.interfaces.OnNotifyBotClickListener;
|
|
23
25
|
import com.notifyvisitors.notifyvisitors.push.NVNotificationChannels;
|
|
24
26
|
|
|
25
27
|
import org.json.JSONArray;
|
|
26
28
|
import org.json.JSONObject;
|
|
27
29
|
|
|
30
|
+
import java.util.HashMap;
|
|
28
31
|
import java.util.HashSet;
|
|
29
32
|
import java.util.Set;
|
|
30
33
|
|
|
@@ -32,11 +35,22 @@ import java.util.Set;
|
|
|
32
35
|
public class RNNotifyvisitorsModule extends ReactContextBaseJavaModule implements ActivityEventListener {
|
|
33
36
|
|
|
34
37
|
private final ReactApplicationContext reactContext;
|
|
35
|
-
private static final String TAG = "NotifyVisitors";
|
|
38
|
+
private static final String TAG = "RN-NotifyVisitors";
|
|
39
|
+
private static final String PLUGIN_VERSION = "4.1.1";
|
|
36
40
|
|
|
37
41
|
private String PUSH_BANNER_CLICK_EVENT = "nv_push_banner_click";
|
|
38
42
|
private String CHAT_BOT_BUTTON_CLICK = "nv_chat_bot_button_click";
|
|
39
43
|
|
|
44
|
+
private String SHOW_CALLBACK = "nv_show_callback";
|
|
45
|
+
private String EVENT_CALLBACK = "nv_event_callback";
|
|
46
|
+
private String COMMON_SHOW_EVENT_CALLBACK = "nv_common_show_event_callback";
|
|
47
|
+
|
|
48
|
+
String finalData;
|
|
49
|
+
|
|
50
|
+
Callback showCallback;
|
|
51
|
+
Callback eventCallback;
|
|
52
|
+
Callback commonCallback;
|
|
53
|
+
|
|
40
54
|
|
|
41
55
|
public RNNotifyvisitorsModule(ReactApplicationContext reactContext) {
|
|
42
56
|
super(reactContext);
|
|
@@ -63,6 +77,9 @@ public class RNNotifyvisitorsModule extends ReactContextBaseJavaModule implement
|
|
|
63
77
|
public void getLinkInfo() {
|
|
64
78
|
try {
|
|
65
79
|
Log.i(TAG, "GET LINK INFO !!");
|
|
80
|
+
if(finalData != null){
|
|
81
|
+
sendEvent(PUSH_BANNER_CLICK_EVENT, finalData);
|
|
82
|
+
}
|
|
66
83
|
} catch (Exception e) {
|
|
67
84
|
Log.i(TAG, "GET LINK INFO ERROR : " + e);
|
|
68
85
|
}
|
|
@@ -114,43 +131,54 @@ public class RNNotifyvisitorsModule extends ReactContextBaseJavaModule implement
|
|
|
114
131
|
}
|
|
115
132
|
|
|
116
133
|
@ReactMethod
|
|
117
|
-
public void show(
|
|
134
|
+
public void show(ReadableMap tokens, ReadableMap customObjects, String fragmentName, Callback callback) {
|
|
118
135
|
try {
|
|
119
136
|
Log.i(TAG, "SHOW !!");
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
137
|
+
showCallback = callback;
|
|
138
|
+
|
|
139
|
+
JSONObject mTokens = null;
|
|
140
|
+
try {
|
|
141
|
+
if (tokens != null) {
|
|
142
|
+
HashMap<String, Object> temp = tokens.toHashMap();
|
|
143
|
+
mTokens = new JSONObject(temp);
|
|
144
|
+
}
|
|
145
|
+
} catch (Exception e) {
|
|
146
|
+
Log.i(TAG, "TOKENS PARSE ERROR : " + e);
|
|
126
147
|
}
|
|
127
148
|
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
149
|
+
JSONObject mCustomObjects = null;
|
|
150
|
+
try {
|
|
151
|
+
if (customObjects != null) {
|
|
152
|
+
HashMap<String, Object> temp = customObjects.toHashMap();
|
|
153
|
+
mCustomObjects = new JSONObject(temp);
|
|
154
|
+
}
|
|
155
|
+
} catch (Exception e) {
|
|
156
|
+
Log.i(TAG, "CUSTOM-OBJECT PARSE ERROR : " + e);
|
|
132
157
|
}
|
|
133
158
|
|
|
134
|
-
// Activity activity = (Activity) reactContext;
|
|
135
|
-
// final Activity activity = reactContext.getCurrentActivity();
|
|
136
159
|
Activity activity = reactContext.getCurrentActivity();
|
|
137
|
-
NotifyVisitorsApi.getInstance(activity).show(
|
|
160
|
+
NotifyVisitorsApi.getInstance(activity).show(mTokens, mCustomObjects, fragmentName);
|
|
138
161
|
} catch (Exception e) {
|
|
139
162
|
Log.i(TAG, "SHOW ERROR : " + e);
|
|
140
163
|
}
|
|
141
164
|
}
|
|
142
165
|
|
|
143
166
|
@ReactMethod
|
|
144
|
-
public void event(String eventName,
|
|
167
|
+
public void event(String eventName, ReadableMap attributes, String ltv, String scope, Callback callback) {
|
|
145
168
|
try {
|
|
146
169
|
Log.i(TAG, "EVENT !!");
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
170
|
+
eventCallback = callback;
|
|
171
|
+
|
|
172
|
+
JSONObject mAttributes = null;
|
|
173
|
+
try {
|
|
174
|
+
if (attributes != null) {
|
|
175
|
+
HashMap<String, Object> temp = attributes.toHashMap();
|
|
176
|
+
mAttributes = new JSONObject(temp);
|
|
177
|
+
}
|
|
178
|
+
} catch (Exception e) {
|
|
179
|
+
Log.i(TAG, "ATTRIBUTES PARSE ERROR : " + e);
|
|
152
180
|
}
|
|
153
|
-
NotifyVisitorsApi.getInstance(reactContext).event(eventName,
|
|
181
|
+
NotifyVisitorsApi.getInstance(reactContext).event(eventName, mAttributes, ltv, scope);
|
|
154
182
|
} catch (Exception e) {
|
|
155
183
|
Log.i(TAG, "EVENT ERROR : " + e);
|
|
156
184
|
}
|
|
@@ -202,17 +230,17 @@ public class RNNotifyvisitorsModule extends ReactContextBaseJavaModule implement
|
|
|
202
230
|
}
|
|
203
231
|
|
|
204
232
|
@ReactMethod
|
|
205
|
-
public void userIdentifier(String userID,
|
|
233
|
+
public void userIdentifier(String userID, ReadableMap attributes) {
|
|
206
234
|
try {
|
|
207
235
|
Log.i(TAG, "userIdentifier !!");
|
|
208
|
-
JSONObject
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
236
|
+
JSONObject mAttributes = null;
|
|
237
|
+
|
|
238
|
+
if (attributes != null) {
|
|
239
|
+
HashMap<String, Object> temp = attributes.toHashMap();
|
|
240
|
+
mAttributes = new JSONObject(temp);
|
|
213
241
|
}
|
|
214
242
|
|
|
215
|
-
NotifyVisitorsApi.getInstance(reactContext).userIdentifier(userID,
|
|
243
|
+
NotifyVisitorsApi.getInstance(reactContext).userIdentifier(userID, mAttributes);
|
|
216
244
|
} catch (Exception e) {
|
|
217
245
|
Log.i(TAG, "USER IDENTIFIER ERROR : " + e);
|
|
218
246
|
}
|
|
@@ -377,10 +405,20 @@ public class RNNotifyvisitorsModule extends ReactContextBaseJavaModule implement
|
|
|
377
405
|
}
|
|
378
406
|
}
|
|
379
407
|
|
|
408
|
+
@ReactMethod
|
|
409
|
+
public void getEventSurveyInfo(Callback callback) {
|
|
410
|
+
try {
|
|
411
|
+
Log.i(TAG, "GET EVENT SURVEY INFO !!");
|
|
412
|
+
commonCallback = callback;
|
|
413
|
+
} catch (Exception e) {
|
|
414
|
+
Log.i(TAG, "GET EVENT SURVEY INFO ERROR : " + e);
|
|
415
|
+
}
|
|
416
|
+
}
|
|
417
|
+
|
|
380
418
|
|
|
381
419
|
@Override
|
|
382
420
|
public void onActivityResult(Activity activity, int requestCode, int resultCode, Intent data) {
|
|
383
|
-
this.onActivityResult(activity, requestCode, resultCode, data);
|
|
421
|
+
//this.onActivityResult(activity, requestCode, resultCode, data);
|
|
384
422
|
Log.i(TAG, "ON ACTIVITY RESULT !!");
|
|
385
423
|
}
|
|
386
424
|
|
|
@@ -390,6 +428,7 @@ public class RNNotifyvisitorsModule extends ReactContextBaseJavaModule implement
|
|
|
390
428
|
super.initialize();
|
|
391
429
|
try {
|
|
392
430
|
Log.i(TAG, "INITIALIZE");
|
|
431
|
+
Log.i(TAG, "RN-NV PLUGIN VERSION : " + PLUGIN_VERSION);
|
|
393
432
|
Activity currentActivity = getCurrentActivity();
|
|
394
433
|
if (currentActivity != null) {
|
|
395
434
|
Intent intent = currentActivity.getIntent();
|
|
@@ -400,6 +439,12 @@ public class RNNotifyvisitorsModule extends ReactContextBaseJavaModule implement
|
|
|
400
439
|
} catch (Exception e) {
|
|
401
440
|
Log.i(TAG, "INITIALIZE ERROR : " + e);
|
|
402
441
|
}
|
|
442
|
+
|
|
443
|
+
try {
|
|
444
|
+
fetchEventSurvey(reactContext);
|
|
445
|
+
} catch (Exception e) {
|
|
446
|
+
Log.i(TAG, "FETCHING EVENT SURVEY DATA : " + e);
|
|
447
|
+
}
|
|
403
448
|
}
|
|
404
449
|
|
|
405
450
|
@Override
|
|
@@ -419,7 +464,7 @@ public class RNNotifyvisitorsModule extends ReactContextBaseJavaModule implement
|
|
|
419
464
|
Log.i(TAG, "INSIDE HANDLE INTENT !!!!");
|
|
420
465
|
|
|
421
466
|
JSONObject dataInfo, finalDataInfo;
|
|
422
|
-
|
|
467
|
+
|
|
423
468
|
|
|
424
469
|
String action = intent.getAction();
|
|
425
470
|
Uri url = intent.getData();
|
|
@@ -436,10 +481,10 @@ public class RNNotifyvisitorsModule extends ReactContextBaseJavaModule implement
|
|
|
436
481
|
for (String key : bundle.keySet()) {
|
|
437
482
|
try {
|
|
438
483
|
dataInfo.put(key, JSONObject.wrap(bundle.get(key)));
|
|
439
|
-
if(key.equals("nv_type")){
|
|
440
|
-
try{
|
|
484
|
+
if (key.equals("nv_type")) {
|
|
485
|
+
try {
|
|
441
486
|
nv_type = bundle.get(key).toString();
|
|
442
|
-
}catch (Exception e){
|
|
487
|
+
} catch (Exception e) {
|
|
443
488
|
//e.printStackTrace();
|
|
444
489
|
}
|
|
445
490
|
}
|
|
@@ -448,7 +493,7 @@ public class RNNotifyvisitorsModule extends ReactContextBaseJavaModule implement
|
|
|
448
493
|
//e.printStackTrace();
|
|
449
494
|
}
|
|
450
495
|
}
|
|
451
|
-
dataInfo.put("type",nv_type);
|
|
496
|
+
dataInfo.put("type", nv_type);
|
|
452
497
|
finalDataInfo.put("parameters", dataInfo);
|
|
453
498
|
finalData = finalDataInfo.toString();
|
|
454
499
|
sendEvent(PUSH_BANNER_CLICK_EVENT, finalData);
|
|
@@ -506,4 +551,55 @@ public class RNNotifyvisitorsModule extends ReactContextBaseJavaModule implement
|
|
|
506
551
|
public ReactApplicationContext getReactContext() {
|
|
507
552
|
return reactContext;
|
|
508
553
|
}
|
|
554
|
+
|
|
555
|
+
private void fetchEventSurvey(Context context) {
|
|
556
|
+
try {
|
|
557
|
+
NotifyVisitorsApi.getInstance(context).getEventResponse(new OnEventTrackListener() {
|
|
558
|
+
@Override
|
|
559
|
+
public void onResponse(JSONObject jsonObject) {
|
|
560
|
+
sendResponse(jsonObject);
|
|
561
|
+
}
|
|
562
|
+
});
|
|
563
|
+
} catch (Exception e) {
|
|
564
|
+
Log.i(TAG, "FETCH EVENT SURVEY ERROR : " + e);
|
|
565
|
+
}
|
|
566
|
+
|
|
567
|
+
}
|
|
568
|
+
|
|
569
|
+
private void sendResponse(JSONObject response) {
|
|
570
|
+
try {
|
|
571
|
+
if (response != null) {
|
|
572
|
+
String eventName = response.getString("eventName");
|
|
573
|
+
|
|
574
|
+
// check clicked is banner or survey
|
|
575
|
+
if (eventName.equalsIgnoreCase("Survey Submit") ||
|
|
576
|
+
eventName.equalsIgnoreCase("Survey Attempt") ||
|
|
577
|
+
eventName.equalsIgnoreCase("Banner Clicked")) {
|
|
578
|
+
if (showCallback != null) {
|
|
579
|
+
sendEvent(SHOW_CALLBACK, response.toString());
|
|
580
|
+
} else {
|
|
581
|
+
Log.i(TAG, "SHOW CALLBACK CONTEXT IS NULL !!");
|
|
582
|
+
}
|
|
583
|
+
} else {
|
|
584
|
+
if (eventCallback != null) {
|
|
585
|
+
sendEvent(EVENT_CALLBACK, response.toString());
|
|
586
|
+
} else {
|
|
587
|
+
Log.i(TAG, "EVENT CALLBACK CONTEXT IS NULL !!");
|
|
588
|
+
}
|
|
589
|
+
}
|
|
590
|
+
|
|
591
|
+
// send commom callback
|
|
592
|
+
if (commonCallback != null) {
|
|
593
|
+
sendEvent(COMMON_SHOW_EVENT_CALLBACK, response.toString());
|
|
594
|
+
}
|
|
595
|
+
} else {
|
|
596
|
+
Log.i(TAG, "RESPONSE IS NULL !!");
|
|
597
|
+
}
|
|
598
|
+
|
|
599
|
+
} catch (Exception e) {
|
|
600
|
+
Log.i(TAG, "SURVEY SEND RESPONSE ERROR : " + e);
|
|
601
|
+
}
|
|
602
|
+
}
|
|
603
|
+
|
|
604
|
+
|
|
509
605
|
}
|
package/index.js
CHANGED
|
@@ -7,6 +7,12 @@ const nvEventEmitter = new NativeEventEmitter(RNNotifyvisitors);
|
|
|
7
7
|
|
|
8
8
|
const NV_PUSH_BANNER_CLICK_EVENT = 'nv_push_banner_click';
|
|
9
9
|
const NV_CHAT_BOT_BUTTON_CLICK = 'nv_chat_bot_button_click';
|
|
10
|
+
|
|
11
|
+
const NV_SHOW_CALLBACK = 'nv_show_callback';
|
|
12
|
+
const NV_EVENT_CALLBACK = 'nv_event_callback';
|
|
13
|
+
const NV_EVENT_SURVEY_CALLBACK = 'nv_common_show_event_callback';
|
|
14
|
+
|
|
15
|
+
|
|
10
16
|
const pushCallbackFunction = {};
|
|
11
17
|
|
|
12
18
|
const registerPushListener = function(){
|
|
@@ -41,15 +47,80 @@ const chatBotButtonClickListener = function(){
|
|
|
41
47
|
}
|
|
42
48
|
};
|
|
43
49
|
|
|
50
|
+
|
|
51
|
+
const nvShowCallbackListener = function(){
|
|
52
|
+
if (RNNotifyvisitors != null) {
|
|
53
|
+
nvEventEmitter.addListener(NV_SHOW_CALLBACK, (data)=>{
|
|
54
|
+
try{
|
|
55
|
+
if(data != null && typeof pushCallbackFunction[NV_SHOW_CALLBACK] == "function"){
|
|
56
|
+
if(Platform.OS == "ios"){
|
|
57
|
+
pushCallbackFunction[NV_SHOW_CALLBACK](data.data);
|
|
58
|
+
} else{
|
|
59
|
+
pushCallbackFunction[NV_SHOW_CALLBACK](data);
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
}
|
|
63
|
+
}catch(e){
|
|
64
|
+
console.log(e);
|
|
65
|
+
}
|
|
66
|
+
});
|
|
67
|
+
}
|
|
68
|
+
};
|
|
69
|
+
|
|
70
|
+
|
|
71
|
+
const nvEventCallbackListener = function(){
|
|
72
|
+
if (RNNotifyvisitors != null) {
|
|
73
|
+
nvEventEmitter.addListener(NV_EVENT_CALLBACK, (data)=>{
|
|
74
|
+
try{
|
|
75
|
+
if(data != null && typeof pushCallbackFunction[NV_EVENT_CALLBACK] == "function"){
|
|
76
|
+
if(Platform.OS == "ios"){
|
|
77
|
+
pushCallbackFunction[NV_EVENT_CALLBACK](data.data);
|
|
78
|
+
} else{
|
|
79
|
+
pushCallbackFunction[NV_EVENT_CALLBACK](data);
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
}
|
|
83
|
+
}catch(e){
|
|
84
|
+
console.log(e);
|
|
85
|
+
}
|
|
86
|
+
});
|
|
87
|
+
}
|
|
88
|
+
};
|
|
89
|
+
|
|
90
|
+
const nvEventSurveyCallback = function(){
|
|
91
|
+
if (RNNotifyvisitors != null) {
|
|
92
|
+
nvEventEmitter.addListener(NV_EVENT_SURVEY_CALLBACK, (data)=>{
|
|
93
|
+
try{
|
|
94
|
+
if(data != null && typeof pushCallbackFunction[NV_EVENT_SURVEY_CALLBACK] == "function"){
|
|
95
|
+
if(Platform.OS == "ios"){
|
|
96
|
+
pushCallbackFunction[NV_EVENT_SURVEY_CALLBACK](data.data);
|
|
97
|
+
}else{
|
|
98
|
+
pushCallbackFunction[NV_EVENT_SURVEY_CALLBACK](data);
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
}
|
|
102
|
+
}catch(e){
|
|
103
|
+
console.log(e);
|
|
104
|
+
}
|
|
105
|
+
});
|
|
106
|
+
}
|
|
107
|
+
};
|
|
108
|
+
|
|
44
109
|
registerPushListener();
|
|
45
110
|
chatBotButtonClickListener();
|
|
111
|
+
nvShowCallbackListener();
|
|
112
|
+
nvEventCallbackListener();
|
|
113
|
+
nvEventSurveyCallback();
|
|
46
114
|
|
|
47
115
|
export default class Notifyvisitors{
|
|
48
116
|
|
|
49
|
-
static show(tokens, customObjects, fragmentName){
|
|
117
|
+
static show(tokens, customObjects, fragmentName, nvCallback){
|
|
50
118
|
try{
|
|
51
|
-
|
|
52
|
-
|
|
119
|
+
pushCallbackFunction[NV_SHOW_CALLBACK] = nvCallback;
|
|
120
|
+
RNNotifyvisitors.show(tokens, customObjects, fragmentName, nvCallback);
|
|
121
|
+
}catch(e){
|
|
122
|
+
console.log(e);
|
|
123
|
+
}
|
|
53
124
|
}
|
|
54
125
|
|
|
55
126
|
static showNotifications(dismissValue){
|
|
@@ -60,28 +131,37 @@ export default class Notifyvisitors{
|
|
|
60
131
|
dismissValue = parseInt(dismissValue);
|
|
61
132
|
}
|
|
62
133
|
RNNotifyvisitors.showNotifications(dismissValue);
|
|
63
|
-
}catch(e){
|
|
134
|
+
}catch(e){
|
|
135
|
+
console.log(e);
|
|
136
|
+
}
|
|
64
137
|
|
|
65
138
|
}
|
|
66
139
|
|
|
67
|
-
static event(eventName, attributes, ltv, scope){
|
|
140
|
+
static event(eventName, attributes, ltv, scope, nvCallback){
|
|
68
141
|
try{
|
|
69
|
-
|
|
70
|
-
|
|
142
|
+
pushCallbackFunction[NV_EVENT_CALLBACK] = nvCallback;
|
|
143
|
+
RNNotifyvisitors.event(eventName, attributes, ltv, scope, nvCallback);
|
|
144
|
+
}catch(e){
|
|
145
|
+
console.log(e);
|
|
146
|
+
}
|
|
71
147
|
|
|
72
148
|
}
|
|
73
149
|
|
|
74
150
|
static stopNotifications(){
|
|
75
151
|
try{
|
|
76
152
|
RNNotifyvisitors.stopNotifications();
|
|
77
|
-
}catch(e){
|
|
153
|
+
}catch(e){
|
|
154
|
+
console.log(e);
|
|
155
|
+
}
|
|
78
156
|
|
|
79
157
|
}
|
|
80
158
|
|
|
81
159
|
static stopPushNotifications(bValue){
|
|
82
160
|
try{
|
|
83
161
|
RNNotifyvisitors.stopPushNotifications(bValue);
|
|
84
|
-
}catch(e){
|
|
162
|
+
}catch(e){
|
|
163
|
+
console.log(e);
|
|
164
|
+
}
|
|
85
165
|
|
|
86
166
|
}
|
|
87
167
|
|
|
@@ -91,35 +171,45 @@ export default class Notifyvisitors{
|
|
|
91
171
|
RNNotifyvisitors.getNotificationDataListener("fetchEvent");
|
|
92
172
|
}
|
|
93
173
|
RNNotifyvisitors.getNotificationDataListener(callback);
|
|
94
|
-
}catch(e){
|
|
174
|
+
}catch(e){
|
|
175
|
+
console.log(e);
|
|
176
|
+
}
|
|
95
177
|
|
|
96
178
|
}
|
|
97
179
|
|
|
98
180
|
static getNotificationCount(callback){
|
|
99
181
|
try{
|
|
100
182
|
RNNotifyvisitors.getNotificationCount(callback);
|
|
101
|
-
}catch(e){
|
|
183
|
+
}catch(e){
|
|
184
|
+
console.log(e);
|
|
185
|
+
}
|
|
102
186
|
|
|
103
187
|
}
|
|
104
188
|
|
|
105
189
|
static scheduleNotification(nid, tag, time, title, message, url, icon){
|
|
106
190
|
try{
|
|
107
191
|
RNNotifyvisitors.scheduleNotification(nid, tag, time, title, message, url, icon);
|
|
108
|
-
}catch(e){
|
|
192
|
+
}catch(e){
|
|
193
|
+
console.log(e);
|
|
194
|
+
}
|
|
109
195
|
|
|
110
196
|
}
|
|
111
197
|
|
|
112
198
|
static userIdentifier(userID, sJsonObject){
|
|
113
199
|
try{
|
|
114
200
|
RNNotifyvisitors.userIdentifier(userID, sJsonObject);
|
|
115
|
-
}catch(e){
|
|
201
|
+
}catch(e){
|
|
202
|
+
console.log(e);
|
|
203
|
+
}
|
|
116
204
|
|
|
117
205
|
}
|
|
118
206
|
|
|
119
207
|
static stopGeofencePushforDateTime(dateTime, additionalHours){
|
|
120
208
|
try{
|
|
121
209
|
RNNotifyvisitors.stopGeofencePushforDateTime(dateTime, additionalHours);
|
|
122
|
-
}catch(e){
|
|
210
|
+
}catch(e){
|
|
211
|
+
console.log(e);
|
|
212
|
+
}
|
|
123
213
|
|
|
124
214
|
}
|
|
125
215
|
|
|
@@ -136,7 +226,9 @@ export default class Notifyvisitors{
|
|
|
136
226
|
static scrollViewDidScroll_iOS_only(){
|
|
137
227
|
try{
|
|
138
228
|
RNNotifyvisitors.scrollViewDidScroll_iOS_only();
|
|
139
|
-
}catch(e){
|
|
229
|
+
}catch(e){
|
|
230
|
+
console.log(e);
|
|
231
|
+
}
|
|
140
232
|
}
|
|
141
233
|
|
|
142
234
|
static promptForPushNotificationsWithUserResponse(callback) {
|
|
@@ -156,7 +248,9 @@ export default class Notifyvisitors{
|
|
|
156
248
|
} else {
|
|
157
249
|
RNNotifyvisitors.setAutoStartPermission();
|
|
158
250
|
}
|
|
159
|
-
}catch(e){
|
|
251
|
+
}catch(e){
|
|
252
|
+
console.log(e);
|
|
253
|
+
}
|
|
160
254
|
}
|
|
161
255
|
|
|
162
256
|
|
|
@@ -173,7 +267,7 @@ export default class Notifyvisitors{
|
|
|
173
267
|
try{
|
|
174
268
|
RNNotifyvisitors.getNvUID(callback);
|
|
175
269
|
}catch(e){
|
|
176
|
-
|
|
270
|
+
console.log(e);
|
|
177
271
|
}
|
|
178
272
|
}
|
|
179
273
|
|
|
@@ -184,7 +278,9 @@ export default class Notifyvisitors{
|
|
|
184
278
|
} else {
|
|
185
279
|
RNNotifyvisitors.createNotificationChannel(chId, chName, chDescription, chImportance, enableLights, shouldVibrate, lightColor, soundFileName);
|
|
186
280
|
}
|
|
187
|
-
}catch(e){
|
|
281
|
+
}catch(e){
|
|
282
|
+
console.log(e);
|
|
283
|
+
}
|
|
188
284
|
}
|
|
189
285
|
|
|
190
286
|
static deleteNotificationChannel(channelId){
|
|
@@ -194,7 +290,9 @@ export default class Notifyvisitors{
|
|
|
194
290
|
} else {
|
|
195
291
|
RNNotifyvisitors.deleteNotificationChannel(channelId);
|
|
196
292
|
}
|
|
197
|
-
}catch(e){
|
|
293
|
+
}catch(e){
|
|
294
|
+
console.log(e);
|
|
295
|
+
}
|
|
198
296
|
}
|
|
199
297
|
|
|
200
298
|
static createNotificationChannelGroup(groupId, groupName){
|
|
@@ -204,7 +302,9 @@ export default class Notifyvisitors{
|
|
|
204
302
|
} else {
|
|
205
303
|
RNNotifyvisitors.createNotificationChannelGroup(groupId, groupName);
|
|
206
304
|
}
|
|
207
|
-
}catch(e){
|
|
305
|
+
}catch(e){
|
|
306
|
+
console.log(e);
|
|
307
|
+
}
|
|
208
308
|
}
|
|
209
309
|
|
|
210
310
|
static deleteNotificationChannelGroup(groupId){
|
|
@@ -214,7 +314,20 @@ export default class Notifyvisitors{
|
|
|
214
314
|
} else {
|
|
215
315
|
RNNotifyvisitors.deleteNotificationChannelGroup(groupId);
|
|
216
316
|
}
|
|
217
|
-
}catch(e){
|
|
317
|
+
}catch(e){
|
|
318
|
+
console.log(e);
|
|
319
|
+
}
|
|
320
|
+
}
|
|
321
|
+
|
|
322
|
+
|
|
323
|
+
static getEventSurveyInfo(nvCallback){
|
|
324
|
+
try{
|
|
325
|
+
pushCallbackFunction[NV_EVENT_SURVEY_CALLBACK] = nvCallback;
|
|
326
|
+
RNNotifyvisitors.getEventSurveyInfo(nvCallback);
|
|
327
|
+
}catch(e){
|
|
328
|
+
console.log(e)
|
|
329
|
+
}
|
|
330
|
+
|
|
218
331
|
}
|
|
219
332
|
|
|
220
333
|
}
|
|
@@ -155,6 +155,10 @@
|
|
|
155
155
|
<integer>0</integer>
|
|
156
156
|
<key>nvDefaultSessionTimeOutInMinute</key>
|
|
157
157
|
<integer>20</integer>
|
|
158
|
+
<key>nvModalSurveyResizingAnimationDurationInSeconds</key>
|
|
159
|
+
<integer>0</integer>
|
|
160
|
+
<key>nvModalSurveyResizingBottomPadding</key>
|
|
161
|
+
<integer>0</integer>
|
|
158
162
|
</dict>
|
|
159
163
|
</dict>
|
|
160
164
|
</plist>
|
|
@@ -13,6 +13,12 @@
|
|
|
13
13
|
#import "RCTUtils.h"
|
|
14
14
|
#endif
|
|
15
15
|
|
|
16
|
+
#if __has_include(<notifyvisitors/notifyvisitors.h>)
|
|
17
|
+
#import <notifyvisitors/notifyvisitors.h>
|
|
18
|
+
#else
|
|
19
|
+
#import "../notifyvisitors.h"
|
|
20
|
+
#endif
|
|
21
|
+
|
|
16
22
|
|
|
17
23
|
typedef NS_ENUM(NSInteger, OSNotificationEventTypes) {
|
|
18
24
|
NotificationReceived,
|
|
@@ -22,7 +28,7 @@ typedef NS_ENUM(NSInteger, OSNotificationEventTypes) {
|
|
|
22
28
|
//#define OSNotificationEventTypesArray @[@"Notifyvisitors-notificationReceived",@"Notifyvisitors-notificationOpened"]
|
|
23
29
|
//#define OSEventString(enum) [OSNotificationEventTypesArray objectAtIndex:enum]
|
|
24
30
|
|
|
25
|
-
@interface RCTEventEmitterDemo : RCTEventEmitter <RCTBridgeModule>
|
|
31
|
+
@interface RCTEventEmitterDemo : RCTEventEmitter <RCTBridgeModule, notifyvisitorsDelegate>
|
|
26
32
|
|
|
27
33
|
+ (void)sendEventWithName:(NSString *)name withBody:(NSDictionary *)body;
|
|
28
34
|
+ (BOOL)hasSetBridge;
|