@woosmap/react-native-plugin-geofencing 0.12.3 → 0.13.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/CHANGELOG.md
CHANGED
|
@@ -16,6 +16,7 @@ import java.util.Map;
|
|
|
16
16
|
import java.util.TimeZone;
|
|
17
17
|
import org.json.JSONException;
|
|
18
18
|
import org.json.JSONObject;
|
|
19
|
+
import com.google.gson.Gson;
|
|
19
20
|
|
|
20
21
|
public class AirshipPushHelper implements AbstractPushHelper {
|
|
21
22
|
SimpleDateFormat displayDateFormatAirship;
|
|
@@ -40,23 +41,38 @@ public class AirshipPushHelper implements AbstractPushHelper {
|
|
|
40
41
|
String key;
|
|
41
42
|
Class type;
|
|
42
43
|
for (Map.Entry<String, Object> entry : data.entrySet()) {
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
44
|
+
try{
|
|
45
|
+
key = entry.getKey();
|
|
46
|
+
keyData = entry.getValue();
|
|
47
|
+
if (keyData == null){
|
|
48
|
+
keyData = "";
|
|
49
|
+
}
|
|
50
|
+
type = keyData.getClass();
|
|
51
|
+
if (type.getName().equals("java.lang.Double")){
|
|
52
|
+
type = double.class;
|
|
53
|
+
}
|
|
54
|
+
else if (type.getName().equals("java.lang.Integer")){
|
|
55
|
+
type = int.class;
|
|
56
|
+
}
|
|
57
|
+
else if (type.getName().equals("java.lang.Boolean")){
|
|
58
|
+
type = boolean.class;
|
|
59
|
+
}
|
|
60
|
+
else if (type.getName().equals("java.lang.Long")){
|
|
61
|
+
type = long.class;
|
|
62
|
+
}
|
|
63
|
+
else if (type.getName().equals("com.google.gson.internal.LinkedTreeMap")) {
|
|
64
|
+
type = String.class;
|
|
65
|
+
keyData = new Gson().toJson(keyData);
|
|
66
|
+
} else {
|
|
67
|
+
type = String.class;
|
|
68
|
+
keyData = keyData.toString();
|
|
69
|
+
}
|
|
70
|
+
addProp = builderClass.getMethod("addProperty", String.class, type);
|
|
71
|
+
addProp.invoke(builderInstance,key, keyData);
|
|
54
72
|
}
|
|
55
|
-
|
|
56
|
-
|
|
73
|
+
catch (Exception ex){
|
|
74
|
+
Log.e(TAG, ex.toString());
|
|
57
75
|
}
|
|
58
|
-
addProp = builderClass.getMethod("addProperty", String.class, type);
|
|
59
|
-
addProp.invoke(builderInstance,key, keyData);
|
|
60
76
|
}
|
|
61
77
|
|
|
62
78
|
Method build = builderClass.getMethod("build");
|
|
@@ -69,9 +85,9 @@ public class AirshipPushHelper implements AbstractPushHelper {
|
|
|
69
85
|
con.setAccessible(true);
|
|
70
86
|
Object eventInstance = con.newInstance(builderInstance);
|
|
71
87
|
Method track = eventClass.getMethod("track");
|
|
72
|
-
|
|
88
|
+
track.invoke(eventInstance);
|
|
73
89
|
Log.d(TAG,"event tracked");
|
|
74
|
-
|
|
90
|
+
break;
|
|
75
91
|
}
|
|
76
92
|
catch (Exception ex) {
|
|
77
93
|
Log.e(TAG, ex.toString());
|
|
@@ -105,9 +121,7 @@ public class AirshipPushHelper implements AbstractPushHelper {
|
|
|
105
121
|
POI poi = this.db.getPOIsDAO().getPOIbyStoreId(regionLog.idStore);
|
|
106
122
|
if (poi != null) {
|
|
107
123
|
HashMap<String, Object> poiData = setDataAirshipPOI(poi);
|
|
108
|
-
|
|
109
|
-
data.putAll(poiData);
|
|
110
|
-
}
|
|
124
|
+
data.putAll(poiData);
|
|
111
125
|
}
|
|
112
126
|
data.put("date", displayDateFormatAirship.format(regionLog.dateTime));
|
|
113
127
|
data.put("event", eventName);
|
|
@@ -135,7 +149,7 @@ public class AirshipPushHelper implements AbstractPushHelper {
|
|
|
135
149
|
if (!"null".equals(POIaround.countryCode)) {
|
|
136
150
|
data.put("country_code", POIaround.countryCode);
|
|
137
151
|
}
|
|
138
|
-
data.put("openNow", POIaround.openNow);
|
|
152
|
+
data.put("openNow", POIaround.openNow());
|
|
139
153
|
|
|
140
154
|
// User Properties
|
|
141
155
|
try {
|
|
@@ -147,7 +161,7 @@ public class AirshipPushHelper implements AbstractPushHelper {
|
|
|
147
161
|
}
|
|
148
162
|
}
|
|
149
163
|
} catch (JSONException e) {
|
|
150
|
-
e.
|
|
164
|
+
Log.e(TAG, e.toString());
|
|
151
165
|
}
|
|
152
166
|
|
|
153
167
|
return data;
|
|
@@ -255,7 +255,7 @@ public class PluginGeofencingModule extends ReactContextBaseJavaModule implement
|
|
|
255
255
|
promise.reject(WoosmapMessageAndKey.errorCode, WoosmapMessageAndKey.permissionValueNotProvided);
|
|
256
256
|
}
|
|
257
257
|
boolean isBackground = data.getBoolean(0);
|
|
258
|
-
PermissionAwareActivity activity = (PermissionAwareActivity) getCurrentActivity();
|
|
258
|
+
PermissionAwareActivity activity = (PermissionAwareActivity) getReactApplicationContext().getCurrentActivity();
|
|
259
259
|
mPermissionsRequestPromise = promise;
|
|
260
260
|
if (activity != null) {
|
|
261
261
|
if (Build.VERSION.SDK_INT >= 23) {
|
|
@@ -281,7 +281,7 @@ public class PluginGeofencingModule extends ReactContextBaseJavaModule implement
|
|
|
281
281
|
if (promise == null) {
|
|
282
282
|
return;
|
|
283
283
|
}
|
|
284
|
-
PermissionAwareActivity activity = (PermissionAwareActivity) getCurrentActivity();
|
|
284
|
+
PermissionAwareActivity activity = (PermissionAwareActivity) getReactApplicationContext().getCurrentActivity();
|
|
285
285
|
if (activity == null) {
|
|
286
286
|
promise.resolve(WoosmapMessageAndKey.unknownMessage);
|
|
287
287
|
return;
|
|
@@ -323,7 +323,7 @@ public class PluginGeofencingModule extends ReactContextBaseJavaModule implement
|
|
|
323
323
|
if (promise == null) {
|
|
324
324
|
return;
|
|
325
325
|
}
|
|
326
|
-
Activity activity = getCurrentActivity();
|
|
326
|
+
Activity activity = getReactApplicationContext().getCurrentActivity();
|
|
327
327
|
if (activity == null) {
|
|
328
328
|
promise.resolve(WoosmapMessageAndKey.unknownMessage);
|
|
329
329
|
return;
|
|
@@ -361,7 +361,7 @@ public class PluginGeofencingModule extends ReactContextBaseJavaModule implement
|
|
|
361
361
|
if (promise == null) {
|
|
362
362
|
return;
|
|
363
363
|
}
|
|
364
|
-
Activity activity = getCurrentActivity();
|
|
364
|
+
Activity activity = getReactApplicationContext().getCurrentActivity();
|
|
365
365
|
if (activity == null) {
|
|
366
366
|
promise.resolve(WoosmapMessageAndKey.unknownMessage);
|
|
367
367
|
return;
|
|
@@ -419,7 +419,7 @@ public class PluginGeofencingModule extends ReactContextBaseJavaModule implement
|
|
|
419
419
|
*/
|
|
420
420
|
private boolean hasPermission(boolean isBackground) {
|
|
421
421
|
try {
|
|
422
|
-
Activity activity = getCurrentActivity();
|
|
422
|
+
Activity activity = getReactApplicationContext().getCurrentActivity();
|
|
423
423
|
if (activity == null) {
|
|
424
424
|
return false;
|
|
425
425
|
}
|
|
@@ -1116,7 +1116,7 @@ public class PluginGeofencingModule extends ReactContextBaseJavaModule implement
|
|
|
1116
1116
|
private void provideNotificationPermissionStatus(final Promise promise) {
|
|
1117
1117
|
if (promise == null) return;
|
|
1118
1118
|
|
|
1119
|
-
Activity activity = getCurrentActivity();
|
|
1119
|
+
Activity activity = getReactApplicationContext().getCurrentActivity();
|
|
1120
1120
|
if (activity == null) {
|
|
1121
1121
|
promise.resolve(WoosmapMessageAndKey.unknownMessage);
|
|
1122
1122
|
return;
|
|
@@ -1163,7 +1163,7 @@ public class PluginGeofencingModule extends ReactContextBaseJavaModule implement
|
|
|
1163
1163
|
@ReactMethod
|
|
1164
1164
|
public void requestNotificationPermissions(final Promise promise) {
|
|
1165
1165
|
try {
|
|
1166
|
-
Activity activity = getCurrentActivity();
|
|
1166
|
+
Activity activity = getReactApplicationContext().getCurrentActivity();
|
|
1167
1167
|
if (activity == null) {
|
|
1168
1168
|
promise.resolve(WoosmapMessageAndKey.unknownMessage);
|
|
1169
1169
|
return;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@woosmap/react-native-plugin-geofencing",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.13.1",
|
|
4
4
|
"description": "This react-native plugin extends the functionality offered by the Woosmap Geofencing Mobile SDKs. Find more about the Woosmap Geofencing SDK",
|
|
5
5
|
"main": "lib/commonjs/index",
|
|
6
6
|
"module": "lib/module/index",
|