@planningcenter/chat-react-native 4.5.1-rc.0 → 4.6.0-qa-1063.1

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 (182) hide show
  1. package/assets/powered_by_giphy.png +0 -0
  2. package/assets/powered_by_giphy_dark.png +0 -0
  3. package/build/components/conversation/attachments/giphy_attachment.d.ts.map +1 -1
  4. package/build/components/conversation/attachments/giphy_attachment.js +2 -2
  5. package/build/components/conversation/attachments/giphy_attachment.js.map +1 -1
  6. package/build/components/conversation/attachments/image_attachment.d.ts.map +1 -1
  7. package/build/components/conversation/attachments/image_attachment.js +5 -3
  8. package/build/components/conversation/attachments/image_attachment.js.map +1 -1
  9. package/build/components/conversation/message_form.d.ts.map +1 -1
  10. package/build/components/conversation/message_form.js +2 -2
  11. package/build/components/conversation/message_form.js.map +1 -1
  12. package/build/components/conversation/message_list.d.ts.map +1 -1
  13. package/build/components/conversation/message_list.js +155 -123
  14. package/build/components/conversation/message_list.js.map +1 -1
  15. package/build/components/conversations/conversations.d.ts.map +1 -1
  16. package/build/components/conversations/conversations.js +1 -0
  17. package/build/components/conversations/conversations.js.map +1 -1
  18. package/build/components/display/conversation_avatar.d.ts +3 -1
  19. package/build/components/display/conversation_avatar.d.ts.map +1 -1
  20. package/build/components/display/conversation_avatar.js +77 -66
  21. package/build/components/display/conversation_avatar.js.map +1 -1
  22. package/build/components/display/keyboard_scroll_view.d.ts.map +1 -1
  23. package/build/components/display/keyboard_scroll_view.js +1 -0
  24. package/build/components/display/keyboard_scroll_view.js.map +1 -1
  25. package/build/components/page/page_error_boundary.d.ts +9 -1
  26. package/build/components/page/page_error_boundary.d.ts.map +1 -1
  27. package/build/components/page/page_error_boundary.js +56 -31
  28. package/build/components/page/page_error_boundary.js.map +1 -1
  29. package/build/hooks/use_conversation_avatar_update.d.ts +4 -3
  30. package/build/hooks/use_conversation_avatar_update.d.ts.map +1 -1
  31. package/build/hooks/use_conversation_avatar_update.js +146 -48
  32. package/build/hooks/use_conversation_avatar_update.js.map +1 -1
  33. package/build/icons/font_awesome.js +6 -6
  34. package/build/icons/font_awesome.js.map +1 -1
  35. package/build/navigation/index.d.ts.map +1 -1
  36. package/build/navigation/index.js +3 -1
  37. package/build/navigation/index.js.map +1 -1
  38. package/build/navigation/page_error_fallbacks.d.ts +7 -0
  39. package/build/navigation/page_error_fallbacks.d.ts.map +1 -0
  40. package/build/navigation/page_error_fallbacks.js +7 -0
  41. package/build/navigation/page_error_fallbacks.js.map +1 -0
  42. package/build/navigation/screenLayout.d.ts.map +1 -1
  43. package/build/navigation/screenLayout.js +10 -6
  44. package/build/navigation/screenLayout.js.map +1 -1
  45. package/build/screens/age_check/age_check_required_screen.d.ts.map +1 -1
  46. package/build/screens/age_check/age_check_required_screen.js +1 -0
  47. package/build/screens/age_check/age_check_required_screen.js.map +1 -1
  48. package/build/screens/age_check/age_check_underage_screen.d.ts.map +1 -1
  49. package/build/screens/age_check/age_check_underage_screen.js +2 -1
  50. package/build/screens/age_check/age_check_underage_screen.js.map +1 -1
  51. package/build/screens/attachment_actions/attachment_actions_screen.d.ts.map +1 -1
  52. package/build/screens/attachment_actions/attachment_actions_screen.js +5 -2
  53. package/build/screens/attachment_actions/attachment_actions_screen.js.map +1 -1
  54. package/build/screens/avatar_picker/avatar_picker_screen.d.ts.map +1 -1
  55. package/build/screens/avatar_picker/avatar_picker_screen.js +76 -66
  56. package/build/screens/avatar_picker/avatar_picker_screen.js.map +1 -1
  57. package/build/screens/avatar_picker/constants.d.ts.map +1 -1
  58. package/build/screens/avatar_picker/constants.js +5 -3
  59. package/build/screens/avatar_picker/constants.js.map +1 -1
  60. package/build/screens/bug_report_screen.d.ts.map +1 -1
  61. package/build/screens/bug_report_screen.js +3 -3
  62. package/build/screens/bug_report_screen.js.map +1 -1
  63. package/build/screens/conversation_details_screen.d.ts.map +1 -1
  64. package/build/screens/conversation_details_screen.js +1 -0
  65. package/build/screens/conversation_details_screen.js.map +1 -1
  66. package/build/screens/conversation_new/components/form_list.d.ts.map +1 -1
  67. package/build/screens/conversation_new/components/form_list.js +1 -0
  68. package/build/screens/conversation_new/components/form_list.js.map +1 -1
  69. package/build/screens/conversation_new/components/groups_form.js +25 -18
  70. package/build/screens/conversation_new/components/groups_form.js.map +1 -1
  71. package/build/screens/conversation_new/components/services_form.js +51 -40
  72. package/build/screens/conversation_new/components/services_form.js.map +1 -1
  73. package/build/screens/conversation_select_recipients/conversation_new_entry_screen.d.ts.map +1 -1
  74. package/build/screens/conversation_select_recipients/conversation_new_entry_screen.js +1 -0
  75. package/build/screens/conversation_select_recipients/conversation_new_entry_screen.js.map +1 -1
  76. package/build/screens/conversation_select_recipients/conversation_select_direct_message_recipients_screen.d.ts.map +1 -1
  77. package/build/screens/conversation_select_recipients/conversation_select_direct_message_recipients_screen.js +332 -291
  78. package/build/screens/conversation_select_recipients/conversation_select_direct_message_recipients_screen.js.map +1 -1
  79. package/build/screens/conversation_select_recipients/conversation_select_group_recipients_screen.d.ts.map +1 -1
  80. package/build/screens/conversation_select_recipients/conversation_select_group_recipients_screen.js +2 -1
  81. package/build/screens/conversation_select_recipients/conversation_select_group_recipients_screen.js.map +1 -1
  82. package/build/screens/conversation_select_recipients/conversation_select_teams_i_lead_recipients_screen.d.ts.map +1 -1
  83. package/build/screens/conversation_select_recipients/conversation_select_teams_i_lead_recipients_screen.js +1 -0
  84. package/build/screens/conversation_select_recipients/conversation_select_teams_i_lead_recipients_screen.js.map +1 -1
  85. package/build/screens/design_system_screen.js +6 -3
  86. package/build/screens/design_system_screen.js.map +1 -1
  87. package/build/screens/get_help_screen.js +57 -63
  88. package/build/screens/get_help_screen.js.map +1 -1
  89. package/build/screens/group_notification_settings_screen.js +3 -2
  90. package/build/screens/group_notification_settings_screen.js.map +1 -1
  91. package/build/screens/notification_settings_screen.d.ts.map +1 -1
  92. package/build/screens/notification_settings_screen.js +1 -0
  93. package/build/screens/notification_settings_screen.js.map +1 -1
  94. package/build/screens/preferred_app_selection_screen.js +45 -39
  95. package/build/screens/preferred_app_selection_screen.js.map +1 -1
  96. package/build/screens/search/components/search_results_list.d.ts +4 -1
  97. package/build/screens/search/components/search_results_list.d.ts.map +1 -1
  98. package/build/screens/search/components/search_results_list.js +136 -110
  99. package/build/screens/search/components/search_results_list.js.map +1 -1
  100. package/build/screens/search/search_screen.d.ts.map +1 -1
  101. package/build/screens/search/search_screen.js +21 -28
  102. package/build/screens/search/search_screen.js.map +1 -1
  103. package/build/screens/send_giphy_screen.d.ts.map +1 -1
  104. package/build/screens/send_giphy_screen.js +93 -136
  105. package/build/screens/send_giphy_screen.js.map +1 -1
  106. package/build/screens/settings_screen.d.ts.map +1 -1
  107. package/build/screens/settings_screen.js +7 -6
  108. package/build/screens/settings_screen.js.map +1 -1
  109. package/build/utils/index.d.ts +1 -0
  110. package/build/utils/index.d.ts.map +1 -1
  111. package/build/utils/index.js +1 -0
  112. package/build/utils/index.js.map +1 -1
  113. package/build/utils/membership_sync_info_text.d.ts +2 -0
  114. package/build/utils/membership_sync_info_text.d.ts.map +1 -0
  115. package/build/utils/membership_sync_info_text.js +4 -0
  116. package/build/utils/membership_sync_info_text.js.map +1 -0
  117. package/build/utils/native_adapters/linking.d.ts +11 -3
  118. package/build/utils/native_adapters/linking.d.ts.map +1 -1
  119. package/build/utils/native_adapters/linking.js.map +1 -1
  120. package/build/vendor/font_awesome_pro_solid_icons.d.ts +6 -6
  121. package/build/vendor/font_awesome_pro_solid_icons.d.ts.map +1 -1
  122. package/build/vendor/font_awesome_pro_solid_icons.js +6 -6
  123. package/build/vendor/font_awesome_pro_solid_icons.js.map +1 -1
  124. package/package.json +5 -5
  125. package/src/__tests__/components/conversation/attachments/giphy_attachment.test.tsx +76 -0
  126. package/src/__tests__/screens/get_help_screen.test.ts +36 -0
  127. package/src/__utils__/render_with_query_client.tsx +13 -0
  128. package/src/components/conversation/__tests__/message_list.test.tsx +4 -0
  129. package/src/components/conversation/attachments/giphy_attachment.tsx +2 -3
  130. package/src/components/conversation/attachments/image_attachment.tsx +2 -3
  131. package/src/components/conversation/message_form.tsx +1 -1
  132. package/src/components/conversation/message_list.tsx +6 -0
  133. package/src/components/conversations/__tests__/conversation_preview.test.tsx +2 -2
  134. package/src/components/conversations/conversations.tsx +1 -0
  135. package/src/components/display/__tests__/conversation_avatar.test.tsx +94 -0
  136. package/src/components/display/conversation_avatar.tsx +9 -2
  137. package/src/components/display/keyboard_scroll_view.tsx +1 -0
  138. package/src/components/page/__tests__/page_error_boundary.test.tsx +33 -0
  139. package/src/components/page/page_error_boundary.tsx +43 -12
  140. package/src/hooks/__tests__/use_conversation_avatar_update.test.tsx +40 -0
  141. package/src/hooks/use_conversation_avatar_update.ts +67 -11
  142. package/src/icons/font_awesome.ts +12 -12
  143. package/src/navigation/index.tsx +6 -2
  144. package/src/navigation/page_error_fallbacks.ts +14 -0
  145. package/src/navigation/screenLayout.tsx +3 -1
  146. package/src/screens/age_check/age_check_required_screen.tsx +5 -1
  147. package/src/screens/age_check/age_check_underage_screen.tsx +2 -1
  148. package/src/screens/attachment_actions/__tests__/attachment_actions_screen.test.tsx +37 -1
  149. package/src/screens/attachment_actions/attachment_actions_screen.tsx +3 -2
  150. package/src/screens/avatar_picker/__tests__/avatar_picker_screen.test.tsx +67 -0
  151. package/src/screens/avatar_picker/__tests__/constants.test.ts +16 -0
  152. package/src/screens/avatar_picker/avatar_picker_screen.tsx +7 -1
  153. package/src/screens/avatar_picker/constants.ts +11 -6
  154. package/src/screens/bug_report_screen.tsx +3 -11
  155. package/src/screens/conversation_details_screen.tsx +1 -0
  156. package/src/screens/conversation_new/components/form_list.tsx +1 -0
  157. package/src/screens/conversation_new/components/groups_form.tsx +2 -2
  158. package/src/screens/conversation_new/components/services_form.tsx +2 -2
  159. package/src/screens/conversation_select_recipients/__tests__/conversation_select_direct_message_recipients_screen.test.tsx +100 -0
  160. package/src/screens/conversation_select_recipients/conversation_new_entry_screen.tsx +4 -1
  161. package/src/screens/conversation_select_recipients/conversation_select_direct_message_recipients_screen.tsx +78 -68
  162. package/src/screens/conversation_select_recipients/conversation_select_group_recipients_screen.tsx +2 -1
  163. package/src/screens/conversation_select_recipients/conversation_select_teams_i_lead_recipients_screen.tsx +1 -0
  164. package/src/screens/design_system_screen.tsx +10 -6
  165. package/src/screens/get_help_screen.tsx +5 -5
  166. package/src/screens/group_notification_settings_screen.tsx +3 -3
  167. package/src/screens/notification_settings_screen.tsx +1 -0
  168. package/src/screens/preferred_app_selection_screen.tsx +4 -4
  169. package/src/screens/search/__tests__/search_screen.test.tsx +11 -12
  170. package/src/screens/search/components/__tests__/conversation_results.test.tsx +14 -5
  171. package/src/screens/search/components/__tests__/message_result_row.test.tsx +5 -4
  172. package/src/screens/search/components/__tests__/search_results_list.test.tsx +10 -5
  173. package/src/screens/search/components/search_results_list.tsx +34 -13
  174. package/src/screens/search/search_screen.tsx +8 -18
  175. package/src/screens/send_giphy_screen.tsx +13 -44
  176. package/src/screens/settings_screen.tsx +25 -25
  177. package/src/utils/__tests__/membership_sync_info_text.test.ts +15 -0
  178. package/src/utils/index.ts +1 -0
  179. package/src/utils/membership_sync_info_text.ts +3 -0
  180. package/src/utils/native_adapters/__tests__/linking.test.ts +12 -0
  181. package/src/utils/native_adapters/linking.ts +12 -3
  182. package/src/vendor/font_awesome_pro_solid_icons.ts +6 -6
