react-native-background-geolocation 5.7.0 → 5.7.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.
@@ -26,7 +26,7 @@ Pod::Spec.new do |s|
26
26
  s.source_files = 'ios/RNBackgroundGeolocation/*.{h,m,mm}'
27
27
  s.preserve_paths = 'docs', 'CHANGELOG.md', 'LICENSE', 'package.json', 'RNBackgroundGeolocation.ios.js'
28
28
 
29
- tslm_version = ENV['TSLOCATIONMANAGER_VERSION'] || '~> 4.7.1'
29
+ tslm_version = ENV['TSLOCATIONMANAGER_VERSION'] || '~> 4.7.2'
30
30
  s.dependency 'TSLocationManager', tslm_version
31
31
 
32
32
  s.libraries = 'sqlite3', 'z', 'stdc++'
@@ -1,22 +1,3 @@
1
-
2
- android {
3
- purgeBackgroundGeolocationDebugResources(applicationVariants)
4
- }
5
-
6
- /**
7
- * Background Geolocation's aar includes about 1.5M of mp3 sound-files for its debugging sound FX.
8
- * This method strips those mp3s out in RELEASE builds.
9
- */
10
- def purgeBackgroundGeolocationDebugResources(applicationVariants) {
11
- if ((rootProject.ext.has("removeBackgroundGeolocationDebugSoundsInRelease")) && (rootProject.ext.removeBackgroundGeolocationDebugSoundsInRelease == false)) return
12
- applicationVariants.all { variant ->
13
- if (variant.buildType.name == "release") {
14
- println("[react-native-background-geolocation] Purging debug resources in release build")
15
- variant.mergeResourcesProvider.configure {
16
- doLast {
17
- delete(fileTree(dir: outputDir, includes: ["raw_tslocationmanager*"]))
18
- }
19
- }
20
- }
21
- }
22
- }
1
+ // Intentionally empty. This script once stripped the SDK's debug sound FX from release builds.
2
+ // It remains only so the `apply from: ".../app.gradle"` line in an app's
3
+ // android/app/build.gradle (the Expo plugin adds one) still resolves.
@@ -9,7 +9,7 @@ def DEFAULT_TARGET_SDK_VERSION = 35
9
9
 
10
10
  // Plugin dependencies
11
11
  def DEFAULT_PLAY_SERVICES_LOCATION_VERSION = "21.3.0"
12
- def DEFAULT_TSLOCATIONMANAGER_VERSION = "4.6.+"
12
+ def DEFAULT_TSLOCATIONMANAGER_VERSION = "4.6.2"
13
13
  def DEFAULT_OK_HTTP_VERSION = "4.12.0"
14
14
  def DEFAULT_ANDROID_PERMISSIONS_VERSION = "2.1.6"
15
15
  def DEFAULT_EVENTBUS_VERSION = "3.3.1"
@@ -697,23 +697,40 @@ public class RNBackgroundGeolocationModule
697
697
  }
698
698
 
699
699
  @ReactMethod
700
- public void addGeofences(ReadableArray data, final Promise response) {
701
- List<TSGeofence> geofences = new ArrayList<TSGeofence>();
702
- for (int n=0;n<data.size();n++) {
703
- try {
704
- geofences.add(buildGeofence(data.getMap(n)));
705
- } catch (TSGeofence.Exception e) {
706
- response.reject(e.getMessage());
707
- return;
708
- }
700
+ public void addGeofences(final ReadableArray data, final Promise response) {
701
+ // (WO-107) This runs on React Native's native-modules thread, which every native module shares, and
702
+ // building a polygon geofence computes its minimum enclosing circle: thousands kept the thread busy for
703
+ // tens of seconds (RN #2668). Build on the SDK's pool.
704
+ // (WO-107) Nothing may escape the pool's Runnable: an exception there kills the app, where on the
705
+ // native-modules thread React Native turned it into a rejection. A missing array is refused here, as iOS
706
+ // refuses it; anything the build throws rejects.
707
+ if (data == null) {
708
+ response.reject("No geofences provided");
709
+ return;
709
710
  }
711
+ BackgroundGeolocation.getThreadPool().execute(new Runnable() {
712
+ @Override public void run() {
713
+ List<TSGeofence> geofences = new ArrayList<TSGeofence>();
714
+ for (int n=0;n<data.size();n++) {
715
+ try {
716
+ geofences.add(buildGeofence(data.getMap(n)));
717
+ } catch (TSGeofence.Exception e) {
718
+ response.reject(e.getMessage());
719
+ return;
720
+ } catch (RuntimeException e) { // an element that is not a map, a field of the wrong type
721
+ response.reject(e);
722
+ return;
723
+ }
724
+ }
710
725
 
711
- getAdapter().addGeofences(geofences, new TSCallback() {
712
- @Override public void onSuccess() {
713
- response.resolve(true);
714
- }
715
- @Override public void onFailure(String error) {
716
- response.reject(error);
726
+ getAdapter().addGeofences(geofences, new TSCallback() {
727
+ @Override public void onSuccess() {
728
+ response.resolve(true);
729
+ }
730
+ @Override public void onFailure(String error) {
731
+ response.reject(error);
732
+ }
733
+ });
717
734
  }
718
735
  });
719
736
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-background-geolocation",
3
- "version": "5.7.0",
3
+ "version": "5.7.1",
4
4
  "description": "The most sophisticated cross-platform background location-tracking & geofencing module with battery-conscious motion-detection intelligence",
5
5
  "scripts": {
6
6
  "build": "pnpm run build:expo",