@planningcenter/chat-react-native 4.8.0-rc.1 → 4.8.0-rc.11
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/app_update_banner.d.ts +2 -0
- package/build/components/conversations/app_update_banner.d.ts.map +1 -0
- package/build/components/conversations/app_update_banner.js +52 -0
- package/build/components/conversations/app_update_banner.js.map +1 -0
- package/build/components/conversations/bulk_conversation_actions_bar.d.ts +2 -0
- package/build/components/conversations/bulk_conversation_actions_bar.d.ts.map +1 -0
- package/build/components/conversations/bulk_conversation_actions_bar.js +215 -0
- package/build/components/conversations/bulk_conversation_actions_bar.js.map +1 -0
- package/build/components/conversations/conversation_actions.d.ts +2 -1
- package/build/components/conversations/conversation_actions.d.ts.map +1 -1
- package/build/components/conversations/conversation_actions.js +173 -130
- 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 +168 -110
- 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 +50 -48
- package/build/components/conversations/conversations.js.map +1 -1
- package/build/components/display/checkbox.d.ts +8 -0
- package/build/components/display/checkbox.d.ts.map +1 -0
- package/build/components/display/checkbox.js +87 -0
- package/build/components/display/checkbox.js.map +1 -0
- 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/components/display/index.d.ts +1 -0
- package/build/components/display/index.d.ts.map +1 -1
- package/build/components/display/index.js +1 -0
- package/build/components/display/index.js.map +1 -1
- package/build/components/primitive/banner_primitive.js +7 -3
- package/build/components/primitive/banner_primitive.js.map +1 -1
- package/build/contexts/api_provider.d.ts.map +1 -1
- package/build/contexts/api_provider.js +2 -0
- package/build/contexts/api_provider.js.map +1 -1
- package/build/contexts/chat_context.d.ts +0 -2
- package/build/contexts/chat_context.d.ts.map +1 -1
- package/build/contexts/chat_context.js +16 -93
- package/build/contexts/chat_context.js.map +1 -1
- package/build/contexts/conversations_context.d.ts +5 -0
- package/build/contexts/conversations_context.d.ts.map +1 -1
- package/build/contexts/conversations_context.js +121 -32
- package/build/contexts/conversations_context.js.map +1 -1
- package/build/contexts/session_context.d.ts +0 -1
- package/build/contexts/session_context.d.ts.map +1 -1
- package/build/contexts/session_context.js +3 -0
- package/build/contexts/session_context.js.map +1 -1
- package/build/hooks/groups/use_group_chat_conversation_payload.d.ts +11 -1
- package/build/hooks/groups/use_group_chat_conversation_payload.d.ts.map +1 -1
- package/build/hooks/groups/use_group_chat_conversation_payload.js +92 -47
- package/build/hooks/groups/use_group_chat_conversation_payload.js.map +1 -1
- package/build/hooks/groups/use_group_members_for_new_conversation.d.ts +27 -25
- package/build/hooks/groups/use_group_members_for_new_conversation.d.ts.map +1 -1
- package/build/hooks/groups/use_group_members_for_new_conversation.js +125 -110
- package/build/hooks/groups/use_group_members_for_new_conversation.js.map +1 -1
- package/build/hooks/groups/use_groups_conversation_create.d.ts.map +1 -1
- package/build/hooks/groups/use_groups_conversation_create.js +39 -31
- package/build/hooks/groups/use_groups_conversation_create.js.map +1 -1
- package/build/hooks/groups/use_groups_proxy.d.ts +2 -0
- package/build/hooks/groups/use_groups_proxy.d.ts.map +1 -0
- package/build/hooks/groups/use_groups_proxy.js +18 -0
- package/build/hooks/groups/use_groups_proxy.js.map +1 -0
- package/build/hooks/use_bulk_conversation_actions.d.ts +8 -0
- package/build/hooks/use_bulk_conversation_actions.d.ts.map +1 -0
- package/build/hooks/use_bulk_conversation_actions.js +309 -0
- package/build/hooks/use_bulk_conversation_actions.js.map +1 -0
- package/build/hooks/use_conversation_jolt_events.d.ts.map +1 -1
- package/build/hooks/use_conversation_jolt_events.js +3 -2
- package/build/hooks/use_conversation_jolt_events.js.map +1 -1
- package/build/hooks/use_conversations_actions.d.ts +9 -9
- package/build/hooks/use_conversations_actions.d.ts.map +1 -1
- package/build/hooks/use_conversations_actions.js +12 -7
- package/build/hooks/use_conversations_actions.js.map +1 -1
- package/build/hooks/use_conversations_cache.d.ts +15 -5
- package/build/hooks/use_conversations_cache.d.ts.map +1 -1
- package/build/hooks/use_conversations_cache.js +170 -122
- package/build/hooks/use_conversations_cache.js.map +1 -1
- package/build/hooks/use_conversations_jolt_events.d.ts.map +1 -1
- package/build/hooks/use_conversations_jolt_events.js +47 -20
- package/build/hooks/use_conversations_jolt_events.js.map +1 -1
- package/build/hooks/use_features.d.ts +1 -0
- package/build/hooks/use_features.d.ts.map +1 -1
- package/build/hooks/use_features.js +1 -0
- package/build/hooks/use_features.js.map +1 -1
- package/build/hooks/use_groups_groups.d.ts.map +1 -1
- package/build/hooks/use_groups_groups.js +25 -9
- package/build/hooks/use_groups_groups.js.map +1 -1
- package/build/hooks/use_mark_latest_message_read.d.ts.map +1 -1
- package/build/hooks/use_mark_latest_message_read.js +5 -4
- package/build/hooks/use_mark_latest_message_read.js.map +1 -1
- package/build/hooks/use_new_conversation_from_filter.d.ts.map +1 -1
- package/build/hooks/use_new_conversation_from_filter.js +11 -1
- package/build/hooks/use_new_conversation_from_filter.js.map +1 -1
- package/build/hooks/use_product_analytics.d.ts.map +1 -1
- package/build/hooks/use_product_analytics.js +93 -75
- package/build/hooks/use_product_analytics.js.map +1 -1
- package/build/navigation/index.d.ts.map +1 -1
- package/build/navigation/index.js +5 -7
- package/build/navigation/index.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 +380 -46
- package/build/screens/conversation_actions_screen.js.map +1 -1
- package/build/screens/conversation_filter_recipients/components/checkbox_row.d.ts.map +1 -1
- package/build/screens/conversation_filter_recipients/components/checkbox_row.js +9 -64
- package/build/screens/conversation_filter_recipients/components/checkbox_row.js.map +1 -1
- package/build/screens/conversation_new/components/groups_form.d.ts.map +1 -1
- package/build/screens/conversation_new/components/groups_form.js +96 -93
- package/build/screens/conversation_new/components/groups_form.js.map +1 -1
- package/build/screens/conversations/conversations_screen.d.ts +5 -0
- package/build/screens/conversations/conversations_screen.d.ts.map +1 -1
- package/build/screens/conversations/conversations_screen.js +176 -33
- package/build/screens/conversations/conversations_screen.js.map +1 -1
- package/build/types/jolt_events/index.d.ts +2 -0
- package/build/types/jolt_events/index.d.ts.map +1 -1
- package/build/types/jolt_events/index.js.map +1 -1
- package/build/types/jolt_events/person_events.d.ts +9 -0
- package/build/types/jolt_events/person_events.d.ts.map +1 -0
- package/build/types/jolt_events/person_events.js +2 -0
- package/build/types/jolt_events/person_events.js.map +1 -0
- package/build/types/resources/groups/groups_group_resource.d.ts +1 -1
- package/build/types/resources/groups/groups_group_resource.d.ts.map +1 -1
- package/build/types/resources/groups/groups_group_resource.js.map +1 -1
- package/build/types/resources/groups/groups_membership_resource.d.ts +11 -0
- package/build/types/resources/groups/groups_membership_resource.d.ts.map +1 -0
- package/build/types/resources/groups/groups_membership_resource.js +2 -0
- package/build/types/resources/groups/groups_membership_resource.js.map +1 -0
- package/build/types/resources/groups/index.d.ts +1 -0
- package/build/types/resources/groups/index.d.ts.map +1 -1
- package/build/types/resources/groups/index.js +1 -0
- package/build/types/resources/groups/index.js.map +1 -1
- package/build/utils/jolt/parse_stream_user_event_type.d.ts +3 -0
- package/build/utils/jolt/parse_stream_user_event_type.d.ts.map +1 -0
- package/build/utils/jolt/parse_stream_user_event_type.js +9 -0
- package/build/utils/jolt/parse_stream_user_event_type.js.map +1 -0
- package/build/utils/native_adapters/configuration.d.ts +3 -0
- package/build/utils/native_adapters/configuration.d.ts.map +1 -1
- package/build/utils/native_adapters/configuration.js +3 -0
- package/build/utils/native_adapters/configuration.js.map +1 -1
- package/build/utils/native_adapters/index.d.ts +1 -0
- package/build/utils/native_adapters/index.d.ts.map +1 -1
- package/build/utils/native_adapters/index.js +1 -0
- package/build/utils/native_adapters/index.js.map +1 -1
- package/build/utils/native_adapters/updates.d.ts +11 -0
- package/build/utils/native_adapters/updates.d.ts.map +1 -0
- package/build/utils/native_adapters/updates.js +8 -0
- package/build/utils/native_adapters/updates.js.map +1 -0
- package/build/utils/product_analytics_token.d.ts +12 -0
- package/build/utils/product_analytics_token.d.ts.map +1 -0
- package/build/utils/product_analytics_token.js +84 -0
- package/build/utils/product_analytics_token.js.map +1 -0
- package/build/utils/theme.js +20 -21
- package/build/utils/theme.js.map +1 -1
- package/build/utils/throttled_refresh.d.ts +7 -0
- package/build/utils/throttled_refresh.d.ts.map +1 -0
- package/build/utils/throttled_refresh.js +42 -0
- package/build/utils/throttled_refresh.js.map +1 -0
- package/package.json +2 -2
- package/src/__tests__/contexts/session_context.tsx +19 -39
- package/src/__tests__/hooks/useTheme.tsx +0 -7
- package/src/__tests__/hooks/use_async_storage.test.tsx +1 -87
- package/src/__tests__/hooks/use_attachment_uploader.test.tsx +0 -11
- package/src/__tests__/hooks/use_font_scale.test.ts +0 -25
- package/src/__tests__/hooks/use_group_chat_conversation_payload.test.tsx +31 -0
- package/src/__tests__/utils/cache/page_mutations.ts +3 -68
- package/src/__tests__/utils/client.ts +6 -15
- package/src/__tests__/utils/native_adapters/configuration.ts +15 -50
- package/src/__tests__/utils/parse_simple_markdown.ts +0 -6
- package/src/__tests__/utils/session.ts +0 -11
- package/src/__tests__/utils/theme.ts +0 -17
- package/src/components/conversations/__tests__/app_update_banner.test.tsx +27 -0
- package/src/components/conversations/__tests__/bulk_conversation_actions_bar.test.tsx +95 -0
- package/src/components/conversations/__tests__/conversation_actions.test.tsx +35 -3
- package/src/components/conversations/__tests__/conversation_preview.test.tsx +69 -3
- package/src/components/conversations/__tests__/conversations.test.tsx +4 -1
- package/src/components/conversations/app_update_banner.tsx +36 -0
- package/src/components/conversations/bulk_conversation_actions_bar.tsx +140 -0
- package/src/components/conversations/conversation_actions.tsx +17 -9
- package/src/components/conversations/conversation_preview.tsx +20 -2
- package/src/components/conversations/conversations.tsx +2 -1
- package/src/components/display/__tests__/filter_dropdown.test.tsx +1 -19
- package/src/components/display/__tests__/icon_tile.test.tsx +24 -7
- package/src/components/display/checkbox.tsx +47 -0
- package/src/components/display/icon.tsx +3 -0
- package/src/components/display/index.ts +1 -0
- package/src/components/page/__tests__/component_error_boundary.test.tsx +0 -12
- package/src/components/primitive/banner_primitive.tsx +5 -1
- package/src/contexts/__tests__/conversations_context.test.tsx +86 -0
- package/src/contexts/api_provider.tsx +2 -0
- package/src/contexts/chat_context.tsx +2 -58
- package/src/contexts/conversations_context.tsx +69 -2
- package/src/contexts/session_context.tsx +3 -1
- package/src/hooks/__tests__/jolt_refresh_throttling.test.tsx +194 -0
- package/src/hooks/__tests__/use_bulk_conversation_actions.test.tsx +119 -0
- package/src/hooks/__tests__/use_conversations_jolt_events.test.tsx +1 -0
- package/src/hooks/__tests__/use_conversations_mark_read.test.tsx +38 -12
- package/src/hooks/__tests__/use_hide_conversation.test.tsx +15 -3
- package/src/hooks/__tests__/use_mark_latest_message_read.test.tsx +23 -2
- package/src/hooks/__tests__/use_product_analytics.test.tsx +304 -0
- package/src/hooks/groups/use_group_chat_conversation_payload.ts +30 -12
- package/src/hooks/groups/use_group_members_for_new_conversation.ts +49 -18
- package/src/hooks/groups/use_groups_conversation_create.ts +10 -14
- package/src/hooks/groups/use_groups_proxy.ts +6 -0
- package/src/hooks/use_bulk_conversation_actions.ts +173 -0
- package/src/hooks/use_conversation_jolt_events.ts +2 -1
- package/src/hooks/use_conversations_actions.ts +7 -4
- package/src/hooks/use_conversations_cache.ts +33 -26
- package/src/hooks/use_conversations_jolt_events.ts +24 -10
- package/src/hooks/use_features.ts +1 -0
- package/src/hooks/use_groups_groups.ts +21 -16
- package/src/hooks/use_mark_latest_message_read.ts +6 -5
- package/src/hooks/use_new_conversation_from_filter.ts +13 -5
- package/src/hooks/use_product_analytics.ts +74 -41
- package/src/navigation/index.tsx +8 -8
- package/src/screens/__tests__/conversation_actions_screen.test.tsx +48 -6
- package/src/screens/__tests__/conversation_details_screen.test.tsx +0 -19
- package/src/screens/avatar_picker/__tests__/avatar_picker_state.test.ts +0 -14
- package/src/screens/conversation_actions_screen.tsx +145 -12
- package/src/screens/conversation_filter_recipients/components/checkbox_row.tsx +3 -35
- package/src/screens/conversation_new/components/groups_form.tsx +11 -9
- package/src/screens/conversations/__tests__/conversations_screen.test.tsx +37 -12
- package/src/screens/conversations/components/__tests__/filter_dropdown_list_header_component.test.tsx +0 -8
- package/src/screens/conversations/components/__tests__/search_list_header_component.test.tsx +0 -10
- package/src/screens/conversations/conversations_screen.tsx +76 -4
- package/src/screens/search/components/__tests__/search_results_list.test.tsx +1 -0
- package/src/types/jolt_events/index.ts +2 -0
- package/src/types/jolt_events/person_events.ts +16 -0
- package/src/types/resources/groups/groups_group_resource.ts +1 -1
- package/src/types/resources/groups/groups_membership_resource.ts +10 -0
- package/src/types/resources/groups/index.ts +1 -0
- package/src/utils/__tests__/attachment_kind.test.ts +0 -4
- package/src/utils/__tests__/convert_attachments_for_create.test.ts +0 -28
- package/src/utils/__tests__/is_input_editable.test.ts +1 -2
- package/src/utils/__tests__/message_text.test.ts +0 -5
- package/src/utils/__tests__/session_manager.test.ts +0 -83
- package/src/utils/__tests__/sha_256.test.ts +0 -34
- package/src/utils/__tests__/throttled_refresh.test.ts +101 -0
- package/src/utils/__tests__/uri.test.ts +51 -0
- package/src/utils/jolt/__tests__/parse_stream_user_event_type.test.ts +27 -0
- package/src/utils/jolt/parse_stream_user_event_type.ts +16 -0
- package/src/utils/native_adapters/configuration.ts +5 -0
- package/src/utils/native_adapters/index.ts +1 -0
- package/src/utils/native_adapters/updates.ts +16 -0
- package/src/utils/product_analytics_token.ts +120 -0
- package/src/utils/theme.ts +20 -21
- package/src/utils/throttled_refresh.ts +62 -0
- package/src/__tests__/event-polyfill.test.ts +0 -313
- package/src/__tests__/index.tsx +0 -5
- package/src/__tests__/jest.ts +0 -11
- package/src/__tests__/utils/uri.ts +0 -65
- package/src/components/display/__tests__/version_footer.test.tsx +0 -48
- package/src/screens/search/components/__tests__/search_blank_states.test.tsx +0 -20
- package/src/utils/__tests__/membership_sync_info_text.test.ts +0 -15
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
import React, { useEffect, useState } from 'react'
|
|
2
|
+
import { Pressable, StyleSheet } from 'react-native'
|
|
3
|
+
import Animated, { FadeIn, LayoutAnimationConfig, ReduceMotion } from 'react-native-reanimated'
|
|
4
|
+
import { useSafeAreaInsets } from 'react-native-safe-area-context'
|
|
5
|
+
import { useConversationsContext } from '../../contexts/conversations_context'
|
|
6
|
+
import { useReduceMotion, useTheme } from '../../hooks'
|
|
7
|
+
import { useBulkConversationActions } from '../../hooks/use_bulk_conversation_actions'
|
|
8
|
+
import { ConversationResource } from '../../types'
|
|
9
|
+
import {
|
|
10
|
+
MAX_FONT_SIZE_MULTIPLIER_LANDMARK,
|
|
11
|
+
isArchivedConversation,
|
|
12
|
+
platformPressedOpacityStyle,
|
|
13
|
+
} from '../../utils'
|
|
14
|
+
import { dismissToast } from '../../utils/toast_store'
|
|
15
|
+
import { Icon, IconString, Text } from '../display'
|
|
16
|
+
|
|
17
|
+
export function BulkConversationActionsBar() {
|
|
18
|
+
const styles = useStyles()
|
|
19
|
+
const reduceMotion = useReduceMotion() ? ReduceMotion.Always : ReduceMotion.Never
|
|
20
|
+
const {
|
|
21
|
+
selectMode,
|
|
22
|
+
selectedIds,
|
|
23
|
+
conversations,
|
|
24
|
+
hideable,
|
|
25
|
+
clearSelection,
|
|
26
|
+
args: { show_hidden: hiddenView = false },
|
|
27
|
+
} = useConversationsContext()
|
|
28
|
+
const { hide, unhide, silence, markRead } = useBulkConversationActions()
|
|
29
|
+
const [pending, setPending] = useState(false)
|
|
30
|
+
|
|
31
|
+
const selected = conversations.filter(({ id }) => selectedIds.includes(id))
|
|
32
|
+
const disabled = pending || selected.length === 0
|
|
33
|
+
const canSilence = !disabled && !selected.some(isArchivedConversation)
|
|
34
|
+
const canHide = canSilence && hideable
|
|
35
|
+
|
|
36
|
+
const run = (action: (_conversations: ConversationResource[]) => Promise<void>) => async () => {
|
|
37
|
+
setPending(true)
|
|
38
|
+
try {
|
|
39
|
+
await action(selected)
|
|
40
|
+
} finally {
|
|
41
|
+
setPending(false)
|
|
42
|
+
clearSelection()
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
useEffect(() => {
|
|
47
|
+
if (selectMode) dismissToast()
|
|
48
|
+
}, [selectMode])
|
|
49
|
+
|
|
50
|
+
return (
|
|
51
|
+
<LayoutAnimationConfig skipEntering>
|
|
52
|
+
{selectMode && (
|
|
53
|
+
<Animated.View
|
|
54
|
+
entering={FadeIn.duration(300).reduceMotion(reduceMotion)}
|
|
55
|
+
style={styles.container}
|
|
56
|
+
testID="bulk-conversation-actions-bar"
|
|
57
|
+
>
|
|
58
|
+
<BulkAction
|
|
59
|
+
title="Mark read"
|
|
60
|
+
iconName="general.check"
|
|
61
|
+
disabled={disabled}
|
|
62
|
+
onPress={run(markRead)}
|
|
63
|
+
/>
|
|
64
|
+
<BulkAction
|
|
65
|
+
title="Silence"
|
|
66
|
+
iconName="general.bellMuted"
|
|
67
|
+
disabled={!canSilence}
|
|
68
|
+
onPress={run(silence)}
|
|
69
|
+
/>
|
|
70
|
+
<BulkAction
|
|
71
|
+
title={hiddenView ? 'Unhide' : 'Hide'}
|
|
72
|
+
iconName={hiddenView ? 'general.showEye' : 'general.hideEye'}
|
|
73
|
+
disabled={!canHide}
|
|
74
|
+
onPress={run(hiddenView ? unhide : hide)}
|
|
75
|
+
/>
|
|
76
|
+
</Animated.View>
|
|
77
|
+
)}
|
|
78
|
+
</LayoutAnimationConfig>
|
|
79
|
+
)
|
|
80
|
+
}
|
|
81
|
+
|
|
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 } = {}) => {
|
|
112
|
+
const { bottom } = useSafeAreaInsets()
|
|
113
|
+
const { colors } = useTheme()
|
|
114
|
+
const containerVerticalPadding = 12
|
|
115
|
+
const actionColor = disabled ? colors.textColorDefaultDisabled : colors.textColorDefaultPrimary
|
|
116
|
+
|
|
117
|
+
return StyleSheet.create({
|
|
118
|
+
container: {
|
|
119
|
+
flexDirection: 'row',
|
|
120
|
+
backgroundColor: colors.surfaceColor090,
|
|
121
|
+
paddingHorizontal: 16,
|
|
122
|
+
paddingTop: containerVerticalPadding,
|
|
123
|
+
paddingBottom: bottom + containerVerticalPadding,
|
|
124
|
+
borderTopWidth: 1,
|
|
125
|
+
borderTopColor: colors.borderColorDefaultDim,
|
|
126
|
+
},
|
|
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',
|
|
138
|
+
},
|
|
139
|
+
})
|
|
140
|
+
}
|
|
@@ -32,12 +32,14 @@ export function ConversationActions({
|
|
|
32
32
|
style,
|
|
33
33
|
onPress,
|
|
34
34
|
accessibilityLabel,
|
|
35
|
+
selected,
|
|
35
36
|
}: {
|
|
36
37
|
children: ReactNode
|
|
37
38
|
conversation: ConversationResource
|
|
38
39
|
onPress: () => void
|
|
39
40
|
style?: StyleProp<ViewStyle>
|
|
40
41
|
accessibilityLabel?: string
|
|
42
|
+
selected?: boolean
|
|
41
43
|
}) {
|
|
42
44
|
const swipeableRef = useRef<SwipeableMethods>(null)
|
|
43
45
|
const navigation = useNavigation()
|
|
@@ -67,6 +69,8 @@ export function ConversationActions({
|
|
|
67
69
|
const isConversationEmpty = conversation.lastMessageCreatedAt === null
|
|
68
70
|
const canMute = !isArchivedConversation(conversation)
|
|
69
71
|
const canHide = hideable && hideConversationsEnabled && !isArchivedConversation(conversation)
|
|
72
|
+
const selectMode = selected !== undefined
|
|
73
|
+
const canOpenActions = hideable && hideConversationsEnabled && !selectMode
|
|
70
74
|
|
|
71
75
|
const handleSwipeableClose = useCallback(() => {
|
|
72
76
|
setDisabled(false)
|
|
@@ -97,8 +101,8 @@ export function ConversationActions({
|
|
|
97
101
|
if (disabled) return
|
|
98
102
|
|
|
99
103
|
Haptic.impactLight()
|
|
100
|
-
navigation.navigate('ConversationActions', { conversation_id: conversation.id })
|
|
101
|
-
}, [disabled, navigation, conversation.id])
|
|
104
|
+
navigation.navigate('ConversationActions', { conversation_id: conversation.id, read, muted })
|
|
105
|
+
}, [disabled, navigation, conversation.id, read, muted])
|
|
102
106
|
|
|
103
107
|
const handleLatestMessageUnread = useCallback(() => {
|
|
104
108
|
markRead(!read)
|
|
@@ -132,11 +136,9 @@ export function ConversationActions({
|
|
|
132
136
|
]
|
|
133
137
|
: []
|
|
134
138
|
|
|
135
|
-
const accessibilityActions =
|
|
136
|
-
|
|
137
|
-
...hideAccessibilityAction,
|
|
138
|
-
...readAccessibilityAction,
|
|
139
|
-
]
|
|
139
|
+
const accessibilityActions = selectMode
|
|
140
|
+
? []
|
|
141
|
+
: [...muteAccessibilityAction, ...hideAccessibilityAction, ...readAccessibilityAction]
|
|
140
142
|
|
|
141
143
|
const handleAccessibilityAction = useCallback(
|
|
142
144
|
(event: AccessibilityActionEvent) => {
|
|
@@ -162,6 +164,10 @@ export function ConversationActions({
|
|
|
162
164
|
[handleLatestMessageUnread, handleMute, handleHide]
|
|
163
165
|
)
|
|
164
166
|
|
|
167
|
+
useEffect(() => {
|
|
168
|
+
if (selectMode) handleSwipeableClose()
|
|
169
|
+
}, [selectMode, handleSwipeableClose])
|
|
170
|
+
|
|
165
171
|
useEffect(() => {
|
|
166
172
|
if (activeConversationId === conversation.id) return
|
|
167
173
|
|
|
@@ -171,6 +177,7 @@ export function ConversationActions({
|
|
|
171
177
|
return (
|
|
172
178
|
<ReanimatedSwipeable
|
|
173
179
|
ref={swipeableRef}
|
|
180
|
+
enabled={!selectMode}
|
|
174
181
|
childrenContainerStyle={styles.swipeableChildContainer}
|
|
175
182
|
containerStyle={styles.swipeableContainer}
|
|
176
183
|
overshootFriction={8}
|
|
@@ -199,11 +206,12 @@ export function ConversationActions({
|
|
|
199
206
|
<Pressable
|
|
200
207
|
testID={`conversation-${conversation.id}`}
|
|
201
208
|
onPress={handlePress}
|
|
202
|
-
onLongPress={
|
|
209
|
+
onLongPress={canOpenActions ? handleLongPress : undefined}
|
|
203
210
|
style={({ pressed }) => [style, pressed && platformPressedOpacityStyle]}
|
|
204
211
|
android_ripple={{ color: androidRippleColor, borderless: false, foreground: true }}
|
|
205
212
|
accessibilityLabel={accessibilityLabel}
|
|
206
|
-
accessibilityRole=
|
|
213
|
+
accessibilityRole={selectMode ? 'checkbox' : 'button'}
|
|
214
|
+
accessibilityState={selectMode ? { checked: selected } : undefined}
|
|
207
215
|
accessibilityActions={accessibilityActions}
|
|
208
216
|
onAccessibilityAction={handleAccessibilityAction}
|
|
209
217
|
>
|
|
@@ -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'
|
|
@@ -19,6 +20,7 @@ import {
|
|
|
19
20
|
IconTile,
|
|
20
21
|
Text,
|
|
21
22
|
Badge,
|
|
23
|
+
Checkbox,
|
|
22
24
|
type BadgeProps,
|
|
23
25
|
} from '../display'
|
|
24
26
|
import { ConversationActions } from './conversation_actions'
|
|
@@ -44,8 +46,12 @@ export const ConversationPreview = ({
|
|
|
44
46
|
const styles = useStyles()
|
|
45
47
|
const {
|
|
46
48
|
args: { show_hidden: hidden = false },
|
|
49
|
+
selectMode,
|
|
50
|
+
selectedIds,
|
|
51
|
+
toggleSelected,
|
|
47
52
|
} = useConversationsContext()
|
|
48
53
|
const {
|
|
54
|
+
id,
|
|
49
55
|
conversationPreview,
|
|
50
56
|
lastMessageCreatedAt,
|
|
51
57
|
title,
|
|
@@ -61,6 +67,8 @@ export const ConversationPreview = ({
|
|
|
61
67
|
const fallbackIconName = emptyConversation ? 'people.noTextMessage' : 'general.person'
|
|
62
68
|
const hasMetaContent = lastMessageCreatedAt || unreadCount > 0 || muted || hidden
|
|
63
69
|
const isUnread = unreadCount > 0 || unreadReaction
|
|
70
|
+
const selected = selectMode ? selectedIds.includes(id) : undefined
|
|
71
|
+
const selectedBackgroundColor = useSelectedChipBackgroundColor()
|
|
64
72
|
|
|
65
73
|
const numberOfLinesScaledTitle = useScalableNumberOfLines(1)
|
|
66
74
|
const numberOfLinesScaledPreviewText = useScalableNumberOfLines(2)
|
|
@@ -79,10 +87,17 @@ export const ConversationPreview = ({
|
|
|
79
87
|
return (
|
|
80
88
|
<ConversationActions
|
|
81
89
|
conversation={conversation}
|
|
82
|
-
style={[
|
|
83
|
-
|
|
90
|
+
style={[
|
|
91
|
+
styles.previewRow,
|
|
92
|
+
disabled && !archived && styles.disabled,
|
|
93
|
+
selected && { backgroundColor: selectedBackgroundColor },
|
|
94
|
+
style,
|
|
95
|
+
]}
|
|
96
|
+
onPress={selectMode ? () => toggleSelected(id) : onPress}
|
|
84
97
|
accessibilityLabel={conversationAccessibilityLabel}
|
|
98
|
+
selected={selected}
|
|
85
99
|
>
|
|
100
|
+
{selected !== undefined && <Checkbox checked={selected} style={styles.checkbox} />}
|
|
86
101
|
{archived ? (
|
|
87
102
|
<IconTile
|
|
88
103
|
icon={faBoxArchive}
|
|
@@ -284,6 +299,9 @@ const useStyles = () => {
|
|
|
284
299
|
disabled: {
|
|
285
300
|
opacity: 0.4,
|
|
286
301
|
},
|
|
302
|
+
checkbox: {
|
|
303
|
+
alignSelf: 'center',
|
|
304
|
+
},
|
|
287
305
|
title: {
|
|
288
306
|
fontSize: 16,
|
|
289
307
|
color: colors.textColorDefaultPrimary,
|
|
@@ -32,6 +32,7 @@ export const Conversations = ({ ListHeaderComponent }: ConversationsProps) => {
|
|
|
32
32
|
isRefetching,
|
|
33
33
|
isFetched,
|
|
34
34
|
hasNextPage,
|
|
35
|
+
selectMode,
|
|
35
36
|
args: {
|
|
36
37
|
chat_group_graph_id,
|
|
37
38
|
group_source_app_name,
|
|
@@ -88,7 +89,7 @@ export const Conversations = ({ ListHeaderComponent }: ConversationsProps) => {
|
|
|
88
89
|
contentInsetAdjustmentBehavior="automatic"
|
|
89
90
|
onRefresh={refetch}
|
|
90
91
|
refreshing={!isFetched && isRefetching}
|
|
91
|
-
ListHeaderComponent={ListHeaderComponent}
|
|
92
|
+
ListHeaderComponent={selectMode ? null : ListHeaderComponent}
|
|
92
93
|
ListEmptyComponent={
|
|
93
94
|
<ConversationsBlankState
|
|
94
95
|
isFilterApplied={isFilterApplied}
|
|
@@ -62,7 +62,7 @@ const options = [
|
|
|
62
62
|
{ id: 'teams', label: 'Teams' },
|
|
63
63
|
]
|
|
64
64
|
|
|
65
|
-
const renderFilterDropdown = (
|
|
65
|
+
const renderFilterDropdown = () => {
|
|
66
66
|
const onSelect = jest.fn()
|
|
67
67
|
const onMoreFilters = jest.fn()
|
|
68
68
|
|
|
@@ -73,7 +73,6 @@ const renderFilterDropdown = ({ showMoreFilters }: { showMoreFilters?: boolean }
|
|
|
73
73
|
onSelect={onSelect}
|
|
74
74
|
onMoreFilters={onMoreFilters}
|
|
75
75
|
triggerLabel="Groups"
|
|
76
|
-
showMoreFilters={showMoreFilters}
|
|
77
76
|
/>
|
|
78
77
|
)
|
|
79
78
|
|
|
@@ -81,16 +80,6 @@ const renderFilterDropdown = ({ showMoreFilters }: { showMoreFilters?: boolean }
|
|
|
81
80
|
}
|
|
82
81
|
|
|
83
82
|
describe('FilterDropdown', () => {
|
|
84
|
-
it('hands the menu every option, the selected one checked, then More filters', () => {
|
|
85
|
-
renderFilterDropdown()
|
|
86
|
-
|
|
87
|
-
expect(screen.getByRole('button', { name: 'Groups' })).toBeTruthy()
|
|
88
|
-
expect(
|
|
89
|
-
screen.getAllByRole('menuitem').map(item => [item.props.accessibilityState.selected])
|
|
90
|
-
).toEqual([[false], [true], [false], [false]])
|
|
91
|
-
expect(screen.getByRole('menuitem', { name: 'More filters' })).toBeTruthy()
|
|
92
|
-
})
|
|
93
|
-
|
|
94
83
|
it('calls onSelect with the id of the pressed option', () => {
|
|
95
84
|
const { onSelect, onMoreFilters } = renderFilterDropdown()
|
|
96
85
|
|
|
@@ -100,13 +89,6 @@ describe('FilterDropdown', () => {
|
|
|
100
89
|
expect(onMoreFilters).not.toHaveBeenCalled()
|
|
101
90
|
})
|
|
102
91
|
|
|
103
|
-
it('leaves More filters out when showMoreFilters is false', () => {
|
|
104
|
-
renderFilterDropdown({ showMoreFilters: false })
|
|
105
|
-
|
|
106
|
-
expect(screen.queryByRole('menuitem', { name: 'More filters' })).toBeNull()
|
|
107
|
-
expect(screen.getAllByRole('menuitem')).toHaveLength(options.length)
|
|
108
|
-
})
|
|
109
|
-
|
|
110
92
|
it('calls onMoreFilters for the More filters action', () => {
|
|
111
93
|
const { onSelect, onMoreFilters } = renderFilterDropdown()
|
|
112
94
|
|
|
@@ -1,16 +1,33 @@
|
|
|
1
1
|
import { render } from '@testing-library/react-native'
|
|
2
2
|
import React from 'react'
|
|
3
|
+
import { StyleSheet } from 'react-native'
|
|
3
4
|
import { faBoxArchive } from '../../../vendor/font_awesome_pro_solid_icons'
|
|
4
5
|
import { IconTile } from '../icon_tile'
|
|
5
6
|
|
|
7
|
+
const clippingAncestors = (shape: 'circle' | 'square') => {
|
|
8
|
+
const view = render(
|
|
9
|
+
<IconTile icon={faBoxArchive} shape={shape} maxFontSizeMultiplier={1} testID="tile" />
|
|
10
|
+
)
|
|
11
|
+
const ancestors = []
|
|
12
|
+
let node = view.getByTestId('tile', { includeHiddenElements: true }).parent
|
|
13
|
+
while (node) {
|
|
14
|
+
ancestors.push(node)
|
|
15
|
+
node = node.parent
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
return ancestors.filter(
|
|
19
|
+
ancestor =>
|
|
20
|
+
typeof ancestor.type === 'string' &&
|
|
21
|
+
StyleSheet.flatten(ancestor.props.style)?.overflow === 'hidden'
|
|
22
|
+
)
|
|
23
|
+
}
|
|
24
|
+
|
|
6
25
|
describe('IconTile', () => {
|
|
7
|
-
it('
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
)
|
|
26
|
+
it('masks a circle tile', () => {
|
|
27
|
+
expect(clippingAncestors('circle')).not.toHaveLength(0)
|
|
28
|
+
})
|
|
11
29
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
})
|
|
30
|
+
it('keeps a square tile out of the circular mask', () => {
|
|
31
|
+
expect(clippingAncestors('square')).toHaveLength(0)
|
|
15
32
|
})
|
|
16
33
|
})
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
import { StyleProp, StyleSheet, View, ViewStyle } from 'react-native'
|
|
3
|
+
import { useTheme } from '../../hooks'
|
|
4
|
+
import { tokens } from '../../vendor/tapestry/tokens'
|
|
5
|
+
import { Icon } from './icon'
|
|
6
|
+
|
|
7
|
+
interface CheckboxProps {
|
|
8
|
+
checked: boolean
|
|
9
|
+
style?: StyleProp<ViewStyle>
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export function Checkbox({ checked, style }: CheckboxProps) {
|
|
13
|
+
const styles = useStyles()
|
|
14
|
+
|
|
15
|
+
return (
|
|
16
|
+
<View style={[checked ? styles.checkedContainer : styles.uncheckedContainer, style]}>
|
|
17
|
+
{checked && <Icon name="general.thickCheckmark" style={styles.checkedIcon} />}
|
|
18
|
+
</View>
|
|
19
|
+
)
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
const useStyles = () => {
|
|
23
|
+
const { colors } = useTheme()
|
|
24
|
+
|
|
25
|
+
const baseCheckboxStyles: ViewStyle = {
|
|
26
|
+
width: 20,
|
|
27
|
+
height: 20,
|
|
28
|
+
borderRadius: 40,
|
|
29
|
+
alignItems: 'center',
|
|
30
|
+
justifyContent: 'center',
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
return StyleSheet.create({
|
|
34
|
+
checkedContainer: {
|
|
35
|
+
...baseCheckboxStyles,
|
|
36
|
+
backgroundColor: colors.statusSuccessIcon,
|
|
37
|
+
},
|
|
38
|
+
uncheckedContainer: {
|
|
39
|
+
...baseCheckboxStyles,
|
|
40
|
+
borderWidth: 2,
|
|
41
|
+
borderColor: colors.borderColorDefaultDarker,
|
|
42
|
+
},
|
|
43
|
+
checkedIcon: {
|
|
44
|
+
color: tokens.colorNeutral100White,
|
|
45
|
+
},
|
|
46
|
+
})
|
|
47
|
+
}
|
|
@@ -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'>}`
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { render } from '@testing-library/react-native'
|
|
2
2
|
import React from 'react'
|
|
3
|
-
import { Text } from 'react-native'
|
|
4
3
|
import { Log } from '../../../utils/native_adapters/configuration'
|
|
5
4
|
import { ComponentErrorBoundary } from '../component_error_boundary'
|
|
6
5
|
|
|
@@ -32,15 +31,4 @@ describe('ComponentErrorBoundary', () => {
|
|
|
32
31
|
expect(toJSON()).toBeNull()
|
|
33
32
|
expect(reportError.mock.calls[0][1]).toMatchObject({ scope: 'component' })
|
|
34
33
|
})
|
|
35
|
-
|
|
36
|
-
it('lets callers override the defaults', () => {
|
|
37
|
-
const { getByText } = render(
|
|
38
|
-
<ComponentErrorBoundary scope="screen" fallback={<Text>overridden</Text>}>
|
|
39
|
-
<Boom thrown={new Error('boom')} />
|
|
40
|
-
</ComponentErrorBoundary>
|
|
41
|
-
)
|
|
42
|
-
|
|
43
|
-
expect(getByText('overridden')).toBeTruthy()
|
|
44
|
-
expect(reportError.mock.calls[0][1]).toMatchObject({ scope: 'screen' })
|
|
45
|
-
})
|
|
46
34
|
})
|
|
@@ -249,7 +249,7 @@ function BannerLink({ children, onPress }: BannerLinkProps) {
|
|
|
249
249
|
const styles = useStyles({ appearance })
|
|
250
250
|
|
|
251
251
|
return (
|
|
252
|
-
<TextInlineButton variant="tertiary" style={styles.
|
|
252
|
+
<TextInlineButton variant="tertiary" style={styles.link} onPress={onPress}>
|
|
253
253
|
{children}
|
|
254
254
|
</TextInlineButton>
|
|
255
255
|
)
|
|
@@ -295,5 +295,9 @@ const useStyles = ({ appearance = 'neutral' }: Styles = {}) => {
|
|
|
295
295
|
text: {
|
|
296
296
|
color: statusColorMap[appearance].text,
|
|
297
297
|
},
|
|
298
|
+
link: {
|
|
299
|
+
color: statusColorMap[appearance].text,
|
|
300
|
+
textDecorationColor: statusColorMap[appearance].text,
|
|
301
|
+
},
|
|
298
302
|
})
|
|
299
303
|
}
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import { act, renderHook } from '@testing-library/react-native'
|
|
2
|
+
import React from 'react'
|
|
3
|
+
import { ConversationFiltersParams } from '../../screens/conversation_filters/screen_props'
|
|
4
|
+
import { ConversationsContextProvider, useConversationsContext } from '../conversations_context'
|
|
5
|
+
|
|
6
|
+
let mockHideEnabled = true
|
|
7
|
+
jest.mock('../../hooks/use_hide_conversations_enabled', () => ({
|
|
8
|
+
useHideConversationsEnabled: () => mockHideEnabled,
|
|
9
|
+
}))
|
|
10
|
+
jest.mock('../../hooks/use_conversations', () => ({
|
|
11
|
+
useConversations: () => ({ conversations: [] }),
|
|
12
|
+
}))
|
|
13
|
+
|
|
14
|
+
let mockArgs: ConversationFiltersParams = {}
|
|
15
|
+
|
|
16
|
+
const renderContext = () =>
|
|
17
|
+
renderHook(() => useConversationsContext(), {
|
|
18
|
+
wrapper: ({ children }: { children: React.ReactNode }) => (
|
|
19
|
+
<ConversationsContextProvider args={mockArgs}>{children}</ConversationsContextProvider>
|
|
20
|
+
),
|
|
21
|
+
})
|
|
22
|
+
|
|
23
|
+
describe('ConversationsContextProvider selection', () => {
|
|
24
|
+
beforeEach(() => {
|
|
25
|
+
mockHideEnabled = true
|
|
26
|
+
mockArgs = {}
|
|
27
|
+
})
|
|
28
|
+
|
|
29
|
+
it('toggles conversations in and out of the selection', () => {
|
|
30
|
+
const { result } = renderContext()
|
|
31
|
+
|
|
32
|
+
act(() => result.current.enterSelectMode(1))
|
|
33
|
+
act(() => result.current.toggleSelected(2))
|
|
34
|
+
|
|
35
|
+
expect(result.current.selectMode).toBe(true)
|
|
36
|
+
expect(result.current.selectedIds).toEqual([1, 2])
|
|
37
|
+
|
|
38
|
+
act(() => result.current.toggleSelected(1))
|
|
39
|
+
|
|
40
|
+
expect(result.current.selectedIds).toEqual([2])
|
|
41
|
+
})
|
|
42
|
+
|
|
43
|
+
it('leaves select mode on clear', () => {
|
|
44
|
+
const { result } = renderContext()
|
|
45
|
+
|
|
46
|
+
act(() => result.current.enterSelectMode(1))
|
|
47
|
+
act(() => result.current.clearSelection())
|
|
48
|
+
|
|
49
|
+
expect(result.current.selectMode).toBe(false)
|
|
50
|
+
expect(result.current.selectedIds).toEqual([])
|
|
51
|
+
})
|
|
52
|
+
|
|
53
|
+
it('clears the selection when the filter changes', () => {
|
|
54
|
+
const { result, rerender } = renderContext()
|
|
55
|
+
|
|
56
|
+
act(() => result.current.enterSelectMode(1))
|
|
57
|
+
mockArgs = { show_unread: true }
|
|
58
|
+
rerender({})
|
|
59
|
+
|
|
60
|
+
expect(result.current.selectMode).toBe(false)
|
|
61
|
+
expect(result.current.selectedIds).toEqual([])
|
|
62
|
+
})
|
|
63
|
+
|
|
64
|
+
it('stays out of select mode when the flag is off', () => {
|
|
65
|
+
mockHideEnabled = false
|
|
66
|
+
const { result } = renderContext()
|
|
67
|
+
|
|
68
|
+
act(() => result.current.enterSelectMode(1))
|
|
69
|
+
|
|
70
|
+
expect(result.current.selectMode).toBe(false)
|
|
71
|
+
expect(result.current.selectedIds).toEqual([])
|
|
72
|
+
})
|
|
73
|
+
|
|
74
|
+
it('does not revive the selection when the flag flips off and back on', () => {
|
|
75
|
+
const { result, rerender } = renderContext()
|
|
76
|
+
|
|
77
|
+
act(() => result.current.enterSelectMode(1))
|
|
78
|
+
mockHideEnabled = false
|
|
79
|
+
rerender({})
|
|
80
|
+
mockHideEnabled = true
|
|
81
|
+
rerender({})
|
|
82
|
+
|
|
83
|
+
expect(result.current.selectMode).toBe(false)
|
|
84
|
+
expect(result.current.selectedIds).toEqual([])
|
|
85
|
+
})
|
|
86
|
+
})
|
|
@@ -15,6 +15,7 @@ import { useJoltForegroundPing } from '../hooks/use_jolt'
|
|
|
15
15
|
import { RequestQueryKey } from '../hooks/use_suspense_api'
|
|
16
16
|
import { emitAuthRefresh } from '../utils/auth_events'
|
|
17
17
|
import { isResponseLike, ResponseError } from '../utils/response_error'
|
|
18
|
+
import { cancelThrottledRefreshes } from '../utils/throttled_refresh'
|
|
18
19
|
import { ChatContext, ChatContextValue } from './chat_context'
|
|
19
20
|
|
|
20
21
|
let apiClient: ApiClient | undefined
|
|
@@ -65,6 +66,7 @@ export function ApiProvider({ children }: ViewProps) {
|
|
|
65
66
|
if (!sessionChanged) return
|
|
66
67
|
|
|
67
68
|
emitAuthRefresh()
|
|
69
|
+
cancelThrottledRefreshes(chatQueryClient)
|
|
68
70
|
|
|
69
71
|
if (chatQueryClient.isFetching()) {
|
|
70
72
|
chatQueryClient.cancelQueries().then(() => chatQueryClient.invalidateQueries())
|