react-native-wakeword 1.0.65 → 1.0.66
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/app.plugin.js +60 -0
- package/package.json +5 -2
package/app.plugin.js
ADDED
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
// app.plugin.js
|
|
2
|
+
const { withAndroidManifest, withProjectBuildGradle } = require('@expo/config-plugins');
|
|
3
|
+
|
|
4
|
+
function withReactNativeWakeword(config) {
|
|
5
|
+
//
|
|
6
|
+
// 1. Add necessary permissions to AndroidManifest (if needed).
|
|
7
|
+
// For example, if `react-native-wakeword` needs RECORD_AUDIO.
|
|
8
|
+
//
|
|
9
|
+
config = withAndroidManifest(config, (config) => {
|
|
10
|
+
const androidManifest = config.modResults;
|
|
11
|
+
|
|
12
|
+
// Ensure 'uses-permission' array exists
|
|
13
|
+
if (!androidManifest.manifest['uses-permission']) {
|
|
14
|
+
androidManifest.manifest['uses-permission'] = [];
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
const permissions = androidManifest.manifest['uses-permission'];
|
|
18
|
+
const hasRecordAudio = permissions.some(
|
|
19
|
+
(permission) => permission.$['android:name'] === 'android.permission.RECORD_AUDIO'
|
|
20
|
+
);
|
|
21
|
+
|
|
22
|
+
// Add RECORD_AUDIO permission if not present
|
|
23
|
+
if (!hasRecordAudio) {
|
|
24
|
+
permissions.push({ $: { 'android:name': 'android.permission.RECORD_AUDIO' } });
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
return config;
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
//
|
|
31
|
+
// 2. Insert Maven repository or other Gradle config in the project's
|
|
32
|
+
// top-level build.gradle (only if your library requires custom artifacts).
|
|
33
|
+
//
|
|
34
|
+
config = withProjectBuildGradle(config, (config) => {
|
|
35
|
+
const buildGradle = config.modResults.contents;
|
|
36
|
+
|
|
37
|
+
// This snippet references a local "libs" folder inside your library package.
|
|
38
|
+
// Adjust the path if your artifacts are elsewhere or not needed.
|
|
39
|
+
const wakewordMaven = `
|
|
40
|
+
// react-native-wakeword added
|
|
41
|
+
maven { url("$rootDir/../node_modules/react-native-wakeword/libs") }
|
|
42
|
+
// End react-native-wakeword added
|
|
43
|
+
`;
|
|
44
|
+
|
|
45
|
+
// Only add the snippet once
|
|
46
|
+
if (!buildGradle.includes('react-native-wakeword added')) {
|
|
47
|
+
config.modResults.contents = buildGradle.replace(
|
|
48
|
+
/repositories\s*{/,
|
|
49
|
+
`repositories {\n${wakewordMaven}`
|
|
50
|
+
);
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
return config;
|
|
54
|
+
});
|
|
55
|
+
|
|
56
|
+
return config;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
module.exports = withReactNativeWakeword;
|
|
60
|
+
|
package/package.json
CHANGED
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-native-wakeword",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.66",
|
|
4
4
|
"description": "Voice/Wake-word detection library for React Native",
|
|
5
5
|
"main": "wakewords/index.js",
|
|
6
6
|
"types": "wakewords/index.d.ts",
|
|
7
7
|
"expo": {
|
|
8
|
-
"plugins": [
|
|
8
|
+
"plugins": [
|
|
9
|
+
"./app.plugin.js"
|
|
10
|
+
]
|
|
9
11
|
},
|
|
10
12
|
"files": [
|
|
11
13
|
"wakewords/",
|
|
@@ -13,6 +15,7 @@
|
|
|
13
15
|
"ios/",
|
|
14
16
|
"react-native.config.js",
|
|
15
17
|
"module.modulemap",
|
|
18
|
+
"./app.plugin.js",
|
|
16
19
|
"KeyWordDetection.podspec"
|
|
17
20
|
],
|
|
18
21
|
"react-native": {
|