Files
lnreader/plugins/withAndroidCustomizations.js
T
Patrick Loser c3c891cea0 refactor: Migrate to Expo Managed Workflow (#1885)
* enable predictive back gesture

* upgrade to rn 85

* remove deprecated

* added timeout to theme switch

* fix plugin items hit registration

* fix SearchbarV2 hit registration

* fix loading spinner

* migrated to expo

* migrated to expo

* Fix reader footer animation

* working again

* added icons back

* added splashscreen

* clean up

* nitro epub

* fix

* remove .env.local from git tracking

* fix rn background actions not working

* moving custom permissions to app.json

* more cleanup

* fix epub import

* remove unused deps

* Further cleanup for gradle build types

* Update build.yml

* ignore android/ and ios/ as they are generated by CNG

* fix lint

* Delete ios directory

* Delete android directory

* fix lint

* fix test mocks

* update packages

* update eslint

* fix ThemeProvider placement

* fix test and lint

* Add BackgroundTask native module

* Add NativeFile changes

* first round of fixing compatibility issues

* added types for native modules
2026-07-22 23:29:53 +05:30

69 lines
1.6 KiB
JavaScript

const {
AndroidConfig,
withAndroidManifest,
withAppBuildGradle,
} = require("@expo/config-plugins");
const BUILD_TYPES_MARKER =
"// @generated by with-android-customizations";
const BUILD_TYPES_APPLY = `${BUILD_TYPES_MARKER}
apply from: new File(
rootDir,
"../gradle/android-build-types.gradle",
)
`;
const withManifestCustomizations = config =>
withAndroidManifest(config, config => {
const manifest = config.modResults;
const app = AndroidConfig.Manifest.getMainApplicationOrThrow(manifest);
const serviceName =
"com.asterinet.react.bgactions.RNBackgroundActionsTask";
const services = app.service ?? [];
let service = services.find(
service => service.$?.["android:name"] === serviceName,
);
if (!service) {
service = {
$: {
"android:name": serviceName,
},
};
services.push(service);
app.service = services;
}
service.$ ??= {};
service.$["android:foregroundServiceType"] = "dataSync";
service.$["tools:replace"] = "android:foregroundServiceType";
return config;
});
const withBuildGradleCustomizations = config =>
withAppBuildGradle(config, config => {
const { contents } = config.modResults;
if (!contents.includes(BUILD_TYPES_MARKER)) {
config.modResults.contents = `${contents.trimEnd()}
${BUILD_TYPES_APPLY}`;
}
return config;
});
const withAndroidCustomizations = config => {
config = withManifestCustomizations(config);
config = withBuildGradleCustomizations(config);
return config;
};
module.exports = withAndroidCustomizations;