@planningcenter/chat-react-native 4.6.0-rc.5 → 4.6.0-rc.7
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/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/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/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/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/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_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.js +68 -62
- 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 +1 -0
- 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 +56 -62
- 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.map +1 -1
- package/build/screens/search/components/search_results_list.js +1 -0
- package/build/screens/search/components/search_results_list.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/package.json +2 -2
- 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/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/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/screens/age_check/age_check_required_screen.tsx +5 -1
- 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/conversation_details_screen.tsx +1 -0
- package/src/screens/conversation_new/components/form_list.tsx +1 -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 +1 -0
- package/src/screens/conversation_select_recipients/conversation_select_group_recipients_screen.tsx +1 -0
- package/src/screens/conversation_select_recipients/conversation_select_teams_i_lead_recipients_screen.tsx +1 -0
- package/src/screens/get_help_screen.tsx +4 -4
- 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 +6 -5
- 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 +4 -3
- package/src/screens/search/components/search_results_list.tsx +1 -0
- package/src/screens/settings_screen.tsx +25 -25
|
@@ -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,7 +100,7 @@ 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')
|
|
@@ -118,7 +119,7 @@ describe('SearchScreen', () => {
|
|
|
118
119
|
})
|
|
119
120
|
|
|
120
121
|
it('lets the prompt scroll while taps still reach the field', () => {
|
|
121
|
-
const view =
|
|
122
|
+
const view = renderWithQueryClient(<SearchScreen />)
|
|
122
123
|
|
|
123
124
|
const scrollView = view.UNSAFE_getByType(ScrollView)
|
|
124
125
|
expect(scrollView.props.keyboardShouldPersistTaps).toBe('handled')
|
|
@@ -127,7 +128,7 @@ describe('SearchScreen', () => {
|
|
|
127
128
|
})
|
|
128
129
|
|
|
129
130
|
it('returns to the prompt as soon as the term is cleared', () => {
|
|
130
|
-
const view =
|
|
131
|
+
const view = renderWithQueryClient(<SearchScreen />)
|
|
131
132
|
const input = view.getByLabelText(inputLabel)
|
|
132
133
|
|
|
133
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,
|
|
@@ -56,7 +57,7 @@ const renderList = (state: Partial<SearchState>, onSettled = jest.fn()) => {
|
|
|
56
57
|
const list = () => (
|
|
57
58
|
<SearchResultsList term="potluck" onSelect={jest.fn()} onSettled={onSettled} {...slots} />
|
|
58
59
|
)
|
|
59
|
-
const view =
|
|
60
|
+
const view = renderWithQueryClient(list())
|
|
60
61
|
const rerenderWith = (next: Partial<SearchState>) => {
|
|
61
62
|
mockUseSearchResults.mockReturnValue(searchState(next))
|
|
62
63
|
view.rerender(list())
|
|
@@ -133,7 +134,7 @@ describe('SearchResultsList', () => {
|
|
|
133
134
|
const onSelect = jest.fn()
|
|
134
135
|
const results = [conversationResult('1'), messageResult('1'), messageResult('2')]
|
|
135
136
|
mockUseSearchResults.mockReturnValue(searchState({ results }))
|
|
136
|
-
const view =
|
|
137
|
+
const view = renderWithQueryClient(
|
|
137
138
|
<SearchResultsList term="potluck" onSelect={onSelect} onSettled={jest.fn()} {...slots} />
|
|
138
139
|
)
|
|
139
140
|
|
|
@@ -65,6 +65,7 @@ export function SearchResultsList({
|
|
|
65
65
|
<FlatList
|
|
66
66
|
data={messageResults}
|
|
67
67
|
keyExtractor={item => item.id}
|
|
68
|
+
contentInsetAdjustmentBehavior="automatic"
|
|
68
69
|
keyboardShouldPersistTaps="handled"
|
|
69
70
|
keyboardDismissMode="on-drag"
|
|
70
71
|
contentContainerStyle={styles.content}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { PlatformPressable } from '@react-navigation/elements'
|
|
2
2
|
import { StaticScreenProps, useNavigation } from '@react-navigation/native'
|
|
3
3
|
import React, { useCallback } from 'react'
|
|
4
|
-
import { Platform, StyleSheet, View } from 'react-native'
|
|
4
|
+
import { Platform, ScrollView, StyleSheet, View } from 'react-native'
|
|
5
5
|
import { useSafeAreaInsets } from 'react-native-safe-area-context'
|
|
6
6
|
import { Heading, Icon, Text, VersionFooter } from '../components'
|
|
7
7
|
import { Switch } from '../components/display/switch'
|
|
@@ -28,29 +28,31 @@ export function SettingsScreen({}: SettingsScreenProps) {
|
|
|
28
28
|
|
|
29
29
|
return (
|
|
30
30
|
<View style={styles.container}>
|
|
31
|
-
<
|
|
32
|
-
<View style={styles.
|
|
33
|
-
<
|
|
34
|
-
|
|
35
|
-
{directMessagesEligible && (
|
|
36
|
-
<View style={styles.settingRow}>
|
|
37
|
-
<View style={styles.settingRowText}>
|
|
38
|
-
<Text>Allow direct messages</Text>
|
|
39
|
-
<Text variant="tertiary">
|
|
40
|
-
When off, you can't be added to new direct messages, and any you're already in will
|
|
41
|
-
be turned off.
|
|
42
|
-
</Text>
|
|
43
|
-
</View>
|
|
44
|
-
<Switch
|
|
45
|
-
value={!directMessagesDisabled}
|
|
46
|
-
onValueChange={enabled => setDirectMessagesDisabled(!enabled)}
|
|
47
|
-
disabled={isMutating}
|
|
48
|
-
/>
|
|
31
|
+
<ScrollView contentInsetAdjustmentBehavior="automatic">
|
|
32
|
+
<View style={styles.sectionOuter}>
|
|
33
|
+
<View style={styles.sectionHeader}>
|
|
34
|
+
<Heading variant="h2">Messages</Heading>
|
|
49
35
|
</View>
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
36
|
+
{directMessagesEligible && (
|
|
37
|
+
<View style={styles.settingRow}>
|
|
38
|
+
<View style={styles.settingRowText}>
|
|
39
|
+
<Text>Allow direct messages</Text>
|
|
40
|
+
<Text variant="tertiary">
|
|
41
|
+
When off, you can't be added to new direct messages, and any you're already in
|
|
42
|
+
will be turned off.
|
|
43
|
+
</Text>
|
|
44
|
+
</View>
|
|
45
|
+
<Switch
|
|
46
|
+
value={!directMessagesDisabled}
|
|
47
|
+
onValueChange={enabled => setDirectMessagesDisabled(!enabled)}
|
|
48
|
+
disabled={isMutating}
|
|
49
|
+
/>
|
|
50
|
+
</View>
|
|
51
|
+
)}
|
|
52
|
+
<NavRow label="Notification settings" onPress={handleNotificationSettings} />
|
|
53
|
+
{appName !== 'services' && <NavRow label="Get help" onPress={handleGetHelp} />}
|
|
54
|
+
</View>
|
|
55
|
+
</ScrollView>
|
|
54
56
|
<View style={styles.footer}>
|
|
55
57
|
<VersionFooter />
|
|
56
58
|
</View>
|
|
@@ -90,8 +92,6 @@ const useStyles = () => {
|
|
|
90
92
|
flex: 1,
|
|
91
93
|
},
|
|
92
94
|
footer: {
|
|
93
|
-
flex: 1,
|
|
94
|
-
justifyContent: 'flex-end',
|
|
95
95
|
paddingBottom: Math.max(insets.bottom, 8),
|
|
96
96
|
},
|
|
97
97
|
sectionOuter: {
|