react-native-notifyvisitors 4.1.1 → 4.1.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/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 +13 -14
- package/android/src/main/AndroidManifest.xml +4 -3
- package/android/src/main/java/com/rn_notifyvisitors/RNNotifyvisitorsModule.java +587 -201
- package/index.d.ts +26 -0
- 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
|
@@ -14,14 +14,18 @@ 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.ReadableArray;
|
|
17
18
|
import com.facebook.react.bridge.ReadableMap;
|
|
18
19
|
import com.facebook.react.modules.core.DeviceEventManagerModule;
|
|
19
20
|
import com.notifyvisitors.notifyvisitors.NotifyVisitorsApi;
|
|
20
21
|
import com.notifyvisitors.notifyvisitors.NotifyVisitorsApplication;
|
|
22
|
+
import com.notifyvisitors.notifyvisitors.center.NVCenterStyleConfig;
|
|
21
23
|
import com.notifyvisitors.notifyvisitors.interfaces.NotificationCountInterface;
|
|
22
24
|
import com.notifyvisitors.notifyvisitors.interfaces.NotificationListDetailsCallback;
|
|
25
|
+
import com.notifyvisitors.notifyvisitors.interfaces.OnCenterCountListener;
|
|
23
26
|
import com.notifyvisitors.notifyvisitors.interfaces.OnEventTrackListener;
|
|
24
27
|
import com.notifyvisitors.notifyvisitors.interfaces.OnNotifyBotClickListener;
|
|
28
|
+
import com.notifyvisitors.notifyvisitors.interfaces.OnReviewCompleteListener;
|
|
25
29
|
import com.notifyvisitors.notifyvisitors.push.NVNotificationChannels;
|
|
26
30
|
|
|
27
31
|
import org.json.JSONArray;
|
|
@@ -36,7 +40,7 @@ public class RNNotifyvisitorsModule extends ReactContextBaseJavaModule implement
|
|
|
36
40
|
|
|
37
41
|
private final ReactApplicationContext reactContext;
|
|
38
42
|
private static final String TAG = "RN-NotifyVisitors";
|
|
39
|
-
private static final String PLUGIN_VERSION = "4.1.
|
|
43
|
+
private static final String PLUGIN_VERSION = "4.1.4";
|
|
40
44
|
|
|
41
45
|
private String PUSH_BANNER_CLICK_EVENT = "nv_push_banner_click";
|
|
42
46
|
private String CHAT_BOT_BUTTON_CLICK = "nv_chat_bot_button_click";
|
|
@@ -51,92 +55,84 @@ public class RNNotifyvisitorsModule extends ReactContextBaseJavaModule implement
|
|
|
51
55
|
Callback eventCallback;
|
|
52
56
|
Callback commonCallback;
|
|
53
57
|
|
|
58
|
+
private String tab1Label, tab1Name;
|
|
59
|
+
private String tab2Label, tab2Name;
|
|
60
|
+
private String tab3Label, tab3Name;
|
|
61
|
+
private String selectedTabColor, unSelectedTabColor, selectedTabIndicatorColor;
|
|
62
|
+
private int selectedTabIndex;
|
|
54
63
|
|
|
64
|
+
Activity mActivity;
|
|
65
|
+
JSONObject mTokens;
|
|
66
|
+
JSONObject mCustomObjects;
|
|
67
|
+
NVCenterStyleConfig config;
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
/* constructor */
|
|
55
71
|
public RNNotifyvisitorsModule(ReactApplicationContext reactContext) {
|
|
56
72
|
super(reactContext);
|
|
57
73
|
this.reactContext = reactContext;
|
|
58
74
|
reactContext.addActivityEventListener(this);
|
|
59
75
|
}
|
|
60
76
|
|
|
77
|
+
/* Bridge Caller */
|
|
61
78
|
@Override
|
|
62
79
|
public String getName() {
|
|
63
80
|
return "RNNotifyvisitors";
|
|
64
81
|
}
|
|
65
82
|
|
|
66
|
-
@ReactMethod
|
|
67
|
-
public static void register(Context context) {
|
|
68
|
-
try {
|
|
69
|
-
Log.i(TAG, "REGISTER !!");
|
|
70
|
-
NotifyVisitorsApplication.register((Application) context.getApplicationContext());
|
|
71
|
-
} catch (Exception e) {
|
|
72
|
-
Log.i(TAG, "REGISTER ERROR : " + e);
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
83
|
|
|
76
|
-
|
|
77
|
-
|
|
84
|
+
/* React Native Plugin Initialize */
|
|
85
|
+
@Override
|
|
86
|
+
public void initialize() {
|
|
87
|
+
super.initialize();
|
|
78
88
|
try {
|
|
79
|
-
Log.i(TAG, "
|
|
80
|
-
|
|
81
|
-
|
|
89
|
+
Log.i(TAG, "INITIALIZE");
|
|
90
|
+
Log.i(TAG, "RN-NV PLUGIN VERSION : " + PLUGIN_VERSION);
|
|
91
|
+
Activity currentActivity = getCurrentActivity();
|
|
92
|
+
if (currentActivity != null) {
|
|
93
|
+
Intent intent = currentActivity.getIntent();
|
|
94
|
+
if (intent != null) {
|
|
95
|
+
handleIntent(intent);
|
|
96
|
+
}
|
|
82
97
|
}
|
|
83
98
|
} catch (Exception e) {
|
|
84
|
-
Log.i(TAG, "
|
|
99
|
+
Log.i(TAG, "INITIALIZE ERROR : " + e);
|
|
85
100
|
}
|
|
86
|
-
}
|
|
87
101
|
|
|
88
102
|
|
|
89
|
-
@ReactMethod
|
|
90
|
-
public void showNotifications(int dismissValue) {
|
|
91
103
|
try {
|
|
92
|
-
|
|
93
|
-
|
|
104
|
+
NotifyVisitorsApi.getInstance(reactContext).getEventResponse(new OnEventTrackListener() {
|
|
105
|
+
@Override
|
|
106
|
+
public void onResponse(JSONObject jsonObject) {
|
|
107
|
+
sendResponse(jsonObject);
|
|
108
|
+
}
|
|
109
|
+
});
|
|
94
110
|
} catch (Exception e) {
|
|
95
|
-
Log.i(TAG, "
|
|
111
|
+
Log.i(TAG, "FETCH EVENT SURVEY ERROR : " + e);
|
|
96
112
|
}
|
|
97
|
-
}
|
|
98
113
|
|
|
99
|
-
@ReactMethod
|
|
100
|
-
public void stopNotifications() {
|
|
101
|
-
try {
|
|
102
|
-
Log.i(TAG, "STOP NOTIFICATIONS !!");
|
|
103
|
-
NotifyVisitorsApi.getInstance(reactContext).stopNotification();
|
|
104
|
-
} catch (Exception e) {
|
|
105
|
-
Log.i(TAG, "STOP NOTIFICATIONS ERROR : " + e);
|
|
106
|
-
}
|
|
107
114
|
}
|
|
108
115
|
|
|
116
|
+
|
|
117
|
+
/* 0 - For Native SDK Initialize From Application Class */
|
|
109
118
|
@ReactMethod
|
|
110
|
-
public void
|
|
119
|
+
public static void register(Context context) {
|
|
111
120
|
try {
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
if (str != null && str != "") {
|
|
116
|
-
if (str.equalsIgnoreCase("true")) {
|
|
117
|
-
bValue = true;
|
|
118
|
-
} else {
|
|
119
|
-
bValue = false;
|
|
120
|
-
}
|
|
121
|
-
Log.i(TAG, "FINAL BOOLEAN VALUE : " + bValue);
|
|
122
|
-
NotifyVisitorsApi.getInstance(reactContext).stopPushNotification(bValue);
|
|
123
|
-
|
|
124
|
-
} else {
|
|
125
|
-
Log.i(TAG, "PARAMETER CAN NOT BE NULL OR EMPTY");
|
|
126
|
-
}
|
|
127
|
-
|
|
121
|
+
Log.i(TAG, "REGISTER !!");
|
|
122
|
+
NotifyVisitorsApplication.register((Application) context.getApplicationContext());
|
|
128
123
|
} catch (Exception e) {
|
|
129
|
-
Log.i(TAG, "
|
|
124
|
+
Log.i(TAG, "REGISTER ERROR : " + e);
|
|
130
125
|
}
|
|
131
126
|
}
|
|
132
127
|
|
|
128
|
+
/* 1 - Survey, InApp Banners */
|
|
133
129
|
@ReactMethod
|
|
134
|
-
public void show(ReadableMap tokens, ReadableMap customObjects, String fragmentName, Callback callback) {
|
|
130
|
+
public void show(ReadableMap tokens, ReadableMap customObjects, final String fragmentName, Callback callback) {
|
|
135
131
|
try {
|
|
136
132
|
Log.i(TAG, "SHOW !!");
|
|
137
133
|
showCallback = callback;
|
|
138
134
|
|
|
139
|
-
|
|
135
|
+
mTokens = null;
|
|
140
136
|
try {
|
|
141
137
|
if (tokens != null) {
|
|
142
138
|
HashMap<String, Object> temp = tokens.toHashMap();
|
|
@@ -146,7 +142,7 @@ public class RNNotifyvisitorsModule extends ReactContextBaseJavaModule implement
|
|
|
146
142
|
Log.i(TAG, "TOKENS PARSE ERROR : " + e);
|
|
147
143
|
}
|
|
148
144
|
|
|
149
|
-
|
|
145
|
+
mCustomObjects = null;
|
|
150
146
|
try {
|
|
151
147
|
if (customObjects != null) {
|
|
152
148
|
HashMap<String, Object> temp = customObjects.toHashMap();
|
|
@@ -156,13 +152,171 @@ public class RNNotifyvisitorsModule extends ReactContextBaseJavaModule implement
|
|
|
156
152
|
Log.i(TAG, "CUSTOM-OBJECT PARSE ERROR : " + e);
|
|
157
153
|
}
|
|
158
154
|
|
|
159
|
-
|
|
160
|
-
|
|
155
|
+
mActivity = reactContext.getCurrentActivity();
|
|
156
|
+
if (mActivity != null) {
|
|
157
|
+
mActivity.runOnUiThread(new Runnable() {
|
|
158
|
+
@Override
|
|
159
|
+
public void run() {
|
|
160
|
+
Log.i(TAG, "Tokens : "+mTokens.toString());
|
|
161
|
+
Log.i(TAG, "Custom Rules : "+mCustomObjects.toString());
|
|
162
|
+
NotifyVisitorsApi.getInstance(mActivity).show(mTokens, mCustomObjects, fragmentName);
|
|
163
|
+
}
|
|
164
|
+
});
|
|
165
|
+
} else {
|
|
166
|
+
Log.e(TAG, "Getting Null Activity !!");
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
|
|
161
170
|
} catch (Exception e) {
|
|
162
171
|
Log.i(TAG, "SHOW ERROR : " + e);
|
|
163
172
|
}
|
|
164
173
|
}
|
|
165
174
|
|
|
175
|
+
/* 2 - Notification Center */
|
|
176
|
+
@ReactMethod
|
|
177
|
+
public void showNotifications(ReadableMap mAppInboxInfo, final int dismissValue) {
|
|
178
|
+
Log.i(TAG, "SHOW NOTIFICATIONS !!");
|
|
179
|
+
|
|
180
|
+
tab1Label = null;
|
|
181
|
+
tab1Name = null;
|
|
182
|
+
tab2Label = null;
|
|
183
|
+
tab2Name = null;
|
|
184
|
+
tab3Label = null;
|
|
185
|
+
tab3Name = null;
|
|
186
|
+
selectedTabColor = null;
|
|
187
|
+
unSelectedTabColor = null;
|
|
188
|
+
selectedTabIndicatorColor = null;
|
|
189
|
+
selectedTabIndex = 0;
|
|
190
|
+
|
|
191
|
+
JSONObject appInboxInfo;
|
|
192
|
+
|
|
193
|
+
|
|
194
|
+
try {
|
|
195
|
+
if (mAppInboxInfo != null) {
|
|
196
|
+
HashMap<String, Object> temp = mAppInboxInfo.toHashMap();
|
|
197
|
+
appInboxInfo = new JSONObject(temp);
|
|
198
|
+
|
|
199
|
+
try {
|
|
200
|
+
tab1Label = appInboxInfo.getString("label_one");
|
|
201
|
+
} catch (Exception e) {
|
|
202
|
+
Log.i(TAG, "SHOW NOTIFICATIONS TAB1LABEL ERROR :" + e);
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
try {
|
|
206
|
+
tab1Name = appInboxInfo.getString("name_one");
|
|
207
|
+
} catch (Exception e) {
|
|
208
|
+
Log.i(TAG, "SHOW NOTIFICATIONS TAB1NAME ERROR :" + e);
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
try {
|
|
212
|
+
tab2Label = appInboxInfo.getString("label_two");
|
|
213
|
+
} catch (Exception e) {
|
|
214
|
+
Log.i(TAG, "SHOW NOTIFICATIONS TAB2LABEL ERROR :" + e);
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
try {
|
|
218
|
+
tab2Name = appInboxInfo.getString("name_two");
|
|
219
|
+
} catch (Exception e) {
|
|
220
|
+
Log.i(TAG, "SHOW NOTIFICATIONS TAB2NAME ERROR :" + e);
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
try {
|
|
224
|
+
tab3Label = appInboxInfo.getString("label_three");
|
|
225
|
+
} catch (Exception e) {
|
|
226
|
+
Log.i(TAG, "SHOW NOTIFICATIONS TAB3LABEL ERROR :" + e);
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
try {
|
|
230
|
+
tab3Name = appInboxInfo.getString("name_three");
|
|
231
|
+
} catch (Exception e) {
|
|
232
|
+
Log.i(TAG, "SHOW NOTIFICATIONS TAB3NAME ERROR :" + e);
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
try {
|
|
236
|
+
selectedTabColor = appInboxInfo.getString("selectedTabTextColor");
|
|
237
|
+
} catch (Exception e) {
|
|
238
|
+
Log.i(TAG, "SHOW NOTIFICATIONS SELECTED TAB COLOR ERROR :" + e);
|
|
239
|
+
selectedTabColor = "#0000ff";
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
try {
|
|
243
|
+
unSelectedTabColor = appInboxInfo.getString("unselectedTabTextColor");
|
|
244
|
+
} catch (Exception e) {
|
|
245
|
+
Log.i(TAG, "SHOW NOTIFICATIONS UNSELECTED TAB COLOR ERROR :" + e);
|
|
246
|
+
unSelectedTabColor = "#779ecb";
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
try {
|
|
250
|
+
selectedTabIndicatorColor = appInboxInfo.getString("selectedTabBgColor");
|
|
251
|
+
} catch (Exception e) {
|
|
252
|
+
Log.i(TAG, "SHOW NOTIFICATIONS SELECTED TAB INDICATOR COLOR ERROR :" + e);
|
|
253
|
+
selectedTabIndicatorColor = "#0000ff";
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
try {
|
|
257
|
+
selectedTabIndex = appInboxInfo.getInt("selectedTabIndex_ios");
|
|
258
|
+
} catch (Exception e) {
|
|
259
|
+
Log.i(TAG, "SELECTED TAB INDEX ERROR :" + e);
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
if (tab1Label.equalsIgnoreCase("null")) {
|
|
263
|
+
tab1Label = null;
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
if (tab1Name.equalsIgnoreCase("null")) {
|
|
267
|
+
tab1Name = null;
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
if (tab2Label.equalsIgnoreCase("null")) {
|
|
271
|
+
tab2Label = null;
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
if (tab2Name.equalsIgnoreCase("null")) {
|
|
275
|
+
tab2Name = null;
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
if (tab3Label.equalsIgnoreCase("null")) {
|
|
279
|
+
tab3Label = null;
|
|
280
|
+
}
|
|
281
|
+
|
|
282
|
+
if (tab3Name.equalsIgnoreCase("null")) {
|
|
283
|
+
tab3Name = null;
|
|
284
|
+
}
|
|
285
|
+
|
|
286
|
+
config = new NVCenterStyleConfig();
|
|
287
|
+
config.setFirstTabDetail(tab1Label, tab1Name);
|
|
288
|
+
config.setSecondTabDetail(tab2Label, tab2Name);
|
|
289
|
+
config.setThirdTabDetail(tab3Label, tab3Name);
|
|
290
|
+
|
|
291
|
+
config.setSelectedTabColor(selectedTabColor);
|
|
292
|
+
config.setUnSelectedTabColor(unSelectedTabColor);
|
|
293
|
+
config.setSelectedTabIndicatorColor(selectedTabIndicatorColor);
|
|
294
|
+
|
|
295
|
+
Log.e(TAG, config.toString());
|
|
296
|
+
mActivity = reactContext.getCurrentActivity();
|
|
297
|
+
if (mActivity != null) {
|
|
298
|
+
mActivity.runOnUiThread(new Runnable() {
|
|
299
|
+
@Override
|
|
300
|
+
public void run() {
|
|
301
|
+
NotifyVisitorsApi.getInstance(reactContext).showNotifications(dismissValue, config);
|
|
302
|
+
}
|
|
303
|
+
});
|
|
304
|
+
} else {
|
|
305
|
+
Log.e(TAG, "Getting Null Activity !!");
|
|
306
|
+
}
|
|
307
|
+
|
|
308
|
+
|
|
309
|
+
} else {
|
|
310
|
+
Log.i(TAG, "TAB INFO IS NULL !! GOING FOR SIMPLE APP INBOX ");
|
|
311
|
+
NotifyVisitorsApi.getInstance(reactContext).showNotifications(dismissValue, null);
|
|
312
|
+
}
|
|
313
|
+
} catch (Exception e) {
|
|
314
|
+
Log.i(TAG, "SHOW NOTIFICATIONS ERROR : " + e);
|
|
315
|
+
}
|
|
316
|
+
|
|
317
|
+
}
|
|
318
|
+
|
|
319
|
+
/* 3 - Event Tracking */
|
|
166
320
|
@ReactMethod
|
|
167
321
|
public void event(String eventName, ReadableMap attributes, String ltv, String scope, Callback callback) {
|
|
168
322
|
try {
|
|
@@ -178,57 +332,18 @@ public class RNNotifyvisitorsModule extends ReactContextBaseJavaModule implement
|
|
|
178
332
|
} catch (Exception e) {
|
|
179
333
|
Log.i(TAG, "ATTRIBUTES PARSE ERROR : " + e);
|
|
180
334
|
}
|
|
335
|
+
|
|
336
|
+
Log.i(TAG, "Event Name : "+eventName);
|
|
337
|
+
Log.i(TAG, "Attributes : "+mAttributes.toString());
|
|
338
|
+
Log.i(TAG, "Life Time Value : "+ltv);
|
|
339
|
+
Log.i(TAG, "Scope : "+scope);
|
|
181
340
|
NotifyVisitorsApi.getInstance(reactContext).event(eventName, mAttributes, ltv, scope);
|
|
182
341
|
} catch (Exception e) {
|
|
183
342
|
Log.i(TAG, "EVENT ERROR : " + e);
|
|
184
343
|
}
|
|
185
344
|
}
|
|
186
345
|
|
|
187
|
-
|
|
188
|
-
public void getNotificationDataListener(final Callback callback) {
|
|
189
|
-
try {
|
|
190
|
-
Log.i(TAG, "GET NOTIFICATION DATA LISTENER !!");
|
|
191
|
-
NotifyVisitorsApi.getInstance(reactContext).getNotificationDataListener(new NotificationListDetailsCallback() {
|
|
192
|
-
@Override
|
|
193
|
-
public void getNotificationData(JSONArray notificationListResponse) {
|
|
194
|
-
Log.i(TAG, "RESPONSE : " + notificationListResponse);
|
|
195
|
-
callback.invoke(notificationListResponse.toString());
|
|
196
|
-
}
|
|
197
|
-
}, 0);
|
|
198
|
-
|
|
199
|
-
} catch (Exception e) {
|
|
200
|
-
Log.i(TAG, "GET NOTIFICATION DATA LISTENER ERROR : " + e);
|
|
201
|
-
}
|
|
202
|
-
}
|
|
203
|
-
|
|
204
|
-
@ReactMethod
|
|
205
|
-
public void getNotificationCount(final Callback callback) {
|
|
206
|
-
try {
|
|
207
|
-
Log.i(TAG, "GET NOTIFICATION COUNT !!");
|
|
208
|
-
NotifyVisitorsApi.getInstance(reactContext).getNotificationCount(new NotificationCountInterface() {
|
|
209
|
-
@Override
|
|
210
|
-
public void getCount(int count) {
|
|
211
|
-
Log.i(TAG, "COUNT : " + count);
|
|
212
|
-
String strI = String.valueOf(count);
|
|
213
|
-
callback.invoke(strI);
|
|
214
|
-
}
|
|
215
|
-
});
|
|
216
|
-
} catch (Exception e) {
|
|
217
|
-
Log.i(TAG, "GET NOTIFICATION COUNT ERROR : " + e);
|
|
218
|
-
}
|
|
219
|
-
}
|
|
220
|
-
|
|
221
|
-
@ReactMethod
|
|
222
|
-
public void scheduleNotification(String nid, String tag, String time, String title, String message, String url,
|
|
223
|
-
String icon) {
|
|
224
|
-
try {
|
|
225
|
-
Log.i(TAG, "SCHEDULE NOTIFICATION !!");
|
|
226
|
-
NotifyVisitorsApi.getInstance(reactContext).scheduleNotification(nid, tag, time, title, message, url, icon);
|
|
227
|
-
} catch (Exception e) {
|
|
228
|
-
Log.i(TAG, "SCHEDULE NOTIFICATION ERROR : " + e);
|
|
229
|
-
}
|
|
230
|
-
}
|
|
231
|
-
|
|
346
|
+
/* 4 - Login User */
|
|
232
347
|
@ReactMethod
|
|
233
348
|
public void userIdentifier(String userID, ReadableMap attributes) {
|
|
234
349
|
try {
|
|
@@ -240,66 +355,40 @@ public class RNNotifyvisitorsModule extends ReactContextBaseJavaModule implement
|
|
|
240
355
|
mAttributes = new JSONObject(temp);
|
|
241
356
|
}
|
|
242
357
|
|
|
358
|
+
Log.i(TAG, "User : "+userID);
|
|
359
|
+
Log.i(TAG, "Attributes : "+mAttributes);
|
|
243
360
|
NotifyVisitorsApi.getInstance(reactContext).userIdentifier(userID, mAttributes);
|
|
244
361
|
} catch (Exception e) {
|
|
245
362
|
Log.i(TAG, "USER IDENTIFIER ERROR : " + e);
|
|
246
363
|
}
|
|
247
364
|
}
|
|
248
365
|
|
|
366
|
+
/* 5 - chatBot */
|
|
249
367
|
@ReactMethod
|
|
250
|
-
public void
|
|
251
|
-
try {
|
|
252
|
-
Log.i(TAG, "STOP GEOFENCE PUSH FOR DATE TIME !!");
|
|
253
|
-
int jAdditionalHours = 0;
|
|
254
|
-
boolean lock = true;
|
|
255
|
-
if (dateTime == null || dateTime.length() == 0) {
|
|
256
|
-
Log.i(TAG, "DATETIME CAN NOT BE NULL OR EMPTY");
|
|
257
|
-
lock = false;
|
|
258
|
-
}
|
|
259
|
-
|
|
260
|
-
if (additionalHours == null || additionalHours.length() == 0) {
|
|
261
|
-
jAdditionalHours = 0;
|
|
262
|
-
} else {
|
|
263
|
-
jAdditionalHours = Integer.parseInt(additionalHours);
|
|
264
|
-
}
|
|
265
|
-
|
|
266
|
-
if (lock) {
|
|
267
|
-
NotifyVisitorsApi.getInstance(reactContext).stopGeofencePushforDateTime(dateTime, jAdditionalHours);
|
|
268
|
-
lock = true;
|
|
269
|
-
}
|
|
270
|
-
|
|
271
|
-
} catch (Exception e) {
|
|
272
|
-
Log.i(TAG, "STOP GEOFENCE PUSH FOR DATE TIME ERROR : " + e);
|
|
273
|
-
}
|
|
274
|
-
|
|
275
|
-
}
|
|
276
|
-
|
|
277
|
-
@ReactMethod
|
|
278
|
-
public void setAutoStartPermission() {
|
|
279
|
-
try {
|
|
280
|
-
Log.i(TAG, "SET AUTOSTART PERMISSION !!");
|
|
281
|
-
Activity activity = getCurrentActivity();
|
|
282
|
-
NotifyVisitorsApi.getInstance(reactContext).setAutoStartPermission(activity);
|
|
283
|
-
} catch (Exception e) {
|
|
284
|
-
Log.i(TAG, "SET AUTOSTART PERMISSION ERROR : " + e);
|
|
285
|
-
}
|
|
286
|
-
}
|
|
287
|
-
|
|
288
|
-
@ReactMethod
|
|
289
|
-
public void startChatBot(String screenName) {
|
|
368
|
+
public void startChatBot(final String screenName) {
|
|
290
369
|
try {
|
|
291
370
|
Log.i(TAG, "START CHAT BOT !!");
|
|
292
371
|
if (screenName == null || screenName.equalsIgnoreCase("empty")) {
|
|
293
372
|
Log.i(TAG, "SCREEN NAME IS MISSING");
|
|
294
373
|
} else {
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
374
|
+
mActivity = getCurrentActivity();
|
|
375
|
+
mActivity = reactContext.getCurrentActivity();
|
|
376
|
+
if (mActivity != null) {
|
|
377
|
+
mActivity.runOnUiThread(new Runnable() {
|
|
378
|
+
@Override
|
|
379
|
+
public void run() {
|
|
380
|
+
NotifyVisitorsApi.getInstance(mActivity).startChatBot(screenName, new OnNotifyBotClickListener() {
|
|
381
|
+
@Override
|
|
382
|
+
public void onInAppRedirection(JSONObject data) {
|
|
383
|
+
String strI = data.toString();
|
|
384
|
+
sendEvent(CHAT_BOT_BUTTON_CLICK, strI);
|
|
385
|
+
}
|
|
386
|
+
});
|
|
387
|
+
}
|
|
388
|
+
});
|
|
389
|
+
} else {
|
|
390
|
+
Log.e(TAG, "Getting Null Activity !!");
|
|
391
|
+
}
|
|
303
392
|
}
|
|
304
393
|
|
|
305
394
|
} catch (Exception e) {
|
|
@@ -307,20 +396,11 @@ public class RNNotifyvisitorsModule extends ReactContextBaseJavaModule implement
|
|
|
307
396
|
}
|
|
308
397
|
}
|
|
309
398
|
|
|
399
|
+
/* 6 - Push Notification Channel */
|
|
310
400
|
@ReactMethod
|
|
311
|
-
public void
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
String strI = NotifyVisitorsApi.getInstance(reactContext).getNvUid();
|
|
315
|
-
callback.invoke(strI);
|
|
316
|
-
} catch (Exception e) {
|
|
317
|
-
Log.i(TAG, "GET NV UID ERROR : " + e);
|
|
318
|
-
}
|
|
319
|
-
}
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
@ReactMethod
|
|
323
|
-
public void createNotificationChannel(String chId, String chName, String chDescription, String chImportance, String enableLights, String shouldVibrate, String lightColor, String soundFileName) {
|
|
401
|
+
public void createNotificationChannel(String chId, String chName, String chDescription,
|
|
402
|
+
String chImportance, String enableLights, String shouldVibrate,
|
|
403
|
+
String lightColor, String soundFileName) {
|
|
324
404
|
try {
|
|
325
405
|
Log.i(TAG, "CREATE NOTIFICATION CHANNEL !!");
|
|
326
406
|
|
|
@@ -374,6 +454,7 @@ public class RNNotifyvisitorsModule extends ReactContextBaseJavaModule implement
|
|
|
374
454
|
}
|
|
375
455
|
}
|
|
376
456
|
|
|
457
|
+
/* 7 - Push Notification Channel */
|
|
377
458
|
@ReactMethod
|
|
378
459
|
public void deleteNotificationChannel(String chId) {
|
|
379
460
|
try {
|
|
@@ -385,6 +466,7 @@ public class RNNotifyvisitorsModule extends ReactContextBaseJavaModule implement
|
|
|
385
466
|
}
|
|
386
467
|
}
|
|
387
468
|
|
|
469
|
+
/* 8 - Push Notification Channel Group */
|
|
388
470
|
@ReactMethod
|
|
389
471
|
public void createNotificationChannelGroup(String groupId, String groupName) {
|
|
390
472
|
try {
|
|
@@ -395,6 +477,7 @@ public class RNNotifyvisitorsModule extends ReactContextBaseJavaModule implement
|
|
|
395
477
|
}
|
|
396
478
|
}
|
|
397
479
|
|
|
480
|
+
/* 9 - Push Notification Channel Group */
|
|
398
481
|
@ReactMethod
|
|
399
482
|
public void deleteNotificationChannelGroup(String groupId) {
|
|
400
483
|
try {
|
|
@@ -405,48 +488,358 @@ public class RNNotifyvisitorsModule extends ReactContextBaseJavaModule implement
|
|
|
405
488
|
}
|
|
406
489
|
}
|
|
407
490
|
|
|
491
|
+
/* 10 - Unread Push Notification Count */
|
|
408
492
|
@ReactMethod
|
|
409
|
-
public void
|
|
493
|
+
public void getNotificationCenterCount(ReadableMap tabCountInfo, final Callback callback) {
|
|
494
|
+
Log.i(TAG, "GET NOTIFICATION CENTER COUNT !!");
|
|
495
|
+
tab1Label = null;
|
|
496
|
+
tab1Name = null;
|
|
497
|
+
tab2Label = null;
|
|
498
|
+
tab2Name = null;
|
|
499
|
+
tab3Label = null;
|
|
500
|
+
tab3Name = null;
|
|
501
|
+
|
|
502
|
+
JSONObject appInboxInfo;
|
|
410
503
|
try {
|
|
411
|
-
|
|
412
|
-
|
|
504
|
+
if (tabCountInfo != null) {
|
|
505
|
+
HashMap<String, Object> temp = tabCountInfo.toHashMap();
|
|
506
|
+
appInboxInfo = new JSONObject(temp);
|
|
507
|
+
|
|
508
|
+
try {
|
|
509
|
+
tab1Label = appInboxInfo.getString("label_one");
|
|
510
|
+
} catch (Exception e) {
|
|
511
|
+
Log.i(TAG, "SHOW NOTIFICATIONS TAB1LABEL ERROR :" + e);
|
|
512
|
+
}
|
|
513
|
+
|
|
514
|
+
try {
|
|
515
|
+
tab1Name = appInboxInfo.getString("name_one");
|
|
516
|
+
} catch (Exception e) {
|
|
517
|
+
Log.i(TAG, "SHOW NOTIFICATIONS TAB1NAME ERROR :" + e);
|
|
518
|
+
}
|
|
519
|
+
|
|
520
|
+
try {
|
|
521
|
+
tab2Label = appInboxInfo.getString("label_two");
|
|
522
|
+
} catch (Exception e) {
|
|
523
|
+
Log.i(TAG, "SHOW NOTIFICATIONS TAB2LABEL ERROR :" + e);
|
|
524
|
+
}
|
|
525
|
+
|
|
526
|
+
try {
|
|
527
|
+
tab2Name = appInboxInfo.getString("name_two");
|
|
528
|
+
} catch (Exception e) {
|
|
529
|
+
Log.i(TAG, "SHOW NOTIFICATIONS TAB2NAME ERROR :" + e);
|
|
530
|
+
}
|
|
531
|
+
|
|
532
|
+
try {
|
|
533
|
+
tab3Label = appInboxInfo.getString("label_three");
|
|
534
|
+
} catch (Exception e) {
|
|
535
|
+
Log.i(TAG, "SHOW NOTIFICATIONS TAB3LABEL ERROR :" + e);
|
|
536
|
+
}
|
|
537
|
+
|
|
538
|
+
try {
|
|
539
|
+
tab3Name = appInboxInfo.getString("name_three");
|
|
540
|
+
} catch (Exception e) {
|
|
541
|
+
Log.i(TAG, "SHOW NOTIFICATIONS TAB3NAME ERROR :" + e);
|
|
542
|
+
}
|
|
543
|
+
|
|
544
|
+
|
|
545
|
+
if (tab1Label.equalsIgnoreCase("null")) {
|
|
546
|
+
tab1Label = null;
|
|
547
|
+
}
|
|
548
|
+
|
|
549
|
+
if (tab1Name.equalsIgnoreCase("null")) {
|
|
550
|
+
tab1Name = null;
|
|
551
|
+
}
|
|
552
|
+
|
|
553
|
+
if (tab2Label.equalsIgnoreCase("null")) {
|
|
554
|
+
tab2Label = null;
|
|
555
|
+
}
|
|
556
|
+
|
|
557
|
+
if (tab2Name.equalsIgnoreCase("null")) {
|
|
558
|
+
tab2Name = null;
|
|
559
|
+
}
|
|
560
|
+
|
|
561
|
+
if (tab3Label.equalsIgnoreCase("null")) {
|
|
562
|
+
tab3Label = null;
|
|
563
|
+
}
|
|
564
|
+
|
|
565
|
+
if (tab3Name.equalsIgnoreCase("null")) {
|
|
566
|
+
tab3Name = null;
|
|
567
|
+
}
|
|
568
|
+
|
|
569
|
+
final NVCenterStyleConfig config = new NVCenterStyleConfig();
|
|
570
|
+
config.setFirstTabDetail(tab1Label, tab1Name);
|
|
571
|
+
config.setSecondTabDetail(tab2Label, tab2Name);
|
|
572
|
+
config.setThirdTabDetail(tab3Label, tab3Name);
|
|
573
|
+
|
|
574
|
+
|
|
575
|
+
mActivity = reactContext.getCurrentActivity();
|
|
576
|
+
if (mActivity != null) {
|
|
577
|
+
mActivity.runOnUiThread(new Runnable() {
|
|
578
|
+
@Override
|
|
579
|
+
public void run() {
|
|
580
|
+
NotifyVisitorsApi.getInstance(reactContext).getNotificationCenterCount(new OnCenterCountListener() {
|
|
581
|
+
@Override
|
|
582
|
+
public void getCount(JSONObject tabCount) {
|
|
583
|
+
Log.i(TAG, "Tab Counts : " + tabCount);
|
|
584
|
+
if (tabCount != null) {
|
|
585
|
+
callback.invoke(tabCount.toString());
|
|
586
|
+
} else {
|
|
587
|
+
Log.i(TAG, "GETTING NULL COUNT OBJECT !!");
|
|
588
|
+
}
|
|
589
|
+
}
|
|
590
|
+
}, config);
|
|
591
|
+
}
|
|
592
|
+
});
|
|
593
|
+
} else {
|
|
594
|
+
Log.e(TAG, "Getting Null Activity !!");
|
|
595
|
+
}
|
|
596
|
+
|
|
597
|
+
} else {
|
|
598
|
+
Log.i(TAG, "INFO IS NULL GOING FOR STANDARD NOTIFICATION CENTER COUNT !!");
|
|
599
|
+
mActivity = reactContext.getCurrentActivity();
|
|
600
|
+
if (mActivity != null) {
|
|
601
|
+
mActivity.runOnUiThread(new Runnable() {
|
|
602
|
+
@Override
|
|
603
|
+
public void run() {
|
|
604
|
+
NotifyVisitorsApi.getInstance(reactContext).getNotificationCenterCount(new OnCenterCountListener() {
|
|
605
|
+
@Override
|
|
606
|
+
public void getCount(JSONObject tabCount) {
|
|
607
|
+
Log.i(TAG, "Tab Counts : " + tabCount);
|
|
608
|
+
if (tabCount != null) {
|
|
609
|
+
callback.invoke(tabCount.toString());
|
|
610
|
+
} else {
|
|
611
|
+
Log.i(TAG, "GETTING NULL COUNT OBJECT !!");
|
|
612
|
+
}
|
|
613
|
+
}
|
|
614
|
+
}, null);
|
|
615
|
+
}
|
|
616
|
+
});
|
|
617
|
+
} else {
|
|
618
|
+
Log.e(TAG, "Getting Null Activity !!");
|
|
619
|
+
}
|
|
620
|
+
}
|
|
413
621
|
} catch (Exception e) {
|
|
414
|
-
Log.i(TAG, "
|
|
622
|
+
Log.i(TAG, "NOTIFICATION CENTER COUNT ERROR : " + e);
|
|
415
623
|
}
|
|
416
624
|
}
|
|
417
625
|
|
|
626
|
+
/* 11 - Get FCM/APNS Device Token */
|
|
627
|
+
@ReactMethod
|
|
628
|
+
public void getRegistrationToken(final Callback callback) {
|
|
629
|
+
try {
|
|
630
|
+
Log.i(TAG, "GET NOTIFICATION CENTER COUNT !!");
|
|
631
|
+
JSONObject nv_token = NotifyVisitorsApi.getInstance(reactContext).getPushRegistrationToken();
|
|
632
|
+
if (nv_token != null) {
|
|
633
|
+
String token = nv_token.getString("subscriptionId");
|
|
634
|
+
callback.invoke(token);
|
|
635
|
+
} else {
|
|
636
|
+
callback.invoke("unavailable");
|
|
637
|
+
}
|
|
418
638
|
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
Log.i(TAG, "ON ACTIVITY RESULT !!");
|
|
639
|
+
} catch (Exception e) {
|
|
640
|
+
Log.i(TAG, "GET NOTIFICATION CENTER COUNT ERROR : " + e);
|
|
641
|
+
}
|
|
423
642
|
}
|
|
424
643
|
|
|
644
|
+
/* 12 - Play Store / App Store Rating */
|
|
645
|
+
@ReactMethod
|
|
646
|
+
public void requestInAppReview(final Callback callback) {
|
|
647
|
+
Log.i(TAG, "GOOGLE IN-APP REVIEW !!");
|
|
648
|
+
try {
|
|
649
|
+
mActivity = reactContext.getCurrentActivity();
|
|
650
|
+
if (mActivity != null) {
|
|
651
|
+
mActivity.runOnUiThread(new Runnable() {
|
|
652
|
+
@Override
|
|
653
|
+
public void run() {
|
|
654
|
+
NotifyVisitorsApi.getInstance(mActivity).enableGoogleInAppReview(new OnReviewCompleteListener() {
|
|
655
|
+
@Override
|
|
656
|
+
public void onComplete(String reviewStatus) {
|
|
657
|
+
callback.invoke(reviewStatus);
|
|
658
|
+
}
|
|
659
|
+
});
|
|
660
|
+
}
|
|
661
|
+
});
|
|
662
|
+
} else {
|
|
663
|
+
Log.e(TAG, "Getting Null Activity !!");
|
|
664
|
+
}
|
|
425
665
|
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
666
|
+
} catch (Exception e) {
|
|
667
|
+
Log.i(TAG, "GOOGLE IN-APP REVIEW ERROR : " + e);
|
|
668
|
+
}
|
|
669
|
+
}
|
|
670
|
+
|
|
671
|
+
/* 13 - Category based Notification */
|
|
672
|
+
@ReactMethod
|
|
673
|
+
public void subscribePushCategory(ReadableArray categoryInfo, boolean unsubscribeSignal) {
|
|
674
|
+
Log.i(TAG, "SUBSCRIBE PUSH CATEGORY !!");
|
|
429
675
|
try {
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
676
|
+
JSONArray mCategoryInfo;
|
|
677
|
+
if (categoryInfo != null) {
|
|
678
|
+
mCategoryInfo = readableArrayToJSONArray(categoryInfo);
|
|
679
|
+
Log.i(TAG, "Category Info :" + mCategoryInfo.toString());
|
|
680
|
+
NotifyVisitorsApi.getInstance(reactContext).pushPreferences(mCategoryInfo, unsubscribeSignal);
|
|
681
|
+
}
|
|
682
|
+
} catch (Exception e) {
|
|
683
|
+
Log.i(TAG, "SUBSCRIBE PUSH CATEGORY ERROR : " + e);
|
|
684
|
+
}
|
|
685
|
+
}
|
|
686
|
+
|
|
687
|
+
|
|
688
|
+
/* 14 - Push /InApp / Notification Center Click Callback Data */
|
|
689
|
+
@ReactMethod
|
|
690
|
+
public void getLinkInfo() {
|
|
691
|
+
try {
|
|
692
|
+
Log.i(TAG, "GET LINK INFO !!");
|
|
693
|
+
if (finalData != null) {
|
|
694
|
+
sendEvent(PUSH_BANNER_CLICK_EVENT, finalData);
|
|
695
|
+
}
|
|
696
|
+
} catch (Exception e) {
|
|
697
|
+
Log.i(TAG, "GET LINK INFO ERROR : " + e);
|
|
698
|
+
}
|
|
699
|
+
}
|
|
700
|
+
|
|
701
|
+
/* 15 - Unique NotifyVisitors Identification */
|
|
702
|
+
@ReactMethod
|
|
703
|
+
public void getNvUID(final Callback callback) {
|
|
704
|
+
try {
|
|
705
|
+
Log.i(TAG, "GET NV UID !!");
|
|
706
|
+
String strI = NotifyVisitorsApi.getInstance(reactContext).getNvUid();
|
|
707
|
+
callback.invoke(strI);
|
|
708
|
+
} catch (Exception e) {
|
|
709
|
+
Log.i(TAG, "GET NV UID ERROR : " + e);
|
|
710
|
+
}
|
|
711
|
+
}
|
|
712
|
+
|
|
713
|
+
/* 16 - JSon Data For Custom Notification Center */
|
|
714
|
+
@ReactMethod
|
|
715
|
+
public void getNotificationDataListener(final Callback callback) {
|
|
716
|
+
try {
|
|
717
|
+
Log.i(TAG, "GET NOTIFICATION DATA LISTENER !!");
|
|
718
|
+
NotifyVisitorsApi.getInstance(reactContext).getNotificationDataListener(new NotificationListDetailsCallback() {
|
|
719
|
+
@Override
|
|
720
|
+
public void getNotificationData(JSONArray notificationListResponse) {
|
|
721
|
+
Log.i(TAG, "RESPONSE : " + notificationListResponse);
|
|
722
|
+
callback.invoke(notificationListResponse.toString());
|
|
437
723
|
}
|
|
724
|
+
}, 0);
|
|
725
|
+
|
|
726
|
+
} catch (Exception e) {
|
|
727
|
+
Log.i(TAG, "GET NOTIFICATION DATA LISTENER ERROR : " + e);
|
|
728
|
+
}
|
|
729
|
+
}
|
|
730
|
+
|
|
731
|
+
/* 17 - Auto Start Library Android */
|
|
732
|
+
@ReactMethod
|
|
733
|
+
public void setAutoStartPermission() {
|
|
734
|
+
try {
|
|
735
|
+
Log.i(TAG, "SET AUTOSTART PERMISSION !!");
|
|
736
|
+
mActivity = reactContext.getCurrentActivity();
|
|
737
|
+
if (mActivity != null) {
|
|
738
|
+
mActivity.runOnUiThread(new Runnable() {
|
|
739
|
+
@Override
|
|
740
|
+
public void run() {
|
|
741
|
+
NotifyVisitorsApi.getInstance(reactContext).setAutoStartPermission(mActivity);
|
|
742
|
+
}
|
|
743
|
+
});
|
|
744
|
+
} else {
|
|
745
|
+
Log.e(TAG, "Getting Null Activity !!");
|
|
438
746
|
}
|
|
439
747
|
} catch (Exception e) {
|
|
440
|
-
Log.i(TAG, "
|
|
748
|
+
Log.i(TAG, "SET AUTOSTART PERMISSION ERROR : " + e);
|
|
749
|
+
}
|
|
750
|
+
}
|
|
751
|
+
|
|
752
|
+
/* 18 - Stop Showing InApp Banner Survey */
|
|
753
|
+
@ReactMethod
|
|
754
|
+
public void stopNotifications() {
|
|
755
|
+
try {
|
|
756
|
+
Log.i(TAG, "STOP NOTIFICATIONS !!");
|
|
757
|
+
NotifyVisitorsApi.getInstance(reactContext).stopNotification();
|
|
758
|
+
} catch (Exception e) {
|
|
759
|
+
Log.i(TAG, "STOP NOTIFICATIONS ERROR : " + e);
|
|
441
760
|
}
|
|
761
|
+
}
|
|
442
762
|
|
|
763
|
+
/* 19 - Stop Showing Location Push for a custom time */
|
|
764
|
+
@ReactMethod
|
|
765
|
+
public void stopGeofencePushforDateTime(String dateTime, String additionalHours) {
|
|
443
766
|
try {
|
|
444
|
-
|
|
767
|
+
Log.i(TAG, "STOP GEOFENCE PUSH FOR DATE TIME !!");
|
|
768
|
+
int jAdditionalHours = 0;
|
|
769
|
+
boolean lock = true;
|
|
770
|
+
if (dateTime == null || dateTime.length() == 0) {
|
|
771
|
+
Log.i(TAG, "DATETIME CAN NOT BE NULL OR EMPTY");
|
|
772
|
+
lock = false;
|
|
773
|
+
}
|
|
774
|
+
|
|
775
|
+
if (additionalHours == null || additionalHours.length() == 0) {
|
|
776
|
+
jAdditionalHours = 0;
|
|
777
|
+
} else {
|
|
778
|
+
jAdditionalHours = Integer.parseInt(additionalHours);
|
|
779
|
+
}
|
|
780
|
+
|
|
781
|
+
if (lock) {
|
|
782
|
+
NotifyVisitorsApi.getInstance(reactContext).stopGeofencePushforDateTime(dateTime, jAdditionalHours);
|
|
783
|
+
lock = true;
|
|
784
|
+
}
|
|
785
|
+
|
|
445
786
|
} catch (Exception e) {
|
|
446
|
-
Log.i(TAG, "
|
|
787
|
+
Log.i(TAG, "STOP GEOFENCE PUSH FOR DATE TIME ERROR : " + e);
|
|
447
788
|
}
|
|
789
|
+
|
|
448
790
|
}
|
|
449
791
|
|
|
792
|
+
/* 20 - Trigger Push Notification on Panel */
|
|
793
|
+
@ReactMethod
|
|
794
|
+
public void scheduleNotification(String nid, String tag, String time,
|
|
795
|
+
String title, String message, String url,
|
|
796
|
+
String icon) {
|
|
797
|
+
try {
|
|
798
|
+
Log.i(TAG, "SCHEDULE NOTIFICATION !!");
|
|
799
|
+
NotifyVisitorsApi.getInstance(reactContext).scheduleNotification(nid, tag, time, title, message, url, icon);
|
|
800
|
+
} catch (Exception e) {
|
|
801
|
+
Log.i(TAG, "SCHEDULE NOTIFICATION ERROR : " + e);
|
|
802
|
+
}
|
|
803
|
+
}
|
|
804
|
+
|
|
805
|
+
/* 21 - Separate Callbacks For Events and Surveys */
|
|
806
|
+
@ReactMethod
|
|
807
|
+
public void getEventSurveyInfo(Callback callback) {
|
|
808
|
+
try {
|
|
809
|
+
Log.i(TAG, "GET EVENT SURVEY INFO !!");
|
|
810
|
+
commonCallback = callback;
|
|
811
|
+
} catch (Exception e) {
|
|
812
|
+
Log.i(TAG, "GET EVENT SURVEY INFO ERROR : " + e);
|
|
813
|
+
}
|
|
814
|
+
}
|
|
815
|
+
|
|
816
|
+
/* 22 - Depricated Function For Notification Count */
|
|
817
|
+
@ReactMethod
|
|
818
|
+
public void getNotificationCount(final Callback callback) {
|
|
819
|
+
try {
|
|
820
|
+
Log.i(TAG, "GET NOTIFICATION COUNT !!");
|
|
821
|
+
NotifyVisitorsApi.getInstance(reactContext).getNotificationCount(new NotificationCountInterface() {
|
|
822
|
+
@Override
|
|
823
|
+
public void getCount(int count) {
|
|
824
|
+
Log.i(TAG, "COUNT : " + count);
|
|
825
|
+
String strI = String.valueOf(count);
|
|
826
|
+
callback.invoke(strI);
|
|
827
|
+
}
|
|
828
|
+
});
|
|
829
|
+
} catch (Exception e) {
|
|
830
|
+
Log.i(TAG, "GET NOTIFICATION COUNT ERROR : " + e);
|
|
831
|
+
}
|
|
832
|
+
}
|
|
833
|
+
|
|
834
|
+
|
|
835
|
+
/* On Activity Result */
|
|
836
|
+
@Override
|
|
837
|
+
public void onActivityResult(Activity activity, int requestCode, int resultCode, Intent data) {
|
|
838
|
+
//this.onActivityResult(activity, requestCode, resultCode, data);
|
|
839
|
+
Log.i(TAG, "ON ACTIVITY RESULT !!");
|
|
840
|
+
}
|
|
841
|
+
|
|
842
|
+
/* On New Intents */
|
|
450
843
|
@Override
|
|
451
844
|
public void onNewIntent(Intent intent) {
|
|
452
845
|
try {
|
|
@@ -459,7 +852,7 @@ public class RNNotifyvisitorsModule extends ReactContextBaseJavaModule implement
|
|
|
459
852
|
}
|
|
460
853
|
}
|
|
461
854
|
|
|
462
|
-
/*
|
|
855
|
+
/* Process data from intent */
|
|
463
856
|
private void handleIntent(Intent intent) {
|
|
464
857
|
Log.i(TAG, "INSIDE HANDLE INTENT !!!!");
|
|
465
858
|
|
|
@@ -535,9 +928,8 @@ public class RNNotifyvisitorsModule extends ReactContextBaseJavaModule implement
|
|
|
535
928
|
}
|
|
536
929
|
}
|
|
537
930
|
}
|
|
538
|
-
/* handleIntent method end */
|
|
539
|
-
|
|
540
931
|
|
|
932
|
+
/* Send Event Callback to React Native Page */
|
|
541
933
|
private void sendEvent(String eventName, String params) {
|
|
542
934
|
try {
|
|
543
935
|
reactContext
|
|
@@ -548,24 +940,8 @@ public class RNNotifyvisitorsModule extends ReactContextBaseJavaModule implement
|
|
|
548
940
|
}
|
|
549
941
|
}
|
|
550
942
|
|
|
551
|
-
public ReactApplicationContext getReactContext() {
|
|
552
|
-
return reactContext;
|
|
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
943
|
|
|
944
|
+
/* Process click data from event and InApp Survey */
|
|
569
945
|
private void sendResponse(JSONObject response) {
|
|
570
946
|
try {
|
|
571
947
|
if (response != null) {
|
|
@@ -599,7 +975,17 @@ public class RNNotifyvisitorsModule extends ReactContextBaseJavaModule implement
|
|
|
599
975
|
} catch (Exception e) {
|
|
600
976
|
Log.i(TAG, "SURVEY SEND RESPONSE ERROR : " + e);
|
|
601
977
|
}
|
|
978
|
+
|
|
979
|
+
|
|
602
980
|
}
|
|
603
981
|
|
|
982
|
+
private JSONArray readableArrayToJSONArray(ReadableArray readableArray) {
|
|
983
|
+
JSONArray result = new JSONArray();
|
|
984
|
+
for (int i = 0; i < readableArray.size(); i++) {
|
|
985
|
+
String tmp = readableArray.getString(i);
|
|
986
|
+
result.put(tmp);
|
|
987
|
+
}
|
|
988
|
+
return result;
|
|
989
|
+
}
|
|
604
990
|
|
|
605
991
|
}
|