@planningcenter/chat-react-native 4.7.1-qa-staging.3 → 4.7.1-rc.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/conversation/attachments/expanded_link.js +8 -8
- package/build/components/conversation/attachments/expanded_link.js.map +1 -1
- package/build/components/conversation/attachments/generic_file_attachment.d.ts.map +1 -1
- package/build/components/conversation/attachments/generic_file_attachment.js +2 -2
- package/build/components/conversation/attachments/generic_file_attachment.js.map +1 -1
- 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.js +2 -2
- package/build/components/conversation/attachments/image_attachment.js.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_markdown.js +2 -2
- package/build/components/conversation/message_markdown.js.map +1 -1
- package/build/components/conversations/conversation_actions.d.ts.map +1 -1
- package/build/components/conversations/conversation_actions.js +193 -333
- package/build/components/conversations/conversation_actions.js.map +1 -1
- package/build/components/conversations/conversation_preview.d.ts.map +1 -1
- package/build/components/conversations/conversation_preview.js +91 -106
- package/build/components/conversations/conversation_preview.js.map +1 -1
- package/build/components/conversations/conversations.d.ts.map +1 -1
- package/build/components/conversations/conversations.js +56 -63
- package/build/components/conversations/conversations.js.map +1 -1
- package/build/components/conversations/conversations_blank_state.d.ts +1 -2
- package/build/components/conversations/conversations_blank_state.d.ts.map +1 -1
- package/build/components/conversations/conversations_blank_state.js +39 -71
- package/build/components/conversations/conversations_blank_state.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 +31 -39
- package/build/contexts/conversations_context.js.map +1 -1
- package/build/hooks/groups/use_group_members_for_new_conversation.d.ts +0 -6
- package/build/hooks/groups/use_group_members_for_new_conversation.d.ts.map +1 -1
- package/build/hooks/use_api.d.ts +0 -6
- package/build/hooks/use_api.d.ts.map +1 -1
- package/build/hooks/use_api.js +5 -8
- package/build/hooks/use_api.js.map +1 -1
- package/build/hooks/use_clear_conversation_filters.d.ts.map +1 -1
- package/build/hooks/use_clear_conversation_filters.js +0 -1
- package/build/hooks/use_clear_conversation_filters.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/hooks/use_groups.d.ts +0 -6
- package/build/hooks/use_groups.d.ts.map +1 -1
- package/build/hooks/use_groups_groups.d.ts +0 -6
- package/build/hooks/use_groups_groups.d.ts.map +1 -1
- package/build/hooks/use_live_relative_time.js +6 -5
- package/build/hooks/use_live_relative_time.js.map +1 -1
- package/build/hooks/use_teams.d.ts +0 -6
- package/build/hooks/use_teams.d.ts.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/age_check/age_check_underage_screen.js +3 -3
- package/build/screens/age_check/age_check_underage_screen.js.map +1 -1
- package/build/screens/attachment_actions/attachment_actions_screen.js +2 -2
- package/build/screens/attachment_actions/attachment_actions_screen.js.map +1 -1
- package/build/screens/bug_report_screen.js +4 -4
- 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 +394 -460
- package/build/screens/conversation_details_screen.js.map +1 -1
- package/build/screens/conversation_filters/components/conversation_filters.d.ts.map +1 -1
- package/build/screens/conversation_filters/components/conversation_filters.js +12 -53
- package/build/screens/conversation_filters/components/conversation_filters.js.map +1 -1
- package/build/screens/conversation_filters/components/rows.d.ts +3 -6
- package/build/screens/conversation_filters/components/rows.d.ts.map +1 -1
- package/build/screens/conversation_filters/components/rows.js +62 -99
- package/build/screens/conversation_filters/components/rows.js.map +1 -1
- package/build/screens/conversation_filters/context/conversation_filter_context.d.ts.map +1 -1
- package/build/screens/conversation_filters/context/conversation_filter_context.js +0 -4
- package/build/screens/conversation_filters/context/conversation_filter_context.js.map +1 -1
- package/build/screens/conversation_filters/filter_types.d.ts +0 -1
- package/build/screens/conversation_filters/filter_types.d.ts.map +1 -1
- package/build/screens/conversation_filters/filter_types.js +0 -1
- package/build/screens/conversation_filters/filter_types.js.map +1 -1
- package/build/screens/conversation_filters/hooks/filters.d.ts +0 -12
- package/build/screens/conversation_filters/hooks/filters.d.ts.map +1 -1
- package/build/screens/conversation_filters/screen_props.d.ts +0 -1
- package/build/screens/conversation_filters/screen_props.d.ts.map +1 -1
- package/build/screens/conversation_filters/screen_props.js.map +1 -1
- package/build/screens/conversations/components/filter_dropdown_list_header_component.d.ts.map +1 -1
- package/build/screens/conversations/components/filter_dropdown_list_header_component.js +126 -138
- package/build/screens/conversations/components/filter_dropdown_list_header_component.js.map +1 -1
- package/build/screens/conversations/components/list_header_component.d.ts.map +1 -1
- package/build/screens/conversations/components/list_header_component.js +90 -95
- package/build/screens/conversations/components/list_header_component.js.map +1 -1
- package/build/screens/conversations/components/search_list_header_component.d.ts.map +1 -1
- package/build/screens/conversations/components/search_list_header_component.js +95 -100
- package/build/screens/conversations/components/search_list_header_component.js.map +1 -1
- package/build/screens/conversations/conversations_screen.d.ts +0 -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/get_help_screen.d.ts.map +1 -1
- package/build/screens/get_help_screen.js +21 -5
- package/build/screens/get_help_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/build/utils/date.d.ts +1 -1
- package/build/utils/date.d.ts.map +1 -1
- package/build/utils/date.js +4 -4
- package/build/utils/date.js.map +1 -1
- package/build/utils/index.d.ts +0 -1
- package/build/utils/index.d.ts.map +1 -1
- package/build/utils/index.js +0 -1
- package/build/utils/index.js.map +1 -1
- package/build/utils/request/conversation.d.ts +1 -3
- package/build/utils/request/conversation.d.ts.map +1 -1
- package/build/utils/request/conversation.js +0 -4
- package/build/utils/request/conversation.js.map +1 -1
- package/build/vendor/font_awesome_pro_solid_icons.d.ts +0 -1
- package/build/vendor/font_awesome_pro_solid_icons.d.ts.map +1 -1
- package/build/vendor/font_awesome_pro_solid_icons.js +0 -5
- package/build/vendor/font_awesome_pro_solid_icons.js.map +1 -1
- package/package.json +3 -3
- package/src/__tests__/components/conversation/attachments/giphy_attachment.test.tsx +1 -1
- package/src/__tests__/screens/conversation_filters/components/conversation_filters.test.tsx +0 -6
- package/src/__tests__/screens/get_help_screen.test.ts +1 -1
- package/src/components/conversation/attachments/expanded_link.tsx +4 -4
- package/src/components/conversation/attachments/generic_file_attachment.tsx +5 -2
- package/src/components/conversation/attachments/giphy_attachment.tsx +4 -2
- package/src/components/conversation/attachments/image_attachment.tsx +2 -2
- package/src/components/conversation/message_form.tsx +2 -2
- package/src/components/conversation/message_markdown.tsx +2 -2
- package/src/components/conversations/__tests__/conversation_actions.test.tsx +2 -77
- package/src/components/conversations/__tests__/conversation_preview.test.tsx +0 -29
- package/src/components/conversations/__tests__/conversations.test.tsx +0 -26
- package/src/components/conversations/__tests__/conversations_blank_state.test.tsx +0 -17
- package/src/components/conversations/conversation_actions.tsx +4 -73
- package/src/components/conversations/conversation_preview.tsx +1 -12
- package/src/components/conversations/conversations.tsx +0 -9
- package/src/components/conversations/conversations_blank_state.tsx +0 -18
- package/src/components/group_conversation_list.tsx +1 -4
- package/src/contexts/conversations_context.tsx +1 -8
- package/src/hooks/__tests__/use_live_relative_time.test.tsx +22 -0
- package/src/hooks/use_api.ts +1 -2
- package/src/hooks/use_clear_conversation_filters.ts +0 -1
- package/src/hooks/use_conversation.ts +0 -1
- package/src/hooks/use_features.ts +0 -1
- package/src/hooks/use_live_relative_time.ts +1 -1
- package/src/navigation/index.tsx +0 -8
- package/src/screens/__tests__/conversation_details_screen.test.tsx +1 -49
- package/src/screens/age_check/age_check_underage_screen.tsx +3 -3
- package/src/screens/attachment_actions/attachment_actions_screen.tsx +2 -2
- package/src/screens/bug_report_screen.tsx +4 -4
- package/src/screens/conversation_details_screen.tsx +0 -19
- package/src/screens/conversation_filters/__tests__/conversation_filters.test.tsx +0 -42
- package/src/screens/conversation_filters/components/conversation_filters.tsx +3 -22
- package/src/screens/conversation_filters/components/rows.tsx +10 -44
- package/src/screens/conversation_filters/context/conversation_filter_context.tsx +0 -4
- package/src/screens/conversation_filters/filter_types.ts +0 -1
- package/src/screens/conversation_filters/screen_props.ts +0 -1
- package/src/screens/conversations/__tests__/conversations_screen.test.tsx +0 -1
- package/src/screens/conversations/components/__tests__/filter_dropdown_list_header_component.test.tsx +0 -42
- package/src/screens/conversations/components/__tests__/list_header_component.test.tsx +0 -1
- package/src/screens/conversations/components/filter_dropdown_list_header_component.tsx +5 -21
- package/src/screens/conversations/components/list_header_component.tsx +4 -14
- package/src/screens/conversations/components/search_list_header_component.tsx +4 -14
- package/src/screens/conversations/conversations_screen.tsx +0 -3
- package/src/screens/get_help_screen.tsx +19 -5
- package/src/screens/index.ts +0 -1
- package/src/types/resources/conversation_membership.ts +0 -1
- package/src/utils/__tests__/date.test.ts +10 -1
- package/src/utils/date.ts +4 -4
- package/src/utils/index.ts +0 -1
- package/src/utils/request/conversation.ts +0 -6
- package/src/vendor/font_awesome_pro_solid_icons.ts +0 -12
- package/build/components/conversations/hidden_indicator.d.ts +0 -4
- package/build/components/conversations/hidden_indicator.d.ts.map +0 -1
- package/build/components/conversations/hidden_indicator.js +0 -52
- package/build/components/conversations/hidden_indicator.js.map +0 -1
- package/build/components/conversations/hidden_results_footer.d.ts +0 -2
- package/build/components/conversations/hidden_results_footer.d.ts.map +0 -1
- package/build/components/conversations/hidden_results_footer.js +0 -34
- package/build/components/conversations/hidden_results_footer.js.map +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_hidden_conversations_count.d.ts +0 -2
- package/build/hooks/use_hidden_conversations_count.d.ts.map +0 -1
- package/build/hooks/use_hidden_conversations_count.js +0 -32
- package/build/hooks/use_hidden_conversations_count.js.map +0 -1
- package/build/hooks/use_hide_conversation.d.ts +0 -108
- package/build/hooks/use_hide_conversation.d.ts.map +0 -1
- package/build/hooks/use_hide_conversation.js +0 -243
- 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/open_url.d.ts +0 -11
- package/build/utils/open_url.d.ts.map +0 -1
- package/build/utils/open_url.js +0 -46
- package/build/utils/open_url.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/conversations/hidden_indicator.tsx +0 -30
- package/src/components/conversations/hidden_results_footer.tsx +0 -25
- 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 -189
- package/src/hooks/use_hidden_conversations_count.ts +0 -14
- package/src/hooks/use_hide_conversation.ts +0 -128
- 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/__tests__/open_url.test.ts +0 -67
- package/src/utils/open_url.ts +0 -47
- package/src/utils/toast_store.ts +0 -45
|
@@ -1,14 +1,9 @@
|
|
|
1
1
|
import React from 'react'
|
|
2
2
|
import { renderWithQueryClient } from '../../../__utils__/render_with_query_client'
|
|
3
|
-
import { ConversationFiltersParams } from '../../../screens/conversation_filters/screen_props'
|
|
4
3
|
import type { ConversationPreviewData, ConversationResource } from '../../../types'
|
|
5
4
|
import { formatDatePreview } from '../../../utils/date'
|
|
6
5
|
import { ConversationPreview } from '../conversation_preview'
|
|
7
6
|
|
|
8
|
-
let mockArgs: ConversationFiltersParams = {}
|
|
9
|
-
jest.mock('../../../contexts/conversations_context', () => ({
|
|
10
|
-
useConversationsContext: () => ({ args: mockArgs }),
|
|
11
|
-
}))
|
|
12
7
|
jest.mock('../conversation_actions', () => ({
|
|
13
8
|
ConversationActions: ({
|
|
14
9
|
children,
|
|
@@ -107,28 +102,4 @@ describe('ConversationPreview', () => {
|
|
|
107
102
|
).toBeNull()
|
|
108
103
|
expect(view.getByLabelText(/^Select Worship Team, Disabled,/)).toBeTruthy()
|
|
109
104
|
})
|
|
110
|
-
|
|
111
|
-
describe('hidden indicator', () => {
|
|
112
|
-
afterEach(() => {
|
|
113
|
-
mockArgs = {}
|
|
114
|
-
})
|
|
115
|
-
|
|
116
|
-
it('marks rows in the hidden list as hidden', () => {
|
|
117
|
-
mockArgs = { show_hidden: true }
|
|
118
|
-
const view = renderPreview(messagePreview)
|
|
119
|
-
|
|
120
|
-
expect(
|
|
121
|
-
view.getByTestId('conversation-hidden-icon', { includeHiddenElements: true })
|
|
122
|
-
).toBeTruthy()
|
|
123
|
-
expect(view.getByLabelText(/^Select Worship Team, Hidden,/)).toBeTruthy()
|
|
124
|
-
})
|
|
125
|
-
|
|
126
|
-
it('leaves rows outside the hidden list unmarked', () => {
|
|
127
|
-
const view = renderPreview(messagePreview)
|
|
128
|
-
|
|
129
|
-
expect(
|
|
130
|
-
view.queryByTestId('conversation-hidden-icon', { includeHiddenElements: true })
|
|
131
|
-
).toBeNull()
|
|
132
|
-
})
|
|
133
|
-
})
|
|
134
105
|
})
|
|
@@ -91,29 +91,3 @@ describe('Conversations archived footer', () => {
|
|
|
91
91
|
expect(view.queryByLabelText('View active conversations')).toBeNull()
|
|
92
92
|
})
|
|
93
93
|
})
|
|
94
|
-
|
|
95
|
-
describe('Conversations hidden footer', () => {
|
|
96
|
-
beforeEach(() => {
|
|
97
|
-
mockFilterDropdownEnabled = true
|
|
98
|
-
mockHasNextPage = false
|
|
99
|
-
mockArgs = { show_hidden: true }
|
|
100
|
-
})
|
|
101
|
-
|
|
102
|
-
it('ends the hidden list with a note on how conversations come back', () => {
|
|
103
|
-
const view = render(<Conversations />)
|
|
104
|
-
|
|
105
|
-
expect(
|
|
106
|
-
view.getByText(
|
|
107
|
-
'Hidden just for you. A conversation comes back to your list when someone sends a new message, unless it’s also silenced.'
|
|
108
|
-
)
|
|
109
|
-
).toBeTruthy()
|
|
110
|
-
expect(view.queryByText('You’re viewing filtered results')).toBeNull()
|
|
111
|
-
})
|
|
112
|
-
|
|
113
|
-
it('waits for the last page before showing the hidden note', () => {
|
|
114
|
-
mockHasNextPage = true
|
|
115
|
-
const view = render(<Conversations />)
|
|
116
|
-
|
|
117
|
-
expect(view.queryByText(/Hidden just for you/)).toBeNull()
|
|
118
|
-
})
|
|
119
|
-
})
|
|
@@ -41,7 +41,6 @@ describe('ConversationsBlankState', () => {
|
|
|
41
41
|
group_source_app_name: undefined,
|
|
42
42
|
show_direct_messages: undefined,
|
|
43
43
|
show_archived: undefined,
|
|
44
|
-
show_hidden: undefined,
|
|
45
44
|
show_unread: undefined,
|
|
46
45
|
})
|
|
47
46
|
})
|
|
@@ -72,20 +71,4 @@ describe('ConversationsBlankState', () => {
|
|
|
72
71
|
expect(view.queryByText('View all conversations')).toBeNull()
|
|
73
72
|
})
|
|
74
73
|
})
|
|
75
|
-
|
|
76
|
-
it('explains how to hide a conversation when the hidden list is empty', () => {
|
|
77
|
-
mockUseFilterDropdownEnabled.mockReturnValue(true)
|
|
78
|
-
|
|
79
|
-
const view = render(
|
|
80
|
-
<ConversationsBlankState
|
|
81
|
-
isFilterApplied={true}
|
|
82
|
-
isHiddenFilterApplied={true}
|
|
83
|
-
canCreateConversations={true}
|
|
84
|
-
/>
|
|
85
|
-
)
|
|
86
|
-
|
|
87
|
-
expect(view.getByText('No hidden conversations')).toBeTruthy()
|
|
88
|
-
expect(view.getByText('Swipe left on a conversation to hide it from your list.')).toBeTruthy()
|
|
89
|
-
expect(view.queryByText('View all conversations')).toBeNull()
|
|
90
|
-
})
|
|
91
74
|
})
|
|
@@ -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,10 +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
|
|
46
|
-
useConversationsContext()
|
|
40
|
+
const { activeConversationId, setActiveConversationId } = useConversationsContext()
|
|
47
41
|
const [disabled, setDisabled] = useState(false)
|
|
48
42
|
const overshootLeft = Platform.OS === 'ios'
|
|
49
43
|
const androidRippleColor = useCreateAndroidRippleColor({
|
|
@@ -57,16 +51,9 @@ export function ConversationActions({
|
|
|
57
51
|
} = useConversationsMarkRead({
|
|
58
52
|
conversation,
|
|
59
53
|
})
|
|
60
|
-
const {
|
|
61
|
-
hidden,
|
|
62
|
-
setHidden,
|
|
63
|
-
isPending: isHiddenPending,
|
|
64
|
-
} = useHideConversation({ conversation, hidden: args.show_hidden || undefined })
|
|
65
|
-
const hideConversationsEnabled = useHideConversationsEnabled()
|
|
66
54
|
|
|
67
55
|
const isConversationEmpty = conversation.lastMessageCreatedAt === null
|
|
68
56
|
const canMute = !isArchivedConversation(conversation)
|
|
69
|
-
const canHide = hideable && hideConversationsEnabled && !isArchivedConversation(conversation)
|
|
70
57
|
|
|
71
58
|
const handleSwipeableClose = useCallback(() => {
|
|
72
59
|
setDisabled(false)
|
|
@@ -88,18 +75,6 @@ export function ConversationActions({
|
|
|
88
75
|
handleSwipeableClose()
|
|
89
76
|
}, [muted, handleSwipeableClose, setMuted])
|
|
90
77
|
|
|
91
|
-
const handleHide = useCallback(() => {
|
|
92
|
-
setHidden(!hidden)
|
|
93
|
-
handleSwipeableClose()
|
|
94
|
-
}, [hidden, handleSwipeableClose, setHidden])
|
|
95
|
-
|
|
96
|
-
const handleLongPress = useCallback(() => {
|
|
97
|
-
if (disabled) return
|
|
98
|
-
|
|
99
|
-
Haptic.impactLight()
|
|
100
|
-
navigation.navigate('ConversationActions', { conversation_id: conversation.id })
|
|
101
|
-
}, [disabled, navigation, conversation.id])
|
|
102
|
-
|
|
103
78
|
const handleLatestMessageUnread = useCallback(() => {
|
|
104
79
|
markRead(!read)
|
|
105
80
|
handleSwipeableClose()
|
|
@@ -123,20 +98,7 @@ export function ConversationActions({
|
|
|
123
98
|
]
|
|
124
99
|
: []
|
|
125
100
|
|
|
126
|
-
const
|
|
127
|
-
? [
|
|
128
|
-
{
|
|
129
|
-
name: hidden ? 'unhide' : 'hide',
|
|
130
|
-
label: hidden ? 'Unhide' : 'Hide',
|
|
131
|
-
},
|
|
132
|
-
]
|
|
133
|
-
: []
|
|
134
|
-
|
|
135
|
-
const accessibilityActions = [
|
|
136
|
-
...muteAccessibilityAction,
|
|
137
|
-
...hideAccessibilityAction,
|
|
138
|
-
...readAccessibilityAction,
|
|
139
|
-
]
|
|
101
|
+
const accessibilityActions = [...muteAccessibilityAction, ...readAccessibilityAction]
|
|
140
102
|
|
|
141
103
|
const handleAccessibilityAction = useCallback(
|
|
142
104
|
(event: AccessibilityActionEvent) => {
|
|
@@ -153,13 +115,9 @@ export function ConversationActions({
|
|
|
153
115
|
case 'unmute':
|
|
154
116
|
handleMute()
|
|
155
117
|
break
|
|
156
|
-
case 'hide':
|
|
157
|
-
case 'unhide':
|
|
158
|
-
handleHide()
|
|
159
|
-
break
|
|
160
118
|
}
|
|
161
119
|
},
|
|
162
|
-
[handleLatestMessageUnread, handleMute
|
|
120
|
+
[handleLatestMessageUnread, handleMute]
|
|
163
121
|
)
|
|
164
122
|
|
|
165
123
|
useEffect(() => {
|
|
@@ -183,15 +141,11 @@ export function ConversationActions({
|
|
|
183
141
|
<LeftActions
|
|
184
142
|
isConversationEmpty={isConversationEmpty}
|
|
185
143
|
canMute={canMute}
|
|
186
|
-
canHide={canHide}
|
|
187
144
|
handleMute={handleMute}
|
|
188
|
-
handleHide={handleHide}
|
|
189
145
|
handleLatestMessageUnread={handleLatestMessageUnread}
|
|
190
146
|
muted={muted}
|
|
191
|
-
hidden={hidden}
|
|
192
147
|
read={read}
|
|
193
148
|
isMutedPending={isMutedPending}
|
|
194
|
-
isHiddenPending={isHiddenPending}
|
|
195
149
|
isMarkReadPending={isMarkReadPending}
|
|
196
150
|
/>
|
|
197
151
|
)}
|
|
@@ -199,7 +153,6 @@ export function ConversationActions({
|
|
|
199
153
|
<Pressable
|
|
200
154
|
testID={`conversation-${conversation.id}`}
|
|
201
155
|
onPress={handlePress}
|
|
202
|
-
onLongPress={canHide ? handleLongPress : undefined}
|
|
203
156
|
style={({ pressed }) => [style, pressed && platformPressedOpacityStyle]}
|
|
204
157
|
android_ripple={{ color: androidRippleColor, borderless: false, foreground: true }}
|
|
205
158
|
accessibilityLabel={accessibilityLabel}
|
|
@@ -216,44 +169,31 @@ export function ConversationActions({
|
|
|
216
169
|
interface LeftActionsProps {
|
|
217
170
|
isConversationEmpty: boolean
|
|
218
171
|
canMute: boolean
|
|
219
|
-
canHide: boolean
|
|
220
172
|
handleMute: () => void
|
|
221
|
-
handleHide: () => void
|
|
222
173
|
handleLatestMessageUnread: () => void
|
|
223
174
|
muted: boolean
|
|
224
|
-
hidden: boolean
|
|
225
175
|
read: boolean
|
|
226
176
|
isMutedPending: boolean
|
|
227
|
-
isHiddenPending: boolean
|
|
228
177
|
isMarkReadPending: boolean
|
|
229
178
|
}
|
|
230
179
|
|
|
231
180
|
function LeftActions({
|
|
232
181
|
isConversationEmpty,
|
|
233
182
|
canMute,
|
|
234
|
-
canHide,
|
|
235
183
|
handleMute,
|
|
236
|
-
handleHide,
|
|
237
184
|
handleLatestMessageUnread,
|
|
238
185
|
muted,
|
|
239
|
-
hidden,
|
|
240
186
|
read,
|
|
241
187
|
isMutedPending,
|
|
242
|
-
isHiddenPending,
|
|
243
188
|
isMarkReadPending,
|
|
244
189
|
}: LeftActionsProps) {
|
|
245
|
-
const styles = useStyles({ actionButtonCount:
|
|
190
|
+
const styles = useStyles({ actionButtonCount: canMute ? 2 : 1 })
|
|
246
191
|
|
|
247
192
|
const muteToggleContent = {
|
|
248
193
|
true: { iconName: 'general.bell', label: 'Enable' },
|
|
249
194
|
false: { iconName: 'general.bellMuted', label: 'Silence' },
|
|
250
195
|
} as const
|
|
251
196
|
|
|
252
|
-
const hideToggleContent = {
|
|
253
|
-
true: { iconName: 'general.showEye', label: 'Unhide' },
|
|
254
|
-
false: { iconName: 'general.hideEye', label: 'Hide' },
|
|
255
|
-
} as const
|
|
256
|
-
|
|
257
197
|
const latestMessageUnreadToggleContent = {
|
|
258
198
|
true: { iconName: 'general.outlinedTextMessage', label: 'Mark read' },
|
|
259
199
|
false: { iconName: 'general.textMessageNotifications', label: 'Mark unread' },
|
|
@@ -278,15 +218,6 @@ function LeftActions({
|
|
|
278
218
|
backgroundColor={tokens.fillColorInteractionSwipeSecondary}
|
|
279
219
|
/>
|
|
280
220
|
)}
|
|
281
|
-
{canHide && (
|
|
282
|
-
<SwipeableToggleButton
|
|
283
|
-
loading={isHiddenPending}
|
|
284
|
-
toggled={hidden}
|
|
285
|
-
onPress={handleHide}
|
|
286
|
-
toggleContent={hideToggleContent}
|
|
287
|
-
backgroundColor={tokens.colorNeutral45}
|
|
288
|
-
/>
|
|
289
|
-
)}
|
|
290
221
|
</View>
|
|
291
222
|
)
|
|
292
223
|
}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import React from 'react'
|
|
2
2
|
import { StyleSheet, View, ViewStyle } from 'react-native'
|
|
3
|
-
import { useConversationsContext } from '../../contexts/conversations_context'
|
|
4
3
|
import {
|
|
5
4
|
useTheme,
|
|
6
5
|
useAtFontScaleBreakpoint,
|
|
@@ -22,7 +21,6 @@ import {
|
|
|
22
21
|
type BadgeProps,
|
|
23
22
|
} from '../display'
|
|
24
23
|
import { ConversationActions } from './conversation_actions'
|
|
25
|
-
import { HiddenIndicator } from './hidden_indicator'
|
|
26
24
|
import { MuteIndicator } from './mute_indicator'
|
|
27
25
|
import { UnreadCountBadge } from './unread_count_badge'
|
|
28
26
|
|
|
@@ -42,9 +40,6 @@ export const ConversationPreview = ({
|
|
|
42
40
|
style,
|
|
43
41
|
}: ConversationPreviewProps) => {
|
|
44
42
|
const styles = useStyles()
|
|
45
|
-
const {
|
|
46
|
-
args: { show_hidden: hidden = false },
|
|
47
|
-
} = useConversationsContext()
|
|
48
43
|
const {
|
|
49
44
|
conversationPreview,
|
|
50
45
|
lastMessageCreatedAt,
|
|
@@ -59,7 +54,7 @@ export const ConversationPreview = ({
|
|
|
59
54
|
const archived = isArchivedConversation(conversation)
|
|
60
55
|
const emptyConversation = !lastMessageCreatedAt
|
|
61
56
|
const fallbackIconName = emptyConversation ? 'people.noTextMessage' : 'general.person'
|
|
62
|
-
const hasMetaContent = lastMessageCreatedAt || unreadCount > 0 || muted
|
|
57
|
+
const hasMetaContent = lastMessageCreatedAt || unreadCount > 0 || muted
|
|
63
58
|
const isUnread = unreadCount > 0 || unreadReaction
|
|
64
59
|
|
|
65
60
|
const numberOfLinesScaledTitle = useScalableNumberOfLines(1)
|
|
@@ -73,7 +68,6 @@ export const ConversationPreview = ({
|
|
|
73
68
|
conversation,
|
|
74
69
|
showBadges,
|
|
75
70
|
archived,
|
|
76
|
-
hidden,
|
|
77
71
|
})
|
|
78
72
|
|
|
79
73
|
return (
|
|
@@ -123,7 +117,6 @@ export const ConversationPreview = ({
|
|
|
123
117
|
<View style={styles.statusContainer}>
|
|
124
118
|
<UnreadCountBadge count={unreadCount} unreadReaction={unreadReaction} showDot={muted} />
|
|
125
119
|
<MuteIndicator muted={muted} />
|
|
126
|
-
<HiddenIndicator hidden={hidden} />
|
|
127
120
|
</View>
|
|
128
121
|
</View>
|
|
129
122
|
)}
|
|
@@ -221,13 +214,11 @@ interface GetConversationAccessibilityLabelProps {
|
|
|
221
214
|
conversation: ConversationResource
|
|
222
215
|
showBadges: boolean
|
|
223
216
|
archived: boolean
|
|
224
|
-
hidden: boolean
|
|
225
217
|
}
|
|
226
218
|
const getConversationAccessibilityLabel = ({
|
|
227
219
|
conversation,
|
|
228
220
|
showBadges,
|
|
229
221
|
archived,
|
|
230
|
-
hidden,
|
|
231
222
|
}: GetConversationAccessibilityLabelProps) => {
|
|
232
223
|
const { badges, title, conversationPreview, muted, disabled, unreadCount, unreadReaction } =
|
|
233
224
|
conversation
|
|
@@ -240,7 +231,6 @@ const getConversationAccessibilityLabel = ({
|
|
|
240
231
|
badge: hasBadges ? `for ${badges[0]?.pcoResourceType} ${badges[0]?.text || ''}` : '',
|
|
241
232
|
disabled: archived ? 'Archived' : disabled ? 'Disabled' : '',
|
|
242
233
|
muted: muted ? 'Muted' : '',
|
|
243
|
-
hidden: hidden ? 'Hidden' : '',
|
|
244
234
|
readStatus: hasUnreadMessages
|
|
245
235
|
? `${unreadCount} unread messages`
|
|
246
236
|
: unreadReaction
|
|
@@ -256,7 +246,6 @@ const getConversationAccessibilityLabel = ({
|
|
|
256
246
|
label.badge,
|
|
257
247
|
label.disabled,
|
|
258
248
|
label.muted,
|
|
259
|
-
label.hidden,
|
|
260
249
|
label.readStatus,
|
|
261
250
|
label.lastMessage,
|
|
262
251
|
]
|
|
@@ -12,7 +12,6 @@ import { ArchivedResultsFooter } from './archived_results_footer'
|
|
|
12
12
|
import { ConversationPreview, ConversationPreviewSkeleton } from './conversation_preview'
|
|
13
13
|
import { ConversationsBlankState } from './conversations_blank_state'
|
|
14
14
|
import { FilteredResultsFooter } from './filtered_results_footer'
|
|
15
|
-
import { HiddenResultsFooter } from './hidden_results_footer'
|
|
16
15
|
|
|
17
16
|
interface ConversationsProps {
|
|
18
17
|
ListHeaderComponent?:
|
|
@@ -37,7 +36,6 @@ export const Conversations = ({ ListHeaderComponent }: ConversationsProps) => {
|
|
|
37
36
|
group_source_app_name,
|
|
38
37
|
show_direct_messages,
|
|
39
38
|
show_archived,
|
|
40
|
-
show_hidden,
|
|
41
39
|
show_unread,
|
|
42
40
|
},
|
|
43
41
|
} = useConversationsContext()
|
|
@@ -50,16 +48,12 @@ export const Conversations = ({ ListHeaderComponent }: ConversationsProps) => {
|
|
|
50
48
|
!!group_source_app_name ||
|
|
51
49
|
!!show_direct_messages ||
|
|
52
50
|
!!show_archived ||
|
|
53
|
-
!!show_hidden ||
|
|
54
51
|
!!show_unread
|
|
55
52
|
const showArchivedResultsFooter = !!show_archived && !isLoading && !hasNextPage
|
|
56
|
-
const showHiddenResultsFooter =
|
|
57
|
-
!!show_hidden && !isLoading && !hasNextPage && conversations.length > 0
|
|
58
53
|
const showFilteredResultsFooter =
|
|
59
54
|
filterDropdownEnabled &&
|
|
60
55
|
isFilterApplied &&
|
|
61
56
|
!show_archived &&
|
|
62
|
-
!show_hidden &&
|
|
63
57
|
!hasNextPage &&
|
|
64
58
|
!isLoading &&
|
|
65
59
|
conversations.length > 0
|
|
@@ -92,15 +86,12 @@ export const Conversations = ({ ListHeaderComponent }: ConversationsProps) => {
|
|
|
92
86
|
ListEmptyComponent={
|
|
93
87
|
<ConversationsBlankState
|
|
94
88
|
isFilterApplied={isFilterApplied}
|
|
95
|
-
isHiddenFilterApplied={!!show_hidden}
|
|
96
89
|
canCreateConversations={canCreateConversations}
|
|
97
90
|
/>
|
|
98
91
|
}
|
|
99
92
|
ListFooterComponent={
|
|
100
93
|
showArchivedResultsFooter ? (
|
|
101
94
|
<ArchivedResultsFooter onViewActiveConversations={clearFilters} />
|
|
102
|
-
) : showHiddenResultsFooter ? (
|
|
103
|
-
<HiddenResultsFooter />
|
|
104
95
|
) : showFilteredResultsFooter ? (
|
|
105
96
|
<FilteredResultsFooter />
|
|
106
97
|
) : null
|
|
@@ -6,34 +6,16 @@ import BlankState from '../primitive/blank_state_primitive'
|
|
|
6
6
|
|
|
7
7
|
interface ConversationsBlankStateProps {
|
|
8
8
|
isFilterApplied: boolean
|
|
9
|
-
isHiddenFilterApplied?: boolean
|
|
10
9
|
canCreateConversations: boolean
|
|
11
10
|
}
|
|
12
11
|
|
|
13
12
|
export function ConversationsBlankState({
|
|
14
13
|
isFilterApplied,
|
|
15
|
-
isHiddenFilterApplied = false,
|
|
16
14
|
canCreateConversations,
|
|
17
15
|
}: ConversationsBlankStateProps) {
|
|
18
16
|
const filterDropdownEnabled = useFilterDropdownEnabled()
|
|
19
17
|
const clearFilters = useClearConversationFilters()
|
|
20
18
|
|
|
21
|
-
if (isHiddenFilterApplied) {
|
|
22
|
-
return (
|
|
23
|
-
<View style={styles.container}>
|
|
24
|
-
<BlankState.Root>
|
|
25
|
-
<BlankState.Imagery name="general.hideEye" />
|
|
26
|
-
<BlankState.Content>
|
|
27
|
-
<BlankState.Heading>No hidden conversations</BlankState.Heading>
|
|
28
|
-
<BlankState.Text>
|
|
29
|
-
Swipe left on a conversation to hide it from your list.
|
|
30
|
-
</BlankState.Text>
|
|
31
|
-
</BlankState.Content>
|
|
32
|
-
</BlankState.Root>
|
|
33
|
-
</View>
|
|
34
|
-
)
|
|
35
|
-
}
|
|
36
|
-
|
|
37
19
|
if (filterDropdownEnabled && isFilterApplied) {
|
|
38
20
|
return (
|
|
39
21
|
<View style={styles.container}>
|
|
@@ -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 {
|
|
@@ -54,7 +50,6 @@ export const ConversationsContextProvider = ({
|
|
|
54
50
|
group_source_app_name,
|
|
55
51
|
show_direct_messages,
|
|
56
52
|
show_archived,
|
|
57
|
-
show_hidden,
|
|
58
53
|
show_unread,
|
|
59
54
|
} = args
|
|
60
55
|
|
|
@@ -64,7 +59,6 @@ export const ConversationsContextProvider = ({
|
|
|
64
59
|
group_source_app_name,
|
|
65
60
|
show_direct_messages,
|
|
66
61
|
show_archived,
|
|
67
|
-
show_hidden,
|
|
68
62
|
show_unread,
|
|
69
63
|
},
|
|
70
64
|
paginatorOptions
|
|
@@ -75,10 +69,9 @@ export const ConversationsContextProvider = ({
|
|
|
75
69
|
args,
|
|
76
70
|
activeConversationId,
|
|
77
71
|
setActiveConversationId,
|
|
78
|
-
hideable,
|
|
79
72
|
...query,
|
|
80
73
|
}),
|
|
81
|
-
[args, activeConversationId,
|
|
74
|
+
[args, activeConversationId, query]
|
|
82
75
|
)
|
|
83
76
|
|
|
84
77
|
return <ConversationsContext.Provider value={value}>{children}</ConversationsContext.Provider>
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { act, renderHook } from '@testing-library/react-native'
|
|
2
|
+
import { useLiveRelativeTime } from '../use_live_relative_time'
|
|
3
|
+
|
|
4
|
+
beforeEach(() => {
|
|
5
|
+
jest.useFakeTimers()
|
|
6
|
+
jest.setSystemTime(new Date('2026-11-10T12:00:00Z'))
|
|
7
|
+
})
|
|
8
|
+
afterEach(() => jest.useRealTimers())
|
|
9
|
+
|
|
10
|
+
describe('useLiveRelativeTime', () => {
|
|
11
|
+
it('refreshes the label every minute while mounted', () => {
|
|
12
|
+
const date = new Date('2026-11-10T11:49:00Z').toISOString()
|
|
13
|
+
const { result } = renderHook(() => useLiveRelativeTime(date))
|
|
14
|
+
expect(result.current).toBe('11 minutes ago')
|
|
15
|
+
|
|
16
|
+
act(() => jest.advanceTimersByTime(60000))
|
|
17
|
+
expect(result.current).toBe('12 minutes ago')
|
|
18
|
+
|
|
19
|
+
act(() => jest.advanceTimersByTime(60000))
|
|
20
|
+
expect(result.current).toBe('13 minutes ago')
|
|
21
|
+
})
|
|
22
|
+
})
|
package/src/hooks/use_api.ts
CHANGED
|
@@ -84,7 +84,6 @@ export const useApiPaginator = <T extends ResourceObject>(
|
|
|
84
84
|
})
|
|
85
85
|
|
|
86
86
|
const data: T[] = query.data?.pages?.flatMap(page => page.data) || []
|
|
87
|
-
const totalCount = query.data?.pages?.[0]?.meta?.totalCount ?? data.length
|
|
88
87
|
|
|
89
|
-
return { ...query, data
|
|
88
|
+
return { ...query, data }
|
|
90
89
|
}
|
|
@@ -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
|
-
})
|