react-native-background-geolocation 5.2.0 → 5.3.0
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/RNBackgroundGeolocation.podspec +1 -1
- package/android/build.gradle +34 -2
- package/android/src/main/java/com/transistorsoft/rnbackgroundgeolocation/RNBackgroundGeolocationModule.java +4 -2
- package/ios/RNBackgroundGeolocation/RNBackgroundGeolocation.mm +3 -2
- package/package.json +1 -1
- package/src/NativeModule.js +2 -2
- package/src/index.js +2 -2
- package/src/native/specs/NativeBackgroundGeolocation.ts +1 -1
- package/src/specs/NativeRNBackgroundGeolocation.js +1 -1
|
@@ -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.
|
|
29
|
+
tslm_version = ENV['TSLOCATIONMANAGER_VERSION'] || '~> 4.3.0'
|
|
30
30
|
s.dependency 'TSLocationManager', tslm_version
|
|
31
31
|
|
|
32
32
|
s.libraries = 'sqlite3', 'z', 'stdc++'
|
package/android/build.gradle
CHANGED
|
@@ -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.
|
|
12
|
+
def DEFAULT_TSLOCATIONMANAGER_VERSION = "4.3.+"
|
|
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"
|
|
@@ -25,6 +25,38 @@ def safeExtGet(prop, fallback) {
|
|
|
25
25
|
rootProject.ext.has(prop) ? rootProject.ext.get(prop) : fallback
|
|
26
26
|
}
|
|
27
27
|
|
|
28
|
+
// Guards against the missing-symbol crash that occurs when an app pins an `ext.tslocationmanagerVersion`
|
|
29
|
+
// older than the SDK this plugin's bridge adapter was built against. Returns `minVersion` (with a
|
|
30
|
+
// warning) when the pinned version's entire range is below it; otherwise returns the pin unchanged.
|
|
31
|
+
// Dynamic pins are handled by comparing the pin's ceiling to the minimum's floor, so "4.2.+" is
|
|
32
|
+
// overridden while "4.+"/"+" are respected. Drop-in identical across the four plugin SDKs.
|
|
33
|
+
def ensureTSLocationManagerVersion(String configured, String minVersion) {
|
|
34
|
+
def parse = { String v, boolean asCeiling ->
|
|
35
|
+
def parts = (v ?: "").trim().tokenize(".")
|
|
36
|
+
def out = [0, 0, 0]
|
|
37
|
+
boolean wild = false
|
|
38
|
+
for (int i = 0; i < 3; i++) {
|
|
39
|
+
if (wild) { out[i] = asCeiling ? Integer.MAX_VALUE : 0; continue }
|
|
40
|
+
def p = (i < parts.size()) ? parts[i] : null
|
|
41
|
+
if (p != null && p.isInteger()) {
|
|
42
|
+
out[i] = p as int
|
|
43
|
+
} else if (p != null) { // "+" wildcard or qualifier
|
|
44
|
+
wild = true
|
|
45
|
+
out[i] = asCeiling ? Integer.MAX_VALUE : 0
|
|
46
|
+
} // missing trailing component stays 0
|
|
47
|
+
}
|
|
48
|
+
return out
|
|
49
|
+
}
|
|
50
|
+
def c = parse(configured, true) // ceiling of the app's pin
|
|
51
|
+
def f = parse(minVersion, false) // floor of the required minimum
|
|
52
|
+
def cmp = (c[0] <=> f[0]) ?: (c[1] <=> f[1]) ?: (c[2] <=> f[2])
|
|
53
|
+
if (cmp < 0) {
|
|
54
|
+
println("[tslocationmanager] ⚠️ ext.tslocationmanagerVersion '${configured}' is older than the '${minVersion}' required by this plugin release and has been overridden to '${minVersion}'. The native bridge adapter references symbols added in '${minVersion}'; an older SDK causes missing-symbol build failures / runtime crashes. Update or remove ext.tslocationmanagerVersion in your root build.gradle to silence this warning.")
|
|
55
|
+
return minVersion
|
|
56
|
+
}
|
|
57
|
+
return configured
|
|
58
|
+
}
|
|
59
|
+
|
|
28
60
|
react {
|
|
29
61
|
libraryName = "react-native-background-geolocation"
|
|
30
62
|
codegenJavaPackageName = "com.transistorsoft.rnbackgroundgeolocation"
|
|
@@ -61,7 +93,7 @@ repositories{
|
|
|
61
93
|
|
|
62
94
|
dependencies {
|
|
63
95
|
def playServicesLocationVersion = safeExtGet('playServicesLocationVersion', safeExtGet('googlePlayServicesLocationVersion', DEFAULT_PLAY_SERVICES_LOCATION_VERSION))
|
|
64
|
-
def tslocationmanagerVersion = safeExtGet('tslocationmanagerVersion', DEFAULT_TSLOCATIONMANAGER_VERSION)
|
|
96
|
+
def tslocationmanagerVersion = ensureTSLocationManagerVersion(safeExtGet('tslocationmanagerVersion', DEFAULT_TSLOCATIONMANAGER_VERSION), DEFAULT_TSLOCATIONMANAGER_VERSION)
|
|
65
97
|
implementation "com.facebook.react:react-native:${safeExtGet('reactNativeVersion', '+')}"
|
|
66
98
|
|
|
67
99
|
def locationMajorVersion = playServicesLocationVersion.split('\\.')[0] as int
|
|
@@ -43,6 +43,7 @@ import com.transistorsoft.locationmanager.adapter.BackgroundGeolocation;
|
|
|
43
43
|
import com.transistorsoft.locationmanager.adapter.callback.*;
|
|
44
44
|
|
|
45
45
|
import com.transistorsoft.locationmanager.data.LocationModel;
|
|
46
|
+
import com.transistorsoft.locationmanager.data.LocationQuery;
|
|
46
47
|
|
|
47
48
|
import com.transistorsoft.locationmanager.data.SQLQuery;
|
|
48
49
|
import com.transistorsoft.locationmanager.device.DeviceInfo;
|
|
@@ -489,8 +490,9 @@ public class RNBackgroundGeolocationModule
|
|
|
489
490
|
}
|
|
490
491
|
|
|
491
492
|
@ReactMethod
|
|
492
|
-
public void getLocations(final Promise response) {
|
|
493
|
-
|
|
493
|
+
public void getLocations(ReadableMap params, final Promise response) {
|
|
494
|
+
LocationQuery query = LocationQuery.fromMap(params != null ? params.toHashMap() : null);
|
|
495
|
+
getAdapter().getLocations(query, new TSGetLocationsCallback() {
|
|
494
496
|
@Override public void onSuccess(List<LocationModel> records) {
|
|
495
497
|
try {
|
|
496
498
|
JSONArray data = new JSONArray();
|
|
@@ -389,9 +389,10 @@ RCT_EXPORT_METHOD(stopWatchPosition:(NSInteger)watchId resolve:(RCTPromiseResolv
|
|
|
389
389
|
resolve(@(YES));
|
|
390
390
|
}
|
|
391
391
|
|
|
392
|
-
RCT_EXPORT_METHOD(getLocations:(RCTPromiseResolveBlock)resolve reject:(RCTPromiseRejectBlock)reject)
|
|
392
|
+
RCT_EXPORT_METHOD(getLocations:(NSDictionary*)params resolve:(RCTPromiseResolveBlock)resolve reject:(RCTPromiseRejectBlock)reject)
|
|
393
393
|
{
|
|
394
|
-
|
|
394
|
+
LocationQuery *query = [[LocationQuery alloc] initWithDictionary:params];
|
|
395
|
+
[locationManager getLocations:query success:^(NSArray* records) {
|
|
395
396
|
resolve(records);
|
|
396
397
|
} failure:^(NSString* error) {
|
|
397
398
|
reject(@"get_locations_error", error, nil);
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
|
|
3
3
|
"name": "react-native-background-geolocation",
|
|
4
|
-
"version": "5.
|
|
4
|
+
"version": "5.3.0",
|
|
5
5
|
"description": "The most sophisticated cross-platform background location-tracking & geofencing module with battery-conscious motion-detection intelligence",
|
|
6
6
|
"scripts": {
|
|
7
7
|
"build": "yarn run build:expo",
|
package/src/NativeModule.js
CHANGED
|
@@ -330,8 +330,8 @@ export default class NativeModule {
|
|
|
330
330
|
* HTTP & Persistence Methods
|
|
331
331
|
*/
|
|
332
332
|
|
|
333
|
-
static getLocations() {
|
|
334
|
-
return RNBackgroundGeolocation.getLocations();
|
|
333
|
+
static getLocations(query) {
|
|
334
|
+
return RNBackgroundGeolocation.getLocations(query || {});
|
|
335
335
|
}
|
|
336
336
|
|
|
337
337
|
static getCount() {
|
package/src/index.js
CHANGED
|
@@ -21,7 +21,7 @@ export interface Spec extends TurboModule {
|
|
|
21
21
|
setOdometer(value: number): Promise<Object>;
|
|
22
22
|
|
|
23
23
|
// HTTP & DB
|
|
24
|
-
getLocations(): Promise<Array<Object>>;
|
|
24
|
+
getLocations(query: Object): Promise<Array<Object>>;
|
|
25
25
|
getCount(): Promise<number>;
|
|
26
26
|
destroyLocations(): Promise<void>;
|
|
27
27
|
sync(): Promise<Array<Object>>;
|
|
@@ -28,7 +28,7 @@ export interface Spec extends TurboModule {
|
|
|
28
28
|
+getState: () => Promise<Object>;
|
|
29
29
|
|
|
30
30
|
// Locations / persistence
|
|
31
|
-
+getLocations: () => Promise<Array<Object>>;
|
|
31
|
+
+getLocations: (query: Object) => Promise<Array<Object>>;
|
|
32
32
|
+getCount: () => Promise<Int32>;
|
|
33
33
|
+insertLocation: (params: Object) => Promise<string>;
|
|
34
34
|
|