@woosmap/react-native-plugin-geofencing 0.2.3-beta.1 → 0.2.3

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
@@ -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 (!regionReadyListener.getIsRegionWatchEnabled()) {
457
- regionReadyListener.setIsRegionWatchEnabled(true);
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.getIsRegionWatchEnabled()) {
480
- regionReadyListener.setIsRegionWatchEnabled(false);
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
- if (isRegionWatchEnabled){
52
- ReactApplication reactApplication = ((ReactApplication)context.getApplicationContext());
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.3-beta.1",
3
+ "version": "0.2.3",
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",
@@ -16,7 +16,7 @@ Pod::Spec.new do |s|
16
16
  s.source_files = "ios/**/*.{h,m,mm,swift}"
17
17
 
18
18
  s.dependency "React-Core"
19
- s.dependency "WoosmapGeofencing" , '3.0.12'
19
+ s.dependency "WoosmapGeofencing" , '3.0.15'
20
20
  s.default_subspec = :default
21
21
 
22
22
  s.subspec "default" do |spec|