react-native-background-geolocation 4.19.1 → 4.19.2
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/expo/plugin/build/androidPlugin.d.ts +8 -0
- package/expo/plugin/build/androidPlugin.js +127 -0
- package/expo/plugin/build/androidPlugin.js.map +1 -0
- package/expo/plugin/build/iOSPlugin.d.ts +4 -0
- package/expo/plugin/build/iOSPlugin.js +10 -0
- package/expo/plugin/build/iOSPlugin.js.map +1 -0
- package/expo/plugin/build/index.d.ts +16 -0
- package/expo/plugin/build/index.js +23 -0
- package/expo/plugin/build/index.js.map +1 -0
- package/package.json +3 -2
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const config_plugins_1 = require("@expo/config-plugins");
|
|
7
|
+
const generateCode_1 = require("@expo/config-plugins/build/utils/generateCode");
|
|
8
|
+
const path_1 = __importDefault(require("path"));
|
|
9
|
+
const fs_1 = __importDefault(require("fs"));
|
|
10
|
+
const PUBLIC_MODULE = 'react-native-background-geolocation';
|
|
11
|
+
const PRIVATE_MODULE = PUBLIC_MODULE + '-android';
|
|
12
|
+
const META_LICENSE_KEY = "com.transistorsoft.locationmanager.license";
|
|
13
|
+
const META_HMS_LICENSE_KEY = "com.transistorsoft.locationmanager.hms.license";
|
|
14
|
+
const META_POLYGON_LICENSE_KEY = "com.transistorsoft.locationmanager.polygon.license";
|
|
15
|
+
const findModuleRecursively = (dir) => {
|
|
16
|
+
const nodeModules = path_1.default.resolve(dir, 'node_modules');
|
|
17
|
+
if (fs_1.default.existsSync(path_1.default.join(nodeModules, PUBLIC_MODULE))) {
|
|
18
|
+
return PUBLIC_MODULE;
|
|
19
|
+
}
|
|
20
|
+
if (fs_1.default.existsSync(path_1.default.join(nodeModules, PRIVATE_MODULE))) {
|
|
21
|
+
return PRIVATE_MODULE;
|
|
22
|
+
}
|
|
23
|
+
const parent = path_1.default.resolve(dir, '..');
|
|
24
|
+
if (parent === dir) {
|
|
25
|
+
// we have reached the root of the file system -> not found
|
|
26
|
+
return null;
|
|
27
|
+
}
|
|
28
|
+
return findModuleRecursively(parent);
|
|
29
|
+
};
|
|
30
|
+
const MODULE_NAME = findModuleRecursively(path_1.default.resolve('.'));
|
|
31
|
+
if (!MODULE_NAME) {
|
|
32
|
+
console.error(`Could not find neither '${PUBLIC_MODULE}' or '${PRIVATE_MODULE}' in node_modules`);
|
|
33
|
+
process.exit(1);
|
|
34
|
+
}
|
|
35
|
+
const { addMetaDataItemToMainApplication, removeMetaDataItemFromMainApplication, getMainApplicationOrThrow } = config_plugins_1.AndroidConfig.Manifest;
|
|
36
|
+
const androidPlugin = (config, props = {}) => {
|
|
37
|
+
config = (0, config_plugins_1.withProjectBuildGradle)(config, ({ modResults, ...subConfig }) => {
|
|
38
|
+
if (modResults.language !== 'groovy') {
|
|
39
|
+
config_plugins_1.WarningAggregator.addWarningAndroid('withBackgroundGeolocation', `Cannot automatically configure project build.gradle if it's not groovy`);
|
|
40
|
+
return { modResults, ...subConfig };
|
|
41
|
+
}
|
|
42
|
+
modResults.contents = applyMavenUrl(modResults.contents);
|
|
43
|
+
return { modResults, ...subConfig };
|
|
44
|
+
});
|
|
45
|
+
config = (0, config_plugins_1.withAppBuildGradle)(config, ({ modResults, ...subConfig }) => {
|
|
46
|
+
if (modResults.language !== 'groovy') {
|
|
47
|
+
config_plugins_1.WarningAggregator.addWarningAndroid('withBackgroundGeolocation', `Cannot automatically configure project build.gradle if it's not groovy`);
|
|
48
|
+
return { modResults, ...subConfig };
|
|
49
|
+
}
|
|
50
|
+
modResults.contents = applyAppGradle(modResults.contents);
|
|
51
|
+
return { modResults, ...subConfig };
|
|
52
|
+
});
|
|
53
|
+
config = (0, config_plugins_1.withAndroidManifest)(config, async (config) => {
|
|
54
|
+
console.log("[react-native-background-geolocation] Adding license-keys to AndroidManifest:", props);
|
|
55
|
+
const mainApplication = getMainApplicationOrThrow(config.modResults);
|
|
56
|
+
addMetaDataItemToMainApplication(mainApplication, META_LICENSE_KEY, props.license || "UNDEFINED");
|
|
57
|
+
if (props.hmsLicense) {
|
|
58
|
+
addMetaDataItemToMainApplication(mainApplication, META_HMS_LICENSE_KEY, props.hmsLicense);
|
|
59
|
+
}
|
|
60
|
+
else {
|
|
61
|
+
removeMetaDataItemFromMainApplication(mainApplication, META_HMS_LICENSE_KEY);
|
|
62
|
+
}
|
|
63
|
+
if (props.polygonLicense) {
|
|
64
|
+
addMetaDataItemToMainApplication(mainApplication, META_POLYGON_LICENSE_KEY, props.polygonLicense);
|
|
65
|
+
}
|
|
66
|
+
else {
|
|
67
|
+
removeMetaDataItemFromMainApplication(mainApplication, META_POLYGON_LICENSE_KEY);
|
|
68
|
+
}
|
|
69
|
+
return config;
|
|
70
|
+
});
|
|
71
|
+
return config;
|
|
72
|
+
};
|
|
73
|
+
const applyAppGradle = (buildGradle) => {
|
|
74
|
+
// Apply background-geolocation.gradle
|
|
75
|
+
const newSrc = [];
|
|
76
|
+
newSrc.push(`Project background_geolocation = project(':${MODULE_NAME}')`);
|
|
77
|
+
newSrc.push(`apply from: "\${background_geolocation.projectDir}/app.gradle"`);
|
|
78
|
+
buildGradle = (0, generateCode_1.mergeContents)({
|
|
79
|
+
tag: `${MODULE_NAME}-project`,
|
|
80
|
+
src: buildGradle,
|
|
81
|
+
newSrc: newSrc.join("\n"),
|
|
82
|
+
anchor: /android\s\{/,
|
|
83
|
+
offset: -1,
|
|
84
|
+
comment: "//",
|
|
85
|
+
}).contents;
|
|
86
|
+
return buildGradle;
|
|
87
|
+
};
|
|
88
|
+
/**
|
|
89
|
+
* DISABLED in favour of gradle.properties
|
|
90
|
+
*
|
|
91
|
+
const applyExtVars = (buildGradle: string, props:Props) => {
|
|
92
|
+
|
|
93
|
+
const newSrc = [];
|
|
94
|
+
|
|
95
|
+
const ext = props.ext;
|
|
96
|
+
if (ext) {
|
|
97
|
+
for (let [key, value] of ext) {
|
|
98
|
+
if (typeof(value) === 'boolean') {
|
|
99
|
+
newSrc.push(`\t${key} = ${value}`)
|
|
100
|
+
} else {
|
|
101
|
+
newSrc.push(`\t${key} = "${value}"`)
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
return mergeContents({
|
|
107
|
+
tag: `${MODULE_NAME}-ext`,
|
|
108
|
+
src: buildGradle,
|
|
109
|
+
newSrc: newSrc.join("\n"),
|
|
110
|
+
anchor: /ext(?:\s+)?\{/,
|
|
111
|
+
offset: 1,
|
|
112
|
+
comment: "//",
|
|
113
|
+
}).contents;
|
|
114
|
+
}
|
|
115
|
+
*/
|
|
116
|
+
const applyMavenUrl = (buildGradle) => {
|
|
117
|
+
return (0, generateCode_1.mergeContents)({
|
|
118
|
+
tag: `${MODULE_NAME}-maven`,
|
|
119
|
+
src: buildGradle,
|
|
120
|
+
newSrc: `\tmaven { url "\${project(":${MODULE_NAME}").projectDir}/libs" }\n\tmaven { url 'https://developer.huawei.com/repo/' }`,
|
|
121
|
+
anchor: /maven\s\{/,
|
|
122
|
+
offset: 1,
|
|
123
|
+
comment: "//",
|
|
124
|
+
}).contents;
|
|
125
|
+
};
|
|
126
|
+
exports.default = androidPlugin;
|
|
127
|
+
//# sourceMappingURL=androidPlugin.js.map
|
|
@@ -0,0 +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,GAAG,4CAA4C,CAAC;AACtE,MAAM,oBAAoB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
|
+
exports.withBackgroundGeolocationPluginIos = void 0;
|
|
4
|
+
const withBackgroundGeolocationPluginIos = (config, props = {}) => {
|
|
5
|
+
// Nothing to here here currently, but left for future considerations.
|
|
6
|
+
return config;
|
|
7
|
+
};
|
|
8
|
+
exports.withBackgroundGeolocationPluginIos = withBackgroundGeolocationPluginIos;
|
|
9
|
+
exports.default = exports.withBackgroundGeolocationPluginIos;
|
|
10
|
+
//# sourceMappingURL=iOSPlugin.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"iOSPlugin.js","sourceRoot":"","sources":["../src/iOSPlugin.ts"],"names":[],"mappings":";;;AAQO,MAAM,kCAAkC,GAAwB,CAAC,MAAM,EAAE,KAAK,GAAC,EAAE,EAAE,EAAE;IAC1F,sEAAsE;IACtE,OAAO,MAAM,CAAC;AAChB,CAAC,CAAC;AAHW,QAAA,kCAAkC,sCAG7C;AAEF,kBAAe,0CAAkC,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { ConfigPlugin } from '@expo/config-plugins';
|
|
2
|
+
declare const withBackgroundGeolocation: ConfigPlugin<{
|
|
3
|
+
/**
|
|
4
|
+
* Android license Default ""
|
|
5
|
+
*/
|
|
6
|
+
license?: string;
|
|
7
|
+
/**
|
|
8
|
+
* Huawei HMS license Default ""
|
|
9
|
+
*/
|
|
10
|
+
hmsLicense?: string;
|
|
11
|
+
/**
|
|
12
|
+
* Polygon Geofencing License Default ""
|
|
13
|
+
*/
|
|
14
|
+
polygonLicense?: string;
|
|
15
|
+
} | void>;
|
|
16
|
+
export default withBackgroundGeolocation;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const config_plugins_1 = require("@expo/config-plugins");
|
|
7
|
+
const androidPlugin_1 = __importDefault(require("./androidPlugin"));
|
|
8
|
+
const iOSPlugin_1 = __importDefault(require("./iOSPlugin"));
|
|
9
|
+
const withBackgroundGeolocation = (config, _props) => {
|
|
10
|
+
const props = _props || {};
|
|
11
|
+
return (0, config_plugins_1.withPlugins)(config, [
|
|
12
|
+
[androidPlugin_1.default, {
|
|
13
|
+
license: props.license,
|
|
14
|
+
hmsLicense: props.hmsLicense,
|
|
15
|
+
polygonLicense: props.polygonLicense
|
|
16
|
+
}],
|
|
17
|
+
[iOSPlugin_1.default, {
|
|
18
|
+
// no props for ios currently.
|
|
19
|
+
}]
|
|
20
|
+
]);
|
|
21
|
+
};
|
|
22
|
+
exports.default = withBackgroundGeolocation;
|
|
23
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;AAAA,yDAAiE;AAEjE,oEAA4C;AAC5C,4DAAoC;AAEpC,MAAM,yBAAyB,GAgB3B,CAAC,MAAM,EAAE,MAAM,EAAE,EAAE;IACrB,MAAM,KAAK,GAAG,MAAM,IAAI,EAAE,CAAC;IAE3B,OAAO,IAAA,4BAAW,EAAC,MAAM,EAAE;QACzB,CAAC,uBAAa,EAAE;gBACd,OAAO,EAAE,KAAK,CAAC,OAAO;gBACtB,UAAU,EAAE,KAAK,CAAC,UAAU;gBAC5B,cAAc,EAAE,KAAK,CAAC,cAAc;aACrC,CAAC;QACF,CAAC,mBAAS,EAAE;YACV,8BAA8B;aAC/B,CAAC;KACH,CAAC,CAAC;AACL,CAAC,CAAC;AAEF,kBAAe,yBAAyB,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-native-background-geolocation",
|
|
3
|
-
"version": "4.19.
|
|
3
|
+
"version": "4.19.2",
|
|
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": "yarn run build:expo",
|
|
7
7
|
"test": "echo \"Error: no test specified\" && exit 1",
|
|
8
|
-
"build:expo": "rimraf expo/plugin/build && tsc --build ./expo/plugin"
|
|
8
|
+
"build:expo": "rimraf expo/plugin/build && tsc --build ./expo/plugin",
|
|
9
|
+
"prepublishOnly": "npm run build"
|
|
9
10
|
},
|
|
10
11
|
"main": "src/index.js",
|
|
11
12
|
"repository": {
|