Route group-invite push notifs to the invite preview sheet#5898
Open
patosullivan wants to merge 1 commit into
Open
Route group-invite push notifs to the invite preview sheet#5898patosullivan wants to merge 1 commit into
patosullivan wants to merge 1 commit into
Conversation
Contributor
There was a problem hiding this comment.
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-inviteactivity events into{ type: 'groupInvite', groupId }notification payloads and add routing for them in the notification listener. - Extend
ChatListnavigation 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.
b002ff8 to
236b511
Compare
236b511 to
f1a2d16
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes TLON-5887: group-invite push notifications not routing anywhere when tapped. The parser returned
nullforgroup-inviteevents, 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
group-invitepush events into a routeable{ type: 'groupInvite', groupId }payload and addedGroupInviteNotificationDatato the notification union, inapps/tlon-mobile/src/lib/notificationPayload.ts. Removedgroup-invitefrom thereturn nullfallthrough (other unsupported events still returnnull).groupInvitecase to the notification listener inapps/tlon-mobile/src/hooks/useNotificationListener.ts. It resets toChatListvia the exportedgroupInvitePreviewRouteStack(groupId)helper, using the existingcreateTypedResetpattern so the destination is deterministic from any starting stack (cold start, a channel screen, or already on ChatList).previewGroupFromInviteNotification?: booleanmarker to theChatListroute params inpackages/app/navigation/types.ts. It is set only by the notification route; deep links and other callers omit it.packages/app/features/top/ChatListScreen.tsx. It tracks the invite-notification group distinctly from normal selections, reacts to a laterpreviewGroupIdparam (mirroring desktopHomeSidebar) so a tap while already mounted reopens the sheet, and runs a group-keyed, sync-readiness-gated bounded timer that only counts down onceconnStatus === 'Connected'andsession.phaseislow/ready. If the invite never resolves within the window it closes the sheet and logsErrorPushNotifNavigaterather than degrading to generic group-preview actions.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).isGroupInviteReadyis true only on a landed invite or existing membership (deliberately excludeshaveRequestedInvite), andgetGroupInviteSheetStatereduces 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.group-inviteparser test plus route-stack and classification asserts inapps/tlon-mobile/src/__uitests__/useNotificationListener.test.ts, and unit coverage forisGroupInviteReadyandgetGroupInviteSheetState(including the stale-A-vs-B and terminal-close cases) inpackages/app/features/top/groupInvitePreview.test.ts.How did I test?
Risks and impact
Rollback plan
Revert.