@@ -0,0 +1,16 @@
1
+ import * as vendoredIcons from '../../../vendor/font_awesome_pro_solid_icons'
2
+ import { AVATAR_ICON_KEYS } from '../constants'
3
+
4
+ const canonicalIconNames: string[] = Object.values(vendoredIcons).map(icon => icon.iconName)
5
+
6
+ describe('AVATAR_ICON_KEYS', () => {
7
+ it('only offers canonical icon names, never Font Awesome aliases', () => {
8
+ const aliases = AVATAR_ICON_KEYS.filter(key => !canonicalIconNames.includes(key))
9
+
10
+ expect(aliases).toEqual([])
11
+ })
12
+
13
+ it('has no duplicates', () => {
14
+ expect(new Set(AVATAR_ICON_KEYS).size).toBe(AVATAR_ICON_KEYS.length)
15
+ })
16
+ })
@@ -11,6 +11,7 @@ import { useTheme } from '../../hooks'
11
11
  import { useConversation } from '../../hooks/use_conversation'
12
12
  import {
13
13
  useConversationAvatarUpdate,
14
+ usePendingConversationAvatarUpdate,
14
15
  type AvatarUpdatePayload,
15
16
  } from '../../hooks/use_conversation_avatar_update'
16
17
  import { useFontScale } from '../../hooks/use_font_scale'
