Repository navigation
共通ダイアログモーダルを追加してAlert表示を移行 - #6550
Conversation
📝 WalkthroughWalkthroughReact Native の Changes共通ダイアログ基盤
Estimated code review effort: 4 (Complex) | ~45 minutes Sequence Diagram(s)sequenceDiagram
participant Screen
participant dialogPresentation
participant CommonDialogPresenter
participant CommonDialogModal
Screen->>dialogPresentation: showDialogWhilePresenting(key, title, message, buttons)
dialogPresentation->>CommonDialogPresenter: publish dialog snapshot
CommonDialogPresenter->>CommonDialogModal: render common modal
CommonDialogModal->>dialogPresentation: dismissPresentedDialog(buttonIndex)
dialogPresentation->>dialogPresentation: completePresentedDialogDismissal()
dialogPresentation->>Screen: execute selected callback
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: 4
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
src/screens/Privacy.tsx (1)
88-99: 🎯 Functional Correctness | 🟠 Major | ⚡ Quick win権限拒否時のダイアログをキャンセル不可にしてください。
showDialogは既定で背景タップとAndroidの戻るキーによる終了を許可します。この経路ではhandleStartWithoutPermissionPressが実行されず、ユーザーはPrivacy画面に残ります。既存のOK操作と同じ遷移を必須にするため、
{ cancelable: false }を渡してください。修正例
[ { text: 'OK', onPress: handleStartWithoutPermissionPress, }, - ] + ], + { cancelable: false } );🤖 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 `@src/screens/Privacy.tsx` around lines 88 - 99, Update the permission-denied dialog invocation in Privacy.tsx to pass the showDialog option { cancelable: false }, while preserving the existing OK button and handleStartWithoutPermissionPress transition.
🧹 Nitpick comments (1)
src/hooks/useInitialNearbyStation.test.tsx (1)
141-145: 🎯 Functional Correctness | 🔵 Trivial | ⚡ Quick winダイアログの表示状態も検証してください。
現在のテストは
requestの内容だけを確認します。visibleを確認しないため、要求が作成されても表示されていない状態を検出できません。getDialogPresentationSnapshot()全体を検証し、visible: trueとrequestのtitle/messageを確認してください。
src/hooks/useInitialNearbyStation.test.tsx#L141-L145:visible: trueと初回起動ダイアログのrequestを同時に検証してください。src/screens/ExperimentalSettings.test.tsx#L88-L90:visible: trueを追加して保存失敗ダイアログの表示を検証してください。src/screens/ExperimentalSettings.test.tsx#L138-L144:visible: trueを追加してテレメトリ保存失敗ダイアログの表示を検証してください。src/screens/TTSSettings.test.tsx#L174-L177:visible: trueを追加してリンク失敗ダイアログの表示を検証してください。🤖 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 `@src/hooks/useInitialNearbyStation.test.tsx` around lines 141 - 145, Update the dialog presentation assertions to verify visibility as well as request content: in src/hooks/useInitialNearbyStation.test.tsx:141-145 assert visible: true alongside the initial-launch request fields; add visible: true in the save-failure assertion at src/screens/ExperimentalSettings.test.tsx:88-90 and the telemetry-save-failure assertion at src/screens/ExperimentalSettings.test.tsx:138-144; and add visible: true to the link-failure assertion at src/screens/TTSSettings.test.tsx:174-177.
🤖 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 `@src/components/CommonDialogModal.test.tsx`:
- Around line 14-41: Clear Jest mock call history after each test: add an
afterEach calling jest.clearAllMocks() in CommonDialogModal.test.tsx (lines
14-41), and update the existing afterEach in CommonDialogPresenter.test.tsx
(lines 24-30) to call jest.clearAllMocks().
In `@src/components/CommonDialogPresenter.tsx`:
- Around line 42-53: The CommonDialogPresenter currently drops additional
non-cancel buttons because DialogModalLayout supports only two button slots.
Enforce and document the DialogButton[] constraint at the request boundary so at
most one cancel and one non-cancel button are accepted, and make the invalid
multiple-confirm-button case fail explicitly rather than silently discarding
buttons. Add or update tests covering two non-cancel buttons and the resulting
behavior.
In `@src/utils/dialogPresentation.test.ts`:
- Around line 11-13: Update the afterEach cleanup in the dialog presentation
tests to call jest.clearAllMocks() both before and after
resetDialogPresentationForTests(), while preserving the existing reset behavior.
In `@src/utils/dialogPresentation.ts`:
- Around line 154-169: Update the completion flow around
completedRequest.buttons[buttonIndex]?.onPress and
completedRequest.options.onDismiss so queued requests retain FIFO order when a
callback invokes showDialog. Activate the existing queued request before
processing callback-created requests, or otherwise append those new requests
after the current queue; ensure the resulting order is A → B → C and add a test
covering that sequence.
---
Outside diff comments:
In `@src/screens/Privacy.tsx`:
- Around line 88-99: Update the permission-denied dialog invocation in
Privacy.tsx to pass the showDialog option { cancelable: false }, while
preserving the existing OK button and handleStartWithoutPermissionPress
transition.
---
Nitpick comments:
In `@src/hooks/useInitialNearbyStation.test.tsx`:
- Around line 141-145: Update the dialog presentation assertions to verify
visibility as well as request content: in
src/hooks/useInitialNearbyStation.test.tsx:141-145 assert visible: true
alongside the initial-launch request fields; add visible: true in the
save-failure assertion at src/screens/ExperimentalSettings.test.tsx:88-90 and
the telemetry-save-failure assertion at
src/screens/ExperimentalSettings.test.tsx:138-144; and add visible: true to the
link-failure assertion at src/screens/TTSSettings.test.tsx:174-177.
🪄 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: 8e731216-0f0c-4ee3-94a6-50908e73c3a0
📒 Files selected for processing (38)
AGENTS.mddocs/spec/ai-agent/ui.mdsrc/components/CommonDialogModal.test.tsxsrc/components/CommonDialogModal.tsxsrc/components/CommonDialogPresenter.test.tsxsrc/components/CommonDialogPresenter.tsxsrc/components/DialogModalLayout.tsxsrc/components/FatalErrorScreen.tsxsrc/components/NewReportModal.tsxsrc/components/Permitted.tsxsrc/components/SelectBoundModal.tsxsrc/components/StationSearchModal.tsxsrc/components/ThemeConfirmModal.tsxsrc/components/TuningSettings.tsxsrc/components/WalkthroughOverlay.tsxsrc/hooks/useCheckStoreVersion.tssrc/hooks/useInitialNearbyStation.test.tsxsrc/hooks/useInitialNearbyStation.tssrc/index.tsxsrc/providers/DeepLinkProvider.tsxsrc/screens/AndroidSettings.tsxsrc/screens/BatterySettings.test.tsxsrc/screens/BatterySettings.tsxsrc/screens/DestinationAgent/index.tsxsrc/screens/EnabledLanguagesSettings.tsxsrc/screens/ExperimentalSettings.test.tsxsrc/screens/ExperimentalSettings.tsxsrc/screens/Main.tsxsrc/screens/NotificationSettings.tsxsrc/screens/Privacy.tsxsrc/screens/RouteSearchScreen.tsxsrc/screens/TTSSettings.test.tsxsrc/screens/TTSSettings.tsxsrc/screens/ThemeSettings.tsxsrc/utils/alertPresentation.test.tssrc/utils/alertPresentation.tssrc/utils/dialogPresentation.test.tssrc/utils/dialogPresentation.ts
💤 Files with no reviewable changes (2)
- src/utils/alertPresentation.test.ts
- src/utils/alertPresentation.ts
|
@coderabbitai review |
✅ Action performedReview finished.
|
There was a problem hiding this comment.
🧹 Nitpick comments (1)
src/utils/dialogPresentation.test.ts (1)
58-65: 🗄️ Data Integrity & Integration | 🔵 Trivial | ⚡ Quick win無効要求がキューに残らないことも検証してください。
getDialogPresentationSnapshot().requestは表示中の要求だけを確認します。queuedRequestsの残留は確認しません。src/utils/dialogPresentation.tsのenqueueDialogが検証前にキューを変更する場合、このテストは成功しても後続の有効な要求に影響します。例外後に有効な要求を追加し、最初にその要求が表示されることを確認してください。
検証例
expect(getDialogPresentationSnapshot().request).toBeNull(); + showDialog('valid'); + expect(getDialogPresentationSnapshot().request?.title).toBe('valid');🤖 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 `@src/utils/dialogPresentation.test.ts` around lines 58 - 65, Extend the test for multiple confirm buttons in the dialog presentation flow to enqueue a valid request after the invalid showDialog call, then verify that the valid request is displayed first. Use getDialogPresentationSnapshot and the existing dialog request symbols to confirm the invalid request did not remain in queuedRequests, while preserving the current exception and null-request assertions.
🤖 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 `@src/utils/dialogPresentation.test.ts`:
- Around line 58-65: Extend the test for multiple confirm buttons in the dialog
presentation flow to enqueue a valid request after the invalid showDialog call,
then verify that the valid request is displayed first. Use
getDialogPresentationSnapshot and the existing dialog request symbols to confirm
the invalid request did not remain in queuedRequests, while preserving the
current exception and null-request assertions.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 59854d31-bcee-4930-b523-3bd54adab40b
📒 Files selected for processing (9)
src/components/CommonDialogModal.test.tsxsrc/components/CommonDialogPresenter.test.tsxsrc/components/CommonDialogPresenter.tsxsrc/hooks/useInitialNearbyStation.test.tsxsrc/screens/ExperimentalSettings.test.tsxsrc/screens/Privacy.tsxsrc/screens/TTSSettings.test.tsxsrc/utils/dialogPresentation.test.tssrc/utils/dialogPresentation.ts
🚧 Files skipped from review as they are similar to previous changes (7)
- src/components/CommonDialogPresenter.test.tsx
- src/components/CommonDialogModal.test.tsx
- src/screens/Privacy.tsx
- src/components/CommonDialogPresenter.tsx
- src/utils/dialogPresentation.ts
- src/screens/TTSSettings.test.tsx
- src/hooks/useInitialNearbyStation.test.tsx
概要
アプリ内で使用していたネイティブのダイアログ表示を、統一されたデザインの
CommonDialogModalへ移行します。ThemeConfirmModalとCommonDialogModalはそれぞれ独立した公開コンポーネントとして維持し、共通するレイアウトだけを内部コンポーネントへ切り出しました。変更の種類
変更内容
CustomModalを基盤とするCommonDialogModalを追加ThemeConfirmModalと共通するレイアウトをDialogModalLayoutに集約CommonDialogPresenterと表示APIを追加回帰リスクとして、ダイアログの表示順、閉じるアニメーション後のコールバック実行、キャンセル操作が変わる可能性があります。表示キューと入力制約の単体テスト、既存画面の関連テスト、Android実機確認で軽減しています。
テスト
npm run lintが通ることnpm testが通ることnpm run typecheckが通ること実行結果:
npm run lint: 613ファイル成功npm test -- --runInBand --silent: 207スイート、2187テスト成功npm run typecheck: 成功git diff --check: 成功関連Issue
なし
スクリーンショット(任意)
CommonDialogModalの表示、絵文字の見切れがないこと、Android戻るキーによる閉じる動作を確認Summary by CodeRabbit
新機能
改善
テスト