@planningcenter/chat-react-native 3.42.3-qa-staging.1 → 3.42.3-qa-staging.2
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/contexts/chat_context.d.ts +1 -0
- package/build/contexts/chat_context.d.ts.map +1 -1
- package/build/contexts/chat_context.js +7 -1
- package/build/contexts/chat_context.js.map +1 -1
- package/build/hooks/index.d.ts +1 -1
- package/build/hooks/index.d.ts.map +1 -1
- package/build/hooks/index.js +1 -1
- package/build/hooks/index.js.map +1 -1
- package/build/hooks/use_current_person.d.ts.map +1 -1
- package/build/hooks/use_current_person.js +1 -0
- package/build/hooks/use_current_person.js.map +1 -1
- package/build/hooks/use_direct_messages_eligible.d.ts +2 -0
- package/build/hooks/use_direct_messages_eligible.d.ts.map +1 -0
- package/build/hooks/use_direct_messages_eligible.js +9 -0
- package/build/hooks/use_direct_messages_eligible.js.map +1 -0
- package/build/hooks/use_features.d.ts +0 -1
- package/build/hooks/use_features.d.ts.map +1 -1
- package/build/hooks/use_features.js +0 -1
- package/build/hooks/use_features.js.map +1 -1
- package/build/navigation/index.d.ts +2 -3
- package/build/navigation/index.d.ts.map +1 -1
- package/build/navigation/index.js +2 -2
- package/build/navigation/index.js.map +1 -1
- package/build/screens/conversation_filters/components/conversation_filters.js +3 -3
- package/build/screens/conversation_filters/components/conversation_filters.js.map +1 -1
- package/build/screens/conversation_select_type_screen.d.ts.map +1 -1
- package/build/screens/conversation_select_type_screen.js +4 -7
- package/build/screens/conversation_select_type_screen.js.map +1 -1
- package/build/screens/conversations/components/list_header_component.js +3 -3
- package/build/screens/conversations/components/list_header_component.js.map +1 -1
- package/build/screens/settings_screen.js +3 -3
- package/build/screens/settings_screen.js.map +1 -1
- package/build/types/resources/person.d.ts +1 -0
- package/build/types/resources/person.d.ts.map +1 -1
- package/build/types/resources/person.js.map +1 -1
- package/build/utils/index.d.ts +1 -0
- package/build/utils/index.d.ts.map +1 -1
- package/build/utils/index.js +1 -0
- package/build/utils/index.js.map +1 -1
- package/build/utils/liquid_glass.d.ts +3 -0
- package/build/utils/liquid_glass.d.ts.map +1 -0
- package/build/utils/liquid_glass.js +9 -0
- package/build/utils/liquid_glass.js.map +1 -0
- package/package.json +3 -3
- package/src/__tests__/hooks/use_direct_messages_eligible.test.tsx +77 -0
- package/src/__tests__/utils/liquid_glass.ts +40 -0
- package/src/contexts/chat_context.tsx +8 -0
- package/src/hooks/index.ts +1 -1
- package/src/hooks/use_current_person.ts +1 -0
- package/src/hooks/use_direct_messages_eligible.ts +11 -0
- package/src/hooks/use_features.ts +0 -1
- package/src/navigation/index.tsx +2 -2
- package/src/screens/conversation_filters/components/conversation_filters.tsx +3 -3
- package/src/screens/conversation_select_type_screen.tsx +4 -7
- package/src/screens/conversations/components/list_header_component.tsx +3 -3
- package/src/screens/settings_screen.tsx +3 -3
- package/src/types/resources/person.ts +1 -0
- package/src/utils/index.ts +1 -0
- package/src/utils/liquid_glass.ts +12 -0
- package/build/hooks/use_direct_messages_enabled.d.ts +0 -2
- package/build/hooks/use_direct_messages_enabled.d.ts.map +0 -1
- package/build/hooks/use_direct_messages_enabled.js +0 -16
- package/build/hooks/use_direct_messages_enabled.js.map +0 -1
- package/src/hooks/use_direct_messages_enabled.ts +0 -23
|
@@ -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,OAAc,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,
|
|
1
|
+
{"version":3,"file":"conversation_select_type_screen.js","sourceRoot":"","sources":["../../src/screens/conversation_select_type_screen.tsx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AI,eACb,KAAC,SAAS,CAAC,MAAM,cACf,KAAC,SAAS,CAAC,WAAW,0CAAgD,GACrD,EAClB,yBAAyB,IAAI,CAC5B,KAAC,SAAS,CAAC,MAAM,IACf,KAAK,EAAE,uBAAuB,yBAAyB,CAAC,IAAI,EAAE,EAC9D,OAAO,EAAE,iBAAiB,EAC1B,iBAAiB,EAAC,yDAAyD,GAC3E,CACH,EACA,4BAA4B,IAAI,CAC/B,KAAC,SAAS,CAAC,MAAM,IACf,KAAK,EAAC,OAAO,EACb,OAAO,EAAE,gBAAgB,EACzB,iBAAiB,EAAC,8BAA8B,GAChD,CACH,EACA,8BAA8B,IAAI,CACjC,KAAC,SAAS,CAAC,MAAM,IACf,KAAK,EAAC,MAAM,EACZ,OAAO,EAAE,eAAe,EACxB,iBAAiB,EAAC,6BAA6B,GAC/C,CACH,EACA,uBAAuB,IAAI,CAC1B,KAAC,SAAS,CAAC,MAAM,IACf,KAAK,EAAC,gBAAgB,EACtB,OAAO,EAAE,wBAAwB,EACjC,QAAQ,EAAE,sBAAsB,EAChC,cAAc,EAAE,sBAAsB,CAAC,CAAC,CAAC,2BAA2B,CAAC,CAAC,CAAC,SAAS,EAChF,iBAAiB,EAAC,iDAAiD,GACnE,CACH,IACc,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 { 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 { directMessagesDisabled, directMessagesEligible } = 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 showDirectMessageOption = directMessagesEligible\n\n // sheetAllowedDetents depends on DM eligibility, which isn't known until render, so it's set\n // 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"]}
|
|
@@ -3,7 +3,7 @@ import { useNavigation, useRoute } from '@react-navigation/native';
|
|
|
3
3
|
import { useCallback, useMemo } from 'react';
|
|
4
4
|
import { Alert, ScrollView, StyleSheet, View } from 'react-native';
|
|
5
5
|
import { Heading, TextButton, ToggleButton } from '../../../components';
|
|
6
|
-
import { useAtFontScaleBreakpoint, useCanCreateConversations, useCurrentPersonCache,
|
|
6
|
+
import { useAtFontScaleBreakpoint, useCanCreateConversations, useCurrentPersonCache, useDirectMessagesEligible, useHasDirectMessages, useNewConversationEntry, useTheme, } from '../../../hooks';
|
|
7
7
|
import { useMarkAllRead } from '../../../hooks/use_conversations_actions';
|
|
8
8
|
import { useCanDisplayGroups } from '../../../hooks/use_groups';
|
|
9
9
|
import { useNewConversationFromFilter } from '../../../hooks/use_new_conversation_from_filter';
|
|
@@ -24,9 +24,9 @@ export const ListHeaderComponent = () => {
|
|
|
24
24
|
const navigation = useNavigation();
|
|
25
25
|
const canFilterByTeams = useCanDisplayGroups({ source_app_name: 'Services', source_type: 'Team' });
|
|
26
26
|
const canFilterByGroups = useCanDisplayGroups({ source_app_name: 'Groups', source_type: 'Group' });
|
|
27
|
-
const
|
|
27
|
+
const directMessagesEligible = useDirectMessagesEligible();
|
|
28
28
|
const hasDirectMessages = useHasDirectMessages();
|
|
29
|
-
const canFilterByDMs =
|
|
29
|
+
const canFilterByDMs = directMessagesEligible && hasDirectMessages;
|
|
30
30
|
const route = useRoute();
|
|
31
31
|
const { chat_group_graph_id, group_source_app_name = '', show_direct_messages, } = route.params || {};
|
|
32
32
|
const currentPersonCache = useCurrentPersonCache();
|
|
@@ -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,OAAc,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,GACT,MAAM,gBAAgB,CAAA;AACvB,OAAO,EAAE,cAAc,EAAE,MAAM,0CAA0C,CAAA;AACzE,OAAO,EAAE,mBAAmB,EAAE,MAAM,2BAA2B,CAAA;AAC/D,OAAO,EAAE,4BAA4B,EAAE,MAAM,iDAAiD,CAAA;AAE9F,OAAO,EAAE,iCAAiC,EAAE,MAAM,gBAAgB,CAAA;AAClE,OAAO,EAAE,MAAM,EAAE,MAAM,gCAAgC,CAAA;AAEvD,OAAO,EAAE,cAAc,EAAE,MAAM,oBAA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EAAE,eAAe;YAC/B,aAAa,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 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 <ListHeaderActionButton\n name=\"general.cog\"\n onPress={handleChatSettings}\n accessibilityLabel=\"Chat settings\"\n maxFontSizeMultiplier={MAX_FONT_SIZE_MULTIPLIER_LANDMARK}\n />\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 {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,OAAc,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,yBAAyB,EACzB,oBAAoB,EACpB,uBAAuB,EACvB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AAE;YACV,iBAAiB,EAAE,CAAC;YACpB,iBAAiB,EAAE,KAAK,CAAC,MAAM,CAAC,uBAAuB;YACvD,aAAa,EAAE,EAAE;YACjB,GAAG,EAAE,EAAE;SACR;QACD,UAAU,EAAE;YACV,GAAG,EAAE,EAAE;YACP,aAAa,EAAE,qBAAqB,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,KAAK;YACvD,UAAU,EAAE,qBAAqB,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,QAAQ;YAC3D,cAAc,EAAE,eAAe;YAC/B,aAAa,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 useDirectMessagesEligible,\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 directMessagesEligible = useDirectMessagesEligible()\n const hasDirectMessages = useHasDirectMessages()\n const canFilterByDMs = directMessagesEligible && 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 <ListHeaderActionButton\n name=\"general.cog\"\n onPress={handleChatSettings}\n accessibilityLabel=\"Chat settings\"\n maxFontSizeMultiplier={MAX_FONT_SIZE_MULTIPLIER_LANDMARK}\n />\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 {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"]}
|
|
@@ -5,13 +5,13 @@ import { useCallback } from 'react';
|
|
|
5
5
|
import { Platform, StyleSheet, View } from 'react-native';
|
|
6
6
|
import { Heading, Icon, Text } from '../components';
|
|
7
7
|
import { Switch } from '../components/display/switch';
|
|
8
|
-
import {
|
|
8
|
+
import { useDirectMessagesEligible, useTheme } from '../hooks';
|
|
9
9
|
import { useAppName } from '../hooks/use_app_name';
|
|
10
10
|
import { usePersonSettings } from '../hooks/use_person_settings';
|
|
11
11
|
export function SettingsScreen({}) {
|
|
12
12
|
const styles = useStyles();
|
|
13
13
|
const { directMessagesDisabled, setDirectMessagesDisabled, isMutating } = usePersonSettings();
|
|
14
|
-
const
|
|
14
|
+
const directMessagesEligible = useDirectMessagesEligible();
|
|
15
15
|
const appName = useAppName();
|
|
16
16
|
const navigation = useNavigation();
|
|
17
17
|
const handleNotificationSettings = useCallback(() => {
|
|
@@ -20,7 +20,7 @@ export function SettingsScreen({}) {
|
|
|
20
20
|
const handleGetHelp = useCallback(() => {
|
|
21
21
|
navigation.navigate('GetHelp', { type: 'chat' });
|
|
22
22
|
}, [navigation]);
|
|
23
|
-
return (_jsx(View, { style: styles.container, children: _jsxs(View, { style: styles.sectionOuter, children: [_jsx(View, { style: styles.sectionHeader, children: _jsx(Heading, { variant: "h2", children: "Messages" }) }),
|
|
23
|
+
return (_jsx(View, { style: styles.container, children: _jsxs(View, { style: styles.sectionOuter, children: [_jsx(View, { style: styles.sectionHeader, children: _jsx(Heading, { variant: "h2", children: "Messages" }) }), directMessagesEligible && (_jsxs(View, { style: styles.settingRow, children: [_jsxs(View, { style: styles.settingRowText, children: [_jsx(Text, { children: "Allow direct messages" }), _jsx(Text, { variant: "tertiary", children: "When off, you can't be added to new direct messages, and any you're already in will be turned off." })] }), _jsx(Switch, { value: !directMessagesDisabled, onValueChange: enabled => setDirectMessagesDisabled(!enabled), disabled: isMutating })] })), _jsx(NavRow, { label: "Notification settings", onPress: handleNotificationSettings }), appName !== 'services' && _jsx(NavRow, { label: "Get help", onPress: handleGetHelp })] }) }));
|
|
24
24
|
}
|
|
25
25
|
function NavRow({ label, onPress }) {
|
|
26
26
|
const styles = useNavRowStyles();
|
|
@@ -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,OAAc,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,
|
|
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,OAAc,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,yBAAyB,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAA;AAC9D,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,sBAAsB,GAA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CAAC,CAAA;AACJ,CAAC,CAAA;AAED,MAAM,eAAe,GAAG,GAAG,EAAE;IAC3B,MAAM,EAAE,MAAM,EAAE,GAAG,QAAQ,EAAE,CAAA;IAC7B,OAAO,UAAU,CAAC,MAAM,CAAC;QACvB,SAAS,EAAE;YACT,WAAW,EAAE,CAAC;SACf;QACD,KAAK,EAAE;YACL,aAAa,EAAE,KAAK;YACpB,UAAU,EAAE,QAAQ;YACpB,cAAc,EAAE,eAAe;YAC/B,YAAY,EAAE,EAAE;YAChB,eAAe,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 { useDirectMessagesEligible, 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 directMessagesEligible = useDirectMessagesEligible()\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 {directMessagesEligible && (\n <View style={styles.settingRow}>\n <View style={styles.settingRowText}>\n <Text>Allow direct messages</Text>\n <Text variant=\"tertiary\">\n When off, you can't be added to new direct messages, and any you're already in will\n be turned off.\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"]}
|
|
@@ -17,6 +17,7 @@ export interface CurrentPersonResource extends PersonResource {
|
|
|
17
17
|
pcoChatEnabled: boolean;
|
|
18
18
|
ageQualificationStatus?: AgeQualificationStatus;
|
|
19
19
|
directMessagesDisabled: boolean;
|
|
20
|
+
directMessagesEligible: boolean;
|
|
20
21
|
under_18: boolean;
|
|
21
22
|
}
|
|
22
23
|
//# sourceMappingURL=person.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"person.d.ts","sourceRoot":"","sources":["../../../src/types/resources/person.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAA;AAElD,eAAO,MAAM,sBAAsB;;;;CAIzB,CAAA;AAEV,MAAM,MAAM,sBAAsB,GAChC,CAAC,OAAO,sBAAsB,CAAC,CAAC,MAAM,OAAO,sBAAsB,CAAC,CAAA;AAEtE,MAAM,WAAW,cAAe,SAAQ,cAAc;IACpD,EAAE,EAAE,MAAM,CAAA;IACV,IAAI,EAAE,QAAQ,CAAA;IACd,IAAI,EAAE,MAAM,CAAA;IACZ,MAAM,EAAE,MAAM,CAAA;CACf;AAED,MAAM,WAAW,qBAAsB,SAAQ,cAAc;IAC3D,OAAO,EAAE,OAAO,CAAA;IAChB,WAAW,EAAE,MAAM,CAAA;IACnB,cAAc,EAAE,OAAO,CAAA;IACvB,sBAAsB,CAAC,EAAE,sBAAsB,CAAA;IAC/C,sBAAsB,EAAE,OAAO,CAAA;IAC/B,QAAQ,EAAE,OAAO,CAAA;CAClB"}
|
|
1
|
+
{"version":3,"file":"person.d.ts","sourceRoot":"","sources":["../../../src/types/resources/person.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAA;AAElD,eAAO,MAAM,sBAAsB;;;;CAIzB,CAAA;AAEV,MAAM,MAAM,sBAAsB,GAChC,CAAC,OAAO,sBAAsB,CAAC,CAAC,MAAM,OAAO,sBAAsB,CAAC,CAAA;AAEtE,MAAM,WAAW,cAAe,SAAQ,cAAc;IACpD,EAAE,EAAE,MAAM,CAAA;IACV,IAAI,EAAE,QAAQ,CAAA;IACd,IAAI,EAAE,MAAM,CAAA;IACZ,MAAM,EAAE,MAAM,CAAA;CACf;AAED,MAAM,WAAW,qBAAsB,SAAQ,cAAc;IAC3D,OAAO,EAAE,OAAO,CAAA;IAChB,WAAW,EAAE,MAAM,CAAA;IACnB,cAAc,EAAE,OAAO,CAAA;IACvB,sBAAsB,CAAC,EAAE,sBAAsB,CAAA;IAC/C,sBAAsB,EAAE,OAAO,CAAA;IAC/B,sBAAsB,EAAE,OAAO,CAAA;IAC/B,QAAQ,EAAE,OAAO,CAAA;CAClB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"person.js","sourceRoot":"","sources":["../../../src/types/resources/person.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,sBAAsB,GAAG;IACpC,SAAS,EAAE,WAAW;IACtB,YAAY,EAAE,cAAc;IAC5B,OAAO,EAAE,SAAS;CACV,CAAA","sourcesContent":["import { ResourceObject } from '../api_primitives'\n\nexport const AgeQualificationStatus = {\n QUALIFIED: 'qualified',\n DISQUALIFIED: 'disqualified',\n UNKNOWN: 'unknown',\n} as const\n\nexport type AgeQualificationStatus =\n (typeof AgeQualificationStatus)[keyof typeof AgeQualificationStatus]\n\nexport interface PersonResource extends ResourceObject {\n id: number\n type: 'Person'\n name: string\n avatar: string\n}\n\nexport interface CurrentPersonResource extends PersonResource {\n canChat: boolean\n unreadCount: number\n pcoChatEnabled: boolean\n ageQualificationStatus?: AgeQualificationStatus\n directMessagesDisabled: boolean\n under_18: boolean\n}\n"]}
|
|
1
|
+
{"version":3,"file":"person.js","sourceRoot":"","sources":["../../../src/types/resources/person.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,sBAAsB,GAAG;IACpC,SAAS,EAAE,WAAW;IACtB,YAAY,EAAE,cAAc;IAC5B,OAAO,EAAE,SAAS;CACV,CAAA","sourcesContent":["import { ResourceObject } from '../api_primitives'\n\nexport const AgeQualificationStatus = {\n QUALIFIED: 'qualified',\n DISQUALIFIED: 'disqualified',\n UNKNOWN: 'unknown',\n} as const\n\nexport type AgeQualificationStatus =\n (typeof AgeQualificationStatus)[keyof typeof AgeQualificationStatus]\n\nexport interface PersonResource extends ResourceObject {\n id: number\n type: 'Person'\n name: string\n avatar: string\n}\n\nexport interface CurrentPersonResource extends PersonResource {\n canChat: boolean\n unreadCount: number\n pcoChatEnabled: boolean\n ageQualificationStatus?: AgeQualificationStatus\n directMessagesDisabled: boolean\n directMessagesEligible: boolean\n under_18: boolean\n}\n"]}
|
package/build/utils/index.d.ts
CHANGED
|
@@ -6,6 +6,7 @@ export * from './client';
|
|
|
6
6
|
export * from './convert_attachments_for_create';
|
|
7
7
|
export * from './destructure_chat_group_graph_id';
|
|
8
8
|
export * from './host_bridge';
|
|
9
|
+
export * from './liquid_glass';
|
|
9
10
|
export * from './native_adapters';
|
|
10
11
|
export * from './pluralize';
|
|
11
12
|
export * from './conversation_safety_constants';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AAAA,cAAc,2BAA2B,CAAA;AACzC,cAAc,mBAAmB,CAAA;AACjC,cAAc,mBAAmB,CAAA;AACjC,cAAc,SAAS,CAAA;AACvB,cAAc,UAAU,CAAA;AACxB,cAAc,kCAAkC,CAAA;AAChD,cAAc,mCAAmC,CAAA;AACjD,cAAc,eAAe,CAAA;AAC7B,cAAc,mBAAmB,CAAA;AACjC,cAAc,aAAa,CAAA;AAC3B,cAAc,iCAAiC,CAAA;AAC/C,cAAc,sBAAsB,CAAA;AACpC,cAAc,WAAW,CAAA;AACzB,cAAc,UAAU,CAAA;AACxB,cAAc,mBAAmB,CAAA;AACjC,cAAc,SAAS,CAAA;AACvB,cAAc,OAAO,CAAA"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AAAA,cAAc,2BAA2B,CAAA;AACzC,cAAc,mBAAmB,CAAA;AACjC,cAAc,mBAAmB,CAAA;AACjC,cAAc,SAAS,CAAA;AACvB,cAAc,UAAU,CAAA;AACxB,cAAc,kCAAkC,CAAA;AAChD,cAAc,mCAAmC,CAAA;AACjD,cAAc,eAAe,CAAA;AAC7B,cAAc,gBAAgB,CAAA;AAC9B,cAAc,mBAAmB,CAAA;AACjC,cAAc,aAAa,CAAA;AAC3B,cAAc,iCAAiC,CAAA;AAC/C,cAAc,sBAAsB,CAAA;AACpC,cAAc,WAAW,CAAA;AACzB,cAAc,UAAU,CAAA;AACxB,cAAc,mBAAmB,CAAA;AACjC,cAAc,SAAS,CAAA;AACvB,cAAc,OAAO,CAAA"}
|
package/build/utils/index.js
CHANGED
|
@@ -6,6 +6,7 @@ export * from './client';
|
|
|
6
6
|
export * from './convert_attachments_for_create';
|
|
7
7
|
export * from './destructure_chat_group_graph_id';
|
|
8
8
|
export * from './host_bridge';
|
|
9
|
+
export * from './liquid_glass';
|
|
9
10
|
export * from './native_adapters';
|
|
10
11
|
export * from './pluralize';
|
|
11
12
|
export * from './conversation_safety_constants';
|
package/build/utils/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AAAA,cAAc,2BAA2B,CAAA;AACzC,cAAc,mBAAmB,CAAA;AACjC,cAAc,mBAAmB,CAAA;AACjC,cAAc,SAAS,CAAA;AACvB,cAAc,UAAU,CAAA;AACxB,cAAc,kCAAkC,CAAA;AAChD,cAAc,mCAAmC,CAAA;AACjD,cAAc,eAAe,CAAA;AAC7B,cAAc,mBAAmB,CAAA;AACjC,cAAc,aAAa,CAAA;AAC3B,cAAc,iCAAiC,CAAA;AAC/C,cAAc,sBAAsB,CAAA;AACpC,cAAc,WAAW,CAAA;AACzB,cAAc,UAAU,CAAA;AACxB,cAAc,mBAAmB,CAAA;AACjC,cAAc,SAAS,CAAA;AACvB,cAAc,OAAO,CAAA","sourcesContent":["export * from './assert_keys_are_numbers'\nexport * from './attachment_kind'\nexport * from './chat_type_label'\nexport * from './cache'\nexport * from './client'\nexport * from './convert_attachments_for_create'\nexport * from './destructure_chat_group_graph_id'\nexport * from './host_bridge'\nexport * from './native_adapters'\nexport * from './pluralize'\nexport * from './conversation_safety_constants'\nexport * from './reaction_constants'\nexport * from './session'\nexport * from './styles'\nexport * from './system_messages'\nexport * from './theme'\nexport * from './uri'\n"]}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AAAA,cAAc,2BAA2B,CAAA;AACzC,cAAc,mBAAmB,CAAA;AACjC,cAAc,mBAAmB,CAAA;AACjC,cAAc,SAAS,CAAA;AACvB,cAAc,UAAU,CAAA;AACxB,cAAc,kCAAkC,CAAA;AAChD,cAAc,mCAAmC,CAAA;AACjD,cAAc,eAAe,CAAA;AAC7B,cAAc,gBAAgB,CAAA;AAC9B,cAAc,mBAAmB,CAAA;AACjC,cAAc,aAAa,CAAA;AAC3B,cAAc,iCAAiC,CAAA;AAC/C,cAAc,sBAAsB,CAAA;AACpC,cAAc,WAAW,CAAA;AACzB,cAAc,UAAU,CAAA;AACxB,cAAc,mBAAmB,CAAA;AACjC,cAAc,SAAS,CAAA;AACvB,cAAc,OAAO,CAAA","sourcesContent":["export * from './assert_keys_are_numbers'\nexport * from './attachment_kind'\nexport * from './chat_type_label'\nexport * from './cache'\nexport * from './client'\nexport * from './convert_attachments_for_create'\nexport * from './destructure_chat_group_graph_id'\nexport * from './host_bridge'\nexport * from './liquid_glass'\nexport * from './native_adapters'\nexport * from './pluralize'\nexport * from './conversation_safety_constants'\nexport * from './reaction_constants'\nexport * from './session'\nexport * from './styles'\nexport * from './system_messages'\nexport * from './theme'\nexport * from './uri'\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"liquid_glass.d.ts","sourceRoot":"","sources":["../../src/utils/liquid_glass.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,wBAAwB,GAAI,SAAS,OAAO,SAExD,CAAA;AAID,eAAO,MAAM,oBAAoB,eACgE,CAAA"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { Platform } from 'react-native';
|
|
2
|
+
let hostLiquidGlassEnabled = false;
|
|
3
|
+
export const setLiquidGlassCapability = (enabled) => {
|
|
4
|
+
hostLiquidGlassEnabled = enabled;
|
|
5
|
+
};
|
|
6
|
+
// The host flag is required because JS cannot detect a binary built with a
|
|
7
|
+
// pre-iOS-26 SDK or opted out via UIDesignRequiresCompatibility.
|
|
8
|
+
export const isLiquidGlassEnabled = () => hostLiquidGlassEnabled && Platform.OS === 'ios' && parseInt(String(Platform.Version), 10) >= 26;
|
|
9
|
+
//# sourceMappingURL=liquid_glass.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"liquid_glass.js","sourceRoot":"","sources":["../../src/utils/liquid_glass.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAA;AAEvC,IAAI,sBAAsB,GAAG,KAAK,CAAA;AAElC,MAAM,CAAC,MAAM,wBAAwB,GAAG,CAAC,OAAgB,EAAE,EAAE;IAC3D,sBAAsB,GAAG,OAAO,CAAA;AAClC,CAAC,CAAA;AAED,2EAA2E;AAC3E,iEAAiE;AACjE,MAAM,CAAC,MAAM,oBAAoB,GAAG,GAAG,EAAE,CACvC,sBAAsB,IAAI,QAAQ,CAAC,EAAE,KAAK,KAAK,IAAI,QAAQ,CAAC,MAAM,CAAC,QAAQ,CAAC,OAAO,CAAC,EAAE,EAAE,CAAC,IAAI,EAAE,CAAA","sourcesContent":["import { Platform } from 'react-native'\n\nlet hostLiquidGlassEnabled = false\n\nexport const setLiquidGlassCapability = (enabled: boolean) => {\n hostLiquidGlassEnabled = enabled\n}\n\n// The host flag is required because JS cannot detect a binary built with a\n// pre-iOS-26 SDK or opted out via UIDesignRequiresCompatibility.\nexport const isLiquidGlassEnabled = () =>\n hostLiquidGlassEnabled && Platform.OS === 'ios' && parseInt(String(Platform.Version), 10) >= 26\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@planningcenter/chat-react-native",
|
|
3
|
-
"version": "3.42.3-qa-staging.
|
|
3
|
+
"version": "3.42.3-qa-staging.2",
|
|
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.42.3-qa-staging.
|
|
29
|
+
"@planningcenter/emoji-keyboard": "3.42.3-qa-staging.2",
|
|
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": "~6.0.3"
|
|
74
74
|
},
|
|
75
|
-
"gitHead": "
|
|
75
|
+
"gitHead": "cecab4954fa383b2bbb8a20bd8956e45b9dce163"
|
|
76
76
|
}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import { QueryClientProvider } from '@tanstack/react-query'
|
|
2
|
+
import { act, renderHook, waitFor } from '@testing-library/react-native'
|
|
3
|
+
import React from 'react'
|
|
4
|
+
import { buildTestQueryClient } from '../../__utils__/query_client'
|
|
5
|
+
import { ChatContext, ChatContextValue } from '../../contexts/chat_context'
|
|
6
|
+
import { ApiClient, useApiClient } from '../../hooks/use_api_client'
|
|
7
|
+
import { currentPersonQueryKey } from '../../hooks/use_current_person'
|
|
8
|
+
import { useDirectMessagesEligible } from '../../hooks/use_direct_messages_eligible'
|
|
9
|
+
import { Session } from '../../utils'
|
|
10
|
+
|
|
11
|
+
jest.mock('../../hooks/use_api_client')
|
|
12
|
+
|
|
13
|
+
const mockedUseApiClient = useApiClient as jest.MockedFunction<typeof useApiClient>
|
|
14
|
+
|
|
15
|
+
let get: jest.Mock
|
|
16
|
+
|
|
17
|
+
const session = new Session({ token: { access_token: 'a-real-token' } })
|
|
18
|
+
|
|
19
|
+
const renderUseDirectMessagesEligible = (queryClient = buildTestQueryClient()) => {
|
|
20
|
+
const wrapper = ({ children }: { children: React.ReactNode }) => (
|
|
21
|
+
<QueryClientProvider client={queryClient}>
|
|
22
|
+
<ChatContext.Provider value={{ session } as unknown as ChatContextValue}>
|
|
23
|
+
{children}
|
|
24
|
+
</ChatContext.Provider>
|
|
25
|
+
</QueryClientProvider>
|
|
26
|
+
)
|
|
27
|
+
|
|
28
|
+
return { ...renderHook(() => useDirectMessagesEligible(), { wrapper }), queryClient }
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
const flushMicrotasks = () =>
|
|
32
|
+
act(async () => {
|
|
33
|
+
await new Promise(resolve => setTimeout(resolve, 0))
|
|
34
|
+
})
|
|
35
|
+
|
|
36
|
+
beforeEach(() => {
|
|
37
|
+
get = jest.fn().mockResolvedValue({ data: { id: 1, directMessagesEligible: true } })
|
|
38
|
+
mockedUseApiClient.mockReturnValue({ chat: { get } } as unknown as ApiClient)
|
|
39
|
+
})
|
|
40
|
+
|
|
41
|
+
afterEach(() => {
|
|
42
|
+
jest.clearAllMocks()
|
|
43
|
+
})
|
|
44
|
+
|
|
45
|
+
describe('useDirectMessagesEligible', () => {
|
|
46
|
+
it('returns true once the person is fetched as eligible', async () => {
|
|
47
|
+
get.mockResolvedValue({
|
|
48
|
+
data: { id: 1, directMessagesEligible: true, directMessagesDisabled: true },
|
|
49
|
+
})
|
|
50
|
+
|
|
51
|
+
const { result } = renderUseDirectMessagesEligible()
|
|
52
|
+
|
|
53
|
+
await waitFor(() => expect(result.current).toBe(true))
|
|
54
|
+
})
|
|
55
|
+
|
|
56
|
+
it('returns false when the attribute is absent from the response', async () => {
|
|
57
|
+
get.mockResolvedValue({ data: { id: 1 } })
|
|
58
|
+
|
|
59
|
+
const { result } = renderUseDirectMessagesEligible()
|
|
60
|
+
|
|
61
|
+
await waitFor(() => expect(get).toHaveBeenCalled())
|
|
62
|
+
await flushMicrotasks()
|
|
63
|
+
|
|
64
|
+
expect(result.current).toBe(false)
|
|
65
|
+
})
|
|
66
|
+
|
|
67
|
+
it('reads the same /me cache entry as useCurrentPerson', () => {
|
|
68
|
+
const queryClient = buildTestQueryClient()
|
|
69
|
+
queryClient.setQueryData(currentPersonQueryKey, {
|
|
70
|
+
data: { id: 1, directMessagesEligible: true },
|
|
71
|
+
})
|
|
72
|
+
|
|
73
|
+
const { result } = renderUseDirectMessagesEligible(queryClient)
|
|
74
|
+
|
|
75
|
+
expect(result.current).toBe(true)
|
|
76
|
+
})
|
|
77
|
+
})
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { Platform } from 'react-native'
|
|
2
|
+
import { isLiquidGlassEnabled, setLiquidGlassCapability } from '../../utils/liquid_glass'
|
|
3
|
+
|
|
4
|
+
const mockPlatform = (OS: 'ios' | 'android', Version: string | number) => {
|
|
5
|
+
Object.defineProperty(Platform, 'OS', { value: OS, configurable: true })
|
|
6
|
+
Object.defineProperty(Platform, 'Version', { value: Version, configurable: true })
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
describe('isLiquidGlassEnabled', () => {
|
|
10
|
+
afterEach(() => {
|
|
11
|
+
setLiquidGlassCapability(false)
|
|
12
|
+
})
|
|
13
|
+
|
|
14
|
+
it('is false until the host enables it', () => {
|
|
15
|
+
mockPlatform('ios', '26.0')
|
|
16
|
+
|
|
17
|
+
expect(isLiquidGlassEnabled()).toBe(false)
|
|
18
|
+
})
|
|
19
|
+
|
|
20
|
+
it('is true when the host enables it on iOS 26 or later', () => {
|
|
21
|
+
mockPlatform('ios', '26.0')
|
|
22
|
+
setLiquidGlassCapability(true)
|
|
23
|
+
|
|
24
|
+
expect(isLiquidGlassEnabled()).toBe(true)
|
|
25
|
+
})
|
|
26
|
+
|
|
27
|
+
it('is false below iOS 26 even when the host enables it', () => {
|
|
28
|
+
mockPlatform('ios', '18.5')
|
|
29
|
+
setLiquidGlassCapability(true)
|
|
30
|
+
|
|
31
|
+
expect(isLiquidGlassEnabled()).toBe(false)
|
|
32
|
+
})
|
|
33
|
+
|
|
34
|
+
it('is false on android even when the host enables it', () => {
|
|
35
|
+
mockPlatform('android', 36)
|
|
36
|
+
setLiquidGlassCapability(true)
|
|
37
|
+
|
|
38
|
+
expect(isLiquidGlassEnabled()).toBe(false)
|
|
39
|
+
})
|
|
40
|
+
})
|
|
@@ -7,6 +7,7 @@ import { ApiResource, DeepPartial } from '../types'
|
|
|
7
7
|
import { FailedResponse } from '../types'
|
|
8
8
|
import { ProductAnalyticsConfig } from '../types/product_analytics'
|
|
9
9
|
import { Client, ENV, OauthType, PartialToken, Session, Uri } from '../utils'
|
|
10
|
+
import { setLiquidGlassCapability } from '../utils/liquid_glass'
|
|
10
11
|
import { ChatTheme, defaultTheme, DefaultTheme } from '../utils/theme'
|
|
11
12
|
|
|
12
13
|
export interface ChatProviderProps {
|
|
@@ -18,6 +19,7 @@ export interface ChatProviderProps {
|
|
|
18
19
|
tokenType?: OauthType
|
|
19
20
|
theme: CreateChatThemeProps
|
|
20
21
|
edgeToEdge?: boolean
|
|
22
|
+
liquidGlassEnabled?: boolean
|
|
21
23
|
}
|
|
22
24
|
|
|
23
25
|
export interface ChatContextValue extends Omit<ChatProviderProps, 'theme'> {
|
|
@@ -36,6 +38,7 @@ export const ChatContext = createContext<ChatContextValue>({
|
|
|
36
38
|
theme: defaultTheme('light'),
|
|
37
39
|
token: undefined,
|
|
38
40
|
edgeToEdge: true,
|
|
41
|
+
liquidGlassEnabled: false,
|
|
39
42
|
productAnalyticsConfig: undefined,
|
|
40
43
|
})
|
|
41
44
|
|
|
@@ -48,7 +51,11 @@ export function ChatProvider({ children, value }: { children: any; value: ChatPr
|
|
|
48
51
|
giphyApiKey,
|
|
49
52
|
tokenType,
|
|
50
53
|
edgeToEdge = true,
|
|
54
|
+
liquidGlassEnabled = false,
|
|
51
55
|
} = value
|
|
56
|
+
// Set during render, not in an effect — navigator options factories read it
|
|
57
|
+
// before effects would run.
|
|
58
|
+
setLiquidGlassCapability(liquidGlassEnabled)
|
|
52
59
|
const theme = useCreateChatTheme(value.theme || {})
|
|
53
60
|
const session = useMemo(
|
|
54
61
|
() => new Session({ token, env, type: tokenType }),
|
|
@@ -59,6 +66,7 @@ export function ChatProvider({ children, value }: { children: any; value: ChatPr
|
|
|
59
66
|
const contextValue: ChatContextValue = {
|
|
60
67
|
...value,
|
|
61
68
|
edgeToEdge,
|
|
69
|
+
liquidGlassEnabled,
|
|
62
70
|
env,
|
|
63
71
|
giphyApiKey,
|
|
64
72
|
onAgeDisqualification,
|
package/src/hooks/index.ts
CHANGED
|
@@ -8,7 +8,7 @@ export * from './use_chat_permissions'
|
|
|
8
8
|
export * from './use_create_android_ripple_color'
|
|
9
9
|
export * from './use_current_person'
|
|
10
10
|
export * from './use_deleting_ids'
|
|
11
|
-
export * from './
|
|
11
|
+
export * from './use_direct_messages_eligible'
|
|
12
12
|
export * from './use_font_scale'
|
|
13
13
|
export * from './use_has_direct_messages'
|
|
14
14
|
export * from './use_groups_groups'
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { CurrentPersonResource } from '../types'
|
|
2
|
+
import { useApiGet } from './use_api'
|
|
3
|
+
import { currentPersonRequestArgs } from './use_current_person'
|
|
4
|
+
|
|
5
|
+
export const useDirectMessagesEligible = (): boolean => {
|
|
6
|
+
const { data: person, isFetched } = useApiGet<CurrentPersonResource>(currentPersonRequestArgs)
|
|
7
|
+
|
|
8
|
+
if (!isFetched) return false
|
|
9
|
+
|
|
10
|
+
return person?.directMessagesEligible ?? false
|
|
11
|
+
}
|
|
@@ -43,7 +43,6 @@ export const availableFeatures = {
|
|
|
43
43
|
custom_conversation_avatars: 'ROLLOUT_custom_conversation_avatars',
|
|
44
44
|
conversation_safety_lock: 'ROLLOUT_conversation_safety_lock',
|
|
45
45
|
video_moderation: 'ROLLOUT_MOBILE_video_moderation',
|
|
46
|
-
direct_messages_eap: 'ROLLOUT_direct_messages_eap',
|
|
47
46
|
dm_search_clear_fix: 'ROLLOUT_MOBILE_dm_search_clear_fix',
|
|
48
47
|
} as const satisfies Record<string, `ROLLOUT_${string}`>
|
|
49
48
|
|
package/src/navigation/index.tsx
CHANGED
|
@@ -12,7 +12,7 @@ import {
|
|
|
12
12
|
HeaderDoneButton,
|
|
13
13
|
HeaderTextButton,
|
|
14
14
|
} from '../components/display/platform_modal_header_buttons'
|
|
15
|
-
import {
|
|
15
|
+
import { useDirectMessagesEligible, useQualifiedByAge } from '../hooks'
|
|
16
16
|
import {
|
|
17
17
|
AttachmentActionsScreen,
|
|
18
18
|
AttachmentActionsScreenOptions,
|
|
@@ -131,7 +131,7 @@ export const NewConversationStack = createNativeStackNavigator({
|
|
|
131
131
|
},
|
|
132
132
|
ConversationSelectDirectMessageRecipients: {
|
|
133
133
|
screen: ConversationSelectDirectMessageRecipientsScreen,
|
|
134
|
-
if:
|
|
134
|
+
if: useDirectMessagesEligible,
|
|
135
135
|
options: ({ navigation, route }) => ({
|
|
136
136
|
title: 'New conversation',
|
|
137
137
|
headerRight: (props: NativeStackHeaderRightProps) => (
|
|
@@ -4,7 +4,7 @@ import { FlatList } from 'react-native-gesture-handler'
|
|
|
4
4
|
import { Heading } from '../../../components'
|
|
5
5
|
import {
|
|
6
6
|
useAtFontScaleBreakpoint,
|
|
7
|
-
|
|
7
|
+
useDirectMessagesEligible,
|
|
8
8
|
useHasDirectMessages,
|
|
9
9
|
useTheme,
|
|
10
10
|
} from '../../../hooks'
|
|
@@ -59,9 +59,9 @@ export const ConversationFilters = () => {
|
|
|
59
59
|
const { setScrollOffset, params } = useContext(FilterContext)
|
|
60
60
|
const { chat_group_graph_id, group_source_app_name = '', show_direct_messages } = params
|
|
61
61
|
|
|
62
|
-
const
|
|
62
|
+
const directMessagesEligible = useDirectMessagesEligible()
|
|
63
63
|
const hasDirectMessages = useHasDirectMessages()
|
|
64
|
-
const canFilterByDMs =
|
|
64
|
+
const canFilterByDMs = directMessagesEligible && hasDirectMessages
|
|
65
65
|
|
|
66
66
|
const activeFilter: FilterTypes = useMemo(() => {
|
|
67
67
|
if (chat_group_graph_id) {
|
|
@@ -2,7 +2,6 @@ import { StaticScreenProps, useNavigation } from '@react-navigation/native'
|
|
|
2
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
|
-
import { availableFeatures, useFeatures } from '../hooks/use_features'
|
|
6
5
|
import { useConversationTypeAccess } from '../hooks/use_new_conversation_entry'
|
|
7
6
|
import type { NewConversationFromFilter } from '../hooks/use_new_conversation_from_filter'
|
|
8
7
|
import { AppName } from '../types/resources/app_name'
|
|
@@ -28,17 +27,15 @@ export function ConversationSelectTypeScreen({ route }: ConversationSelectTypeSc
|
|
|
28
27
|
const navigation = useNavigation()
|
|
29
28
|
const { canCreateGroupsConversations, canCreateServicesConversations } =
|
|
30
29
|
useConversationTypeAccess()
|
|
31
|
-
const {
|
|
32
|
-
const { directMessagesDisabled, under_18 } = useCurrentPerson()
|
|
30
|
+
const { directMessagesDisabled, directMessagesEligible } = useCurrentPerson()
|
|
33
31
|
const { newConversationFromFilter, chat_group_graph_id, group_source_app_name } =
|
|
34
32
|
route.params || {}
|
|
35
33
|
|
|
36
34
|
const filterParams = { chat_group_graph_id, group_source_app_name }
|
|
37
|
-
const
|
|
38
|
-
const showDirectMessageOption = dmFeatureEnabled && !under_18
|
|
35
|
+
const showDirectMessageOption = directMessagesEligible
|
|
39
36
|
|
|
40
|
-
// sheetAllowedDetents depends on
|
|
41
|
-
//
|
|
37
|
+
// sheetAllowedDetents depends on DM eligibility, which isn't known until render, so it's set
|
|
38
|
+
// here instead of in the static ConversationSelectTypeScreenOptions. useLayoutEffect applies
|
|
42
39
|
// it before paint so the sheet never visibly resizes after opening.
|
|
43
40
|
useLayoutEffect(() => {
|
|
44
41
|
navigation.setOptions({ sheetAllowedDetents: showDirectMessageOption ? [0.3] : [0.25] })
|