Add notification settings screen for wrong direction alerts#5773
Add notification settings screen for wrong direction alerts#5773TinyKitten merged 5 commits intodevfrom
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughWalkthrough誤方向通知設定を追加。翻訳キーの追加、設定画面への遷移項目追加、新しい通知設定スクリーン、Jotai状態とAsyncStorageでの永続化、既存フローへの読み込み統合を実装。 Changes
Sequence DiagramsequenceDiagram
actor User
participant NotificationSettings as NotificationSettings<br/>Screen
participant JotaiState as Jotai<br/>notifyState
participant AsyncStorage as AsyncStorage
participant Navigation as Navigation
User->>NotificationSettings: 通知設定画面を開く
activate NotificationSettings
NotificationSettings->>JotaiState: 読み取り(wrongDirectionNotifyEnabled)
JotaiState-->>NotificationSettings: 現在値を返す
NotificationSettings-->>User: トグルと説明を表示
deactivate NotificationSettings
User->>NotificationSettings: トグルを切り替え
activate NotificationSettings
NotificationSettings->>AsyncStorage: 新しい値を保存(WRONG_DIRECTION_NOTIFY_ENABLED)
activate AsyncStorage
AsyncStorage-->>NotificationSettings: 保存完了
deactivate AsyncStorage
NotificationSettings->>JotaiState: Atomを更新
JotaiState-->>NotificationSettings: 更新完了
NotificationSettings-->>User: UIを更新
deactivate NotificationSettings
User->>NotificationSettings: OKボタンで戻る
activate NotificationSettings
NotificationSettings->>Navigation: 前の画面へ戻る
Navigation-->>User: 前画面表示
deactivate NotificationSettings
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@src/screens/NotificationSettings.tsx`:
- Around line 45-60: handleToggleWrongDirectionNotify correctly saves
wrongDirectionNotifyEnabled to AsyncStorage and state, but the notification
sender in useRefreshStation (hook functions around lines previously noted)
ignores this flag so wrong-direction alerts still send; update the sending logic
in useRefreshStation (the function(s) that decide and dispatch wrong-direction
notifications, e.g., the handler around the send/notify calls) to read the
persisted flag (from AsyncStorage or from your global/state store) and gate
sending: before invoking the wrong-direction notification dispatch, check the
flag and return early if false; ensure you reference the same storage key
ASYNC_STORAGE_KEYS.WRONG_DIRECTION_NOTIFY_ENABLED or the notify state
setter/getter used by NotificationSettings so the UI toggle actually controls
sending.
🪄 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: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: ffb15f18-7615-4eed-b517-253e8ad8cc19
📒 Files selected for processing (8)
assets/translations/en.jsonassets/translations/ja.jsonsrc/components/Permitted.tsxsrc/constants/asyncStorage.tssrc/screens/AppSettings.tsxsrc/screens/NotificationSettings.tsxsrc/stacks/MainStack.tsxsrc/store/atoms/notify.ts
概要
逆方向走行時の通知設定を管理する新しい設定画面を追加しました。ユーザーが逆方向走行時の通知のオン/オフを切り替えられるようになります。
変更の種類
変更内容
新規追加
既存ファイルの変更
AppSettings.tsx:
Permitted.tsx:
wrongDirectionNotifyEnabled設定を読み込みnotifyStateatom を初期化MainStack.tsx:
notify.ts:
NotifyStateインターフェースにwrongDirectionNotifyEnabledフィールドを追加asyncStorage.ts:
WRONG_DIRECTION_NOTIFY_ENABLEDキーを定数として追加翻訳ファイル (en.json, ja.json):
テスト
npm run lintが通ることnpm run typecheckが通ることhttps://claude.ai/code/session_01GTPWXRZfVMsQWVchRxFW6n
Summary by CodeRabbit