react-native-background-geolocation 5.0.3 → 5.0.5
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/README.md
CHANGED
|
@@ -27,11 +27,13 @@ const findModuleRecursively = (dir) => {
|
|
|
27
27
|
}
|
|
28
28
|
return findModuleRecursively(parent);
|
|
29
29
|
};
|
|
30
|
-
const
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
}
|
|
30
|
+
const resolveModuleName = (projectRoot) => {
|
|
31
|
+
const moduleName = findModuleRecursively(path_1.default.resolve(projectRoot));
|
|
32
|
+
if (!moduleName) {
|
|
33
|
+
throw new Error(`Could not find neither '${PUBLIC_MODULE}' or '${PRIVATE_MODULE}' in node_modules from project root: ${projectRoot}`);
|
|
34
|
+
}
|
|
35
|
+
return moduleName;
|
|
36
|
+
};
|
|
35
37
|
const { addMetaDataItemToMainApplication, removeMetaDataItemFromMainApplication, getMainApplicationOrThrow } = config_plugins_1.AndroidConfig.Manifest;
|
|
36
38
|
const androidPlugin = (config, props = {}) => {
|
|
37
39
|
config = (0, config_plugins_1.withAppBuildGradle)(config, ({ modResults, ...subConfig }) => {
|
|
@@ -39,7 +41,9 @@ const androidPlugin = (config, props = {}) => {
|
|
|
39
41
|
config_plugins_1.WarningAggregator.addWarningAndroid('withBackgroundGeolocation', `Cannot automatically configure project build.gradle if it's not groovy`);
|
|
40
42
|
return { modResults, ...subConfig };
|
|
41
43
|
}
|
|
42
|
-
|
|
44
|
+
const projectRoot = config?._internal?.projectRoot ?? process.cwd();
|
|
45
|
+
const moduleName = resolveModuleName(projectRoot);
|
|
46
|
+
modResults.contents = applyAppGradle(modResults.contents, moduleName);
|
|
43
47
|
return { modResults, ...subConfig };
|
|
44
48
|
});
|
|
45
49
|
config = (0, config_plugins_1.withAndroidManifest)(config, async (config) => {
|
|
@@ -64,13 +68,13 @@ const androidPlugin = (config, props = {}) => {
|
|
|
64
68
|
});
|
|
65
69
|
return config;
|
|
66
70
|
};
|
|
67
|
-
const applyAppGradle = (buildGradle) => {
|
|
71
|
+
const applyAppGradle = (buildGradle, moduleName) => {
|
|
68
72
|
// Apply background-geolocation.gradle
|
|
69
73
|
const newSrc = [];
|
|
70
|
-
newSrc.push(`Project background_geolocation = project(':${
|
|
74
|
+
newSrc.push(`Project background_geolocation = project(':${moduleName}')`);
|
|
71
75
|
newSrc.push(`apply from: "\${background_geolocation.projectDir}/app.gradle"`);
|
|
72
76
|
buildGradle = (0, generateCode_1.mergeContents)({
|
|
73
|
-
tag: `${
|
|
77
|
+
tag: `${moduleName}-project`,
|
|
74
78
|
src: buildGradle,
|
|
75
79
|
newSrc: newSrc.join("\n"),
|
|
76
80
|
anchor: /android\s\{/,
|
|
@@ -107,11 +111,11 @@ const applyExtVars = (buildGradle: string, props:Props) => {
|
|
|
107
111
|
}).contents;
|
|
108
112
|
}
|
|
109
113
|
*/
|
|
110
|
-
const applyMavenUrl = (buildGradle) => {
|
|
114
|
+
const applyMavenUrl = (buildGradle, moduleName) => {
|
|
111
115
|
return (0, generateCode_1.mergeContents)({
|
|
112
|
-
tag: `${
|
|
116
|
+
tag: `${moduleName}-maven`,
|
|
113
117
|
src: buildGradle,
|
|
114
|
-
newSrc: `\tmaven { url "\${project(":${
|
|
118
|
+
newSrc: `\tmaven { url "\${project(":${moduleName}").projectDir}/libs" }\n\tmaven { url 'https://developer.huawei.com/repo/' }`,
|
|
115
119
|
anchor: /maven\s\{/,
|
|
116
120
|
offset: 1,
|
|
117
121
|
comment: "//",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"androidPlugin.js","sourceRoot":"","sources":["../src/androidPlugin.ts"],"names":[],"mappings":";;;;;AAAA,yDAQ8B;AAE9B,gFAGuD;AASvD,gDAAwB;AACxB,4CAAoB;AAEpB,MAAM,aAAa,GAAG,qCAAqC,CAAC;AAC5D,MAAM,cAAc,GAAG,aAAa,GAAG,UAAU,CAAC;AAElD,MAAM,gBAAgB,G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F,MAAM,cAAc,GAAG,CAAC,WAAkB,EAAE,UAAkB,EAAE,EAAE;IAChE,sCAAsC;IACtC,MAAM,MAAM,GAAG,EAAE,CAAC;IAElB,MAAM,CAAC,IAAI,CAAC,8CAA8C,UAAU,IAAI,CAAC,CAAA;IACzE,MAAM,CAAC,IAAI,CAAC,gEAAgE,CAAC,CAAA;IAE7E,WAAW,GAAG,IAAA,4BAAa,EAAC;QAC1B,GAAG,EAAE,GAAG,UAAU,UAAU;QAC5B,GAAG,EAAE,WAAW;QAChB,MAAM,EAAE,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC;QACzB,MAAM,EAAE,aAAa;QACrB,MAAM,EAAE,CAAC,CAAC;QACV,OAAO,EAAE,IAAI;KACd,CAAC,CAAC,QAAQ,CAAC;IAEZ,OAAO,WAAW,CAAC;AAErB,CAAC,CAAA;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;EA2BE;AAEF,MAAM,aAAa,GAAG,CAAC,WAAmB,EAAE,UAAkB,EAAS,EAAE;IACvE,OAAO,IAAA,4BAAa,EAAC;QACnB,GAAG,EAAE,GAAG,UAAU,QAAQ;QAC1B,GAAG,EAAE,WAAW;QAChB,MAAM,EAAE,+BAA+B,UAAU,8EAA8E;QAC/H,MAAM,EAAE,WAAW;QACnB,MAAM,EAAE,CAAC;QACT,OAAO,EAAE,IAAI;KACd,CAAC,CAAC,QAAQ,CAAC;AACd,CAAC,CAAA;AAED,kBAAe,aAAa,CAAC"}
|
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.5",
|
|
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/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";
|
|
@@ -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
|
|