Skip to content
This repository was archived by the owner on Jul 14, 2024. It is now read-only.

Commit 2c95e4e

Browse files
authored
docs: update (#1)
* chore: update LICENSE * chore: remove unnecessary Xcode workspace files * fix: update gitignore * refactor: drop circleci * docs: updated README docs * chore: sort package.json * revert: circleci * revert: 22889a1 * fix: change branch in ci config
1 parent f42f281 commit 2c95e4e

6 files changed

Lines changed: 187 additions & 122 deletions

File tree

.circleci/config.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,4 +58,4 @@ workflows:
5858
- type_check
5959
filters:
6060
branches:
61-
only: master
61+
only: main

.gitignore

Lines changed: 76 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,85 @@
1-
# macOS
2-
.DS_STORE
1+
# Learn more https://docs.github.com/en/get-started/getting-started-with-git/ignoring-files
32

4-
node_modules
5-
*.class
3+
# Dependencies
4+
node_modules/
5+
6+
# Testing
7+
coverage/
8+
9+
# Debug logs
10+
npm-debug.*
11+
yarn-debug.*
12+
yarn-error.*
13+
14+
# Local environment files
15+
.env
16+
.env*.local
17+
18+
# TypeScript
19+
*.tsbuildinfo
20+
21+
# Build
22+
build/
23+
dist/
24+
web-build/
25+
plugin/build
26+
27+
# Native files
28+
*.orig.*
29+
*.jks
30+
*.p8
31+
*.p12
32+
*.key
33+
*.mobileprovision
34+
35+
# Metro bundler
36+
.metro-health-check*
37+
38+
# macOS specific
39+
.DS_Store
40+
*.pem
41+
42+
# VSCODE
43+
.vscode
44+
45+
# commitizen
46+
.cz.json
47+
48+
# Xcode
49+
*.pbxuser
50+
!default.pbxuser
51+
*.mode1v3
52+
!default.mode1v3
53+
*.mode2v3
54+
!default.mode2v3
55+
*.perspectivev3
56+
!default.perspectivev3
57+
*.xccheckout
58+
*.moved-aside
59+
DerivedData
60+
*.hmap
61+
*.ipa
62+
63+
# Android/IntelliJ
664
.idea
65+
.gradle
66+
local.properties
67+
*.iml
68+
*.hprof
69+
.cxx/
70+
*.keystore
71+
!debug.keystore
772

8-
# Mobile Tools for Java (J2ME)
73+
# J2ME
974
.mtj.tmp/
1075

11-
# Package Files #
76+
# Package Files
1277
*.jar
13-
14-
build/
78+
*.class
1579
VoiceModule.iml
16-
yarn-error.log
1780

18-
dist
19-
20-
plugin/build
81+
# Bundle artifacts
82+
*.jsbundle
2183

22-
# user-specific files
23-
local.properties
84+
# CocoaPods
85+
/ios/Pods/

LICENSE

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
The MIT License (MIT)
1+
MIT License
22

3-
Copyright (c) 2018 Sam Wenke
3+
Copyright (c) 2024 Pedro Bueno
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal
@@ -18,4 +18,4 @@ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
1818
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
1919
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
2020
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21-
SOFTWARE.
21+
SOFTWARE.

README.md

Lines changed: 82 additions & 76 deletions
Original file line numberDiff line numberDiff line change
@@ -1,57 +1,75 @@
1-
![CircleCI branch][circle-ci-badge]
1+
# @pedrol2b/react-native-voice
2+
23
[![npm][npm]][npm-url]
34

4-
<h1 align="center">React Native Voice</h1>
5-
<p align="center">A speech-to-text library for <a href="https://reactnative.dev/">React Native.</a></p>
5+
> 📝 This is a fork of [react-native-voice/voice](https://github.com/react-native-voice/voice)
66
7-
<a href="https://discord.gg/CJHKVeW6sp">
8-
<img src="https://img.shields.io/discord/764994995098615828?label=Discord&logo=Discord&style=for-the-badge"
9-
alt="chat on Discord"></a>
7+
A speech-to-text library for [react native](https://reactnative.dev/).
108

11-
```sh
12-
yarn add @pedrol2b/react-native-voice
9+
## :thread: Guides
1310

14-
# or
11+
- [@pedrol2b/react-native-voice](#pedrol2breact-native-voice)
12+
- [:thread: Guides](#thread-guides)
13+
- [Getting Started](#getting-started)
14+
- [Installing the library](#installing-the-library)
15+
- [Linking the library](#linking-the-library)
16+
- [Auto link](#auto-link)
17+
- [Link manually](#link-manually)
18+
- [Prebuild Plugin](#prebuild-plugin)
19+
- [How to use](#how-to-use)
20+
- [Voice API](#voice-api)
21+
- [Static](#static)
22+
- [Events](#events)
23+
- [Permissions](#permissions)
24+
- [Contributors](#contributors)
1525

16-
npm i @pedrol2b/react-native-voice --save
17-
```
26+
### Getting Started
1827

19-
Link the iOS package
28+
#### Installing the library
2029

2130
```sh
22-
npx pod-install
31+
yarn add @pedrol2b/react-native-voice
32+
cd ios && pod install
2333
```
2434

25-
## Table of contents
35+
or
2636

27-
- [Table of contents](#table-of-contents)
28-
- [Manually Link Android](#manually-link-android)
29-
- [Manually Link iOS](#manually-link-ios)
30-
- [Props](#props)
31-
- [Example](#example)
32-
- [Example](#example-1)
33-
- [Android](#android)
34-
- [iOS](#ios)
37+
```sh
38+
npm i @pedrol2b/react-native-voice
39+
cd ios && pod install
40+
```
3541

36-
<h2 align="center">Linking</h2>
42+
#### Linking the library
3743

38-
<p align="center">Manually or automatically link the NativeModule</p>
44+
##### Auto link
3945

4046
```sh
4147
react-native link @pedrol2b/react-native-voice
4248
```
4349

44-
### Manually Link Android
50+
##### Link manually
51+
52+
:apple: **iOS**
4553

46-
- In `android/setting.gradle`
54+
How to link the library manually on iOS.
55+
56+
- Drag the `Voice.xcodeproj` from the `@pedrol2b/react-native-voice/ios` folder to the Libraries group on Xcode in your project. [Manual linking](https://reactnative.dev/docs/linking-libraries-ios.html)
57+
58+
- Click on your main project file (the one that represents the `.xcodeproj`) select Build Phases and drag the static library, `lib.Voice.a`, from the `Libraries/Voice.xcodeproj/Products` folder to Link Binary With Libraries
59+
60+
:robot: **android**
61+
62+
How to link the library manually on Android.
63+
64+
- `android/setting.gradle`
4765

4866
```gradle
4967
...
5068
include ':@react-native-voice_voice', ':app'
5169
project(':@react-native-voice_voice').projectDir = new File(rootProject.projectDir, '../node_modules/@pedrol2b/react-native-voice/android')
5270
```
5371

54-
- In `android/app/build.gradle`
72+
- `android/app/build.gradle`
5573

5674
```gradle
5775
...
@@ -61,7 +79,7 @@ dependencies {
6179
}
6280
```
6381

64-
- In `MainApplication.java`
82+
- `MainApplication.java`
6583

6684
```java
6785

@@ -84,17 +102,11 @@ public class MainActivity extends Activity implements ReactApplication {
84102
}
85103
```
86104

87-
### Manually Link iOS
88-
89-
- Drag the Voice.xcodeproj from the @pedrol2b/react-native-voice/ios folder to the Libraries group on Xcode in your poject. [Manual linking](https://reactnative.dev/docs/linking-libraries-ios.html)
90-
91-
- Click on your main project file (the one that represents the .xcodeproj) select Build Phases and drag the static library, lib.Voice.a, from the Libraries/Voice.xcodeproj/Products folder to Link Binary With Libraries
105+
##### Prebuild Plugin
92106

93-
<h2 align="center">Prebuild Plugin</h2>
107+
> :warning: This package cannot be used in the "Expo Go" app because [it requires custom native code](https://docs.expo.io/workflow/customizing/).
94108
95-
> This package cannot be used in the "Expo Go" app because [it requires custom native code](https://docs.expo.io/workflow/customizing/).
96-
97-
After installing this npm package, add the [config plugin](https://docs.expo.io/guides/config-plugins/) to the [`plugins`](https://docs.expo.io/versions/latest/config/app/#plugins) array of your `app.json` or `app.config.js`:
109+
After installing this package, add the [config plugin](https://docs.expo.io/guides/config-plugins/) to the [`plugins`](https://docs.expo.io/versions/latest/config/app/#plugins) array of your `app.json` or `app.config.js`:
98110

99111
```json
100112
{
@@ -104,16 +116,13 @@ After installing this npm package, add the [config plugin](https://docs.expo.io/
104116
}
105117
```
106118

107-
Next, rebuild your app as described in the ["Adding custom native code"](https://docs.expo.io/workflow/customizing/) guide.
108-
109-
### Props
110-
111119
The plugin provides props for extra customization. Every time you change the props or plugins, you'll need to rebuild (and `prebuild`) the native app. If no extra properties are added, defaults will be used.
112120

113121
- `speechRecognition` (_string | false_): Sets the message for the `NSSpeechRecognitionUsageDescription` key in the `Info.plist` message. When undefined, a default permission message will be used. When `false`, the permission will be skipped.
122+
114123
- `microphone` (_string | false_): Sets the message for the `NSMicrophoneUsageDescription` key in the `Info.plist`. When undefined, a default permission message will be used. When `false`, the `android.permission.RECORD_AUDIO` will not be added to the `AndroidManifest.xml` and the iOS permission will be skipped.
115124

116-
### Example
125+
Example
117126

118127
```json
119128
{
@@ -129,11 +138,11 @@ The plugin provides props for extra customization. Every time you change the pro
129138
}
130139
```
131140

132-
<h2 align="center">Usage</h2>
141+
Next, rebuild your app as described in the ["Adding custom native code"](https://docs.expo.io/workflow/customizing/) guide.
133142

134-
<p align="center"><a href="https://github.com/react-native-voice/voice/blob/master/example/src/VoiceTest.tsx">Full example for Android and iOS.</a></p>
143+
### How to use
135144

136-
### Example
145+
Example
137146

138147
```javascript
139148
import Voice from '@pedrol2b/react-native-voice';
@@ -152,9 +161,9 @@ class VoiceTest extends Component {
152161
}
153162
```
154163

155-
<h2 align="center">API</h2>
164+
### Voice API
156165

157-
<p align="center">Static access to the Voice API.</p>
166+
#### Static
158167

159168
**All methods _now_ return a `new Promise` for `async/await` compatibility.**
160169

@@ -169,9 +178,9 @@ class VoiceTest extends Component {
169178
| Voice.isRecognizing() | Return if the SpeechRecognizer is recognizing. | Android, iOS |
170179
| Voice.getSpeechRecognitionServices() | Returns a list of the speech recognition engines available on the device. (Example: `['com.google.android.googlequicksearchbox']` if Google is the only one available.) | Android |
171180

172-
<h2 align="center">Events</h2>
181+
#### Events
173182

174-
<p align="center">Callbacks that are invoked when a native event emitted.</p>
183+
Callbacks that are invoked when a native event emitted.
175184

176185
| Event Name | Description | Event | Platform |
177186
| ----------------------------------- | ------------------------------------------------------ | ----------------------------------------------- | ------------ |
@@ -183,17 +192,32 @@ class VoiceTest extends Component {
183192
| Voice.onSpeechPartialResults(event) | Invoked when any results are computed. | `{ value: [..., 'Partial speech recognized'] }` | Android, iOS |
184193
| Voice.onSpeechVolumeChanged(event) | Invoked when pitch that is recognized changed. | `{ value: pitch in dB }` | Android |
185194

186-
<h2 align="center">Permissions</h2>
195+
#### Permissions
196+
197+
:apple: **iOS**
198+
199+
Need to include permissions for `NSMicrophoneUsageDescription` and `NSSpeechRecognitionUsageDescription` inside Info.plist for iOS. See the included `VoiceTest` for how to handle these cases.
200+
201+
```xml
202+
<dict>
203+
...
204+
<key>NSMicrophoneUsageDescription</key>
205+
<string>Description of why you require the use of the microphone</string>
206+
<key>NSSpeechRecognitionUsageDescription</key>
207+
<string>Description of why you require the use of the speech recognition</string>
208+
...
209+
</dict>
210+
```
187211

188-
<p align="center">Arguably the most important part.</p>
212+
Please see the documentation provided by ReactNative for this: [PermissionsAndroid](https://reactnative.dev/docs/permissionsandroid.html)
189213

190-
### Android
214+
:robot: **android**
191215

192216
While the included `VoiceTest` app works without explicit permissions checks and requests, it may be necessary to add a permission request for `RECORD_AUDIO` for some configurations.
193217
Since Android M (6.0), [user need to grant permission at runtime (and not during app installation)](https://developer.android.com/training/permissions/requesting.html).
194218
By default, calling the `startSpeech` method will invoke `RECORD AUDIO` permission popup to the user. This can be disabled by passing `REQUEST_PERMISSIONS_AUTO: true` in the options argument.
195219

196-
If you're running an ejected expo/expokit app, you may run into issues with permissions on Android and get the following error `host.exp.exponent.MainActivity cannot be cast to com.facebook.react.ReactActivity startSpeech`. This can be resolved by prompting for permssion using the `expo-permission` package before starting recognition.
220+
If you're running an ejected expo/expokit app, you may run into issues with permissions on Android and get the following error `host.exp.exponent.MainActivity cannot be cast to com.facebook.react.ReactActivity startSpeech`. This can be resolved by prompting for permission using the `expo-permission` package before starting recognition.
197221

198222
```js
199223
import { Permissions } from "expo";
@@ -212,7 +236,7 @@ async componentDidMount() {
212236

213237
**Notes on Android**
214238

215-
Even after all the permissions are correct in Android, there is one last thing to make sure this libray is working fine on Android. Please make sure the device has Google Speech Recognizing Engine such as `com.google.android.googlequicksearchbox` by calling `Voice.getSpeechRecognitionServices()`. Since Android phones can be configured with so many options, even if a device has googlequicksearchbox engine, it could be configured to use other services. You can check which serivce is used for Voice Assistive App in following steps for most Android phones:
239+
Even after all the permissions are correct in Android, there is one last thing to make sure this library is working fine on Android. Please make sure the device has Google Speech Recognizing Engine such as `com.google.android.googlequicksearchbox` by calling `Voice.getSpeechRecognitionServices()`. Since Android phones can be configured with so many options, even if a device has googlequicksearchbox engine, it could be configured to use other services. You can check which service is used for Voice Assistive App in following steps for most Android phones:
216240

217241
`Settings > App Management > Default App > Assistive App and Voice Input > Assistive App`
218242

@@ -222,28 +246,7 @@ Above flow can vary depending on the Android models and manufactures. For Huawei
222246

223247
Please ask users to install [Google Search App](https://play.google.com/store/apps/details?id=com.google.android.googlequicksearchbox&hl=en).
224248

225-
### iOS
226-
227-
Need to include permissions for `NSMicrophoneUsageDescription` and `NSSpeechRecognitionUsageDescription` inside Info.plist for iOS. See the included `VoiceTest` for how to handle these cases.
228-
229-
```xml
230-
<dict>
231-
...
232-
<key>NSMicrophoneUsageDescription</key>
233-
<string>Description of why you require the use of the microphone</string>
234-
<key>NSSpeechRecognitionUsageDescription</key>
235-
<string>Description of why you require the use of the speech recognition</string>
236-
...
237-
</dict>
238-
```
239-
240-
Please see the documentation provided by ReactNative for this: [PermissionsAndroid](https://reactnative.dev/docs/permissionsandroid.html)
241-
242-
[npm]: https://img.shields.io/npm/v/@pedrol2b/react-native-voice.svg?style=flat-square
243-
[npm-url]: https://npmjs.com/package/@pedrol2b/react-native-voice
244-
[circle-ci-badge]: https://img.shields.io/circleci/project/github/react-native-voice/voice/master.svg?style=flat-square
245-
246-
<h2 align="center">Contributors</h2>
249+
## Contributors
247250

248251
- @asafron
249252
- @BrendanFDMoore
@@ -257,3 +260,6 @@ Please see the documentation provided by ReactNative for this: [PermissionsAndro
257260
- @rudiedev6
258261
- @tdonia
259262
- @wenkesj
263+
264+
[npm]: https://img.shields.io/npm/v/@pedrol2b/react-native-voice.svg?style=flat-square
265+
[npm-url]: https://npmjs.com/package/@pedrol2b/react-native-voice

0 commit comments

Comments
 (0)