Conversation
- reader-web 新增 ttsBoundary 訊息,依 expo-speech onBoundary 的絕對字元位移, 在朗讀中的句子下方畫底線標記,並在快讀到頁尾時自動翻頁(不用等整章念完) - 修正 tts.ts 暫停後恢復播放會整段重講的問題,改成從暫停時的絕對位移接續朗讀 - 修正 iOS 睡眠計時在背景被系統節流時,超過設定時間仍繼續播放的問題 - 新增閱讀頁朗讀控制列(播放/暫停、重置、睡眠計時循環切換),置於內容與頁碼列 之間、固定高度渲染,避免遮住內容或觸發 WebView 重新分頁 Co-Authored-By: Claude Sonnet 5 <[email protected]>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (4)
🚧 Files skipped from review as they are similar to previous changes (3)
📝 WalkthroughWalkthroughThis PR adds synchronized text-to-speech for the mobile reader by extending TTS messages, adding absolute-offset speech resume and deadline-based sleep timing, introducing WebView text indexing and highlight rendering, wiring boundary-driven page follow, and updating the reader screen controls and chapter-advance flow. ChangesReader TTS feature
Estimated code review effort: 4 (Complex) | ~60 minutes Possibly related PRs
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
mobile/lib/tts.ts (1)
250-253: 🎯 Functional Correctness | 🟠 Major | ⚡ Quick winSleep timer should not restart on every chapter
readNextAndContinue()callstts.speak()for each auto-advanced chapter, sostartSleepTimer(sleepMinutes)resets the deadline every time and the timer can never expire during continuous reading. Only start it when no deadline is already running.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@mobile/lib/tts.ts` around lines 250 - 253, In readNextAndContinue()’s speak flow, the sleep timer is being restarted on every auto-advanced chapter because startSleepTimer(sleepMinutes) is called whenever sleepMinutes > 0. Update the logic around speakChunk(generation) so the timer only starts if no active deadline is already running, and keep the existing sleepMinutes check in tts.speak() or its caller to avoid resetting the countdown during continuous reading.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@mobile/reader-web/ttsHighlight.ts`:
- Around line 55-81: The TTS text index cache can become stale after
`applyScriptToDoc()` changes text via `convertDoc()`/`restoreDoc()`, so offsets
returned by `getTextIndex()` may no longer match the document. Update the
script/typography change flow to invalidate `ttsTextIndexCache` for the affected
document whenever text is rewritten, and ensure `getTextIndex()` rebuilds the
index from the current `Text.nodeValue` values after those conversions.
---
Outside diff comments:
In `@mobile/lib/tts.ts`:
- Around line 250-253: In readNextAndContinue()’s speak flow, the sleep timer is
being restarted on every auto-advanced chapter because
startSleepTimer(sleepMinutes) is called whenever sleepMinutes > 0. Update the
logic around speakChunk(generation) so the timer only starts if no active
deadline is already running, and keep the existing sleepMinutes check in
tts.speak() or its caller to avoid resetting the countdown during continuous
reading.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro Plus
Run ID: bf9ab482-b10a-4d46-bbdd-0c806d801773
📒 Files selected for processing (7)
mobile/app/reader/[id].tsxmobile/components/icons.tsxmobile/lib/readerHtml.generated.tsmobile/lib/readerMessages.tsmobile/lib/tts.tsmobile/reader-web/index.tsmobile/reader-web/ttsHighlight.ts
- ttsHighlight.ts: 新增 invalidateTextIndex(),簡繁轉換改寫 nodeValue 後清掉 getTextIndex 的快取,避免朗讀抓到轉換前的舊文字 - tts.ts: speak() 只在沒有睡眠計時 deadline 在跑時才啟動計時器,避免跨章節 自動接續朗讀時倒數被每一章重置 Co-Authored-By: Claude Sonnet 5 <[email protected]>
Summary by CodeRabbit
New Features
Bug Fixes
UI/Behavior