@planningcenter/chat-react-native 3.27.0 → 3.28.0-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.
Files changed (49) hide show
  1. package/build/components/conversation/message.d.ts +1 -2
  2. package/build/components/conversation/message.d.ts.map +1 -1
  3. package/build/components/conversation/message.js +5 -5
  4. package/build/components/conversation/message.js.map +1 -1
  5. package/build/components/conversation/message_form/message_form_attachment_image.d.ts.map +1 -1
  6. package/build/components/conversation/message_form/message_form_attachment_image.js +1 -2
  7. package/build/components/conversation/message_form/message_form_attachment_image.js.map +1 -1
  8. package/build/components/conversation/message_form.d.ts.map +1 -1
  9. package/build/components/conversation/message_form.js +59 -5
  10. package/build/components/conversation/message_form.js.map +1 -1
  11. package/build/components/conversation/messages_disabled_banners.d.ts.map +1 -1
  12. package/build/components/conversation/messages_disabled_banners.js +2 -14
  13. package/build/components/conversation/messages_disabled_banners.js.map +1 -1
  14. package/build/hooks/use_attachment_uploader.d.ts +2 -0
  15. package/build/hooks/use_attachment_uploader.d.ts.map +1 -1
  16. package/build/hooks/use_attachment_uploader.js +13 -2
  17. package/build/hooks/use_attachment_uploader.js.map +1 -1
  18. package/build/hooks/use_features.d.ts +0 -1
  19. package/build/hooks/use_features.d.ts.map +1 -1
  20. package/build/hooks/use_features.js +0 -1
  21. package/build/hooks/use_features.js.map +1 -1
  22. package/build/hooks/use_upload_client.d.ts.map +1 -1
  23. package/build/hooks/use_upload_client.js +7 -0
  24. package/build/hooks/use_upload_client.js.map +1 -1
  25. package/build/screens/conversation_screen.d.ts +1 -2
  26. package/build/screens/conversation_screen.d.ts.map +1 -1
  27. package/build/screens/conversation_screen.js +4 -9
  28. package/build/screens/conversation_screen.js.map +1 -1
  29. package/build/screens/message_actions_screen.js +1 -2
  30. package/build/screens/message_actions_screen.js.map +1 -1
  31. package/build/types/resources/denormalized_attachment_resource_for_create.d.ts +2 -0
  32. package/build/types/resources/denormalized_attachment_resource_for_create.d.ts.map +1 -1
  33. package/build/types/resources/denormalized_attachment_resource_for_create.js.map +1 -1
  34. package/build/utils/upload_uri.d.ts +1 -0
  35. package/build/utils/upload_uri.d.ts.map +1 -1
  36. package/build/utils/upload_uri.js +1 -0
  37. package/build/utils/upload_uri.js.map +1 -1
  38. package/package.json +2 -2
  39. package/src/components/conversation/message.tsx +4 -9
  40. package/src/components/conversation/message_form/message_form_attachment_image.tsx +1 -2
  41. package/src/components/conversation/message_form.tsx +86 -4
  42. package/src/components/conversation/messages_disabled_banners.tsx +9 -17
  43. package/src/hooks/use_attachment_uploader.ts +14 -2
  44. package/src/hooks/use_features.ts +0 -1
  45. package/src/hooks/use_upload_client.ts +8 -0
  46. package/src/screens/conversation_screen.tsx +2 -13
  47. package/src/screens/message_actions_screen.tsx +1 -2
  48. package/src/types/resources/denormalized_attachment_resource_for_create.ts +2 -0
  49. package/src/utils/upload_uri.ts +1 -0
