@woosmap/react-native-plugin-geofencing 0.7.3 → 0.7.4-beta.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 +3 -0
- package/android/src/main/java/com/reactnativeplugingeofencing/PluginGeofencingModule.java +1 -1
- package/android/src/main/java/com/reactnativeplugingeofencing/WoosLocationReadyListener.java +5 -15
- package/android/src/main/java/com/reactnativeplugingeofencing/WoosRegionReadyListener.java +5 -16
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -104,7 +104,7 @@ public class PluginGeofencingModule extends ReactContextBaseJavaModule implement
|
|
|
104
104
|
}
|
|
105
105
|
this.woosmap.onResume();
|
|
106
106
|
//Add region listener
|
|
107
|
-
regionReadyListener = new WoosRegionReadyListener(
|
|
107
|
+
regionReadyListener = new WoosRegionReadyListener(reactContext);
|
|
108
108
|
woosmap.setRegionLogReadyListener(regionReadyListener);
|
|
109
109
|
woosmap.setRegionReadyListener(regionReadyListener);
|
|
110
110
|
if (!trackingProfile.isEmpty()) {
|
package/android/src/main/java/com/reactnativeplugingeofencing/WoosLocationReadyListener.java
CHANGED
|
@@ -1,12 +1,7 @@
|
|
|
1
1
|
package com.reactnativeplugingeofencing;
|
|
2
2
|
|
|
3
|
-
import android.content.Context;
|
|
4
3
|
import android.location.Location;
|
|
5
|
-
|
|
6
|
-
import com.facebook.react.ReactApplication;
|
|
7
|
-
import com.facebook.react.ReactInstanceManager;
|
|
8
|
-
import com.facebook.react.ReactNativeHost;
|
|
9
|
-
import com.facebook.react.bridge.ReactContext;
|
|
4
|
+
import com.facebook.react.bridge.ReactApplicationContext;
|
|
10
5
|
import com.facebook.react.modules.core.DeviceEventManagerModule;
|
|
11
6
|
import com.webgeoservices.woosmapgeofencing.Woosmap;
|
|
12
7
|
|
|
@@ -14,24 +9,19 @@ import com.webgeoservices.woosmapgeofencing.Woosmap;
|
|
|
14
9
|
* Implements Woosmap Location Ready callbacks
|
|
15
10
|
*/
|
|
16
11
|
public class WoosLocationReadyListener implements Woosmap.LocationReadyListener {
|
|
17
|
-
private
|
|
18
|
-
|
|
19
|
-
public WoosLocationReadyListener(Context context){
|
|
12
|
+
private ReactApplicationContext context;
|
|
13
|
+
public WoosLocationReadyListener(ReactApplicationContext context){
|
|
20
14
|
this.context=context;
|
|
21
15
|
}
|
|
22
16
|
|
|
23
17
|
private void sendEvent(final String eventName, final Object data) {
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
if (reactContext != null) {
|
|
27
|
-
reactContext.getJSModule(DeviceEventManagerModule.RCTDeviceEventEmitter.class).emit(eventName, data);
|
|
18
|
+
if (context != null) {
|
|
19
|
+
context.getJSModule(DeviceEventManagerModule.RCTDeviceEventEmitter.class).emit(eventName, data);
|
|
28
20
|
}
|
|
29
21
|
}
|
|
30
22
|
@Override
|
|
31
23
|
public void LocationReadyCallback(Location location) {
|
|
32
24
|
try {
|
|
33
|
-
ReactApplication reactApplication = ((ReactApplication)context.getApplicationContext());
|
|
34
|
-
reactNativeHost = reactApplication.getReactNativeHost();
|
|
35
25
|
sendEvent(WoosmapMessageAndKey.locationSuccessCallbackName, WoosmapUtil.getLocationWritableMap(location));
|
|
36
26
|
}catch (Exception ex){
|
|
37
27
|
sendEvent(WoosmapMessageAndKey.locationErrorCallbackName, ex.getMessage());
|
|
@@ -1,11 +1,6 @@
|
|
|
1
1
|
package com.reactnativeplugingeofencing;
|
|
2
2
|
|
|
3
|
-
import
|
|
4
|
-
|
|
5
|
-
import com.facebook.react.ReactApplication;
|
|
6
|
-
import com.facebook.react.ReactInstanceManager;
|
|
7
|
-
import com.facebook.react.ReactNativeHost;
|
|
8
|
-
import com.facebook.react.bridge.ReactContext;
|
|
3
|
+
import com.facebook.react.bridge.ReactApplicationContext;
|
|
9
4
|
import com.facebook.react.modules.core.DeviceEventManagerModule;
|
|
10
5
|
import com.webgeoservices.woosmapgeofencing.Woosmap;
|
|
11
6
|
import com.webgeoservices.woosmapgeofencingcore.database.Region;
|
|
@@ -17,11 +12,9 @@ import java.util.HashMap;
|
|
|
17
12
|
* Implements Woosmap Region callbacks
|
|
18
13
|
*/
|
|
19
14
|
public class WoosRegionReadyListener implements Woosmap.RegionReadyListener,Woosmap.RegionLogReadyListener {
|
|
20
|
-
|
|
21
|
-
private ReactNativeHost reactNativeHost;
|
|
22
|
-
private Context context;
|
|
15
|
+
private ReactApplicationContext context;
|
|
23
16
|
private boolean isRegionWatchEnabled = false;
|
|
24
|
-
public WoosRegionReadyListener(
|
|
17
|
+
public WoosRegionReadyListener(ReactApplicationContext context){
|
|
25
18
|
this.context=context;
|
|
26
19
|
}
|
|
27
20
|
|
|
@@ -33,10 +26,8 @@ public class WoosRegionReadyListener implements Woosmap.RegionReadyListener,Woos
|
|
|
33
26
|
isRegionWatchEnabled = value;
|
|
34
27
|
}
|
|
35
28
|
private void sendEvent(final String eventName, final Object data) {
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
if (reactContext != null) {
|
|
39
|
-
reactContext.getJSModule(DeviceEventManagerModule.RCTDeviceEventEmitter.class).emit(eventName, data);
|
|
29
|
+
if (context != null) {
|
|
30
|
+
context.getJSModule(DeviceEventManagerModule.RCTDeviceEventEmitter.class).emit(eventName, data);
|
|
40
31
|
}
|
|
41
32
|
}
|
|
42
33
|
@Override
|
|
@@ -49,8 +40,6 @@ public class WoosRegionReadyListener implements Woosmap.RegionReadyListener,Woos
|
|
|
49
40
|
airshipPushHelper.pushDataToCloud(data);
|
|
50
41
|
}
|
|
51
42
|
if (isRegionWatchEnabled){
|
|
52
|
-
ReactApplication reactApplication = ((ReactApplication)context.getApplicationContext());
|
|
53
|
-
reactNativeHost = reactApplication.getReactNativeHost();
|
|
54
43
|
sendEvent(WoosmapMessageAndKey.regionSuccessCallbackName, WoosmapUtil.getRegionWritableMap(regionLog));
|
|
55
44
|
}
|
|
56
45
|
}catch (Exception ex){
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@woosmap/react-native-plugin-geofencing",
|
|
3
|
-
"version": "0.7.
|
|
3
|
+
"version": "0.7.4-beta.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",
|