Repository navigation
Androidホーム画面ウィジェットが更新されず未乗車表示のままになる問題を修正 - #6577
Conversation
ライブアクティビティ更新フックはiOSでのみマウントされるため、その中から呼んでいた ウィジェット同期がAndroidでは一度も実行されていなかった。ウィジェットが必要とする 低頻度の項目だけを購読する専用フックへ切り出し、Androidで別ホストとしてマウントする。 Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01XHQB1iKjHbZLmPDKysVpnt
未乗車時の1行表示がアプリ名(dev版では「TrainLCD Canary」)になっていたため、 路線未設定のプレースホルダーへ差し替える。あわせてiOSのHomeScreenWidgetに合わせた 正方形レイアウトの追加とナンバリングサークルの線幅調整、ウィジェット選択画面の プレビューが空にならないよう各レイアウトへ既定文言を設定する。 Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01XHQB1iKjHbZLmPDKysVpnt
|
Warning Review limit reachedYou’ve reached a temporary PR review limit under our Fair Usage Limits Policy. Next review available in: 2 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: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (3)
📝 WalkthroughWalkthroughAndroidウィジェットを4種類のサイズに対応させました。路線情報の表示を更新しました。 ChangesAndroidウィジェット表示
Estimated code review effort: 3 (Moderate) | ~25 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 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 `@android/app/src/main/java/me/tinykitten/trainlcd/RideWidgetProvider.kt`:
- Around line 108-110: Update the view-selection logic in RideWidgetProvider so
smallViews requires both the small height threshold and a width/aspect-ratio
condition; route wide 4x2 widgets to rectangularViews while keeping 2x2 widgets
on smallViews. Add regression coverage for both widget sizes using the existing
test structure.
In `@src/hooks/useUpdateWidget.ts`:
- Around line 48-54: Update the useEffect in useUpdateWidget so its
!selectedBound branch calls clearWidget() before returning, clearing stale
widget data when selectedBound changes to null. Add a test that rerenders from a
populated selectedBound to null and verifies clearWidget is invoked.
🪄 Autofix
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: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: f3ead137-5a4c-4e36-8c94-d00f0f1dca45
📒 Files selected for processing (13)
android/app/src/main/java/me/tinykitten/trainlcd/RideWidgetProvider.ktandroid/app/src/main/res/drawable/widget_numbering_circle.xmlandroid/app/src/main/res/layout/widget_ride_circular.xmlandroid/app/src/main/res/layout/widget_ride_inline.xmlandroid/app/src/main/res/layout/widget_ride_rectangular.xmlandroid/app/src/main/res/layout/widget_ride_small.xmlandroid/app/src/main/res/values/strings.xmlandroid/app/src/main/res/xml/ride_widget_info.xmlsrc/hooks/index.tssrc/hooks/useUpdateLiveActivities.tssrc/hooks/useUpdateWidget.test.tsxsrc/hooks/useUpdateWidget.tssrc/screens/Main.tsx
💤 Files with no reviewable changes (1)
- src/hooks/useUpdateLiveActivities.ts
Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01XHQB1iKjHbZLmPDKysVpnt
|
@coderabbitai review |
|
概要
Android のホーム画面ウィジェットが、乗車中でも常に未乗車表示(dev 版ではアプリ名の
TrainLCD Canary)のままになる問題を修正します。原因は、ウィジェットへの同期を呼んでいた
useUpdateLiveActivitiesが iOS でしかマウントされていないことでした(src/screens/Main.tsxのFxUpdateLiveActivitiesがPlatform.OS === 'ios'でゲートされている。#6422 の再レンダー最適化で導入)。そのため Android ではupdateWidgetが一度も呼ばれず、ウィジェットは初期状態のままでした。加えて、未乗車時の 1 行レイアウトが
@string/app_nameを表示していたため、TrainLCD Canaryという文字列だけが見える状態になっていました。ウィジェット選択画面のプレビューも、レイアウトに既定文言がなく空欄でした。Note
同じゲートにより Android 16 のライブアップデート通知(
startLiveUpdate/updateLiveUpdate)も現状呼ばれていません。ウィジェットとは独立した挙動変更になるため本 PR では触れていません。復活させるべきかは別途ご判断ください。変更の種類
変更内容
データ経路の修正
useUpdateWidgetを新設。ウィジェットが必要とする低頻度の項目(路線名・路線色・路線記号・方面)だけを購読し、到着・通過など毎秒変化する状態は購読しないため、高頻度atom購読の隔離で位置更新ごとの全画面再レンダーを解消 #6422 で避けた位置更新ごとの派生計算コストは持ち込まないMainScreenEffectsにFxUpdateWidgetを追加し、Android でのみマウント(レンダーレス副作用ホスト 1 つにつき 1 フックの規約に従う)useUpdateLiveActivitiesから、呼ばれることのなかったupdateWidget/clearWidgetの呼び出しを削除useUpdateWidgetの単体テストを追加(行先選択時に送信する / 未選択では送らない / アンマウント(降車)で消去する)表示の修正
路線が未設定です/方面が未設定ですのプレースホルダーに統一HomeScreenWidget(watchOS・ロック画面ウィジェットと同じ体裁のホーム画面ウィジェットをiOSに追加 #6573 / ホーム画面ウィジェットの路線記号の枠線と文字を太くして視認性を改善 #6576)に体裁を合わせ、正方形サイズ向けレイアウト(ナンバリングサークル + 路線名 + 方面、systemSmall 相当)を追加。横長は「路線色バー + TrainLCD + 路線名 + 方面 + ナンバリングサークル」(systemMedium 相当)に更新targetCellWidth/targetCellHeight)へ変更テスト
npm run lint/npm test(209 suites・2198 tests passed)/npm run typecheckをローカルで実行し、いずれも成功しています。あわせて Android SDK 36 + JDK 17 で./gradlew :app:compileDevDebugKotlinを実行し BUILD SUCCESSFUL を確認しました(processDevDebugResourcesを通過しているため、追加・変更したレイアウトとリソースも検証済みです)。npm run lintが通ることnpm testが通ることnpm run typecheckが通ること関連Issue
スクリーンショット(任意)
作業環境にエミュレータ/実機がないため未取得です。canary ビルドで、乗車後にウィジェットへ路線名・方面・路線記号が反映されること、および未乗車時にプレースホルダーが表示されることの確認をお願いします。
Generated by Claude Code
Summary by CodeRabbit
新機能
改善