@@ -79,9 +80,14 @@ function EditModeContent({ conversationId }: { conversationId: number }) {
79
80
  const navigation = useNavigation()
80
81
  const { data: conversation } = useConversation({ conversation_id: conversationId })
81
82
  const mutation = useConversationAvatarUpdate({ conversationId })
83
+ const pendingUpdate = usePendingConversationAvatarUpdate(conversationId)
82
84
  const previewDiameter = usePreviewAvatarDiameter()
83
85
 
84
- const [state, dispatch] = useReducer(avatarPickerReducer, conversation, initAvatarPickerState)
86
+ const [state, dispatch] = useReducer(avatarPickerReducer, undefined, () =>
87
+ pendingUpdate
88
+ ? initAvatarPickerStateFromPayload(pendingUpdate)
89
+ : initAvatarPickerState(conversation)
90
+ )
85
91
 
86
92
  const hasAvatar = state.selectedType !== null
87
93
 
@@ -4,9 +4,9 @@ export const AVATAR_ICON_KEYS: string[] = [
4
4
  'church',
5
5
  'cross',
6
6
  'dove',
7
- 'hands-heart',
7
+ 'hands-holding-heart',
8
8
  'person-rays',
9
- 'praying-hands',
9
+ 'hands-praying',
10
10
  'podium',
11
11
  'droplet',
12
12
  'person-drowning',
@@ -21,13 +21,13 @@ export const AVATAR_ICON_KEYS: string[] = [
21
21
  'baby',
22
22
  'children',
23
23
  'mug-hot',
24
- 'video-camera',
24
+ 'video',
25
25
  'music',
26
26
  'piano-keyboard',
27
27
  'drum',
28
28
  'user-graduate',
29
29
  'comments-question',
30
- 'presentation',
30
+ 'presentation-screen',
31
31
  'microphone-stand',
32
32
  'id-badge',
33
33
  'book-user',
@@ -43,11 +43,16 @@ export const AVATAR_ICON_KEYS: string[] = [
43
43
  'person-dress',
44
44
  'person',
45
45
  'seedling',
46
- 'comments-alt',
46
+ 'messages',
47
47
  'globe',
48
48
  'book-open-reader',
49
- 'running',
49
+ 'person-running',
50
50
  'leaf',
51
+ // General
52
+ 'plate-utensils',
53
+ 'bullhorn',
54
+ 'car',
55
+ 'tag',
51
56
  ]
52
57
 
53
58
  export const GRID_COLUMNS = 6
@@ -5,15 +5,7 @@ import type {
5
5
  } from '@react-navigation/native-stack'
6
6
  import { startsWith } from 'lodash'
7
7
  import React, { useCallback, useState } from 'react'
8
- import {
9
- View,
10
- StyleSheet,
11
- TextInput,
12
- Linking,
13
- ScrollView,
14
- TouchableOpacity,
15
- Platform,
16
- } from 'react-native'
8
+ import { View, StyleSheet, TextInput, ScrollView, TouchableOpacity, Platform } from 'react-native'
17
9
  import { useSafeAreaInsets } from 'react-native-safe-area-context'
18
10
  import {
19
11
  Button,
@@ -38,7 +30,7 @@ import { useTheme } from '../hooks'
38
30
  import { useAppName } from '../hooks/use_app_name'
39
31
  import { useReportBugAction } from '../hooks/use_report_bug_action'
40
32
  import { useUploadClient } from '../hooks/use_upload_client'
41
- import { ImagePicker, ImagePickerResult, platformFontWeightBold } from '../utils'
33
+ import { ImagePicker, ImagePickerResult, Linking, platformFontWeightBold } from '../utils'
42
34
 
43
35
  const MAX_DESCRIPTION_LENGTH = 2000
44
36
 
@@ -292,7 +284,7 @@ export function BugReportScreen() {
292
284
 
293
285
  <View style={styles.textInputContainer}>
294
286
  <Text style={styles.fieldLabel}>
295
- What did you expect to happen? Please describe what actually happened.{' '}
287
+ What did you expect to happen? Please also describe what actually happened.{' '}
296
288
  <Text style={styles.required}>*</Text>
297
289
  </Text>
298
290
  <TextInput
@@ -427,6 +427,7 @@ export function ConversationDetailsScreen({ route }: ConversationDetailsScreenPr
427
427
  return (
428
428
  <View style={styles.listContainer}>
429
429
  <FlatList
430
+ contentInsetAdjustmentBehavior="automatic"
430
431
  data={listData as SectionListData}
431
432
  contentContainerStyle={styles.contentContainer}
432
433
  renderItem={({ item, index }) => {
@@ -23,6 +23,7 @@ export const FormList = ({
23
23
 
24
24
  return (
25
25
  <FlatList
26
+ contentInsetAdjustmentBehavior="automatic"
26
27
  data={memberData}
27
28
  ListHeaderComponent={FormContent}
28
29
  renderItem={({ item }) => <Person person={item} style={styles.person} />}
@@ -22,7 +22,7 @@ import { useMyGender } from '../../../hooks/use_my_gender'
22
22
  import { useUploadClient } from '../../../hooks/use_upload_client'
23
23
  import { GroupsGroupResource } from '../../../types'
24
24
  import { GraphId } from '../../../types/resources/group_resource'
25
- import { pluralize } from '../../../utils'
25
+ import { membershipSyncInfoText, pluralize } from '../../../utils'
26
26
  import { genderDisplayLabel } from '../../../utils/gender_display_label'
27
27
  import { Haptic } from '../../../utils/native_adapters'
28
28
  import { AvatarSelectionRow } from './avatar_selection_row'
@@ -147,7 +147,7 @@ export const GroupsForm = ({ groupId, chat_group_graph_id, avatarSelection }: Gr
147
147
  disabled={!title || isPending || validationPending || warnings.length > 0}
148
148
  title="Start Conversation"
149
149
  onPress={() => handleSave()}
150
- infoText="Conversation will be automatically updated if any members are added or removed from this group."
150
+ infoText={membershipSyncInfoText('the group')}
151
151
  warnings={warnings}
152
152
  />
153
153
  </KeyboardView>
@@ -17,7 +17,7 @@ import { useConversationValidate } from '../../../hooks/use_conversation_validat
17
17
  import { availableFeatures, useFeatures } from '../../../hooks/use_features'
18
18
  import { useUploadClient } from '../../../hooks/use_upload_client'
19
19
  import { MemberResource } from '../../../types'
20
- import { pluralize } from '../../../utils'
20
+ import { membershipSyncInfoText, pluralize } from '../../../utils'
21
21
  import { Haptic } from '../../../utils/native_adapters'
22
22
  import { tokens } from '../../../vendor/tapestry/tokens'
23
23
  import { TeamFilterTypes } from '../../conversation_filter_recipients/types'
@@ -139,7 +139,7 @@ export const ServicesForm = ({
139
139
  }
140
140
  title={selectionHasConversation ? 'Open conversation' : 'Start conversation'}
141
141
  onPress={createConversation}
142
- infoText="Conversation will be automatically updated if any members are added or removed from included teams."
142
+ infoText={membershipSyncInfoText(selectedTeamIds.length === 1 ? 'the team' : 'the teams')}
143
143
  loading={isLoadingConversationCheck}
144
144
  warnings={warnings}
145
145
  />
@@ -0,0 +1,100 @@
1
+ import { fireEvent, render } from '@testing-library/react-native'
2
+ import React from 'react'
3
+ import { SafeAreaProvider } from 'react-native-safe-area-context'
4
+ import { ScreenLayout } from '../../../navigation/screenLayout'
5
+ import { Log } from '../../../utils/native_adapters/configuration'
6
+ import { ResponseError } from '../../../utils/response_error'
7
+ import { ConversationSelectDirectMessageRecipientsScreen } from '../conversation_select_direct_message_recipients_screen'
8
+
9
+ jest.mock('@react-navigation/native', () => ({
10
+ ...jest.requireActual('@react-navigation/native'),
11
+ useNavigation: () => ({ getParent: jest.fn(), goBack: jest.fn(), navigate: jest.fn() }),
12
+ useRoute: () => ({ name: 'ConversationSelectDirectMessageRecipients' }),
13
+ }))
14
+ jest.mock('../../../hooks/use_features', () => ({
15
+ ...jest.requireActual('../../../hooks/use_features'),
16
+ useFeatures: () => ({ featureEnabled: () => false }),
17
+ }))
18
+ jest.mock('../../../hooks/use_debounced_search_term', () => ({
19
+ useDebouncedSearchTerm: (term: string) => term,
20
+ }))
21
+ jest.mock('../../../hooks/direct_messages/use_direct_message_conversation_validate', () => ({
22
+ useDirectMessageConversationValidate: () => ({ warnings: [], validationPending: false }),
23
+ }))
24
+ jest.mock('../../../hooks/direct_messages/use_find_or_create_direct_message_conversation', () => ({
25
+ useFindOrCreateDirectMessageConversation: () => ({
26
+ findOrCreateConversation: jest.fn(),
27
+ directMessageExists: false,
28
+ isFinding: false,
29
+ isError: false,
30
+ }),
31
+ }))
32
+ jest.mock('../../../hooks/direct_messages/use_direct_message_affiliations', () => ({
33
+ useDirectMessageAffiliations: () => ({
34
+ groups: new Map(),
35
+ teams: new Map(),
36
+ resultsDescription: null,
37
+ }),
38
+ }))
39
+ let mockSearchFailure: Error = new TypeError('Network request failed')
40
+ jest.mock('../../../hooks/direct_messages/use_direct_message_candidates', () => ({
41
+ useDirectMessageCandidates: (term: string) => {
42
+ if (term) throw mockSearchFailure
43
+ return { data: undefined, isFetching: false }
44
+ },
45
+ }))
46
+ jest.mock('../../../components/display/action_button', () => ({ ActionButton: () => null }))
47
+ jest.mock('../../../components/display/keyboard_view', () => ({
48
+ ...jest.requireActual('../../../components/display/keyboard_view'),
49
+ KeyboardView: ({ children }: { children: React.ReactNode }) => children,
50
+ }))
51
+
52
+ const renderScreen = () =>
53
+ render(
54
+ <SafeAreaProvider
55
+ initialMetrics={{
56
+ frame: { x: 0, y: 0, width: 390, height: 844 },
57
+ insets: { top: 0, left: 0, right: 0, bottom: 0 },
58
+ }}
59
+ >
60
+ <ScreenLayout>
61
+ <ConversationSelectDirectMessageRecipientsScreen route={{ params: {} } as never} />
62
+ </ScreenLayout>
63
+ </SafeAreaProvider>
64
+ )
65
+
66
+ describe('ConversationSelectDirectMessageRecipientsScreen', () => {
67
+ let reportError: jest.SpyInstance
68
+ let consoleError: jest.SpyInstance
69
+
70
+ beforeEach(() => {
71
+ reportError = jest.spyOn(Log, 'reportError').mockImplementation(() => {})
72
+ consoleError = jest.spyOn(console, 'error').mockImplementation(() => {})
73
+ })
74
+
75
+ afterEach(() => {
76
+ reportError.mockRestore()
77
+ consoleError.mockRestore()
78
+ })
79
+
80
+ it('hands a failed search to the page error view', () => {
81
+ mockSearchFailure = new TypeError('Network request failed')
82
+ const view = renderScreen()
83
+
84
+ fireEvent.changeText(view.getByPlaceholderText('Search'), 'pi')
85
+
86
+ expect(view.getByText('Problem connecting!')).toBeTruthy()
87
+ expect(view.queryByPlaceholderText('Search')).toBeNull()
88
+ expect(reportError).toHaveBeenCalledTimes(1)
89
+ })
90
+
91
+ it("uses the screen's own wording when the search fails for no known reason", () => {
92
+ mockSearchFailure = new ResponseError({ status: 500, statusText: 'x', errors: [] } as never)
93
+ const view = renderScreen()
94
+
95
+ fireEvent.changeText(view.getByPlaceholderText('Search'), 'pi')
96
+
97
+ expect(view.getByText("Couldn't load people right now")).toBeTruthy()
98
+ expect(view.queryByText('Oops!')).toBeNull()
99
+ })
100
+ })
@@ -59,7 +59,10 @@ export const ConversationNewEntryScreen = ({ route }: ConversationSelectRecipien
59
59
  }
60
60
 
61
61
  return (
62
- <ScrollView contentContainerStyle={styles.contentContainer}>
62
+ <ScrollView
63
+ contentInsetAdjustmentBehavior="automatic"
64
+ contentContainerStyle={styles.contentContainer}
65
+ >
63
66
  <View style={styles.header}>
64
67
  <Heading variant="h2">Start a conversation by</Heading>
65
68
  </View>
@@ -1,11 +1,10 @@
1
1
  import { PlatformPressable } from '@react-navigation/elements'
2
2
  import { StackActions, useNavigation } from '@react-navigation/native'
3
- import { RefObject, useRef, useState } from 'react'
3
+ import { ReactElement, RefObject, useRef, useState } from 'react'
4
4
  import { FlatList, Pressable, StyleSheet, TextInput, View } from 'react-native'
5
5
  import { Avatar, Badge, Banner, Icon, KeyboardView, Spinner, Text } from '../../components'
6
6
  import { ActionButton } from '../../components/display/action_button'
7
7
  import { AutoFocusAwareTextInput } from '../../components/display/text_input'
8
- import { ComponentErrorBoundary } from '../../components/page/component_error_boundary'
9
8
  import { useTheme } from '../../hooks'
10
9
  import { useDirectMessageAffiliations } from '../../hooks/direct_messages/use_direct_message_affiliations'
11
10
  import { useDirectMessageCandidates } from '../../hooks/direct_messages/use_direct_message_candidates'
@@ -92,38 +91,31 @@ export function ConversationSelectDirectMessageRecipientsScreen({
92
91
 
93
92
  return (
94
93
  <KeyboardView>
95
- {isError && (
96
- <Banner
97
- appearance="error"
98
- description="There was an issue starting the conversation. Please try again."
99
- style={styles.errorBanner}
100
- />
101
- )}
102
- <ToField
103
- selectedPeople={selectedPeople}
104
- searchTerm={searchTerm}
105
- onSearchChange={setSearchTerm}
106
- onRemove={removePerson}
107
- onClear={() => setSelectedPeople(new Map())}
108
- searchInputRef={searchInputRef}
109
- />
110
94
  <View style={styles.candidateResultsContainer}>
111
- <ComponentErrorBoundary
112
- key={debouncedTerm}
113
- fallback={
114
- <Banner
115
- appearance="error"
116
- description="Couldn't load people right now. Try again."
117
- style={styles.errorBanner}
118
- />
95
+ <CandidateResults
96
+ term={debouncedTerm}
97
+ selectedPeople={selectedPeople}
98
+ onSelect={selectPerson}
99
+ header={
100
+ <>
101
+ {isError && (
102
+ <Banner
103
+ appearance="error"
104
+ description="There was an issue starting the conversation. Please try again."
105
+ style={styles.errorBanner}
106
+ />
107
+ )}
108
+ <ToField
109
+ selectedPeople={selectedPeople}
110
+ searchTerm={searchTerm}
111
+ onSearchChange={setSearchTerm}
112
+ onRemove={removePerson}
113
+ onClear={() => setSelectedPeople(new Map())}
114
+ searchInputRef={searchInputRef}
115
+ />
116
+ </>
119
117
  }
120
- >
121
- <CandidateResults
122
- term={debouncedTerm}
123
- selectedPeople={selectedPeople}
124
- onSelect={selectPerson}
125
- />
126
- </ComponentErrorBoundary>
118
+ />
127
119
  </View>
128
120
  <ActionButton
129
121
  title={buttonText}
@@ -214,53 +206,57 @@ function CandidateResults({
214
206
  term,
215
207
  selectedPeople,
216
208
  onSelect,
209
+ header,
217
210
  }: {
218
211
  term: string
219
212
  selectedPeople: Map<string, DirectMessageCandidateResource>
220
213
  onSelect: (candidate: DirectMessageCandidateResource) => void
214
+ header: ReactElement
221
215
  }) {
222
216
  const styles = useStyles()
223
217
  const { data, isFetching } = useDirectMessageCandidates(term)
224
218
  const { groups, teams, resultsDescription } = useDirectMessageAffiliations()
225
219
 
226
- if (term.length < 1) {
227
- if (selectedPeople.size > 0) return null
220
+ const unselectedCandidates = (data?.data ?? []).filter(c => !selectedPeople.has(c.id))
221
+ const hasTruncated = (data?.meta.totalCount ?? 0) > (data?.data.length ?? 0)
222
+ const isAtLimit = selectedPeople.size >= MAX_RECIPIENTS
223
+ const showsResults = term.length >= 1 && !isAtLimit && unselectedCandidates.length > 0
228
224
 
229
- return (
230
- <View style={styles.emptyState}>
231
- <Icon name="churchCenter.people" size={40} style={styles.emptyStateIcon} />
232
- <Text style={styles.emptyStateTitle}>Search for people to direct message</Text>
233
- <Text variant="secondary" style={styles.emptyStateSubtitle}>
234
- Start a conversation with people in your groups and teams.
235
- </Text>
236
- </View>
237
- )
238
- }
225
+ const emptyState = (() => {
226
+ if (showsResults) return null
239
227
 
240
- const isAtLimit = selectedPeople.size >= MAX_RECIPIENTS
228
+ if (term.length < 1) {
229
+ if (selectedPeople.size > 0) return null
241
230
 
242
- if (isAtLimit) {
243
- return (
244
- <View style={styles.emptyState}>
245
- <Text variant="secondary" style={styles.emptyStateSubtitle}>
246
- You can add up to {MAX_RECIPIENTS} people to a direct message.
247
- </Text>
248
- </View>
249
- )
250
- }
231
+ return (
232
+ <View style={styles.emptyState}>
233
+ <Icon name="churchCenter.people" size={40} style={styles.emptyStateIcon} />
234
+ <Text style={styles.emptyStateTitle}>Search for people to direct message</Text>
235
+ <Text variant="secondary" style={styles.emptyStateSubtitle}>
236
+ Start a conversation with people in your groups and teams.
237
+ </Text>
238
+ </View>
239
+ )
240
+ }
251
241
 
252
- const unselectedCandidates = (data?.data ?? []).filter(c => !selectedPeople.has(c.id))
253
- const hasTruncated = (data?.meta.totalCount ?? 0) > (data?.data.length ?? 0)
242
+ if (isAtLimit) {
243
+ return (
244
+ <View style={styles.emptyState}>
245
+ <Text variant="secondary" style={styles.emptyStateSubtitle}>
246
+ You can add up to {MAX_RECIPIENTS} people to a direct message.
247
+ </Text>
248
+ </View>
249
+ )
250
+ }
254
251
 
255
- if (isFetching && unselectedCandidates.length === 0) {
256
- return (
257
- <View style={styles.emptyState}>
258
- <Spinner />
259
- </View>
260
- )
261
- }
252
+ if (isFetching) {
253
+ return (
254
+ <View style={styles.emptyState}>
255
+ <Spinner />
256
+ </View>
257
+ )
258
+ }
262
259
 
263
- if (!isFetching && unselectedCandidates.length === 0) {
264
260
  return (
265
261
  <View style={styles.emptyState}>
266
262
  <Icon name="general.search" size={32} style={styles.emptyStateIcon} />
@@ -270,13 +266,15 @@ function CandidateResults({
270
266
  </Text>
271
267
  </View>
272
268
  )
273
- }
269
+ })()
274
270
 
275
271
  return (
276
272
  <CandidateList
277
- candidates={unselectedCandidates}
273
+ header={header}
274
+ candidates={showsResults ? unselectedCandidates : []}
278
275
  hasTruncated={hasTruncated}
279
276
  description={resultsDescription}
277
+ emptyState={emptyState}
280
278
  groups={groups}
281
279
  teams={teams}
282
280
  onSelect={onSelect}
@@ -309,27 +307,33 @@ function candidateAffiliationNames(
309
307
  }
310
308
 
311
309
  function CandidateList({
310
+ header,
312
311
  candidates,
313
312
  hasTruncated,
314
313
  description,
314
+ emptyState,
315
315
  groups,
316
316
  teams,
317
317
  onSelect,
318
318
  }: {
319
+ header: ReactElement
319
320
  candidates: DirectMessageCandidateResource[]
320
321
  hasTruncated: boolean
321
322
  description: string | null
323
+ emptyState: ReactElement | null
322
324
  groups: Map<number, string>
323
325
  teams: Map<number, string>
324
326
  onSelect: (candidate: DirectMessageCandidateResource) => void
325
327
  }) {
326
328
  const styles = useStyles()
329
+ const hasCandidates = candidates.length > 0
327
330
  const available = candidates.filter(c => !c.directMessagesDisabled)
328
331
  const dmDisabled = candidates.filter(c => c.directMessagesDisabled)
329
332
 
330
333
  return (
331
334
  <FlatList<DirectMessageCandidateResource>
332
335
  data={available}
336
+ contentInsetAdjustmentBehavior="automatic"
333
337
  keyboardShouldPersistTaps="handled"
334
338
  keyExtractor={item => item.id}
335
339
  renderItem={({ item }) => (
@@ -340,7 +344,13 @@ function CandidateList({
340
344
  onSelect={() => onSelect(item)}
341
345
  />
342
346
  )}
343
- ListHeaderComponent={<ResultsHeading description={description} />}
347
+ ListHeaderComponent={
348
+ <>
349
+ {header}
350
+ {hasCandidates && <ResultsHeading description={description} />}
351
+ </>
352
+ }
353
+ ListEmptyComponent={emptyState}
344
354
  ListFooterComponent={
345
355
  <>
346
356
  {dmDisabled.length > 0 && (
@@ -361,7 +371,7 @@ function CandidateList({
361
371
  ))}
362
372
  </>
363
373
  )}
364
- {hasTruncated && (
374
+ {hasCandidates && hasTruncated && (
365
375
  <View style={styles.truncatedFooter}>
366
376
  <Text variant="secondary" style={styles.truncatedText}>
367
377
  Keep typing to narrow your results.
@@ -23,7 +23,7 @@ const SECTION_CONFIG = {
23
23
  },
24
24
  [SectionKey.more]: {
25
25
  title: 'More groups',
26
- subtitle: 'You can not start a new conversation in these groups',
26
+ subtitle: "You can't start a new conversation in these groups",
27
27
  ListItemComponent: RestrictedGroupRow,
28
28
  },
29
29
  }
@@ -60,6 +60,7 @@ export const ConversationSelectGroupRecipientsScreen = ({
60
60
 
61
61
  return (
62
62
  <SectionList<GroupsGroupResource, GroupsSection>
63
+ contentInsetAdjustmentBehavior="automatic"
63
64
  sections={sections}
64
65
  keyExtractor={item => item.id.toString()}
65
66
  stickySectionHeadersEnabled={false}
@@ -32,6 +32,7 @@ export const ConversationSelectTeamsILeadRecipientsScreen = ({
32
32
 
33
33
  return (
34
34
  <FlatList
35
+ contentInsetAdjustmentBehavior="automatic"
35
36
  data={serviceTypes}
36
37
  keyExtractor={item => item.id.toString()}
37
38
  contentContainerStyle={styles.contentContainer}
@@ -1128,9 +1128,9 @@ const FA_ICONS: { category: string; icons: IconName[] }[] = [
1128
1128
  'church',
1129
1129
  'cross',
1130
1130
  'dove',
1131
- 'hands-heart',
1131
+ 'hands-holding-heart',
1132
1132
  'person-rays',
1133
- 'praying-hands',
1133
+ 'hands-praying',
1134
1134
  'podium',
1135
1135
  'droplet',
1136
1136
  'person-drowning',
@@ -1149,13 +1149,13 @@ const FA_ICONS: { category: string; icons: IconName[] }[] = [
1149
1149
  'baby',
1150
1150
  'children',
1151
1151
  'mug-hot',
1152
- 'video-camera',
1152
+ 'video',
1153
1153
  'music',
1154
1154
  'piano-keyboard',
1155
1155
  'drum',
1156
1156
  'user-graduate',
1157
1157
  'comments-question',
1158
- 'presentation',
1158
+ 'presentation-screen',
1159
1159
  'microphone-stand',
1160
1160
  'id-badge',
1161
1161
  'book-user',
@@ -1175,13 +1175,17 @@ const FA_ICONS: { category: string; icons: IconName[] }[] = [
1175
1175
  'person-dress',
1176
1176
  'person',
1177
1177
  'seedling',
1178
- 'comments-alt',
1178
+ 'messages',
1179
1179
  'globe',
1180
1180
  'book-open-reader',
1181
- 'running',
1181
+ 'person-running',
1182
1182
  'leaf',
1183
1183
  ],
1184
1184
  },
1185
+ {
1186
+ category: 'General',
1187
+ icons: ['plate-utensils', 'bullhorn', 'car', 'tag'],
1188
+ },
1185
1189
  ]
1186
1190
 
1187
1191
  function FontAwesomeIconsSection({ isLast }: SectionProps) {
@@ -1,12 +1,12 @@
1
1
  import { StaticScreenProps, useNavigation } from '@react-navigation/native'
2
2
  import { useCallback, useMemo } from 'react'
3
- import { Alert, Linking, StyleSheet, View } from 'react-native'
3
+ import { Alert, 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 } from '../utils'
9
+ import { Clipboard, Linking } from '../utils'
10
10
 
11
11
  type GetHelpScreenRouteProps = {
12
12
  type?: 'chat' | 'general'
@@ -56,7 +56,7 @@ export const GetHelpScreen = ({ route }: GetHelpScreenProps) => {
56
56
  }, [navigation])
57
57
 
58
58
  return (
59
- <View style={[styles.container]}>
59
+ <ScrollView contentInsetAdjustmentBehavior="automatic" contentContainerStyle={styles.container}>
60
60
  {appSpecificHelpUrls.length > 0 && (
61
61
  <Heading variant="h2" style={[styles.heading, styles.headingBottomBorder]}>
62
62
  How-to articles
@@ -90,7 +90,7 @@ export const GetHelpScreen = ({ route }: GetHelpScreenProps) => {
90
90
  to the development team.
91
91
  </Text>
92
92
  </View>
93
- </View>
93
+ </ScrollView>
94
94
  )
95
95
  }
96
96
 
@@ -145,7 +145,7 @@ const useStyles = () => {
145
145
 
146
146
  return StyleSheet.create({
147
147
  container: {
148
- flex: 1,
148
+ flexGrow: 1,
149
149
  },
150
150
  text: {
151
151
  paddingVertical: 4,