Conversation
重用既有的 measurePageEdgeOffset 算出目前頁面在章節文字中的起始位移, getChapterText 回傳切過的文字+該位移;RN 端把 expo-speech 回報的 charIndex 加回位移再送給 WebView,跟讀底線與頁尾自動翻頁的絕對位移比對 才不會錯位。 Co-Authored-By: Claude Sonnet 5 <[email protected]>
新增 icon-src 來源檔與 store-assets(Google Play 商店用圖),Android adaptiveIcon 背景改暖陶色並封鎖 SYSTEM_ALERT_WINDOW 權限,app.json 補上 iOS 非豁免加密聲明、EAS projectId 與 owner,供 EAS Build / 商店送審使用。 Co-Authored-By: Claude Sonnet 5 <[email protected]>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
Warning Review limit reached
Next review available in: 43 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughAdds a ChangesReader chapterText startOffset propagation
App configuration updates
Estimated code review effort: 3 (Moderate) | ~20 minutes Possibly related PRs
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 inconclusive)
✅ Passed checks (4 passed)
✨ Finishing Touches🧪 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.
🧹 Nitpick comments (1)
mobile/app/reader/[id].tsx (1)
315-347: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winConsider extracting the duplicated speak/boundary-offset logic.
readNextAndContinue(Lines 318-327) andhandleTTSPlay(Lines 337-346) now duplicate identicalrequestChapterTextdestructuring, thereadingHrefRef/ttsStartsetup, and thecharIndex + startOffsetboundary math. This offset arithmetic is easy to get subtly wrong in one call site while updating the other (e.g., a future change to the boundary formula). Centralizing it in one helper would remove that risk.♻️ Proposed refactor: shared helper
+ const speakChapterText = useCallback((text: string, startOffset: number) => { + readingHrefRef.current = currentHrefRef.current; + webviewRef.current?.postMessage(JSON.stringify({ type: 'ttsStart' })); + tts.speak( + text, + () => continueReadingRef.current(), + (charIndex) => + webviewRef.current?.postMessage(JSON.stringify({ type: 'ttsBoundary', charIndex: charIndex + startOffset })) + ); + }, [tts]); + const readNextAndContinue = useCallback(async () => { const advanced = await advanceToNextChapter(); if (!advanced) return; const { text, startOffset } = await requestChapterText(); if (!text.trim()) return; - readingHrefRef.current = currentHrefRef.current; - webviewRef.current?.postMessage(JSON.stringify({ type: 'ttsStart' })); - tts.speak( - text, - () => continueReadingRef.current(), - (charIndex) => - webviewRef.current?.postMessage(JSON.stringify({ type: 'ttsBoundary', charIndex: charIndex + startOffset })) - ); - }, [advanceToNextChapter, requestChapterText, tts]); + speakChapterText(text, startOffset); + }, [advanceToNextChapter, requestChapterText, speakChapterText]); const handleTTSPlay = useCallback(async () => { if (tts.paused) { tts.resume(); webviewRef.current?.postMessage(JSON.stringify({ type: 'ttsStart' })); return; } const { text, startOffset } = await requestChapterText(); if (!text.trim()) return; - readingHrefRef.current = currentHrefRef.current; - webviewRef.current?.postMessage(JSON.stringify({ type: 'ttsStart' })); - tts.speak( - text, - () => continueReadingRef.current(), - (charIndex) => - webviewRef.current?.postMessage(JSON.stringify({ type: 'ttsBoundary', charIndex: charIndex + startOffset })) - ); - }, [tts, requestChapterText]); + speakChapterText(text, startOffset); + }, [tts, requestChapterText, speakChapterText]);🤖 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/app/reader/`[id].tsx around lines 315 - 347, There is duplicated TTS playback setup in readNextAndContinue and handleTTSPlay, including requestChapterText handling, readingHrefRef/ttsStart initialization, and the charIndex plus startOffset boundary calculation. Extract this repeated speak/boundary-offset flow into a shared helper used by both functions, and keep advanceToNextChapter only in readNextAndContinue while preserving the existing continueReadingRef callback behavior.
🤖 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.
Nitpick comments:
In `@mobile/app/reader/`[id].tsx:
- Around line 315-347: There is duplicated TTS playback setup in
readNextAndContinue and handleTTSPlay, including requestChapterText handling,
readingHrefRef/ttsStart initialization, and the charIndex plus startOffset
boundary calculation. Extract this repeated speak/boundary-offset flow into a
shared helper used by both functions, and keep advanceToNextChapter only in
readNextAndContinue while preserving the existing continueReadingRef callback
behavior.
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro Plus
Run ID: f8d924dc-a719-4dec-9bcd-545cd3956ed6
⛔ Files ignored due to path filters (13)
icon-src/feature-graphic.svgis excluded by!**/*.svgicon-src/icon-background.svgis excluded by!**/*.svgicon-src/icon-glyph.svgis excluded by!**/*.svgicon-src/icon-monochrome.svgis excluded by!**/*.svgicon-src/icon-square.svgis excluded by!**/*.svgmobile/assets/android-icon-background.pngis excluded by!**/*.pngmobile/assets/android-icon-foreground.pngis excluded by!**/*.pngmobile/assets/android-icon-monochrome.pngis excluded by!**/*.pngmobile/assets/favicon.pngis excluded by!**/*.pngmobile/assets/icon.pngis excluded by!**/*.pngmobile/assets/splash-icon.pngis excluded by!**/*.pngstore-assets/google-play/app-icon-512x512.pngis excluded by!**/*.pngstore-assets/google-play/feature-graphic-1024x500.pngis excluded by!**/*.png
📒 Files selected for processing (5)
mobile/app.jsonmobile/app/reader/[id].tsxmobile/lib/readerHtml.generated.tsmobile/lib/readerMessages.tsmobile/reader-web/index.ts
readNextAndContinue 與 handleTTSPlay 原本各自重複 readingHrefRef 設定、 ttsStart 訊息與 tts.speak 呼叫,抽成共用的 startSpeaking helper。 Co-Authored-By: Claude Sonnet 5 <[email protected]>
Summary by CodeRabbit