@planningcenter/chat-react-native 4.8.0-qa-staging.5 → 4.8.0-qa-staging.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/conversations/bulk_conversation_actions_bar.d.ts.map +1 -1
- package/build/components/conversations/bulk_conversation_actions_bar.js +137 -45
- package/build/components/conversations/bulk_conversation_actions_bar.js.map +1 -1
- package/build/components/conversations/conversation_actions.js +113 -109
- 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 +129 -115
- package/build/components/conversations/conversation_preview.js.map +1 -1
- package/build/components/display/button.js +0 -1
- package/build/components/display/button.js.map +1 -1
- package/build/components/display/icon.d.ts +3 -1
- package/build/components/display/icon.d.ts.map +1 -1
- package/build/components/display/icon.js +2 -0
- package/build/components/display/icon.js.map +1 -1
- package/build/screens/conversation_actions_screen.d.ts +2 -0
- package/build/screens/conversation_actions_screen.d.ts.map +1 -1
- package/build/screens/conversation_actions_screen.js +359 -67
- package/build/screens/conversation_actions_screen.js.map +1 -1
- package/package.json +3 -3
- package/src/components/conversations/__tests__/conversation_actions.test.tsx +5 -1
- package/src/components/conversations/bulk_conversation_actions_bar.tsx +62 -33
- package/src/components/conversations/conversation_actions.tsx +2 -2
- package/src/components/conversations/conversation_preview.tsx +8 -1
- package/src/components/display/button.tsx +0 -1
- package/src/components/display/icon.tsx +3 -0
- package/src/screens/__tests__/conversation_actions_screen.test.tsx +36 -5
- package/src/screens/conversation_actions_screen.tsx +135 -22
|
@@ -1,14 +1,18 @@
|
|
|
1
1
|
import React, { useEffect, useState } from 'react'
|
|
2
|
-
import { StyleSheet } from 'react-native'
|
|
2
|
+
import { Pressable, StyleSheet } from 'react-native'
|
|
3
3
|
import Animated, { FadeIn, LayoutAnimationConfig, ReduceMotion } from 'react-native-reanimated'
|
|
4
4
|
import { useSafeAreaInsets } from 'react-native-safe-area-context'
|
|
5
5
|
import { useConversationsContext } from '../../contexts/conversations_context'
|
|
6
6
|
import { useReduceMotion, useTheme } from '../../hooks'
|
|
7
7
|
import { useBulkConversationActions } from '../../hooks/use_bulk_conversation_actions'
|
|
8
8
|
import { ConversationResource } from '../../types'
|
|
9
|
-
import {
|
|
9
|
+
import {
|
|
10
|
+
MAX_FONT_SIZE_MULTIPLIER_LANDMARK,
|
|
11
|
+
isArchivedConversation,
|
|
12
|
+
platformPressedOpacityStyle,
|
|
13
|
+
} from '../../utils'
|
|
10
14
|
import { dismissToast } from '../../utils/toast_store'
|
|
11
|
-
import {
|
|
15
|
+
import { Icon, IconString, Text } from '../display'
|
|
12
16
|
|
|
13
17
|
export function BulkConversationActionsBar() {
|
|
14
18
|
const styles = useStyles()
|
|
@@ -51,35 +55,23 @@ export function BulkConversationActionsBar() {
|
|
|
51
55
|
style={styles.container}
|
|
52
56
|
testID="bulk-conversation-actions-bar"
|
|
53
57
|
>
|
|
54
|
-
<
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
disabled={!canHide}
|
|
60
|
-
onPress={run(hiddenView ? unhide : hide)}
|
|
61
|
-
style={styles.button}
|
|
62
|
-
maxFontSizeMultiplier={MAX_FONT_SIZE_MULTIPLIER_LANDMARK}
|
|
58
|
+
<BulkAction
|
|
59
|
+
title="Mark read"
|
|
60
|
+
iconName="general.check"
|
|
61
|
+
disabled={disabled}
|
|
62
|
+
onPress={run(markRead)}
|
|
63
63
|
/>
|
|
64
|
-
<
|
|
65
|
-
variant="outline"
|
|
66
|
-
size="lg"
|
|
64
|
+
<BulkAction
|
|
67
65
|
title="Silence"
|
|
68
|
-
|
|
66
|
+
iconName="general.bellMuted"
|
|
69
67
|
disabled={!canSilence}
|
|
70
68
|
onPress={run(silence)}
|
|
71
|
-
style={styles.button}
|
|
72
|
-
maxFontSizeMultiplier={MAX_FONT_SIZE_MULTIPLIER_LANDMARK}
|
|
73
69
|
/>
|
|
74
|
-
<
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
disabled={disabled}
|
|
80
|
-
onPress={run(markRead)}
|
|
81
|
-
style={styles.button}
|
|
82
|
-
maxFontSizeMultiplier={MAX_FONT_SIZE_MULTIPLIER_LANDMARK}
|
|
70
|
+
<BulkAction
|
|
71
|
+
title={hiddenView ? 'Unhide' : 'Hide'}
|
|
72
|
+
iconName={hiddenView ? 'general.showEye' : 'general.hideEye'}
|
|
73
|
+
disabled={!canHide}
|
|
74
|
+
onPress={run(hiddenView ? unhide : hide)}
|
|
83
75
|
/>
|
|
84
76
|
</Animated.View>
|
|
85
77
|
)}
|
|
@@ -87,16 +79,44 @@ export function BulkConversationActionsBar() {
|
|
|
87
79
|
)
|
|
88
80
|
}
|
|
89
81
|
|
|
90
|
-
|
|
82
|
+
function BulkAction({
|
|
83
|
+
title,
|
|
84
|
+
iconName,
|
|
85
|
+
disabled,
|
|
86
|
+
onPress,
|
|
87
|
+
}: {
|
|
88
|
+
title: string
|
|
89
|
+
iconName: IconString
|
|
90
|
+
disabled: boolean
|
|
91
|
+
onPress: () => void
|
|
92
|
+
}) {
|
|
93
|
+
const styles = useStyles({ disabled })
|
|
94
|
+
|
|
95
|
+
return (
|
|
96
|
+
<Pressable
|
|
97
|
+
onPress={onPress}
|
|
98
|
+
disabled={disabled}
|
|
99
|
+
accessibilityRole="button"
|
|
100
|
+
accessibilityState={{ disabled }}
|
|
101
|
+
style={({ pressed }) => [styles.action, pressed && platformPressedOpacityStyle]}
|
|
102
|
+
>
|
|
103
|
+
<Icon name={iconName} size={20} style={styles.actionIcon} accessibilityElementsHidden />
|
|
104
|
+
<Text style={styles.actionTitle} maxFontSizeMultiplier={MAX_FONT_SIZE_MULTIPLIER_LANDMARK}>
|
|
105
|
+
{title}
|
|
106
|
+
</Text>
|
|
107
|
+
</Pressable>
|
|
108
|
+
)
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
const useStyles = ({ disabled = false }: { disabled?: boolean } = {}) => {
|
|
91
112
|
const { bottom } = useSafeAreaInsets()
|
|
92
113
|
const { colors } = useTheme()
|
|
93
|
-
const containerVerticalPadding =
|
|
114
|
+
const containerVerticalPadding = 12
|
|
115
|
+
const actionColor = disabled ? colors.textColorDefaultDisabled : colors.textColorDefaultPrimary
|
|
94
116
|
|
|
95
117
|
return StyleSheet.create({
|
|
96
118
|
container: {
|
|
97
119
|
flexDirection: 'row',
|
|
98
|
-
flexWrap: 'wrap',
|
|
99
|
-
gap: 8,
|
|
100
120
|
backgroundColor: colors.surfaceColor090,
|
|
101
121
|
paddingHorizontal: 16,
|
|
102
122
|
paddingTop: containerVerticalPadding,
|
|
@@ -104,8 +124,17 @@ const useStyles = () => {
|
|
|
104
124
|
borderTopWidth: 1,
|
|
105
125
|
borderTopColor: colors.borderColorDefaultDim,
|
|
106
126
|
},
|
|
107
|
-
|
|
108
|
-
|
|
127
|
+
action: {
|
|
128
|
+
flex: 1,
|
|
129
|
+
alignItems: 'center',
|
|
130
|
+
gap: 4,
|
|
131
|
+
},
|
|
132
|
+
actionIcon: {
|
|
133
|
+
color: actionColor,
|
|
134
|
+
},
|
|
135
|
+
actionTitle: {
|
|
136
|
+
color: actionColor,
|
|
137
|
+
fontWeight: '600',
|
|
109
138
|
},
|
|
110
139
|
})
|
|
111
140
|
}
|
|
@@ -101,8 +101,8 @@ export function ConversationActions({
|
|
|
101
101
|
if (disabled) return
|
|
102
102
|
|
|
103
103
|
Haptic.impactLight()
|
|
104
|
-
navigation.navigate('ConversationActions', { conversation_id: conversation.id })
|
|
105
|
-
}, [disabled, navigation, conversation.id])
|
|
104
|
+
navigation.navigate('ConversationActions', { conversation_id: conversation.id, read, muted })
|
|
105
|
+
}, [disabled, navigation, conversation.id, read, muted])
|
|
106
106
|
|
|
107
107
|
const handleLatestMessageUnread = useCallback(() => {
|
|
108
108
|
markRead(!read)
|
|
@@ -7,6 +7,7 @@ import {
|
|
|
7
7
|
useFontScale,
|
|
8
8
|
useScalableNumberOfLines,
|
|
9
9
|
} from '../../hooks'
|
|
10
|
+
import { useSelectedChipBackgroundColor } from '../../hooks/use_selected_chip_background_color'
|
|
10
11
|
import { ConversationPreviewData, ConversationResource } from '../../types'
|
|
11
12
|
import { REACTION_EMOJIS, isArchivedConversation, platformFontWeightBold } from '../../utils'
|
|
12
13
|
import { formatDatePreview } from '../../utils/date'
|
|
@@ -67,6 +68,7 @@ export const ConversationPreview = ({
|
|
|
67
68
|
const hasMetaContent = lastMessageCreatedAt || unreadCount > 0 || muted || hidden
|
|
68
69
|
const isUnread = unreadCount > 0 || unreadReaction
|
|
69
70
|
const selected = selectMode ? selectedIds.includes(id) : undefined
|
|
71
|
+
const selectedBackgroundColor = useSelectedChipBackgroundColor()
|
|
70
72
|
|
|
71
73
|
const numberOfLinesScaledTitle = useScalableNumberOfLines(1)
|
|
72
74
|
const numberOfLinesScaledPreviewText = useScalableNumberOfLines(2)
|
|
@@ -85,7 +87,12 @@ export const ConversationPreview = ({
|
|
|
85
87
|
return (
|
|
86
88
|
<ConversationActions
|
|
87
89
|
conversation={conversation}
|
|
88
|
-
style={[
|
|
90
|
+
style={[
|
|
91
|
+
styles.previewRow,
|
|
92
|
+
disabled && !archived && styles.disabled,
|
|
93
|
+
selected && { backgroundColor: selectedBackgroundColor },
|
|
94
|
+
style,
|
|
95
|
+
]}
|
|
89
96
|
onPress={selectMode ? () => toggleSelected(id) : onPress}
|
|
90
97
|
accessibilityLabel={conversationAccessibilityLabel}
|
|
91
98
|
selected={selected}
|
|
@@ -257,7 +257,6 @@ const useStyles = ({
|
|
|
257
257
|
flexDirection: 'row',
|
|
258
258
|
justifyContent: 'center',
|
|
259
259
|
alignItems: 'center',
|
|
260
|
-
flexGrow: 1,
|
|
261
260
|
margin: outlineMarginOffset,
|
|
262
261
|
gap: sizeStyleMap[size].gap,
|
|
263
262
|
borderRadius: sizeStyleMap[size].borderRadius - outlineMarginOffset,
|
|
@@ -3,6 +3,7 @@ import * as api from '@planningcenter/icons/paths/api'
|
|
|
3
3
|
import * as brand from '@planningcenter/icons/paths/brand'
|
|
4
4
|
import * as calendar from '@planningcenter/icons/paths/calendar'
|
|
5
5
|
import * as chat from '@planningcenter/icons/paths/chat'
|
|
6
|
+
import * as checkIns from '@planningcenter/icons/paths/check-ins'
|
|
6
7
|
import * as churchCenter from '@planningcenter/icons/paths/church-center'
|
|
7
8
|
import * as general from '@planningcenter/icons/paths/general'
|
|
8
9
|
import * as groups from '@planningcenter/icons/paths/groups'
|
|
@@ -30,6 +31,7 @@ const ICONS = {
|
|
|
30
31
|
brand,
|
|
31
32
|
calendar,
|
|
32
33
|
chat,
|
|
34
|
+
checkIns,
|
|
33
35
|
churchCenter,
|
|
34
36
|
general,
|
|
35
37
|
groups,
|
|
@@ -55,6 +57,7 @@ export type IconString =
|
|
|
55
57
|
| `brand.${IconName<'brand'>}`
|
|
56
58
|
| `calendar.${IconName<'calendar'>}`
|
|
57
59
|
| `chat.${IconName<'chat'>}`
|
|
60
|
+
| `checkIns.${IconName<'checkIns'>}`
|
|
58
61
|
| `churchCenter.${IconName<'churchCenter'>}`
|
|
59
62
|
| `general.${IconName<'general'>}`
|
|
60
63
|
| `groups.${IconName<'groups'>}`
|
|
@@ -5,7 +5,7 @@ import { SafeAreaProvider } from 'react-native-safe-area-context'
|
|
|
5
5
|
import type { ConversationResource } from '../../types'
|
|
6
6
|
import { ConversationActionsScreen } from '../conversation_actions_screen'
|
|
7
7
|
|
|
8
|
-
const mockNavigation = { goBack: jest.fn(), dispatch: jest.fn() }
|
|
8
|
+
const mockNavigation = { goBack: jest.fn(), dispatch: jest.fn(), navigate: jest.fn() }
|
|
9
9
|
jest.mock('@react-navigation/native', () => ({
|
|
10
10
|
...jest.requireActual('@react-navigation/native'),
|
|
11
11
|
useNavigation: () => mockNavigation,
|
|
@@ -15,9 +15,20 @@ jest.mock('@react-navigation/elements', () => ({
|
|
|
15
15
|
useHeaderHeight: () => 0,
|
|
16
16
|
}))
|
|
17
17
|
|
|
18
|
-
|
|
18
|
+
let mockConversation = { type: 'Conversation', id: 7, title: 'Youth Group' } as ConversationResource
|
|
19
|
+
const mockSetMuted = jest.fn()
|
|
19
20
|
jest.mock('../../hooks/use_conversation', () => ({
|
|
20
|
-
useConversation: () => ({ data:
|
|
21
|
+
useConversation: () => ({ data: mockConversation }),
|
|
22
|
+
useConversationMute: () => ({ muted: false, setMuted: mockSetMuted, isPending: false }),
|
|
23
|
+
}))
|
|
24
|
+
|
|
25
|
+
const mockMarkRead = jest.fn()
|
|
26
|
+
jest.mock('../../hooks/use_conversations_actions', () => ({
|
|
27
|
+
useConversationsMarkRead: () => ({ read: true, markRead: mockMarkRead, isPending: false }),
|
|
28
|
+
}))
|
|
29
|
+
jest.mock('../../components/display', () => ({
|
|
30
|
+
...jest.requireActual('../../components/display'),
|
|
31
|
+
ConversationAvatar: () => null,
|
|
21
32
|
}))
|
|
22
33
|
|
|
23
34
|
let mockHidden = false
|
|
@@ -36,11 +47,11 @@ const safeAreaMetrics = {
|
|
|
36
47
|
insets: { top: 0, right: 0, bottom: 0, left: 0 },
|
|
37
48
|
}
|
|
38
49
|
|
|
39
|
-
const renderScreen = () =>
|
|
50
|
+
const renderScreen = (params: { read?: boolean; muted?: boolean } = {}) =>
|
|
40
51
|
render(
|
|
41
52
|
<SafeAreaProvider initialMetrics={safeAreaMetrics}>
|
|
42
53
|
<ThemeProvider value={DefaultTheme}>
|
|
43
|
-
<ConversationActionsScreen route={{ params: { conversation_id: 7 } }} />
|
|
54
|
+
<ConversationActionsScreen route={{ params: { conversation_id: 7, ...params } }} />
|
|
44
55
|
</ThemeProvider>
|
|
45
56
|
</SafeAreaProvider>
|
|
46
57
|
)
|
|
@@ -49,6 +60,7 @@ describe('ConversationActionsScreen', () => {
|
|
|
49
60
|
beforeEach(() => {
|
|
50
61
|
mockHidden = false
|
|
51
62
|
mockHideEnabled = true
|
|
63
|
+
mockConversation = { type: 'Conversation', id: 7, title: 'Youth Group' } as ConversationResource
|
|
52
64
|
jest.clearAllMocks()
|
|
53
65
|
})
|
|
54
66
|
|
|
@@ -87,4 +99,23 @@ describe('ConversationActionsScreen', () => {
|
|
|
87
99
|
|
|
88
100
|
expect(mockSetHidden).toHaveBeenCalledWith(false)
|
|
89
101
|
})
|
|
102
|
+
|
|
103
|
+
it('toggles read and silenced from the state the list row passed in', () => {
|
|
104
|
+
const { getByText } = renderScreen({ read: false, muted: true })
|
|
105
|
+
|
|
106
|
+
fireEvent.press(getByText('Mark as read'))
|
|
107
|
+
fireEvent.press(getByText('Enable'))
|
|
108
|
+
|
|
109
|
+
expect(mockMarkRead).toHaveBeenCalledWith(true)
|
|
110
|
+
expect(mockSetMuted).toHaveBeenCalledWith(false)
|
|
111
|
+
})
|
|
112
|
+
|
|
113
|
+
it('offers neither silence nor hide on an archived conversation', () => {
|
|
114
|
+
mockConversation = { ...mockConversation, disabled: true, disabledReason: 'archived' }
|
|
115
|
+
const { queryByText, getByText } = renderScreen()
|
|
116
|
+
|
|
117
|
+
expect(queryByText('Silence')).toBeNull()
|
|
118
|
+
expect(queryByText('Hide conversation')).toBeNull()
|
|
119
|
+
expect(getByText('Select conversations')).toBeTruthy()
|
|
120
|
+
})
|
|
90
121
|
})
|
|
@@ -1,27 +1,70 @@
|
|
|
1
1
|
import { StackActions, StaticScreenProps, useNavigation } from '@react-navigation/native'
|
|
2
2
|
import React from 'react'
|
|
3
|
-
import { StyleSheet } from 'react-native'
|
|
3
|
+
import { StyleSheet, View } from 'react-native'
|
|
4
|
+
import { ConversationAvatar, Heading, Text } from '../components/display'
|
|
4
5
|
import FormSheet, { getFormSheetScreenOptions } from '../components/primitive/form_sheet'
|
|
5
|
-
import {
|
|
6
|
+
import { useTheme } from '../hooks'
|
|
7
|
+
import { useConversation, useConversationMute } from '../hooks/use_conversation'
|
|
8
|
+
import { useConversationsMarkRead } from '../hooks/use_conversations_actions'
|
|
6
9
|
import { useHideConversation } from '../hooks/use_hide_conversation'
|
|
7
10
|
import { useHideConversationsEnabled } from '../hooks/use_hide_conversations_enabled'
|
|
8
|
-
import { isArchivedConversation } from '../utils'
|
|
11
|
+
import { isArchivedConversation, MAX_FONT_SIZE_MULTIPLIER_LANDMARK } from '../utils'
|
|
9
12
|
|
|
10
13
|
export const ConversationActionsScreenOptions = getFormSheetScreenOptions({
|
|
11
14
|
headerTitle: 'Conversation actions',
|
|
15
|
+
sheetAllowedDetents: 'fitToContents',
|
|
12
16
|
})
|
|
13
17
|
|
|
14
18
|
export type ConversationActionsScreenProps = StaticScreenProps<{
|
|
15
19
|
conversation_id: number
|
|
20
|
+
read?: boolean
|
|
21
|
+
muted?: boolean
|
|
16
22
|
}>
|
|
17
23
|
|
|
18
24
|
export function ConversationActionsScreen({ route }: ConversationActionsScreenProps) {
|
|
19
25
|
const navigation = useNavigation()
|
|
20
26
|
const styles = useStyles()
|
|
21
|
-
const {
|
|
22
|
-
const {
|
|
27
|
+
const { conversation_id } = route.params
|
|
28
|
+
const { data: conversation } = useConversation({ conversation_id })
|
|
29
|
+
const { hidden, setHidden, isPending: isHiddenPending } = useHideConversation({ conversation })
|
|
30
|
+
const markReadState = useConversationsMarkRead({ conversation })
|
|
31
|
+
const muteState = useConversationMute({ conversation_id })
|
|
23
32
|
const hideConversationsEnabled = useHideConversationsEnabled()
|
|
24
|
-
|
|
33
|
+
|
|
34
|
+
const read = route.params.read ?? markReadState.read
|
|
35
|
+
const muted = route.params.muted ?? muteState.muted
|
|
36
|
+
const archived = isArchivedConversation(conversation)
|
|
37
|
+
const emptyConversation = conversation.lastMessageCreatedAt === null
|
|
38
|
+
const subtitle = conversation.badges?.[0]?.text
|
|
39
|
+
|
|
40
|
+
const navigateAfterDismiss = (navigate: () => void) => {
|
|
41
|
+
navigation.goBack()
|
|
42
|
+
requestAnimationFrame(navigate)
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
const handleOpenPress = () =>
|
|
46
|
+
navigateAfterDismiss(() =>
|
|
47
|
+
navigation.navigate('Conversation', {
|
|
48
|
+
conversation_id,
|
|
49
|
+
title: conversation.title ?? undefined,
|
|
50
|
+
badge: conversation.badges?.[0],
|
|
51
|
+
deleted: conversation.deleted,
|
|
52
|
+
muted,
|
|
53
|
+
})
|
|
54
|
+
)
|
|
55
|
+
|
|
56
|
+
const handleDetailsPress = () =>
|
|
57
|
+
navigateAfterDismiss(() => navigation.navigate('ConversationDetails', { conversation_id }))
|
|
58
|
+
|
|
59
|
+
const handleMarkReadPress = () => {
|
|
60
|
+
markReadState.markRead(!read)
|
|
61
|
+
navigation.goBack()
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
const handleMutePress = () => {
|
|
65
|
+
muteState.setMuted(!muted)
|
|
66
|
+
navigation.goBack()
|
|
67
|
+
}
|
|
25
68
|
|
|
26
69
|
const handleHidePress = () => {
|
|
27
70
|
setHidden(!hidden)
|
|
@@ -32,20 +75,76 @@ export function ConversationActionsScreen({ route }: ConversationActionsScreenPr
|
|
|
32
75
|
navigation.dispatch(
|
|
33
76
|
StackActions.popTo(
|
|
34
77
|
'Conversations',
|
|
35
|
-
{ select_conversation_id:
|
|
78
|
+
{ select_conversation_id: conversation_id },
|
|
36
79
|
{ merge: true }
|
|
37
80
|
)
|
|
38
81
|
)
|
|
39
82
|
}
|
|
40
83
|
|
|
84
|
+
if (!hideConversationsEnabled) return <FormSheet.Root fitToContents>{null}</FormSheet.Root>
|
|
85
|
+
|
|
41
86
|
return (
|
|
42
|
-
<FormSheet.Root
|
|
43
|
-
|
|
87
|
+
<FormSheet.Root fitToContents>
|
|
88
|
+
<FormSheet.Header>
|
|
89
|
+
<View style={styles.header}>
|
|
90
|
+
<ConversationAvatar conversation={conversation} size="md" showFallback />
|
|
91
|
+
<View style={styles.headerText}>
|
|
92
|
+
<Heading
|
|
93
|
+
variant="h3"
|
|
94
|
+
numberOfLines={1}
|
|
95
|
+
maxFontSizeMultiplier={MAX_FONT_SIZE_MULTIPLIER_LANDMARK}
|
|
96
|
+
>
|
|
97
|
+
{conversation.title}
|
|
98
|
+
</Heading>
|
|
99
|
+
{!!subtitle && (
|
|
100
|
+
<Text
|
|
101
|
+
variant="tertiary"
|
|
102
|
+
numberOfLines={1}
|
|
103
|
+
maxFontSizeMultiplier={MAX_FONT_SIZE_MULTIPLIER_LANDMARK}
|
|
104
|
+
>
|
|
105
|
+
{subtitle}
|
|
106
|
+
</Text>
|
|
107
|
+
)}
|
|
108
|
+
</View>
|
|
109
|
+
</View>
|
|
110
|
+
</FormSheet.Header>
|
|
111
|
+
<FormSheet.Action
|
|
112
|
+
onPress={handleOpenPress}
|
|
113
|
+
title="Open conversation"
|
|
114
|
+
iconName="general.textMessage"
|
|
115
|
+
/>
|
|
116
|
+
<FormSheet.Action
|
|
117
|
+
onPress={handleDetailsPress}
|
|
118
|
+
title="Conversation details"
|
|
119
|
+
iconName="general.cog"
|
|
120
|
+
/>
|
|
121
|
+
{!emptyConversation && (
|
|
122
|
+
<FormSheet.Action
|
|
123
|
+
onPress={handleMarkReadPress}
|
|
124
|
+
title={read ? 'Mark as unread' : 'Mark as read'}
|
|
125
|
+
iconName={read ? 'checkIns.checkPending' : 'checkIns.check'}
|
|
126
|
+
disabled={markReadState.isPending}
|
|
127
|
+
/>
|
|
128
|
+
)}
|
|
129
|
+
{!archived && (
|
|
130
|
+
<FormSheet.Action
|
|
131
|
+
onPress={handleMutePress}
|
|
132
|
+
title={muted ? 'Enable' : 'Silence'}
|
|
133
|
+
iconName={muted ? 'general.bell' : 'general.bellMuted'}
|
|
134
|
+
disabled={muteState.isPending}
|
|
135
|
+
accessibilityHint={
|
|
136
|
+
muted
|
|
137
|
+
? 'Turns notifications for this conversation back on.'
|
|
138
|
+
: 'Turns off notifications for this conversation.'
|
|
139
|
+
}
|
|
140
|
+
/>
|
|
141
|
+
)}
|
|
142
|
+
{!archived && (
|
|
44
143
|
<FormSheet.Action
|
|
45
144
|
onPress={handleHidePress}
|
|
46
145
|
title={hidden ? 'Unhide conversation' : 'Hide conversation'}
|
|
47
146
|
iconName={hidden ? 'general.showEye' : 'general.hideEye'}
|
|
48
|
-
disabled={
|
|
147
|
+
disabled={isHiddenPending}
|
|
49
148
|
accessibilityHint={
|
|
50
149
|
hidden
|
|
51
150
|
? 'Shows this conversation in your conversation list again.'
|
|
@@ -53,21 +152,35 @@ export function ConversationActionsScreen({ route }: ConversationActionsScreenPr
|
|
|
53
152
|
}
|
|
54
153
|
/>
|
|
55
154
|
)}
|
|
56
|
-
{
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
)}
|
|
155
|
+
<View style={styles.divider} />
|
|
156
|
+
<FormSheet.Action
|
|
157
|
+
onPress={handleSelectPress}
|
|
158
|
+
title="Select conversations"
|
|
159
|
+
iconName="general.check"
|
|
160
|
+
accessibilityHint="Selects this conversation and lets you choose more to hide, silence, or mark read."
|
|
161
|
+
/>
|
|
64
162
|
</FormSheet.Root>
|
|
65
163
|
)
|
|
66
164
|
}
|
|
67
165
|
|
|
68
|
-
const useStyles = () =>
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
166
|
+
const useStyles = () => {
|
|
167
|
+
const { colors } = useTheme()
|
|
168
|
+
|
|
169
|
+
return StyleSheet.create({
|
|
170
|
+
header: {
|
|
171
|
+
flex: 1,
|
|
172
|
+
flexDirection: 'row',
|
|
173
|
+
alignItems: 'center',
|
|
174
|
+
gap: 12,
|
|
175
|
+
},
|
|
176
|
+
headerText: {
|
|
177
|
+
flex: 1,
|
|
178
|
+
},
|
|
179
|
+
divider: {
|
|
180
|
+
height: 1,
|
|
181
|
+
marginHorizontal: 16,
|
|
182
|
+
marginVertical: 4,
|
|
183
|
+
backgroundColor: colors.borderColorDefaultBase,
|
|
72
184
|
},
|
|
73
185
|
})
|
|
186
|
+
}
|