Skip to content

Dev#8

Merged
Retsomm merged 3 commits into
mainfrom
dev
Jul 6, 2026
Merged

Dev#8
Retsomm merged 3 commits into
mainfrom
dev

Conversation

@Retsomm

@Retsomm Retsomm commented Jul 6, 2026

Copy link
Copy Markdown
Owner

Summary by CodeRabbit

  • Bug Fixes
    • Improved audiobook/text-to-speech highlighting so spoken words now stay in sync with the visible text, including when continuing to the next chapter or starting playback manually.
    • Fixed chapter text retrieval to begin from the currently displayed section instead of always starting at the beginning.
    • Updated app configuration for iOS and Android compatibility and permissions handling.

Retsomm and others added 2 commits July 6, 2026 11:23
重用既有的 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]>
@vercel

vercel Bot commented Jul 6, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
travel-in-time Ready Ready Preview, Comment Jul 6, 2026 3:42am

@coderabbitai

coderabbitai Bot commented Jul 6, 2026

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

@Retsomm, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 43 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

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 configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 98d89e75-d219-4a46-903b-2c790f551bc3

📥 Commits

Reviewing files that changed from the base of the PR and between 811c15c and 034c1cd.

📒 Files selected for processing (1)
  • mobile/app/reader/[id].tsx
📝 Walkthrough

Walkthrough

Adds a startOffset field to the reader's chapterText message contract, propagated from reader-web (computed from visible page position) through the reader screen's resolver and TTS boundary calculations. Also updates mobile/app.json with iOS/Android identifiers, permissions, and EAS/extra configuration.

Changes

Reader chapterText startOffset propagation

Layer / File(s) Summary
Message contract update
mobile/lib/readerMessages.ts
OutboundMessage's chapterText variant now requires a startOffset: number field alongside text.
reader-web startOffset computation
mobile/reader-web/index.ts
getChapterText() returns { text, startOffset } computed from the visible page's start position instead of the full chapter text; handleMessage sends both fields.
Reader screen resolver and TTS offset
mobile/app/reader/[id].tsx
chapterTextResolverRef and requestChapterText are retyped to { text, startOffset }; readNextAndContinue and handleTTSPlay offset TTS charIndex by startOffset when posting ttsBoundary.

App configuration updates

Layer / File(s) Summary
iOS/Android and EAS config changes
mobile/app.json
Sets iOS bundleIdentifier and infoPlist encryption flag, Android icon background color and blockedPermissions, and adds extra (router, EAS projectId) and owner fields.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Possibly related PRs

  • Retsomm/TravelInTime#3: Modifies the same chapter-text request/response messaging path across mobile/reader-web/index.ts, mobile/app/reader/[id].tsx, and mobile/lib/readerMessages.ts.
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 inconclusive)

Check name Status Explanation Resolution
Title check ❓ Inconclusive The title is too vague to describe the actual changes in the pull request. Replace it with a concise summary of the main change, such as the reader text offset and app config update.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch dev

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🧹 Nitpick comments (1)
mobile/app/reader/[id].tsx (1)

315-347: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Consider extracting the duplicated speak/boundary-offset logic.

readNextAndContinue (Lines 318-327) and handleTTSPlay (Lines 337-346) now duplicate identical requestChapterText destructuring, the readingHrefRef/ttsStart setup, and the charIndex + startOffset boundary 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

📥 Commits

Reviewing files that changed from the base of the PR and between 9fb9726 and 811c15c.

⛔ Files ignored due to path filters (13)
  • icon-src/feature-graphic.svg is excluded by !**/*.svg
  • icon-src/icon-background.svg is excluded by !**/*.svg
  • icon-src/icon-glyph.svg is excluded by !**/*.svg
  • icon-src/icon-monochrome.svg is excluded by !**/*.svg
  • icon-src/icon-square.svg is excluded by !**/*.svg
  • mobile/assets/android-icon-background.png is excluded by !**/*.png
  • mobile/assets/android-icon-foreground.png is excluded by !**/*.png
  • mobile/assets/android-icon-monochrome.png is excluded by !**/*.png
  • mobile/assets/favicon.png is excluded by !**/*.png
  • mobile/assets/icon.png is excluded by !**/*.png
  • mobile/assets/splash-icon.png is excluded by !**/*.png
  • store-assets/google-play/app-icon-512x512.png is excluded by !**/*.png
  • store-assets/google-play/feature-graphic-1024x500.png is excluded by !**/*.png
📒 Files selected for processing (5)
  • mobile/app.json
  • mobile/app/reader/[id].tsx
  • mobile/lib/readerHtml.generated.ts
  • mobile/lib/readerMessages.ts
  • mobile/reader-web/index.ts

readNextAndContinue 與 handleTTSPlay 原本各自重複 readingHrefRef 設定、
ttsStart 訊息與 tts.speak 呼叫,抽成共用的 startSpeaking helper。

Co-Authored-By: Claude Sonnet 5 <[email protected]>
@Retsomm Retsomm merged commit 354176d into main Jul 6, 2026
6 checks passed
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.

1 participant