Skip to content

Commit

Permalink
Merge branch 'expo-plugin-licensing'
Browse files Browse the repository at this point in the history
  • Loading branch information
christocracy committed Sep 5, 2024
2 parents 8f29620 + 5c0da4a commit 9b11cf3
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 7 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# Change Log

## 4.17.1 — 2024-09-05
* [Expo] Fix bug in Expo plugin adding unused license keys for "polygon geofencing" with a value of `UNDEFINED`, causing license-validation error. Add logic to automatically remove license keys from `AndroidManifest` when corresponding keys are not found in your `app.json` (eg: `polygonLicense`).

## 4.17.0 — 2024-09-04
* [iOS] Fix bug in iOS *Polygon Geofencing* when running in geofences-only mode (`.startGeofences`). iOS would mistakenly turn off location updates exactly 3 samples into the containing circular geofence of a polygon.
* Implement `notifyOnDwell` for polygon-geofences.
Expand Down
31 changes: 25 additions & 6 deletions expo/plugin/src/androidPlugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,12 @@ if (!MODULE_NAME) {
process.exit(1);
}

const { addMetaDataItemToMainApplication, getMainApplicationOrThrow } = AndroidConfig.Manifest;
const {
addMetaDataItemToMainApplication,
removeMetaDataItemFromMainApplication,
getMainApplicationOrThrow
} = AndroidConfig.Manifest;


const androidPlugin: ConfigPlugin<Props> = (config, props={}) => {
config = withProjectBuildGradle(config, ({ modResults, ...subConfig }) => {
Expand Down Expand Up @@ -86,24 +91,38 @@ const androidPlugin: ConfigPlugin<Props> = (config, props={}) => {

config = withAndroidManifest(config, async (config) => {

console.log("[react-native-background-geolocation] Adding license-keys to AndroidManifest:", props);

const mainApplication = getMainApplicationOrThrow(config.modResults);

addMetaDataItemToMainApplication(
mainApplication,
META_LICENSE_KEY,
props.license || "UNDEFINED"
);
addMetaDataItemToMainApplication(
mainApplication,
META_HMS_LICENSE_KEY,
props.hmsLicense || "UNDEFINED"
);
if (props.hmsLicense) {
addMetaDataItemToMainApplication(
mainApplication,
META_HMS_LICENSE_KEY,
props.hmsLicense
);
} else {
removeMetaDataItemFromMainApplication(
mainApplication,
META_HMS_LICENSE_KEY
);
}
if (props.polygonLicense) {
addMetaDataItemToMainApplication(
mainApplication,
META_POLYGON_LICENSE_KEY,
props.polygonLicense
);
} else {
removeMetaDataItemFromMainApplication(
mainApplication,
META_POLYGON_LICENSE_KEY
);
}
return config;

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "react-native-background-geolocation",
"version": "4.17.0",
"version": "4.17.1",
"description": "The most sophisticated cross-platform background location-tracking & geofencing module with battery-conscious motion-detection intelligence",
"scripts": {
"build": "yarn run build:expo",
Expand Down

0 comments on commit 9b11cf3

Please sign in to comment.