rns-recplay 1.2.7 → 1.2.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +2 -2
- package/withNativeRecPlay.js +43 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "rns-recplay",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.8",
|
|
4
4
|
"description": "High-performance React Native module for audio recording and audio playback on Android and iOS.",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"types": "index.d.ts",
|
|
@@ -40,7 +40,7 @@
|
|
|
40
40
|
"index.js",
|
|
41
41
|
"react-native.config.js",
|
|
42
42
|
"rns-recplay.podspec",
|
|
43
|
-
"
|
|
43
|
+
"withNativeRecPlay.js"
|
|
44
44
|
],
|
|
45
45
|
"peerDependencies": {
|
|
46
46
|
"expo": ">=45.0.0",
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
const { withInfoPlist, withAndroidManifest } = require('@expo/config-plugins');
|
|
2
|
+
|
|
3
|
+
const withIosPermissions = (config, { microphonePermission }) => {
|
|
4
|
+
return withInfoPlist(config, (config) => {
|
|
5
|
+
config.modResults.NSMicrophoneUsageDescription =
|
|
6
|
+
microphonePermission || "Allow $(PRODUCT_NAME) to access your microphone for recording audio.";
|
|
7
|
+
return config;
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
const withAndroidPermissions = (config) => {
|
|
12
|
+
return withAndroidManifest(config, (config) => {
|
|
13
|
+
const manifest = config.modResults.manifest;
|
|
14
|
+
const permissionsToAdd = [
|
|
15
|
+
'android.permission.RECORD_AUDIO',
|
|
16
|
+
'android.permission.MODIFY_AUDIO_SETTINGS',
|
|
17
|
+
];
|
|
18
|
+
|
|
19
|
+
if (!manifest['uses-permission']) {
|
|
20
|
+
manifest['uses-permission'] = [];
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
permissionsToAdd.forEach(perm => {
|
|
24
|
+
// CHECK: Only push if it's not already there
|
|
25
|
+
const exists = manifest['uses-permission'].some(
|
|
26
|
+
p => p.$['android:name'] === perm
|
|
27
|
+
);
|
|
28
|
+
if (!exists) {
|
|
29
|
+
manifest['uses-permission'].push({
|
|
30
|
+
'$': { 'android:name': perm }
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
return config;
|
|
36
|
+
});
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
module.exports = (config, props) => {
|
|
40
|
+
config = withIosPermissions(config, props);
|
|
41
|
+
config = withAndroidPermissions(config);
|
|
42
|
+
return config;
|
|
43
|
+
};
|