Skip to content

Commit

Permalink
fix: un-comment log statements for test
Browse files Browse the repository at this point in the history
  • Loading branch information
daheeahn committed Jun 17, 2024
1 parent a3eb96c commit 8896c9d
Showing 1 changed file with 11 additions and 10 deletions.
21 changes: 11 additions & 10 deletions android/src/main/java/expo/modules/stt/ExpoSttModule.kt
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ class ExpoSttModule : Module(), RecognitionListener {
override fun definition() = ModuleDefinition {
Name(TAG)

Events(onSpeechStart, onSpeechResult, onPartialResults, onSpeechEnd, onSpeechError)

AsyncFunction("requestRecognitionPermission") {
requestRecognitionPermission()
}
Expand Down Expand Up @@ -84,7 +86,7 @@ class ExpoSttModule : Module(), RecognitionListener {
speech?.stopListening()
}
isRecognizing = false
// Log.d(TAG, "Stop Voice Recognizer")
Log.d(TAG, "Stop Voice Recognizer")

return@Function null as Any
}
Expand All @@ -94,12 +96,11 @@ class ExpoSttModule : Module(), RecognitionListener {
speech?.destroy()
}
isRecognizing = false
// Log.d(TAG, "Destroy Voice Recognizer")
Log.d(TAG, "Destroy Voice Recognizer")

return@Function null as Any
}

Events(onSpeechStart, onSpeechResult, onPartialResults, onSpeechEnd, onSpeechError)
}

private fun requestRecognitionPermission() {
Expand All @@ -126,20 +127,20 @@ class ExpoSttModule : Module(), RecognitionListener {
}

override fun onReadyForSpeech(params: Bundle?) {
// Log.d(TAG, "onReadyForSpeech")
Log.d(TAG, "onReadyForSpeech")
}

override fun onBeginningOfSpeech() {
isRecognizing = true
sendEvent(onSpeechStart)
// Log.d(TAG, "onBeginningOfSpeech")
Log.d(TAG, "onBeginningOfSpeech")
}

override fun onResults(results: Bundle?) {
isRecognizing = false
val matches = results?.getStringArrayList(SpeechRecognizer.RESULTS_RECOGNITION)
sendEvent(onSpeechResult, mapOf("results" to matches))
// Log.d(TAG, "onResults $matches")
Log.d(TAG, "onResults $matches")
}

override fun onPartialResults(partialResults: Bundle?) {
Expand All @@ -150,7 +151,7 @@ class ExpoSttModule : Module(), RecognitionListener {
override fun onEndOfSpeech() {
isRecognizing = false
sendEvent(onSpeechEnd)
// Log.d(TAG, "onEndOfSpeech")
Log.d(TAG, "onEndOfSpeech")
}

override fun onError(error: Int) {
Expand All @@ -169,18 +170,18 @@ class ExpoSttModule : Module(), RecognitionListener {
}

sendEvent(onSpeechError, mapOf("errorMessage" to errorMessage))
// Log.d(TAG, "onError: $error $errorMessage")
Log.d(TAG, "onError: $error $errorMessage")
}

override fun onBufferReceived(buffer: ByteArray?) {
// Log.d(TAG, "onBufferReceived")
Log.d(TAG, "onBufferReceived")
}

override fun onRmsChanged(rmsdB: Float) {
// Log.d(TAG, "onRmsChanged: $rmsdB")
}

override fun onEvent(eventType: Int, params: Bundle?) {
// Log.d(TAG, "onEvent: $eventType")
Log.d(TAG, "onEvent: $eventType")
}
}

0 comments on commit 8896c9d

Please sign in to comment.