react-native-background-geolocation 5.0.2 → 5.0.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/.vscode/settings.json +3 -0
- package/README.md +1 -1
- package/package.json +1 -1
- package/src/DeviceSettings.js +2 -4
- package/src/Logger.js +6 -18
- package/src/NativeModule.js +14 -12
- package/src/TransistorAuthorizationService.js +2 -4
- package/src/native/specs/NativeBackgroundGeolocation.ts +4 -4
- package/android/.settings/org.eclipse.buildship.core.prefs +0 -13
package/README.md
CHANGED
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
|
|
3
3
|
"name": "react-native-background-geolocation",
|
|
4
|
-
"version": "5.0.
|
|
4
|
+
"version": "5.0.4",
|
|
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/DeviceSettings.js
CHANGED
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
const { RNBackgroundGeolocation } = NativeModules;
|
|
3
|
+
import { RNBackgroundGeolocation } from "./NativeModule";
|
|
6
4
|
|
|
7
5
|
const IGNORE_BATTERY_OPTIMIZATIONS = "IGNORE_BATTERY_OPTIMIZATIONS";
|
|
8
6
|
const POWER_MANAGER = "POWER_MANAGER";
|
|
@@ -30,6 +28,6 @@ export default class DeviceSettings {
|
|
|
30
28
|
}
|
|
31
29
|
|
|
32
30
|
show(request) {
|
|
33
|
-
return RNBackgroundGeolocation.showSettings(
|
|
31
|
+
return RNBackgroundGeolocation.showSettings(request);
|
|
34
32
|
}
|
|
35
33
|
}
|
package/src/Logger.js
CHANGED
|
@@ -13,19 +13,7 @@ const ORDER_ASC = 1;
|
|
|
13
13
|
const ORDER_DESC = -1;
|
|
14
14
|
|
|
15
15
|
function log(level, msg) {
|
|
16
|
-
|
|
17
|
-
// fallback to debug if missing.
|
|
18
|
-
if (
|
|
19
|
-
NativeModule.logger &&
|
|
20
|
-
typeof NativeModule.logger[level] === 'function'
|
|
21
|
-
) {
|
|
22
|
-
NativeModule.logger[level](msg);
|
|
23
|
-
} else if (
|
|
24
|
-
NativeModule.logger &&
|
|
25
|
-
typeof NativeModule.logger.debug === 'function'
|
|
26
|
-
) {
|
|
27
|
-
NativeModule.logger.debug(msg);
|
|
28
|
-
}
|
|
16
|
+
return NativeModule.log(level, msg);
|
|
29
17
|
}
|
|
30
18
|
|
|
31
19
|
function validateQuery(query) {
|
|
@@ -43,11 +31,11 @@ export default class Logger {
|
|
|
43
31
|
static get ORDER_ASC() { return ORDER_ASC; }
|
|
44
32
|
static get ORDER_DESC() { return ORDER_DESC; }
|
|
45
33
|
|
|
46
|
-
static debug(msg) { log(LOG_LEVEL_DEBUG, msg); }
|
|
47
|
-
static error(msg) { log(LOG_LEVEL_ERROR, msg); }
|
|
48
|
-
static warn(msg) { log(LOG_LEVEL_WARN, msg); }
|
|
49
|
-
static info(msg) { log(LOG_LEVEL_INFO, msg); }
|
|
50
|
-
static notice(msg) { log(LOG_LEVEL_NOTICE, msg); }
|
|
34
|
+
static debug(msg) { return log(LOG_LEVEL_DEBUG, msg); }
|
|
35
|
+
static error(msg) { return log(LOG_LEVEL_ERROR, msg); }
|
|
36
|
+
static warn(msg) { return log(LOG_LEVEL_WARN, msg); }
|
|
37
|
+
static info(msg) { return log(LOG_LEVEL_INFO, msg); }
|
|
38
|
+
static notice(msg) { return log(LOG_LEVEL_NOTICE, msg); }
|
|
51
39
|
|
|
52
40
|
static getLog(query) {
|
|
53
41
|
return NativeModule.getLog(validateQuery(query));
|
package/src/NativeModule.js
CHANGED
|
@@ -35,11 +35,10 @@ function getNativeBGGeo() {
|
|
|
35
35
|
);
|
|
36
36
|
}
|
|
37
37
|
|
|
38
|
-
const RNBackgroundGeolocation = getNativeBGGeo();
|
|
38
|
+
export const RNBackgroundGeolocation = getNativeBGGeo();
|
|
39
39
|
|
|
40
40
|
const EventEmitter = new NativeEventEmitter(RNBackgroundGeolocation);
|
|
41
41
|
|
|
42
|
-
|
|
43
42
|
import TransistorAuthorizationService from "./TransistorAuthorizationService";
|
|
44
43
|
|
|
45
44
|
const TAG = "TSLocationManager";
|
|
@@ -51,31 +50,31 @@ const PLATFORM_IOS = "ios";
|
|
|
51
50
|
*/
|
|
52
51
|
const LOGGER = {
|
|
53
52
|
error: function(msg) {
|
|
54
|
-
RNBackgroundGeolocation.log('error', msg);
|
|
53
|
+
return RNBackgroundGeolocation.log('error', msg);
|
|
55
54
|
},
|
|
56
55
|
warn: function(msg) {
|
|
57
|
-
RNBackgroundGeolocation.log('warn', msg);
|
|
56
|
+
return RNBackgroundGeolocation.log('warn', msg);
|
|
58
57
|
},
|
|
59
58
|
debug: function(msg) {
|
|
60
|
-
RNBackgroundGeolocation.log('debug', msg);
|
|
59
|
+
return RNBackgroundGeolocation.log('debug', msg);
|
|
61
60
|
},
|
|
62
61
|
info: function(msg) {
|
|
63
|
-
RNBackgroundGeolocation.log('info', msg);
|
|
62
|
+
return RNBackgroundGeolocation.log('info', msg);
|
|
64
63
|
},
|
|
65
64
|
notice: function(msg) {
|
|
66
|
-
RNBackgroundGeolocation.log('notice', msg);
|
|
65
|
+
return RNBackgroundGeolocation.log('notice', msg);
|
|
67
66
|
},
|
|
68
67
|
header: function(msg) {
|
|
69
|
-
RNBackgroundGeolocation.log('header', msg);
|
|
68
|
+
return RNBackgroundGeolocation.log('header', msg);
|
|
70
69
|
},
|
|
71
70
|
on: function(msg) {
|
|
72
|
-
RNBackgroundGeolocation.log('on', msg);
|
|
71
|
+
return RNBackgroundGeolocation.log('on', msg);
|
|
73
72
|
},
|
|
74
73
|
off: function(msg) {
|
|
75
|
-
RNBackgroundGeolocation.log('off', msg);
|
|
74
|
+
return RNBackgroundGeolocation.log('off', msg);
|
|
76
75
|
},
|
|
77
76
|
ok: function(msg) {
|
|
78
|
-
RNBackgroundGeolocation.log('ok', msg);
|
|
77
|
+
return RNBackgroundGeolocation.log('ok', msg);
|
|
79
78
|
}
|
|
80
79
|
}
|
|
81
80
|
|
|
@@ -300,7 +299,6 @@ export default class NativeModule {
|
|
|
300
299
|
let watchId;
|
|
301
300
|
try {
|
|
302
301
|
watchId = await RNBackgroundGeolocation.watchPosition(options);
|
|
303
|
-
console.log("********** watchPositonId: ", watchId)
|
|
304
302
|
// Resolve with our wrapped Subscription instance.
|
|
305
303
|
resolve({
|
|
306
304
|
id: watchId,
|
|
@@ -391,6 +389,10 @@ export default class NativeModule {
|
|
|
391
389
|
* Logging & Debug Methods
|
|
392
390
|
*/
|
|
393
391
|
|
|
392
|
+
static log(level, message) {
|
|
393
|
+
return RNBackgroundGeolocation.log(level, message);
|
|
394
|
+
}
|
|
395
|
+
|
|
394
396
|
static setLogLevel(value) {
|
|
395
397
|
return RNBackgroundGeolocation.setLogLevel(value);
|
|
396
398
|
}
|
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
import { NativeModules } from "react-native"
|
|
4
|
-
|
|
5
3
|
const DEFAULT_URL = 'https://tracker.transistorsoft.com';
|
|
6
4
|
|
|
7
5
|
const DUMMY_TOKEN = 'DUMMY_TOKEN';
|
|
@@ -14,7 +12,7 @@ const LOCATIONS_PATH = '/api/locations';
|
|
|
14
12
|
|
|
15
13
|
const REFRESH_TOKEN_PATH = '/api/refresh_token';
|
|
16
14
|
|
|
17
|
-
|
|
15
|
+
import { RNBackgroundGeolocation } from "./NativeModule";
|
|
18
16
|
|
|
19
17
|
export default class TransistorAuthorizationService {
|
|
20
18
|
static findOrCreate(orgname, username, url=DEFAULT_URL) {
|
|
@@ -40,7 +38,7 @@ export default class TransistorAuthorizationService {
|
|
|
40
38
|
});
|
|
41
39
|
}
|
|
42
40
|
|
|
43
|
-
static destroy(url=DEFAULT_URL) {
|
|
41
|
+
static destroy(url=DEFAULT_URL) {
|
|
44
42
|
return RNBackgroundGeolocation.destroyTransistorToken(url);
|
|
45
43
|
}
|
|
46
44
|
|
|
@@ -43,11 +43,11 @@ export interface Spec extends TurboModule {
|
|
|
43
43
|
destroyTransistorToken(url: string): Promise<void>;
|
|
44
44
|
|
|
45
45
|
// Logging
|
|
46
|
-
log(level: string, message: string): Promise<
|
|
46
|
+
log(level: string, message: string): Promise<boolean>;
|
|
47
47
|
getLog(query: Object): Promise<string>;
|
|
48
|
-
emailLog(email: string, query: Object): Promise<
|
|
49
|
-
uploadLog(url: string, query: Object): Promise<
|
|
50
|
-
destroyLog(): Promise<
|
|
48
|
+
emailLog(email: string, query: Object): Promise<boolean>;
|
|
49
|
+
uploadLog(url: string, query: Object): Promise<boolean>;
|
|
50
|
+
destroyLog(): Promise<boolean>;
|
|
51
51
|
}
|
|
52
52
|
|
|
53
53
|
export default TurboModuleRegistry.getEnforcing<Spec>('RNBackgroundGeolocation');
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
arguments=--init-script /var/folders/qk/r2r49k7527b6r81484vtk0g40000gn/T/db3b08fc4a9ef609cb16b96b200fa13e563f396e9bb1ed0905fdab7bc3bc513b.gradle --init-script /var/folders/qk/r2r49k7527b6r81484vtk0g40000gn/T/52cde0cfcf3e28b8b7510e992210d9614505e0911af0c190bd590d7158574963.gradle
|
|
2
|
-
auto.sync=false
|
|
3
|
-
build.scans.enabled=false
|
|
4
|
-
connection.gradle.distribution=GRADLE_DISTRIBUTION(VERSION(8.9))
|
|
5
|
-
connection.project.dir=
|
|
6
|
-
eclipse.preferences.version=1
|
|
7
|
-
gradle.user.home=
|
|
8
|
-
java.home=/opt/homebrew/Cellar/openjdk@17/17.0.15/libexec/openjdk.jdk/Contents/Home
|
|
9
|
-
jvm.arguments=
|
|
10
|
-
offline.mode=false
|
|
11
|
-
override.workspace.settings=true
|
|
12
|
-
show.console.view=true
|
|
13
|
-
show.executions.view=true
|