route chat-added-to-group to the convo, always alert on group removals

- chat-added-to-group: open the convo (recipient was just added, has access)
- chat-removed-from-group / chat-join-request-rejected: still open the
  Messages list, since the convo isn't accessible
- always show the in-foreground banner for chat-removed-from-group and
  chat-join-request-rejected, even if the recipient is currently in the
  affected convo

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
Samuel Newman
2026-05-19 17:33:23 +03:00
parent de7da593b7
commit 5d8e5edf35
2 changed files with 19 additions and 9 deletions
+6 -4
View File
@@ -949,8 +949,11 @@ function RoutesContainer({children}: React.PropsWithChildren<{}>) {
} }
} else if ( } else if (
payload.reason === 'chat-message' || payload.reason === 'chat-message' ||
payload.reason === 'chat-reaction' payload.reason === 'chat-reaction' ||
payload.reason === 'chat-added-to-group'
) { ) {
// chat-added-to-group routes to the convo because the recipient was
// just added and now has access.
// @ts-expect-error nested navigators aren't typed -sfn // @ts-expect-error nested navigators aren't typed -sfn
navigate('MessagesTab', { navigate('MessagesTab', {
screen: 'Messages', screen: 'Messages',
@@ -959,9 +962,8 @@ function RoutesContainer({children}: React.PropsWithChildren<{}>) {
}, },
}) })
} else { } else {
// chat-added-to-group, chat-removed-from-group, // chat-removed-from-group, chat-join-request-rejected: the convo is
// chat-join-request-rejected: open the Messages list without // no longer accessible to the recipient, so just open the list.
// targeting a specific conversation
// @ts-expect-error nested navigators aren't typed -sfn // @ts-expect-error nested navigators aren't typed -sfn
navigate('MessagesTab', {screen: 'Messages'}) navigate('MessagesTab', {screen: 'Messages'})
} }
+13 -5
View File
@@ -243,8 +243,11 @@ export function useNotificationsHandler() {
} }
} else if ( } else if (
payload.reason === 'chat-message' || payload.reason === 'chat-message' ||
payload.reason === 'chat-reaction' payload.reason === 'chat-reaction' ||
payload.reason === 'chat-added-to-group'
) { ) {
// chat-added-to-group routes to the convo because the recipient was
// just added and now has access.
navigation.dispatch(state => { navigation.dispatch(state => {
if (state.routes[0].name === 'Messages') { if (state.routes[0].name === 'Messages') {
if ( if (
@@ -278,9 +281,8 @@ export function useNotificationsHandler() {
} }
}) })
} else { } else {
// chat-added-to-group, chat-removed-from-group, // chat-removed-from-group, chat-join-request-rejected: the convo is
// chat-join-request-rejected: open the Messages list without // no longer accessible to the recipient, so just open the list.
// targeting a specific conversation
navigation.dispatch( navigation.dispatch(
CommonActions.navigate('MessagesTab', {screen: 'Messages'}), CommonActions.navigate('MessagesTab', {screen: 'Messages'}),
) )
@@ -314,7 +316,13 @@ export function useNotificationsHandler() {
isChatNotificationPayload(payload) && isChatNotificationPayload(payload) &&
payload.recipientDid === currentAccount?.did payload.recipientDid === currentAccount?.did
) { ) {
const shouldAlert = payload.convoId !== currentConvoId // chat-removed-from-group / chat-join-request-rejected always alert,
// even if the recipient is currently viewing the affected convo -
// they need to know they were removed/rejected.
const shouldAlert =
payload.reason === 'chat-removed-from-group' ||
payload.reason === 'chat-join-request-rejected' ||
payload.convoId !== currentConvoId
return { return {
shouldShowList: shouldAlert, shouldShowList: shouldAlert,
shouldShowBanner: shouldAlert, shouldShowBanner: shouldAlert,