@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
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"conversation_select_type_screen.js","sourceRoot":"","sources":["../../src/screens/conversation_select_type_screen.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAqB,aAAa,EAAE,MAAM,0BAA0B,CAAA;AAC3E,OAAO,KAAK,MAAM,OAAO,CAAA;
|
|
1
|
+
{"version":3,"file":"conversation_select_type_screen.js","sourceRoot":"","sources":["../../src/screens/conversation_select_type_screen.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAqB,aAAa,EAAE,MAAM,0BAA0B,CAAA;AAC3E,OAAO,KAAK,EAAE,EAAE,eAAe,EAAE,MAAM,OAAO,CAAA;AAC9C,OAAO,SAAS,EAAE,EAAE,yBAAyB,EAAE,MAAM,oCAAoC,CAAA;AACzF,OAAO,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAA;AAC9D,OAAO,EAAE,iBAAiB,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAA;AACtE,OAAO,EAAE,yBAAyB,EAAE,MAAM,qCAAqC,CAAA;AAI/E,OAAO,EAAE,MAAM,EAAE,MAAM,0BAA0B,CAAA;AAEjD,MAAM,CAAC,MAAM,mCAAmC,GAAG,yBAAyB,CAAC;IAC3E,WAAW,EAAE,kBAAkB;CAChC,CAAC,CAAA;AAaF,MAAM,UAAU,4BAA4B,CAAC,EAAE,KAAK,EAAqC;IACvF,MAAM,UAAU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AA,CAAC,4BAA4B,IAAI,CAC/B,CAAC,SAAS,CAAC,MAAM,CACf,KAAK,CAAC,OAAO,CACb,OAAO,CAAC,CAAC,gBAAgB,CAAC,CAC1B,iBAAiB,CAAC,8BAA8B,EAChD,CACH,CACD;MAAA,CAAC,8BAA8B,IAAI,CACjC,CAAC,SAAS,CAAC,MAAM,CACf,KAAK,CAAC,MAAM,CACZ,OAAO,CAAC,CAAC,eAAe,CAAC,CACzB,iBAAiB,CAAC,6BAA6B,EAC/C,CACH,CACD;MAAA,CAAC,uBAAuB,IAAI,CAC1B,CAAC,SAAS,CAAC,MAAM,CACf,KAAK,CAAC,gBAAgB,CACtB,OAAO,CAAC,CAAC,wBAAwB,CAAC,CAClC,QAAQ,CAAC,CAAC,sBAAsB,CAAC,CACjC,cAAc,CAAC,CAAC,sBAAsB,CAAC,CAAC,CAAC,2BAA2B,CAAC,CAAC,CAAC,SAAS,CAAC,CACjF,iBAAiB,CAAC,iDAAiD,EACnE,CACH,CACH;IAAA,EAAE,SAAS,CAAC,IAAI,CAAC,CAClB,CAAA;AACH,CAAC","sourcesContent":["import { StaticScreenProps, useNavigation } from '@react-navigation/native'\nimport React, { useLayoutEffect } from 'react'\nimport FormSheet, { getFormSheetScreenOptions } from '../components/primitive/form_sheet'\nimport { useCurrentPerson } from '../hooks/use_current_person'\nimport { availableFeatures, useFeatures } from '../hooks/use_features'\nimport { useConversationTypeAccess } from '../hooks/use_new_conversation_entry'\nimport type { NewConversationFromFilter } from '../hooks/use_new_conversation_from_filter'\nimport { AppName } from '../types/resources/app_name'\nimport { GraphId } from '../types/resources/group_resource'\nimport { Haptic } from '../utils/native_adapters'\n\nexport const ConversationSelectTypeScreenOptions = getFormSheetScreenOptions({\n headerTitle: 'New conversation',\n})\n\nexport type ConversationSelectTypeScreenProps = StaticScreenProps<{\n chat_group_graph_id?: GraphId\n group_source_app_name?: AppName\n newConversationFromFilter?: NewConversationFromFilter\n}>\n\ntype NewConversationTypeScreen =\n | 'ConversationSelectGroupRecipients'\n | 'ConversationSelectTeamsILeadRecipients'\n | 'ConversationSelectDirectMessageRecipients'\n\nexport function ConversationSelectTypeScreen({ route }: ConversationSelectTypeScreenProps) {\n const navigation = useNavigation()\n const { canCreateGroupsConversations, canCreateServicesConversations } =\n useConversationTypeAccess()\n const { featureEnabled } = useFeatures()\n const { directMessagesDisabled, under_18 } = useCurrentPerson()\n const { newConversationFromFilter, chat_group_graph_id, group_source_app_name } =\n route.params || {}\n\n const filterParams = { chat_group_graph_id, group_source_app_name }\n const dmFeatureEnabled = featureEnabled(availableFeatures.direct_messages_eap)\n const showDirectMessageOption = dmFeatureEnabled && !under_18\n\n // sheetAllowedDetents depends on the DM feature flag, which isn't known until render, so it's\n // set here instead of in the static ConversationSelectTypeScreenOptions. useLayoutEffect applies\n // it before paint so the sheet never visibly resizes after opening.\n useLayoutEffect(() => {\n navigation.setOptions({ sheetAllowedDetents: showDirectMessageOption ? [0.3] : [0.25] })\n }, [navigation, showDirectMessageOption])\n\n const handleFilterPress = () => {\n if (!newConversationFromFilter) return\n\n Haptic.impactLight()\n navigation.goBack()\n requestAnimationFrame(() => {\n if (newConversationFromFilter.sourceAppName === 'groups') {\n navigation.navigate('New', {\n screen: 'ConversationNew',\n params: {\n ...filterParams,\n source_app_name: 'Groups' as AppName,\n group_id: newConversationFromFilter.groupId,\n },\n })\n } else {\n navigation.navigate('New', {\n screen: 'ConversationNew',\n params: {\n ...filterParams,\n source_app_name: 'Services' as AppName,\n team_ids: newConversationFromFilter.teamIds,\n },\n })\n }\n })\n }\n\n const navigateToNewConversationType = (screen: NewConversationTypeScreen) => {\n Haptic.impactLight()\n navigation.goBack()\n requestAnimationFrame(() => navigation.navigate('New', { screen, params: filterParams }))\n }\n\n const handleGroupPress = () => navigateToNewConversationType('ConversationSelectGroupRecipients')\n const handleTeamPress = () =>\n navigateToNewConversationType('ConversationSelectTeamsILeadRecipients')\n const handleDirectMessagePress = () =>\n navigateToNewConversationType('ConversationSelectDirectMessageRecipients')\n\n return (\n <FormSheet.Root>\n <FormSheet.Header>\n <FormSheet.HeaderTitle>Start a conversation by</FormSheet.HeaderTitle>\n </FormSheet.Header>\n {newConversationFromFilter && (\n <FormSheet.Action\n title={`New conversation in ${newConversationFromFilter.name}`}\n onPress={handleFilterPress}\n accessibilityHint=\"Creates a conversation pre-scoped to the current filter\"\n />\n )}\n {canCreateGroupsConversations && (\n <FormSheet.Action\n title=\"Group\"\n onPress={handleGroupPress}\n accessibilityHint=\"Opens group selection screen\"\n />\n )}\n {canCreateServicesConversations && (\n <FormSheet.Action\n title=\"Team\"\n onPress={handleTeamPress}\n accessibilityHint=\"Opens team selection screen\"\n />\n )}\n {showDirectMessageOption && (\n <FormSheet.Action\n title=\"Direct message\"\n onPress={handleDirectMessagePress}\n disabled={directMessagesDisabled}\n disabledReason={directMessagesDisabled ? 'Disabled in chat settings' : undefined}\n accessibilityHint=\"Opens direct message recipient selection screen\"\n />\n )}\n </FormSheet.Root>\n )\n}\n"]}
|
|
@@ -115,7 +115,7 @@ export const ListHeaderComponent = () => {
|
|
|
115
115
|
<View style={styles.headingRow}>
|
|
116
116
|
<View style={styles.titleContainer}>
|
|
117
117
|
<Heading numberOfLines={1} variant="h2">
|
|
118
|
-
|
|
118
|
+
Conversations
|
|
119
119
|
</Heading>
|
|
120
120
|
<TextButton onPress={alertMarkAllRead} disabled={isPending} maxFontSizeMultiplier={MAX_FONT_SIZE_MULTIPLIER_LANDMARK} accessibilityShowsLargeContentViewer accessibilityLargeContentTitle="Mark all read">
|
|
121
121
|
Mark all read
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"list_header_component.js","sourceRoot":"","sources":["../../../../src/screens/conversations/components/list_header_component.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAa,aAAa,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAA;AAC7E,OAAO,KAAK,EAAE,EAAE,WAAW,EAAE,OAAO,EAAE,MAAM,OAAO,CAAA;AACnD,OAAO,EA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Aa,EAAE,qBAAqB,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;YAC5C,iBAAiB,EAAE,sBAAsB;SAC1C;QACD,cAAc,EAAE;YACd,GAAG,EAAE,CAAC;SACP;QACD,gBAAgB,EAAE;YAChB,aAAa,EAAE,KAAK;YACpB,GAAG,EAAE,CAAC;YACN,UAAU,EAAE,QAAQ;SACrB;QACD,cAAc,EAAE;YACd,aAAa,EAAE,CAAC;SACjB;QACD,SAAS,EAAE;YACT,aAAa,EAAE,KAAK;YACpB,cAAc,EAAE,YAAY;YAC5B,GAAG,EAAE,CAAC;YACN,iBAAiB,EAAE,sBAAsB;YACzC,QAAQ,EAAE,CAAC;SACZ;QACD,YAAY,EAAE;YACZ,IAAI,EAAE,CAAC;YACP,QAAQ,EAAE,EAAE;SACb;KACF,CAAC,CAAA;AACJ,CAAC,CAAA","sourcesContent":["import { RouteProp, useNavigation, useRoute } from '@react-navigation/native'\nimport React, { useCallback, useMemo } from 'react'\nimport { Alert, ScrollView, StyleSheet, View } from 'react-native'\nimport { Heading, TextButton, ToggleButton } from '../../../components'\nimport {\n useAtFontScaleBreakpoint,\n useCanCreateConversations,\n useCurrentPersonCache,\n useDirectMessagesEnabled,\n useHasDirectMessages,\n useNewConversationEntry,\n useTheme,\n} from '../../../hooks'\nimport { useMarkAllRead } from '../../../hooks/use_conversations_actions'\nimport { useCanDisplayGroups } from '../../../hooks/use_groups'\nimport { useNewConversationFromFilter } from '../../../hooks/use_new_conversation_from_filter'\nimport { GraphId } from '../../../types/resources/group_resource'\nimport { MAX_FONT_SIZE_MULTIPLIER_LANDMARK } from '../../../utils'\nimport { Haptic } from '../../../utils/native_adapters'\nimport { ConversationsScreenProps } from '../conversations_screen'\nimport { ChatGroupBadge } from './chat_group_badge'\nimport { ListHeaderActionButton } from './list_header_action_button'\n\nconst ROW_PADDING_HORIZONTAL = 16\n\nenum FilterTypes {\n All = 'All',\n Groups = 'Groups',\n Teams = 'Teams',\n DMs = 'DMs',\n More = 'More',\n}\n\nexport const ListHeaderComponent = () => {\n const navigation = useNavigation()\n const canFilterByTeams = useCanDisplayGroups({ source_app_name: 'Services', source_type: 'Team' })\n const canFilterByGroups = useCanDisplayGroups({ source_app_name: 'Groups', source_type: 'Group' })\n const directMessagesEnabled = useDirectMessagesEnabled()\n const hasDirectMessages = useHasDirectMessages()\n const canFilterByDMs = directMessagesEnabled && hasDirectMessages\n const route = useRoute<RouteProp<ConversationsScreenProps['route']>>()\n const {\n chat_group_graph_id,\n group_source_app_name = '',\n show_direct_messages,\n } = route.params || {}\n const currentPersonCache = useCurrentPersonCache()\n const { markAllRead, isPending } = useMarkAllRead()\n const canCreateConversations = useCanCreateConversations()\n const entryMode = useNewConversationEntry()\n const newConversationFromFilter = useNewConversationFromFilter(\n chat_group_graph_id as GraphId | undefined\n )\n\n const active: FilterTypes = useMemo(() => {\n if (chat_group_graph_id) {\n return FilterTypes.More\n } else if (/groups/i.test(group_source_app_name)) {\n return FilterTypes.Groups\n } else if (/services/i.test(group_source_app_name)) {\n return FilterTypes.Teams\n } else if (show_direct_messages) {\n return FilterTypes.DMs\n }\n\n return FilterTypes.All\n }, [chat_group_graph_id, group_source_app_name, show_direct_messages])\n\n const handleNewConversationNavigation = useCallback(() => {\n if (newConversationFromFilter || entryMode === 'select_type') {\n return navigation.navigate('ConversationSelectType', {\n ...route.params,\n newConversationFromFilter,\n })\n }\n\n if (entryMode === 'groups') {\n return navigation.navigate('New', {\n screen: 'ConversationSelectGroupRecipients',\n params: { ...route.params },\n })\n }\n\n if (entryMode === 'teams') {\n return navigation.navigate('New', {\n screen: 'ConversationSelectTeamsILeadRecipients',\n params: { ...route.params },\n })\n }\n\n if (entryMode === 'direct_message') {\n return navigation.navigate('New', {\n screen: 'ConversationSelectDirectMessageRecipients',\n params: { ...route.params },\n })\n }\n }, [navigation, route.params, entryMode, newConversationFromFilter])\n\n const handleChatSettings = useCallback(() => {\n navigation.navigate('ChatSettings', {})\n }, [navigation])\n\n const handleOpenConversationFilters = useCallback(() => {\n navigation.navigate('ConversationFilters', {\n chat_group_graph_id,\n group_source_app_name,\n show_direct_messages,\n })\n }, [navigation, chat_group_graph_id, group_source_app_name, show_direct_messages])\n\n const handleMarkAllRead = useCallback(() => {\n currentPersonCache.update({ unreadCount: 0 })\n Haptic.notificationSuccess()\n markAllRead()\n }, [currentPersonCache, markAllRead])\n\n const alertMarkAllRead = useCallback(() => {\n if (active === FilterTypes.All) return handleMarkAllRead()\n\n Alert.alert('Mark all read', 'This includes conversations not shown by the current filter.', [\n { text: 'Cancel' },\n { text: 'OK', onPress: () => handleMarkAllRead() },\n ])\n }, [active, handleMarkAllRead])\n\n const hasSomeSourceFilterCapability = canFilterByTeams || canFilterByGroups\n const hasMultiSourceFilterCapabilities = canFilterByTeams && canFilterByGroups\n const showFilterRow = hasMultiSourceFilterCapabilities || canFilterByDMs\n const shouldShowHeaderFiltersButton = hasSomeSourceFilterCapability && !showFilterRow\n const moreFiltersButtonA11yLabel = shouldShowHeaderFiltersButton\n ? 'View filters'\n : 'View more filters'\n\n const moreFiltersButtonProps = {\n onPress: handleOpenConversationFilters,\n active: active === FilterTypes.More,\n iconNameRight: 'general.threeReducingHorizontalBars' as const,\n accessibilityLabel: moreFiltersButtonA11yLabel,\n }\n\n const styles = useStyles({ shouldShowHeaderFiltersButton })\n\n return (\n <View style={styles.listHeader}>\n <View style={styles.headingRow}>\n <View style={styles.titleContainer}>\n <Heading numberOfLines={1} variant=\"h2\">\n Conversationz\n </Heading>\n <TextButton\n onPress={alertMarkAllRead}\n disabled={isPending}\n maxFontSizeMultiplier={MAX_FONT_SIZE_MULTIPLIER_LANDMARK}\n accessibilityShowsLargeContentViewer\n accessibilityLargeContentTitle=\"Mark all read\"\n >\n Mark all read\n </TextButton>\n </View>\n <View style={styles.actionsContainer}>\n {canCreateConversations && (\n <ListHeaderActionButton\n name=\"churchCenter.signups\"\n onPress={handleNewConversationNavigation}\n accessibilityLabel=\"New conversation\"\n testID=\"conversations-new-conversation-button\"\n maxFontSizeMultiplier={MAX_FONT_SIZE_MULTIPLIER_LANDMARK}\n />\n )}\n <ListHeaderActionButton\n name=\"general.cog\"\n onPress={handleChatSettings}\n accessibilityLabel=\"Chat settings\"\n maxFontSizeMultiplier={MAX_FONT_SIZE_MULTIPLIER_LANDMARK}\n />\n {shouldShowHeaderFiltersButton && <ToggleButton {...moreFiltersButtonProps} />}\n </View>\n </View>\n {showFilterRow && (\n <ScrollView\n horizontal\n showsHorizontalScrollIndicator={false}\n contentContainerStyle={styles.filterRow}\n accessibilityRole=\"toolbar\"\n >\n <ToggleButton\n title={FilterTypes.All}\n active={active === FilterTypes.All}\n onPress={() =>\n navigation.setParams({\n chat_group_graph_id: undefined,\n group_source_app_name: undefined,\n show_direct_messages: undefined,\n })\n }\n accessibilityLabel=\"Show all conversations\"\n style={styles.filterButton}\n />\n {canFilterByGroups && (\n <ToggleButton\n title={FilterTypes.Groups}\n active={active === FilterTypes.Groups}\n onPress={() =>\n navigation.setParams({\n chat_group_graph_id: undefined,\n group_source_app_name: 'Groups',\n show_direct_messages: undefined,\n })\n }\n accessibilityLabel=\"Filter to group conversations\"\n style={styles.filterButton}\n />\n )}\n {canFilterByTeams && (\n <ToggleButton\n title={FilterTypes.Teams}\n active={active === FilterTypes.Teams}\n onPress={() =>\n navigation.setParams({\n chat_group_graph_id: undefined,\n group_source_app_name: 'Services',\n show_direct_messages: undefined,\n })\n }\n accessibilityLabel=\"Filter to team conversations\"\n style={styles.filterButton}\n />\n )}\n {canFilterByDMs && (\n <ToggleButton\n title={FilterTypes.DMs}\n active={active === FilterTypes.DMs}\n onPress={() =>\n navigation.setParams({\n chat_group_graph_id: undefined,\n group_source_app_name: undefined,\n show_direct_messages: true,\n })\n }\n accessibilityLabel=\"Filter to direct message conversations\"\n style={styles.filterButton}\n />\n )}\n <ToggleButton {...moreFiltersButtonProps} />\n </ScrollView>\n )}\n <ChatGroupBadge rowPaddingHorizontal={ROW_PADDING_HORIZONTAL} />\n </View>\n )\n}\n\nconst useStyles = ({\n shouldShowHeaderFiltersButton,\n}: {\n shouldShowHeaderFiltersButton: boolean\n}) => {\n const theme = useTheme()\n const atFontScaleBreakpoint = useAtFontScaleBreakpoint(\n shouldShowHeaderFiltersButton ? 1.2 : undefined\n )\n\n return StyleSheet.create({\n listHeader: {\n borderBottomWidth: 1,\n borderBottomColor: theme.colors.fillColorNeutral050Base,\n paddingBottom: 16,\n gap: 16,\n },\n headingRow: {\n gap: 12,\n flexDirection: atFontScaleBreakpoint ? 'column' : 'row',\n alignItems: atFontScaleBreakpoint ? 'flex-start' : 'center',\n justifyContent: 'space-between',\n paddingBottom: atFontScaleBreakpoint ? 4 : 0,\n paddingHorizontal: ROW_PADDING_HORIZONTAL,\n },\n titleContainer: {\n gap: 8,\n },\n actionsContainer: {\n flexDirection: 'row',\n gap: 8,\n alignItems: 'center',\n },\n markAllReadRow: {\n paddingBottom: 4,\n },\n filterRow: {\n flexDirection: 'row',\n justifyContent: 'flex-start',\n gap: 8,\n paddingHorizontal: ROW_PADDING_HORIZONTAL,\n flexGrow: 1,\n },\n filterButton: {\n flex: 1,\n minWidth: 65,\n },\n })\n}\n"]}
|
|
1
|
+
{"version":3,"file":"list_header_component.js","sourceRoot":"","sources":["../../../../src/screens/conversations/components/list_header_component.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAa,aAAa,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAA;AAC7E,OAAO,KAAK,EAAE,EAAE,WAAW,EAAE,OAAO,EAAE,MAAM,OAAO,CAAA;AACnD,OAAO,EAAE,KAAK,EAAE,UAAU,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,cAAc,CAAA;AAClE,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAA;AACvE,OAAO,EACL,wBAAwB,EACxB,yBAAyB,EACzB,qBAAqB,EACrB,wBAAwB,EACxB,oBAAoB,EACpB,uBAAuB,EACvB,QAAQ,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,EAAE;YACd,aAAa,EAAE,CAAC;SACjB;QACD,SAAS,EAAE;YACT,aAAa,EAAE,KAAK;YACpB,cAAc,EAAE,YAAY;YAC5B,GAAG,EAAE,CAAC;YACN,iBAAiB,EAAE,sBAAsB;YACzC,QAAQ,EAAE,CAAC;SACZ;QACD,YAAY,EAAE;YACZ,IAAI,EAAE,CAAC;YACP,QAAQ,EAAE,EAAE;SACb;KACF,CAAC,CAAA;AACJ,CAAC,CAAA","sourcesContent":["import { RouteProp, useNavigation, useRoute } from '@react-navigation/native'\nimport React, { useCallback, useMemo } from 'react'\nimport { Alert, ScrollView, StyleSheet, View } from 'react-native'\nimport { Heading, TextButton, ToggleButton } from '../../../components'\nimport {\n useAtFontScaleBreakpoint,\n useCanCreateConversations,\n useCurrentPersonCache,\n useDirectMessagesEnabled,\n useHasDirectMessages,\n useNewConversationEntry,\n useTheme,\n} from '../../../hooks'\nimport { useMarkAllRead } from '../../../hooks/use_conversations_actions'\nimport { useCanDisplayGroups } from '../../../hooks/use_groups'\nimport { useNewConversationFromFilter } from '../../../hooks/use_new_conversation_from_filter'\nimport { GraphId } from '../../../types/resources/group_resource'\nimport { MAX_FONT_SIZE_MULTIPLIER_LANDMARK } from '../../../utils'\nimport { Haptic } from '../../../utils/native_adapters'\nimport { ConversationsScreenProps } from '../conversations_screen'\nimport { ChatGroupBadge } from './chat_group_badge'\nimport { ListHeaderActionButton } from './list_header_action_button'\n\nconst ROW_PADDING_HORIZONTAL = 16\n\nenum FilterTypes {\n All = 'All',\n Groups = 'Groups',\n Teams = 'Teams',\n DMs = 'DMs',\n More = 'More',\n}\n\nexport const ListHeaderComponent = () => {\n const navigation = useNavigation()\n const canFilterByTeams = useCanDisplayGroups({ source_app_name: 'Services', source_type: 'Team' })\n const canFilterByGroups = useCanDisplayGroups({ source_app_name: 'Groups', source_type: 'Group' })\n const directMessagesEnabled = useDirectMessagesEnabled()\n const hasDirectMessages = useHasDirectMessages()\n const canFilterByDMs = directMessagesEnabled && hasDirectMessages\n const route = useRoute<RouteProp<ConversationsScreenProps['route']>>()\n const {\n chat_group_graph_id,\n group_source_app_name = '',\n show_direct_messages,\n } = route.params || {}\n const currentPersonCache = useCurrentPersonCache()\n const { markAllRead, isPending } = useMarkAllRead()\n const canCreateConversations = useCanCreateConversations()\n const entryMode = useNewConversationEntry()\n const newConversationFromFilter = useNewConversationFromFilter(\n chat_group_graph_id as GraphId | undefined\n )\n\n const active: FilterTypes = useMemo(() => {\n if (chat_group_graph_id) {\n return FilterTypes.More\n } else if (/groups/i.test(group_source_app_name)) {\n return FilterTypes.Groups\n } else if (/services/i.test(group_source_app_name)) {\n return FilterTypes.Teams\n } else if (show_direct_messages) {\n return FilterTypes.DMs\n }\n\n return FilterTypes.All\n }, [chat_group_graph_id, group_source_app_name, show_direct_messages])\n\n const handleNewConversationNavigation = useCallback(() => {\n if (newConversationFromFilter || entryMode === 'select_type') {\n return navigation.navigate('ConversationSelectType', {\n ...route.params,\n newConversationFromFilter,\n })\n }\n\n if (entryMode === 'groups') {\n return navigation.navigate('New', {\n screen: 'ConversationSelectGroupRecipients',\n params: { ...route.params },\n })\n }\n\n if (entryMode === 'teams') {\n return navigation.navigate('New', {\n screen: 'ConversationSelectTeamsILeadRecipients',\n params: { ...route.params },\n })\n }\n\n if (entryMode === 'direct_message') {\n return navigation.navigate('New', {\n screen: 'ConversationSelectDirectMessageRecipients',\n params: { ...route.params },\n })\n }\n }, [navigation, route.params, entryMode, newConversationFromFilter])\n\n const handleChatSettings = useCallback(() => {\n navigation.navigate('ChatSettings', {})\n }, [navigation])\n\n const handleOpenConversationFilters = useCallback(() => {\n navigation.navigate('ConversationFilters', {\n chat_group_graph_id,\n group_source_app_name,\n show_direct_messages,\n })\n }, [navigation, chat_group_graph_id, group_source_app_name, show_direct_messages])\n\n const handleMarkAllRead = useCallback(() => {\n currentPersonCache.update({ unreadCount: 0 })\n Haptic.notificationSuccess()\n markAllRead()\n }, [currentPersonCache, markAllRead])\n\n const alertMarkAllRead = useCallback(() => {\n if (active === FilterTypes.All) return handleMarkAllRead()\n\n Alert.alert('Mark all read', 'This includes conversations not shown by the current filter.', [\n { text: 'Cancel' },\n { text: 'OK', onPress: () => handleMarkAllRead() },\n ])\n }, [active, handleMarkAllRead])\n\n const hasSomeSourceFilterCapability = canFilterByTeams || canFilterByGroups\n const hasMultiSourceFilterCapabilities = canFilterByTeams && canFilterByGroups\n const showFilterRow = hasMultiSourceFilterCapabilities || canFilterByDMs\n const shouldShowHeaderFiltersButton = hasSomeSourceFilterCapability && !showFilterRow\n const moreFiltersButtonA11yLabel = shouldShowHeaderFiltersButton\n ? 'View filters'\n : 'View more filters'\n\n const moreFiltersButtonProps = {\n onPress: handleOpenConversationFilters,\n active: active === FilterTypes.More,\n iconNameRight: 'general.threeReducingHorizontalBars' as const,\n accessibilityLabel: moreFiltersButtonA11yLabel,\n }\n\n const styles = useStyles({ shouldShowHeaderFiltersButton })\n\n return (\n <View style={styles.listHeader}>\n <View style={styles.headingRow}>\n <View style={styles.titleContainer}>\n <Heading numberOfLines={1} variant=\"h2\">\n Conversations\n </Heading>\n <TextButton\n onPress={alertMarkAllRead}\n disabled={isPending}\n maxFontSizeMultiplier={MAX_FONT_SIZE_MULTIPLIER_LANDMARK}\n accessibilityShowsLargeContentViewer\n accessibilityLargeContentTitle=\"Mark all read\"\n >\n Mark all read\n </TextButton>\n </View>\n <View style={styles.actionsContainer}>\n {canCreateConversations && (\n <ListHeaderActionButton\n name=\"churchCenter.signups\"\n onPress={handleNewConversationNavigation}\n accessibilityLabel=\"New conversation\"\n testID=\"conversations-new-conversation-button\"\n maxFontSizeMultiplier={MAX_FONT_SIZE_MULTIPLIER_LANDMARK}\n />\n )}\n <ListHeaderActionButton\n name=\"general.cog\"\n onPress={handleChatSettings}\n accessibilityLabel=\"Chat settings\"\n maxFontSizeMultiplier={MAX_FONT_SIZE_MULTIPLIER_LANDMARK}\n />\n {shouldShowHeaderFiltersButton && <ToggleButton {...moreFiltersButtonProps} />}\n </View>\n </View>\n {showFilterRow && (\n <ScrollView\n horizontal\n showsHorizontalScrollIndicator={false}\n contentContainerStyle={styles.filterRow}\n accessibilityRole=\"toolbar\"\n >\n <ToggleButton\n title={FilterTypes.All}\n active={active === FilterTypes.All}\n onPress={() =>\n navigation.setParams({\n chat_group_graph_id: undefined,\n group_source_app_name: undefined,\n show_direct_messages: undefined,\n })\n }\n accessibilityLabel=\"Show all conversations\"\n style={styles.filterButton}\n />\n {canFilterByGroups && (\n <ToggleButton\n title={FilterTypes.Groups}\n active={active === FilterTypes.Groups}\n onPress={() =>\n navigation.setParams({\n chat_group_graph_id: undefined,\n group_source_app_name: 'Groups',\n show_direct_messages: undefined,\n })\n }\n accessibilityLabel=\"Filter to group conversations\"\n style={styles.filterButton}\n />\n )}\n {canFilterByTeams && (\n <ToggleButton\n title={FilterTypes.Teams}\n active={active === FilterTypes.Teams}\n onPress={() =>\n navigation.setParams({\n chat_group_graph_id: undefined,\n group_source_app_name: 'Services',\n show_direct_messages: undefined,\n })\n }\n accessibilityLabel=\"Filter to team conversations\"\n style={styles.filterButton}\n />\n )}\n {canFilterByDMs && (\n <ToggleButton\n title={FilterTypes.DMs}\n active={active === FilterTypes.DMs}\n onPress={() =>\n navigation.setParams({\n chat_group_graph_id: undefined,\n group_source_app_name: undefined,\n show_direct_messages: true,\n })\n }\n accessibilityLabel=\"Filter to direct message conversations\"\n style={styles.filterButton}\n />\n )}\n <ToggleButton {...moreFiltersButtonProps} />\n </ScrollView>\n )}\n <ChatGroupBadge rowPaddingHorizontal={ROW_PADDING_HORIZONTAL} />\n </View>\n )\n}\n\nconst useStyles = ({\n shouldShowHeaderFiltersButton,\n}: {\n shouldShowHeaderFiltersButton: boolean\n}) => {\n const theme = useTheme()\n const atFontScaleBreakpoint = useAtFontScaleBreakpoint(\n shouldShowHeaderFiltersButton ? 1.2 : undefined\n )\n\n return StyleSheet.create({\n listHeader: {\n borderBottomWidth: 1,\n borderBottomColor: theme.colors.fillColorNeutral050Base,\n paddingBottom: 16,\n gap: 16,\n },\n headingRow: {\n gap: 12,\n flexDirection: atFontScaleBreakpoint ? 'column' : 'row',\n alignItems: atFontScaleBreakpoint ? 'flex-start' : 'center',\n justifyContent: 'space-between',\n paddingBottom: atFontScaleBreakpoint ? 4 : 0,\n paddingHorizontal: ROW_PADDING_HORIZONTAL,\n },\n titleContainer: {\n gap: 8,\n },\n actionsContainer: {\n flexDirection: 'row',\n gap: 8,\n alignItems: 'center',\n },\n markAllReadRow: {\n paddingBottom: 4,\n },\n filterRow: {\n flexDirection: 'row',\n justifyContent: 'flex-start',\n gap: 8,\n paddingHorizontal: ROW_PADDING_HORIZONTAL,\n flexGrow: 1,\n },\n filterButton: {\n flex: 1,\n minWidth: 65,\n },\n })\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"settings_screen.d.ts","sourceRoot":"","sources":["../../src/screens/settings_screen.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,iBAAiB,EAAiB,MAAM,0BAA0B,CAAA;AAC3E,OAAO,KAAsB,MAAM,OAAO,CAAA;AAQ1C,MAAM,MAAM,mBAAmB,GAAG,iBAAiB,CAAC,EAAE,CAAC,CAAA;AAEvD,wBAAgB,cAAc,CAAC,EAAE,EAAE,mBAAmB,
|
|
1
|
+
{"version":3,"file":"settings_screen.d.ts","sourceRoot":"","sources":["../../src/screens/settings_screen.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,iBAAiB,EAAiB,MAAM,0BAA0B,CAAA;AAC3E,OAAO,KAAsB,MAAM,OAAO,CAAA;AAQ1C,MAAM,MAAM,mBAAmB,GAAG,iBAAiB,CAAC,EAAE,CAAC,CAAA;AAEvD,wBAAgB,cAAc,CAAC,EAAE,EAAE,mBAAmB,qBAyCrD"}
|
|
@@ -28,8 +28,7 @@ export function SettingsScreen({}) {
|
|
|
28
28
|
<View style={styles.settingRowText}>
|
|
29
29
|
<Text>Allow direct messages</Text>
|
|
30
30
|
<Text variant="tertiary">
|
|
31
|
-
When
|
|
32
|
-
be turned off.
|
|
31
|
+
When disabled, you won't be able to participate in direct messages.
|
|
33
32
|
</Text>
|
|
34
33
|
</View>
|
|
35
34
|
<Switch value={!directMessagesDisabled} onValueChange={enabled => setDirectMessagesDisabled(!enabled)} disabled={isMutating}/>
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"settings_screen.js","sourceRoot":"","sources":["../../src/screens/settings_screen.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAA;AAC9D,OAAO,EAAqB,aAAa,EAAE,MAAM,0BAA0B,CAAA;AAC3E,OAAO,KAAK,EAAE,EAAE,WAAW,EAAE,MAAM,OAAO,CAAA;AAC1C,OAAO,EAAE,QAAQ,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,cAAc,CAAA;AACzD,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,eAAe,CAAA;AACnD,OAAO,EAAE,MAAM,EAAE,MAAM,8BAA8B,CAAA;AACrD,OAAO,EAAE,wBAAwB,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAA;AAC7D,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAA;AAClD,OAAO,EAAE,iBAAiB,EAAE,MAAM,8BAA8B,CAAA;AAIhE,MAAM,UAAU,cAAc,CAAC,EAAuB;IACpD,MAAM,MAAM,GAAG,SAAS,EAAE,CAAA;IAC1B,MAAM,EAAE,sBAAsB,EAAE,yBAAyB,EAAE,UAAU,EAAE,GAAG,iBAAiB,EAAE,CAAA;IAC7F,MAAM,qBAAqB,GAAG,wBAAwB,EAAE,CAAA;IACxD,MAAM,OAAO,GAAG,UAAU,EAAE,CAAA;IAC5B,MAAM,UAAU,GAAG,aAAa,EAAE,CAAA;IAElC,MAAM,0BAA0B,GAAG,WAAW,CAAC,GAAG,EAAE;QAClD,UAAU,CAAC,QAAQ,CAAC,sBAAsB,EAAE,EAAE,CAAC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Ae,EAAE,EAAE;YACnB,iBAAiB,EAAE,CAAC;YACpB,iBAAiB,EAAE,MAAM,CAAC,sBAAsB;SACjD;QACD,OAAO,EAAE;YACP,KAAK,EAAE,MAAM,CAAC,wBAAwB;SACvC;KACF,CAAC,CAAA;AACJ,CAAC,CAAA","sourcesContent":["import { PlatformPressable } from '@react-navigation/elements'\nimport { StaticScreenProps, useNavigation } from '@react-navigation/native'\nimport React, { useCallback } from 'react'\nimport { Platform, StyleSheet, View } from 'react-native'\nimport { Heading, Icon, Text } from '../components'\nimport { Switch } from '../components/display/switch'\nimport { useDirectMessagesEnabled, useTheme } from '../hooks'\nimport { useAppName } from '../hooks/use_app_name'\nimport { usePersonSettings } from '../hooks/use_person_settings'\n\nexport type SettingsScreenProps = StaticScreenProps<{}>\n\nexport function SettingsScreen({}: SettingsScreenProps) {\n const styles = useStyles()\n const { directMessagesDisabled, setDirectMessagesDisabled, isMutating } = usePersonSettings()\n const directMessagesEnabled = useDirectMessagesEnabled()\n const appName = useAppName()\n const navigation = useNavigation()\n\n const handleNotificationSettings = useCallback(() => {\n navigation.navigate('NotificationSettings', {})\n }, [navigation])\n\n const handleGetHelp = useCallback(() => {\n navigation.navigate('GetHelp', { type: 'chat' })\n }, [navigation])\n\n return (\n <View style={styles.container}>\n <View style={styles.sectionOuter}>\n <View style={styles.sectionHeader}>\n <Heading variant=\"h2\">Messages</Heading>\n </View>\n {directMessagesEnabled && (\n <View style={styles.settingRow}>\n <View style={styles.settingRowText}>\n <Text>Allow direct messages</Text>\n <Text variant=\"tertiary\">\n When disabled, you won't be able to participate in direct messages.\n </Text>\n </View>\n <Switch\n value={!directMessagesDisabled}\n onValueChange={enabled => setDirectMessagesDisabled(!enabled)}\n disabled={isMutating}\n />\n </View>\n )}\n <NavRow label=\"Notification settings\" onPress={handleNotificationSettings} />\n {appName !== 'services' && <NavRow label=\"Get help\" onPress={handleGetHelp} />}\n </View>\n </View>\n )\n}\n\ninterface NavRowProps {\n label: string\n onPress: () => void\n}\n\nfunction NavRow({ label, onPress }: NavRowProps) {\n const styles = useNavRowStyles()\n return (\n <PlatformPressable\n style={styles.container}\n onPress={onPress}\n accessibilityRole=\"button\"\n accessibilityLabel={label}\n >\n <View style={styles.inner}>\n <Text>{label}</Text>\n {Platform.OS === 'ios' && (\n <Icon name=\"general.rightChevron\" size={16} style={styles.chevron} />\n )}\n </View>\n </PlatformPressable>\n )\n}\n\nconst useStyles = () => {\n const { colors } = useTheme()\n return StyleSheet.create({\n container: {\n flex: 1,\n },\n sectionOuter: {\n paddingLeft: 16,\n },\n sectionHeader: {\n paddingRight: 16,\n paddingTop: 24,\n paddingBottom: 12,\n borderBottomWidth: 1,\n borderBottomColor: colors.borderColorDefaultBase,\n },\n settingRow: {\n flexDirection: 'row',\n alignItems: 'flex-start',\n justifyContent: 'space-between',\n paddingRight: 16,\n paddingVertical: 12,\n borderBottomWidth: 1,\n borderBottomColor: colors.borderColorDefaultBase,\n },\n settingRowText: {\n flex: 1,\n gap: 8,\n },\n })\n}\n\nconst useNavRowStyles = () => {\n const { colors } = useTheme()\n return StyleSheet.create({\n container: {\n paddingLeft: 0,\n },\n inner: {\n flexDirection: 'row',\n alignItems: 'center',\n justifyContent: 'space-between',\n paddingRight: 16,\n paddingVertical: 14,\n borderBottomWidth: 1,\n borderBottomColor: colors.borderColorDefaultBase,\n },\n chevron: {\n color: colors.iconColorDefaultDisabled,\n },\n })\n}\n"]}
|
|
@@ -3,22 +3,13 @@ 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
|
export type ConversationDisabledReason = 'safety_check' | 'direct_messages_disabled';
|
|
8
|
-
export interface ConversationPreviewData {
|
|
9
|
-
kind: 'reaction' | 'message';
|
|
10
|
-
authorName: string;
|
|
11
|
-
value: ReactionCountResource['value'] | null;
|
|
12
|
-
text: string;
|
|
13
|
-
createdAt: string;
|
|
14
|
-
}
|
|
15
7
|
export interface ConversationResource {
|
|
16
8
|
type: 'Conversation';
|
|
17
9
|
id: number;
|
|
18
10
|
badges?: ConversationBadgeResource[];
|
|
19
11
|
analyticsMetadata?: AnalyticsMetadataResource;
|
|
20
12
|
conversationMembership?: Partial<ConversationMembershipResource>;
|
|
21
|
-
conversationPreview: ConversationPreviewData | null;
|
|
22
13
|
createdAt: string;
|
|
23
14
|
deleted?: boolean;
|
|
24
15
|
directMessage?: boolean;
|
|
@@ -41,7 +32,7 @@ export interface ConversationResource {
|
|
|
41
32
|
repliesDisabled: boolean;
|
|
42
33
|
title: string;
|
|
43
34
|
unreadCount: number;
|
|
44
|
-
|
|
35
|
+
unreadReactionCount?: number;
|
|
45
36
|
updatedAt: string;
|
|
46
37
|
}
|
|
47
38
|
//# sourceMappingURL=conversation.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"conversation.d.ts","sourceRoot":"","sources":["../../../src/types/resources/conversation.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,sBAAsB,CAAA;AACrE,OAAO,EAAE,yBAAyB,EAAE,MAAM,sBAAsB,CAAA;AAChE,OAAO,EAAE,8BAA8B,EAAE,MAAM,2BAA2B,CAAA;AAC1E,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAA;AAChD,OAAO,EAAE,qBAAqB,EAAE,MAAM,kBAAkB,CAAA;
|
|
1
|
+
{"version":3,"file":"conversation.d.ts","sourceRoot":"","sources":["../../../src/types/resources/conversation.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,sBAAsB,CAAA;AACrE,OAAO,EAAE,yBAAyB,EAAE,MAAM,sBAAsB,CAAA;AAChE,OAAO,EAAE,8BAA8B,EAAE,MAAM,2BAA2B,CAAA;AAC1E,OAAO,EAAE,aAA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,CAAA;IACb,WAAW,EAAE,MAAM,CAAA;IACnB,mBAAmB,CAAC,EAAE,MAAM,CAAA;IAC5B,SAAS,EAAE,MAAM,CAAA;CAClB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"conversation.js","sourceRoot":"","sources":["../../../src/types/resources/conversation.ts"],"names":[],"mappings":"","sourcesContent":["import type { AnalyticsMetadataResource } from './analytics_metadata'\nimport { ConversationBadgeResource } from './conversation_badge'\nimport { ConversationMembershipResource } from './conversation_membership'\nimport { GroupResource } from './group_resource'\nimport { MemberAbilityResource } from './member_ability'\
|
|
1
|
+
{"version":3,"file":"conversation.js","sourceRoot":"","sources":["../../../src/types/resources/conversation.ts"],"names":[],"mappings":"","sourcesContent":["import type { AnalyticsMetadataResource } from './analytics_metadata'\nimport { ConversationBadgeResource } from './conversation_badge'\nimport { ConversationMembershipResource } from './conversation_membership'\nimport { GroupResource } from './group_resource'\nimport { MemberAbilityResource } from './member_ability'\n\nexport type ConversationDisabledReason = 'safety_check' | 'direct_messages_disabled'\n\nexport interface ConversationResource {\n type: 'Conversation'\n id: number\n badges?: ConversationBadgeResource[]\n analyticsMetadata?: AnalyticsMetadataResource\n conversationMembership?: Partial<ConversationMembershipResource>\n createdAt: string\n deleted?: boolean\n directMessage?: boolean\n disabled?: boolean\n disabledReason?: ConversationDisabledReason\n genderOption?: string | null\n groups?: GroupResource[]\n previewAvatarUrls?: string[]\n customAvatarType?: 'image' | 'icon' | 'emoji' | null\n customAvatarKey?: string | null\n customAvatarColor?: string | null\n customAvatarImageUrl?: string | null\n lastMessageAuthorId?: string\n lastMessageAuthorName?: string\n lastMessageCreatedAt?: string\n lastMessageTextPreview?: string\n latestReadMessageSortKey?: string\n memberAbility?: MemberAbilityResource\n muted: boolean\n repliesDisabled: boolean\n title: string\n unreadCount: number\n unreadReactionCount?: number // Derived from Jolt events\n updatedAt: string\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"conversation.d.ts","sourceRoot":"","sources":["../../../src/utils/request/conversation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,sCAAsC,CAAA;AAC9D,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAA;AAE5C,MAAM,WAAW,uBAAuB;IACtC,IAAI,EAAE,MAAM,CAAA;IACZ,mBAAmB,CAAC,EAAE,OAAO,CAAA;IAC7B,qBAAqB,CAAC,EAAE,MAAM,CAAA;IAC9B,oBAAoB,CAAC,EAAE,OAAO,CAAA;CAC/B;AAED,eAAO,MAAM,2BAA2B,GAAI,8EAKzC,OAAO,CAAC,uBAAuB,CAAM,KAAG,
|
|
1
|
+
{"version":3,"file":"conversation.d.ts","sourceRoot":"","sources":["../../../src/utils/request/conversation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,sCAAsC,CAAA;AAC9D,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAA;AAE5C,MAAM,WAAW,uBAAuB;IACtC,IAAI,EAAE,MAAM,CAAA;IACZ,mBAAmB,CAAC,EAAE,OAAO,CAAA;IAC7B,qBAAqB,CAAC,EAAE,MAAM,CAAA;IAC9B,oBAAoB,CAAC,EAAE,OAAO,CAAA;CAC/B;AAED,eAAO,MAAM,2BAA2B,GAAI,8EAKzC,OAAO,CAAC,uBAAuB,CAAM,KAAG,UAkD1C,CAAA"}
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
export const getConversationsRequestArgs = ({ gids, chat_group_graph_id, group_source_app_name, show_direct_messages, } = {}) => {
|
|
2
2
|
let filter;
|
|
3
3
|
if (chat_group_graph_id) {
|
|
4
|
-
filter = '
|
|
4
|
+
filter = 'group';
|
|
5
5
|
}
|
|
6
6
|
else if (show_direct_messages) {
|
|
7
7
|
filter = 'mine_or_not_empty,direct_message';
|
|
8
8
|
}
|
|
9
9
|
else if (group_source_app_name) {
|
|
10
|
-
filter = '
|
|
10
|
+
filter = 'group_source_app_name';
|
|
11
11
|
}
|
|
12
12
|
else {
|
|
13
13
|
filter = 'mine_or_not_empty';
|
|
@@ -25,7 +25,6 @@ export const getConversationsRequestArgs = ({ gids, chat_group_graph_id, group_s
|
|
|
25
25
|
Conversation: [
|
|
26
26
|
'created_at',
|
|
27
27
|
'badges',
|
|
28
|
-
'conversation_preview',
|
|
29
28
|
'disabled',
|
|
30
29
|
'disabled_reason',
|
|
31
30
|
'groups',
|
|
@@ -43,7 +42,6 @@ export const getConversationsRequestArgs = ({ gids, chat_group_graph_id, group_s
|
|
|
43
42
|
'replies_disabled',
|
|
44
43
|
'title',
|
|
45
44
|
'unread_count',
|
|
46
|
-
'unread_reaction',
|
|
47
45
|
'updated_at',
|
|
48
46
|
],
|
|
49
47
|
AnalyticsMetadata: ['metadata'],
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"conversation.js","sourceRoot":"","sources":["../../../src/utils/request/conversation.ts"],"names":[],"mappings":"AAUA,MAAM,CAAC,MAAM,2BAA2B,GAAG,CAAC,EAC1C,IAAI,EACJ,mBAAmB,EACnB,qBAAqB,EACrB,oBAAoB,MACgB,EAAE,EAAc,EAAE;IACtD,IAAI,MAAc,CAAA;IAClB,IAAI,mBAAmB,EAAE,CAAC;QACxB,MAAM,GAAG,
|
|
1
|
+
{"version":3,"file":"conversation.js","sourceRoot":"","sources":["../../../src/utils/request/conversation.ts"],"names":[],"mappings":"AAUA,MAAM,CAAC,MAAM,2BAA2B,GAAG,CAAC,EAC1C,IAAI,EACJ,mBAAmB,EACnB,qBAAqB,EACrB,oBAAoB,MACgB,EAAE,EAAc,EAAE;IACtD,IAAI,MAAc,CAAA;IAClB,IAAI,mBAAmB,EAAE,CAAC;QACxB,MAAM,GAAG,OAAO,CAAA;IAClB,CAAC;SAAM,IAAI,oBAAoB,EAAE,CAAC;QAChC,MAAM,GAAG,kCAAkC,CAAA;IAC7C,CAAC;SAAM,IAAI,qBAAqB,EAAE,CAAC;QACjC,MAAM,GAAG,uBAAuB,CAAA;IAClC,CAAC;SAAM,CAAC;QACN,MAAM,GAAG,mBAAmB,CAAA;IAC9B,CAAC;IAED,OAAO;QACL,GAAG,EAAE,mBAAmB;QACxB,IAAI,EAAE;YACJ,OAAO,EAAE,EAAE;YACX,KAAK,EAAE,eAAe;YACtB,MAAM;YACN,IAAI;YACJ,KAAK,EAAE,mBAAmB;YAC1B,qBAAqB;YACrB,MAAM,EAAE;gBACN,YAAY,EAAE;oBACZ,YAAY;oBACZ,QAAQ;oBACR,UAAU;oBACV,iBAAiB;oBACjB,QAAQ;oBACR,wBAAwB;oBACxB,0BAA0B;oBAC1B,yBAAyB;oBACzB,2BAA2B;oBAC3B,qBAAqB;oBACrB,oBAAoB;oBACpB,mBAAmB;oBACnB,qBAAqB;oBACrB,yBAAyB;oBACzB,gBAAgB;oBAChB,OAAO;oBACP,kBAAkB;oBAClB,OAAO;oBACP,cAAc;oBACd,YAAY;iBACb;gBACD,iBAAiB,EAAE,CAAC,UAAU,CAAC;gBAC/B,iBAAiB,EAAE,CAAC,UAAU,EAAE,mBAAmB,EAAE,MAAM,CAAC;aAC7D;YACD,OAAO,EAAE,CAAC,QAAQ,EAAE,oBAAoB,CAAC;SAC1C;KACF,CAAA;AACH,CAAC,CAAA","sourcesContent":["import { GraphId } from '../../types/resources/group_resource'\nimport { GetRequest } from '../client/types'\n\nexport interface ConversationRequestArgs {\n gids: string\n chat_group_graph_id?: GraphId\n group_source_app_name?: string\n show_direct_messages?: boolean\n}\n\nexport const getConversationsRequestArgs = ({\n gids,\n chat_group_graph_id,\n group_source_app_name,\n show_direct_messages,\n}: Partial<ConversationRequestArgs> = {}): GetRequest => {\n let filter: string\n if (chat_group_graph_id) {\n filter = 'group'\n } else if (show_direct_messages) {\n filter = 'mine_or_not_empty,direct_message'\n } else if (group_source_app_name) {\n filter = 'group_source_app_name'\n } else {\n filter = 'mine_or_not_empty'\n }\n\n return {\n url: '/me/conversations',\n data: {\n perPage: 20,\n order: '-last_message',\n filter,\n gids,\n group: chat_group_graph_id,\n group_source_app_name,\n fields: {\n Conversation: [\n 'created_at',\n 'badges',\n 'disabled',\n 'disabled_reason',\n 'groups',\n 'last_message_author_id',\n 'last_message_author_name',\n 'last_message_created_at',\n 'last_message_text_preview',\n 'preview_avatar_urls',\n 'custom_avatar_type',\n 'custom_avatar_key',\n 'custom_avatar_color',\n 'custom_avatar_image_url',\n 'member_ability',\n 'muted',\n 'replies_disabled',\n 'title',\n 'unread_count',\n 'updated_at',\n ],\n AnalyticsMetadata: ['metadata'],\n ConversationBadge: ['app_name', 'pco_resource_type', 'text'],\n },\n include: ['badges', 'analytics_metadata'],\n },\n }\n}\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@planningcenter/chat-react-native",
|
|
3
|
-
"version": "3.42.1-
|
|
3
|
+
"version": "3.42.1-rc.0",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "build/index.js",
|
|
6
6
|
"react-native": "./src/index.tsx",
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
"dependencies": {
|
|
27
27
|
"@fortawesome/fontawesome-svg-core": "^7.2.0",
|
|
28
28
|
"@fortawesome/react-native-fontawesome": "^0.3.2",
|
|
29
|
-
"@planningcenter/emoji-keyboard": "3.
|
|
29
|
+
"@planningcenter/emoji-keyboard": "3.38.0",
|
|
30
30
|
"lodash-inflection": "^1.5.0",
|
|
31
31
|
"react-compiler-runtime": "^1.0.0"
|
|
32
32
|
},
|
|
@@ -72,5 +72,5 @@
|
|
|
72
72
|
"react-native-url-polyfill": "^2.0.0",
|
|
73
73
|
"typescript": "~5.9.2"
|
|
74
74
|
},
|
|
75
|
-
"gitHead": "
|
|
75
|
+
"gitHead": "44af63192428afb33d5a0aa9c187abcad2f61959"
|
|
76
76
|
}
|
|
@@ -6,10 +6,8 @@ import {
|
|
|
6
6
|
useFontScale,
|
|
7
7
|
useScalableNumberOfLines,
|
|
8
8
|
} from '../../hooks'
|
|
9
|
-
import {
|
|
10
|
-
import { REACTION_EMOJIS, platformFontWeightBold } from '../../utils'
|
|
9
|
+
import { ConversationResource } from '../../types'
|
|
11
10
|
import { formatDatePreview } from '../../utils/date'
|
|
12
|
-
import { tokens } from '../../vendor/tapestry/tokens'
|
|
13
11
|
import { AvatarGroup, ConversationAvatar, Heading, Text, Badge, type BadgeProps } from '../display'
|
|
14
12
|
import { ConversationActions } from './conversation_actions'
|
|
15
13
|
import { MuteIndicator } from './mute_indicator'
|
|
@@ -32,26 +30,25 @@ export const ConversationPreview = ({
|
|
|
32
30
|
}: ConversationPreviewProps) => {
|
|
33
31
|
const styles = useStyles()
|
|
34
32
|
const {
|
|
35
|
-
|
|
33
|
+
lastMessageAuthorName,
|
|
36
34
|
lastMessageCreatedAt,
|
|
35
|
+
lastMessageTextPreview,
|
|
37
36
|
title,
|
|
38
37
|
unreadCount,
|
|
39
38
|
badges,
|
|
40
39
|
muted,
|
|
41
40
|
disabled,
|
|
42
|
-
unreadReaction,
|
|
43
41
|
} = conversation
|
|
44
42
|
|
|
45
43
|
const emptyConversation = !lastMessageCreatedAt
|
|
46
44
|
const fallbackIconName = emptyConversation ? 'people.noTextMessage' : 'general.person'
|
|
47
45
|
const hasMetaContent = lastMessageCreatedAt || unreadCount > 0 || muted
|
|
48
|
-
const isUnread = unreadCount > 0 || unreadReaction
|
|
49
46
|
|
|
50
47
|
const numberOfLinesScaledTitle = useScalableNumberOfLines(1)
|
|
51
48
|
const numberOfLinesScaledPreviewText = useScalableNumberOfLines(2)
|
|
52
49
|
|
|
53
|
-
const conversationPreviewText =
|
|
54
|
-
?
|
|
50
|
+
const conversationPreviewText = lastMessageTextPreview
|
|
51
|
+
? `${lastMessageAuthorName}: ${lastMessageTextPreview}`
|
|
55
52
|
: EMPTY_CONVERSATION_PREVIEW_TEXT
|
|
56
53
|
|
|
57
54
|
const conversationAccessibilityLabel = getConversationAccessibilityLabel({
|
|
@@ -72,20 +69,13 @@ export const ConversationPreview = ({
|
|
|
72
69
|
fallbackIconName={fallbackIconName}
|
|
73
70
|
/>
|
|
74
71
|
<View style={styles.conversationBody}>
|
|
75
|
-
<Heading
|
|
76
|
-
numberOfLines={numberOfLinesScaledTitle}
|
|
77
|
-
variant="h3"
|
|
78
|
-
style={[styles.title, isUnread && styles.unreadTitle]}
|
|
79
|
-
>
|
|
72
|
+
<Heading numberOfLines={numberOfLinesScaledTitle} variant="h3" style={styles.title}>
|
|
80
73
|
{title}
|
|
81
74
|
</Heading>
|
|
82
75
|
<Text
|
|
83
76
|
variant="tertiary"
|
|
84
77
|
numberOfLines={numberOfLinesScaledPreviewText}
|
|
85
|
-
style={
|
|
86
|
-
emptyConversation && styles.emptyConversationPreviewText,
|
|
87
|
-
isUnread && styles.unreadText,
|
|
88
|
-
]}
|
|
78
|
+
style={emptyConversation && styles.emptyConversationPreviewText}
|
|
89
79
|
>
|
|
90
80
|
{conversationPreviewText}
|
|
91
81
|
</Text>
|
|
@@ -93,9 +83,9 @@ export const ConversationPreview = ({
|
|
|
93
83
|
</View>
|
|
94
84
|
{hasMetaContent && (
|
|
95
85
|
<View style={styles.metaContainer}>
|
|
96
|
-
<Text variant="tertiary">{formatDatePreview(
|
|
86
|
+
<Text variant="tertiary">{formatDatePreview(lastMessageCreatedAt)}</Text>
|
|
97
87
|
<View style={styles.statusContainer}>
|
|
98
|
-
<UnreadCountBadge count={unreadCount}
|
|
88
|
+
<UnreadCountBadge count={unreadCount} showDot={muted} />
|
|
99
89
|
<MuteIndicator muted={muted} />
|
|
100
90
|
</View>
|
|
101
91
|
</View>
|
|
@@ -162,30 +152,6 @@ export const ConversationPreviewSkeleton = () => {
|
|
|
162
152
|
)
|
|
163
153
|
}
|
|
164
154
|
|
|
165
|
-
function reactionEmoji(value: ConversationPreviewData['value']): string | null {
|
|
166
|
-
if (!value) return null
|
|
167
|
-
return REACTION_EMOJIS[value] ?? null
|
|
168
|
-
}
|
|
169
|
-
|
|
170
|
-
function formatConversationPreviewText(preview: ConversationPreviewData) {
|
|
171
|
-
if (preview.kind === 'reaction') {
|
|
172
|
-
const emoji = reactionEmoji(preview.value)
|
|
173
|
-
return `${preview.authorName}${emoji ? ` ${emoji}` : ' reacted'} to: "${preview.text}"`
|
|
174
|
-
}
|
|
175
|
-
|
|
176
|
-
return `${preview.authorName}: ${preview.text}`
|
|
177
|
-
}
|
|
178
|
-
|
|
179
|
-
function formatConversationPreviewAccessibilityLabel(preview: ConversationPreviewData) {
|
|
180
|
-
const date = formatDatePreview(preview.createdAt)
|
|
181
|
-
|
|
182
|
-
if (preview.kind === 'reaction') {
|
|
183
|
-
return `${preview.authorName} reacted to your message sent ${date} and says ${preview.text}`
|
|
184
|
-
}
|
|
185
|
-
|
|
186
|
-
return `Last message sent ${date} from ${preview.authorName} and says ${preview.text}`
|
|
187
|
-
}
|
|
188
|
-
|
|
189
155
|
interface GetConversationAccessibilityLabelProps {
|
|
190
156
|
conversation: ConversationResource
|
|
191
157
|
showBadges: boolean
|
|
@@ -194,24 +160,29 @@ const getConversationAccessibilityLabel = ({
|
|
|
194
160
|
conversation,
|
|
195
161
|
showBadges,
|
|
196
162
|
}: GetConversationAccessibilityLabelProps) => {
|
|
197
|
-
const {
|
|
198
|
-
|
|
163
|
+
const {
|
|
164
|
+
badges,
|
|
165
|
+
title,
|
|
166
|
+
lastMessageAuthorName,
|
|
167
|
+
lastMessageTextPreview,
|
|
168
|
+
muted,
|
|
169
|
+
disabled,
|
|
170
|
+
unreadCount,
|
|
171
|
+
lastMessageCreatedAt,
|
|
172
|
+
} = conversation
|
|
199
173
|
|
|
200
174
|
const hasBadges = badges && showBadges
|
|
201
175
|
const hasUnreadMessages = unreadCount > 0
|
|
176
|
+
const hasLastMessage = lastMessageCreatedAt
|
|
202
177
|
|
|
203
178
|
const label = {
|
|
204
179
|
title,
|
|
205
180
|
badge: hasBadges ? `for ${badges[0]?.pcoResourceType} ${badges[0]?.text || ''}` : '',
|
|
206
181
|
disabled: disabled ? 'Disabled' : '',
|
|
207
182
|
muted: muted ? 'Muted' : '',
|
|
208
|
-
readStatus: hasUnreadMessages
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
? 'unread reaction'
|
|
212
|
-
: '',
|
|
213
|
-
lastMessage: conversationPreview
|
|
214
|
-
? formatConversationPreviewAccessibilityLabel(conversationPreview)
|
|
183
|
+
readStatus: hasUnreadMessages ? `${unreadCount} unread messages` : '',
|
|
184
|
+
lastMessage: hasLastMessage
|
|
185
|
+
? `Last message sent ${formatDatePreview(lastMessageCreatedAt)} from ${lastMessageAuthorName} and says ${lastMessageTextPreview}`
|
|
215
186
|
: EMPTY_CONVERSATION_PREVIEW_TEXT,
|
|
216
187
|
}
|
|
217
188
|
|
|
@@ -251,12 +222,6 @@ const useStyles = () => {
|
|
|
251
222
|
fontSize: 16,
|
|
252
223
|
color: colors.textColorDefaultPrimary,
|
|
253
224
|
},
|
|
254
|
-
unreadTitle: {
|
|
255
|
-
fontWeight: tokens.fontWeightBold,
|
|
256
|
-
},
|
|
257
|
-
unreadText: {
|
|
258
|
-
fontWeight: platformFontWeightBold,
|
|
259
|
-
},
|
|
260
225
|
titleLoading: {
|
|
261
226
|
width: 120,
|
|
262
227
|
height: 20,
|
|
@@ -4,21 +4,12 @@ import { useFontScale, useTheme } from '../../hooks'
|
|
|
4
4
|
import { MAX_FONT_SIZE_MULTIPLIER, platformFontWeightBold } from '../../utils'
|
|
5
5
|
import { Text } from '../display'
|
|
6
6
|
|
|
7
|
-
export const UnreadCountBadge = ({
|
|
8
|
-
count,
|
|
9
|
-
unreadReaction,
|
|
10
|
-
showDot,
|
|
11
|
-
}: {
|
|
12
|
-
count: number
|
|
13
|
-
unreadReaction: boolean
|
|
14
|
-
showDot: boolean
|
|
15
|
-
}) => {
|
|
7
|
+
export const UnreadCountBadge = ({ count, showDot }: { count: number; showDot: boolean }) => {
|
|
16
8
|
const styles = useStyles()
|
|
17
9
|
const displayCount = count > 99 ? '99+' : count
|
|
18
|
-
const isUnread = count > 0 || unreadReaction
|
|
19
10
|
|
|
20
|
-
if (
|
|
21
|
-
if (showDot
|
|
11
|
+
if (count === 0) return null
|
|
12
|
+
if (showDot) return <View style={styles.dot} />
|
|
22
13
|
|
|
23
14
|
return (
|
|
24
15
|
<View style={styles.badge}>
|
|
@@ -33,7 +24,7 @@ const useStyles = () => {
|
|
|
33
24
|
const { colors } = useTheme()
|
|
34
25
|
const dotScaleLimit = MAX_FONT_SIZE_MULTIPLIER * 1.5
|
|
35
26
|
const fontScale = useFontScale({ maxFontSizeMultiplier: dotScaleLimit })
|
|
36
|
-
const size =
|
|
27
|
+
const size = 8 * fontScale
|
|
37
28
|
|
|
38
29
|
return StyleSheet.create({
|
|
39
30
|
badge: {
|
|
@@ -16,7 +16,6 @@ export const getConversationRequestArgs = ({ conversation_id }: { conversation_i
|
|
|
16
16
|
'created_at',
|
|
17
17
|
'badges',
|
|
18
18
|
'conversation_membership',
|
|
19
|
-
'conversation_preview',
|
|
20
19
|
'gender_option',
|
|
21
20
|
'groups',
|
|
22
21
|
'last_message_author_id',
|
|
@@ -37,7 +36,6 @@ export const getConversationRequestArgs = ({ conversation_id }: { conversation_i
|
|
|
37
36
|
'replies_disabled',
|
|
38
37
|
'title',
|
|
39
38
|
'unread_count',
|
|
40
|
-
'unread_reaction',
|
|
41
39
|
'updated_at',
|
|
42
40
|
],
|
|
43
41
|
AnalyticsMetadata: ['metadata'],
|
|
@@ -63,7 +63,7 @@ export function useConversationJoltEvents({ conversationId }: Props) {
|
|
|
63
63
|
data: {
|
|
64
64
|
...prev.data,
|
|
65
65
|
latestReadMessageSortKey: latest_read_message_sort_key,
|
|
66
|
-
|
|
66
|
+
unreadReactionCount: 0,
|
|
67
67
|
},
|
|
68
68
|
}
|
|
69
69
|
})
|
|
@@ -87,9 +87,25 @@ export function useConversationJoltEvents({ conversationId }: Props) {
|
|
|
87
87
|
|
|
88
88
|
const handleReactionJoltEvent = useCallback(
|
|
89
89
|
(event: JoltReactionEvent) => {
|
|
90
|
-
|
|
90
|
+
queryClient.setQueryData<ApiResource<ConversationResource>>(queryKey, prev => {
|
|
91
|
+
if (!prev?.data) return prev
|
|
91
92
|
|
|
92
|
-
|
|
93
|
+
if (event.data.data.author_id === currentPersonId) {
|
|
94
|
+
return prev
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
return {
|
|
98
|
+
...prev,
|
|
99
|
+
data: {
|
|
100
|
+
...prev.data,
|
|
101
|
+
// Not a real count, just a derived value from Jolt events so we can
|
|
102
|
+
// determine if we should mark the conversation as read
|
|
103
|
+
unreadReactionCount: prev.data.unreadReactionCount
|
|
104
|
+
? prev.data.unreadReactionCount + 1
|
|
105
|
+
: 1,
|
|
106
|
+
},
|
|
107
|
+
}
|
|
108
|
+
})
|
|
93
109
|
},
|
|
94
110
|
[queryClient, queryKey, currentPersonId]
|
|
95
111
|
)
|
|
@@ -20,7 +20,7 @@ export const useConversationsMarkRead = ({
|
|
|
20
20
|
currentPersonCache.update({}, person => {
|
|
21
21
|
const currentUnread = person.unreadCount
|
|
22
22
|
const updatedUnread = read ? Math.max(currentUnread - 1, 0) : currentUnread + 1
|
|
23
|
-
return { ...person, unreadCount: updatedUnread }
|
|
23
|
+
return { ...person, unreadCount: updatedUnread, unreadReactionCount: 0 }
|
|
24
24
|
})
|
|
25
25
|
}
|
|
26
26
|
|
|
@@ -29,7 +29,6 @@ export const useConversationsMarkRead = ({
|
|
|
29
29
|
update({
|
|
30
30
|
...conversation,
|
|
31
31
|
unreadCount: read ? 0 : 1,
|
|
32
|
-
...(read ? { unreadReaction: false } : {}),
|
|
33
32
|
})
|
|
34
33
|
handlePersonUnreadCount(read)
|
|
35
34
|
},
|
|
@@ -107,7 +106,6 @@ export const useMarkAllRead = () => {
|
|
|
107
106
|
onMutate: () => {
|
|
108
107
|
updateAll({
|
|
109
108
|
unreadCount: 0,
|
|
110
|
-
unreadReaction: false,
|
|
111
109
|
})
|
|
112
110
|
},
|
|
113
111
|
mutationKey: ['markAllRead', args],
|