Skip to content

Route group-invite push notifs to the invite preview sheet#5898

Open
patosullivan wants to merge 1 commit into
developfrom
po/tlon-5887-group-invite-notifications-dont-route
Open

Route group-invite push notifs to the invite preview sheet#5898
patosullivan wants to merge 1 commit into
developfrom
po/tlon-5887-group-invite-notifications-dont-route

Conversation

@patosullivan

@patosullivan patosullivan commented Jun 5, 2026

Copy link
Copy Markdown
Member

Summary

Fixes TLON-5887: group-invite push notifications not routing anywhere when tapped. The parser returned null for group-invite events, so the notification listener had nothing to navigate to. This parses the event and routes the tap to the chat list, opening the group preview sheet in a loading state until the invite row lands, then showing Accept/Reject.

Changes

  • Parsed group-invite push events into a routeable { type: 'groupInvite', groupId } payload and added GroupInviteNotificationData to the notification union, in apps/tlon-mobile/src/lib/notificationPayload.ts. Removed group-invite from the return null fallthrough (other unsupported events still return null).
  • Added a groupInvite case to the notification listener in apps/tlon-mobile/src/hooks/useNotificationListener.ts. It resets to ChatList via the exported groupInvitePreviewRouteStack(groupId) helper, using the existing createTypedReset pattern so the destination is deterministic from any starting stack (cold start, a channel screen, or already on ChatList).
  • Added a previewGroupFromInviteNotification?: boolean marker to the ChatList route params in packages/app/navigation/types.ts. It is set only by the notification route; deep links and other callers omit it.
  • Added notification-scoped invite gating to packages/app/features/top/ChatListScreen.tsx. It tracks the invite-notification group distinctly from normal selections, reacts to a later previewGroupId param (mirroring desktop HomeSidebar) so a tap while already mounted reopens the sheet, and runs a group-keyed, sync-readiness-gated bounded timer that only counts down once connStatus === 'Connected' and session.phase is low/ready. If the invite never resolves within the window it closes the sheet and logs ErrorPushNotifNavigate rather than degrading to generic group-preview actions.
  • Added packages/app/features/top/groupInvitePreview.ts, a pure module holding the sheet open/group/terminal-close decision logic (the component still owns timer setup and sync-readiness gating). isGroupInviteReady is true only on a landed invite or existing membership (deliberately excludes haveRequestedInvite), and getGroupInviteSheetState reduces non-notification selections to today's exact behavior while giving notification selections the loading-spinner-until-ready, never-hand-a-non-ready-row, bounded-close treatment.
  • Added tests: a group-invite parser test plus route-stack and classification asserts in apps/tlon-mobile/src/__uitests__/useNotificationListener.test.ts, and unit coverage for isGroupInviteReady and getGroupInviteSheetState (including the stale-A-vs-B and terminal-close cases) in packages/app/features/top/groupInvitePreview.test.ts.

How did I test?

  • Manually verified on physical Android and iOS devices.

Risks and impact

  • Safe to rollback without consulting PR author? Yes
  • Affects important code area:
    • Notifications

Rollback plan

Revert.

@patosullivan patosullivan requested a review from Copilot June 5, 2026 18:14
@linear-code

linear-code Bot commented Jun 5, 2026

Copy link
Copy Markdown

TLON-5887

Copilot AI left a comment

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.

Pull request overview

Fixes mobile handling of group-invite push notification taps by parsing them into a routable payload and resetting navigation to ChatList, where the group preview sheet is opened in a notification-specific “loading until invite is ready” mode with a bounded timeout fallback.

Changes:

  • Parse group-invite activity events into { type: 'groupInvite', groupId } notification payloads and add routing for them in the notification listener.
  • Extend ChatList navigation params with an invite marker and add notification-scoped gating/timeout logic for the group preview sheet.
  • Add a pure decision module (groupInvitePreview.ts) with unit tests, plus routing/parser tests in mobile UI tests.

Reviewed changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
packages/app/navigation/types.ts Extends ChatList route params to include previewGroupIsInvite?: boolean for notification-origin routing.
packages/app/features/top/groupInvitePreview.ts Adds pure gating/decision logic for invite-preview sheet behavior on notification path.
packages/app/features/top/groupInvitePreview.test.ts Unit tests for invite readiness and sheet-state reduction logic.
packages/app/features/top/ChatListScreen.tsx Implements notification-specific invite gating + bounded timeout and wires it into GroupPreviewSheet.
apps/tlon-mobile/src/lib/notificationPayload.ts Parses group-invite events into a routable groupInvite notification payload.
apps/tlon-mobile/src/hooks/useNotificationListener.ts Adds route-stack helper + listener routing case to reset to ChatList invite preview.
apps/tlon-mobile/src/uitests/useNotificationListener.test.ts Adds tests for group-invite parsing, route-stack construction, and route classification.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread apps/tlon-mobile/src/lib/notificationPayload.ts Outdated
@patosullivan patosullivan force-pushed the po/tlon-5887-group-invite-notifications-dont-route branch from b002ff8 to 236b511 Compare June 5, 2026 18:25
@patosullivan patosullivan force-pushed the po/tlon-5887-group-invite-notifications-dont-route branch from 236b511 to f1a2d16 Compare June 5, 2026 18:28
@patosullivan patosullivan requested a review from Copilot June 5, 2026 18:28

Copilot AI left a comment

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.

Pull request overview

Copilot reviewed 7 out of 7 changed files in this pull request and generated no new comments.

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