@planningcenter/chat-react-native 3.23.0 → 3.23.1-qa-538.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 (122) hide show
  1. package/build/components/display/toggle_button.d.ts +11 -4
  2. package/build/components/display/toggle_button.d.ts.map +1 -1
  3. package/build/components/display/toggle_button.js +6 -5
  4. package/build/components/display/toggle_button.js.map +1 -1
  5. package/build/components/primitive/form_sheet.d.ts +1 -1
  6. package/build/components/primitive/form_sheet.d.ts.map +1 -1
  7. package/build/components/primitive/form_sheet.js +1 -1
  8. package/build/components/primitive/form_sheet.js.map +1 -1
  9. package/build/hooks/index.d.ts +1 -0
  10. package/build/hooks/index.d.ts.map +1 -1
  11. package/build/hooks/index.js +1 -0
  12. package/build/hooks/index.js.map +1 -1
  13. package/build/hooks/use_conversation.d.ts.map +1 -1
  14. package/build/hooks/use_conversation.js +6 -1
  15. package/build/hooks/use_conversation.js.map +1 -1
  16. package/build/hooks/use_conversation_membership.d.ts +5 -0
  17. package/build/hooks/use_conversation_membership.d.ts.map +1 -0
  18. package/build/hooks/use_conversation_membership.js +54 -0
  19. package/build/hooks/use_conversation_membership.js.map +1 -0
  20. package/build/hooks/use_features.d.ts +1 -0
  21. package/build/hooks/use_features.d.ts.map +1 -1
  22. package/build/hooks/use_features.js +1 -0
  23. package/build/hooks/use_features.js.map +1 -1
  24. package/build/hooks/use_new_conversation_entry.d.ts +3 -0
  25. package/build/hooks/use_new_conversation_entry.d.ts.map +1 -0
  26. package/build/hooks/use_new_conversation_entry.js +20 -0
  27. package/build/hooks/use_new_conversation_entry.js.map +1 -0
  28. package/build/hooks/use_report_message.d.ts +6 -0
  29. package/build/hooks/use_report_message.d.ts.map +1 -0
  30. package/build/hooks/use_report_message.js +28 -0
  31. package/build/hooks/use_report_message.js.map +1 -0
  32. package/build/navigation/index.d.ts +18 -8
  33. package/build/navigation/index.d.ts.map +1 -1
  34. package/build/navigation/index.js +16 -6
  35. package/build/navigation/index.js.map +1 -1
  36. package/build/screens/conversation_details_screen.d.ts.map +1 -1
  37. package/build/screens/conversation_details_screen.js +18 -10
  38. package/build/screens/conversation_details_screen.js.map +1 -1
  39. package/build/screens/conversation_filter_recipients/conversation_filter_recipients_screen.js +5 -3
  40. package/build/screens/conversation_filter_recipients/conversation_filter_recipients_screen.js.map +1 -1
  41. package/build/screens/conversation_select_recipients/conversation_new_entry_screen.d.ts +4 -0
  42. package/build/screens/conversation_select_recipients/conversation_new_entry_screen.d.ts.map +1 -0
  43. package/build/screens/conversation_select_recipients/conversation_new_entry_screen.js +67 -0
  44. package/build/screens/conversation_select_recipients/conversation_new_entry_screen.js.map +1 -0
  45. package/build/screens/conversation_select_recipients/conversation_select_teams_i_lead_recipients_screen.d.ts.map +1 -1
  46. package/build/screens/conversation_select_recipients/conversation_select_teams_i_lead_recipients_screen.js +17 -2
  47. package/build/screens/conversation_select_recipients/conversation_select_teams_i_lead_recipients_screen.js.map +1 -1
  48. package/build/screens/conversation_select_type_screen.d.ts +11 -0
  49. package/build/screens/conversation_select_type_screen.d.ts.map +1 -0
  50. package/build/screens/conversation_select_type_screen.js +32 -0
  51. package/build/screens/conversation_select_type_screen.js.map +1 -0
  52. package/build/screens/conversations/components/list_header_component.d.ts.map +1 -1
  53. package/build/screens/conversations/components/list_header_component.js +54 -25
  54. package/build/screens/conversations/components/list_header_component.js.map +1 -1
  55. package/build/screens/index.d.ts +1 -1
  56. package/build/screens/index.d.ts.map +1 -1
  57. package/build/screens/index.js +1 -1
  58. package/build/screens/index.js.map +1 -1
  59. package/build/screens/message_actions_screen.js +14 -2
  60. package/build/screens/message_actions_screen.js.map +1 -1
  61. package/build/screens/message_report/components/message_preview.d.ts +10 -0
  62. package/build/screens/message_report/components/message_preview.d.ts.map +1 -0
  63. package/build/screens/message_report/components/message_preview.js +81 -0
  64. package/build/screens/message_report/components/message_preview.js.map +1 -0
  65. package/build/screens/message_report/components/report_reason_list.d.ts +9 -0
  66. package/build/screens/message_report/components/report_reason_list.d.ts.map +1 -0
  67. package/build/screens/message_report/components/report_reason_list.js +67 -0
  68. package/build/screens/message_report/components/report_reason_list.js.map +1 -0
  69. package/build/screens/message_report_screen.d.ts +10 -0
  70. package/build/screens/message_report_screen.d.ts.map +1 -0
  71. package/build/screens/message_report_screen.js +214 -0
  72. package/build/screens/message_report_screen.js.map +1 -0
  73. package/build/types/resources/conversation.d.ts +2 -3
  74. package/build/types/resources/conversation.d.ts.map +1 -1
  75. package/build/types/resources/conversation.js.map +1 -1
  76. package/build/types/resources/conversation_membership.d.ts +14 -0
  77. package/build/types/resources/conversation_membership.d.ts.map +1 -0
  78. package/build/types/resources/conversation_membership.js +2 -0
  79. package/build/types/resources/conversation_membership.js.map +1 -0
  80. package/build/types/resources/index.d.ts +1 -0
  81. package/build/types/resources/index.d.ts.map +1 -1
  82. package/build/types/resources/index.js +1 -0
  83. package/build/types/resources/index.js.map +1 -1
  84. package/build/types/resources/message_report.d.ts +19 -0
  85. package/build/types/resources/message_report.d.ts.map +1 -0
  86. package/build/types/resources/message_report.js +9 -0
  87. package/build/types/resources/message_report.js.map +1 -0
  88. package/build/utils/deep_snake_case_keys.d.ts +4 -0
  89. package/build/utils/deep_snake_case_keys.d.ts.map +1 -0
  90. package/build/utils/deep_snake_case_keys.js +13 -0
  91. package/build/utils/deep_snake_case_keys.js.map +1 -0
  92. package/package.json +2 -2
  93. package/src/components/display/toggle_button.tsx +27 -15
  94. package/src/components/primitive/form_sheet.tsx +4 -2
  95. package/src/hooks/index.ts +1 -0
  96. package/src/hooks/use_conversation.ts +6 -1
  97. package/src/hooks/use_conversation_membership.ts +82 -0
  98. package/src/hooks/use_features.ts +1 -0
  99. package/src/hooks/use_new_conversation_entry.ts +31 -0
  100. package/src/hooks/use_report_message.ts +37 -0
  101. package/src/navigation/index.tsx +19 -6
  102. package/src/screens/conversation_details_screen.tsx +34 -16
  103. package/src/screens/conversation_filter_recipients/conversation_filter_recipients_screen.tsx +10 -3
  104. package/src/screens/conversation_select_recipients/conversation_new_entry_screen.tsx +100 -0
  105. package/src/screens/conversation_select_recipients/conversation_select_teams_i_lead_recipients_screen.tsx +23 -3
  106. package/src/screens/conversation_select_type_screen.tsx +53 -0
  107. package/src/screens/conversations/components/list_header_component.tsx +103 -67
  108. package/src/screens/index.ts +1 -1
  109. package/src/screens/message_actions_screen.tsx +24 -2
  110. package/src/screens/message_report/components/message_preview.tsx +99 -0
  111. package/src/screens/message_report/components/report_reason_list.tsx +106 -0
  112. package/src/screens/message_report_screen.tsx +278 -0
  113. package/src/types/resources/conversation.ts +2 -3
  114. package/src/types/resources/conversation_membership.ts +15 -0
  115. package/src/types/resources/index.ts +1 -0
  116. package/src/types/resources/message_report.ts +20 -0
  117. package/src/utils/deep_snake_case_keys.ts +16 -0
  118. package/build/screens/conversation_select_recipients/conversation_select_recipients_screen.d.ts +0 -4
  119. package/build/screens/conversation_select_recipients/conversation_select_recipients_screen.d.ts.map +0 -1
  120. package/build/screens/conversation_select_recipients/conversation_select_recipients_screen.js +0 -146
  121. package/build/screens/conversation_select_recipients/conversation_select_recipients_screen.js.map +0 -1
  122. package/src/screens/conversation_select_recipients/conversation_select_recipients_screen.tsx +0 -215
