mirror of
https://github.com/expo/config-plugins.git
synced 2026-11-13 20:28:07 -10:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f1bd9a7e27 |
No files matched your search
@@ -1,3 +1,10 @@
|
|||||||
|
### @config-plugins/react-native-blob-util [1.0.3](https://github.com/expo/config-plugins/compare/@config-plugins/[email protected]...@config-plugins/[email protected]) (2022-03-22)
|
||||||
|
|
||||||
|
|
||||||
|
### Other chores
|
||||||
|
|
||||||
|
* git ignore build folders ([#59](https://github.com/expo/config-plugins/issues/59)) ([d6050be](https://github.com/expo/config-plugins/commit/d6050beb2a5c68dc59287c27ec388c2002ec7904))
|
||||||
|
|
||||||
### @config-plugins/react-native-blob-util [1.0.2](https://github.com/expo/config-plugins/compare/@config-plugins/[email protected]...@config-plugins/[email protected]) (2022-03-16)
|
### @config-plugins/react-native-blob-util [1.0.2](https://github.com/expo/config-plugins/compare/@config-plugins/[email protected]...@config-plugins/[email protected]) (2022-03-16)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
+4
@@ -0,0 +1,4 @@
|
|||||||
|
import { AndroidConfig, ConfigPlugin } from "@expo/config-plugins";
|
||||||
|
export declare function appendDownloadCompleteAction(androidManifest: AndroidConfig.Manifest.AndroidManifest): AndroidConfig.Manifest.AndroidManifest;
|
||||||
|
declare const _default: ConfigPlugin<void>;
|
||||||
|
export default _default;
|
||||||
+59
@@ -0,0 +1,59 @@
|
|||||||
|
"use strict";
|
||||||
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
|
exports.appendDownloadCompleteAction = void 0;
|
||||||
|
const config_plugins_1 = require("@expo/config-plugins");
|
||||||
|
let pkg = {
|
||||||
|
name: "react-native-blob-util",
|
||||||
|
};
|
||||||
|
try {
|
||||||
|
pkg = require("react-native-blob-util/package.json");
|
||||||
|
}
|
||||||
|
catch (_a) {
|
||||||
|
// empty catch block
|
||||||
|
}
|
||||||
|
function appendDownloadCompleteAction(androidManifest) {
|
||||||
|
var _a, _b;
|
||||||
|
if (!Array.isArray(androidManifest.manifest.application)) {
|
||||||
|
return androidManifest;
|
||||||
|
}
|
||||||
|
for (const application of androidManifest.manifest.application) {
|
||||||
|
for (const activity of application.activity || []) {
|
||||||
|
if (((_a = activity === null || activity === void 0 ? void 0 : activity.$) === null || _a === void 0 ? void 0 : _a["android:launchMode"]) === "singleTask") {
|
||||||
|
for (const intentFilter of activity["intent-filter"] || []) {
|
||||||
|
const isLauncher = (_b = intentFilter.category) === null || _b === void 0 ? void 0 : _b.some((action) => action.$["android:name"] === "android.intent.category.LAUNCHER");
|
||||||
|
if (!isLauncher)
|
||||||
|
continue;
|
||||||
|
intentFilter.action = intentFilter.action || [];
|
||||||
|
const hasDownloadCompleteAction = intentFilter.action.some((action) => action.$["android:name"] ===
|
||||||
|
"android.intent.action.DOWNLOAD_COMPLETE");
|
||||||
|
if (!hasDownloadCompleteAction) {
|
||||||
|
intentFilter.action.push({
|
||||||
|
$: {
|
||||||
|
"android:name": "android.intent.action.DOWNLOAD_COMPLETE",
|
||||||
|
},
|
||||||
|
});
|
||||||
|
return androidManifest;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return androidManifest;
|
||||||
|
}
|
||||||
|
exports.appendDownloadCompleteAction = appendDownloadCompleteAction;
|
||||||
|
const withReactNativeBlobUtil = (config) => {
|
||||||
|
config = config_plugins_1.AndroidConfig.Permissions.withPermissions(config, [
|
||||||
|
"android.permission.READ_EXTERNAL_STORAGE",
|
||||||
|
"android.permission.WRITE_EXTERNAL_STORAGE",
|
||||||
|
"android.permission.DOWNLOAD_WITHOUT_NOTIFICATION",
|
||||||
|
// Wifi-only mode.
|
||||||
|
"android.permission.ACCESS_NETWORK_STATE",
|
||||||
|
]);
|
||||||
|
config = config_plugins_1.withAndroidManifest(config, (config) => {
|
||||||
|
config.modResults = appendDownloadCompleteAction(config.modResults);
|
||||||
|
return config;
|
||||||
|
});
|
||||||
|
return config;
|
||||||
|
};
|
||||||
|
exports.default = config_plugins_1.createRunOncePlugin(withReactNativeBlobUtil, pkg.name, pkg.version);
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@config-plugins/react-native-blob-util",
|
"name": "@config-plugins/react-native-blob-util",
|
||||||
"version": "1.0.2",
|
"version": "1.0.3",
|
||||||
"description": "Config plugin to auto configure react-native-blob-util on prebuild",
|
"description": "Config plugin to auto configure react-native-blob-util on prebuild",
|
||||||
"main": "build/withReactNativeBlobUtil.js",
|
"main": "build/withReactNativeBlobUtil.js",
|
||||||
"types": "build/withReactNativeBlobUtil.d.ts",
|
"types": "build/withReactNativeBlobUtil.d.ts",
|
||||||
|
|||||||
Reference in new issue
Block a user