@@ -1 +1 @@
1
- {"version":3,"file":"message_actions_screen.js","sourceRoot":"","sources":["../../src/screens/message_actions_screen.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAA;AAC9D,OAAO,EAAE,YAAY,EAAqB,aAAa,EAAE,MAAM,0BAA0B,CAAA;AACzF,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAA;AACnD,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAA;AACtC,OAAO,KAAK,EAAE,EAAE,WAAW,EAAE,MAAM,OAAO,CAAA;AAC1C,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,cAAc,CAAA;AAChE,OAAO,EAAE,IAAI,EAAE,MAAM,eAAe,CAAA;AACpC,OAAO,EAAE,iBAAiB,EAAE,MAAM,6CAA6C,CAAA;AAC/E,OAAO,EAAE,eAAe,EAAE,MAAM,UAAU,CAAA;AAC1C,OAAO,SAAS,EAAE,EAAE,yBAAyB,EA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P,UAAU,EAAE,CAAC;YACb,aAAa,EAAE,EAAE;YACjB,iBAAiB,EAAE,MAAM,CAAC,sBAAsB;YAChD,iBAAiB,EAAE,CAAC;SACrB;QACD,QAAQ,EAAE;YACR,MAAM,EAAE,eAAe;YACvB,KAAK,EAAE,eAAe;YACtB,WAAW,EAAE,cAAc;YAC3B,YAAY,EAAE,EAAE;YAChB,cAAc,EAAE,QAAQ;YACxB,QAAQ,EAAE,QAAQ;SACnB;QACD,aAAa,EAAE;YACb,QAAQ,EAAE,EAAE;YACZ,SAAS,EAAE,QAAQ;SACpB;QACD,OAAO,EAAE;YACP,UAAU,EAAE,CAAC;SACd;KACF,CAAC,CAAA;AACJ,CAAC,CAAA","sourcesContent":["import { PlatformPressable } from '@react-navigation/elements'\nimport { StackActions, StaticScreenProps, useNavigation } from '@react-navigation/native'\nimport { useMutation } from '@tanstack/react-query'\nimport { isNil, omitBy } from 'lodash'\nimport React, { useCallback } from 'react'\nimport { Alert, Platform, StyleSheet, View } from 'react-native'\nimport { Text } from '../components'\nimport { useReactionStyles } from '../components/conversation/message_reaction'\nimport { REACTION_EMOJIS } from '../utils'\nimport FormSheet, { getFormSheetScreenOptions } from '../components/primitive/form_sheet'\nimport { useCreateAndroidRippleColor, useFontScale, useTheme } from '../hooks'\nimport { useApiClient } from '../hooks/use_api_client'\nimport { useConversationMessages } from '../hooks/use_conversation_messages'\nimport { useMessageReactionToggle } from '../hooks/use_message_reaction_toggle'\nimport { ReactionCountResource } from '../types/resources/reaction'\nimport { Clipboard, Haptic } from '../utils/native_adapters'\nimport { MessageResource } from '../types'\nimport { availableFeatures, useFeatures } from '../hooks/use_features'\n\nexport const MessageActionsScreenOptions = getFormSheetScreenOptions({\n sheetAllowedDetents: [0.5],\n headerTitle: 'Message actions',\n})\n\nexport type MessageActionsScreenProps = StaticScreenProps<{\n message_id: string\n reply_root_author_name?: string\n conversation_id: number\n canDeleteNonAuthoredMessages?: boolean\n inReplyScreen?: boolean\n}>\n\nexport function MessageActionsScreen({ route }: MessageActionsScreenProps) {\n const {\n conversation_id,\n message_id,\n canDeleteNonAuthoredMessages,\n inReplyScreen,\n reply_root_author_name,\n } = route.params\n\n const { messages, refetch } = useConversationMessages(\n { conversation_id },\n { refetchOnMount: false }\n )\n const message = messages.find(m => m.id === message_id)\n\n if (!message) return null\n\n return (\n <MessageActionsScreenContent\n message={message}\n conversation_id={conversation_id}\n canDeleteNonAuthoredMessages={canDeleteNonAuthoredMessages || false}\n refetchMessages={refetch}\n inReplyScreen={inReplyScreen}\n replyRootAuthorName={reply_root_author_name}\n />\n )\n}\n\nfunction MessageActionsScreenContent({\n message,\n conversation_id,\n canDeleteNonAuthoredMessages,\n refetchMessages,\n inReplyScreen,\n replyRootAuthorName,\n}: {\n message: MessageResource\n conversation_id: number\n canDeleteNonAuthoredMessages: boolean\n refetchMessages: () => void\n inReplyScreen?: boolean\n replyRootAuthorName?: string\n}) {\n const navigation = useNavigation()\n const apiClient = useApiClient()\n const styles = useStyles()\n const { featureEnabled } = useFeatures()\n const repliesEnabled = featureEnabled(availableFeatures.threaded_replies)\n const expandedLink = message.attachments.find(attachment => attachment.type === 'ExpandedLink')\n const hasExpandedLink = !!expandedLink\n\n const myReactions = message?.reactionCounts\n .filter(reaction => reaction.mine)\n .map(reaction => reaction.value)\n\n const availableReactions = Object.entries(REACTION_EMOJIS).map(([value, emoji]) => {\n return {\n value: value as ReactionCountResource['value'],\n emoji,\n mine: myReactions?.includes(value as ReactionCountResource['value']),\n }\n })\n\n const attachmentForCopy = (): string => {\n const giphyTitleLink = message?.attachments.find(\n attachment => attachment.type === 'giphy'\n )?.titleLink\n\n if (giphyTitleLink) return giphyTitleLink\n return ''\n }\n\n const handleReplyPress = useCallback(() => {\n navigation.goBack()\n // Waits for the modal to be dismissed before pushing the reply screen\n requestAnimationFrame(() => {\n navigation.navigate('ConversationReply', {\n conversation_id,\n reply_root_id: message.replyRootId || message.id,\n reply_root_author_name: replyRootAuthorName,\n })\n })\n }, [navigation, conversation_id, message.id, message.replyRootId, replyRootAuthorName])\n\n const handleCopyPress = () => {\n Clipboard.setStringAsync(message?.text || attachmentForCopy() || '')\n navigation.goBack()\n }\n\n const handleReportPress = useCallback(() => {\n Haptic.impactLight()\n navigation.navigate('MessageReport', {\n conversation_id,\n message_id: message.id,\n })\n }, [navigation, conversation_id, message.id])\n\n const { handleReactionToggle, isPending } = useMessageReactionToggle({\n conversation_id,\n message,\n })\n\n const deleteMessage = useCallback(() => {\n const url = `/me/conversations/${conversation_id}/messages/${message.id}/`\n\n return apiClient.chat.delete({ url })\n }, [apiClient, conversation_id, message.id])\n\n const { mutate: handleDeleteMessage } = useMutation({\n mutationFn: deleteMessage,\n mutationKey: ['deleteMessage', message.id],\n onSuccess: () => {\n refetchMessages()\n Haptic.notificationSuccess()\n },\n onError: () => {\n Alert.alert('Oops', 'We were unable to delete this message. Please try again.')\n },\n })\n\n const handleDeleteConfirm = useCallback(() => {\n Alert.alert('Delete message', 'Are you sure you want to permanently delete this message?', [\n { text: 'Cancel', style: 'cancel' },\n {\n text: 'Delete',\n style: 'destructive',\n onPress: () => {\n handleDeleteMessage()\n navigation.goBack()\n },\n },\n ])\n }, [handleDeleteMessage, navigation])\n\n const handleEditPress = useCallback(() => {\n const state = navigation.getState?.()\n const targetRouteName = inReplyScreen ? 'ConversationReply' : 'Conversation'\n const targetRoute = state?.routes?.find(r => r.name === targetRouteName)\n const params = omitBy(\n {\n ...(targetRoute?.params || {}),\n conversation_id,\n editing_message_id: message.id,\n },\n isNil\n )\n navigation.dispatch(StackActions.popTo(targetRouteName, params))\n }, [navigation, conversation_id, message.id, inReplyScreen])\n\n const handleViewReadReceiptsPress = useCallback(() => {\n Haptic.impactLight()\n const params = omitBy(\n {\n conversation_id,\n message_id: message.id,\n },\n isNil\n )\n navigation.dispatch(StackActions.popTo('MessageReadReceipts', params))\n }, [navigation, conversation_id, message.id])\n\n const removeLinkPreview = useCallback(() => {\n const url = `/me/conversations/${conversation_id}/messages/${message.id}/remove_expanded_link`\n const data = {\n data: { type: 'ExpandedLink', attributes: { expanded_link_id: expandedLink?.id } },\n }\n\n return apiClient.chat.post({ url, data })\n }, [apiClient, conversation_id, message.id, expandedLink])\n\n const { mutate: handleRemoveLinkPreview } = useMutation({\n mutationFn: removeLinkPreview,\n onSuccess: () => {\n refetchMessages()\n Haptic.notificationSuccess()\n navigation.goBack()\n },\n onError: () => {\n Alert.alert('Oops', 'We were unable to remove the preview. Please try again.')\n },\n })\n\n const handleRemoveLinkPreviewConfirm = useCallback(() => {\n Alert.alert('Remove link preview?', 'This will remove the image preview but retain the link', [\n { text: 'Cancel', style: 'cancel' },\n { text: 'Remove', style: 'destructive', onPress: () => handleRemoveLinkPreview() },\n ])\n }, [handleRemoveLinkPreview])\n\n const showReportMessageAction =\n !message?.mine && featureEnabled(availableFeatures.message_reporting)\n\n return (\n <FormSheet.Root style={styles.formSheetContent}>\n <View style={styles.reactionList}>\n {availableReactions.map((reaction, index) => (\n <Reaction\n key={index}\n reaction={reaction}\n onPress={() => {\n Haptic.impactLight()\n handleReactionToggle({\n value: reaction.value,\n mine: reaction.mine,\n })\n navigation.goBack()\n }}\n />\n ))}\n </View>\n <View style={styles.actions}>\n {repliesEnabled && !inReplyScreen && (\n <FormSheet.Action\n onPress={handleReplyPress}\n title=\"Reply to message\"\n iconName=\"registrations.undo\"\n accessibilityHint=\"Navigates to the reply screen\"\n accessibilityRole=\"link\"\n />\n )}\n <FormSheet.Action\n onPress={handleCopyPress}\n title=\"Copy text\"\n iconName=\"services.fileCopy\"\n accessibilityHint=\"Copies text and links to clipboard\"\n />\n {showReportMessageAction && (\n <FormSheet.Action\n onPress={handleReportPress}\n title=\"Report message\"\n iconName=\"chat.reportMessageO\"\n accessibilityHint=\"Opens a form to report this message\"\n />\n )}\n {message?.mine && (\n <FormSheet.Action\n onPress={() => handleEditPress()}\n title=\"Edit message\"\n iconName=\"accounts.editor\"\n accessibilityHint=\"Opens existing text in the message form input.\"\n />\n )}\n {message?.mine && (\n <FormSheet.Action\n onPress={() => handleViewReadReceiptsPress()}\n title=\"View read receipts\"\n iconName=\"general.checkPerson\"\n accessibilityHint=\"Opens a modal with a list of people who read your message.\"\n />\n )}\n {message?.mine && hasExpandedLink && (\n <FormSheet.Action\n onPress={() => handleRemoveLinkPreviewConfirm()}\n title=\"Remove link preview\"\n iconName=\"general.brokenLink\"\n accessibilityHint=\"Removes an expanded link preview from the message.\"\n />\n )}\n {(message?.mine || canDeleteNonAuthoredMessages) && (\n <FormSheet.Action\n onPress={() => handleDeleteConfirm()}\n title=\"Delete message\"\n iconName=\"publishing.trash\"\n appearance=\"danger\"\n disabled={isPending}\n accessibilityHint=\"Opens a confirmation alert to delete this message permanently.\"\n />\n )}\n </View>\n </FormSheet.Root>\n )\n}\n\nconst Reaction = ({\n reaction,\n onPress,\n}: {\n reaction: { value: ReactionCountResource['value']; emoji: string; mine: boolean | undefined }\n onPress: () => void\n}) => {\n const styles = useStyles()\n const reactionStyles = useReactionStyles({ mine: reaction.mine ? 1 : 0 })\n\n const { colors } = useTheme()\n const baseRippleColor = reaction.mine ? colors.interaction : colors.fillColorNeutral060\n const androidRippleColor = useCreateAndroidRippleColor({ color: baseRippleColor })\n\n return (\n <PlatformPressable\n key={reaction.value}\n style={[reactionStyles.reaction, styles.reaction]}\n android_ripple={{ color: androidRippleColor, borderless: false, foreground: true }}\n onPress={onPress}\n >\n <Text style={styles.reactionEmoji} allowFontScaling={false}>\n {REACTION_EMOJIS[reaction.value]}\n </Text>\n </PlatformPressable>\n )\n}\n\nconst useStyles = () => {\n const { colors } = useTheme()\n const fontScale = useFontScale({ maxFontSizeMultiplier: 1.3 })\n\n const btnBorderWidth = 1\n const baseSize = 46 * Math.max(1, fontScale)\n const reactionBtnSize = Platform.select({\n ios: baseSize,\n android: baseSize + btnBorderWidth * 2,\n })\n\n return StyleSheet.create({\n formSheetContent: {\n paddingTop: 16,\n },\n reactionList: {\n flexDirection: 'row',\n justifyContent: 'center',\n alignItems: 'center',\n gap: 16,\n paddingTop: 8,\n paddingBottom: 16,\n borderBottomColor: colors.borderColorDefaultBase,\n borderBottomWidth: 1,\n },\n reaction: {\n height: reactionBtnSize,\n width: reactionBtnSize,\n borderWidth: btnBorderWidth,\n borderRadius: 32,\n justifyContent: 'center',\n overflow: 'hidden',\n },\n reactionEmoji: {\n fontSize: 24,\n textAlign: 'center',\n },\n actions: {\n paddingTop: 4,\n },\n })\n}\n"]}
1
+ {"version":3,"file":"message_actions_screen.js","sourceRoot":"","sources":["../../src/screens/message_actions_screen.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAA;AAC9D,OAAO,EAAE,YAAY,EAAqB,aAAa,EAAE,MAAM,0BAA0B,CAAA;AACzF,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAA;AACnD,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAA;AACtC,OAAO,KAAK,EAAE,EAAE,WAAW,EAAE,MAAM,OAAO,CAAA;AAC1C,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,cAAc,CAAA;AAChE,OAAO,EAAE,IAAI,EAAE,MAAM,eAAe,CAAA;AACpC,OAAO,EAAE,iBAAiB,EAAE,MAAM,6CAA6C,CAAA;AAC/E,OAAO,EAAE,eAAe,EAAE,MAAM,UAAU,CAAA;AAC1C,OAAO,SAAS,EAAE,EAAE,yBAAyB,EAAE,MAAM,oCAAoC,CAAA;AACzF,OAAO,EAAE,2BAA2B,EAAE,YAAY,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAA;AAC9E,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAA;AACtD,OAAO,EAAE,uBAAuB,EAAE,MAAM,oCAAoC,CAAA;AAC5E,OAAO,EAAE,wBAAwB,EAAE,MAAM,sCAAsC,CAAA;AAE/E,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,0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E,CAAC;SACd;KACF,CAAC,CAAA;AACJ,CAAC,CAAA","sourcesContent":["import { PlatformPressable } from '@react-navigation/elements'\nimport { StackActions, StaticScreenProps, useNavigation } from '@react-navigation/native'\nimport { useMutation } from '@tanstack/react-query'\nimport { isNil, omitBy } from 'lodash'\nimport React, { useCallback } from 'react'\nimport { Alert, Platform, StyleSheet, View } from 'react-native'\nimport { Text } from '../components'\nimport { useReactionStyles } from '../components/conversation/message_reaction'\nimport { REACTION_EMOJIS } from '../utils'\nimport FormSheet, { getFormSheetScreenOptions } from '../components/primitive/form_sheet'\nimport { useCreateAndroidRippleColor, useFontScale, useTheme } from '../hooks'\nimport { useApiClient } from '../hooks/use_api_client'\nimport { useConversationMessages } from '../hooks/use_conversation_messages'\nimport { useMessageReactionToggle } from '../hooks/use_message_reaction_toggle'\nimport { ReactionCountResource } from '../types/resources/reaction'\nimport { Clipboard, Haptic } from '../utils/native_adapters'\nimport { MessageResource } from '../types'\nimport { availableFeatures, useFeatures } from '../hooks/use_features'\n\nexport const MessageActionsScreenOptions = getFormSheetScreenOptions({\n sheetAllowedDetents: [0.5],\n headerTitle: 'Message actions',\n})\n\nexport type MessageActionsScreenProps = StaticScreenProps<{\n message_id: string\n reply_root_author_name?: string\n conversation_id: number\n canDeleteNonAuthoredMessages?: boolean\n inReplyScreen?: boolean\n}>\n\nexport function MessageActionsScreen({ route }: MessageActionsScreenProps) {\n const {\n conversation_id,\n message_id,\n canDeleteNonAuthoredMessages,\n inReplyScreen,\n reply_root_author_name,\n } = route.params\n\n const { messages, refetch } = useConversationMessages(\n { conversation_id },\n { refetchOnMount: false }\n )\n const message = messages.find(m => m.id === message_id)\n\n if (!message) return null\n\n return (\n <MessageActionsScreenContent\n message={message}\n conversation_id={conversation_id}\n canDeleteNonAuthoredMessages={canDeleteNonAuthoredMessages || false}\n refetchMessages={refetch}\n inReplyScreen={inReplyScreen}\n replyRootAuthorName={reply_root_author_name}\n />\n )\n}\n\nfunction MessageActionsScreenContent({\n message,\n conversation_id,\n canDeleteNonAuthoredMessages,\n refetchMessages,\n inReplyScreen,\n replyRootAuthorName,\n}: {\n message: MessageResource\n conversation_id: number\n canDeleteNonAuthoredMessages: boolean\n refetchMessages: () => void\n inReplyScreen?: boolean\n replyRootAuthorName?: string\n}) {\n const navigation = useNavigation()\n const apiClient = useApiClient()\n const styles = useStyles()\n const { featureEnabled } = useFeatures()\n const expandedLink = message.attachments.find(attachment => attachment.type === 'ExpandedLink')\n const hasExpandedLink = !!expandedLink\n\n const myReactions = message?.reactionCounts\n .filter(reaction => reaction.mine)\n .map(reaction => reaction.value)\n\n const availableReactions = Object.entries(REACTION_EMOJIS).map(([value, emoji]) => {\n return {\n value: value as ReactionCountResource['value'],\n emoji,\n mine: myReactions?.includes(value as ReactionCountResource['value']),\n }\n })\n\n const attachmentForCopy = (): string => {\n const giphyTitleLink = message?.attachments.find(\n attachment => attachment.type === 'giphy'\n )?.titleLink\n\n if (giphyTitleLink) return giphyTitleLink\n return ''\n }\n\n const handleReplyPress = useCallback(() => {\n navigation.goBack()\n // Waits for the modal to be dismissed before pushing the reply screen\n requestAnimationFrame(() => {\n navigation.navigate('ConversationReply', {\n conversation_id,\n reply_root_id: message.replyRootId || message.id,\n reply_root_author_name: replyRootAuthorName,\n })\n })\n }, [navigation, conversation_id, message.id, message.replyRootId, replyRootAuthorName])\n\n const handleCopyPress = () => {\n Clipboard.setStringAsync(message?.text || attachmentForCopy() || '')\n navigation.goBack()\n }\n\n const handleReportPress = useCallback(() => {\n Haptic.impactLight()\n navigation.navigate('MessageReport', {\n conversation_id,\n message_id: message.id,\n })\n }, [navigation, conversation_id, message.id])\n\n const { handleReactionToggle, isPending } = useMessageReactionToggle({\n conversation_id,\n message,\n })\n\n const deleteMessage = useCallback(() => {\n const url = `/me/conversations/${conversation_id}/messages/${message.id}/`\n\n return apiClient.chat.delete({ url })\n }, [apiClient, conversation_id, message.id])\n\n const { mutate: handleDeleteMessage } = useMutation({\n mutationFn: deleteMessage,\n mutationKey: ['deleteMessage', message.id],\n onSuccess: () => {\n refetchMessages()\n Haptic.notificationSuccess()\n },\n onError: () => {\n Alert.alert('Oops', 'We were unable to delete this message. Please try again.')\n },\n })\n\n const handleDeleteConfirm = useCallback(() => {\n Alert.alert('Delete message', 'Are you sure you want to permanently delete this message?', [\n { text: 'Cancel', style: 'cancel' },\n {\n text: 'Delete',\n style: 'destructive',\n onPress: () => {\n handleDeleteMessage()\n navigation.goBack()\n },\n },\n ])\n }, [handleDeleteMessage, navigation])\n\n const handleEditPress = useCallback(() => {\n const state = navigation.getState?.()\n const targetRouteName = inReplyScreen ? 'ConversationReply' : 'Conversation'\n const targetRoute = state?.routes?.find(r => r.name === targetRouteName)\n const params = omitBy(\n {\n ...(targetRoute?.params || {}),\n conversation_id,\n editing_message_id: message.id,\n },\n isNil\n )\n navigation.dispatch(StackActions.popTo(targetRouteName, params))\n }, [navigation, conversation_id, message.id, inReplyScreen])\n\n const handleViewReadReceiptsPress = useCallback(() => {\n Haptic.impactLight()\n const params = omitBy(\n {\n conversation_id,\n message_id: message.id,\n },\n isNil\n )\n navigation.dispatch(StackActions.popTo('MessageReadReceipts', params))\n }, [navigation, conversation_id, message.id])\n\n const removeLinkPreview = useCallback(() => {\n const url = `/me/conversations/${conversation_id}/messages/${message.id}/remove_expanded_link`\n const data = {\n data: { type: 'ExpandedLink', attributes: { expanded_link_id: expandedLink?.id } },\n }\n\n return apiClient.chat.post({ url, data })\n }, [apiClient, conversation_id, message.id, expandedLink])\n\n const { mutate: handleRemoveLinkPreview } = useMutation({\n mutationFn: removeLinkPreview,\n onSuccess: () => {\n refetchMessages()\n Haptic.notificationSuccess()\n navigation.goBack()\n },\n onError: () => {\n Alert.alert('Oops', 'We were unable to remove the preview. Please try again.')\n },\n })\n\n const handleRemoveLinkPreviewConfirm = useCallback(() => {\n Alert.alert('Remove link preview?', 'This will remove the image preview but retain the link', [\n { text: 'Cancel', style: 'cancel' },\n { text: 'Remove', style: 'destructive', onPress: () => handleRemoveLinkPreview() },\n ])\n }, [handleRemoveLinkPreview])\n\n const showReportMessageAction =\n !message?.mine && featureEnabled(availableFeatures.message_reporting)\n\n return (\n <FormSheet.Root style={styles.formSheetContent}>\n <View style={styles.reactionList}>\n {availableReactions.map((reaction, index) => (\n <Reaction\n key={index}\n reaction={reaction}\n onPress={() => {\n Haptic.impactLight()\n handleReactionToggle({\n value: reaction.value,\n mine: reaction.mine,\n })\n navigation.goBack()\n }}\n />\n ))}\n </View>\n <View style={styles.actions}>\n {!inReplyScreen && (\n <FormSheet.Action\n onPress={handleReplyPress}\n title=\"Reply to message\"\n iconName=\"registrations.undo\"\n accessibilityHint=\"Navigates to the reply screen\"\n accessibilityRole=\"link\"\n />\n )}\n <FormSheet.Action\n onPress={handleCopyPress}\n title=\"Copy text\"\n iconName=\"services.fileCopy\"\n accessibilityHint=\"Copies text and links to clipboard\"\n />\n {showReportMessageAction && (\n <FormSheet.Action\n onPress={handleReportPress}\n title=\"Report message\"\n iconName=\"chat.reportMessageO\"\n accessibilityHint=\"Opens a form to report this message\"\n />\n )}\n {message?.mine && (\n <FormSheet.Action\n onPress={() => handleEditPress()}\n title=\"Edit message\"\n iconName=\"accounts.editor\"\n accessibilityHint=\"Opens existing text in the message form input.\"\n />\n )}\n {message?.mine && (\n <FormSheet.Action\n onPress={() => handleViewReadReceiptsPress()}\n title=\"View read receipts\"\n iconName=\"general.checkPerson\"\n accessibilityHint=\"Opens a modal with a list of people who read your message.\"\n />\n )}\n {message?.mine && hasExpandedLink && (\n <FormSheet.Action\n onPress={() => handleRemoveLinkPreviewConfirm()}\n title=\"Remove link preview\"\n iconName=\"general.brokenLink\"\n accessibilityHint=\"Removes an expanded link preview from the message.\"\n />\n )}\n {(message?.mine || canDeleteNonAuthoredMessages) && (\n <FormSheet.Action\n onPress={() => handleDeleteConfirm()}\n title=\"Delete message\"\n iconName=\"publishing.trash\"\n appearance=\"danger\"\n disabled={isPending}\n accessibilityHint=\"Opens a confirmation alert to delete this message permanently.\"\n />\n )}\n </View>\n </FormSheet.Root>\n )\n}\n\nconst Reaction = ({\n reaction,\n onPress,\n}: {\n reaction: { value: ReactionCountResource['value']; emoji: string; mine: boolean | undefined }\n onPress: () => void\n}) => {\n const styles = useStyles()\n const reactionStyles = useReactionStyles({ mine: reaction.mine ? 1 : 0 })\n\n const { colors } = useTheme()\n const baseRippleColor = reaction.mine ? colors.interaction : colors.fillColorNeutral060\n const androidRippleColor = useCreateAndroidRippleColor({ color: baseRippleColor })\n\n return (\n <PlatformPressable\n key={reaction.value}\n style={[reactionStyles.reaction, styles.reaction]}\n android_ripple={{ color: androidRippleColor, borderless: false, foreground: true }}\n onPress={onPress}\n >\n <Text style={styles.reactionEmoji} allowFontScaling={false}>\n {REACTION_EMOJIS[reaction.value]}\n </Text>\n </PlatformPressable>\n )\n}\n\nconst useStyles = () => {\n const { colors } = useTheme()\n const fontScale = useFontScale({ maxFontSizeMultiplier: 1.3 })\n\n const btnBorderWidth = 1\n const baseSize = 46 * Math.max(1, fontScale)\n const reactionBtnSize = Platform.select({\n ios: baseSize,\n android: baseSize + btnBorderWidth * 2,\n })\n\n return StyleSheet.create({\n formSheetContent: {\n paddingTop: 16,\n },\n reactionList: {\n flexDirection: 'row',\n justifyContent: 'center',\n alignItems: 'center',\n gap: 16,\n paddingTop: 8,\n paddingBottom: 16,\n borderBottomColor: colors.borderColorDefaultBase,\n borderBottomWidth: 1,\n },\n reaction: {\n height: reactionBtnSize,\n width: reactionBtnSize,\n borderWidth: btnBorderWidth,\n borderRadius: 32,\n justifyContent: 'center',\n overflow: 'hidden',\n },\n reactionEmoji: {\n fontSize: 24,\n textAlign: 'center',\n },\n actions: {\n paddingTop: 4,\n },\n })\n}\n"]}
@@ -36,11 +36,13 @@ export interface FileAttachment {
36
36
  file: NativeAttachmentFile;
37
37
  status: AttachmentStatus;
38
38
  uploadedAt: number;
39
+ flagged?: boolean;
39
40
  }
40
41
  export interface FileUploadState {
41
42
  [fileName: string]: {
42
43
  status: AttachmentStatus;
43
44
  id?: string;
45
+ flagged?: boolean;
44
46
  };
45
47
  }
46
48
  export interface FileUploadError {
@@ -1 +1 @@
1
- {"version":3,"file":"denormalized_attachment_resource_for_create.d.ts","sourceRoot":"","sources":["../../../src/types/resources/denormalized_attachment_resource_for_create.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,0CAA0C,EAC1C,yBAAyB,EACzB,sBAAsB,EACvB,MAAM,oCAAoC,CAAA;AAE3C,MAAM,MAAM,uCAAuC,GAC/C,8CAA8C,GAC9C,4CAA4C,GAC5C,0CAA0C,CAAA;AAE9C,MAAM,WAAW,8CAA+C,SAAQ,yBAAyB;IAC/F,IAAI,EAAE,mBAAmB,CAAA;IACzB,EAAE,EAAE,MAAM,CAAA;IAGV,IAAI,EAAE,oBAAoB,CAAA;CAC3B;AAED,MAAM,WAAW,4CAA6C,SAAQ,yBAAyB;IAC7F,IAAI,EAAE,OAAO,CAAA;IACb,EAAE,EAAE,MAAM,CAAA;IACV,KAAK,EAAE,MAAM,CAAA;IACb,oBAAoB,EAAE,MAAM,CAAA;IAC5B,UAAU,EAAE,MAAM,CAAA;IAClB,SAAS,EAAE,MAAM,CAAA;IACjB,KAAK,EAAE;QACL,QAAQ,EAAE,sBAAsB,CAAA;QAChC,YAAY,EAAE,sBAAsB,CAAA;QACpC,kBAAkB,EAAE,sBAAsB,CAAA;QAC1C,wBAAwB,EAAE,sBAAsB,CAAA;QAChD,WAAW,EAAE,sBAAsB,CAAA;QACnC,iBAAiB,EAAE,sBAAsB,CAAA;QACzC,uBAAuB,EAAE,sBAAsB,CAAA;KAChD,CAAA;CACF;AAED,KAAK,gBAAgB,GAAG,WAAW,GAAG,SAAS,GAAG,OAAO,CAAA;AAEzD,MAAM,WAAW,oBAAoB;IACnC,GAAG,EAAE,MAAM,CAAA;IACX,IAAI,EAAE,MAAM,CAAA;IACZ,IAAI,EAAE,MAAM,CAAA;IACZ,IAAI,EAAE,MAAM,CAAA;IACZ,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,MAAM,CAAC,EAAE,MAAM,CAAA;CAChB;AAED,MAAM,WAAW,cAAc;IAC7B,EAAE,CAAC,EAAE,MAAM,CAAA;IACX,IAAI,EAAE,oBAAoB,CAAA;IAC1B,MAAM,EAAE,gBAAgB,CAAA;IACxB,UAAU,EAAE,MAAM,CAAA;CACnB;AAED,MAAM,WAAW,eAAe;IAC9B,CAAC,QAAQ,EAAE,MAAM,GAAG;QAClB,MAAM,EAAE,gBAAgB,CAAA;QACxB,EAAE,CAAC,EAAE,MAAM,CAAA;KACZ,CAAA;CACF;AAED,MAAM,WAAW,eAAe;IAC9B,SAAS,CAAC,EAAE,MAAM,EAAE,CAAA;IACpB,SAAS,CAAC,EAAE,OAAO,CAAA;CACpB"}
1
+ {"version":3,"file":"denormalized_attachment_resource_for_create.d.ts","sourceRoot":"","sources":["../../../src/types/resources/denormalized_attachment_resource_for_create.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,0CAA0C,EAC1C,yBAAyB,EACzB,sBAAsB,EACvB,MAAM,oCAAoC,CAAA;AAE3C,MAAM,MAAM,uCAAuC,GAC/C,8CAA8C,GAC9C,4CAA4C,GAC5C,0CAA0C,CAAA;AAE9C,MAAM,WAAW,8CAA+C,SAAQ,yBAAyB;IAC/F,IAAI,EAAE,mBAAmB,CAAA;IACzB,EAAE,EAAE,MAAM,CAAA;IAGV,IAAI,EAAE,oBAAoB,CAAA;CAC3B;AAED,MAAM,WAAW,4CAA6C,SAAQ,yBAAyB;IAC7F,IAAI,EAAE,OAAO,CAAA;IACb,EAAE,EAAE,MAAM,CAAA;IACV,KAAK,EAAE,MAAM,CAAA;IACb,oBAAoB,EAAE,MAAM,CAAA;IAC5B,UAAU,EAAE,MAAM,CAAA;IAClB,SAAS,EAAE,MAAM,CAAA;IACjB,KAAK,EAAE;QACL,QAAQ,EAAE,sBAAsB,CAAA;QAChC,YAAY,EAAE,sBAAsB,CAAA;QACpC,kBAAkB,EAAE,sBAAsB,CAAA;QAC1C,wBAAwB,EAAE,sBAAsB,CAAA;QAChD,WAAW,EAAE,sBAAsB,CAAA;QACnC,iBAAiB,EAAE,sBAAsB,CAAA;QACzC,uBAAuB,EAAE,sBAAsB,CAAA;KAChD,CAAA;CACF;AAED,KAAK,gBAAgB,GAAG,WAAW,GAAG,SAAS,GAAG,OAAO,CAAA;AAEzD,MAAM,WAAW,oBAAoB;IACnC,GAAG,EAAE,MAAM,CAAA;IACX,IAAI,EAAE,MAAM,CAAA;IACZ,IAAI,EAAE,MAAM,CAAA;IACZ,IAAI,EAAE,MAAM,CAAA;IACZ,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,MAAM,CAAC,EAAE,MAAM,CAAA;CAChB;AAED,MAAM,WAAW,cAAc;IAC7B,EAAE,CAAC,EAAE,MAAM,CAAA;IACX,IAAI,EAAE,oBAAoB,CAAA;IAC1B,MAAM,EAAE,gBAAgB,CAAA;IACxB,UAAU,EAAE,MAAM,CAAA;IAClB,OAAO,CAAC,EAAE,OAAO,CAAA;CAClB;AAED,MAAM,WAAW,eAAe;IAC9B,CAAC,QAAQ,EAAE,MAAM,GAAG;QAClB,MAAM,EAAE,gBAAgB,CAAA;QACxB,EAAE,CAAC,EAAE,MAAM,CAAA;QACX,OAAO,CAAC,EAAE,OAAO,CAAA;KAClB,CAAA;CACF;AAED,MAAM,WAAW,eAAe;IAC9B,SAAS,CAAC,EAAE,MAAM,EAAE,CAAA;IACpB,SAAS,CAAC,EAAE,OAAO,CAAA;CACpB"}
@@ -1 +1 @@
1
- {"version":3,"file":"denormalized_attachment_resource_for_create.js","sourceRoot":"","sources":["../../../src/types/resources/denormalized_attachment_resource_for_create.ts"],"names":[],"mappings":"","sourcesContent":["import {\n DenormalizedExpandedLinkAttachmentResource,\n GenericAttachmentResource,\n GiphyAttachmentVariant,\n} from './denormalized_attachment_resource'\n\nexport type DenormalizedAttachmentResourceForCreate =\n | DenormalizedMessageAttachmentResourceForCreate\n | DenormalizedGiphyAttachmentResourceForCreate\n | DenormalizedExpandedLinkAttachmentResource\n\nexport interface DenormalizedMessageAttachmentResourceForCreate extends GenericAttachmentResource {\n type: 'MessageAttachment'\n id: string\n\n // Not needed for upload, but is used to preview image during pending send state\n file: NativeAttachmentFile\n}\n\nexport interface DenormalizedGiphyAttachmentResourceForCreate extends GenericAttachmentResource {\n type: 'giphy'\n id: string\n title: string\n original_giphy_title: string\n title_link: string\n thumb_url: string\n giphy: {\n original: GiphyAttachmentVariant\n fixed_height: GiphyAttachmentVariant\n fixed_height_still: GiphyAttachmentVariant\n fixed_height_downsampled: GiphyAttachmentVariant\n fixed_width: GiphyAttachmentVariant\n fixed_width_still: GiphyAttachmentVariant\n fixed_width_downsampled: GiphyAttachmentVariant\n }\n}\n\ntype AttachmentStatus = 'uploading' | 'success' | 'error'\n\nexport interface NativeAttachmentFile {\n uri: string\n name: string\n type: string // Should be a MIME type\n size: number\n width?: number\n height?: number\n}\n\nexport interface FileAttachment {\n id?: string\n file: NativeAttachmentFile\n status: AttachmentStatus\n uploadedAt: number\n}\n\nexport interface FileUploadState {\n [fileName: string]: {\n status: AttachmentStatus\n id?: string\n }\n}\n\nexport interface FileUploadError {\n file_type?: string[]\n file_size?: boolean\n}\n"]}
1
+ {"version":3,"file":"denormalized_attachment_resource_for_create.js","sourceRoot":"","sources":["../../../src/types/resources/denormalized_attachment_resource_for_create.ts"],"names":[],"mappings":"","sourcesContent":["import {\n DenormalizedExpandedLinkAttachmentResource,\n GenericAttachmentResource,\n GiphyAttachmentVariant,\n} from './denormalized_attachment_resource'\n\nexport type DenormalizedAttachmentResourceForCreate =\n | DenormalizedMessageAttachmentResourceForCreate\n | DenormalizedGiphyAttachmentResourceForCreate\n | DenormalizedExpandedLinkAttachmentResource\n\nexport interface DenormalizedMessageAttachmentResourceForCreate extends GenericAttachmentResource {\n type: 'MessageAttachment'\n id: string\n\n // Not needed for upload, but is used to preview image during pending send state\n file: NativeAttachmentFile\n}\n\nexport interface DenormalizedGiphyAttachmentResourceForCreate extends GenericAttachmentResource {\n type: 'giphy'\n id: string\n title: string\n original_giphy_title: string\n title_link: string\n thumb_url: string\n giphy: {\n original: GiphyAttachmentVariant\n fixed_height: GiphyAttachmentVariant\n fixed_height_still: GiphyAttachmentVariant\n fixed_height_downsampled: GiphyAttachmentVariant\n fixed_width: GiphyAttachmentVariant\n fixed_width_still: GiphyAttachmentVariant\n fixed_width_downsampled: GiphyAttachmentVariant\n }\n}\n\ntype AttachmentStatus = 'uploading' | 'success' | 'error'\n\nexport interface NativeAttachmentFile {\n uri: string\n name: string\n type: string // Should be a MIME type\n size: number\n width?: number\n height?: number\n}\n\nexport interface FileAttachment {\n id?: string\n file: NativeAttachmentFile\n status: AttachmentStatus\n uploadedAt: number\n flagged?: boolean\n}\n\nexport interface FileUploadState {\n [fileName: string]: {\n status: AttachmentStatus\n id?: string\n flagged?: boolean\n }\n}\n\nexport interface FileUploadError {\n file_type?: string[]\n file_size?: boolean\n}\n"]}
@@ -18,6 +18,7 @@ export declare class UploadUri {
18
18
  get headers(): {
19
19
  'User-Agent': string;
20
20
  Authorization: string;
21
+ 'X-PCO-Moderate-Image': string;
21
22
  };
22
23
  }
23
24
  //# sourceMappingURL=upload_uri.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"upload_uri.d.ts","sourceRoot":"","sources":["../../src/utils/upload_uri.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AAQnC;;GAEG;AACH,qBAAa,SAAS;IACpB,OAAO,EAAE,OAAO,CAAA;IAChB,GAAG,CAAC,EAAE,MAAM,CAAA;gBAEA,EAAE,OAAO,EAAE,EAAE;QAAE,OAAO,EAAE,OAAO,CAAA;KAAE;IAI7C,IAAI,MAAM,qBAMT;IAED,IAAI,IAAI,WAEP;IAED,IAAI,SAAS,gCAOZ;IAED,IAAI,MAAM,IAAI,KAAK,GAAG,sBAAsB,CAE3C;IAED,IAAI,GAAG,mBAON;IAED,IAAI,GAAG,4BAEN;IAED,IAAI,OAAO,WAEV;IAED,IAAI,OAAO;;;MAKV;CACF"}
1
+ {"version":3,"file":"upload_uri.d.ts","sourceRoot":"","sources":["../../src/utils/upload_uri.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AAQnC;;GAEG;AACH,qBAAa,SAAS;IACpB,OAAO,EAAE,OAAO,CAAA;IAChB,GAAG,CAAC,EAAE,MAAM,CAAA;gBAEA,EAAE,OAAO,EAAE,EAAE;QAAE,OAAO,EAAE,OAAO,CAAA;KAAE;IAI7C,IAAI,MAAM,qBAMT;IAED,IAAI,IAAI,WAEP;IAED,IAAI,SAAS,gCAOZ;IAED,IAAI,MAAM,IAAI,KAAK,GAAG,sBAAsB,CAE3C;IAED,IAAI,GAAG,mBAON;IAED,IAAI,GAAG,4BAEN;IAED,IAAI,OAAO,WAEV;IAED,IAAI,OAAO;;;;MAMV;CACF"}
@@ -54,6 +54,7 @@ export class UploadUri {
54
54
  return {
55
55
  'User-Agent': `${appName}/${readableVersion} (${brand}, ${model}, ${systemName}, ${systemVersion})`,
56
56
  Authorization: `Bearer ${this.session.token?.access_token}`,
57
+ 'X-PCO-Moderate-Image': 'true',
57
58
  };
58
59
  }
59
60
  }
@@ -1 +1 @@
1
- {"version":3,"file":"upload_uri.js","sourceRoot":"","sources":["../../src/utils/upload_uri.ts"],"names":[],"mappings":"AAAA,OAAO,UAAU,MAAM,0BAA0B,CAAA;AAEjD,MAAM,KAAK,GAAG,UAAU,CAAC,QAAQ,EAAE,CAAA;AACnC,MAAM,KAAK,GAAG,UAAU,CAAC,QAAQ,EAAE,CAAA;AACnC,MAAM,UAAU,GAAG,UAAU,CAAC,aAAa,EAAE,CAAA;AAC7C,MAAM,aAAa,GAAG,UAAU,CAAC,gBAAgB,EAAE,CAAA;AACnD,MAAM,eAAe,GAAG,UAAU,CAAC,kBAAkB,EAAE,CAAA;AACvD,MAAM,OAAO,GAAG,UAAU,CAAC,kBAAkB,EAAE,CAAA;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AC,OAAO,CAAC,KAAK,EAAE,YAAY,EAAE;SAC5D,CAAA;IACH,CAAC;CACF","sourcesContent":["import DeviceInfo from 'react-native-device-info'\nimport { Session } from './session'\nconst brand = DeviceInfo.getBrand()\nconst model = DeviceInfo.getModel()\nconst systemName = DeviceInfo.getSystemName()\nconst systemVersion = DeviceInfo.getSystemVersion()\nconst readableVersion = DeviceInfo.getReadableVersion()\nconst appName = DeviceInfo.getApplicationName()\n\n/**\n * This is for accessing https://github.com/planningcenter/upload\n */\nexport class UploadUri {\n session: Session\n app?: string\n\n constructor({ session }: { session: Session }) {\n this.session = session\n }\n\n get schema() {\n if (this.env === 'development') {\n return 'http'\n } else {\n return 'https'\n }\n }\n\n get host() {\n return `${this.subdomain}.${this.domain}.${this.tld}`\n }\n\n get subdomain() {\n switch (this.env) {\n case 'staging':\n return 'upload-staging'\n default:\n return 'upload'\n }\n }\n\n get domain(): 'pco' | 'planningcenteronline' {\n return this.env === 'development' ? 'pco' : 'planningcenteronline'\n }\n\n get tld() {\n switch (this.env) {\n case 'development':\n return 'test'\n default:\n return 'com'\n }\n }\n\n get env() {\n return this.session?.env || 'production'\n }\n\n get baseUrl() {\n return `${this.schema}://${this.host}`\n }\n\n get headers() {\n return {\n 'User-Agent': `${appName}/${readableVersion} (${brand}, ${model}, ${systemName}, ${systemVersion})`,\n Authorization: `Bearer ${this.session.token?.access_token}`,\n }\n }\n}\n"]}
1
+ {"version":3,"file":"upload_uri.js","sourceRoot":"","sources":["../../src/utils/upload_uri.ts"],"names":[],"mappings":"AAAA,OAAO,UAAU,MAAM,0BAA0B,CAAA;AAEjD,MAAM,KAAK,GAAG,UAAU,CAAC,QAAQ,EAAE,CAAA;AACnC,MAAM,KAAK,GAAG,UAAU,CAAC,QAAQ,EAAE,CAAA;AACnC,MAAM,UAAU,GAAG,UAAU,CAAC,aAAa,EAAE,CAAA;AAC7C,MAAM,aAAa,GAAG,UAAU,CAAC,gBAAgB,EAAE,CAAA;AACnD,MAAM,eAAe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AI,eAAe,KAAK,KAAK,KAAK,KAAK,KAAK,UAAU,KAAK,aAAa,GAAG;YACnG,aAAa,EAAE,UAAU,IAAI,CAAC,OAAO,CAAC,KAAK,EAAE,YAAY,EAAE;YAC3D,sBAAsB,EAAE,MAAM;SAC/B,CAAA;IACH,CAAC;CACF","sourcesContent":["import DeviceInfo from 'react-native-device-info'\nimport { Session } from './session'\nconst brand = DeviceInfo.getBrand()\nconst model = DeviceInfo.getModel()\nconst systemName = DeviceInfo.getSystemName()\nconst systemVersion = DeviceInfo.getSystemVersion()\nconst readableVersion = DeviceInfo.getReadableVersion()\nconst appName = DeviceInfo.getApplicationName()\n\n/**\n * This is for accessing https://github.com/planningcenter/upload\n */\nexport class UploadUri {\n session: Session\n app?: string\n\n constructor({ session }: { session: Session }) {\n this.session = session\n }\n\n get schema() {\n if (this.env === 'development') {\n return 'http'\n } else {\n return 'https'\n }\n }\n\n get host() {\n return `${this.subdomain}.${this.domain}.${this.tld}`\n }\n\n get subdomain() {\n switch (this.env) {\n case 'staging':\n return 'upload-staging'\n default:\n return 'upload'\n }\n }\n\n get domain(): 'pco' | 'planningcenteronline' {\n return this.env === 'development' ? 'pco' : 'planningcenteronline'\n }\n\n get tld() {\n switch (this.env) {\n case 'development':\n return 'test'\n default:\n return 'com'\n }\n }\n\n get env() {\n return this.session?.env || 'production'\n }\n\n get baseUrl() {\n return `${this.schema}://${this.host}`\n }\n\n get headers() {\n return {\n 'User-Agent': `${appName}/${readableVersion} (${brand}, ${model}, ${systemName}, ${systemVersion})`,\n Authorization: `Bearer ${this.session.token?.access_token}`,\n 'X-PCO-Moderate-Image': 'true',\n }\n }\n}\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@planningcenter/chat-react-native",
3
- "version": "3.27.0",
3
+ "version": "3.28.0-rc.0",
4
4
  "description": "",
5
5
  "main": "build/index.js",
6
6
  "types": "build/index.d.ts",
@@ -58,5 +58,5 @@
58
58
  "react-native-url-polyfill": "^2.0.0",
59
59
  "typescript": "<5.6.0"
60
60
  },
61
- "gitHead": "d2daf82ce727483e97734ec8a7e97a2b19de3484"
61
+ "gitHead": "6d471ae6894e16a694e06f9f181ebf8bf6f644af"
62
62
  }
@@ -45,7 +45,6 @@ interface MessageProps extends MessageResource {
45
45
  conversation_id: number
46
46
  latestReadMessageSortKey?: string
47
47
  inReplyScreen?: boolean
48
- repliesEnabled?: boolean
49
48
  }
50
49
 
51
50
  export function Message({
@@ -53,7 +52,6 @@ export function Message({
53
52
  conversation_id,
54
53
  latestReadMessageSortKey,
55
54
  inReplyScreen,
56
- repliesEnabled,
57
55
  ...message
58
56
  }: MessageProps) {
59
57
  const { text, reactionCounts, pending, error, attachments, author } = message
@@ -85,11 +83,10 @@ export function Message({
85
83
  }
86
84
 
87
85
  const renderAuthor = (!message.mine && message.renderAuthor) || false
88
- const showReplyCountButton =
89
- !inReplyScreen && message.replyRootId === message.id && repliesEnabled
86
+ const showReplyCountButton = !inReplyScreen && message.replyRootId === message.id
90
87
  const isReplyRootMessage = message.replyRootId === message.id
91
88
  const isDeletedReplyRootMessage = isReplyRootMessage && !!message.deletedAt
92
- const replyToReplyRootMessage = repliesEnabled && !isReplyRootMessage && !!message.replyRootId
89
+ const replyToReplyRootMessage = !isReplyRootMessage && !!message.replyRootId
93
90
 
94
91
  const replyCountText = pluralize(message.replyCount, 'reply')
95
92
  const messagePendingLabel = isPersisted ? 'Saving' : 'Sending'
@@ -221,9 +218,7 @@ export function Message({
221
218
  ) : (
222
219
  <View style={styles.avatarPlaceholder} />
223
220
  )}
224
- {repliesEnabled && (
225
- <TheirReplyConnector message={message} messageBubbleHeight={messageBubbleHeight} />
226
- )}
221
+ <TheirReplyConnector message={message} messageBubbleHeight={messageBubbleHeight} />
227
222
  </View>
228
223
  )}
229
224
  <View style={[styles.messageContent, { marginBottom: messageBottomMargin }]}>
@@ -332,7 +327,7 @@ export function Message({
332
327
  </View>
333
328
  )}
334
329
  </View>
335
- {repliesEnabled && message.mine && (
330
+ {message.mine && (
336
331
  <MyReplyConnector message={message} messageBubbleHeight={messageBubbleHeight} />
337
332
  )}
338
333
  </Animated.View>
@@ -14,7 +14,6 @@ interface Props {
14
14
  export function MessageFormAttachmentImage({ uri, alt, status, removeAttachment }: Props) {
15
15
  const loading = status === 'uploading'
16
16
  const error = status === 'error'
17
- const ready = status === 'success'
18
17
 
19
18
  return (
20
19
  <ImageAttachmentPreview
@@ -23,7 +22,7 @@ export function MessageFormAttachmentImage({ uri, alt, status, removeAttachment
23
22
  onRemovePress={removeAttachment}
24
23
  loading={loading}
25
24
  error={error}
26
- hideRemoveButton={!ready}
25
+ hideRemoveButton={loading}
27
26
  size="sm"
28
27
  />
29
28
  )
@@ -1,6 +1,7 @@
1
1
  import { useNavigation, useTheme as useNavigationTheme, useRoute } from '@react-navigation/native'
2
2
  import React, { useCallback, useContext, useEffect, useState } from 'react'
3
3
  import {
4
+ Linking,
4
5
  Platform,
5
6
  Pressable,
6
7
  ScrollView,
@@ -29,7 +30,6 @@ import {
29
30
  platformFontWeightMedium,
30
31
  platformPressedOpacityStyle,
31
32
  } from '../../utils'
32
- import { availableFeatures, useFeatures } from '../../hooks/use_features'
33
33
  import { useAttachmentUploader } from '../../hooks/use_attachment_uploader'
34
34
  import { useMessageDraft } from '../../hooks/use_message_draft'
35
35
  import {
@@ -42,6 +42,8 @@ import { useBroadcastTypingStatus } from '../../hooks/use_broadcast_typing_statu
42
42
  import { tokens } from '../../vendor/tapestry/tokens'
43
43
  import LinearGradient from 'react-native-linear-gradient'
44
44
  import { MessageFormAttachmentVideo } from './message_form/message_form_attachment_video'
45
+ import BannerPrimitive from '../primitive/banner_primitive'
46
+ import { Button } from '../display/button'
45
47
 
46
48
  export const MessageForm = {
47
49
  Root: MessageFormRoot,
@@ -174,6 +176,7 @@ function MessageFormRoot({
174
176
  const canSubmit = (() => {
175
177
  if (isPending) return false
176
178
  if (attachmentUploader?.pendingUploads) return false
179
+ if (attachmentUploader?.flaggedAttachmentCount) return false
177
180
  if (text.length > 0) return true
178
181
  if (attachmentUploader?.attachments?.length) return true
179
182
  return false
@@ -255,6 +258,7 @@ function MessageFormRoot({
255
258
  <View style={styles.container}>
256
259
  <EditingIndicator />
257
260
  <ReplyIndicator />
261
+ <FlaggedContentBanner />
258
262
  <View style={styles.textInputContainer}>{children}</View>
259
263
  </View>
260
264
  </MessageFormContext.Provider>
@@ -309,6 +313,69 @@ function MessageFormAttachments() {
309
313
  )
310
314
  }
311
315
 
316
+ function FlaggedContentBanner() {
317
+ const styles = useMessageFormStyles()
318
+ const { attachmentUploader } = React.useContext(MessageFormContext)
319
+ const flaggedCount = attachmentUploader?.flaggedAttachmentCount || 0
320
+
321
+ if (flaggedCount === 0) return null
322
+
323
+ const isSingular = flaggedCount === 1
324
+ const buttonTitle = isSingular ? 'Remove flagged image' : 'Remove flagged images'
325
+
326
+ return (
327
+ <View style={styles.flaggedBannerContainer}>
328
+ <BannerPrimitive.Root appearance="error">
329
+ <BannerPrimitive.StaticLayout>
330
+ <BannerPrimitive.StatusIcon />
331
+ <BannerPrimitive.Content>
332
+ <BannerMessage isSingular={isSingular} />
333
+ <View style={styles.flaggedBannerButtonRow}>
334
+ <Button
335
+ title={buttonTitle}
336
+ size="sm"
337
+ appearance="danger"
338
+ onPress={() => attachmentUploader?.removeFlaggedAttachments()}
339
+ accessibilityLabel={buttonTitle}
340
+ />
341
+ </View>
342
+ </BannerPrimitive.Content>
343
+ </BannerPrimitive.StaticLayout>
344
+ </BannerPrimitive.Root>
345
+ </View>
346
+ )
347
+ }
348
+
349
+ function BannerMessage({ isSingular }: { isSingular: boolean }) {
350
+ const styles = useMessageFormStyles()
351
+
352
+ const contentGuidelinesLink = (
353
+ <Text
354
+ style={styles.flaggedBannerLink}
355
+ onPress={() =>
356
+ Linking.openURL(
357
+ 'https://www.planningcenter.com/terms#:~:text=4.%20Acceptable%20Use%20of%20Planning%20Center'
358
+ )
359
+ }
360
+ accessibilityRole="link"
361
+ >
362
+ content guidelines
363
+ </Text>
364
+ )
365
+
366
+ return isSingular ? (
367
+ <Text style={styles.flaggedBannerText}>
368
+ An uploaded image was flagged because it doesn't meet our {contentGuidelinesLink}. Please
369
+ remove before proceeding.
370
+ </Text>
371
+ ) : (
372
+ <Text style={styles.flaggedBannerText}>
373
+ Some uploaded images were flagged because they don't meet our {contentGuidelinesLink}. Please
374
+ remove them before proceeding.
375
+ </Text>
376
+ )
377
+ }
378
+
312
379
  function MessageFormInput() {
313
380
  const styles = useMessageFormStyles()
314
381
  const theme = useTheme()
@@ -571,11 +638,9 @@ function EditingIndicator() {
571
638
  function ReplyIndicator() {
572
639
  const { replyRootId, replyRootAuthorFirstName } = React.useContext(MessageFormContext)
573
640
  const navigation = useNavigation()
574
- const { featureEnabled } = useFeatures()
575
- const repliesEnabled = featureEnabled(availableFeatures.threaded_replies)
576
641
  const title = replyRootAuthorFirstName ? `Reply to ${replyRootAuthorFirstName}` : 'Reply'
577
642
 
578
- if (!repliesEnabled || !replyRootId) return null
643
+ if (!replyRootId) return null
579
644
 
580
645
  return (
581
646
  <FormIndicatorRow
@@ -758,6 +823,23 @@ const useMessageFormStyles = () => {
758
823
  paddingHorizontal: 16,
759
824
  paddingVertical: 4,
760
825
  },
826
+ flaggedBannerContainer: {
827
+ paddingBottom: 12,
828
+ },
829
+ flaggedBannerText: {
830
+ color: theme.colors.textColorDefaultPrimary,
831
+ fontSize: 14,
832
+ },
833
+ flaggedBannerLink: {
834
+ color: theme.colors.textColorDefaultPrimary,
835
+ fontSize: 14,
836
+ textDecorationLine: 'underline' as const,
837
+ },
838
+ flaggedBannerButtonRow: {
839
+ flexDirection: 'row',
840
+ justifyContent: 'flex-end',
841
+ marginTop: 4,
842
+ },
761
843
  formIndicatorRow: {
762
844
  flexDirection: 'row',
763
845
  alignItems: 'center',
@@ -2,30 +2,22 @@ import { StyleSheet, View, type ViewStyle } from 'react-native'
2
2
  import { useTheme } from '../../hooks'
3
3
  import { Text } from '../display'
4
4
  import { useSafeAreaInsets } from 'react-native-safe-area-context'
5
- import { useFeatures } from '../../hooks/use_features'
6
- import { availableFeatures } from '../../hooks/use_features'
7
5
 
8
6
  export const LeaderMessagesDisabledBanner = () => {
9
- const { featureEnabled } = useFeatures()
10
- const repliesEnabled = featureEnabled(availableFeatures.threaded_replies)
11
-
12
- const description = repliesEnabled
13
- ? 'Only leaders can send messages in this conversation.'
14
- : 'Replies are frozen for everyone else.'
15
-
16
- return <MessagesDisabledBanner description={description} />
7
+ return (
8
+ <MessagesDisabledBanner description="Only leaders can send messages in this conversation." />
9
+ )
17
10
  }
18
11
 
19
12
  export const MemberMessagesDisabledBanner = () => {
20
13
  const styles = useStyles()
21
- const { featureEnabled } = useFeatures()
22
- const repliesEnabled = featureEnabled(availableFeatures.threaded_replies)
23
14
 
24
- const description = repliesEnabled
25
- ? 'Only leaders can send messages, but you can still add reactions.'
26
- : 'Replies have been disabled by a leader, but you can still add reactions.'
27
-
28
- return <MessagesDisabledBanner description={description} style={styles.memberBanner} />
15
+ return (
16
+ <MessagesDisabledBanner
17
+ description="Only leaders can send messages, but you can still add reactions."
18
+ style={styles.memberBanner}
19
+ />
20
+ )
29
21
  }
30
22
 
31
23
  interface MessagesDisabledBannerProps {
@@ -100,9 +100,14 @@ export function useAttachmentUploader({
100
100
  }
101
101
  setLastUploadId(messageAttachmentId)
102
102
  })
103
- .catch(() => {
103
+ .catch(err => {
104
+ const isFlagged = err?.code === 'image_flagged'
104
105
  uploadState.current[attachment.file.name] = {
105
106
  status: 'error',
107
+ flagged: isFlagged,
108
+ }
109
+ if (!isFlagged) {
110
+ setErrorMessage('This file could not be uploaded.')
106
111
  }
107
112
  setLastUploadId(attachment.file.name)
108
113
  })
@@ -123,7 +128,7 @@ export function useAttachmentUploader({
123
128
 
124
129
  const state = uploadState.current[attachment.file.name]
125
130
  if (state) {
126
- return { ...attachment, id: state.id, status: state.status }
131
+ return { ...attachment, id: state.id, status: state.status, flagged: state.flagged }
127
132
  }
128
133
  return attachment
129
134
  })
@@ -136,12 +141,17 @@ export function useAttachmentUploader({
136
141
  )
137
142
  }, [])
138
143
 
144
+ const removeFlaggedAttachments = useCallback(() => {
145
+ setAttachments(prevAttachments => prevAttachments.filter(a => !a.flagged))
146
+ }, [])
147
+
139
148
  const reset = useCallback(() => {
140
149
  setAttachments([])
141
150
  setErrorMessage(null)
142
151
  }, [])
143
152
 
144
153
  const pendingUploads = attachments.filter(a => a.status === 'uploading').length > 0
154
+ const flaggedAttachmentCount = attachments.filter(a => a.flagged).length
145
155
 
146
156
  const attachmentIds = useMemo(
147
157
  () => attachments.filter(a => a.status === 'success' && a.id).map(a => a.id as string),
@@ -153,9 +163,11 @@ export function useAttachmentUploader({
153
163
  attachmentIds,
154
164
  handleFilesAttached,
155
165
  removeAttachment,
166
+ removeFlaggedAttachments,
156
167
  reset,
157
168
  pendingUploads,
158
169
  errorMessage,
170
+ flaggedAttachmentCount,
159
171
  remainingAttachable: MAX_NUMBER_OF_ATTACHMENTS - numberOfAttachments,
160
172
  }
161
173
  }
@@ -34,7 +34,6 @@ export function useFeatures() {
34
34
  }
35
35
 
36
36
  export const availableFeatures = {
37
- threaded_replies: 'ROLLOUT_MOBILE_threaded_replies_v1',
38
37
  message_reporting: 'ROLLOUT_MOBILE_message_reporting',
39
38
  granular_notifications_ui: 'ROLLOUT_granular_notification_preferences_ui',
40
39
  }
@@ -46,6 +46,14 @@ class UploadClient extends Client {
46
46
  body: formData,
47
47
  })
48
48
 
49
+ if (response.status === 403) {
50
+ const errorBody = await response.json().catch(() => null)
51
+ if (errorBody?.detail === 'Image was flagged') {
52
+ return Promise.reject({ code: 'image_flagged' })
53
+ }
54
+ return this.handleNotOk(response)
55
+ }
56
+
49
57
  if (!response.ok) {
50
58
  return this.handleNotOk(response)
51
59
  }
@@ -39,7 +39,6 @@ import { CONVERSATION_MESSAGE_LIST_PADDING_HORIZONTAL } from '../utils/styles'
39
39
  import { useConversationJoltEvents } from '../hooks/use_conversation_jolt_events'
40
40
  import { JumpToBottomButton } from '../components/conversation/jump_to_bottom_button'
41
41
  import { ReplyShadowMessage } from '../components/conversation/reply_shadow_message'
42
- import { availableFeatures, useFeatures } from '../hooks/use_features'
43
42
  import { ConversationContextProvider } from '../contexts/conversation_context'
44
43
 
45
44
  export type ConversationRouteProps = {
@@ -92,12 +91,9 @@ function ConversationScreenContent({ route }: ConversationScreenProps) {
92
91
  useConversationMessagesJoltEvents({ conversationId: conversation_id })
93
92
  useEnsureConversationsRouteExists()
94
93
  useMarkLatestMessageRead({ conversation, messages })
95
- const { featureEnabled } = useFeatures()
96
- const repliesEnabled = featureEnabled(availableFeatures.threaded_replies)
97
94
  const messagesWithSeparators = groupMessages({
98
95
  ms: messages,
99
96
  inReplyScreen: !!reply_root_id,
100
- repliesEnabled,
101
97
  })
102
98
  const noMessages = messagesWithSeparators.length === 0
103
99
 
@@ -199,7 +195,6 @@ function ConversationScreenContent({ route }: ConversationScreenProps) {
199
195
  conversation_id={conversation_id}
200
196
  latestReadMessageSortKey={conversation?.latestReadMessageSortKey}
201
197
  inReplyScreen={!!reply_root_id}
202
- repliesEnabled={repliesEnabled}
203
198
  />
204
199
  )
205
200
  }}
@@ -288,14 +283,9 @@ type ReplyShadowMessage = {
288
283
  interface GroupMessagesProps {
289
284
  ms: MessageResource[]
290
285
  inReplyScreen?: boolean
291
- repliesEnabled?: boolean
292
286
  }
293
287
 
294
- export const groupMessages = ({
295
- ms,
296
- inReplyScreen,
297
- repliesEnabled = false,
298
- }: GroupMessagesProps) => {
288
+ export const groupMessages = ({ ms, inReplyScreen }: GroupMessagesProps) => {
299
289
  let enrichedMessages: (MessageResource | DateSeparator | ReplyShadowMessage)[] = []
300
290
  let encounteredOneOfMyMessages = false
301
291
 
@@ -339,7 +329,6 @@ export const groupMessages = ({
339
329
  prevMessageDifferentThread ||
340
330
  prevMessageIsDateSeparator)
341
331
  const nextIsReplyShadowMessage =
342
- repliesEnabled &&
343
332
  nextMessageInThread &&
344
333
  !nextMessageThreadRoot &&
345
334
  (nextMessageDifferentThread || nextMessageIsDateSeparator)
@@ -373,7 +362,7 @@ export const groupMessages = ({
373
362
 
374
363
  enrichedMessages.push(message)
375
364
 
376
- if (insertReplyShadowMessage && repliesEnabled) {
365
+ if (insertReplyShadowMessage) {
377
366
  enrichedMessages.push({
378
367
  type: 'ReplyShadowMessage',
379
368
  id: `${message.id}-${message.replyRootId}`,
@@ -78,7 +78,6 @@ function MessageActionsScreenContent({
78
78
  const apiClient = useApiClient()
79
79
  const styles = useStyles()
80
80
  const { featureEnabled } = useFeatures()
81
- const repliesEnabled = featureEnabled(availableFeatures.threaded_replies)
82
81
  const expandedLink = message.attachments.find(attachment => attachment.type === 'ExpandedLink')
83
82
  const hasExpandedLink = !!expandedLink
84
83
 
@@ -242,7 +241,7 @@ function MessageActionsScreenContent({
242
241
  ))}
243
242
  </View>
244
243
  <View style={styles.actions}>
245
- {repliesEnabled && !inReplyScreen && (
244
+ {!inReplyScreen && (
246
245
  <FormSheet.Action
247
246
  onPress={handleReplyPress}
248
247
  title="Reply to message"
@@ -51,12 +51,14 @@ export interface FileAttachment {
51
51
  file: NativeAttachmentFile
52
52
  status: AttachmentStatus
53
53
  uploadedAt: number
54
+ flagged?: boolean
54
55
  }
55
56
 
56
57
  export interface FileUploadState {
57
58
  [fileName: string]: {
58
59
  status: AttachmentStatus
59
60
  id?: string
61
+ flagged?: boolean
60
62
  }
61
63
  }
62
64
 
@@ -64,6 +64,7 @@ export class UploadUri {
64
64
  return {
65
65
  'User-Agent': `${appName}/${readableVersion} (${brand}, ${model}, ${systemName}, ${systemVersion})`,
66
66
  Authorization: `Bearer ${this.session.token?.access_token}`,
67
+ 'X-PCO-Moderate-Image': 'true',
67
68
  }
68
69
  }
69
70
  }