@woosmap/react-native-plugin-geofencing 0.2.4-beta.0 → 0.2.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/CHANGELOG.md
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
### Latest
|
|
2
|
+
* Added a new field named `eventName` in the region callback
|
|
3
|
+
|
|
4
|
+
### 0.1.9
|
|
5
|
+
* #56 region create event triggers other than region log event removed in android. by @dippatra in https://github.com/Woosmap/geofencing-react-native-plugin/pull/58
|
|
6
|
+
|
|
7
|
+
### 0.1.8
|
|
8
|
+
* #53 POI identifier (idStore) is not returned in the Region object issue by @dippatra in https://github.com/Woosmap/geofencing-react-native-plugin/pull/54
|
package/android/build.gradle
CHANGED
|
@@ -60,7 +60,7 @@ dependencies {
|
|
|
60
60
|
implementation 'com.google.android.gms:play-services-location:21.0.1'
|
|
61
61
|
implementation 'com.google.code.gson:gson:2.8.8'
|
|
62
62
|
implementation "com.github.woosmap:geofencing-core-android-sdk:core_geofence_2.+"
|
|
63
|
-
implementation("com.webgeoservices.woosmapgeofencing:woosmap-mobile-sdk:3.0.
|
|
63
|
+
implementation("com.webgeoservices.woosmapgeofencing:woosmap-mobile-sdk:3.0.12")
|
|
64
64
|
implementation 'com.google.android.gms:play-services-maps:18.1.0'
|
|
65
65
|
implementation 'androidx.room:room-runtime:2.2.4'
|
|
66
66
|
annotationProcessor 'androidx.room:room-compiler:2.2.4'
|
|
@@ -107,10 +107,6 @@ public class PluginGeofencingModule extends ReactContextBaseJavaModule implement
|
|
|
107
107
|
this.woosmap.createWoosmapNotifChannel();
|
|
108
108
|
}
|
|
109
109
|
this.woosmap.onResume();
|
|
110
|
-
//Add region listener
|
|
111
|
-
regionReadyListener = new WoosRegionReadyListener(getReactApplicationContext());
|
|
112
|
-
woosmap.setRegionLogReadyListener(regionReadyListener);
|
|
113
|
-
woosmap.setRegionReadyListener(regionReadyListener);
|
|
114
110
|
if (!trackingProfile.isEmpty()) {
|
|
115
111
|
woosmap.startTracking(trackingProfile);
|
|
116
112
|
}
|
|
@@ -453,8 +449,10 @@ public class PluginGeofencingModule extends ReactContextBaseJavaModule implement
|
|
|
453
449
|
public void watchRegions(String watchID, Promise promise) {
|
|
454
450
|
try {
|
|
455
451
|
if (isWoosmapInitialized()) {
|
|
456
|
-
if (
|
|
457
|
-
regionReadyListener
|
|
452
|
+
if (regionReadyListener == null) {
|
|
453
|
+
regionReadyListener = new WoosRegionReadyListener(reactContext);
|
|
454
|
+
woosmap.setRegionLogReadyListener(regionReadyListener);
|
|
455
|
+
woosmap.setRegionReadyListener(regionReadyListener);
|
|
458
456
|
promise.resolve(watchID);
|
|
459
457
|
} else {
|
|
460
458
|
promise.reject(WoosmapMessageAndKey.errorCode, WoosmapMessageAndKey.regionWatchAlreadyStarted);
|
|
@@ -476,8 +474,10 @@ public class PluginGeofencingModule extends ReactContextBaseJavaModule implement
|
|
|
476
474
|
@ReactMethod
|
|
477
475
|
public void clearRegionsWatch(String watchID, Promise promise) {
|
|
478
476
|
try {
|
|
479
|
-
if (regionReadyListener
|
|
480
|
-
|
|
477
|
+
if (regionReadyListener != null) {
|
|
478
|
+
woosmap.setRegionLogReadyListener(null);
|
|
479
|
+
woosmap.setRegionReadyListener(null);
|
|
480
|
+
regionReadyListener = null;
|
|
481
481
|
promise.resolve(watchID);
|
|
482
482
|
} else {
|
|
483
483
|
promise.reject(WoosmapMessageAndKey.errorCode, WoosmapMessageAndKey.regionWatchNotStarted);
|
|
@@ -20,18 +20,9 @@ public class WoosRegionReadyListener implements Woosmap.RegionReadyListener,Woos
|
|
|
20
20
|
|
|
21
21
|
private ReactNativeHost reactNativeHost;
|
|
22
22
|
private Context context;
|
|
23
|
-
private boolean isRegionWatchEnabled = false;
|
|
24
23
|
public WoosRegionReadyListener(Context context){
|
|
25
24
|
this.context=context;
|
|
26
25
|
}
|
|
27
|
-
|
|
28
|
-
public boolean getIsRegionWatchEnabled(){
|
|
29
|
-
return isRegionWatchEnabled;
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
public void setIsRegionWatchEnabled(boolean value){
|
|
33
|
-
isRegionWatchEnabled = value;
|
|
34
|
-
}
|
|
35
26
|
private void sendEvent(final String eventName, final Object data) {
|
|
36
27
|
final ReactInstanceManager reactInstanceManager = reactNativeHost.getReactInstanceManager();
|
|
37
28
|
ReactContext reactContext = reactInstanceManager.getCurrentReactContext();
|
|
@@ -42,17 +33,15 @@ public class WoosRegionReadyListener implements Woosmap.RegionReadyListener,Woos
|
|
|
42
33
|
@Override
|
|
43
34
|
public void RegionLogReadyCallback(RegionLog regionLog) {
|
|
44
35
|
try {
|
|
36
|
+
ReactApplication reactApplication = ((ReactApplication)context.getApplicationContext());
|
|
45
37
|
if (WoosmapUtil.getEnableAishipConnector(context)){
|
|
46
38
|
//Do the airship push here.
|
|
47
39
|
AirshipPushHelper airshipPushHelper = new AirshipPushHelper(context);
|
|
48
40
|
HashMap<String, Object> data = airshipPushHelper.getAirshipData(regionLog);
|
|
49
41
|
airshipPushHelper.pushDataToCloud(data);
|
|
50
42
|
}
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
reactNativeHost = reactApplication.getReactNativeHost();
|
|
54
|
-
sendEvent(WoosmapMessageAndKey.regionSuccessCallbackName, WoosmapUtil.getRegionWritableMap(regionLog));
|
|
55
|
-
}
|
|
43
|
+
reactNativeHost = reactApplication.getReactNativeHost();
|
|
44
|
+
sendEvent(WoosmapMessageAndKey.regionSuccessCallbackName, WoosmapUtil.getRegionWritableMap(regionLog));
|
|
56
45
|
}catch (Exception ex){
|
|
57
46
|
sendEvent(WoosmapMessageAndKey.regionErrorCallbackName, ex.getMessage());
|
|
58
47
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@woosmap/react-native-plugin-geofencing",
|
|
3
|
-
"version": "0.2.4
|
|
3
|
+
"version": "0.2.4",
|
|
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",
|
|
@@ -141,4 +141,4 @@
|
|
|
141
141
|
"dependencies": {
|
|
142
142
|
"react-native-uuid": "^2.0.1"
|
|
143
143
|
}
|
|
144
|
-
}
|
|
144
|
+
}
|