30 lines
796 B
JavaScript
30 lines
796 B
JavaScript
const { withAndroidManifest } = require('@expo/config-plugins');
|
|
|
|
const withUsbCamera = (config) => {
|
|
return withAndroidManifest(config, async (config) => {
|
|
const androidManifest = config.modResults;
|
|
|
|
if (!androidManifest.manifest['uses-feature']) {
|
|
androidManifest.manifest['uses-feature'] = [];
|
|
}
|
|
|
|
// Check if usb.host feature is already added
|
|
const featureExists = androidManifest.manifest['uses-feature'].some(
|
|
(f) => f.$['android:name'] === 'android.hardware.usb.host'
|
|
);
|
|
|
|
if (!featureExists) {
|
|
androidManifest.manifest['uses-feature'].push({
|
|
$: {
|
|
'android:name': 'android.hardware.usb.host',
|
|
'android:required': 'false',
|
|
},
|
|
});
|
|
}
|
|
|
|
return config;
|
|
});
|
|
};
|
|
|
|
module.exports = withUsbCamera;
|