Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

2917: Fix tts on ios proposal #3063

Merged
merged 5 commits into from
Feb 4, 2025
Merged

2917: Fix tts on ios proposal #3063

merged 5 commits into from
Feb 4, 2025

Conversation

steffenkleinle
Copy link
Member

@steffenkleinle steffenkleinle commented Jan 30, 2025

Short description

This PR fixes tts on iOS and a few other bugs and problems with tts.
Furthermore, I added some tests and did some refactoring.

Proposed changes

  • Fix tts on iOS by removing the listener before stopping/pausing tts
  • Allow reading content of 2nd level categories (see discussion here)
  • Fix tts sentences when navigating between pages
  • Handle opening of player in TtsContainer instead of header for clear responsibilities
  • Only initialize tts once actually needed (fixes annoying issues if no tts engine installed)
  • Error handling (show users a message if initializing fails)
  • Create a new useAppStateListener hook
  • Improve tests for TtsContainer and useTtsPlayer
  • Further improvements and refactoring

Side effects

N/A, hopefully everything works now on both android and ios.

Testing

Test the tts player thoroughly on both ios and android! Press all buttons multiple times (especially pause, play, previous, next) and navigate between different pages while the tts player is open.

Resolved issues

Fixes: #2917


@steffenkleinle steffenkleinle changed the title 2916 tts ios proposal 2916: Fix tts on ios proposal Jan 30, 2025
return []
}, [model, languageCode])
const ttsContext = useContext(TtsContext)
const [previousSentences] = useState(ttsContext.sentences)
Copy link
Member Author

Choose a reason for hiding this comment

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

I did not find another way to ensure that the correct sentences are set after navigating back.

@steffenkleinle steffenkleinle force-pushed the 2916-tts-ios-proposal branch 2 times, most recently from 048f9f2 to 6f58f22 Compare January 30, 2025 15:31
@steffenkleinle steffenkleinle changed the title 2916: Fix tts on ios proposal 3046: Fix tts on ios proposal Jan 30, 2025
@steffenkleinle steffenkleinle linked an issue Jan 30, 2025 that may be closed by this pull request
@steffenkleinle steffenkleinle changed the title 3046: Fix tts on ios proposal 2917: Fix tts on ios proposal Jan 30, 2025
@steffenkleinle steffenkleinle marked this pull request as ready for review January 30, 2025 15:45
Copy link
Contributor

@f1sh1918 f1sh1918 left a comment

Choose a reason for hiding this comment

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

Some minor comments. But looks good. 👍
Glad that you found a better solution :)
Tested on ios real device

native/src/components/AppStateListener.ts Show resolved Hide resolved
@f1sh1918 f1sh1918 mentioned this pull request Feb 3, 2025
Copy link
Contributor

@LeandraH LeandraH left a comment

Choose a reason for hiding this comment

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

Very cool! Tested on real iOS

@steffenkleinle steffenkleinle merged commit 16f3813 into main Feb 4, 2025
7 checks passed
@steffenkleinle steffenkleinle deleted the 2916-tts-ios-proposal branch February 4, 2025 09:20
@bahaaTuffaha
Copy link
Contributor

bahaaTuffaha commented Feb 4, 2025

Sorry I was late to check it out
Great work...
one thing
You changed something at useTtsPlayer.ts so when I change the language while its speaking the player will be disabled and nothing to read.

(tested on Andorid)

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.

Add TTS on ios
4 participants