-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathplugin.js
More file actions
25 lines (20 loc) · 884 Bytes
/
plugin.js
File metadata and controls
25 lines (20 loc) · 884 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
const { withAndroidManifest } = require('@expo/config-plugins');
const withExternalStoragePermission = (config) => {
return withAndroidManifest(config, async (config) => {
const androidManifest = config.modResults;
if (!androidManifest.manifest['uses-permission']) {
androidManifest.manifest['uses-permission'] = [];
}
// Add MANAGE_EXTERNAL_STORAGE permission
if (!androidManifest.manifest['uses-permission'].find(p => p.$['android:name'] === 'android.permission.MANAGE_EXTERNAL_STORAGE')) {
androidManifest.manifest['uses-permission'].push({
$: {
'android:name': 'android.permission.MANAGE_EXTERNAL_STORAGE',
// Optionally add tools:ignore="ScopedStorage" if needed but usually standard permission is enough
},
});
}
return config;
});
};
module.exports = withExternalStoragePermission;