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:
+6
-4
@@ -949,8 +949,11 @@ function RoutesContainer({children}: React.PropsWithChildren<{}>) {
|
||||
}
|
||||
} else if (
|
||||
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
|
||||
navigate('MessagesTab', {
|
||||
screen: 'Messages',
|
||||
@@ -959,9 +962,8 @@ function RoutesContainer({children}: React.PropsWithChildren<{}>) {
|
||||
},
|
||||
})
|
||||
} else {
|
||||
// chat-added-to-group, chat-removed-from-group,
|
||||
// chat-join-request-rejected: open the Messages list without
|
||||
// targeting a specific conversation
|
||||
// chat-removed-from-group, chat-join-request-rejected: the convo is
|
||||
// no longer accessible to the recipient, so just open the list.
|
||||
// @ts-expect-error nested navigators aren't typed -sfn
|
||||
navigate('MessagesTab', {screen: 'Messages'})
|
||||
}
|
||||
|
||||
@@ -243,8 +243,11 @@ export function useNotificationsHandler() {
|
||||
}
|
||||
} else if (
|
||||
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 => {
|
||||
if (state.routes[0].name === 'Messages') {
|
||||
if (
|
||||
@@ -278,9 +281,8 @@ export function useNotificationsHandler() {
|
||||
}
|
||||
})
|
||||
} else {
|
||||
// chat-added-to-group, chat-removed-from-group,
|
||||
// chat-join-request-rejected: open the Messages list without
|
||||
// targeting a specific conversation
|
||||
// chat-removed-from-group, chat-join-request-rejected: the convo is
|
||||
// no longer accessible to the recipient, so just open the list.
|
||||
navigation.dispatch(
|
||||
CommonActions.navigate('MessagesTab', {screen: 'Messages'}),
|
||||
)
|
||||
@@ -314,7 +316,13 @@ export function useNotificationsHandler() {
|
||||
isChatNotificationPayload(payload) &&
|
||||
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 {
|
||||
shouldShowList: shouldAlert,
|
||||
shouldShowBanner: shouldAlert,
|
||||
|
||||
Reference in New Issue
Block a user