@planningcenter/chat-react-native 4.7.1-qa-1092.0 → 4.7.1-qa-staging.3

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 (221) hide show
  1. package/build/components/conversation/attachments/expanded_link.js +8 -8
  2. package/build/components/conversation/attachments/expanded_link.js.map +1 -1
  3. package/build/components/conversation/attachments/generic_file_attachment.d.ts.map +1 -1
  4. package/build/components/conversation/attachments/generic_file_attachment.js +2 -2
  5. package/build/components/conversation/attachments/generic_file_attachment.js.map +1 -1
  6. package/build/components/conversation/attachments/giphy_attachment.d.ts.map +1 -1
  7. package/build/components/conversation/attachments/giphy_attachment.js +2 -2
  8. package/build/components/conversation/attachments/giphy_attachment.js.map +1 -1
  9. package/build/components/conversation/attachments/image_attachment.js +2 -2
  10. package/build/components/conversation/attachments/image_attachment.js.map +1 -1
  11. package/build/components/conversation/message_form.js +2 -2
  12. package/build/components/conversation/message_form.js.map +1 -1
  13. package/build/components/conversation/message_markdown.js +2 -2
  14. package/build/components/conversation/message_markdown.js.map +1 -1
  15. package/build/components/conversations/conversation_actions.d.ts.map +1 -1
  16. package/build/components/conversations/conversation_actions.js +333 -193
  17. package/build/components/conversations/conversation_actions.js.map +1 -1
  18. package/build/components/conversations/conversation_preview.d.ts.map +1 -1
  19. package/build/components/conversations/conversation_preview.js +106 -91
  20. package/build/components/conversations/conversation_preview.js.map +1 -1
  21. package/build/components/conversations/conversations.d.ts.map +1 -1
  22. package/build/components/conversations/conversations.js +63 -56
  23. package/build/components/conversations/conversations.js.map +1 -1
  24. package/build/components/conversations/conversations_blank_state.d.ts +2 -1
  25. package/build/components/conversations/conversations_blank_state.d.ts.map +1 -1
  26. package/build/components/conversations/conversations_blank_state.js +71 -39
  27. package/build/components/conversations/conversations_blank_state.js.map +1 -1
  28. package/build/components/conversations/hidden_indicator.d.ts +4 -0
  29. package/build/components/conversations/hidden_indicator.d.ts.map +1 -0
  30. package/build/components/conversations/hidden_indicator.js +52 -0
  31. package/build/components/conversations/hidden_indicator.js.map +1 -0
  32. package/build/components/conversations/hidden_results_footer.d.ts +2 -0
  33. package/build/components/conversations/hidden_results_footer.d.ts.map +1 -0
  34. package/build/components/conversations/hidden_results_footer.js +34 -0
  35. package/build/components/conversations/hidden_results_footer.js.map +1 -0
  36. package/build/components/display/toast.d.ts +3 -0
  37. package/build/components/display/toast.d.ts.map +1 -0
  38. package/build/components/display/toast.js +224 -0
  39. package/build/components/display/toast.js.map +1 -0
  40. package/build/components/group_conversation_list.d.ts.map +1 -1
  41. package/build/components/group_conversation_list.js +1 -0
  42. package/build/components/group_conversation_list.js.map +1 -1
  43. package/build/contexts/conversations_context.d.ts +3 -1
  44. package/build/contexts/conversations_context.d.ts.map +1 -1
  45. package/build/contexts/conversations_context.js +39 -31
  46. package/build/contexts/conversations_context.js.map +1 -1
  47. package/build/hooks/groups/use_group_members_for_new_conversation.d.ts +6 -0
  48. package/build/hooks/groups/use_group_members_for_new_conversation.d.ts.map +1 -1
  49. package/build/hooks/use_api.d.ts +6 -0
  50. package/build/hooks/use_api.d.ts.map +1 -1
  51. package/build/hooks/use_api.js +8 -5
  52. package/build/hooks/use_api.js.map +1 -1
  53. package/build/hooks/use_clear_conversation_filters.d.ts.map +1 -1
  54. package/build/hooks/use_clear_conversation_filters.js +1 -0
  55. package/build/hooks/use_clear_conversation_filters.js.map +1 -1
  56. package/build/hooks/use_conversation.d.ts.map +1 -1
  57. package/build/hooks/use_conversation.js +1 -1
  58. package/build/hooks/use_conversation.js.map +1 -1
  59. package/build/hooks/use_features.d.ts +1 -0
  60. package/build/hooks/use_features.d.ts.map +1 -1
  61. package/build/hooks/use_features.js +2 -1
  62. package/build/hooks/use_features.js.map +1 -1
  63. package/build/hooks/use_groups.d.ts +6 -0
  64. package/build/hooks/use_groups.d.ts.map +1 -1
  65. package/build/hooks/use_groups_groups.d.ts +6 -0
  66. package/build/hooks/use_groups_groups.d.ts.map +1 -1
  67. package/build/hooks/use_hidden_conversations_count.d.ts +2 -0
  68. package/build/hooks/use_hidden_conversations_count.d.ts.map +1 -0
  69. package/build/hooks/use_hidden_conversations_count.js +32 -0
  70. package/build/hooks/use_hidden_conversations_count.js.map +1 -0
  71. package/build/hooks/use_hide_conversation.d.ts +108 -0
  72. package/build/hooks/use_hide_conversation.d.ts.map +1 -0
  73. package/build/hooks/use_hide_conversation.js +243 -0
  74. package/build/hooks/use_hide_conversation.js.map +1 -0
  75. package/build/hooks/use_hide_conversations_enabled.d.ts +2 -0
  76. package/build/hooks/use_hide_conversations_enabled.d.ts.map +1 -0
  77. package/build/hooks/use_hide_conversations_enabled.js +18 -0
  78. package/build/hooks/use_hide_conversations_enabled.js.map +1 -0
  79. package/build/hooks/use_teams.d.ts +6 -0
  80. package/build/hooks/use_teams.d.ts.map +1 -1
  81. package/build/navigation/index.d.ts +5 -0
  82. package/build/navigation/index.d.ts.map +1 -1
  83. package/build/navigation/index.js +5 -0
  84. package/build/navigation/index.js.map +1 -1
  85. package/build/screens/age_check/age_check_underage_screen.js +3 -3
  86. package/build/screens/age_check/age_check_underage_screen.js.map +1 -1
  87. package/build/screens/attachment_actions/attachment_actions_screen.js +2 -2
  88. package/build/screens/attachment_actions/attachment_actions_screen.js.map +1 -1
  89. package/build/screens/bug_report_screen.js +4 -4
  90. package/build/screens/bug_report_screen.js.map +1 -1
  91. package/build/screens/conversation_actions_screen.d.ts +7 -0
  92. package/build/screens/conversation_actions_screen.d.ts.map +1 -0
  93. package/build/screens/conversation_actions_screen.js +89 -0
  94. package/build/screens/conversation_actions_screen.js.map +1 -0
  95. package/build/screens/conversation_details_screen.d.ts.map +1 -1
  96. package/build/screens/conversation_details_screen.js +460 -394
  97. package/build/screens/conversation_details_screen.js.map +1 -1
  98. package/build/screens/conversation_filters/components/conversation_filters.d.ts.map +1 -1
  99. package/build/screens/conversation_filters/components/conversation_filters.js +53 -12
  100. package/build/screens/conversation_filters/components/conversation_filters.js.map +1 -1
  101. package/build/screens/conversation_filters/components/rows.d.ts +6 -3
  102. package/build/screens/conversation_filters/components/rows.d.ts.map +1 -1
  103. package/build/screens/conversation_filters/components/rows.js +99 -62
  104. package/build/screens/conversation_filters/components/rows.js.map +1 -1
  105. package/build/screens/conversation_filters/context/conversation_filter_context.d.ts.map +1 -1
  106. package/build/screens/conversation_filters/context/conversation_filter_context.js +4 -0
  107. package/build/screens/conversation_filters/context/conversation_filter_context.js.map +1 -1
  108. package/build/screens/conversation_filters/filter_types.d.ts +1 -0
  109. package/build/screens/conversation_filters/filter_types.d.ts.map +1 -1
  110. package/build/screens/conversation_filters/filter_types.js +1 -0
  111. package/build/screens/conversation_filters/filter_types.js.map +1 -1
  112. package/build/screens/conversation_filters/hooks/filters.d.ts +12 -0
  113. package/build/screens/conversation_filters/hooks/filters.d.ts.map +1 -1
  114. package/build/screens/conversation_filters/screen_props.d.ts +1 -0
  115. package/build/screens/conversation_filters/screen_props.d.ts.map +1 -1
  116. package/build/screens/conversation_filters/screen_props.js.map +1 -1
  117. package/build/screens/conversations/components/filter_dropdown_list_header_component.d.ts.map +1 -1
  118. package/build/screens/conversations/components/filter_dropdown_list_header_component.js +138 -126
  119. package/build/screens/conversations/components/filter_dropdown_list_header_component.js.map +1 -1
  120. package/build/screens/conversations/components/list_header_component.d.ts.map +1 -1
  121. package/build/screens/conversations/components/list_header_component.js +95 -90
  122. package/build/screens/conversations/components/list_header_component.js.map +1 -1
  123. package/build/screens/conversations/components/search_list_header_component.d.ts.map +1 -1
  124. package/build/screens/conversations/components/search_list_header_component.js +100 -95
  125. package/build/screens/conversations/components/search_list_header_component.js.map +1 -1
  126. package/build/screens/conversations/conversations_screen.d.ts +1 -0
  127. package/build/screens/conversations/conversations_screen.d.ts.map +1 -1
  128. package/build/screens/conversations/conversations_screen.js +18 -10
  129. package/build/screens/conversations/conversations_screen.js.map +1 -1
  130. package/build/screens/get_help_screen.d.ts.map +1 -1
  131. package/build/screens/get_help_screen.js +5 -21
  132. package/build/screens/get_help_screen.js.map +1 -1
  133. package/build/screens/index.d.ts +1 -0
  134. package/build/screens/index.d.ts.map +1 -1
  135. package/build/screens/index.js +1 -0
  136. package/build/screens/index.js.map +1 -1
  137. package/build/types/resources/conversation_membership.d.ts +1 -0
  138. package/build/types/resources/conversation_membership.d.ts.map +1 -1
  139. package/build/types/resources/conversation_membership.js.map +1 -1
  140. package/build/utils/index.d.ts +1 -0
  141. package/build/utils/index.d.ts.map +1 -1
  142. package/build/utils/index.js +1 -0
  143. package/build/utils/index.js.map +1 -1
  144. package/build/utils/open_url.d.ts +11 -0
  145. package/build/utils/open_url.d.ts.map +1 -0
  146. package/build/utils/open_url.js +46 -0
  147. package/build/utils/open_url.js.map +1 -0
  148. package/build/utils/request/conversation.d.ts +3 -1
  149. package/build/utils/request/conversation.d.ts.map +1 -1
  150. package/build/utils/request/conversation.js +4 -0
  151. package/build/utils/request/conversation.js.map +1 -1
  152. package/build/utils/toast_store.d.ts +21 -0
  153. package/build/utils/toast_store.d.ts.map +1 -0
  154. package/build/utils/toast_store.js +27 -0
  155. package/build/utils/toast_store.js.map +1 -0
  156. package/build/vendor/font_awesome_pro_solid_icons.d.ts +1 -0
  157. package/build/vendor/font_awesome_pro_solid_icons.d.ts.map +1 -1
  158. package/build/vendor/font_awesome_pro_solid_icons.js +5 -0
  159. package/build/vendor/font_awesome_pro_solid_icons.js.map +1 -1
  160. package/package.json +3 -3
  161. package/src/__tests__/components/conversation/attachments/giphy_attachment.test.tsx +1 -1
  162. package/src/__tests__/screens/conversation_filters/components/conversation_filters.test.tsx +6 -0
  163. package/src/__tests__/screens/get_help_screen.test.ts +1 -1
  164. package/src/components/conversation/attachments/expanded_link.tsx +4 -4
  165. package/src/components/conversation/attachments/generic_file_attachment.tsx +2 -5
  166. package/src/components/conversation/attachments/giphy_attachment.tsx +2 -4
  167. package/src/components/conversation/attachments/image_attachment.tsx +2 -2
  168. package/src/components/conversation/message_form.tsx +2 -2
  169. package/src/components/conversation/message_markdown.tsx +2 -2
  170. package/src/components/conversations/__tests__/conversation_actions.test.tsx +77 -2
  171. package/src/components/conversations/__tests__/conversation_preview.test.tsx +29 -0
  172. package/src/components/conversations/__tests__/conversations.test.tsx +26 -0
  173. package/src/components/conversations/__tests__/conversations_blank_state.test.tsx +17 -0
  174. package/src/components/conversations/conversation_actions.tsx +73 -4
  175. package/src/components/conversations/conversation_preview.tsx +12 -1
  176. package/src/components/conversations/conversations.tsx +9 -0
  177. package/src/components/conversations/conversations_blank_state.tsx +18 -0
  178. package/src/components/conversations/hidden_indicator.tsx +30 -0
  179. package/src/components/conversations/hidden_results_footer.tsx +25 -0
  180. package/src/components/display/__tests__/toast.test.tsx +55 -0
  181. package/src/components/display/toast.tsx +115 -0
  182. package/src/components/group_conversation_list.tsx +4 -1
  183. package/src/contexts/conversations_context.tsx +8 -1
  184. package/src/hooks/__tests__/use_hide_conversation.test.tsx +189 -0
  185. package/src/hooks/use_api.ts +2 -1
  186. package/src/hooks/use_clear_conversation_filters.ts +1 -0
  187. package/src/hooks/use_conversation.ts +1 -0
  188. package/src/hooks/use_features.ts +1 -0
  189. package/src/hooks/use_hidden_conversations_count.ts +14 -0
  190. package/src/hooks/use_hide_conversation.ts +128 -0
  191. package/src/hooks/use_hide_conversations_enabled.ts +7 -0
  192. package/src/navigation/index.tsx +8 -0
  193. package/src/screens/__tests__/conversation_actions_screen.test.tsx +79 -0
  194. package/src/screens/__tests__/conversation_details_screen.test.tsx +49 -1
  195. package/src/screens/age_check/age_check_underage_screen.tsx +3 -3
  196. package/src/screens/attachment_actions/attachment_actions_screen.tsx +2 -2
  197. package/src/screens/bug_report_screen.tsx +4 -4
  198. package/src/screens/conversation_actions_screen.tsx +53 -0
  199. package/src/screens/conversation_details_screen.tsx +19 -0
  200. package/src/screens/conversation_filters/__tests__/conversation_filters.test.tsx +42 -0
  201. package/src/screens/conversation_filters/components/conversation_filters.tsx +22 -3
  202. package/src/screens/conversation_filters/components/rows.tsx +44 -10
  203. package/src/screens/conversation_filters/context/conversation_filter_context.tsx +4 -0
  204. package/src/screens/conversation_filters/filter_types.ts +1 -0
  205. package/src/screens/conversation_filters/screen_props.ts +1 -0
  206. package/src/screens/conversations/__tests__/conversations_screen.test.tsx +1 -0
  207. package/src/screens/conversations/components/__tests__/filter_dropdown_list_header_component.test.tsx +42 -0
  208. package/src/screens/conversations/components/__tests__/list_header_component.test.tsx +1 -0
  209. package/src/screens/conversations/components/filter_dropdown_list_header_component.tsx +21 -5
  210. package/src/screens/conversations/components/list_header_component.tsx +14 -4
  211. package/src/screens/conversations/components/search_list_header_component.tsx +14 -4
  212. package/src/screens/conversations/conversations_screen.tsx +3 -0
  213. package/src/screens/get_help_screen.tsx +5 -19
  214. package/src/screens/index.ts +1 -0
  215. package/src/types/resources/conversation_membership.ts +1 -0
  216. package/src/utils/__tests__/open_url.test.ts +67 -0
  217. package/src/utils/index.ts +1 -0
  218. package/src/utils/open_url.ts +47 -0
  219. package/src/utils/request/conversation.ts +6 -0
  220. package/src/utils/toast_store.ts +45 -0
  221. package/src/vendor/font_awesome_pro_solid_icons.ts +12 -0