@@ -65,6 +65,13 @@ function MessageActionsScreenContent({ message, conversation_id, canDeleteNonAut
65
65
  Clipboard.setStringAsync(message?.text || attachmentForCopy() || '');
66
66
  navigation.goBack();
67
67
  };
68
+ const handleReportPress = useCallback(() => {
69
+ Haptic.impactLight();
70
+ navigation.navigate('MessageReport', {
71
+ conversation_id,
72
+ message_id: message.id,
73
+ });
74
+ }, [navigation, conversation_id, message.id]);
68
75
  const { handleReactionToggle, isPending } = useMessageReactionToggle({
69
76
  conversation_id,
70
77
  message,
@@ -140,6 +147,7 @@ function MessageActionsScreenContent({ message, conversation_id, canDeleteNonAut
140
147
  { text: 'Remove', style: 'destructive', onPress: () => handleRemoveLinkPreview() },
141
148
  ]);
142
149
  }, [handleRemoveLinkPreview]);
150
+ const showReportMessageAction = !message?.mine && featureEnabled(availableFeatures.message_reporting);
143
151
  return (<FormSheet.Root style={styles.formSheetContent}>
144
152
  <View style={styles.reactionList}>
145
153
  {availableReactions.map((reaction, index) => (<Reaction key={index} reaction={reaction} onPress={() => {
@@ -154,6 +162,7 @@ function MessageActionsScreenContent({ message, conversation_id, canDeleteNonAut
154
162
  <View style={styles.actions}>
155
163
  {repliesEnabled && !inReplyScreen && (<FormSheet.Action onPress={handleReplyPress} title="Reply to message" iconName="registrations.undo" accessibilityHint="Navigates to the reply screen" accessibilityRole="link"/>)}
156
164
  <FormSheet.Action onPress={handleCopyPress} title="Copy text" iconName="services.fileCopy" accessibilityHint="Copies text and links to clipboard"/>
165
+ {showReportMessageAction && (<FormSheet.Action onPress={handleReportPress} title="Report message" iconName="chat.reportMessageO" accessibilityHint="Opens a form to report this message"/>)}
157
166
  {message?.mine && (<FormSheet.Action onPress={() => handleEditPress()} title="Edit message" iconName="accounts.editor" accessibilityHint="Opens existing text in the message form input."/>)}
158
167
  {message?.mine && (<FormSheet.Action onPress={() => handleViewReadReceiptsPress()} title="View read receipts" iconName="general.checkPerson" accessibilityHint="Opens a modal with a list of people who read your message."/>)}
159
168
  {message?.mine && hasExpandedLink && (<FormSheet.Action onPress={() => handleRemoveLinkPreviewConfirm()} title="Remove link preview" iconName="general.brokenLink" accessibilityHint="Removes an expanded link preview from the message."/>)}
@@ -168,14 +177,16 @@ const Reaction = ({ reaction, onPress, }) => {
168
177
  const baseRippleColor = reaction.mine ? colors.interaction : colors.fillColorNeutral060;
169
178
  const androidRippleColor = useCreateAndroidRippleColor({ color: baseRippleColor });
170
179
  return (<PlatformPressable key={reaction.value} style={[reactionStyles.reaction, styles.reaction]} android_ripple={{ color: androidRippleColor, borderless: false, foreground: true }} onPress={onPress}>
171
- <Text style={styles.reactionEmoji}>{REACTION_EMOJIS[reaction.value]}</Text>
180
+ <Text style={styles.reactionEmoji} allowFontScaling={false}>
181
+ {REACTION_EMOJIS[reaction.value]}
182
+ </Text>
172
183
  </PlatformPressable>);
173
184
  };
174
185
  const useStyles = () => {
175
186
  const { colors } = useTheme();
176
187
  const fontScale = useFontScale({ maxFontSizeMultiplier: 1.3 });
177
188
  const btnBorderWidth = 1;
178
- const baseSize = 46 * fontScale;
189
+ const baseSize = 46 * Math.max(1, fontScale);
179
190
  const reactionBtnSize = Platform.select({
180
191
  ios: baseSize,
181
192
  android: baseSize + btnBorderWidth * 2,
@@ -204,6 +215,7 @@ const useStyles = () => {
204
215
  },
205
216
  reactionEmoji: {
206
217
  fontSize: 24,
218
+ textAlign: 'center',
207
219
  },
208
220
  actions: {
209
221
  paddingTop: 4,
@@ -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,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,uB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AAM,QAAQ,GAAG,EAAE,GAAG,SAAS,CAAA;IAC/B,MAAM,eAAe,GAAG,QAAQ,CAAC,MAAM,CAAC;QACtC,GAAG,EAAE,QAAQ;QACb,OAAO,EAAE,QAAQ,GAAG,cAAc,GAAG,CAAC;KACvC,CAAC,CAAA;IAEF,OAAO,UAAU,CAAC,MAAM,CAAC;QACvB,gBAAgB,EAAE;YAChB,UAAU,EAAE,EAAE;SACf;QACD,YAAY,EAAE;YACZ,aAAa,EAAE,KAAK;YACpB,cAAc,EAAE,QAAQ;YACxB,UAAU,EAAE,QAAQ;YACpB,GAAG,EAAE,EAAE;YACP,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;SACb;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 { 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 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 {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}>{REACTION_EMOJIS[reaction.value]}</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 * 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 },\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/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AAQ,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"]}
@@ -0,0 +1,10 @@
1
+ import React from 'react';
2
+ import { ViewStyle } from 'react-native';
3
+ import { MessageResource } from '../../../types';
4
+ interface MessagePreviewProps {
5
+ message: MessageResource;
6
+ style?: ViewStyle;
7
+ }
8
+ export declare function MessagePreview({ message, style }: MessagePreviewProps): React.JSX.Element;
9
+ export {};
10
+ //# sourceMappingURL=message_preview.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"message_preview.d.ts","sourceRoot":"","sources":["../../../../src/screens/message_report/components/message_preview.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AACzB,OAAO,EAAoB,SAAS,EAAE,MAAM,cAAc,CAAA;AAG1D,OAAO,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAA;AAEhD,UAAU,mBAAmB;IAC3B,OAAO,EAAE,eAAe,CAAA;IACxB,KAAK,CAAC,EAAE,SAAS,CAAA;CAClB;AAED,wBAAgB,cAAc,CAAC,EAAE,OAAO,EAAE,KAAK,EAAE,EAAE,mBAAmB,qBAkCrE"}
@@ -0,0 +1,81 @@
1
+ import React from 'react';
2
+ import { View, StyleSheet } from 'react-native';
3
+ import { Avatar, Text, Icon } from '../../../components';
4
+ import { useTheme } from '../../../hooks';
5
+ export function MessagePreview({ message, style }) {
6
+ const styles = useStyles();
7
+ const hasImages = message.attachments.some(att => att.type === 'MessageAttachment' && att.attributes?.contentType?.startsWith('image/'));
8
+ return (<View style={[styles.previewContainer, style]}>
9
+ <View style={styles.previewHeader}>
10
+ <Avatar sourceUri={message.author.avatar} size="md"/>
11
+ <Text style={styles.authorName}>{message.author.name}</Text>
12
+ </View>
13
+
14
+ <View style={styles.messageBubbleContainer}>
15
+ {message.text && (<View style={styles.messageBubble}>
16
+ <Text style={styles.messageText} numberOfLines={5}>
17
+ {message.text}
18
+ </Text>
19
+ </View>)}
20
+
21
+ {hasImages && (<View style={styles.imagePlaceholder}>
22
+ <Icon name="general.image" style={styles.placeholderIcon}/>
23
+ <Text variant="secondary" style={styles.placeholderText}>
24
+ Image hidden
25
+ </Text>
26
+ </View>)}
27
+ </View>
28
+ </View>);
29
+ }
30
+ const useStyles = () => {
31
+ const { colors } = useTheme();
32
+ return StyleSheet.create({
33
+ previewContainer: {
34
+ gap: 12,
35
+ },
36
+ previewHeader: {
37
+ flexDirection: 'row',
38
+ alignItems: 'center',
39
+ gap: 12,
40
+ },
41
+ authorName: {
42
+ fontSize: 14,
43
+ fontWeight: '600',
44
+ color: colors.textColorDefaultPrimary,
45
+ },
46
+ messageBubbleContainer: {
47
+ gap: 8,
48
+ },
49
+ messageBubble: {
50
+ backgroundColor: colors.fillColorNeutral060,
51
+ borderRadius: 16,
52
+ paddingHorizontal: 16,
53
+ paddingVertical: 12,
54
+ alignSelf: 'flex-start',
55
+ maxWidth: '80%',
56
+ },
57
+ messageText: {
58
+ fontSize: 14,
59
+ color: colors.textColorDefaultPrimary,
60
+ lineHeight: 20,
61
+ },
62
+ imagePlaceholder: {
63
+ height: 120,
64
+ backgroundColor: colors.fillColorNeutral060,
65
+ borderRadius: 16,
66
+ justifyContent: 'center',
67
+ alignItems: 'center',
68
+ gap: 8,
69
+ maxWidth: '80%',
70
+ alignSelf: 'flex-start',
71
+ },
72
+ placeholderIcon: {
73
+ fontSize: 32,
74
+ color: colors.iconColorDefaultSecondary,
75
+ },
76
+ placeholderText: {
77
+ fontSize: 14,
78
+ },
79
+ });
80
+ };
81
+ //# sourceMappingURL=message_preview.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"message_preview.js","sourceRoot":"","sources":["../../../../src/screens/message_report/components/message_preview.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AACzB,OAAO,EAAE,IAAI,EAAE,UAAU,EAAa,MAAM,cAAc,CAAA;AAC1D,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,qBAAqB,CAAA;AACxD,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAg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N,QAAQ,EAAE,KAAK;YACf,SAAS,EAAE,YAAY;SACxB;QACD,eAAe,EAAE;YACf,QAAQ,EAAE,EAAE;YACZ,KAAK,EAAE,MAAM,CAAC,yBAAyB;SACxC;QACD,eAAe,EAAE;YACf,QAAQ,EAAE,EAAE;SACb;KACF,CAAC,CAAA;AACJ,CAAC,CAAA","sourcesContent":["import React from 'react'\nimport { View, StyleSheet, ViewStyle } from 'react-native'\nimport { Avatar, Text, Icon } from '../../../components'\nimport { useTheme } from '../../../hooks'\nimport { MessageResource } from '../../../types'\n\ninterface MessagePreviewProps {\n message: MessageResource\n style?: ViewStyle\n}\n\nexport function MessagePreview({ message, style }: MessagePreviewProps) {\n const styles = useStyles()\n\n const hasImages = message.attachments.some(\n att => att.type === 'MessageAttachment' && att.attributes?.contentType?.startsWith('image/')\n )\n\n return (\n <View style={[styles.previewContainer, style]}>\n <View style={styles.previewHeader}>\n <Avatar sourceUri={message.author.avatar} size=\"md\" />\n <Text style={styles.authorName}>{message.author.name}</Text>\n </View>\n\n <View style={styles.messageBubbleContainer}>\n {message.text && (\n <View style={styles.messageBubble}>\n <Text style={styles.messageText} numberOfLines={5}>\n {message.text}\n </Text>\n </View>\n )}\n\n {hasImages && (\n <View style={styles.imagePlaceholder}>\n <Icon name=\"general.image\" style={styles.placeholderIcon} />\n <Text variant=\"secondary\" style={styles.placeholderText}>\n Image hidden\n </Text>\n </View>\n )}\n </View>\n </View>\n )\n}\n\nconst useStyles = () => {\n const { colors } = useTheme()\n\n return StyleSheet.create({\n previewContainer: {\n gap: 12,\n },\n previewHeader: {\n flexDirection: 'row',\n alignItems: 'center',\n gap: 12,\n },\n authorName: {\n fontSize: 14,\n fontWeight: '600',\n color: colors.textColorDefaultPrimary,\n },\n messageBubbleContainer: {\n gap: 8,\n },\n messageBubble: {\n backgroundColor: colors.fillColorNeutral060,\n borderRadius: 16,\n paddingHorizontal: 16,\n paddingVertical: 12,\n alignSelf: 'flex-start',\n maxWidth: '80%',\n },\n messageText: {\n fontSize: 14,\n color: colors.textColorDefaultPrimary,\n lineHeight: 20,\n },\n imagePlaceholder: {\n height: 120,\n backgroundColor: colors.fillColorNeutral060,\n borderRadius: 16,\n justifyContent: 'center',\n alignItems: 'center',\n gap: 8,\n maxWidth: '80%',\n alignSelf: 'flex-start',\n },\n placeholderIcon: {\n fontSize: 32,\n color: colors.iconColorDefaultSecondary,\n },\n placeholderText: {\n fontSize: 14,\n },\n })\n}\n"]}
@@ -0,0 +1,9 @@
1
+ import React from 'react';
2
+ import { MessageReportReason } from '../../../types/resources/message_report';
3
+ interface ReportReasonListProps {
4
+ selectedReason: MessageReportReason | null;
5
+ onReasonChange: (reason: MessageReportReason) => void;
6
+ }
7
+ export declare function ReportReasonList({ selectedReason, onReasonChange }: ReportReasonListProps): React.JSX.Element;
8
+ export {};
9
+ //# sourceMappingURL=report_reason_list.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"report_reason_list.d.ts","sourceRoot":"","sources":["../../../../src/screens/message_report/components/report_reason_list.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AAMzB,OAAO,EAEL,mBAAmB,EACpB,MAAM,yCAAyC,CAAA;AAOhD,UAAU,qBAAqB;IAC7B,cAAc,EAAE,mBAAmB,GAAG,IAAI,CAAA;IAC1C,cAAc,EAAE,CAAC,MAAM,EAAE,mBAAmB,KAAK,IAAI,CAAA;CACtD;AAED,wBAAgB,gBAAgB,CAAC,EAAE,cAAc,EAAE,cAAc,EAAE,EAAE,qBAAqB,qBAiBzF"}
@@ -0,0 +1,67 @@
1
+ import React from 'react';
2
+ import { View, StyleSheet } from 'react-native';
3
+ import { PlatformPressable } from '@react-navigation/elements';
4
+ import { Text } from '../../../components';
5
+ import { useTheme, useCreateAndroidRippleColor } from '../../../hooks';
6
+ import { Haptic } from '../../../utils/native_adapters';
7
+ import { MESSAGE_REPORT_REASONS, } from '../../../types/resources/message_report';
8
+ const MESSAGE_REPORT_REASONS_LIST = Object.entries(MESSAGE_REPORT_REASONS).map(([key, label]) => ({
9
+ key: key,
10
+ label,
11
+ }));
12
+ export function ReportReasonList({ selectedReason, onReasonChange }) {
13
+ return (<View>
14
+ {MESSAGE_REPORT_REASONS_LIST.map(({ key, label }) => (<ReportReasonButton key={key} reason={key} label={label} isSelected={selectedReason === key} onPress={() => {
15
+ Haptic.impactLight();
16
+ onReasonChange(key);
17
+ }}/>))}
18
+ </View>);
19
+ }
20
+ function ReportReasonButton({ label, isSelected, onPress }) {
21
+ const styles = useStyles({ isSelected });
22
+ const { colors } = useTheme();
23
+ const androidRippleColor = useCreateAndroidRippleColor({ color: colors.fillColorNeutral060 });
24
+ return (<PlatformPressable onPress={onPress} style={styles.pressable} android_ripple={{ color: androidRippleColor }} accessibilityRole="radio" accessibilityState={{ selected: isSelected }} accessibilityLabel={label}>
25
+ <View style={styles.row}>
26
+ <View style={styles.radioButton}>
27
+ {isSelected && <View style={styles.radioButtonInner}/>}
28
+ </View>
29
+ <Text style={styles.label}>{label}</Text>
30
+ </View>
31
+ </PlatformPressable>);
32
+ }
33
+ const useStyles = ({ isSelected }) => {
34
+ const { colors } = useTheme();
35
+ return StyleSheet.create({
36
+ pressable: {
37
+ paddingVertical: 16,
38
+ paddingHorizontal: 16,
39
+ },
40
+ row: {
41
+ flexDirection: 'row',
42
+ alignItems: 'center',
43
+ gap: 12,
44
+ },
45
+ radioButton: {
46
+ width: 20,
47
+ height: 20,
48
+ borderRadius: 10,
49
+ borderWidth: 2,
50
+ borderColor: isSelected ? colors.interaction : colors.borderColorDefaultBase,
51
+ justifyContent: 'center',
52
+ alignItems: 'center',
53
+ },
54
+ radioButtonInner: {
55
+ width: 10,
56
+ height: 10,
57
+ borderRadius: 5,
58
+ backgroundColor: colors.interaction,
59
+ },
60
+ label: {
61
+ fontSize: 16,
62
+ color: colors.textColorDefaultPrimary,
63
+ flex: 1,
64
+ },
65
+ });
66
+ };
67
+ //# sourceMappingURL=report_reason_list.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"report_reason_list.js","sourceRoot":"","sources":["../../../../src/screens/message_report/components/report_reason_list.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AACzB,OAAO,EAAE,IAAI,EAAE,UAAU,EAAE,MAAM,cAAc,CAAA;AAC/C,OAAO,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAA;AAC9D,OAAO,EAAE,IAAI,EAAE,MAAM,qBAAqB,CAAA;AAC1C,OAAO,EAAE,QAAQ,EAAE,2BAA2B,EAAE,MAAM,gBAAgB,CAAA;AACtE,OAAO,EAAE,MAAM,EAAE,MAAM,gCAAgC,CAAA;AACvD,OAAO,EACL,sBAAsB,GAEvB,MAAM,yCAAyC,CAAA;AAEhD,MAAM,2BAA2B,GAAG,MAAM,CAAC,OAAO,CAAC,sBAAsB,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,EAAE,KAAK,CAAC,EAAE,EAAE,CAAC,CAAC;IAChG,GAAG,EAAE,GAA0B;IAC/B,KAAK;CACN,CAAC,CAAC,CAAA;AAOH,MAAM,UAAU,gBAAgB,CAAC,EAAE,cAAc,EAAE,cAAc,EAAyB;IACxF,OAAO,CACL,CAAC,IAAI,CACH;MAAA,CAAC,2BAA2B,CAAC,GAAG,CAAC,CAAC,EAAE,GAAG,EAAE,KAAK,EAAE,EAAE,EAAE,CAAC,CACnD,CAAC,kBAAkB,CACjB,GAAG,CAAC,CAAC,GAAG,CAAC,CACT,MAAM,CAAC,CAAC,GAAG,CAAC,CACZ,KAAK,CAAC,CAAC,KAAK,CAAC,CACb,UAAU,CAAC,CAAC,cAAc,KAAK,GAAG,CAAC,CACnC,OAAO,CAAC,CAAC,GAAG,EAAE;gBACZ,MAAM,CAAC,WAAW,EAAE,CAAA;gBACpB,cAAc,CAAC,GAAG,CAAC,CAAA;YACrB,CAAC,CAAC,EACF,CACH,CAAC,CACJ;IAAA,EAAE,IAAI,CAAC,CACR,CAAA;AACH,CAA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T,eAAe,EAAE,EAAE;YACnB,iBAAiB,EAAE,EAAE;SACtB;QACD,GAAG,EAAE;YACH,aAAa,EAAE,KAAK;YACpB,UAAU,EAAE,QAAQ;YACpB,GAAG,EAAE,EAAE;SACR;QACD,WAAW,EAAE;YACX,KAAK,EAAE,EAAE;YACT,MAAM,EAAE,EAAE;YACV,YAAY,EAAE,EAAE;YAChB,WAAW,EAAE,CAAC;YACd,WAAW,EAAE,UAAU,CAAC,CAAC,CAAC,MAAM,CAAC,WAAW,CAAC,CAAC,CAAC,MAAM,CAAC,sBAAsB;YAC5E,cAAc,EAAE,QAAQ;YACxB,UAAU,EAAE,QAAQ;SACrB;QACD,gBAAgB,EAAE;YAChB,KAAK,EAAE,EAAE;YACT,MAAM,EAAE,EAAE;YACV,YAAY,EAAE,CAAC;YACf,eAAe,EAAE,MAAM,CAAC,WAAW;SACpC;QACD,KAAK,EAAE;YACL,QAAQ,EAAE,EAAE;YACZ,KAAK,EAAE,MAAM,CAAC,uBAAuB;YACrC,IAAI,EAAE,CAAC;SACR;KACF,CAAC,CAAA;AACJ,CAAC,CAAA","sourcesContent":["import React from 'react'\nimport { View, StyleSheet } from 'react-native'\nimport { PlatformPressable } from '@react-navigation/elements'\nimport { Text } from '../../../components'\nimport { useTheme, useCreateAndroidRippleColor } from '../../../hooks'\nimport { Haptic } from '../../../utils/native_adapters'\nimport {\n MESSAGE_REPORT_REASONS,\n MessageReportReason,\n} from '../../../types/resources/message_report'\n\nconst MESSAGE_REPORT_REASONS_LIST = Object.entries(MESSAGE_REPORT_REASONS).map(([key, label]) => ({\n key: key as MessageReportReason,\n label,\n}))\n\ninterface ReportReasonListProps {\n selectedReason: MessageReportReason | null\n onReasonChange: (reason: MessageReportReason) => void\n}\n\nexport function ReportReasonList({ selectedReason, onReasonChange }: ReportReasonListProps) {\n return (\n <View>\n {MESSAGE_REPORT_REASONS_LIST.map(({ key, label }) => (\n <ReportReasonButton\n key={key}\n reason={key}\n label={label}\n isSelected={selectedReason === key}\n onPress={() => {\n Haptic.impactLight()\n onReasonChange(key)\n }}\n />\n ))}\n </View>\n )\n}\n\ninterface ReportReasonButtonProps {\n reason: MessageReportReason\n label: string\n isSelected: boolean\n onPress: () => void\n}\n\nfunction ReportReasonButton({ label, isSelected, onPress }: ReportReasonButtonProps) {\n const styles = useStyles({ isSelected })\n const { colors } = useTheme()\n const androidRippleColor = useCreateAndroidRippleColor({ color: colors.fillColorNeutral060 })\n\n return (\n <PlatformPressable\n onPress={onPress}\n style={styles.pressable}\n android_ripple={{ color: androidRippleColor }}\n accessibilityRole=\"radio\"\n accessibilityState={{ selected: isSelected }}\n accessibilityLabel={label}\n >\n <View style={styles.row}>\n <View style={styles.radioButton}>\n {isSelected && <View style={styles.radioButtonInner} />}\n </View>\n <Text style={styles.label}>{label}</Text>\n </View>\n </PlatformPressable>\n )\n}\n\nconst useStyles = ({ isSelected }: { isSelected: boolean }) => {\n const { colors } = useTheme()\n\n return StyleSheet.create({\n pressable: {\n paddingVertical: 16,\n paddingHorizontal: 16,\n },\n row: {\n flexDirection: 'row',\n alignItems: 'center',\n gap: 12,\n },\n radioButton: {\n width: 20,\n height: 20,\n borderRadius: 10,\n borderWidth: 2,\n borderColor: isSelected ? colors.interaction : colors.borderColorDefaultBase,\n justifyContent: 'center',\n alignItems: 'center',\n },\n radioButtonInner: {\n width: 10,\n height: 10,\n borderRadius: 5,\n backgroundColor: colors.interaction,\n },\n label: {\n fontSize: 16,\n color: colors.textColorDefaultPrimary,\n flex: 1,\n },\n })\n}\n"]}
@@ -0,0 +1,10 @@
1
+ import React from 'react';
2
+ import type { NativeStackNavigationOptions, NativeStackScreenProps } from '@react-navigation/native-stack';
3
+ import { StaticScreenProps } from '@react-navigation/native';
4
+ export declare const MessageReportScreenOptions: ({ navigation, }: NativeStackScreenProps<any>) => NativeStackNavigationOptions;
5
+ export type MessageReportScreenProps = StaticScreenProps<{
6
+ conversation_id: number;
7
+ message_id: string;
8
+ }>;
9
+ export declare function MessageReportScreen({ route }: MessageReportScreenProps): React.JSX.Element | null;
10
+ //# sourceMappingURL=message_report_screen.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"message_report_screen.d.ts","sourceRoot":"","sources":["../../src/screens/message_report_screen.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA0D,MAAM,OAAO,CAAA;AAE9E,OAAO,KAAK,EACV,4BAA4B,EAC5B,sBAAsB,EACvB,MAAM,gCAAgC,CAAA;AACvC,OAAO,EAAE,iBAAiB,EAA+B,MAAM,0BAA0B,CAAA;AAmBzF,eAAO,MAAM,0BAA0B,oBAEpC,sBAAsB,CAAC,GAAG,CAAC,KAAG,4BAI/B,CAAA;AAEF,MAAM,MAAM,wBAAwB,GAAG,iBAAiB,CAAC;IACvD,eAAe,EAAE,MAAM,CAAA;IACvB,UAAU,EAAE,MAAM,CAAA;CACnB,CAAC,CAAA;AAEF,wBAAgB,mBAAmB,CAAC,EAAE,KAAK,EAAE,EAAE,wBAAwB,4BAStE"}
@@ -0,0 +1,214 @@
1
+ import React, { useCallback, useLayoutEffect, useMemo, useState } from 'react';
2
+ import { View, StyleSheet, TextInput, ScrollView } from 'react-native';
3
+ import { useNavigation, StackActions } from '@react-navigation/native';
4
+ import { Spinner, Text, KeyboardView } from '../components';
5
+ import BlankState from '../components/primitive/blank_state_primitive';
6
+ import { useTheme } from '../hooks';
7
+ import { useReportMessage } from '../hooks/use_report_message';
8
+ import { HeaderDismissButton, HeaderTextButton, } from '../components/display/platform_modal_header_buttons';
9
+ import { useSafeAreaInsets } from 'react-native-safe-area-context';
10
+ import { useConversationMessages } from '../hooks/use_conversation_messages';
11
+ import { MessagePreview } from './message_report/components/message_preview';
12
+ import { ReportReasonList } from './message_report/components/report_reason_list';
13
+ import { platformFontWeightBold } from '../utils';
14
+ const MAX_DETAIL_LENGTH = 500;
15
+ export const MessageReportScreenOptions = ({ navigation, }) => ({
16
+ presentation: 'modal',
17
+ title: 'Report message',
18
+ headerLeft: () => <HeaderDismissButton title="Cancel" onPress={() => navigation.goBack()}/>,
19
+ });
20
+ export function MessageReportScreen({ route }) {
21
+ const { conversation_id, message_id } = route.params;
22
+ const { messages } = useConversationMessages({ conversation_id }, { refetchOnMount: false });
23
+ const message = messages.find(m => m.id === message_id);
24
+ if (!message)
25
+ return null;
26
+ return <MessageReportScreenContent message={message} conversation_id={conversation_id}/>;
27
+ }
28
+ function MessageReportScreenContent({ message, conversation_id, }) {
29
+ const styles = useStyles();
30
+ const navigation = useNavigation();
31
+ const [selectedReason, setSelectedReason] = useState(null);
32
+ const [reasonDetail, setReasonDetail] = useState('');
33
+ const { mutate: submitReport, status } = useReportMessage(conversation_id, message.id);
34
+ const handleReasonChange = useCallback((reason) => {
35
+ setSelectedReason(reason);
36
+ if (reason !== 'other') {
37
+ setReasonDetail('');
38
+ }
39
+ }, []);
40
+ const isFormValid = useMemo(() => {
41
+ if (selectedReason === null)
42
+ return false;
43
+ if (selectedReason === 'other' && reasonDetail.trim().length === 0) {
44
+ return false;
45
+ }
46
+ if (status === 'pending')
47
+ return false;
48
+ return true;
49
+ }, [selectedReason, reasonDetail, status]);
50
+ const handleSubmit = useCallback(() => {
51
+ if (!isFormValid || !selectedReason)
52
+ return;
53
+ submitReport({
54
+ reason: selectedReason,
55
+ reasonDetail: selectedReason === 'other' ? reasonDetail : undefined,
56
+ });
57
+ }, [isFormValid, selectedReason, reasonDetail, submitReport]);
58
+ const handleClose = useCallback(() => {
59
+ navigation.dispatch(StackActions.popTo('Conversation', { conversation_id }));
60
+ }, [navigation, conversation_id]);
61
+ const HeaderRight = useCallback(() => <HeaderTextButton title="Submit" onPress={handleSubmit} disabled={!isFormValid}/>, [handleSubmit, isFormValid]);
62
+ useLayoutEffect(() => {
63
+ if (status === 'pending' || status === 'success') {
64
+ navigation.setOptions({
65
+ headerRight: () => null,
66
+ });
67
+ }
68
+ else {
69
+ navigation.setOptions({
70
+ headerTitle: 'Report message',
71
+ headerRight: HeaderRight,
72
+ });
73
+ }
74
+ }, [HeaderRight, navigation, status]);
75
+ if (status === 'pending') {
76
+ return (<View style={styles.fullScreenContainer}>
77
+ <Spinner />
78
+ <Text style={styles.loadingText}>Submitting report...</Text>
79
+ </View>);
80
+ }
81
+ if (status === 'success') {
82
+ return (<View style={styles.fullScreenContainer}>
83
+ <BlankState.Root>
84
+ <BlankState.Imagery name="general.checkCircle" style={styles.successIcon}/>
85
+ <BlankState.Content>
86
+ <BlankState.Heading style={styles.successTitle}>Message reported</BlankState.Heading>
87
+ <BlankState.Text style={styles.successSubtitle}>
88
+ The message has been reported and a church leader will be contacted.
89
+ </BlankState.Text>
90
+ </BlankState.Content>
91
+ <BlankState.Button title="Close" onPress={handleClose} size="lg" variant="fill"/>
92
+ </BlankState.Root>
93
+ </View>);
94
+ }
95
+ if (status === 'error') {
96
+ return (<BlankState.Root>
97
+ <BlankState.Imagery name="general.exclamationTriangle"/>
98
+ <BlankState.Content>
99
+ <BlankState.Heading>Unable to submit report</BlankState.Heading>
100
+ <BlankState.Text>
101
+ We were unable to report this message. Please try again.
102
+ </BlankState.Text>
103
+ </BlankState.Content>
104
+ <BlankState.Button title="Close" onPress={handleClose} size="lg" variant="outline"/>
105
+ </BlankState.Root>);
106
+ }
107
+ return (<KeyboardView>
108
+ <ScrollView contentContainerStyle={styles.container}>
109
+ <Text style={styles.warningText}>
110
+ Reporting this message will notify a church leader. The person you are reporting will not
111
+ receive a notification from Church Center. If someone is in immediate danger, call local
112
+ emergency services. Don&apos;t wait.
113
+ </Text>
114
+
115
+ <MessagePreview message={message}/>
116
+
117
+ <View style={styles.reasonSection}>
118
+ <Text style={styles.fieldLabel}>
119
+ What best describes the problem? <Text style={styles.required}>*</Text>
120
+ </Text>
121
+
122
+ <View style={styles.reasonListContainer}>
123
+ <ReportReasonList selectedReason={selectedReason} onReasonChange={handleReasonChange}/>
124
+ </View>
125
+ </View>
126
+
127
+ {selectedReason === 'other' && (<View style={styles.detailSection}>
128
+ <Text style={styles.fieldLabel}>
129
+ Please provide more details <Text style={styles.required}>*</Text>
130
+ </Text>
131
+ <TextInput style={styles.textInput} multiline placeholder="Describe the issue..." value={reasonDetail} onChangeText={setReasonDetail} maxLength={MAX_DETAIL_LENGTH} accessibilityLabel="Additional details" accessibilityHint="Provide more information about why you're reporting this message"/>
132
+ {reasonDetail.length >= MAX_DETAIL_LENGTH - 100 && (<Text variant="footnote">
133
+ {reasonDetail.length}/{MAX_DETAIL_LENGTH}
134
+ </Text>)}
135
+ </View>)}
136
+ </ScrollView>
137
+ </KeyboardView>);
138
+ }
139
+ const useStyles = () => {
140
+ const { bottom } = useSafeAreaInsets();
141
+ const { colors } = useTheme();
142
+ return StyleSheet.create({
143
+ container: {
144
+ padding: 16,
145
+ paddingBottom: 16 + bottom,
146
+ gap: 24,
147
+ },
148
+ fullHeight: {
149
+ flex: 1,
150
+ justifyContent: 'center',
151
+ alignItems: 'center',
152
+ },
153
+ fullScreenContainer: {
154
+ flex: 1,
155
+ justifyContent: 'center',
156
+ alignItems: 'center',
157
+ backgroundColor: colors.surfaceColor100,
158
+ },
159
+ loadingText: {
160
+ marginTop: 16,
161
+ fontSize: 16,
162
+ fontWeight: '600',
163
+ color: colors.textColorDefaultPrimary,
164
+ },
165
+ warningText: {
166
+ fontSize: 14,
167
+ lineHeight: 20,
168
+ color: colors.textColorDefaultSecondary,
169
+ },
170
+ reasonSection: {
171
+ gap: 8,
172
+ },
173
+ fieldLabel: {
174
+ fontSize: 16,
175
+ fontWeight: platformFontWeightBold,
176
+ color: colors.textColorDefaultPrimary,
177
+ },
178
+ required: {
179
+ color: colors.statusErrorText,
180
+ },
181
+ reasonListContainer: {
182
+ backgroundColor: colors.surfaceColor100,
183
+ },
184
+ detailSection: {
185
+ gap: 8,
186
+ },
187
+ textInput: {
188
+ color: colors.textColorDefaultPrimary,
189
+ fontSize: 16,
190
+ textAlignVertical: 'top',
191
+ minHeight: 120,
192
+ maxHeight: 200,
193
+ borderWidth: 1,
194
+ borderColor: colors.borderColorDefaultBase,
195
+ borderRadius: 8,
196
+ paddingHorizontal: 16,
197
+ paddingVertical: 12,
198
+ backgroundColor: colors.surfaceColor100,
199
+ },
200
+ successIcon: {
201
+ color: colors.statusSuccessIcon,
202
+ fontSize: 48,
203
+ },
204
+ successTitle: {
205
+ fontSize: 24,
206
+ marginBottom: 4,
207
+ },
208
+ successSubtitle: {
209
+ fontSize: 16,
210
+ marginBottom: 4,
211
+ },
212
+ });
213
+ };
214
+ //# sourceMappingURL=message_report_screen.js.map