@planningcenter/chat-react-native 4.7.1-qa-staging.0 → 4.7.1-qa-1092.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/build/components/conversations/conversation_actions.d.ts.map +1 -1
- package/build/components/conversations/conversation_actions.js +186 -322
- package/build/components/conversations/conversation_actions.js.map +1 -1
- package/build/components/group_conversation_list.d.ts.map +1 -1
- package/build/components/group_conversation_list.js +0 -1
- package/build/components/group_conversation_list.js.map +1 -1
- package/build/contexts/conversations_context.d.ts +1 -3
- package/build/contexts/conversations_context.d.ts.map +1 -1
- package/build/contexts/conversations_context.js +27 -32
- package/build/contexts/conversations_context.js.map +1 -1
- package/build/hooks/use_conversation.d.ts.map +1 -1
- package/build/hooks/use_conversation.js +1 -1
- package/build/hooks/use_conversation.js.map +1 -1
- package/build/hooks/use_features.d.ts +0 -1
- package/build/hooks/use_features.d.ts.map +1 -1
- package/build/hooks/use_features.js +1 -2
- package/build/hooks/use_features.js.map +1 -1
- package/build/navigation/index.d.ts +0 -5
- package/build/navigation/index.d.ts.map +1 -1
- package/build/navigation/index.js +0 -5
- package/build/navigation/index.js.map +1 -1
- package/build/screens/conversation_details_screen.d.ts.map +1 -1
- package/build/screens/conversation_details_screen.js +394 -460
- package/build/screens/conversation_details_screen.js.map +1 -1
- package/build/screens/conversations/conversations_screen.d.ts.map +1 -1
- package/build/screens/conversations/conversations_screen.js +10 -18
- package/build/screens/conversations/conversations_screen.js.map +1 -1
- package/build/screens/index.d.ts +0 -1
- package/build/screens/index.d.ts.map +1 -1
- package/build/screens/index.js +0 -1
- package/build/screens/index.js.map +1 -1
- package/build/types/resources/conversation_membership.d.ts +0 -1
- package/build/types/resources/conversation_membership.d.ts.map +1 -1
- package/build/types/resources/conversation_membership.js.map +1 -1
- package/package.json +3 -3
- package/src/components/conversations/__tests__/conversation_actions.test.tsx +2 -76
- package/src/components/conversations/conversation_actions.tsx +4 -68
- package/src/components/group_conversation_list.tsx +1 -4
- package/src/contexts/conversations_context.tsx +1 -6
- package/src/hooks/use_conversation.ts +0 -1
- package/src/hooks/use_features.ts +0 -1
- package/src/navigation/index.tsx +0 -8
- package/src/screens/__tests__/conversation_details_screen.test.tsx +1 -49
- package/src/screens/conversation_details_screen.tsx +0 -19
- package/src/screens/conversations/__tests__/conversations_screen.test.tsx +0 -1
- package/src/screens/conversations/conversations_screen.tsx +0 -2
- package/src/screens/index.ts +0 -1
- package/src/types/resources/conversation_membership.ts +0 -1
- package/build/components/display/toast.d.ts +0 -3
- package/build/components/display/toast.d.ts.map +0 -1
- package/build/components/display/toast.js +0 -224
- package/build/components/display/toast.js.map +0 -1
- package/build/hooks/use_hide_conversation.d.ts +0 -107
- package/build/hooks/use_hide_conversation.d.ts.map +0 -1
- package/build/hooks/use_hide_conversation.js +0 -238
- package/build/hooks/use_hide_conversation.js.map +0 -1
- package/build/hooks/use_hide_conversations_enabled.d.ts +0 -2
- package/build/hooks/use_hide_conversations_enabled.d.ts.map +0 -1
- package/build/hooks/use_hide_conversations_enabled.js +0 -18
- package/build/hooks/use_hide_conversations_enabled.js.map +0 -1
- package/build/screens/conversation_actions_screen.d.ts +0 -7
- package/build/screens/conversation_actions_screen.d.ts.map +0 -1
- package/build/screens/conversation_actions_screen.js +0 -89
- package/build/screens/conversation_actions_screen.js.map +0 -1
- package/build/utils/toast_store.d.ts +0 -21
- package/build/utils/toast_store.d.ts.map +0 -1
- package/build/utils/toast_store.js +0 -27
- package/build/utils/toast_store.js.map +0 -1
- package/src/components/display/__tests__/toast.test.tsx +0 -55
- package/src/components/display/toast.tsx +0 -115
- package/src/hooks/__tests__/use_hide_conversation.test.tsx +0 -147
- package/src/hooks/use_hide_conversation.ts +0 -118
- package/src/hooks/use_hide_conversations_enabled.ts +0 -7
- package/src/screens/__tests__/conversation_actions_screen.test.tsx +0 -79
- package/src/screens/conversation_actions_screen.tsx +0 -53
- package/src/utils/toast_store.ts +0 -45
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { render } from '@testing-library/react-native'
|
|
2
2
|
import React from 'react'
|
|
3
3
|
import { Text } from 'react-native'
|
|
4
4
|
import type { ConversationResource } from '../../../types'
|
|
@@ -27,28 +27,6 @@ jest.mock('../../../hooks/use_conversations_actions', () => ({
|
|
|
27
27
|
useConversationsMarkRead: () => ({ read: false, markRead: jest.fn(), isPending: false }),
|
|
28
28
|
}))
|
|
29
29
|
|
|
30
|
-
const mockNavigate = jest.fn()
|
|
31
|
-
jest.mock('@react-navigation/native', () => ({
|
|
32
|
-
...jest.requireActual('@react-navigation/native'),
|
|
33
|
-
useNavigation: () => ({ navigate: mockNavigate }),
|
|
34
|
-
}))
|
|
35
|
-
const mockSetHidden = jest.fn()
|
|
36
|
-
jest.mock('../../../hooks/use_hide_conversation', () => ({
|
|
37
|
-
useHideConversation: () => ({ hidden: false, setHidden: mockSetHidden, isPending: false }),
|
|
38
|
-
}))
|
|
39
|
-
let mockHideEnabled = false
|
|
40
|
-
jest.mock('../../../hooks/use_hide_conversations_enabled', () => ({
|
|
41
|
-
useHideConversationsEnabled: () => mockHideEnabled,
|
|
42
|
-
}))
|
|
43
|
-
let mockHideable = true
|
|
44
|
-
jest.mock('../../../contexts/conversations_context', () => ({
|
|
45
|
-
useConversationsContext: () => ({
|
|
46
|
-
activeConversationId: undefined,
|
|
47
|
-
setActiveConversationId: jest.fn(),
|
|
48
|
-
hideable: mockHideable,
|
|
49
|
-
}),
|
|
50
|
-
}))
|
|
51
|
-
|
|
52
30
|
const createdAt = '2026-10-01T12:00:00Z'
|
|
53
31
|
|
|
54
32
|
const conversation = (overrides: Partial<ConversationResource>): ConversationResource => ({
|
|
@@ -74,18 +52,11 @@ const renderActions = (overrides: Partial<ConversationResource>) =>
|
|
|
74
52
|
)
|
|
75
53
|
|
|
76
54
|
describe('ConversationActions', () => {
|
|
77
|
-
|
|
78
|
-
mockHideEnabled = false
|
|
79
|
-
jest.clearAllMocks()
|
|
80
|
-
})
|
|
81
|
-
|
|
82
|
-
it('offers mark read but not mute or hide on an archived conversation', () => {
|
|
83
|
-
mockHideEnabled = true
|
|
55
|
+
it('offers mark read but not mute on an archived conversation', () => {
|
|
84
56
|
const view = renderActions({ disabled: true, disabledReason: 'archived' })
|
|
85
57
|
|
|
86
58
|
expect(view.getByText('Mark read')).toBeTruthy()
|
|
87
59
|
expect(view.queryByText('Silence')).toBeNull()
|
|
88
|
-
expect(view.queryByText('Hide')).toBeNull()
|
|
89
60
|
})
|
|
90
61
|
|
|
91
62
|
it('offers mute on a conversation disabled for another reason', () => {
|
|
@@ -94,48 +65,3 @@ describe('ConversationActions', () => {
|
|
|
94
65
|
expect(view.getByText('Silence')).toBeTruthy()
|
|
95
66
|
})
|
|
96
67
|
})
|
|
97
|
-
|
|
98
|
-
describe('ConversationActions hide', () => {
|
|
99
|
-
beforeEach(() => {
|
|
100
|
-
mockHideEnabled = true
|
|
101
|
-
mockHideable = true
|
|
102
|
-
jest.clearAllMocks()
|
|
103
|
-
})
|
|
104
|
-
|
|
105
|
-
it('offers no hide action or long press when the list is not hideable', () => {
|
|
106
|
-
mockHideable = false
|
|
107
|
-
const view = renderActions({})
|
|
108
|
-
|
|
109
|
-
fireEvent(view.getByTestId('conversation-7'), 'longPress')
|
|
110
|
-
|
|
111
|
-
expect(view.queryByText('Hide')).toBeNull()
|
|
112
|
-
expect(view.getByText('Silence')).toBeTruthy()
|
|
113
|
-
expect(mockNavigate).not.toHaveBeenCalled()
|
|
114
|
-
})
|
|
115
|
-
|
|
116
|
-
it('offers no hide action or long press when the flag is off', () => {
|
|
117
|
-
mockHideEnabled = false
|
|
118
|
-
const view = renderActions({})
|
|
119
|
-
|
|
120
|
-
fireEvent(view.getByTestId('conversation-7'), 'longPress')
|
|
121
|
-
|
|
122
|
-
expect(view.queryByText('Hide')).toBeNull()
|
|
123
|
-
expect(mockNavigate).not.toHaveBeenCalled()
|
|
124
|
-
})
|
|
125
|
-
|
|
126
|
-
it('hides from the swipe action', () => {
|
|
127
|
-
const view = renderActions({})
|
|
128
|
-
|
|
129
|
-
fireEvent.press(view.getByText('Hide'))
|
|
130
|
-
|
|
131
|
-
expect(mockSetHidden).toHaveBeenCalledWith(true)
|
|
132
|
-
})
|
|
133
|
-
|
|
134
|
-
it('opens the conversation actions sheet on long press', () => {
|
|
135
|
-
const view = renderActions({})
|
|
136
|
-
|
|
137
|
-
fireEvent(view.getByTestId('conversation-7'), 'longPress')
|
|
138
|
-
|
|
139
|
-
expect(mockNavigate).toHaveBeenCalledWith('ConversationActions', { conversation_id: 7 })
|
|
140
|
-
})
|
|
141
|
-
})
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { useNavigation } from '@react-navigation/native'
|
|
2
1
|
import React, { ReactNode, useCallback, useEffect, useRef, useState } from 'react'
|
|
3
2
|
import {
|
|
4
3
|
AccessibilityActionEvent,
|
|
@@ -18,11 +17,8 @@ import {
|
|
|
18
17
|
useConversationsMarkRead,
|
|
19
18
|
useConversationsMute,
|
|
20
19
|
} from '../../hooks/use_conversations_actions'
|
|
21
|
-
import { useHideConversation } from '../../hooks/use_hide_conversation'
|
|
22
|
-
import { useHideConversationsEnabled } from '../../hooks/use_hide_conversations_enabled'
|
|
23
20
|
import { ConversationResource } from '../../types'
|
|
24
21
|
import { isArchivedConversation, platformPressedOpacityStyle } from '../../utils'
|
|
25
|
-
import { Haptic } from '../../utils/native_adapters'
|
|
26
22
|
import { tokens } from '../../vendor/tapestry/tokens'
|
|
27
23
|
import { SwipeableToggleButton } from './swipeable_toggle_button'
|
|
28
24
|
|
|
@@ -40,9 +36,8 @@ export function ConversationActions({
|
|
|
40
36
|
accessibilityLabel?: string
|
|
41
37
|
}) {
|
|
42
38
|
const swipeableRef = useRef<SwipeableMethods>(null)
|
|
43
|
-
const navigation = useNavigation()
|
|
44
39
|
const styles = useStyles()
|
|
45
|
-
const { activeConversationId, setActiveConversationId
|
|
40
|
+
const { activeConversationId, setActiveConversationId } = useConversationsContext()
|
|
46
41
|
const [disabled, setDisabled] = useState(false)
|
|
47
42
|
const overshootLeft = Platform.OS === 'ios'
|
|
48
43
|
const androidRippleColor = useCreateAndroidRippleColor({
|
|
@@ -56,12 +51,9 @@ export function ConversationActions({
|
|
|
56
51
|
} = useConversationsMarkRead({
|
|
57
52
|
conversation,
|
|
58
53
|
})
|
|
59
|
-
const { hidden, setHidden, isPending: isHiddenPending } = useHideConversation({ conversation })
|
|
60
|
-
const hideConversationsEnabled = useHideConversationsEnabled()
|
|
61
54
|
|
|
62
55
|
const isConversationEmpty = conversation.lastMessageCreatedAt === null
|
|
63
56
|
const canMute = !isArchivedConversation(conversation)
|
|
64
|
-
const canHide = hideable && hideConversationsEnabled && !isArchivedConversation(conversation)
|
|
65
57
|
|
|
66
58
|
const handleSwipeableClose = useCallback(() => {
|
|
67
59
|
setDisabled(false)
|
|
@@ -83,18 +75,6 @@ export function ConversationActions({
|
|
|
83
75
|
handleSwipeableClose()
|
|
84
76
|
}, [muted, handleSwipeableClose, setMuted])
|
|
85
77
|
|
|
86
|
-
const handleHide = useCallback(() => {
|
|
87
|
-
setHidden(!hidden)
|
|
88
|
-
handleSwipeableClose()
|
|
89
|
-
}, [hidden, handleSwipeableClose, setHidden])
|
|
90
|
-
|
|
91
|
-
const handleLongPress = useCallback(() => {
|
|
92
|
-
if (disabled) return
|
|
93
|
-
|
|
94
|
-
Haptic.impactLight()
|
|
95
|
-
navigation.navigate('ConversationActions', { conversation_id: conversation.id })
|
|
96
|
-
}, [disabled, navigation, conversation.id])
|
|
97
|
-
|
|
98
78
|
const handleLatestMessageUnread = useCallback(() => {
|
|
99
79
|
markRead(!read)
|
|
100
80
|
handleSwipeableClose()
|
|
@@ -118,20 +98,7 @@ export function ConversationActions({
|
|
|
118
98
|
]
|
|
119
99
|
: []
|
|
120
100
|
|
|
121
|
-
const
|
|
122
|
-
? [
|
|
123
|
-
{
|
|
124
|
-
name: hidden ? 'unhide' : 'hide',
|
|
125
|
-
label: hidden ? 'Unhide' : 'Hide',
|
|
126
|
-
},
|
|
127
|
-
]
|
|
128
|
-
: []
|
|
129
|
-
|
|
130
|
-
const accessibilityActions = [
|
|
131
|
-
...muteAccessibilityAction,
|
|
132
|
-
...hideAccessibilityAction,
|
|
133
|
-
...readAccessibilityAction,
|
|
134
|
-
]
|
|
101
|
+
const accessibilityActions = [...muteAccessibilityAction, ...readAccessibilityAction]
|
|
135
102
|
|
|
136
103
|
const handleAccessibilityAction = useCallback(
|
|
137
104
|
(event: AccessibilityActionEvent) => {
|
|
@@ -148,13 +115,9 @@ export function ConversationActions({
|
|
|
148
115
|
case 'unmute':
|
|
149
116
|
handleMute()
|
|
150
117
|
break
|
|
151
|
-
case 'hide':
|
|
152
|
-
case 'unhide':
|
|
153
|
-
handleHide()
|
|
154
|
-
break
|
|
155
118
|
}
|
|
156
119
|
},
|
|
157
|
-
[handleLatestMessageUnread, handleMute
|
|
120
|
+
[handleLatestMessageUnread, handleMute]
|
|
158
121
|
)
|
|
159
122
|
|
|
160
123
|
useEffect(() => {
|
|
@@ -178,15 +141,11 @@ export function ConversationActions({
|
|
|
178
141
|
<LeftActions
|
|
179
142
|
isConversationEmpty={isConversationEmpty}
|
|
180
143
|
canMute={canMute}
|
|
181
|
-
canHide={canHide}
|
|
182
144
|
handleMute={handleMute}
|
|
183
|
-
handleHide={handleHide}
|
|
184
145
|
handleLatestMessageUnread={handleLatestMessageUnread}
|
|
185
146
|
muted={muted}
|
|
186
|
-
hidden={hidden}
|
|
187
147
|
read={read}
|
|
188
148
|
isMutedPending={isMutedPending}
|
|
189
|
-
isHiddenPending={isHiddenPending}
|
|
190
149
|
isMarkReadPending={isMarkReadPending}
|
|
191
150
|
/>
|
|
192
151
|
)}
|
|
@@ -194,7 +153,6 @@ export function ConversationActions({
|
|
|
194
153
|
<Pressable
|
|
195
154
|
testID={`conversation-${conversation.id}`}
|
|
196
155
|
onPress={handlePress}
|
|
197
|
-
onLongPress={canHide ? handleLongPress : undefined}
|
|
198
156
|
style={({ pressed }) => [style, pressed && platformPressedOpacityStyle]}
|
|
199
157
|
android_ripple={{ color: androidRippleColor, borderless: false, foreground: true }}
|
|
200
158
|
accessibilityLabel={accessibilityLabel}
|
|
@@ -211,44 +169,31 @@ export function ConversationActions({
|
|
|
211
169
|
interface LeftActionsProps {
|
|
212
170
|
isConversationEmpty: boolean
|
|
213
171
|
canMute: boolean
|
|
214
|
-
canHide: boolean
|
|
215
172
|
handleMute: () => void
|
|
216
|
-
handleHide: () => void
|
|
217
173
|
handleLatestMessageUnread: () => void
|
|
218
174
|
muted: boolean
|
|
219
|
-
hidden: boolean
|
|
220
175
|
read: boolean
|
|
221
176
|
isMutedPending: boolean
|
|
222
|
-
isHiddenPending: boolean
|
|
223
177
|
isMarkReadPending: boolean
|
|
224
178
|
}
|
|
225
179
|
|
|
226
180
|
function LeftActions({
|
|
227
181
|
isConversationEmpty,
|
|
228
182
|
canMute,
|
|
229
|
-
canHide,
|
|
230
183
|
handleMute,
|
|
231
|
-
handleHide,
|
|
232
184
|
handleLatestMessageUnread,
|
|
233
185
|
muted,
|
|
234
|
-
hidden,
|
|
235
186
|
read,
|
|
236
187
|
isMutedPending,
|
|
237
|
-
isHiddenPending,
|
|
238
188
|
isMarkReadPending,
|
|
239
189
|
}: LeftActionsProps) {
|
|
240
|
-
const styles = useStyles({ actionButtonCount:
|
|
190
|
+
const styles = useStyles({ actionButtonCount: canMute ? 2 : 1 })
|
|
241
191
|
|
|
242
192
|
const muteToggleContent = {
|
|
243
193
|
true: { iconName: 'general.bell', label: 'Enable' },
|
|
244
194
|
false: { iconName: 'general.bellMuted', label: 'Silence' },
|
|
245
195
|
} as const
|
|
246
196
|
|
|
247
|
-
const hideToggleContent = {
|
|
248
|
-
true: { iconName: 'general.showEye', label: 'Unhide' },
|
|
249
|
-
false: { iconName: 'general.hideEye', label: 'Hide' },
|
|
250
|
-
} as const
|
|
251
|
-
|
|
252
197
|
const latestMessageUnreadToggleContent = {
|
|
253
198
|
true: { iconName: 'general.outlinedTextMessage', label: 'Mark read' },
|
|
254
199
|
false: { iconName: 'general.textMessageNotifications', label: 'Mark unread' },
|
|
@@ -273,15 +218,6 @@ function LeftActions({
|
|
|
273
218
|
backgroundColor={tokens.fillColorInteractionSwipeSecondary}
|
|
274
219
|
/>
|
|
275
220
|
)}
|
|
276
|
-
{canHide && (
|
|
277
|
-
<SwipeableToggleButton
|
|
278
|
-
loading={isHiddenPending}
|
|
279
|
-
toggled={hidden}
|
|
280
|
-
onPress={handleHide}
|
|
281
|
-
toggleContent={hideToggleContent}
|
|
282
|
-
backgroundColor={tokens.colorNeutral45}
|
|
283
|
-
/>
|
|
284
|
-
)}
|
|
285
221
|
</View>
|
|
286
222
|
)
|
|
287
223
|
}
|
|
@@ -33,10 +33,7 @@ interface GroupConversationsProps extends Partial<ConversationRequestArgs> {
|
|
|
33
33
|
*/
|
|
34
34
|
export const GroupConversations = ({ chat_group_graph_id, ...rest }: GroupConversationsProps) => {
|
|
35
35
|
return (
|
|
36
|
-
<ConversationsContextProvider
|
|
37
|
-
args={{ chat_group_graph_id, group_source_app_name: undefined }}
|
|
38
|
-
hideable={false}
|
|
39
|
-
>
|
|
36
|
+
<ConversationsContextProvider args={{ chat_group_graph_id, group_source_app_name: undefined }}>
|
|
40
37
|
<GroupConversationList {...rest} />
|
|
41
38
|
</ConversationsContextProvider>
|
|
42
39
|
)
|
|
@@ -14,7 +14,6 @@ interface ConversationsContextValue extends UseConversationsValue {
|
|
|
14
14
|
activeConversationId?: number
|
|
15
15
|
setActiveConversationId: (_id: number) => void
|
|
16
16
|
args: ConversationFiltersParams
|
|
17
|
-
hideable: boolean
|
|
18
17
|
}
|
|
19
18
|
|
|
20
19
|
const defaultQueryValue: UseConversationsValue = {
|
|
@@ -34,7 +33,6 @@ const ConversationsContext = createContext<ConversationsContextValue>({
|
|
|
34
33
|
args: {},
|
|
35
34
|
activeConversationId: undefined,
|
|
36
35
|
setActiveConversationId: () => {},
|
|
37
|
-
hideable: true,
|
|
38
36
|
...defaultQueryValue,
|
|
39
37
|
})
|
|
40
38
|
|
|
@@ -42,11 +40,9 @@ export const ConversationsContextProvider = ({
|
|
|
42
40
|
children,
|
|
43
41
|
args = {},
|
|
44
42
|
opts: paginatorOptions,
|
|
45
|
-
hideable = true,
|
|
46
43
|
}: PropsWithChildren<{
|
|
47
44
|
args: ConversationFiltersParams
|
|
48
45
|
opts?: ApiGetQueryOptions
|
|
49
|
-
hideable?: boolean
|
|
50
46
|
}>) => {
|
|
51
47
|
const [activeConversationId, setActiveConversationId] = useState<number | undefined>()
|
|
52
48
|
const {
|
|
@@ -73,10 +69,9 @@ export const ConversationsContextProvider = ({
|
|
|
73
69
|
args,
|
|
74
70
|
activeConversationId,
|
|
75
71
|
setActiveConversationId,
|
|
76
|
-
hideable,
|
|
77
72
|
...query,
|
|
78
73
|
}),
|
|
79
|
-
[args, activeConversationId,
|
|
74
|
+
[args, activeConversationId, query]
|
|
80
75
|
)
|
|
81
76
|
|
|
82
77
|
return <ConversationsContext.Provider value={value}>{children}</ConversationsContext.Provider>
|
|
@@ -61,7 +61,6 @@ export const availableFeatures = {
|
|
|
61
61
|
filter_dropdown_rollout: 'ROLLOUT_MOBILE_filter_dropdown',
|
|
62
62
|
manual_archiving: 'QA_MOBILE_manual_archiving',
|
|
63
63
|
manual_archiving_rollout: 'ROLLOUT_MOBILE_manual_archiving',
|
|
64
|
-
hide_conversations: 'ROLLOUT_hide_conversations',
|
|
65
64
|
} as const satisfies Record<string, `${'QA' | 'ROLLOUT'}_${string}`>
|
|
66
65
|
|
|
67
66
|
const featureNames = Object.values(availableFeatures)
|
package/src/navigation/index.tsx
CHANGED
|
@@ -27,10 +27,6 @@ import {
|
|
|
27
27
|
MessageReadReceiptsScreen,
|
|
28
28
|
MessageReadReceiptsScreenOptions,
|
|
29
29
|
} from '../screens/conversation/message_read_receipts_screen'
|
|
30
|
-
import {
|
|
31
|
-
ConversationActionsScreen,
|
|
32
|
-
ConversationActionsScreenOptions,
|
|
33
|
-
} from '../screens/conversation_actions_screen'
|
|
34
30
|
import { ConversationDetailsScreen } from '../screens/conversation_details_screen'
|
|
35
31
|
import {
|
|
36
32
|
ConversationFilterReceipientsScreenOptions,
|
|
@@ -346,10 +342,6 @@ export const ChatStack = createNativeStackNavigator({
|
|
|
346
342
|
// Something about sheetAllowedDetents declared inline breaks TS
|
|
347
343
|
options: MessageActionsScreenOptions,
|
|
348
344
|
},
|
|
349
|
-
ConversationActions: {
|
|
350
|
-
screen: ConversationActionsScreen,
|
|
351
|
-
options: ConversationActionsScreenOptions,
|
|
352
|
-
},
|
|
353
345
|
MessageReport: {
|
|
354
346
|
screen: MessageReportScreen,
|
|
355
347
|
options: MessageReportScreenOptions,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { DefaultTheme,
|
|
1
|
+
import { DefaultTheme, ThemeProvider } from '@react-navigation/native'
|
|
2
2
|
import { QueryClientProvider } from '@tanstack/react-query'
|
|
3
3
|
import { fireEvent, render } from '@testing-library/react-native'
|
|
4
4
|
import React from 'react'
|
|
@@ -68,12 +68,6 @@ jest.mock('../../hooks/use_conversation', () => ({
|
|
|
68
68
|
useConversationUpdate: () => ({ mutate: mockSaveTitle }),
|
|
69
69
|
}))
|
|
70
70
|
|
|
71
|
-
let mockHidden = false
|
|
72
|
-
const mockSetHidden = jest.fn()
|
|
73
|
-
jest.mock('../../hooks/use_hide_conversation', () => ({
|
|
74
|
-
useHideConversation: () => ({ hidden: mockHidden, setHidden: mockSetHidden, isPending: false }),
|
|
75
|
-
}))
|
|
76
|
-
|
|
77
71
|
let mockEnabledFeatures: string[] = []
|
|
78
72
|
jest.mock('../../hooks/use_features', () => ({
|
|
79
73
|
...jest.requireActual('../../hooks/use_features'),
|
|
@@ -309,45 +303,3 @@ describe('ConversationDetailsScreen archive', () => {
|
|
|
309
303
|
expect(mockArchive).not.toHaveBeenCalled()
|
|
310
304
|
})
|
|
311
305
|
})
|
|
312
|
-
|
|
313
|
-
describe('ConversationDetailsScreen hide', () => {
|
|
314
|
-
beforeEach(() => {
|
|
315
|
-
mockConversation = baseConversation
|
|
316
|
-
mockEnabledFeatures = ['ROLLOUT_hide_conversations']
|
|
317
|
-
mockHidden = false
|
|
318
|
-
jest.clearAllMocks()
|
|
319
|
-
})
|
|
320
|
-
|
|
321
|
-
it('hides the row when the flag is off', () => {
|
|
322
|
-
mockEnabledFeatures = []
|
|
323
|
-
const { queryByText } = renderScreen()
|
|
324
|
-
|
|
325
|
-
expect(queryByText('Hide conversation')).toBeNull()
|
|
326
|
-
})
|
|
327
|
-
|
|
328
|
-
it('hides the row for an archived conversation', () => {
|
|
329
|
-
mockConversation = archivedConversation
|
|
330
|
-
const { queryByText } = renderScreen()
|
|
331
|
-
|
|
332
|
-
expect(queryByText('Hide conversation')).toBeNull()
|
|
333
|
-
})
|
|
334
|
-
|
|
335
|
-
it('hides the conversation and returns to the list', () => {
|
|
336
|
-
const { getByText } = renderScreen()
|
|
337
|
-
|
|
338
|
-
fireEvent.press(getByText('Hide conversation'))
|
|
339
|
-
|
|
340
|
-
expect(mockSetHidden).toHaveBeenCalledWith(true)
|
|
341
|
-
expect(mockNavigation.dispatch).toHaveBeenCalledWith(StackActions.popToTop())
|
|
342
|
-
})
|
|
343
|
-
|
|
344
|
-
it('unhides a hidden conversation and stays on the details', () => {
|
|
345
|
-
mockHidden = true
|
|
346
|
-
const { getByText } = renderScreen()
|
|
347
|
-
|
|
348
|
-
fireEvent.press(getByText('Unhide conversation'))
|
|
349
|
-
|
|
350
|
-
expect(mockSetHidden).toHaveBeenCalledWith(false)
|
|
351
|
-
expect(mockNavigation.dispatch).not.toHaveBeenCalled()
|
|
352
|
-
})
|
|
353
|
-
})
|
|
@@ -50,8 +50,6 @@ import {
|
|
|
50
50
|
useConversationUpdate,
|
|
51
51
|
} from '../hooks/use_conversation'
|
|
52
52
|
import { availableFeatures, useFeatures } from '../hooks/use_features'
|
|
53
|
-
import { useHideConversation } from '../hooks/use_hide_conversation'
|
|
54
|
-
import { useHideConversationsEnabled } from '../hooks/use_hide_conversations_enabled'
|
|
55
53
|
import { useManualArchivingEnabled } from '../hooks/use_manual_archiving_enabled'
|
|
56
54
|
import { usePreviewAvatarDiameter } from '../hooks/use_preview_avatar_diameter'
|
|
57
55
|
import { useUnarchiveConversationAction } from '../hooks/use_unarchive_conversation_action'
|
|
@@ -117,8 +115,6 @@ export function ConversationDetailsScreen({ route }: ConversationDetailsScreenPr
|
|
|
117
115
|
const granularNotificationsEnabled = featureEnabled(availableFeatures.granular_notifications_ui)
|
|
118
116
|
const customAvatarsEnabled = featureEnabled(availableFeatures.custom_conversation_avatars)
|
|
119
117
|
const manualArchivingEnabled = useManualArchivingEnabled()
|
|
120
|
-
const hideConversationsEnabled = useHideConversationsEnabled()
|
|
121
|
-
const { hidden, setHidden, isPending: isHidePending } = useHideConversation({ conversation })
|
|
122
118
|
const showGenderFilter =
|
|
123
119
|
featureEnabled(availableFeatures.gender_specific_conversations) && !!conversation.genderOption
|
|
124
120
|
const genderLabel = conversation.genderOption ? genderDisplayLabel(conversation.genderOption) : ''
|
|
@@ -134,7 +130,6 @@ export function ConversationDetailsScreen({ route }: ConversationDetailsScreenPr
|
|
|
134
130
|
const canSaveTitle = canUpdate && !emptyTitle
|
|
135
131
|
const canDelete = conversation.memberAbility?.canDelete || false
|
|
136
132
|
const canArchive = manualArchivingEnabled && (conversation.memberAbility?.canArchive || false)
|
|
137
|
-
const canHide = hideConversationsEnabled && !archived
|
|
138
133
|
const isLeader = conversation.memberAbility?.leader || false
|
|
139
134
|
const isDisabled = conversation.disabled ?? false
|
|
140
135
|
const showAdultRequirementNotice = isDisabled && conversation.disabledReason === 'safety_check'
|
|
@@ -236,11 +231,6 @@ export function ConversationDetailsScreen({ route }: ConversationDetailsScreenPr
|
|
|
236
231
|
)
|
|
237
232
|
}, [setArchived])
|
|
238
233
|
|
|
239
|
-
const handleHide = useCallback(() => {
|
|
240
|
-
setHidden(!hidden)
|
|
241
|
-
if (!hidden) navigation.dispatch(StackActions.popToTop())
|
|
242
|
-
}, [hidden, navigation, setHidden])
|
|
243
|
-
|
|
244
234
|
const HeaderTitle = useCallback(
|
|
245
235
|
(props: HeaderTitleProps) => {
|
|
246
236
|
return (
|
|
@@ -364,15 +354,6 @@ export function ConversationDetailsScreen({ route }: ConversationDetailsScreenPr
|
|
|
364
354
|
},
|
|
365
355
|
showBottomBorder: true,
|
|
366
356
|
},
|
|
367
|
-
{
|
|
368
|
-
type: canHide ? SectionTypes.setting : SectionTypes.hidden,
|
|
369
|
-
data: {
|
|
370
|
-
title: hidden ? 'Unhide conversation' : 'Hide conversation',
|
|
371
|
-
disabled: isHidePending,
|
|
372
|
-
onPress: handleHide,
|
|
373
|
-
},
|
|
374
|
-
showBottomBorder: canArchive || canDelete,
|
|
375
|
-
},
|
|
376
357
|
{
|
|
377
358
|
type: canArchive ? SectionTypes.setting : SectionTypes.hidden,
|
|
378
359
|
data: {
|
|
@@ -27,7 +27,6 @@ jest.mock('../../../components', () => ({
|
|
|
27
27
|
<ListHeaderComponent />
|
|
28
28
|
),
|
|
29
29
|
}))
|
|
30
|
-
jest.mock('../../../components/display/toast', () => ({ Toast: () => null }))
|
|
31
30
|
jest.mock('../components/list_header_component', () => {
|
|
32
31
|
const { Text } = require('react-native')
|
|
33
32
|
return { ListHeaderComponent: () => <Text>Default header</Text> }
|
|
@@ -2,7 +2,6 @@ import { StaticScreenProps } from '@react-navigation/native'
|
|
|
2
2
|
import React from 'react'
|
|
3
3
|
import { StyleSheet, View } from 'react-native'
|
|
4
4
|
import { Conversations } from '../../components'
|
|
5
|
-
import { Toast } from '../../components/display/toast'
|
|
6
5
|
import { ConversationsContextProvider } from '../../contexts/conversations_context'
|
|
7
6
|
import { useFilterDropdownEnabled } from '../../hooks/use_filter_dropdown_enabled'
|
|
8
7
|
import { analyticsEvents, usePublishProductAnalyticsEvent } from '../../hooks/use_product_analytics'
|
|
@@ -33,7 +32,6 @@ export function ConversationsScreen({ route }: ConversationsScreenProps) {
|
|
|
33
32
|
<ConversationsContextProvider args={route.params} opts={{ throwOnError: true }}>
|
|
34
33
|
<Conversations ListHeaderComponent={Header} />
|
|
35
34
|
</ConversationsContextProvider>
|
|
36
|
-
<Toast />
|
|
37
35
|
</View>
|
|
38
36
|
)
|
|
39
37
|
}
|
package/src/screens/index.ts
CHANGED
|
@@ -8,7 +8,6 @@ export * from './preferred_app_selection_screen'
|
|
|
8
8
|
export * from './group_notification_settings_screen'
|
|
9
9
|
export * from './conversation_filter_recipients/conversation_filter_recipients_screen'
|
|
10
10
|
export * from './message_actions_screen'
|
|
11
|
-
export * from './conversation_actions_screen'
|
|
12
11
|
export * from './message_report_screen'
|
|
13
12
|
export * from './send_giphy_screen'
|
|
14
13
|
export * from './not_found'
|
|
@@ -5,7 +5,6 @@ export type NotificationLevelDescription = string
|
|
|
5
5
|
|
|
6
6
|
export interface ConversationMembershipResource extends ResourceObject {
|
|
7
7
|
type: 'ConversationMembership'
|
|
8
|
-
hidden?: boolean
|
|
9
8
|
lastReadMessageSortKey: string
|
|
10
9
|
muted: boolean
|
|
11
10
|
notificationLevel: NotificationLevelValue
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"toast.d.ts","sourceRoot":"","sources":["../../../src/components/display/toast.tsx"],"names":[],"mappings":"AAUA,eAAO,MAAM,iBAAiB,OAAO,CAAA;AAErC,wBAAgB,KAAK,mDAgEpB"}
|