@openpeepshq/rn-components 0.24.0 → 0.28.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (26) hide show
  1. package/package.json +2 -2
  2. package/src/components/conversations/ConversationPreviewCard.test.tsx +345 -0
  3. package/src/components/conversations/ConversationPreviewCard.tsx +29 -24
  4. package/src/components/custom/navigation/side-menu.test.tsx +9 -0
  5. package/src/components/custom/navigation/side-menu.tsx +19 -3
  6. package/src/components/groups/GroupAvatar.test.tsx +20 -2
  7. package/src/components/groups/GroupAvatar.tsx +7 -1
  8. package/src/components/jams/JamCallParticipant.test.tsx +303 -0
  9. package/src/components/jams/JamCallParticipant.tsx +7 -1
  10. package/src/components/jams/useLateTrackMediaStream.test.ts +139 -25
  11. package/src/components/jams/useLateTrackMediaStream.ts +62 -19
  12. package/src/components/post/pieces/ShareMenu.test.tsx +105 -11
  13. package/src/components/post/pieces/ShareMenu.tsx +55 -10
  14. package/src/components/post/pieces/modals/SendToConversationModal.tsx +140 -0
  15. package/src/components/post/pieces/modals/ShareIntoGroupModal.tsx +121 -0
  16. package/src/components/post/pieces/modals/index.ts +2 -0
  17. package/src/components/post/pieces/sharePickers.test.tsx +819 -0
  18. package/src/components/profile/Avatar.test.tsx +19 -0
  19. package/src/components/profile/Avatar.tsx +9 -1
  20. package/src/lib/push-notifications.test.ts +244 -0
  21. package/src/lib/push-notifications.ts +65 -0
  22. package/src/pages/auth/Login.tsx +16 -2
  23. package/src/pages/conversations/Index.test.tsx +235 -0
  24. package/src/pages/conversations/Index.tsx +15 -16
  25. package/src/pages/settings/Account.test.tsx +4 -0
  26. package/src/pages/settings/Account.tsx +14 -0
@@ -101,6 +101,10 @@ jest.mock('../../lib/downloadFile', () => ({
101
101
  downloadDocument,
102
102
  }));
103
103
 
104
+ jest.mock('../../lib/push-notifications', () => ({
105
+ unregisterPushForLogout: jest.fn(async () => 'ok'),
106
+ }));
107
+
104
108
  jest.mock('../../components/ui/themed-view', () => ({
105
109
  ThemedView: (props: { children?: unknown }) =>
106
110
  React.createElement('ThemedView', null, props.children),
@@ -13,6 +13,7 @@ import { Account } from '@openpeepshq/common';
13
13
  import { ActivityIndicator, View } from 'react-native';
14
14
  import { useTranslation } from 'react-i18next';
15
15
  import { downloadDocument } from '../../lib/downloadFile';
16
+ import { unregisterPushForLogout } from '../../lib/push-notifications';
16
17
 
17
18
  type AccountSettingsProps = MainScreenProps<'AccountSettings'>;
18
19
 
@@ -139,7 +140,20 @@ export const AccountSettings: React.FC<AccountSettingsProps> = () => {
139
140
  await queryClient.invalidateQueries({
140
141
  queryKey: ['profile'],
141
142
  });
143
+ // Best-effort cleanup (never throws); logout always follows. The RN
144
+ // side owns FCM cleanup, so this outcome — not the web pushCleanup
145
+ // flag — is what the logout toast reflects on native.
146
+ const pushResult = await unregisterPushForLogout(client);
142
147
  await logout();
148
+ if (pushResult === 'failed') {
149
+ Toast.show({
150
+ type: 'error',
151
+ text1: t('settings.notifications.pushCleanupFailed', {
152
+ defaultValue:
153
+ 'Could not remove push notifications for this device.',
154
+ }),
155
+ });
156
+ }
143
157
  })
144
158
  .catch((err) => {
145
159
  console.log('response', err);