feat: 逃走者が写真を撮ったら鬼に通知する - #128
Conversation
- 鬼のとき、新しく撮られた他人の写真があれば端末通知とSnackBarで 知らせる(usePhotoTakenNotifications)。最初に受け取った一覧は基準に するだけで通知しない - 鬼は撮影しないので、撮影タイミングの通知は鬼には出さない。途中で 鬼になった場合も、タイマー発火時点の役割に従う Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Warning Review limit reachedNext included review available in 42 minutes. View limit detailsLimit details: You’ve used the included review currently available. You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Review configuration: ⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Advanced Run ID: 📒 Files selected for processing (7)
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 |
|
@claude review |
|
Claude finished @rinyaaa's task in 2m 29s —— View job レビュー
全体的によく設計・テストされたPRです。既存の 指摘は軽微なものです。
|
|
@coderabbitai review |
|
There was a problem hiding this comment.
Copilot review overview
🟡 Changes recommended
Unresolved notification correctness issues remain, along with a documentation nit.
Review effort: Lite
Findings: 2
Open (2)
What changed in this PR
Adds notifications to demons when fugitives take photos, while suppressing photo-timing notifications for demons.
Changes:
- Added photo monitoring with local notifications and SnackBars.
- Added separate notification channel and ID.
- Added role-aware timing notifications and tests.
| File | Description | Review notes |
|---|---|---|
test/features/room/view_model/photo_capture_controller_test.dart |
Tests role-aware timing notifications | — |
test/features/room/photo_taken_notifications_test.dart |
Tests photo notification behavior | — |
test/core/utils/local_notifications_test.dart |
Tests notification ID separation | — |
lib/features/room/view/game_page.dart |
Wires notification behavior into gameplay | — |
lib/features/room/view_model/photo_capture_controller.dart |
Controls timing notifications by role | — |
lib/features/room/photo_taken_notifications.dart |
Detects and displays photo events | Three moderate issues remain around duplicate names, cached initial state, and role-state synchronization. |
lib/core/utils/local_notifications.dart |
Adds photo-taken notification support | Documentation nit: reference the actual capture notification channel name. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| String photoTakenMessage(List<String> displayNames) { | ||
| final names = <String>{for (final name in displayNames) '$nameさん'}; | ||
| return '${names.join('、')}が足元の写真を撮りました'; |
| ref.listen(photosStreamProvider(roomId), (prev, next) { | ||
| final photos = next.value; | ||
| if (photos == null) return; |
Copilotのレビュー指摘への対応。 - 通知の本文で重複を除く単位を名前からuidに変えた。同じ名前の別人が 1人にまとまっていた - 写真の一覧がすでに読み込まれた状態で画面が開くと、ref.listenはその値 では呼ばれず、次に増えた写真が基準扱いになって通知が漏れていた。 読み込み済みの一覧を先に基準にする - 役割はbuild時点の値ではなく、写真が届いた時点の最新のルームから読む Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

背景 / 目的
Closes #120
9/24のプレイテストで「鬼側に写真撮ったよの通知が来なかった」と報告があった。鬼は写真を撮らないが、全員の写真を見られる。ところが、逃走者が写真を撮ったことを鬼に知らせる機能はそもそも無かった。
また、「足元の写真を撮ってください」という撮影タイミングの通知は役割を問わず出していた。鬼は撮影しないので、鬼には不要な通知だった。ユーザーと相談し、鬼には撮影の通知を出し、撮影タイミングの通知は出さないことにした。
変更内容
photo_taken_notifications.dart(新規)usePhotoTakenNotifications: 写真の一覧を監視し、自分が鬼なら、新しく増えた他人の写真を端末通知とSnackBarで知らせるphotosToNotify、本文はphotoTakenMessage(例: 「たろうさん、はなこさんが足元の写真を撮りました」)local_notifications.dart:showPhotoTakenNotificationを追加。チャンネルとIDは撮影タイミングの通知と分けた。同じIDで出すので、続けて撮られると最新の内容に置き換わるphoto_capture_controller.dart:notifyWhenDue引数を追加し、鬼には撮影タイミングの通知を出さない。途中で鬼になった場合も、タイマーが発火した時点の役割に従うgame_page.dart: 上記の配線動作確認
flutter test: 全件成功flutter analyze: エラー・警告なしphotosToNotify: 最初の一覧では通知しない、鬼には新しい他人の写真を通知する、複数枚まとめて通知する、自分の写真・逃走者・役割不明では通知しないスクリーンショット / 動画
レビューで見てほしいところ
影響範囲・注意点
🤖 Generated with Claude Code