@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
@@ -19,6 +19,7 @@ import {
19
19
  import { useApiGet } from '../../../hooks/use_api'
20
20
  import { useMarkAllRead } from '../../../hooks/use_conversations_actions'
21
21
  import { useCanDisplayGroups } from '../../../hooks/use_groups'
22
+ import { useHideConversationsEnabled } from '../../../hooks/use_hide_conversations_enabled'
22
23
  import { useNewConversationFromFilter } from '../../../hooks/use_new_conversation_from_filter'
23
24
  import { useSearchEnabled } from '../../../hooks/use_search_enabled'
24
25
  import { GraphId, GroupResource } from '../../../types/resources/group_resource'
@@ -34,6 +35,7 @@ const TRIGGER_CAP_SLACK = 2
34
35
  const LAYOUT_JITTER = 1
35
36
  const ALL_CONVERSATIONS_LABEL = 'All conversations'
36
37
  const ARCHIVED_LABEL = 'Archived'
38
+ const HIDDEN_LABEL = 'Hidden'
37
39
 
38
40
  enum FilterTypes {
39
41
  All = 'All',
@@ -63,6 +65,7 @@ export const FilterDropdownListHeaderComponent = () => {
63
65
  const hasDirectMessages = useHasDirectMessages()
64
66
  const canFilterByDMs = directMessagesEligible && hasDirectMessages
65
67
  const canBrowseArchived = useCanBrowseArchivedConversations()
68
+ const hideConversationsEnabled = useHideConversationsEnabled()
66
69
  const searchEnabled = useSearchEnabled()
67
70
  const route = useRoute<RouteProp<ConversationsScreenProps['route']>>()
68
71
  const {
@@ -71,6 +74,7 @@ export const FilterDropdownListHeaderComponent = () => {
71
74
  group_source_app_name = '',
72
75
  show_direct_messages,
73
76
  show_archived,
77
+ show_hidden,
74
78
  show_unread,
75
79
  } = route.params || {}
76
80
  const currentPersonCache = useCurrentPersonCache()
@@ -86,7 +90,7 @@ export const FilterDropdownListHeaderComponent = () => {
86
90
  )
87
91
 
88
92
  const active: FilterTypes = useMemo(() => {
89
- if (chat_group_graph_id || show_archived) {
93
+ if (chat_group_graph_id || show_archived || show_hidden) {
90
94
  return FilterTypes.More
91
95
  } else if (/groups/i.test(group_source_app_name)) {
92
96
  return FilterTypes.Groups
@@ -99,7 +103,14 @@ export const FilterDropdownListHeaderComponent = () => {
99
103
  }
100
104
 
101
105
  return FilterTypes.All
102
- }, [chat_group_graph_id, group_source_app_name, show_direct_messages, show_archived, show_unread])
106
+ }, [
107
+ chat_group_graph_id,
108
+ group_source_app_name,
109
+ show_direct_messages,
110
+ show_archived,
111
+ show_hidden,
112
+ show_unread,
113
+ ])
103
114
 
104
115
  const options: FilterDropdownOption[] = useMemo(
105
116
  () => [
@@ -115,10 +126,11 @@ export const FilterDropdownListHeaderComponent = () => {
115
126
  const triggerLabel = useMemo(() => {
116
127
  if (chat_group_graph_id) return group?.name || title || ALL_CONVERSATIONS_LABEL
117
128
  if (show_archived) return ARCHIVED_LABEL
129
+ if (show_hidden) return HIDDEN_LABEL
118
130
  if (active === FilterTypes.All) return ALL_CONVERSATIONS_LABEL
119
131
 
120
132
  return active
121
- }, [chat_group_graph_id, group?.name, title, show_archived, active])
133
+ }, [chat_group_graph_id, group?.name, title, show_archived, show_hidden, active])
122
134
 
123
135
  const handleNewConversationNavigation = useCallback(() => {
124
136
  if (newConversationFromFilter || entryMode === 'select_type') {
@@ -158,6 +170,7 @@ export const FilterDropdownListHeaderComponent = () => {
158
170
  group_source_app_name: undefined,
159
171
  show_direct_messages: undefined,
160
172
  show_archived: undefined,
173
+ show_hidden: undefined,
161
174
  show_unread: undefined,
162
175
  ...params,
163
176
  })
@@ -187,6 +200,7 @@ export const FilterDropdownListHeaderComponent = () => {
187
200
  group_source_app_name,
188
201
  show_direct_messages,
189
202
  show_archived,
203
+ show_hidden,
190
204
  show_unread,
191
205
  })
192
206
  }, [
@@ -195,6 +209,7 @@ export const FilterDropdownListHeaderComponent = () => {
195
209
  group_source_app_name,
196
210
  show_direct_messages,
197
211
  show_archived,
212
+ show_hidden,
198
213
  show_unread,
199
214
  ])
200
215
 
@@ -213,7 +228,8 @@ export const FilterDropdownListHeaderComponent = () => {
213
228
  ])
214
229
  }, [active, handleMarkAllRead])
215
230
 
216
- const showMoreFilters = canFilterByGroups || canFilterByTeams || canBrowseArchived
231
+ const showMoreFilters =
232
+ canFilterByGroups || canFilterByTeams || canBrowseArchived || hideConversationsEnabled
217
233
 
218
234
  const styles = useStyles()
219
235
 
@@ -301,7 +317,7 @@ export const FilterDropdownListHeaderComponent = () => {
301
317
  )}
302
318
  </View>
303
319
  </View>
304
- {!show_archived && (
320
+ {!show_archived && !show_hidden && (
305
321
  <View style={styles.markAllReadRow}>
306
322
  <TextButton
307
323
  onPress={alertMarkAllRead}
@@ -45,6 +45,7 @@ export const ListHeaderComponent = () => {
45
45
  group_source_app_name = '',
46
46
  show_direct_messages,
47
47
  show_archived,
48
+ show_hidden,
48
49
  } = route.params || {}
49
50
  const currentPersonCache = useCurrentPersonCache()
50
51
  const { markAllRead, isPending } = useMarkAllRead()
@@ -55,7 +56,7 @@ export const ListHeaderComponent = () => {
55
56
  )
56
57
 
57
58
  const active: FilterTypes = useMemo(() => {
58
- if (chat_group_graph_id || show_archived) {
59
+ if (chat_group_graph_id || show_archived || show_hidden) {
59
60
  return FilterTypes.More
60
61
  } else if (/groups/i.test(group_source_app_name)) {
61
62
  return FilterTypes.Groups
@@ -66,7 +67,7 @@ export const ListHeaderComponent = () => {
66
67
  }
67
68
 
68
69
  return FilterTypes.All
69
- }, [chat_group_graph_id, group_source_app_name, show_direct_messages, show_archived])
70
+ }, [chat_group_graph_id, group_source_app_name, show_direct_messages, show_archived, show_hidden])
70
71
 
71
72
  const handleNewConversationNavigation = useCallback(() => {
72
73
  if (newConversationFromFilter || entryMode === 'select_type') {
@@ -106,6 +107,7 @@ export const ListHeaderComponent = () => {
106
107
  group_source_app_name: undefined,
107
108
  show_direct_messages: undefined,
108
109
  show_archived: undefined,
110
+ show_hidden: undefined,
109
111
  ...params,
110
112
  })
111
113
  },
@@ -122,8 +124,16 @@ export const ListHeaderComponent = () => {
122
124
  group_source_app_name,
123
125
  show_direct_messages,
124
126
  show_archived,
127
+ show_hidden,
125
128
  })
126
- }, [navigation, chat_group_graph_id, group_source_app_name, show_direct_messages, show_archived])
129
+ }, [
130
+ navigation,
131
+ chat_group_graph_id,
132
+ group_source_app_name,
133
+ show_direct_messages,
134
+ show_archived,
135
+ show_hidden,
136
+ ])
127
137
 
128
138
  const handleMarkAllRead = useCallback(() => {
129
139
  currentPersonCache.update({ unreadCount: 0 })
@@ -164,7 +174,7 @@ export const ListHeaderComponent = () => {
164
174
  <Heading numberOfLines={1} variant="h2">
165
175
  Conversations
166
176
  </Heading>
167
- {!show_archived && (
177
+ {!show_archived && !show_hidden && (
168
178
  <TextButton
169
179
  onPress={alertMarkAllRead}
170
180
  disabled={isPending}
@@ -45,6 +45,7 @@ export const SearchListHeaderComponent = () => {
45
45
  group_source_app_name = '',
46
46
  show_direct_messages,
47
47
  show_archived,
48
+ show_hidden,
48
49
  } = route.params || {}
49
50
  const currentPersonCache = useCurrentPersonCache()
50
51
  const { markAllRead, isPending } = useMarkAllRead()
@@ -55,7 +56,7 @@ export const SearchListHeaderComponent = () => {
55
56
  )
56
57
 
57
58
  const active: FilterTypes = useMemo(() => {
58
- if (chat_group_graph_id || show_archived) {
59
+ if (chat_group_graph_id || show_archived || show_hidden) {
59
60
  return FilterTypes.More
60
61
  } else if (/groups/i.test(group_source_app_name)) {
61
62
  return FilterTypes.Groups
@@ -66,7 +67,7 @@ export const SearchListHeaderComponent = () => {
66
67
  }
67
68
 
68
69
  return FilterTypes.All
69
- }, [chat_group_graph_id, group_source_app_name, show_direct_messages, show_archived])
70
+ }, [chat_group_graph_id, group_source_app_name, show_direct_messages, show_archived, show_hidden])
70
71
 
71
72
  const handleNewConversationNavigation = useCallback(() => {
72
73
  if (newConversationFromFilter || entryMode === 'select_type') {
@@ -106,6 +107,7 @@ export const SearchListHeaderComponent = () => {
106
107
  group_source_app_name: undefined,
107
108
  show_direct_messages: undefined,
108
109
  show_archived: undefined,
110
+ show_hidden: undefined,
109
111
  ...params,
110
112
  })
111
113
  },
@@ -126,8 +128,16 @@ export const SearchListHeaderComponent = () => {
126
128
  group_source_app_name,
127
129
  show_direct_messages,
128
130
  show_archived,
131
+ show_hidden,
129
132
  })
130
- }, [navigation, chat_group_graph_id, group_source_app_name, show_direct_messages, show_archived])
133
+ }, [
134
+ navigation,
135
+ chat_group_graph_id,
136
+ group_source_app_name,
137
+ show_direct_messages,
138
+ show_archived,
139
+ show_hidden,
140
+ ])
131
141
 
132
142
  const handleMarkAllRead = useCallback(() => {
133
143
  currentPersonCache.update({ unreadCount: 0 })
@@ -168,7 +178,7 @@ export const SearchListHeaderComponent = () => {
168
178
  <Heading numberOfLines={1} variant="h2">
169
179
  Conversations
170
180
  </Heading>
171
- {!show_archived && (
181
+ {!show_archived && !show_hidden && (
172
182
  <TextButton
173
183
  onPress={alertMarkAllRead}
174
184
  disabled={isPending}
@@ -2,6 +2,7 @@ import { StaticScreenProps } from '@react-navigation/native'
2
2
  import React from 'react'
3
3
  import { StyleSheet, View } from 'react-native'
4
4
  import { Conversations } from '../../components'
5
+ import { Toast } from '../../components/display/toast'
5
6
  import { ConversationsContextProvider } from '../../contexts/conversations_context'
6
7
  import { useFilterDropdownEnabled } from '../../hooks/use_filter_dropdown_enabled'
7
8
  import { analyticsEvents, usePublishProductAnalyticsEvent } from '../../hooks/use_product_analytics'
@@ -18,6 +19,7 @@ export type ConversationsScreenProps = StaticScreenProps<{
18
19
  group_source_app_name?: AppName
19
20
  show_direct_messages?: boolean
20
21
  show_archived?: boolean
22
+ show_hidden?: boolean
21
23
  show_unread?: boolean
22
24
  }>
23
25
 
@@ -32,6 +34,7 @@ export function ConversationsScreen({ route }: ConversationsScreenProps) {
32
34
  <ConversationsContextProvider args={route.params} opts={{ throwOnError: true }}>
33
35
  <Conversations ListHeaderComponent={Header} />
34
36
  </ConversationsContextProvider>
37
+ <Toast />
35
38
  </View>
36
39
  )
37
40
  }
@@ -1,12 +1,12 @@
1
1
  import { StaticScreenProps, useNavigation } from '@react-navigation/native'
2
2
  import { useCallback, useMemo } from 'react'
3
- import { Alert, ScrollView, StyleSheet, View } from 'react-native'
3
+ import { ScrollView, StyleSheet, View } from 'react-native'
4
4
  import { Heading, PressableRow, Text, TextInlineButton } from '../components'
5
5
  import { useApiGet, useTheme } from '../hooks'
6
6
  import { useAppName } from '../hooks/use_app_name'
7
7
  import { useOrganization } from '../hooks/use_organization'
8
8
  import { ResourceObject } from '../types'
9
- import { Clipboard, Linking } from '../utils'
9
+ import { openUrl } from '../utils'
10
10
 
11
11
  type GetHelpScreenRouteProps = {
12
12
  type?: 'chat' | 'general'
@@ -65,7 +65,7 @@ export const GetHelpScreen = ({ route }: GetHelpScreenProps) => {
65
65
  {appSpecificHelpUrls.map(helpUrl => (
66
66
  <PressableRow
67
67
  key={helpUrl.id}
68
- onPress={() => Linking.openURL(helpUrl.link)}
68
+ onPress={() => openUrl(helpUrl.link)}
69
69
  text={helpUrl.title}
70
70
  isActive={true}
71
71
  iconPath="general.newWindow"
@@ -117,27 +117,13 @@ const ContactRow = ({ email, phone }: { email?: string; phone?: string }) => {
117
117
  export function sendEmail(email: string) {
118
118
  if (!email) return
119
119
 
120
- const url = encodeURI(`mailto:${email}`)
121
-
122
- Linking.openURL(url).catch(() => {
123
- Alert.alert('Oops', `Unable to open: ${email}`, [
124
- { text: 'Copy to clipboard', onPress: () => Clipboard.setStringAsync(email) },
125
- { text: 'OK' },
126
- ])
127
- })
120
+ openUrl(encodeURI(`mailto:${email}`))
128
121
  }
129
122
 
130
123
  export function placePhoneCall(phoneNumber: string) {
131
124
  if (!phoneNumber) return
132
125
 
133
- const url = encodeURI(`tel:${phoneNumber}`)
134
-
135
- Linking.openURL(url).catch(() => {
136
- Alert.alert('Oops', `Unable to open: ${phoneNumber}`, [
137
- { text: 'Copy to clipboard', onPress: () => Clipboard.setStringAsync(phoneNumber) },
138
- { text: 'OK' },
139
- ])
140
- })
126
+ openUrl(encodeURI(`tel:${phoneNumber}`))
141
127
  }
142
128
 
143
129
  const useStyles = () => {
@@ -8,6 +8,7 @@ export * from './preferred_app_selection_screen'
8
8
  export * from './group_notification_settings_screen'
9
9
  export * from './conversation_filter_recipients/conversation_filter_recipients_screen'
10
10
  export * from './message_actions_screen'
11
+ export * from './conversation_actions_screen'
11
12
  export * from './message_report_screen'
12
13
  export * from './send_giphy_screen'
13
14
  export * from './not_found'
@@ -5,6 +5,7 @@ export type NotificationLevelDescription = string
5
5
 
6
6
  export interface ConversationMembershipResource extends ResourceObject {
7
7
  type: 'ConversationMembership'
8
+ hidden?: boolean
8
9
  lastReadMessageSortKey: string
9
10
  muted: boolean
10
11
  notificationLevel: NotificationLevelValue
@@ -0,0 +1,67 @@
1
+ import { Alert } from 'react-native'
2
+ import { Clipboard, Linking, Log } from '../native_adapters'
3
+ import { openUrl } from '../open_url'
4
+
5
+ type AlertButton = { text?: string; onPress?: () => void }
6
+
7
+ const pressButton = (text: string) => {
8
+ const buttons = (Alert.alert as jest.Mock).mock.calls[0][2] as AlertButton[]
9
+ buttons.find(button => button.text === text)?.onPress?.()
10
+ }
11
+
12
+ describe('openUrl', () => {
13
+ let openURL: jest.SpyInstance
14
+ let setStringAsync: jest.SpyInstance
15
+ let reportError: jest.SpyInstance
16
+
17
+ beforeEach(() => {
18
+ jest.spyOn(Alert, 'alert').mockImplementation(() => {})
19
+ openURL = jest.spyOn(Linking, 'openURL')
20
+ setStringAsync = jest.spyOn(Clipboard, 'setStringAsync').mockResolvedValue()
21
+ reportError = jest.spyOn(Log, 'reportError').mockImplementation(() => {})
22
+ })
23
+
24
+ afterEach(() => {
25
+ jest.restoreAllMocks()
26
+ })
27
+
28
+ it('passes the url and options through to the Linking adapter', async () => {
29
+ openURL.mockResolvedValue(true)
30
+
31
+ await openUrl('https://youtu.be/abc', { forceOpenInBrowser: true })
32
+
33
+ expect(openURL).toHaveBeenCalledWith('https://youtu.be/abc', { forceOpenInBrowser: true })
34
+ expect(Alert.alert).not.toHaveBeenCalled()
35
+ expect(reportError).not.toHaveBeenCalled()
36
+ })
37
+
38
+ it('reports a failed web link instead of alerting', async () => {
39
+ const error = new Error('Unable to open URL')
40
+ openURL.mockRejectedValue(error)
41
+
42
+ await openUrl('https://youtu.be/abc')
43
+
44
+ expect(reportError).toHaveBeenCalledWith(error, { extra: { url: 'https://youtu.be/abc' } })
45
+ expect(Alert.alert).not.toHaveBeenCalled()
46
+ })
47
+
48
+ it.each([
49
+ ['mailto', 'mailto:admin@example.com', 'admin@example.com'],
50
+ ['encoded mailto', encodeURI('mailto:first last@example.com'), 'first last@example.com'],
51
+ ['tel', 'tel:+1 (555) 555-0100', '+1 (555) 555-0100'],
52
+ ])('alerts and offers to copy the bare address for a %s link', async (_name, url, address) => {
53
+ openURL.mockRejectedValue(new Error('No Activity found'))
54
+
55
+ await openUrl(url)
56
+
57
+ expect(Alert.alert).toHaveBeenCalledWith(
58
+ 'Oops',
59
+ `Unable to open: ${address}`,
60
+ expect.arrayContaining([expect.objectContaining({ text: 'Copy to clipboard' })])
61
+ )
62
+ expect(reportError).not.toHaveBeenCalled()
63
+
64
+ pressButton('Copy to clipboard')
65
+ expect(setStringAsync).toHaveBeenCalledWith(address)
66
+ })
67
+ })
@@ -10,6 +10,7 @@ export * from './host_bridge'
10
10
  export * from './liquid_glass'
11
11
  export * from './membership_sync_info_text'
12
12
  export * from './native_adapters'
13
+ export * from './open_url'
13
14
  export * from './pluralize'
14
15
  export * from './conversation_safety_constants'
15
16
  export * from './reaction_constants'
@@ -0,0 +1,47 @@
1
+ import { Alert } from 'react-native'
2
+ import { Clipboard, Linking, Log } from './native_adapters'
3
+ import type { LinkingOpenURLOptions } from './native_adapters/linking'
4
+
5
+ const CONTACT_SCHEME = /^(mailto|tel):/i
6
+
7
+ /**
8
+ * Opens a URL through the host's Linking adapter and never leaves the
9
+ * rejection unhandled.
10
+ *
11
+ * mailto: and tel: links fail for ordinary reasons (no mail app, no phone),
12
+ * so the user gets an alert offering to copy the address. Any other failure
13
+ * is reported through the Log adapter so it stays visible as a handled error.
14
+ */
15
+ export function openUrl(url: string, options?: LinkingOpenURLOptions) {
16
+ return Linking.openURL(url, options).catch((error: unknown) => {
17
+ if (CONTACT_SCHEME.test(url)) {
18
+ alertUnableToOpen(url)
19
+ return
20
+ }
21
+
22
+ Log.reportError(toError(error, url), { extra: { url } })
23
+ })
24
+ }
25
+
26
+ function alertUnableToOpen(url: string) {
27
+ const address = readableAddress(url)
28
+
29
+ Alert.alert('Oops', `Unable to open: ${address}`, [
30
+ { text: 'Copy to clipboard', onPress: () => Clipboard.setStringAsync(address) },
31
+ { text: 'OK' },
32
+ ])
33
+ }
34
+
35
+ function readableAddress(url: string) {
36
+ const address = url.replace(CONTACT_SCHEME, '')
37
+
38
+ try {
39
+ return decodeURIComponent(address)
40
+ } catch {
41
+ return address
42
+ }
43
+ }
44
+
45
+ function toError(error: unknown, url: string) {
46
+ return error instanceof Error ? error : new Error(`Unable to open URL: ${url}`)
47
+ }
@@ -7,15 +7,19 @@ export interface ConversationRequestArgs {
7
7
  group_source_app_name?: string
8
8
  show_direct_messages?: boolean
9
9
  show_archived?: boolean
10
+ show_hidden?: boolean
10
11
  show_unread?: boolean
11
12
  }
12
13
 
14
+ export const HIDDEN_CONVERSATIONS_FILTER = 'mine_or_not_empty,hidden'
15
+
13
16
  export const getConversationsRequestArgs = ({
14
17
  gids,
15
18
  chat_group_graph_id,
16
19
  group_source_app_name,
17
20
  show_direct_messages,
18
21
  show_archived,
22
+ show_hidden,
19
23
  show_unread,
20
24
  }: Partial<ConversationRequestArgs> = {}): GetRequest => {
21
25
  let filter: string
@@ -23,6 +27,8 @@ export const getConversationsRequestArgs = ({
23
27
  filter = 'mine_or_not_empty,group'
24
28
  } else if (show_archived) {
25
29
  filter = 'mine_or_not_empty,archived'
30
+ } else if (show_hidden) {
31
+ filter = HIDDEN_CONVERSATIONS_FILTER
26
32
  } else if (show_unread) {
27
33
  filter = 'mine_or_not_empty,unread'
28
34
  } else if (show_direct_messages) {
@@ -0,0 +1,45 @@
1
+ export interface ToastAction {
2
+ label: string
3
+ onPress: () => void
4
+ }
5
+
6
+ export interface ToastOptions {
7
+ title: string
8
+ subtitle?: string
9
+ action?: ToastAction
10
+ }
11
+
12
+ export interface ToastState extends ToastOptions {
13
+ id: number
14
+ }
15
+
16
+ type Listener = () => void
17
+
18
+ let currentToast: ToastState | null = null
19
+ let nextId = 1
20
+ const listeners = new Set<Listener>()
21
+
22
+ const emit = () => listeners.forEach(listener => listener())
23
+
24
+ export const toastStore = {
25
+ getSnapshot: () => currentToast,
26
+ subscribe: (listener: Listener) => {
27
+ listeners.add(listener)
28
+ return () => {
29
+ listeners.delete(listener)
30
+ }
31
+ },
32
+ }
33
+
34
+ export function showToast(options: ToastOptions) {
35
+ currentToast = { ...options, id: nextId++ }
36
+ emit()
37
+ }
38
+
39
+ export function dismissToast(id?: number) {
40
+ if (!currentToast) return
41
+ if (id !== undefined && currentToast.id !== id) return
42
+
43
+ currentToast = null
44
+ emit()
45
+ }
@@ -620,3 +620,15 @@ export const faBoxArchive: IconDefinition = {
620
620
  'M0 64C0 46.3 14.3 32 32 32l448 0c17.7 0 32 14.3 32 32l0 32c0 17.7-14.3 32-32 32L32 128C14.3 128 0 113.7 0 96L0 64zM32 176l448 0 0 240c0 35.3-28.7 64-64 64L96 480c-35.3 0-64-28.7-64-64l0-240zm152 64c-13.3 0-24 10.7-24 24s10.7 24 24 24l144 0c13.3 0 24-10.7 24-24s-10.7-24-24-24l-144 0z',
621
621
  ],
622
622
  }
623
+
624
+ export const faEyeSlash: IconDefinition = {
625
+ prefix: 'fas',
626
+ iconName: 'eye-slash',
627
+ icon: [
628
+ 576,
629
+ 512,
630
+ [],
631
+ 'f070',
632
+ 'M41-24.9c-9.4-9.4-24.6-9.4-33.9 0S-2.3-.3 7 9.1l528 528c9.4 9.4 24.6 9.4 33.9 0s9.4-24.6 0-33.9l-96.4-96.4c2.7-2.4 5.4-4.8 8-7.2 46.8-43.5 78.1-95.4 93-131.1 3.3-7.9 3.3-16.7 0-24.6-14.9-35.7-46.2-87.7-93-131.1-47.1-43.7-111.8-80.6-192.6-80.6-56.8 0-105.6 18.2-146 44.2L41-24.9zM204.5 138.7c23.5-16.8 52.4-26.7 83.5-26.7 79.5 0 144 64.5 144 144 0 31.1-9.9 59.9-26.7 83.5l-34.7-34.7c12.7-21.4 17-47.7 10.1-73.7-13.7-51.2-66.4-81.6-117.6-67.9-8.6 2.3-16.7 5.7-24 10l-34.7-34.7zM325.3 395.1c-11.9 3.2-24.4 4.9-37.3 4.9-79.5 0-144-64.5-144-144 0-12.9 1.7-25.4 4.9-37.3L69.4 139.2c-32.6 36.8-55 75.8-66.9 104.5-3.3 7.9-3.3 16.7 0 24.6 14.9 35.7 46.2 87.7 93 131.1 47.1 43.7 111.8 80.6 192.6 80.6 37.3 0 71.2-7.9 101.5-20.6l-64.2-64.2z',
633
+ ],
634
+ }