react-native-scanbot-barcode-scanner-sdk
Version:
Scanbot Barcode Scanner SDK React Native Plugin for Android and iOS
27 lines (26 loc) • 1.06 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.withAndroidFeature = void 0;
const config_plugins_1 = require("@expo/config-plugins");
const withAndroidFeature = (config, { androidCameraFeature }) => {
if (androidCameraFeature) {
config = (0, config_plugins_1.withAndroidManifest)(config, (manifestProps) => {
const { manifest } = manifestProps.modResults;
const featureKey = 'uses-feature';
if (!Array.isArray(manifest[featureKey])) {
manifest[featureKey] = [];
}
if (!manifest[featureKey].find((item) => item.$['android:name'] === 'android.hardware.camera')) {
manifest[featureKey].push({
$: {
'android:name': 'android.hardware.camera',
'android:required': 'true',
},
});
}
return manifestProps;
});
}
return config;
};
exports.withAndroidFeature = withAndroidFeature;