@planningcenter/chat-react-native 4.5.1-rc.0 → 4.6.0-qa-1063.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/assets/powered_by_giphy.png +0 -0
- package/assets/powered_by_giphy_dark.png +0 -0
- package/build/components/conversation/attachments/giphy_attachment.d.ts.map +1 -1
- package/build/components/conversation/attachments/giphy_attachment.js +2 -2
- package/build/components/conversation/attachments/giphy_attachment.js.map +1 -1
- package/build/components/conversation/attachments/image_attachment.d.ts.map +1 -1
- package/build/components/conversation/attachments/image_attachment.js +5 -3
- package/build/components/conversation/attachments/image_attachment.js.map +1 -1
- package/build/components/conversation/message_form.d.ts.map +1 -1
- package/build/components/conversation/message_form.js +2 -2
- package/build/components/conversation/message_form.js.map +1 -1
- package/build/components/conversation/message_list.d.ts.map +1 -1
- package/build/components/conversation/message_list.js +155 -123
- package/build/components/conversation/message_list.js.map +1 -1
- package/build/components/conversations/conversations.d.ts.map +1 -1
- package/build/components/conversations/conversations.js +1 -0
- package/build/components/conversations/conversations.js.map +1 -1
- package/build/components/display/conversation_avatar.d.ts +3 -1
- package/build/components/display/conversation_avatar.d.ts.map +1 -1
- package/build/components/display/conversation_avatar.js +77 -66
- package/build/components/display/conversation_avatar.js.map +1 -1
- package/build/components/display/keyboard_scroll_view.d.ts.map +1 -1
- package/build/components/display/keyboard_scroll_view.js +1 -0
- package/build/components/display/keyboard_scroll_view.js.map +1 -1
- package/build/components/page/page_error_boundary.d.ts +9 -1
- package/build/components/page/page_error_boundary.d.ts.map +1 -1
- package/build/components/page/page_error_boundary.js +56 -31
- package/build/components/page/page_error_boundary.js.map +1 -1
- package/build/hooks/use_conversation_avatar_update.d.ts +4 -3
- package/build/hooks/use_conversation_avatar_update.d.ts.map +1 -1
- package/build/hooks/use_conversation_avatar_update.js +146 -48
- package/build/hooks/use_conversation_avatar_update.js.map +1 -1
- package/build/navigation/index.d.ts.map +1 -1
- package/build/navigation/index.js +3 -1
- package/build/navigation/index.js.map +1 -1
- package/build/navigation/page_error_fallbacks.d.ts +7 -0
- package/build/navigation/page_error_fallbacks.d.ts.map +1 -0
- package/build/navigation/page_error_fallbacks.js +7 -0
- package/build/navigation/page_error_fallbacks.js.map +1 -0
- package/build/navigation/screenLayout.d.ts.map +1 -1
- package/build/navigation/screenLayout.js +10 -6
- package/build/navigation/screenLayout.js.map +1 -1
- package/build/screens/age_check/age_check_required_screen.d.ts.map +1 -1
- package/build/screens/age_check/age_check_required_screen.js +1 -0
- package/build/screens/age_check/age_check_required_screen.js.map +1 -1
- package/build/screens/age_check/age_check_underage_screen.d.ts.map +1 -1
- package/build/screens/age_check/age_check_underage_screen.js +2 -1
- package/build/screens/age_check/age_check_underage_screen.js.map +1 -1
- package/build/screens/attachment_actions/attachment_actions_screen.d.ts.map +1 -1
- package/build/screens/attachment_actions/attachment_actions_screen.js +5 -2
- package/build/screens/attachment_actions/attachment_actions_screen.js.map +1 -1
- package/build/screens/avatar_picker/avatar_picker_screen.d.ts.map +1 -1
- package/build/screens/avatar_picker/avatar_picker_screen.js +76 -66
- package/build/screens/avatar_picker/avatar_picker_screen.js.map +1 -1
- package/build/screens/bug_report_screen.d.ts.map +1 -1
- package/build/screens/bug_report_screen.js +3 -3
- package/build/screens/bug_report_screen.js.map +1 -1
- package/build/screens/conversation_details_screen.d.ts.map +1 -1
- package/build/screens/conversation_details_screen.js +1 -0
- package/build/screens/conversation_details_screen.js.map +1 -1
- package/build/screens/conversation_new/components/form_list.d.ts.map +1 -1
- package/build/screens/conversation_new/components/form_list.js +1 -0
- package/build/screens/conversation_new/components/form_list.js.map +1 -1
- package/build/screens/conversation_new/components/groups_form.js +25 -18
- package/build/screens/conversation_new/components/groups_form.js.map +1 -1
- package/build/screens/conversation_new/components/services_form.js +51 -40
- package/build/screens/conversation_new/components/services_form.js.map +1 -1
- package/build/screens/conversation_select_recipients/conversation_new_entry_screen.d.ts.map +1 -1
- package/build/screens/conversation_select_recipients/conversation_new_entry_screen.js +1 -0
- package/build/screens/conversation_select_recipients/conversation_new_entry_screen.js.map +1 -1
- package/build/screens/conversation_select_recipients/conversation_select_direct_message_recipients_screen.d.ts.map +1 -1
- package/build/screens/conversation_select_recipients/conversation_select_direct_message_recipients_screen.js +332 -291
- package/build/screens/conversation_select_recipients/conversation_select_direct_message_recipients_screen.js.map +1 -1
- package/build/screens/conversation_select_recipients/conversation_select_group_recipients_screen.d.ts.map +1 -1
- package/build/screens/conversation_select_recipients/conversation_select_group_recipients_screen.js +2 -1
- package/build/screens/conversation_select_recipients/conversation_select_group_recipients_screen.js.map +1 -1
- package/build/screens/conversation_select_recipients/conversation_select_teams_i_lead_recipients_screen.d.ts.map +1 -1
- package/build/screens/conversation_select_recipients/conversation_select_teams_i_lead_recipients_screen.js +1 -0
- package/build/screens/conversation_select_recipients/conversation_select_teams_i_lead_recipients_screen.js.map +1 -1
- package/build/screens/get_help_screen.js +57 -63
- package/build/screens/get_help_screen.js.map +1 -1
- package/build/screens/group_notification_settings_screen.js +3 -2
- package/build/screens/group_notification_settings_screen.js.map +1 -1
- package/build/screens/notification_settings_screen.d.ts.map +1 -1
- package/build/screens/notification_settings_screen.js +1 -0
- package/build/screens/notification_settings_screen.js.map +1 -1
- package/build/screens/preferred_app_selection_screen.js +45 -39
- package/build/screens/preferred_app_selection_screen.js.map +1 -1
- package/build/screens/search/components/search_results_list.d.ts +4 -1
- package/build/screens/search/components/search_results_list.d.ts.map +1 -1
- package/build/screens/search/components/search_results_list.js +136 -110
- package/build/screens/search/components/search_results_list.js.map +1 -1
- package/build/screens/search/search_screen.d.ts.map +1 -1
- package/build/screens/search/search_screen.js +21 -28
- package/build/screens/search/search_screen.js.map +1 -1
- package/build/screens/send_giphy_screen.d.ts.map +1 -1
- package/build/screens/send_giphy_screen.js +93 -136
- package/build/screens/send_giphy_screen.js.map +1 -1
- package/build/screens/settings_screen.d.ts.map +1 -1
- package/build/screens/settings_screen.js +7 -6
- package/build/screens/settings_screen.js.map +1 -1
- package/build/utils/index.d.ts +1 -0
- package/build/utils/index.d.ts.map +1 -1
- package/build/utils/index.js +1 -0
- package/build/utils/index.js.map +1 -1
- package/build/utils/membership_sync_info_text.d.ts +2 -0
- package/build/utils/membership_sync_info_text.d.ts.map +1 -0
- package/build/utils/membership_sync_info_text.js +4 -0
- package/build/utils/membership_sync_info_text.js.map +1 -0
- package/build/utils/native_adapters/linking.d.ts +11 -3
- package/build/utils/native_adapters/linking.d.ts.map +1 -1
- package/build/utils/native_adapters/linking.js.map +1 -1
- package/package.json +3 -3
- package/src/__tests__/components/conversation/attachments/giphy_attachment.test.tsx +76 -0
- package/src/__tests__/screens/get_help_screen.test.ts +36 -0
- package/src/__utils__/render_with_query_client.tsx +13 -0
- package/src/components/conversation/__tests__/message_list.test.tsx +4 -0
- package/src/components/conversation/attachments/giphy_attachment.tsx +2 -3
- package/src/components/conversation/attachments/image_attachment.tsx +2 -3
- package/src/components/conversation/message_form.tsx +1 -1
- package/src/components/conversation/message_list.tsx +6 -0
- package/src/components/conversations/__tests__/conversation_preview.test.tsx +2 -2
- package/src/components/conversations/conversations.tsx +1 -0
- package/src/components/display/__tests__/conversation_avatar.test.tsx +94 -0
- package/src/components/display/conversation_avatar.tsx +9 -2
- package/src/components/display/keyboard_scroll_view.tsx +1 -0
- package/src/components/page/__tests__/page_error_boundary.test.tsx +33 -0
- package/src/components/page/page_error_boundary.tsx +43 -12
- package/src/hooks/__tests__/use_conversation_avatar_update.test.tsx +40 -0
- package/src/hooks/use_conversation_avatar_update.ts +67 -11
- package/src/navigation/index.tsx +6 -2
- package/src/navigation/page_error_fallbacks.ts +14 -0
- package/src/navigation/screenLayout.tsx +3 -1
- package/src/screens/age_check/age_check_required_screen.tsx +5 -1
- package/src/screens/age_check/age_check_underage_screen.tsx +2 -1
- package/src/screens/attachment_actions/__tests__/attachment_actions_screen.test.tsx +37 -1
- package/src/screens/attachment_actions/attachment_actions_screen.tsx +3 -2
- package/src/screens/avatar_picker/__tests__/avatar_picker_screen.test.tsx +67 -0
- package/src/screens/avatar_picker/avatar_picker_screen.tsx +7 -1
- package/src/screens/bug_report_screen.tsx +3 -11
- package/src/screens/conversation_details_screen.tsx +1 -0
- package/src/screens/conversation_new/components/form_list.tsx +1 -0
- package/src/screens/conversation_new/components/groups_form.tsx +2 -2
- package/src/screens/conversation_new/components/services_form.tsx +2 -2
- package/src/screens/conversation_select_recipients/__tests__/conversation_select_direct_message_recipients_screen.test.tsx +100 -0
- package/src/screens/conversation_select_recipients/conversation_new_entry_screen.tsx +4 -1
- package/src/screens/conversation_select_recipients/conversation_select_direct_message_recipients_screen.tsx +78 -68
- package/src/screens/conversation_select_recipients/conversation_select_group_recipients_screen.tsx +2 -1
- package/src/screens/conversation_select_recipients/conversation_select_teams_i_lead_recipients_screen.tsx +1 -0
- package/src/screens/get_help_screen.tsx +5 -5
- package/src/screens/group_notification_settings_screen.tsx +3 -3
- package/src/screens/notification_settings_screen.tsx +1 -0
- package/src/screens/preferred_app_selection_screen.tsx +4 -4
- package/src/screens/search/__tests__/search_screen.test.tsx +11 -12
- package/src/screens/search/components/__tests__/conversation_results.test.tsx +14 -5
- package/src/screens/search/components/__tests__/message_result_row.test.tsx +5 -4
- package/src/screens/search/components/__tests__/search_results_list.test.tsx +10 -5
- package/src/screens/search/components/search_results_list.tsx +34 -13
- package/src/screens/search/search_screen.tsx +8 -18
- package/src/screens/send_giphy_screen.tsx +13 -44
- package/src/screens/settings_screen.tsx +25 -25
- package/src/utils/__tests__/membership_sync_info_text.test.ts +15 -0
- package/src/utils/index.ts +1 -0
- package/src/utils/membership_sync_info_text.ts +3 -0
- package/src/utils/native_adapters/__tests__/linking.test.ts +12 -0
- package/src/utils/native_adapters/linking.ts +12 -3
|
@@ -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
|
-
<
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
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
|
-
|
|
227
|
-
|
|
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
|
-
|
|
230
|
-
|
|
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
|
-
|
|
228
|
+
if (term.length < 1) {
|
|
229
|
+
if (selectedPeople.size > 0) return null
|
|
241
230
|
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
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
|
-
|
|
253
|
-
|
|
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
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
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
|
-
|
|
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={
|
|
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.
|
package/src/screens/conversation_select_recipients/conversation_select_group_recipients_screen.tsx
CHANGED
|
@@ -23,7 +23,7 @@ const SECTION_CONFIG = {
|
|
|
23
23
|
},
|
|
24
24
|
[SectionKey.more]: {
|
|
25
25
|
title: 'More groups',
|
|
26
|
-
subtitle:
|
|
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}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { StaticScreenProps, useNavigation } from '@react-navigation/native'
|
|
2
2
|
import { useCallback, useMemo } from 'react'
|
|
3
|
-
import { Alert,
|
|
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
|
-
<
|
|
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
|
-
</
|
|
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
|
-
|
|
148
|
+
flexGrow: 1,
|
|
149
149
|
},
|
|
150
150
|
text: {
|
|
151
151
|
paddingVertical: 4,
|
|
@@ -2,7 +2,7 @@ import { PlatformPressable } from '@react-navigation/elements'
|
|
|
2
2
|
import { StaticScreenProps, useNavigation } from '@react-navigation/native'
|
|
3
3
|
import type { NativeStackNavigationProp } from '@react-navigation/native-stack'
|
|
4
4
|
import React, { useEffect } from 'react'
|
|
5
|
-
import { Platform, StyleSheet, View } from 'react-native'
|
|
5
|
+
import { Platform, ScrollView, StyleSheet, View } from 'react-native'
|
|
6
6
|
import { Heading, Icon, Text } from '../components'
|
|
7
7
|
import { useTheme } from '../hooks'
|
|
8
8
|
import { platformFontWeightBold } from '../utils/styles'
|
|
@@ -38,7 +38,7 @@ export function GroupNotificationSettingsScreen({ route }: GroupNotificationSett
|
|
|
38
38
|
}
|
|
39
39
|
|
|
40
40
|
return (
|
|
41
|
-
<
|
|
41
|
+
<ScrollView contentInsetAdjustmentBehavior="automatic" style={styles.container}>
|
|
42
42
|
<View style={styles.sectionOuter}>
|
|
43
43
|
<View style={styles.sectionInner}>
|
|
44
44
|
<Heading variant="h2" style={styles.sectionHeading}>
|
|
@@ -76,7 +76,7 @@ export function GroupNotificationSettingsScreen({ route }: GroupNotificationSett
|
|
|
76
76
|
)}
|
|
77
77
|
</View>
|
|
78
78
|
</PlatformPressable>
|
|
79
|
-
</
|
|
79
|
+
</ScrollView>
|
|
80
80
|
)
|
|
81
81
|
}
|
|
82
82
|
|
|
@@ -123,6 +123,7 @@ export function NotificationSettingsScreen({}: NotificationSettingsScreenProps)
|
|
|
123
123
|
return (
|
|
124
124
|
<View style={styles.listContainer}>
|
|
125
125
|
<FlatList
|
|
126
|
+
contentInsetAdjustmentBehavior="automatic"
|
|
126
127
|
data={listData as SectionListData}
|
|
127
128
|
contentContainerStyle={styles.contentContainer}
|
|
128
129
|
renderItem={({ item, index }) => {
|
|
@@ -2,7 +2,7 @@ import { PlatformPressable } from '@react-navigation/elements'
|
|
|
2
2
|
import { StaticScreenProps } from '@react-navigation/native'
|
|
3
3
|
import { useMutation } from '@tanstack/react-query'
|
|
4
4
|
import React, { type PropsWithChildren } from 'react'
|
|
5
|
-
import { Image, StyleSheet, View, type ViewStyle } from 'react-native'
|
|
5
|
+
import { Image, ScrollView, StyleSheet, View, type ViewStyle } from 'react-native'
|
|
6
6
|
import { Heading, Icon, Text } from '../components'
|
|
7
7
|
import { useApiClient, useTheme } from '../hooks'
|
|
8
8
|
import { useAppName } from '../hooks/use_app_name'
|
|
@@ -45,7 +45,7 @@ export function PreferredAppSelectionScreen({ route }: PreferredAppSelectionScre
|
|
|
45
45
|
const sectionTitle = chatType ? chatTypeLabel(chatType.title) : undefined
|
|
46
46
|
|
|
47
47
|
return (
|
|
48
|
-
<
|
|
48
|
+
<ScrollView contentInsetAdjustmentBehavior="automatic" contentContainerStyle={styles.container}>
|
|
49
49
|
<View style={styles.section}>
|
|
50
50
|
<Heading variant="h2" style={styles.sectionHeading}>
|
|
51
51
|
{sectionTitle}
|
|
@@ -64,7 +64,7 @@ export function PreferredAppSelectionScreen({ route }: PreferredAppSelectionScre
|
|
|
64
64
|
</PressableRow>
|
|
65
65
|
))}
|
|
66
66
|
</View>
|
|
67
|
-
</
|
|
67
|
+
</ScrollView>
|
|
68
68
|
)
|
|
69
69
|
}
|
|
70
70
|
|
|
@@ -118,7 +118,7 @@ const PressableRow = ({
|
|
|
118
118
|
|
|
119
119
|
const styles = StyleSheet.create({
|
|
120
120
|
container: {
|
|
121
|
-
|
|
121
|
+
flexGrow: 1,
|
|
122
122
|
},
|
|
123
123
|
section: {
|
|
124
124
|
paddingTop: 24,
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import { act, fireEvent
|
|
1
|
+
import { act, fireEvent } from '@testing-library/react-native'
|
|
2
2
|
import React from 'react'
|
|
3
3
|
import { Keyboard, ScrollView } from 'react-native'
|
|
4
|
+
import { renderWithQueryClient } from '../../../__utils__/render_with_query_client'
|
|
4
5
|
import type { useSearchResults } from '../../../hooks/use_search_results'
|
|
5
6
|
import type {
|
|
6
7
|
ConversationSearchResultResource,
|
|
@@ -71,7 +72,7 @@ const renderWithResults = () => {
|
|
|
71
72
|
hasNextPage: false,
|
|
72
73
|
isFetchingNextPage: false,
|
|
73
74
|
})
|
|
74
|
-
const view =
|
|
75
|
+
const view = renderWithQueryClient(<SearchScreen />)
|
|
75
76
|
const input = view.getByLabelText(inputLabel)
|
|
76
77
|
fireEvent.changeText(input, 'bud')
|
|
77
78
|
fireEvent.changeText(input, 'budget')
|
|
@@ -99,37 +100,35 @@ afterEach(() => jest.useRealTimers())
|
|
|
99
100
|
|
|
100
101
|
describe('SearchScreen', () => {
|
|
101
102
|
it('searches once with the trimmed term after typing settles', () => {
|
|
102
|
-
const view =
|
|
103
|
+
const view = renderWithQueryClient(<SearchScreen />)
|
|
103
104
|
const input = view.getByLabelText(inputLabel)
|
|
104
105
|
|
|
105
106
|
fireEvent.changeText(input, 'bud')
|
|
106
107
|
fireEvent.changeText(input, ' budget ')
|
|
107
108
|
|
|
108
109
|
expect(view.getByText('Search chat')).toBeTruthy()
|
|
109
|
-
|
|
110
|
+
const searchedTerms = () =>
|
|
111
|
+
new Set(mockUseSearchResults.mock.calls.map(([term]) => term).filter(term => term.trim()))
|
|
112
|
+
expect([...searchedTerms()]).toEqual([])
|
|
110
113
|
|
|
111
114
|
act(() => jest.advanceTimersByTime(200))
|
|
112
115
|
|
|
113
|
-
|
|
114
|
-
expect([...searchedTerms]).toEqual(['budget'])
|
|
116
|
+
expect([...searchedTerms()]).toEqual(['budget'])
|
|
115
117
|
expect(view.queryByText('Search chat')).toBeNull()
|
|
116
118
|
expect(view.getByLabelText('Loading results')).toBeTruthy()
|
|
117
119
|
})
|
|
118
120
|
|
|
119
121
|
it('lets the prompt scroll while taps still reach the field', () => {
|
|
120
|
-
const view =
|
|
122
|
+
const view = renderWithQueryClient(<SearchScreen />)
|
|
121
123
|
|
|
122
124
|
const scrollView = view.UNSAFE_getByType(ScrollView)
|
|
123
125
|
expect(scrollView.props.keyboardShouldPersistTaps).toBe('handled')
|
|
124
|
-
expect(scrollView.props.contentContainerStyle).toMatchObject({
|
|
125
|
-
flexGrow: 1,
|
|
126
|
-
justifyContent: 'center',
|
|
127
|
-
})
|
|
126
|
+
expect(scrollView.props.contentContainerStyle).toMatchObject({ flexGrow: 1 })
|
|
128
127
|
expect(view.getByText('Search chat')).toBeTruthy()
|
|
129
128
|
})
|
|
130
129
|
|
|
131
130
|
it('returns to the prompt as soon as the term is cleared', () => {
|
|
132
|
-
const view =
|
|
131
|
+
const view = renderWithQueryClient(<SearchScreen />)
|
|
133
132
|
const input = view.getByLabelText(inputLabel)
|
|
134
133
|
|
|
135
134
|
fireEvent.changeText(input, 'budget')
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { fireEvent
|
|
1
|
+
import { fireEvent } from '@testing-library/react-native'
|
|
2
2
|
import React from 'react'
|
|
3
|
+
import { renderWithQueryClient } from '../../../../__utils__/render_with_query_client'
|
|
3
4
|
import type { ConversationSearchResultResource } from '../../../../types'
|
|
4
5
|
import { ConversationResults } from '../conversation_results'
|
|
5
6
|
|
|
@@ -14,7 +15,9 @@ const buildResults = (count: number, prefix = 'Conversation') =>
|
|
|
14
15
|
|
|
15
16
|
describe('ConversationResults', () => {
|
|
16
17
|
it('caps at five rows until View more is pressed, then offers View less', () => {
|
|
17
|
-
const view =
|
|
18
|
+
const view = renderWithQueryClient(
|
|
19
|
+
<ConversationResults results={buildResults(6)} onSelect={jest.fn()} />
|
|
20
|
+
)
|
|
18
21
|
|
|
19
22
|
expect(view.getByText('Conversation 5')).toBeTruthy()
|
|
20
23
|
expect(view.queryByText('Conversation 6')).toBeNull()
|
|
@@ -27,14 +30,18 @@ describe('ConversationResults', () => {
|
|
|
27
30
|
})
|
|
28
31
|
|
|
29
32
|
it('renders no footer for five or fewer results', () => {
|
|
30
|
-
const view =
|
|
33
|
+
const view = renderWithQueryClient(
|
|
34
|
+
<ConversationResults results={buildResults(4)} onSelect={jest.fn()} />
|
|
35
|
+
)
|
|
31
36
|
|
|
32
37
|
expect(view.getByText('Conversation 4')).toBeTruthy()
|
|
33
38
|
expect(view.queryByText('View more')).toBeNull()
|
|
34
39
|
})
|
|
35
40
|
|
|
36
41
|
it('stays expanded when the parent re-renders with a new results array', () => {
|
|
37
|
-
const view =
|
|
42
|
+
const view = renderWithQueryClient(
|
|
43
|
+
<ConversationResults results={buildResults(6)} onSelect={jest.fn()} />
|
|
44
|
+
)
|
|
38
45
|
fireEvent.press(view.getByText('View more'))
|
|
39
46
|
|
|
40
47
|
view.rerender(<ConversationResults results={buildResults(6)} onSelect={jest.fn()} />)
|
|
@@ -46,7 +53,9 @@ describe('ConversationResults', () => {
|
|
|
46
53
|
it('passes the pressed result and its position to onSelect', () => {
|
|
47
54
|
const onSelect = jest.fn()
|
|
48
55
|
const results = buildResults(2)
|
|
49
|
-
const view =
|
|
56
|
+
const view = renderWithQueryClient(
|
|
57
|
+
<ConversationResults results={results} onSelect={onSelect} />
|
|
58
|
+
)
|
|
50
59
|
|
|
51
60
|
fireEvent.press(view.getByText('Conversation 2'))
|
|
52
61
|
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { fireEvent
|
|
1
|
+
import { fireEvent } from '@testing-library/react-native'
|
|
2
2
|
import React from 'react'
|
|
3
|
+
import { renderWithQueryClient } from '../../../../__utils__/render_with_query_client'
|
|
3
4
|
import type { MessageSearchResultResource } from '../../../../types/resources/search_result'
|
|
4
5
|
import { formatDatePreview } from '../../../../utils/date'
|
|
5
6
|
import { defaultTheme } from '../../../../utils/theme'
|
|
@@ -33,7 +34,7 @@ const interactionColor = defaultTheme('light').colors.interaction
|
|
|
33
34
|
|
|
34
35
|
describe('MessageResultRow', () => {
|
|
35
36
|
it('renders the title, author, snippet, and date', () => {
|
|
36
|
-
const view =
|
|
37
|
+
const view = renderWithQueryClient(<MessageResultRow result={result} onPress={jest.fn()} />)
|
|
37
38
|
|
|
38
39
|
expect(view.getByText('Worship Team')).toBeTruthy()
|
|
39
40
|
expect(view.getByText('Ada Lovelace:', { exact: false })).toBeTruthy()
|
|
@@ -44,7 +45,7 @@ describe('MessageResultRow', () => {
|
|
|
44
45
|
})
|
|
45
46
|
|
|
46
47
|
it('colors matched segments with the interaction color', () => {
|
|
47
|
-
const view =
|
|
48
|
+
const view = renderWithQueryClient(<MessageResultRow result={result} onPress={jest.fn()} />)
|
|
48
49
|
|
|
49
50
|
expect(view.getByText('budget')).toHaveStyle({ color: interactionColor })
|
|
50
51
|
expect(view.getByText('…planning the ')).not.toHaveStyle({ color: interactionColor })
|
|
@@ -53,7 +54,7 @@ describe('MessageResultRow', () => {
|
|
|
53
54
|
it('exposes the row as a button with a composed label and reports presses', () => {
|
|
54
55
|
const onPress = jest.fn()
|
|
55
56
|
const date = formatDatePreview(result.extra.createdAt)
|
|
56
|
-
const view =
|
|
57
|
+
const view = renderWithQueryClient(<MessageResultRow result={result} onPress={onPress} />)
|
|
57
58
|
|
|
58
59
|
const row = view.getByRole('button', {
|
|
59
60
|
name: `Worship Team, Ada Lovelace: …planning the budget meeting for next week, ${date}`,
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import { fireEvent
|
|
1
|
+
import { fireEvent } from '@testing-library/react-native'
|
|
2
2
|
import React from 'react'
|
|
3
3
|
import { FlatList } from 'react-native'
|
|
4
|
+
import { renderWithQueryClient } from '../../../../__utils__/render_with_query_client'
|
|
4
5
|
import type { useSearchResults } from '../../../../hooks/use_search_results'
|
|
5
6
|
import type {
|
|
6
7
|
ConversationSearchResultResource,
|
|
@@ -49,10 +50,14 @@ const messageResult = (id: string): MessageSearchResultResource => ({
|
|
|
49
50
|
},
|
|
50
51
|
})
|
|
51
52
|
|
|
53
|
+
const slots = { header: <></>, prompt: <></> }
|
|
54
|
+
|
|
52
55
|
const renderList = (state: Partial<SearchState>, onSettled = jest.fn()) => {
|
|
53
56
|
mockUseSearchResults.mockReturnValue(searchState(state))
|
|
54
|
-
const list = () =>
|
|
55
|
-
|
|
57
|
+
const list = () => (
|
|
58
|
+
<SearchResultsList term="potluck" onSelect={jest.fn()} onSettled={onSettled} {...slots} />
|
|
59
|
+
)
|
|
60
|
+
const view = renderWithQueryClient(list())
|
|
56
61
|
const rerenderWith = (next: Partial<SearchState>) => {
|
|
57
62
|
mockUseSearchResults.mockReturnValue(searchState(next))
|
|
58
63
|
view.rerender(list())
|
|
@@ -129,8 +134,8 @@ describe('SearchResultsList', () => {
|
|
|
129
134
|
const onSelect = jest.fn()
|
|
130
135
|
const results = [conversationResult('1'), messageResult('1'), messageResult('2')]
|
|
131
136
|
mockUseSearchResults.mockReturnValue(searchState({ results }))
|
|
132
|
-
const view =
|
|
133
|
-
<SearchResultsList term="potluck" onSelect={onSelect} onSettled={jest.fn()} />
|
|
137
|
+
const view = renderWithQueryClient(
|
|
138
|
+
<SearchResultsList term="potluck" onSelect={onSelect} onSettled={jest.fn()} {...slots} />
|
|
134
139
|
)
|
|
135
140
|
|
|
136
141
|
fireEvent.press(view.getByLabelText(/^Message 2/))
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React, { useEffect, useRef } from 'react'
|
|
1
|
+
import React, { ReactElement, useEffect, useRef } from 'react'
|
|
2
2
|
import { FlatList, StyleSheet, View } from 'react-native'
|
|
3
3
|
import { Banner, Spinner, Text, TextButton } from '../../../components'
|
|
4
4
|
import { useSearchResults } from '../../../hooks/use_search_results'
|
|
@@ -23,9 +23,17 @@ interface SearchResultsListProps {
|
|
|
23
23
|
term: string
|
|
24
24
|
onSelect: (result: SearchResultResource, position: number) => void
|
|
25
25
|
onSettled: (term: string, counts: SearchResultCounts) => void
|
|
26
|
+
header: ReactElement
|
|
27
|
+
prompt: ReactElement
|
|
26
28
|
}
|
|
27
29
|
|
|
28
|
-
export function SearchResultsList({
|
|
30
|
+
export function SearchResultsList({
|
|
31
|
+
term,
|
|
32
|
+
onSelect,
|
|
33
|
+
onSettled,
|
|
34
|
+
header,
|
|
35
|
+
prompt,
|
|
36
|
+
}: SearchResultsListProps) {
|
|
29
37
|
const {
|
|
30
38
|
results,
|
|
31
39
|
failedTypes,
|
|
@@ -36,9 +44,10 @@ export function SearchResultsList({ term, onSelect, onSettled }: SearchResultsLi
|
|
|
36
44
|
hasNextPage,
|
|
37
45
|
isFetchingNextPage,
|
|
38
46
|
} = useSearchResults(term)
|
|
39
|
-
const
|
|
40
|
-
const
|
|
41
|
-
const
|
|
47
|
+
const searching = term.trim().length > 0
|
|
48
|
+
const conversationResults = searching ? results.filter(isConversationResult) : []
|
|
49
|
+
const messageResults = searching ? results.filter(isMessageResult) : []
|
|
50
|
+
const settled = searching && !isPending && !isError
|
|
42
51
|
|
|
43
52
|
const settledTermRef = useRef<string | undefined>(undefined)
|
|
44
53
|
|
|
@@ -56,6 +65,7 @@ export function SearchResultsList({ term, onSelect, onSettled }: SearchResultsLi
|
|
|
56
65
|
<FlatList
|
|
57
66
|
data={messageResults}
|
|
58
67
|
keyExtractor={item => item.id}
|
|
68
|
+
contentInsetAdjustmentBehavior="automatic"
|
|
59
69
|
keyboardShouldPersistTaps="handled"
|
|
60
70
|
keyboardDismissMode="on-drag"
|
|
61
71
|
contentContainerStyle={styles.content}
|
|
@@ -64,20 +74,27 @@ export function SearchResultsList({ term, onSelect, onSettled }: SearchResultsLi
|
|
|
64
74
|
)}
|
|
65
75
|
ListHeaderComponent={
|
|
66
76
|
<>
|
|
77
|
+
{header}
|
|
67
78
|
{conversationResults.length > 0 && (
|
|
68
79
|
<ConversationResults results={conversationResults} onSelect={onSelect} />
|
|
69
80
|
)}
|
|
70
|
-
{failedTypes.includes('conversation') &&
|
|
81
|
+
{searching && failedTypes.includes('conversation') && (
|
|
82
|
+
<SectionFailure type="conversation" />
|
|
83
|
+
)}
|
|
71
84
|
{messageResults.length > 0 && <ResultsSection title="Messages" />}
|
|
72
85
|
</>
|
|
73
86
|
}
|
|
74
87
|
ListEmptyComponent={
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
88
|
+
searching ? (
|
|
89
|
+
<ListEmpty
|
|
90
|
+
term={term}
|
|
91
|
+
isError={isError}
|
|
92
|
+
isPending={isPending}
|
|
93
|
+
noResults={results.length === 0 && failedTypes.length === 0}
|
|
94
|
+
/>
|
|
95
|
+
) : (
|
|
96
|
+
<View style={styles.prompt}>{prompt}</View>
|
|
97
|
+
)
|
|
81
98
|
}
|
|
82
99
|
ListFooterComponent={
|
|
83
100
|
<>
|
|
@@ -91,7 +108,7 @@ export function SearchResultsList({ term, onSelect, onSettled }: SearchResultsLi
|
|
|
91
108
|
Try again
|
|
92
109
|
</TextButton>
|
|
93
110
|
)}
|
|
94
|
-
{failedTypes.includes('message') && <SectionFailure type="message" />}
|
|
111
|
+
{searching && failedTypes.includes('message') && <SectionFailure type="message" />}
|
|
95
112
|
</>
|
|
96
113
|
}
|
|
97
114
|
onEndReached={() => {
|
|
@@ -149,6 +166,10 @@ const styles = StyleSheet.create({
|
|
|
149
166
|
content: {
|
|
150
167
|
flexGrow: 1,
|
|
151
168
|
},
|
|
169
|
+
prompt: {
|
|
170
|
+
flexGrow: 1,
|
|
171
|
+
justifyContent: 'center',
|
|
172
|
+
},
|
|
152
173
|
banner: {
|
|
153
174
|
margin: 16,
|
|
154
175
|
},
|