Skip to content

Commit b365272

Browse files
authored
Merge pull request #9 from melvinmt/voice
Add Speech Recognition
2 parents 3ac0ee1 + 43e2886 commit b365272

31 files changed

Lines changed: 1507 additions & 101 deletions

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ yarn-error.log*
3232
.expo/
3333
.expo-shared/
3434
dist/
35+
dist-ios/
3536
web-build/
3637
*.jks
3738
*.p8

README.md

Lines changed: 39 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,8 @@ npm install
7878

7979
#### Development Mode (Expo Go)
8080

81+
**Note**: Speech recognition features require a native build and cannot run in Expo Go. For full functionality, use native development mode (see below).
82+
8183
```bash
8284
# Start the development server
8385
npm start
@@ -91,19 +93,50 @@ Then:
9193
- Press `a` for Android Emulator
9294
- Scan QR code with Expo Go app on physical device
9395

94-
#### After Prebuild (Native Development)
96+
#### Native Development (Required for Speech Recognition)
9597

96-
If you've run `npx expo prebuild` to generate native iOS/Android projects:
98+
Speech recognition features require a native build. Follow these steps:
9799

100+
1. **Install dependencies and prebuild native code**:
98101
```bash
99-
# For iOS - this will start Metro and build/run the app
100-
npx expo run:ios
102+
# Install npm dependencies
103+
npm install
104+
105+
# Generate native iOS/Android projects
106+
# Use WITHOUT --clean to preserve existing Xcode project settings
107+
# Only use --clean if you need a completely fresh start
108+
npx expo prebuild
109+
110+
# For iOS, install CocoaPods dependencies
111+
cd ios && pod install && cd ..
112+
```
113+
114+
**Important**:
115+
- Use `npx expo prebuild` (without `--clean`) to preserve your existing Xcode project settings
116+
- Only use `npx expo prebuild --clean` when you need a completely fresh native project (this will overwrite all custom settings)
117+
- If you have custom Xcode settings, consider using [Expo config plugins](https://docs.expo.dev/guides/config-plugins/) to apply them programmatically
101118

102-
# For Android
119+
2. **Run on a physical device** (speech recognition requires a physical device):
120+
```bash
121+
# For iOS - requires physical device connected
122+
npx expo run:ios --device
123+
124+
# For Android - can use emulator or physical device
103125
npx expo run:android
104126
```
105127

106-
**Important**: After prebuild, always use `npx expo run:ios` or `npx expo run:android` rather than opening Xcode/Android Studio directly. This ensures Metro bundler is properly configured and the entry point resolves correctly.
128+
**Important Notes**:
129+
- **iOS Simulator does NOT support speech recognition** - you must use a physical iOS device
130+
- After prebuild, always use `npx expo run:ios` or `npx expo run:android` rather than opening Xcode/Android Studio directly
131+
- The app will gracefully degrade if microphone/speech permissions are denied - it will work normally without pronunciation checks
132+
133+
#### Permissions
134+
135+
The app requests the following permissions:
136+
- **Microphone**: Required for speech recognition to help children practice pronunciation
137+
- **Speech Recognition**: Required to validate pronunciation accuracy
138+
139+
Both permissions are optional - the app functions normally if permissions are denied, just without pronunciation validation features.
107140

108141
## 📁 Project Structure
109142

app.json

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,10 @@
1616
],
1717
"ios": {
1818
"supportsTablet": true,
19-
"bundleIdentifier": "com.earlyreader.app"
19+
"bundleIdentifier": "com.earlyreader.app",
20+
"infoPlist": {
21+
"ITSAppUsesNonExemptEncryption": false
22+
}
2023
},
2124
"android": {
2225
"adaptiveIcon": {
@@ -30,7 +33,14 @@
3033
},
3134
"scheme": "earlyreader",
3235
"plugins": [
33-
"expo-router"
36+
"expo-router",
37+
[
38+
"@react-native-voice/voice",
39+
{
40+
"microphonePermission": "Early Reader needs access to your microphone to help your child practice pronunciation.",
41+
"speechRecognitionPermission": "Early Reader needs speech recognition to help your child learn to read by practicing pronunciation."
42+
}
43+
]
3444
],
3545
"newArchEnabled": true
3646
}

app/children.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,3 +19,4 @@ export default ChildSelectionScreen;
1919

2020

2121

22+

app/onboarding/add-children.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,3 +19,4 @@ export default AddChildrenScreen;
1919

2020

2121

22+

assets/.gitkeep

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,3 +18,4 @@
1818

1919

2020

21+

babel.config.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,3 +26,4 @@ module.exports = function(api) {
2626

2727

2828

29+

features.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -201,3 +201,4 @@
201201

202202

203203

204+

ios/.gitignore

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
# OSX
2+
#
23
.DS_Store
34

4-
# Xcode - user-specific and build artifacts
5+
# Xcode
6+
#
57
build/
6-
DerivedData/
78
*.pbxuser
89
!default.pbxuser
910
*.mode1v3
@@ -12,19 +13,18 @@ DerivedData/
1213
!default.mode2v3
1314
*.perspectivev3
1415
!default.perspectivev3
15-
xcuserdata/
16+
xcuserdata
1617
*.xccheckout
1718
*.moved-aside
19+
DerivedData
1820
*.hmap
21+
*.ipa
1922
*.xcuserstate
23+
project.xcworkspace
2024
.xcode.env.local
2125

22-
# Keep xcworkspace but ignore user data inside it
23-
*.xcworkspace/xcuserdata/
24-
2526
# Bundle artifacts
2627
*.jsbundle
2728

28-
# CocoaPods - can be regenerated from Podfile
29+
# CocoaPods
2930
/Pods/
30-
Podfile.lock

0 commit comments

Comments
 (0)