Skip to content

Implement foreground push filtering to suppress banners for active chatroom - #784

Merged
tentamdin merged 2 commits into
developfrom
fix/pushBannerInOpenRoom
Sep 17, 2026
Merged

tentamdin merged 2 commits into
developfrom
fix/pushBannerInOpenRoom

Conversation

@harshal-2304

Copy link
Copy Markdown
Member

No description provided.

@harshal-2304 harshal-2304 self-assigned this Sep 16, 2026
@harshal-2304
harshal-2304 added this pull request to stack #782 September 16, 2026 10:25
@harshal-2304
harshal-2304 marked this pull request as draft September 16, 2026 10:26
@harshal-2304
harshal-2304 force-pushed the fix/pushBannerInOpenRoom branch from 8dc5c0d to eea46dd Compare September 16, 2026 10:27
@greptile-apps

greptile-apps Bot commented Sep 16, 2026

Copy link
Copy Markdown
Contributor

RetriggerConfidence Score: 5/5

The PR appears safe to merge, with the previously missing integration coverage now present.

Findings

  1. P2 Integration coverage is missing
Fix with agent prompt
### Issue 1
test/features/push_notifications/foreground_push_filter_test.dart:15-18
These tests cover the filter registry in isolation, but they do not mount `GroupChatScreen` to exercise the route, lifecycle, room-targeting, and disposal conditions that control actual suppression. A widget test for an active matching room, a covered or backgrounded screen, and claim release during disposal would prevent regressions that hide unrelated notifications or show banners for the active chat.

Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!

---

For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.

Summary

This PR adds foreground push filtering so notifications for the currently visible group chat do not display redundant banners.

  • Introduces an app-lifetime registry of screen-owned push matchers.
  • Registers and releases the group chat’s matcher with route and lifecycle guards.
  • Applies filtering only to foreground local notifications.
  • Adds unit and widget coverage for targeting, covered routes, lifecycle changes, and disposal.
  • The previous integration-coverage finding is fully addressed by the new widget tests.
Diagram
%%{init: {'theme': 'neutral'}}%%
flowchart TD
  A[Foreground push received] --> B[PushNotificationService]
  B --> C{Message has notification?}
  C -- No --> D[Do not show banner]
  C -- Yes --> E[ForegroundPushFilter]
  E --> F{Active screen claims push?}
  F -- Yes --> D
  F -- No --> G[Show local notification]
  H[GroupChatScreen] -->|claim matcher on init| E
  H -->|release matcher on dispose| E
  H --> I{App resumed and route current?}
  I -- Yes --> J[Match room or group target]
  I -- No --> K[Do not claim push]
Loading

Reviews (4) · Last reviewed commit: "Add tests for foreground push filtering ..."

Comment on lines +15 to +18
expect(filter.shouldShow(roomX), isTrue);
expect(filter.shouldShow(const {}), isTrue);
});

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

P2 Integration coverage is missing

These tests cover the filter registry in isolation, but they do not mount GroupChatScreen to exercise the route, lifecycle, room-targeting, and disposal conditions that control actual suppression. A widget test for an active matching room, a covered or backgrounded screen, and claim release during disposal would prevent regressions that hide unrelated notifications or show banners for the active chat.

Prompt To Fix With AI
This is a comment left during a code review.
Path: test/features/push_notifications/foreground_push_filter_test.dart
Line: 15-18

Comment:
**Integration coverage is missing**

These tests cover the filter registry in isolation, but they do not mount `GroupChatScreen` to exercise the route, lifecycle, room-targeting, and disposal conditions that control actual suppression. A widget test for an active matching room, a covered or backgrounded screen, and claim release during disposal would prevent regressions that hide unrelated notifications or show banners for the active chat.

---

For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.

Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!

@harshal-2304
harshal-2304 marked this pull request as ready for review September 16, 2026 10:28
@harshal-2304
harshal-2304 marked this pull request as draft September 16, 2026 10:45
@harshal-2304
harshal-2304 marked this pull request as ready for review September 16, 2026 10:45
@harshal-2304
harshal-2304 marked this pull request as draft September 16, 2026 10:52
@harshal-2304
harshal-2304 marked this pull request as ready for review September 16, 2026 10:52
@tentamdin
tentamdin force-pushed the fix/pushBannerInOpenRoom branch from 433cafd to cbf1a2f Compare September 17, 2026 10:58
Base automatically changed from feat/chatAnalytics to develop September 17, 2026 17:36
@tentamdin
tentamdin force-pushed the fix/pushBannerInOpenRoom branch from cbf1a2f to 4442d2c Compare September 17, 2026 17:36
@tentamdin
tentamdin merged commit 4b9c633 into develop Sep 17, 2026
1 check failed
@TenzDelek
TenzDelek deleted the fix/pushBannerInOpenRoom branch September 18, 2026 06:25
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.

2 participants