@@ -1,4 +1,4 @@
1
- import { DefaultTheme, ThemeProvider } from '@react-navigation/native'
1
+ import { DefaultTheme, StackActions, ThemeProvider } from '@react-navigation/native'
2
2
  import { QueryClientProvider } from '@tanstack/react-query'
3
3
  import { fireEvent, render } from '@testing-library/react-native'
4
4
  import React from 'react'
@@ -68,6 +68,12 @@ jest.mock('../../hooks/use_conversation', () => ({
68
68
  useConversationUpdate: () => ({ mutate: mockSaveTitle }),
69
69
  }))
70
70
 
71
+ let mockHidden = false
72
+ const mockSetHidden = jest.fn()
73
+ jest.mock('../../hooks/use_hide_conversation', () => ({
74
+ useHideConversation: () => ({ hidden: mockHidden, setHidden: mockSetHidden, isPending: false }),
75
+ }))
76
+
71
77
  let mockEnabledFeatures: string[] = []
72
78
  jest.mock('../../hooks/use_features', () => ({
73
79
  ...jest.requireActual('../../hooks/use_features'),
@@ -303,3 +309,45 @@ describe('ConversationDetailsScreen archive', () => {
303
309
  expect(mockArchive).not.toHaveBeenCalled()
304
310
  })
305
311
  })
312
+
313
+ describe('ConversationDetailsScreen hide', () => {
314
+ beforeEach(() => {
315
+ mockConversation = baseConversation
316
+ mockEnabledFeatures = ['ROLLOUT_hide_conversations']
317
+ mockHidden = false
318
+ jest.clearAllMocks()
319
+ })
320
+
321
+ it('hides the row when the flag is off', () => {
322
+ mockEnabledFeatures = []
323
+ const { queryByText } = renderScreen()
324
+
325
+ expect(queryByText('Hide conversation')).toBeNull()
326
+ })
327
+
328
+ it('hides the row for an archived conversation', () => {
329
+ mockConversation = archivedConversation
330
+ const { queryByText } = renderScreen()
331
+
332
+ expect(queryByText('Hide conversation')).toBeNull()
333
+ })
334
+
335
+ it('hides the conversation and returns to the list', () => {
336
+ const { getByText } = renderScreen()
337
+
338
+ fireEvent.press(getByText('Hide conversation'))
339
+
340
+ expect(mockSetHidden).toHaveBeenCalledWith(true)
341
+ expect(mockNavigation.dispatch).toHaveBeenCalledWith(StackActions.popToTop())
342
+ })
343
+
344
+ it('unhides a hidden conversation and stays on the details', () => {
345
+ mockHidden = true
346
+ const { getByText } = renderScreen()
347
+
348
+ fireEvent.press(getByText('Unhide conversation'))
349
+
350
+ expect(mockSetHidden).toHaveBeenCalledWith(false)
351
+ expect(mockNavigation.dispatch).not.toHaveBeenCalled()
352
+ })
353
+ })
@@ -4,7 +4,7 @@ import { StyleSheet, View, ScrollView } from 'react-native'
4
4
  import { Heading } from '../../components'
5
5
  import { Icon, Text, TextInlineButton } from '../../components/display'
6
6
  import { useTheme } from '../../hooks'
7
- import { Linking } from '../../utils'
7
+ import { openUrl } from '../../utils'
8
8
  import type { AgeCheckParams } from './screen_props'
9
9
 
10
10
  export interface AgeCheckUnderageScreenProps {
@@ -19,11 +19,11 @@ export function AgeCheckUnderageScreen({ contactEmail }: AgeCheckUnderageScreenP
19
19
 
20
20
  const openChurchAdminHelp = () => {
21
21
  if (!email) return
22
- Linking.openURL(`mailto:${email}`)
22
+ openUrl(`mailto:${email}`)
23
23
  }
24
24
 
25
25
  const openTerms = () => {
26
- Linking.openURL('https://www.planningcenter.com/terms')
26
+ openUrl('https://www.planningcenter.com/terms')
27
27
  }
28
28
 
29
29
  return (
@@ -3,7 +3,7 @@ import React, { useCallback } from 'react'
3
3
  import { Alert, StyleSheet } from 'react-native'
4
4
  import FormSheet, { getFormSheetScreenOptions } from '../../components/primitive/form_sheet'
5
5
  import { useConversation } from '../../hooks/use_conversation'
6
- import { Linking } from '../../utils'
6
+ import { openUrl } from '../../utils'
7
7
  import { useDeleteAttachment } from './hooks/useDeleteAttachment'
8
8
 
9
9
  export const AttachmentActionsScreenOptions = getFormSheetScreenOptions({
@@ -60,7 +60,7 @@ export function AttachmentActionsScreen({ route }: AttachmentActionsScreenProps)
60
60
  }, [attachmentName, handleDeleteAttachment, navigation])
61
61
 
62
62
  const handleOpenInBrowser = () => {
63
- Linking.openURL(attachmentUrl, { forceOpenInBrowser: true })
63
+ openUrl(attachmentUrl, { forceOpenInBrowser: true })
64
64
  navigation.goBack()
65
65
  }
66
66
 
@@ -30,7 +30,7 @@ import { useTheme } from '../hooks'
30
30
  import { useAppName } from '../hooks/use_app_name'
31
31
  import { useReportBugAction } from '../hooks/use_report_bug_action'
32
32
  import { useUploadClient } from '../hooks/use_upload_client'
33
- import { ImagePicker, ImagePickerResult, Linking, platformFontWeightBold } from '../utils'
33
+ import { ImagePicker, ImagePickerResult, openUrl, platformFontWeightBold } from '../utils'
34
34
 
35
35
  const MAX_DESCRIPTION_LENGTH = 2000
36
36
 
@@ -196,7 +196,7 @@ export function BugReportScreen() {
196
196
  <TextInlineButton
197
197
  accessibilityRole="link"
198
198
  onPress={() =>
199
- Linking.openURL('https://support.planningcenteronline.com/hc/en-us/requests/new')
199
+ openUrl('https://support.planningcenteronline.com/hc/en-us/requests/new')
200
200
  }
201
201
  >
202
202
  contact our help center
@@ -342,7 +342,7 @@ export function BugReportScreen() {
342
342
  <TextInlineButton
343
343
  accessibilityRole="link"
344
344
  variant="footnote"
345
- onPress={() => Linking.openURL(VIDEO_RECORDING_HELP_URL)}
345
+ onPress={() => openUrl(VIDEO_RECORDING_HELP_URL)}
346
346
  >
347
347
  How to record your screen
348
348
  </TextInlineButton>
@@ -355,7 +355,7 @@ export function BugReportScreen() {
355
355
  <TextInlineButton
356
356
  accessibilityRole="link"
357
357
  variant="footnote"
358
- onPress={() => Linking.openURL('https://www.planningcenter.com/privacy')}
358
+ onPress={() => openUrl('https://www.planningcenter.com/privacy')}
359
359
  >
360
360
  Privacy Policy
361
361
  </TextInlineButton>
@@ -0,0 +1,53 @@
1
+ import { StaticScreenProps, useNavigation } from '@react-navigation/native'
2
+ import React from 'react'
3
+ import { StyleSheet } from 'react-native'
4
+ import FormSheet, { getFormSheetScreenOptions } from '../components/primitive/form_sheet'
5
+ import { useConversation } from '../hooks/use_conversation'
6
+ import { useHideConversation } from '../hooks/use_hide_conversation'
7
+ import { useHideConversationsEnabled } from '../hooks/use_hide_conversations_enabled'
8
+
9
+ export const ConversationActionsScreenOptions = getFormSheetScreenOptions({
10
+ headerTitle: 'Conversation actions',
11
+ })
12
+
13
+ export type ConversationActionsScreenProps = StaticScreenProps<{
14
+ conversation_id: number
15
+ }>
16
+
17
+ export function ConversationActionsScreen({ route }: ConversationActionsScreenProps) {
18
+ const navigation = useNavigation()
19
+ const styles = useStyles()
20
+ const { data: conversation } = useConversation(route.params)
21
+ const { hidden, setHidden, isPending } = useHideConversation({ conversation })
22
+ const hideConversationsEnabled = useHideConversationsEnabled()
23
+
24
+ const handleHidePress = () => {
25
+ setHidden(!hidden)
26
+ navigation.goBack()
27
+ }
28
+
29
+ return (
30
+ <FormSheet.Root style={styles.formSheetContent}>
31
+ {hideConversationsEnabled && (
32
+ <FormSheet.Action
33
+ onPress={handleHidePress}
34
+ title={hidden ? 'Unhide conversation' : 'Hide conversation'}
35
+ iconName={hidden ? 'general.showEye' : 'general.hideEye'}
36
+ disabled={isPending}
37
+ accessibilityHint={
38
+ hidden
39
+ ? 'Shows this conversation in your conversation list again.'
40
+ : 'Hides this conversation from your conversation list.'
41
+ }
42
+ />
43
+ )}
44
+ </FormSheet.Root>
45
+ )
46
+ }
47
+
48
+ const useStyles = () =>
49
+ StyleSheet.create({
50
+ formSheetContent: {
51
+ paddingTop: 16,
52
+ },
53
+ })
@@ -50,6 +50,8 @@ import {
50
50
  useConversationUpdate,
51
51
  } from '../hooks/use_conversation'
52
52
  import { availableFeatures, useFeatures } from '../hooks/use_features'
53
+ import { useHideConversation } from '../hooks/use_hide_conversation'
54
+ import { useHideConversationsEnabled } from '../hooks/use_hide_conversations_enabled'
53
55
  import { useManualArchivingEnabled } from '../hooks/use_manual_archiving_enabled'
54
56
  import { usePreviewAvatarDiameter } from '../hooks/use_preview_avatar_diameter'
55
57
  import { useUnarchiveConversationAction } from '../hooks/use_unarchive_conversation_action'
@@ -115,6 +117,8 @@ export function ConversationDetailsScreen({ route }: ConversationDetailsScreenPr
115
117
  const granularNotificationsEnabled = featureEnabled(availableFeatures.granular_notifications_ui)
116
118
  const customAvatarsEnabled = featureEnabled(availableFeatures.custom_conversation_avatars)
117
119
  const manualArchivingEnabled = useManualArchivingEnabled()
120
+ const hideConversationsEnabled = useHideConversationsEnabled()
121
+ const { hidden, setHidden, isPending: isHidePending } = useHideConversation({ conversation })
118
122
  const showGenderFilter =
119
123
  featureEnabled(availableFeatures.gender_specific_conversations) && !!conversation.genderOption
120
124
  const genderLabel = conversation.genderOption ? genderDisplayLabel(conversation.genderOption) : ''
@@ -130,6 +134,7 @@ export function ConversationDetailsScreen({ route }: ConversationDetailsScreenPr
130
134
  const canSaveTitle = canUpdate && !emptyTitle
131
135
  const canDelete = conversation.memberAbility?.canDelete || false
132
136
  const canArchive = manualArchivingEnabled && (conversation.memberAbility?.canArchive || false)
137
+ const canHide = hideConversationsEnabled && !archived
133
138
  const isLeader = conversation.memberAbility?.leader || false
134
139
  const isDisabled = conversation.disabled ?? false
135
140
  const showAdultRequirementNotice = isDisabled && conversation.disabledReason === 'safety_check'
@@ -231,6 +236,11 @@ export function ConversationDetailsScreen({ route }: ConversationDetailsScreenPr
231
236
  )
232
237
  }, [setArchived])
233
238
 
239
+ const handleHide = useCallback(() => {
240
+ setHidden(!hidden)
241
+ if (!hidden) navigation.dispatch(StackActions.popToTop())
242
+ }, [hidden, navigation, setHidden])
243
+
234
244
  const HeaderTitle = useCallback(
235
245
  (props: HeaderTitleProps) => {
236
246
  return (
@@ -354,6 +364,15 @@ export function ConversationDetailsScreen({ route }: ConversationDetailsScreenPr
354
364
  },
355
365
  showBottomBorder: true,
356
366
  },
367
+ {
368
+ type: canHide ? SectionTypes.setting : SectionTypes.hidden,
369
+ data: {
370
+ title: hidden ? 'Unhide conversation' : 'Hide conversation',
371
+ disabled: isHidePending,
372
+ onPress: handleHide,
373
+ },
374
+ showBottomBorder: canArchive || canDelete,
375
+ },
357
376
  {
358
377
  type: canArchive ? SectionTypes.setting : SectionTypes.hidden,
359
378
  data: {
@@ -18,6 +18,14 @@ let mockCanBrowseArchived = false
18
18
  jest.mock('../../../hooks/use_can_browse_archived_conversations', () => ({
19
19
  useCanBrowseArchivedConversations: () => mockCanBrowseArchived,
20
20
  }))
21
+ let mockHideEnabled = false
22
+ jest.mock('../../../hooks/use_hide_conversations_enabled', () => ({
23
+ useHideConversationsEnabled: () => mockHideEnabled,
24
+ }))
25
+ let mockHiddenCount = 0
26
+ jest.mock('../../../hooks/use_hidden_conversations_count', () => ({
27
+ useHiddenConversationsCount: () => mockHiddenCount,
28
+ }))
21
29
  jest.mock('../../../hooks/use_direct_messages_eligible', () => ({
22
30
  useDirectMessagesEligible: () => false,
23
31
  }))
@@ -66,6 +74,7 @@ describe('ConversationFilters archived option', () => {
66
74
 
67
75
  expect(view.queryByText('Other')).toBeNull()
68
76
  expect(view.queryByText('Archived conversations')).toBeNull()
77
+ expect(view.queryByText('Hidden conversations')).toBeNull()
69
78
  })
70
79
 
71
80
  it('offers Archived under Other when the person can browse archived conversations', () => {
@@ -99,3 +108,36 @@ describe('ConversationFilters archived option', () => {
99
108
  expect(within(selected).getByText('Archived conversations')).toBeTruthy()
100
109
  })
101
110
  })
111
+
112
+ describe('ConversationFilters hidden option', () => {
113
+ beforeEach(() => {
114
+ mockSetAppFilter.mockClear()
115
+ mockCanBrowseArchived = false
116
+ mockHideEnabled = true
117
+ mockHiddenCount = 3
118
+ })
119
+
120
+ it('offers Hidden conversations under Other with the hidden count', () => {
121
+ const view = renderFilters()
122
+
123
+ expect(view.getByText('Other')).toBeTruthy()
124
+ expect(view.getByText('Hidden conversations')).toBeTruthy()
125
+ expect(view.getByText('Hidden for just you')).toBeTruthy()
126
+ expect(view.getByTestId('filter-row-count')).toHaveTextContent('3')
127
+ })
128
+
129
+ it('selecting Hidden conversations sets the hidden filter param', () => {
130
+ const view = renderFilters()
131
+
132
+ fireEvent.press(view.getByText('Hidden conversations'))
133
+
134
+ expect(mockSetAppFilter).toHaveBeenCalledWith({ show_hidden: true })
135
+ })
136
+
137
+ it('preselects Hidden conversations when it is the active filter', () => {
138
+ const view = renderFilters({ show_hidden: true })
139
+
140
+ const selected = view.getByRole('button', { selected: true })
141
+ expect(within(selected).getByText('Hidden conversations')).toBeTruthy()
142
+ })
143
+ })
@@ -10,7 +10,9 @@ import {
10
10
  useTheme,
11
11
  } from '../../../hooks'
12
12
  import { useFilterDropdownEnabled } from '../../../hooks/use_filter_dropdown_enabled'
13
- import { faBoxArchive } from '../../../vendor/font_awesome_pro_solid_icons'
13
+ import { useHiddenConversationsCount } from '../../../hooks/use_hidden_conversations_count'
14
+ import { useHideConversationsEnabled } from '../../../hooks/use_hide_conversations_enabled'
15
+ import { faBoxArchive, faEyeSlash } from '../../../vendor/font_awesome_pro_solid_icons'
14
16
  import { FilterContext, useFilterContext } from '../context/conversation_filter_context'
15
17
  import { FilterTypes } from '../filter_types'
16
18
  import { useGroupsToFilter, useTeamsToFilter } from '../hooks/filters'
@@ -69,6 +71,7 @@ export const ConversationFilters = () => {
69
71
  group_source_app_name = '',
70
72
  show_direct_messages,
71
73
  show_archived,
74
+ show_hidden,
72
75
  } = params
73
76
 
74
77
  const filterDropdownEnabled = useFilterDropdownEnabled()
@@ -76,6 +79,9 @@ export const ConversationFilters = () => {
76
79
  const hasDirectMessages = useHasDirectMessages()
77
80
  const canFilterByDMs = directMessagesEligible && hasDirectMessages
78
81
  const canFilterByArchived = useCanBrowseArchivedConversations()
82
+ const canFilterByHidden = useHideConversationsEnabled()
83
+ const hiddenCount = useHiddenConversationsCount()
84
+ const showOtherFilters = canFilterByArchived || canFilterByHidden
79
85
 
80
86
  const activeFilter: FilterTypes = useMemo(() => {
81
87
  if (chat_group_graph_id) {
@@ -88,10 +94,12 @@ export const ConversationFilters = () => {
88
94
  return FilterTypes.DirectMessages
89
95
  } else if (show_archived) {
90
96
  return FilterTypes.Archived
97
+ } else if (show_hidden) {
98
+ return FilterTypes.Hidden
91
99
  }
92
100
 
93
101
  return FilterTypes.All
94
- }, [chat_group_graph_id, group_source_app_name, show_direct_messages, show_archived])
102
+ }, [chat_group_graph_id, group_source_app_name, show_direct_messages, show_archived, show_hidden])
95
103
 
96
104
  const { groups = [] } = useGroupsToFilter()
97
105
  const { teams = [] } = useTeamsToFilter()
@@ -173,7 +181,7 @@ export const ConversationFilters = () => {
173
181
  data: { routeName: 'TeamFilters' },
174
182
  },
175
183
  {
176
- type: canFilterByArchived ? SectionTypes.header : SectionTypes.hidden,
184
+ type: showOtherFilters ? SectionTypes.header : SectionTypes.hidden,
177
185
  data: { title: 'Other', style: styles.extraHeaderScalableSpace },
178
186
  },
179
187
  {
@@ -186,6 +194,17 @@ export const ConversationFilters = () => {
186
194
  isActive: activeFilter === FilterTypes.Archived,
187
195
  },
188
196
  },
197
+ {
198
+ type: canFilterByHidden ? SectionTypes.other : SectionTypes.hidden,
199
+ data: {
200
+ filter: FilterTypes.Hidden,
201
+ description: 'Hidden for just you',
202
+ icon: faEyeSlash,
203
+ show_hidden: true,
204
+ count: hiddenCount,
205
+ isActive: activeFilter === FilterTypes.Hidden,
206
+ },
207
+ },
189
208
  ]
190
209
 
191
210
  return (
@@ -1,7 +1,7 @@
1
1
  import type { IconDefinition } from '@fortawesome/fontawesome-svg-core'
2
2
  import { PlatformPressable } from '@react-navigation/elements'
3
3
  import { NavigationProp, useNavigation } from '@react-navigation/native'
4
- import React, { PropsWithChildren, useContext } from 'react'
4
+ import React, { PropsWithChildren, ReactNode, useContext } from 'react'
5
5
  import { StyleSheet, View, ViewStyle } from 'react-native'
6
6
  import { Heading, Icon, IconTile, Image, Text, TextButton } from '../../../components'
7
7
  import {
@@ -118,18 +118,38 @@ export const TeamRow = ({ team }: TeamRowProps) => {
118
118
 
119
119
  export type OtherRowProps = {
120
120
  show_archived?: boolean
121
+ show_hidden?: boolean
122
+ count?: number
121
123
  isActive: boolean
122
124
  filter: FilterTypes
123
125
  description: string
124
126
  icon: IconDefinition
125
127
  }
126
128
 
127
- export const OtherRow = ({ show_archived, isActive, filter, description, icon }: OtherRowProps) => {
129
+ export const OtherRow = ({
130
+ show_archived,
131
+ show_hidden,
132
+ count,
133
+ isActive,
134
+ filter,
135
+ description,
136
+ icon,
137
+ }: OtherRowProps) => {
128
138
  const styles = useRowStyles()
129
139
  const { setAppFilter } = useContext(FilterContext)
130
140
 
131
141
  return (
132
- <PressableRow onPress={() => setAppFilter({ show_archived })} isActive={isActive}>
142
+ <PressableRow
143
+ onPress={() => setAppFilter({ show_archived, show_hidden })}
144
+ isActive={isActive}
145
+ trailing={
146
+ count !== undefined && (
147
+ <Text variant="tertiary" testID="filter-row-count">
148
+ {count}
149
+ </Text>
150
+ )
151
+ }
152
+ >
133
153
  <IconTile icon={icon} shape="square" size="lg" />
134
154
  <View style={styles.rowTextContainer}>
135
155
  <Heading variant="h3" style={styles.rowTitle}>
@@ -163,7 +183,13 @@ export const PressableRow = ({
163
183
  isActive,
164
184
  onPress,
165
185
  style,
166
- }: PropsWithChildren<{ isActive: boolean; onPress: () => void; style?: ViewStyle }>) => {
186
+ trailing,
187
+ }: PropsWithChildren<{
188
+ isActive: boolean
189
+ onPress: () => void
190
+ style?: ViewStyle
191
+ trailing?: ReactNode
192
+ }>) => {
167
193
  const styles = useRowStyles({ isActive })
168
194
  return (
169
195
  <PlatformPressable
@@ -174,12 +200,15 @@ export const PressableRow = ({
174
200
  >
175
201
  <View style={styles.row}>
176
202
  <View style={[styles.rowInner, style]}>{children}</View>
177
- <Icon
178
- name="general.check"
179
- style={styles.rowIconRight}
180
- accessibilityElementsHidden
181
- maxFontSizeMultiplier={2.5}
182
- />
203
+ <View style={styles.rowTrailing}>
204
+ {trailing}
205
+ <Icon
206
+ name="general.check"
207
+ style={styles.rowIconRight}
208
+ accessibilityElementsHidden
209
+ maxFontSizeMultiplier={2.5}
210
+ />
211
+ </View>
183
212
  </View>
184
213
  </PlatformPressable>
185
214
  )
@@ -219,6 +248,11 @@ const useRowStyles = ({ isActive = false }: { isActive?: boolean } = {}) => {
219
248
  rowTextContainer: {
220
249
  flexShrink: 1,
221
250
  },
251
+ rowTrailing: {
252
+ flexDirection: 'row',
253
+ alignItems: 'center',
254
+ gap: 12,
255
+ },
222
256
  rowWithoutBorder: {
223
257
  flexDirection: 'row',
224
258
  alignItems: 'center',
@@ -23,6 +23,7 @@ export const FilterContext = createContext<{
23
23
  group_source_app_name: undefined,
24
24
  show_direct_messages: undefined,
25
25
  show_archived: undefined,
26
+ show_hidden: undefined,
26
27
  show_unread: undefined,
27
28
  },
28
29
  scrollOffset: 0,
@@ -60,6 +61,7 @@ export const FilterProvider = ({ children }: PropsWithChildren) => {
60
61
  group_source_app_name: undefined,
61
62
  show_direct_messages: undefined,
62
63
  show_archived: undefined,
64
+ show_hidden: undefined,
63
65
  show_unread: undefined,
64
66
  })
65
67
  )
@@ -70,6 +72,7 @@ export const FilterProvider = ({ children }: PropsWithChildren) => {
70
72
  group_source_app_name: undefined,
71
73
  show_direct_messages: undefined,
72
74
  show_archived: undefined,
75
+ show_hidden: undefined,
73
76
  show_unread: undefined,
74
77
  })
75
78
  },
@@ -79,6 +82,7 @@ export const FilterProvider = ({ children }: PropsWithChildren) => {
79
82
  group_source_app_name: params.group_source_app_name,
80
83
  show_direct_messages: params.show_direct_messages,
81
84
  show_archived: params.show_archived,
85
+ show_hidden: params.show_hidden,
82
86
  show_unread: undefined,
83
87
  })
84
88
  },
@@ -4,5 +4,6 @@ export enum FilterTypes {
4
4
  Groups = 'All my groups',
5
5
  Teams = 'All my teams and plans',
6
6
  Archived = 'Archived conversations',
7
+ Hidden = 'Hidden conversations',
7
8
  More = 'More',
8
9
  }
@@ -6,6 +6,7 @@ export type ConversationFiltersParams = {
6
6
  group_source_app_name?: string
7
7
  show_direct_messages?: boolean
8
8
  show_archived?: boolean
9
+ show_hidden?: boolean
9
10
  show_unread?: boolean
10
11
  }
11
12
 
@@ -27,6 +27,7 @@ jest.mock('../../../components', () => ({
27
27
  <ListHeaderComponent />
28
28
  ),
29
29
  }))
30
+ jest.mock('../../../components/display/toast', () => ({ Toast: () => null }))
30
31
  jest.mock('../components/list_header_component', () => {
31
32
  const { Text } = require('react-native')
32
33
  return { ListHeaderComponent: () => <Text>Default header</Text> }
@@ -19,6 +19,7 @@ const mockRouteParams: Record<string, unknown> = {}
19
19
  const mockCanDisplayGroups = jest.fn()
20
20
  const mockSearchEnabled = jest.fn()
21
21
  const mockCanBrowseArchived = jest.fn()
22
+ const mockHideEnabled = jest.fn()
22
23
  const mockGroupsByGraphId: Record<string, { name: string }> = {}
23
24
 
24
25
  jest.mock('@react-navigation/native', () => ({
@@ -44,6 +45,9 @@ jest.mock('../../../../hooks/use_has_direct_messages', () => ({
44
45
  jest.mock('../../../../hooks/use_can_browse_archived_conversations', () => ({
45
46
  useCanBrowseArchivedConversations: () => mockCanBrowseArchived(),
46
47
  }))
48
+ jest.mock('../../../../hooks/use_hide_conversations_enabled', () => ({
49
+ useHideConversationsEnabled: () => mockHideEnabled(),
50
+ }))
47
51
  jest.mock('../../../../hooks/use_chat_permissions', () => ({
48
52
  useCanCreateConversations: () => true,
49
53
  }))
@@ -140,6 +144,7 @@ describe('FilterDropdownListHeaderComponent', () => {
140
144
  mockSetParams.mockClear()
141
145
  mockSearchEnabled.mockReturnValue(true)
142
146
  mockCanBrowseArchived.mockReturnValue(false)
147
+ mockHideEnabled.mockReturnValue(false)
143
148
  setCapabilities({ groups: true, teams: true })
144
149
  setRouteParams({})
145
150
  })
@@ -272,6 +277,43 @@ describe('FilterDropdownListHeaderComponent', () => {
272
277
  expect(view.queryByText('Mark all read')).toBeNull()
273
278
  })
274
279
 
280
+ it('offers More filters when hidden conversations are the only extra filter', () => {
281
+ setCapabilities({ groups: false, teams: false })
282
+ mockHideEnabled.mockReturnValue(true)
283
+
284
+ render(<FilterDropdownListHeaderComponent />)
285
+
286
+ expect(menuItemNames()).toEqual(['All', 'DMs', 'Unread', 'More filters'])
287
+ })
288
+
289
+ it('labels the hidden list and carries it into More filters', () => {
290
+ setRouteParams({ show_hidden: true })
291
+
292
+ render(<FilterDropdownListHeaderComponent />)
293
+
294
+ expect(screen.getByRole('button', { name: 'Hidden' })).toBeTruthy()
295
+ expect(screen.queryByText('Mark all read')).toBeNull()
296
+
297
+ fireEvent.press(screen.getByRole('menuitem', { name: 'More filters' }))
298
+
299
+ expect(mockNavigate).toHaveBeenCalledWith(
300
+ 'ConversationFilters',
301
+ expect.objectContaining({ show_hidden: true })
302
+ )
303
+ })
304
+
305
+ it('leaves the hidden list when another filter is picked', () => {
306
+ setRouteParams({ show_hidden: true })
307
+
308
+ render(<FilterDropdownListHeaderComponent />)
309
+
310
+ fireEvent.press(screen.getByRole('menuitem', { name: 'Unread' }))
311
+
312
+ expect(mockSetParams).toHaveBeenCalledWith(
313
+ expect.objectContaining({ show_unread: true, show_hidden: undefined })
314
+ )
315
+ })
316
+
275
317
  it('leaves the archived list when another filter is picked', () => {
276
318
  setRouteParams({ show_archived: true })
277
319
 
@@ -45,6 +45,7 @@ const clearedFilter = {
45
45
  group_source_app_name: undefined,
46
46
  show_direct_messages: undefined,
47
47
  show_archived: undefined,
48
+ show_hidden: undefined,
48
49
  }
49
50
 
50
51
  describe('ListHeaderComponent filter toggles', () => {