@planningcenter/chat-react-native 3.42.1-qa-staging.5 → 3.42.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/conversations/conversation_preview.d.ts.map +1 -1
- package/build/components/conversations/conversation_preview.js +12 -46
- package/build/components/conversations/conversation_preview.js.map +1 -1
- package/build/components/conversations/unread_count_badge.d.ts +1 -2
- package/build/components/conversations/unread_count_badge.d.ts.map +1 -1
- package/build/components/conversations/unread_count_badge.js +4 -5
- package/build/components/conversations/unread_count_badge.js.map +1 -1
- package/build/hooks/use_conversation.d.ts.map +1 -1
- package/build/hooks/use_conversation.js +0 -2
- package/build/hooks/use_conversation.js.map +1 -1
- package/build/hooks/use_conversation_jolt_events.d.ts.map +1 -1
- package/build/hooks/use_conversation_jolt_events.js +19 -4
- package/build/hooks/use_conversation_jolt_events.js.map +1 -1
- package/build/hooks/use_conversations_actions.d.ts.map +1 -1
- package/build/hooks/use_conversations_actions.js +1 -3
- package/build/hooks/use_conversations_actions.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 +4 -3
- package/build/hooks/use_mark_latest_message_read.js.map +1 -1
- package/build/screens/conversation_select_type_screen.d.ts.map +1 -1
- package/build/screens/conversation_select_type_screen.js +9 -2
- package/build/screens/conversation_select_type_screen.js.map +1 -1
- package/build/screens/conversations/components/list_header_component.js +1 -1
- package/build/screens/conversations/components/list_header_component.js.map +1 -1
- package/build/screens/settings_screen.d.ts.map +1 -1
- package/build/screens/settings_screen.js +1 -2
- package/build/screens/settings_screen.js.map +1 -1
- package/build/types/resources/conversation.d.ts +1 -10
- package/build/types/resources/conversation.d.ts.map +1 -1
- package/build/types/resources/conversation.js.map +1 -1
- package/build/utils/request/conversation.d.ts.map +1 -1
- package/build/utils/request/conversation.js +2 -4
- package/build/utils/request/conversation.js.map +1 -1
- package/package.json +3 -3
- package/src/components/conversations/conversation_preview.tsx +23 -58
- package/src/components/conversations/unread_count_badge.tsx +4 -13
- package/src/hooks/use_conversation.ts +0 -2
- package/src/hooks/use_conversation_jolt_events.ts +19 -3
- package/src/hooks/use_conversations_actions.ts +1 -3
- package/src/hooks/use_mark_latest_message_read.ts +4 -3
- package/src/screens/conversation_select_type_screen.tsx +10 -2
- package/src/screens/conversations/components/list_header_component.tsx +1 -1
- package/src/screens/settings_screen.tsx +1 -2
- package/src/types/resources/conversation.ts +1 -11
- package/src/utils/__tests__/conversation.test.ts +2 -6
- package/src/utils/request/conversation.ts +2 -4
|
@@ -17,9 +17,9 @@ export function useMarkLatestMessageRead({ conversation }: Props) {
|
|
|
17
17
|
[markRead]
|
|
18
18
|
)
|
|
19
19
|
const unreadCount = conversation.unreadCount
|
|
20
|
-
const
|
|
20
|
+
const unreadReactionCount = conversation.unreadReactionCount || 0
|
|
21
21
|
|
|
22
|
-
const shouldMarkRead = Boolean(unreadCount >= 1 ||
|
|
22
|
+
const shouldMarkRead = Boolean(unreadCount >= 1 || unreadReactionCount > 0 || !firedOnce.current)
|
|
23
23
|
const appState = useAppState()
|
|
24
24
|
const isActive = appState === 'active'
|
|
25
25
|
|
|
@@ -29,5 +29,6 @@ export function useMarkLatestMessageRead({ conversation }: Props) {
|
|
|
29
29
|
firedOnce.current = true
|
|
30
30
|
|
|
31
31
|
debouncedMarkRead(true)
|
|
32
|
-
|
|
32
|
+
// keeping unreadReactionCount in the dependency array to watch for changes
|
|
33
|
+
}, [debouncedMarkRead, isActive, shouldMarkRead, unreadReactionCount])
|
|
33
34
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { StaticScreenProps, useNavigation } from '@react-navigation/native'
|
|
2
|
-
import React from 'react'
|
|
2
|
+
import React, { useLayoutEffect } from 'react'
|
|
3
3
|
import FormSheet, { getFormSheetScreenOptions } from '../components/primitive/form_sheet'
|
|
4
4
|
import { useCurrentPerson } from '../hooks/use_current_person'
|
|
5
5
|
import { availableFeatures, useFeatures } from '../hooks/use_features'
|
|
@@ -35,6 +35,14 @@ export function ConversationSelectTypeScreen({ route }: ConversationSelectTypeSc
|
|
|
35
35
|
|
|
36
36
|
const filterParams = { chat_group_graph_id, group_source_app_name }
|
|
37
37
|
const dmFeatureEnabled = featureEnabled(availableFeatures.direct_messages_eap)
|
|
38
|
+
const showDirectMessageOption = dmFeatureEnabled && !under_18
|
|
39
|
+
|
|
40
|
+
// sheetAllowedDetents depends on the DM feature flag, which isn't known until render, so it's
|
|
41
|
+
// set here instead of in the static ConversationSelectTypeScreenOptions. useLayoutEffect applies
|
|
42
|
+
// it before paint so the sheet never visibly resizes after opening.
|
|
43
|
+
useLayoutEffect(() => {
|
|
44
|
+
navigation.setOptions({ sheetAllowedDetents: showDirectMessageOption ? [0.3] : [0.25] })
|
|
45
|
+
}, [navigation, showDirectMessageOption])
|
|
38
46
|
|
|
39
47
|
const handleFilterPress = () => {
|
|
40
48
|
if (!newConversationFromFilter) return
|
|
@@ -102,7 +110,7 @@ export function ConversationSelectTypeScreen({ route }: ConversationSelectTypeSc
|
|
|
102
110
|
accessibilityHint="Opens team selection screen"
|
|
103
111
|
/>
|
|
104
112
|
)}
|
|
105
|
-
{
|
|
113
|
+
{showDirectMessageOption && (
|
|
106
114
|
<FormSheet.Action
|
|
107
115
|
title="Direct message"
|
|
108
116
|
onPress={handleDirectMessagePress}
|
|
@@ -145,7 +145,7 @@ export const ListHeaderComponent = () => {
|
|
|
145
145
|
<View style={styles.headingRow}>
|
|
146
146
|
<View style={styles.titleContainer}>
|
|
147
147
|
<Heading numberOfLines={1} variant="h2">
|
|
148
|
-
|
|
148
|
+
Conversations
|
|
149
149
|
</Heading>
|
|
150
150
|
<TextButton
|
|
151
151
|
onPress={alertMarkAllRead}
|
|
@@ -36,8 +36,7 @@ export function SettingsScreen({}: SettingsScreenProps) {
|
|
|
36
36
|
<View style={styles.settingRowText}>
|
|
37
37
|
<Text>Allow direct messages</Text>
|
|
38
38
|
<Text variant="tertiary">
|
|
39
|
-
When
|
|
40
|
-
be turned off.
|
|
39
|
+
When disabled, you won't be able to participate in direct messages.
|
|
41
40
|
</Text>
|
|
42
41
|
</View>
|
|
43
42
|
<Switch
|
|
@@ -3,25 +3,15 @@ import { ConversationBadgeResource } from './conversation_badge'
|
|
|
3
3
|
import { ConversationMembershipResource } from './conversation_membership'
|
|
4
4
|
import { GroupResource } from './group_resource'
|
|
5
5
|
import { MemberAbilityResource } from './member_ability'
|
|
6
|
-
import { ReactionCountResource } from './reaction'
|
|
7
6
|
|
|
8
7
|
export type ConversationDisabledReason = 'safety_check' | 'direct_messages_disabled'
|
|
9
8
|
|
|
10
|
-
export interface ConversationPreviewData {
|
|
11
|
-
kind: 'reaction' | 'message'
|
|
12
|
-
authorName: string
|
|
13
|
-
value: ReactionCountResource['value'] | null
|
|
14
|
-
text: string
|
|
15
|
-
createdAt: string
|
|
16
|
-
}
|
|
17
|
-
|
|
18
9
|
export interface ConversationResource {
|
|
19
10
|
type: 'Conversation'
|
|
20
11
|
id: number
|
|
21
12
|
badges?: ConversationBadgeResource[]
|
|
22
13
|
analyticsMetadata?: AnalyticsMetadataResource
|
|
23
14
|
conversationMembership?: Partial<ConversationMembershipResource>
|
|
24
|
-
conversationPreview: ConversationPreviewData | null
|
|
25
15
|
createdAt: string
|
|
26
16
|
deleted?: boolean
|
|
27
17
|
directMessage?: boolean
|
|
@@ -44,6 +34,6 @@ export interface ConversationResource {
|
|
|
44
34
|
repliesDisabled: boolean
|
|
45
35
|
title: string
|
|
46
36
|
unreadCount: number
|
|
47
|
-
|
|
37
|
+
unreadReactionCount?: number // Derived from Jolt events
|
|
48
38
|
updatedAt: string
|
|
49
39
|
}
|
|
@@ -5,12 +5,8 @@ const groupId = 'Groups-Group-1' as const
|
|
|
5
5
|
describe('getConversationsRequestArgs', () => {
|
|
6
6
|
it.each([
|
|
7
7
|
['no args', {}, 'mine_or_not_empty'],
|
|
8
|
-
[
|
|
9
|
-
|
|
10
|
-
{ group_source_app_name: 'Groups' },
|
|
11
|
-
'mine_or_not_empty,group_source_app_name',
|
|
12
|
-
],
|
|
13
|
-
['chat_group_graph_id', { chat_group_graph_id: groupId }, 'mine_or_not_empty,group'],
|
|
8
|
+
['group_source_app_name', { group_source_app_name: 'Groups' }, 'group_source_app_name'],
|
|
9
|
+
['chat_group_graph_id', { chat_group_graph_id: groupId }, 'group'],
|
|
14
10
|
['show_direct_messages', { show_direct_messages: true }, 'mine_or_not_empty,direct_message'],
|
|
15
11
|
])('%s uses filter: %s', (_label, args, expectedFilter) => {
|
|
16
12
|
expect(getConversationsRequestArgs(args).data.filter).toBe(expectedFilter)
|
|
@@ -16,11 +16,11 @@ export const getConversationsRequestArgs = ({
|
|
|
16
16
|
}: Partial<ConversationRequestArgs> = {}): GetRequest => {
|
|
17
17
|
let filter: string
|
|
18
18
|
if (chat_group_graph_id) {
|
|
19
|
-
filter = '
|
|
19
|
+
filter = 'group'
|
|
20
20
|
} else if (show_direct_messages) {
|
|
21
21
|
filter = 'mine_or_not_empty,direct_message'
|
|
22
22
|
} else if (group_source_app_name) {
|
|
23
|
-
filter = '
|
|
23
|
+
filter = 'group_source_app_name'
|
|
24
24
|
} else {
|
|
25
25
|
filter = 'mine_or_not_empty'
|
|
26
26
|
}
|
|
@@ -38,7 +38,6 @@ export const getConversationsRequestArgs = ({
|
|
|
38
38
|
Conversation: [
|
|
39
39
|
'created_at',
|
|
40
40
|
'badges',
|
|
41
|
-
'conversation_preview',
|
|
42
41
|
'disabled',
|
|
43
42
|
'disabled_reason',
|
|
44
43
|
'groups',
|
|
@@ -56,7 +55,6 @@ export const getConversationsRequestArgs = ({
|
|
|
56
55
|
'replies_disabled',
|
|
57
56
|
'title',
|
|
58
57
|
'unread_count',
|
|
59
|
-
'unread_reaction',
|
|
60
58
|
'updated_at',
|
|
61
59
|
],
|
|
62
60
|
AnalyticsMetadata: ['metadata'],
|