Skip to content

Conversation

@andremion
Copy link
Collaborator

@andremion andremion commented Dec 5, 2025

Goal

Refactor speech-to-text implementation to improve state management, API design, and code organization, and fix a bug when the recording is manually stopped, and the previously recognized text is partially lost.

Implementation

  • Refactored SpeechToTextButtonState to use Compose state properties (isListening, rmsdB) and moved onTextRecognized callback to state creation level
  • Simplified SpeechRecognizerHelper interface by removing multiple callbacks and using properties instead of methods
  • Removed unnecessary ComponentActivity dependency and DisposableEffect from SpeechToTextButton
  • Extracted helper functions and improved state reset logic

Out of scope

  • Updated sample app credentials

Testing

  • Start the recognizer, speak, see the recognized text, and stop manually.
  • Repeat the steps above, but let the recognizer stop automatically after 3 seconds of silence.

Checklist

  • Issue linked (if any)
  • Tests/docs updated
  • I have signed the Stream CLA (required for external contributors)

@andremion andremion requested a review from a team December 5, 2025 15:31
@github-actions
Copy link
Contributor

github-actions bot commented Dec 5, 2025

SDK Size Comparison 📏

SDK Before After Difference Status
stream-chat-android-ai-compose 0.01 MB 0.01 MB 0.00 MB 🟢

@andremion andremion force-pushed the speech-to-text-improvements branch from 50d4c9c to ff5c2b1 Compare December 5, 2025 15:38
@andremion andremion marked this pull request as ready for review December 5, 2025 15:38
@andremion andremion force-pushed the speech-to-text-improvements branch 2 times, most recently from 6e541ed to 9a58bae Compare December 6, 2025 11:12
@andremion andremion marked this pull request as draft December 9, 2025 09:39
@andremion andremion force-pushed the speech-to-text-improvements branch 2 times, most recently from aedfaa9 to ece8277 Compare December 9, 2025 13:54
@andremion andremion marked this pull request as ready for review December 9, 2025 13:55
@andremion andremion force-pushed the speech-to-text-improvements branch from ece8277 to 11788cf Compare December 9, 2025 14:34
Comment on lines -10 to -11
branches:
- '**'
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

redundant setup

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants