@planningcenter/chat-react-native 3.21.2-rc.5 → 3.22.0-rc.1

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 (58) hide show
  1. package/build/components/conversation/attachments/attachment_card.js +1 -0
  2. package/build/components/conversation/attachments/attachment_card.js.map +1 -1
  3. package/build/components/conversation/attachments/attachment_deleting_overlay.d.ts +3 -0
  4. package/build/components/conversation/attachments/attachment_deleting_overlay.d.ts.map +1 -0
  5. package/build/components/conversation/attachments/attachment_deleting_overlay.js +29 -0
  6. package/build/components/conversation/attachments/attachment_deleting_overlay.js.map +1 -0
  7. package/build/components/conversation/attachments/audio_attachment.d.ts +2 -1
  8. package/build/components/conversation/attachments/audio_attachment.d.ts.map +1 -1
  9. package/build/components/conversation/attachments/audio_attachment.js +5 -3
  10. package/build/components/conversation/attachments/audio_attachment.js.map +1 -1
  11. package/build/components/conversation/attachments/generic_file_attachment.d.ts +2 -1
  12. package/build/components/conversation/attachments/generic_file_attachment.d.ts.map +1 -1
  13. package/build/components/conversation/attachments/generic_file_attachment.js +4 -2
  14. package/build/components/conversation/attachments/generic_file_attachment.js.map +1 -1
  15. package/build/components/conversation/attachments/image_attachment.d.ts +2 -1
  16. package/build/components/conversation/attachments/image_attachment.d.ts.map +1 -1
  17. package/build/components/conversation/attachments/image_attachment.js +9 -4
  18. package/build/components/conversation/attachments/image_attachment.js.map +1 -1
  19. package/build/components/conversation/attachments/video_attachment.d.ts +2 -1
  20. package/build/components/conversation/attachments/video_attachment.d.ts.map +1 -1
  21. package/build/components/conversation/attachments/video_attachment.js +5 -3
  22. package/build/components/conversation/attachments/video_attachment.js.map +1 -1
  23. package/build/components/conversation/message.d.ts.map +1 -1
  24. package/build/components/conversation/message.js +7 -3
  25. package/build/components/conversation/message.js.map +1 -1
  26. package/build/components/conversation/message_attachments.d.ts.map +1 -1
  27. package/build/components/conversation/message_attachments.js +8 -6
  28. package/build/components/conversation/message_attachments.js.map +1 -1
  29. package/build/hooks/index.d.ts +1 -0
  30. package/build/hooks/index.d.ts.map +1 -1
  31. package/build/hooks/index.js +1 -0
  32. package/build/hooks/index.js.map +1 -1
  33. package/build/hooks/use_deleting_ids.d.ts +4 -0
  34. package/build/hooks/use_deleting_ids.d.ts.map +1 -0
  35. package/build/hooks/use_deleting_ids.js +19 -0
  36. package/build/hooks/use_deleting_ids.js.map +1 -0
  37. package/build/screens/attachment_actions/attachment_actions_screen.d.ts.map +1 -1
  38. package/build/screens/attachment_actions/attachment_actions_screen.js +9 -2
  39. package/build/screens/attachment_actions/attachment_actions_screen.js.map +1 -1
  40. package/build/screens/attachment_actions/hooks/useDeleteAttachment.d.ts.map +1 -1
  41. package/build/screens/attachment_actions/hooks/useDeleteAttachment.js +1 -3
  42. package/build/screens/attachment_actions/hooks/useDeleteAttachment.js.map +1 -1
  43. package/build/screens/message_actions_screen.js +10 -3
  44. package/build/screens/message_actions_screen.js.map +1 -1
  45. package/package.json +2 -2
  46. package/src/components/conversation/attachments/attachment_card.tsx +1 -0
  47. package/src/components/conversation/attachments/attachment_deleting_overlay.tsx +34 -0
  48. package/src/components/conversation/attachments/audio_attachment.tsx +7 -2
  49. package/src/components/conversation/attachments/generic_file_attachment.tsx +6 -1
  50. package/src/components/conversation/attachments/image_attachment.tsx +11 -3
  51. package/src/components/conversation/attachments/video_attachment.tsx +7 -2
  52. package/src/components/conversation/message.tsx +11 -7
  53. package/src/components/conversation/message_attachments.tsx +9 -0
  54. package/src/hooks/index.ts +1 -0
  55. package/src/hooks/use_deleting_ids.ts +22 -0
  56. package/src/screens/attachment_actions/attachment_actions_screen.tsx +9 -2
  57. package/src/screens/attachment_actions/hooks/useDeleteAttachment.tsx +1 -3
  58. package/src/screens/message_actions_screen.tsx +10 -3
@@ -1,7 +1,8 @@
1
1
  import React from 'react';
2
2
  import { DenormalizedMessageAttachmentResource } from '../../../types/resources/denormalized_attachment_resource';
3
- export declare function VideoAttachment({ attachment, onMessageAttachmentLongPress, }: {
3
+ export declare function VideoAttachment({ attachment, onMessageAttachmentLongPress, isDeleting, }: {
4
4
  attachment: DenormalizedMessageAttachmentResource;
5
5
  onMessageAttachmentLongPress: (attachment: DenormalizedMessageAttachmentResource) => void;
6
+ isDeleting: boolean;
6
7
  }): React.JSX.Element;
7
8
  //# sourceMappingURL=video_attachment.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"video_attachment.d.ts","sourceRoot":"","sources":["../../../../src/components/conversation/attachments/video_attachment.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA2B,MAAM,OAAO,CAAA;AAE/C,OAAO,EAAE,qCAAqC,EAAE,MAAM,2DAA2D,CAAA;AAQjH,wBAAgB,eAAe,CAAC,EAC9B,UAAU,EACV,4BAA4B,GAC7B,EAAE;IACD,UAAU,EAAE,qCAAqC,CAAA;IACjD,4BAA4B,EAAE,CAAC,UAAU,EAAE,qCAAqC,KAAK,IAAI,CAAA;CAC1F,qBA0DA"}
1
+ {"version":3,"file":"video_attachment.d.ts","sourceRoot":"","sources":["../../../../src/components/conversation/attachments/video_attachment.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA2B,MAAM,OAAO,CAAA;AAE/C,OAAO,EAAE,qCAAqC,EAAE,MAAM,2DAA2D,CAAA;AASjH,wBAAgB,eAAe,CAAC,EAC9B,UAAU,EACV,4BAA4B,EAC5B,UAAU,GACX,EAAE;IACD,UAAU,EAAE,qCAAqC,CAAA;IACjD,4BAA4B,EAAE,CAAC,UAAU,EAAE,qCAAqC,KAAK,IAAI,CAAA;IACzF,UAAU,EAAE,OAAO,CAAA;CACpB,qBA4DA"}
@@ -6,7 +6,8 @@ import { Video } from '../../../utils/native_adapters';
6
6
  import { PlatformPressable } from '@react-navigation/elements';
7
7
  import { useTheme } from '../../../hooks';
8
8
  import { tokens } from '../../../vendor/tapestry/tokens';
9
- export function VideoAttachment({ attachment, onMessageAttachmentLongPress, }) {
9
+ import { AttachmentDeletingOverlay } from './attachment_deleting_overlay';
10
+ export function VideoAttachment({ attachment, onMessageAttachmentLongPress, isDeleting, }) {
10
11
  const { colors } = useTheme();
11
12
  const styles = useStyles();
12
13
  const { attributes } = attachment;
@@ -27,14 +28,15 @@ export function VideoAttachment({ attachment, onMessageAttachmentLongPress, }) {
27
28
  }
28
29
  const viewRef = useRef(null);
29
30
  return (<View style={styles.container} ref={viewRef}>
30
- <PlatformPressable onPress={openVideo} onLongPress={() => onMessageAttachmentLongPress(attachment)} android_ripple={{ color: colors.androidRippleNeutral, foreground: true }} accessibilityLabel="Play Video" accessibilityHint="Press to play video. Long press for more options">
31
+ <PlatformPressable onPress={openVideo} onLongPress={() => !isDeleting && onMessageAttachmentLongPress(attachment)} android_ripple={{ color: colors.androidRippleNeutral, foreground: true }} accessibilityLabel="Play Video" accessibilityHint="Press to play video. Long press for more options" disabled={isDeleting}>
31
32
  <View style={styles.thumbnailOverlay}/>
32
33
  <Video.Player ref={videoRef} source={{ uri: url }} aspectRatio={width / height} style={styles.video} onFullscreenPlayerWillDismiss={onFullscreenPlayerWillDismiss}/>
33
- {!isOpen && (<View style={styles.playContainer}>
34
+ {!isOpen && !isDeleting && (<View style={styles.playContainer}>
34
35
  <View style={styles.playCircle}>
35
36
  <Icon name="services.play" style={styles.playIcon} accessibilityElementsHidden={true}/>
36
37
  </View>
37
38
  </View>)}
39
+ {isDeleting && <AttachmentDeletingOverlay />}
38
40
  </PlatformPressable>
39
41
  </View>);
40
42
  }
@@ -1 +1 @@
1
- {"version":3,"file":"video_attachment.js","sourceRoot":"","sources":["../../../../src/components/conversation/attachments/video_attachment.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAA;AAC/C,OAAO,EAAE,IAAI,EAAE,UAAU,EAAE,MAAM,cAAc,CAAA;AAE/C,OAAO,EAAE,+BAA+B,EAAE,MAAM,aAAa,CAAA;AAC7D,OAAO,EAAE,IAAI,EAAE,MAAM,eAAe,CAAA;AACpC,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,sBAAsB,GAC1B,MAAM,CAAC,IAAI,KAAK,OAAO;QACrB,CAAC,CAAC,MAAM,CAAC,4BAA4B;QACrC,CAAC,CAAC,MAAM,CAAC,4BAA4B,CAAA;IAEzC,OAAO,UAAU,CAAC,MAAM,CAAC;QACvB,SAAS,EAAE;YACT,YAAY,EAAE,CAAC;YACf,QAAQ,EAAE,QAAQ;SACnB;QACD,KAAK,EAAE;YACL,KAAK,EAAE,MAAM;YACb,eAAe,EAAE,MAAM,CAAC,mBAAmB;SAC5C;QACD,gBAAgB,EAAE;YAChB,QAAQ,EAAE,UAAU;YACpB,GAAG,EAAE,CAAC;YACN,IAAI,EAAE,CAAC;YACP,KAAK,EAAE,CAAC;YACR,MAAM,EAAE,CAAC;YACT,eAAe,EAAE,sBAAsB;YACvC,MAAM,EAAE,eAAe;SACxB;QACD,aAAa,EAAE;YACb,QAAQ,EAAE,UAAU;YACpB,GAAG,EAAE,CAAC;YACN,IAAI,EAAE,CAAC;YACP,KAAK,EAAE,CAAC;YACR,MAAM,EAAE,CAAC;YACT,cAAc,EAAE,QAAQ;YACxB,UAAU,EAAE,QAAQ;YACpB,MAAM,EAAE,eAAe,GAAG,CAAC;SAC5B;QACD,UAAU,EAAE;YACV,cAAc,EAAE,QAAQ;YACxB,UAAU,EAAE,QAAQ;YACpB,KAAK,EAAE,EAAE;YACT,MAAM,EAAE,EAAE;YACV,YAAY,EAAE,EAAE;YAChB,eAAe,EAAE,MAAM,CAAC,2BAA2B;YACnD,WAAW,EAAE,MAAM,CAAC,sBAAsB;YAC1C,WAAW,EAAE,CAAC;SACf;QACD,QAAQ,EAAE;YACR,QAAQ,EAAE,EAAE;SACb;KACF,CAAC,CAAA;AACJ,CAAC,CAAA","sourcesContent":["import React, { useRef, useState } from 'react'\nimport { View, StyleSheet } from 'react-native'\nimport { DenormalizedMessageAttachmentResource } from '../../../types/resources/denormalized_attachment_resource'\nimport { MESSAGE_ATTACHMENT_WIDTH_SINGLE } from './constants'\nimport { Icon } from '../../display'\nimport { Video, VideoPlayerHandle } from '../../../utils/native_adapters'\nimport { PlatformPressable } from '@react-navigation/elements'\nimport { useTheme } from '../../../hooks'\nimport { tokens } from '../../../vendor/tapestry/tokens'\n\nexport function VideoAttachment({\n attachment,\n onMessageAttachmentLongPress,\n}: {\n attachment: DenormalizedMessageAttachmentResource\n onMessageAttachmentLongPress: (attachment: DenormalizedMessageAttachmentResource) => void\n}) {\n const { colors } = useTheme()\n const styles = useStyles()\n\n const { attributes } = attachment\n const { width = MESSAGE_ATTACHMENT_WIDTH_SINGLE, height = MESSAGE_ATTACHMENT_WIDTH_SINGLE } =\n attributes.metadata || {}\n const { url } = attributes\n\n const videoRef = useRef<VideoPlayerHandle>(null)\n const [isOpen, setIsOpen] = useState(false)\n\n function openVideo() {\n if (!isOpen && videoRef.current) {\n videoRef.current.presentFullscreenPlayer()\n videoRef.current.play()\n setIsOpen(true)\n }\n }\n\n function onFullscreenPlayerWillDismiss() {\n videoRef.current?.pause()\n setIsOpen(false)\n }\n\n const viewRef = useRef<View>(null)\n\n return (\n <View style={styles.container} ref={viewRef}>\n <PlatformPressable\n onPress={openVideo}\n onLongPress={() => onMessageAttachmentLongPress(attachment)}\n android_ripple={{ color: colors.androidRippleNeutral, foreground: true }}\n accessibilityLabel=\"Play Video\"\n accessibilityHint=\"Press to play video. Long press for more options\"\n >\n <View style={styles.thumbnailOverlay} />\n <Video.Player\n ref={videoRef}\n source={{ uri: url }}\n aspectRatio={width / height}\n style={styles.video}\n onFullscreenPlayerWillDismiss={onFullscreenPlayerWillDismiss}\n />\n {!isOpen && (\n <View style={styles.playContainer}>\n <View style={styles.playCircle}>\n <Icon\n name=\"services.play\"\n style={styles.playIcon}\n accessibilityElementsHidden={true}\n />\n </View>\n </View>\n )}\n </PlatformPressable>\n </View>\n )\n}\nconst OVERLAY_Z_INDEX = 1\n\nconst useStyles = () => {\n const { colors } = useTheme()\n const overlayBackgroundColor =\n colors.name === 'light'\n ? tokens.fillColorTransparencyDark010\n : tokens.fillColorTransparencyDark030\n\n return StyleSheet.create({\n container: {\n borderRadius: 8,\n overflow: 'hidden',\n },\n video: {\n width: '100%',\n backgroundColor: colors.fillColorNeutral070,\n },\n thumbnailOverlay: {\n position: 'absolute',\n top: 0,\n left: 0,\n right: 0,\n bottom: 0,\n backgroundColor: overlayBackgroundColor,\n zIndex: OVERLAY_Z_INDEX,\n },\n playContainer: {\n position: 'absolute',\n top: 0,\n left: 0,\n right: 0,\n bottom: 0,\n justifyContent: 'center',\n alignItems: 'center',\n zIndex: OVERLAY_Z_INDEX + 1,\n },\n playCircle: {\n justifyContent: 'center',\n alignItems: 'center',\n width: 42,\n height: 42,\n borderRadius: 25,\n backgroundColor: colors.fillColorNeutral100Inverted,\n borderColor: colors.borderColorDefaultBase,\n borderWidth: 1,\n },\n playIcon: {\n fontSize: 20,\n },\n })\n}\n"]}
1
+ {"version":3,"file":"video_attachment.js","sourceRoot":"","sources":["../../../../src/components/conversation/attachments/video_attachment.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAA;AAC/C,OAAO,EAAE,IAAI,EAAE,UAAU,EAAE,MAAM,cAAc,CAAA;AAE/C,OAAO,EAAE,+BAA+B,EAAE,MAAM,aAAa,CAAA;AAC7D,OAAO,EAAE,IAAI,EAAE,MAAM,eAAe,CAAA;AACpC,OAAO,EAAE,KAAK,EAAqB,MAAM,gCAAgC,CAAA;AACzE,OAAO,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAA;AAC9D,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAA;AACzC,OAAO,EAAE,MAAM,EAAE,MAAM,iCAAiC,CAAA;AACxD,OAAO,EAAE,yBAAyB,EAAE,MAAM,+BAA+B,CAAA;AAEzE,MAAM,UAAU,eAAe,CAAC,EAC9B,UAAU,EACV,4BAA4B,EAC5B,UAAU,GAKX;IACC,MAAM,EAAE,MAAM,EAAE,G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M,CAAC;QACvB,SAAS,EAAE;YACT,YAAY,EAAE,CAAC;YACf,QAAQ,EAAE,QAAQ;SACnB;QACD,KAAK,EAAE;YACL,KAAK,EAAE,MAAM;YACb,eAAe,EAAE,MAAM,CAAC,mBAAmB;SAC5C;QACD,gBAAgB,EAAE;YAChB,QAAQ,EAAE,UAAU;YACpB,GAAG,EAAE,CAAC;YACN,IAAI,EAAE,CAAC;YACP,KAAK,EAAE,CAAC;YACR,MAAM,EAAE,CAAC;YACT,eAAe,EAAE,sBAAsB;YACvC,MAAM,EAAE,eAAe;SACxB;QACD,aAAa,EAAE;YACb,QAAQ,EAAE,UAAU;YACpB,GAAG,EAAE,CAAC;YACN,IAAI,EAAE,CAAC;YACP,KAAK,EAAE,CAAC;YACR,MAAM,EAAE,CAAC;YACT,cAAc,EAAE,QAAQ;YACxB,UAAU,EAAE,QAAQ;YACpB,MAAM,EAAE,eAAe,GAAG,CAAC;SAC5B;QACD,UAAU,EAAE;YACV,cAAc,EAAE,QAAQ;YACxB,UAAU,EAAE,QAAQ;YACpB,KAAK,EAAE,EAAE;YACT,MAAM,EAAE,EAAE;YACV,YAAY,EAAE,EAAE;YAChB,eAAe,EAAE,MAAM,CAAC,2BAA2B;YACnD,WAAW,EAAE,MAAM,CAAC,sBAAsB;YAC1C,WAAW,EAAE,CAAC;SACf;QACD,QAAQ,EAAE;YACR,QAAQ,EAAE,EAAE;SACb;KACF,CAAC,CAAA;AACJ,CAAC,CAAA","sourcesContent":["import React, { useRef, useState } from 'react'\nimport { View, StyleSheet } from 'react-native'\nimport { DenormalizedMessageAttachmentResource } from '../../../types/resources/denormalized_attachment_resource'\nimport { MESSAGE_ATTACHMENT_WIDTH_SINGLE } from './constants'\nimport { Icon } from '../../display'\nimport { Video, VideoPlayerHandle } from '../../../utils/native_adapters'\nimport { PlatformPressable } from '@react-navigation/elements'\nimport { useTheme } from '../../../hooks'\nimport { tokens } from '../../../vendor/tapestry/tokens'\nimport { AttachmentDeletingOverlay } from './attachment_deleting_overlay'\n\nexport function VideoAttachment({\n attachment,\n onMessageAttachmentLongPress,\n isDeleting,\n}: {\n attachment: DenormalizedMessageAttachmentResource\n onMessageAttachmentLongPress: (attachment: DenormalizedMessageAttachmentResource) => void\n isDeleting: boolean\n}) {\n const { colors } = useTheme()\n const styles = useStyles()\n\n const { attributes } = attachment\n const { width = MESSAGE_ATTACHMENT_WIDTH_SINGLE, height = MESSAGE_ATTACHMENT_WIDTH_SINGLE } =\n attributes.metadata || {}\n const { url } = attributes\n\n const videoRef = useRef<VideoPlayerHandle>(null)\n const [isOpen, setIsOpen] = useState(false)\n\n function openVideo() {\n if (!isOpen && videoRef.current) {\n videoRef.current.presentFullscreenPlayer()\n videoRef.current.play()\n setIsOpen(true)\n }\n }\n\n function onFullscreenPlayerWillDismiss() {\n videoRef.current?.pause()\n setIsOpen(false)\n }\n\n const viewRef = useRef<View>(null)\n\n return (\n <View style={styles.container} ref={viewRef}>\n <PlatformPressable\n onPress={openVideo}\n onLongPress={() => !isDeleting && onMessageAttachmentLongPress(attachment)}\n android_ripple={{ color: colors.androidRippleNeutral, foreground: true }}\n accessibilityLabel=\"Play Video\"\n accessibilityHint=\"Press to play video. Long press for more options\"\n disabled={isDeleting}\n >\n <View style={styles.thumbnailOverlay} />\n <Video.Player\n ref={videoRef}\n source={{ uri: url }}\n aspectRatio={width / height}\n style={styles.video}\n onFullscreenPlayerWillDismiss={onFullscreenPlayerWillDismiss}\n />\n {!isOpen && !isDeleting && (\n <View style={styles.playContainer}>\n <View style={styles.playCircle}>\n <Icon\n name=\"services.play\"\n style={styles.playIcon}\n accessibilityElementsHidden={true}\n />\n </View>\n </View>\n )}\n {isDeleting && <AttachmentDeletingOverlay />}\n </PlatformPressable>\n </View>\n )\n}\nconst OVERLAY_Z_INDEX = 1\n\nconst useStyles = () => {\n const { colors } = useTheme()\n const overlayBackgroundColor =\n colors.name === 'light'\n ? tokens.fillColorTransparencyDark010\n : tokens.fillColorTransparencyDark030\n\n return StyleSheet.create({\n container: {\n borderRadius: 8,\n overflow: 'hidden',\n },\n video: {\n width: '100%',\n backgroundColor: colors.fillColorNeutral070,\n },\n thumbnailOverlay: {\n position: 'absolute',\n top: 0,\n left: 0,\n right: 0,\n bottom: 0,\n backgroundColor: overlayBackgroundColor,\n zIndex: OVERLAY_Z_INDEX,\n },\n playContainer: {\n position: 'absolute',\n top: 0,\n left: 0,\n right: 0,\n bottom: 0,\n justifyContent: 'center',\n alignItems: 'center',\n zIndex: OVERLAY_Z_INDEX + 1,\n },\n playCircle: {\n justifyContent: 'center',\n alignItems: 'center',\n width: 42,\n height: 42,\n borderRadius: 25,\n backgroundColor: colors.fillColorNeutral100Inverted,\n borderColor: colors.borderColorDefaultBase,\n borderWidth: 1,\n },\n playIcon: {\n fontSize: 20,\n },\n })\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"message.d.ts","sourceRoot":"","sources":["../../../src/components/conversation/message.tsx"],"names":[],"mappings":"AACA,OAAO,KAAoB,MAAM,OAAO,CAAA;AAexC,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAA;AAsB7C;;GAEG;AACH,UAAU,YAAa,SAAQ,eAAe;IAC5C,4BAA4B,EAAE,OAAO,CAAA;IACrC,eAAe,EAAE,MAAM,CAAA;IACvB,wBAAwB,CAAC,EAAE,MAAM,CAAA;IACjC,aAAa,CAAC,EAAE,OAAO,CAAA;IACvB,cAAc,CAAC,EAAE,OAAO,CAAA;CACzB;AAED,wBAAgB,OAAO,CAAC,EACtB,4BAA4B,EAC5B,eAAe,EACf,wBAAwB,EACxB,aAAa,EACb,cAAc,EACd,GAAG,OAAO,EACX,EAAE,YAAY,qBAyRd"}
1
+ {"version":3,"file":"message.d.ts","sourceRoot":"","sources":["../../../src/components/conversation/message.tsx"],"names":[],"mappings":"AACA,OAAO,KAAoB,MAAM,OAAO,CAAA;AAexC,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAA;AAuB7C;;GAEG;AACH,UAAU,YAAa,SAAQ,eAAe;IAC5C,4BAA4B,EAAE,OAAO,CAAA;IACrC,eAAe,EAAE,MAAM,CAAA;IACvB,wBAAwB,CAAC,EAAE,MAAM,CAAA;IACjC,aAAa,CAAC,EAAE,OAAO,CAAA;IACvB,cAAc,CAAC,EAAE,OAAO,CAAA;CACzB;AAED,wBAAgB,OAAO,CAAC,EACtB,4BAA4B,EAC5B,eAAe,EACf,wBAAwB,EACxB,aAAa,EACb,cAAc,EACd,GAAG,OAAO,EACX,EAAE,YAAY,qBA2Rd"}
@@ -18,9 +18,12 @@ import { pluralize } from '../../utils';
18
18
  import { useConversationMessage } from '../../hooks/use_conversation_message';
19
19
  import { some } from 'lodash';
20
20
  import { isNewMessage } from '../../utils/cache/messages_cache';
21
+ import { useDeletingIds } from '../../hooks';
21
22
  export function Message({ canDeleteNonAuthoredMessages, conversation_id, latestReadMessageSortKey, inReplyScreen, repliesEnabled, ...message }) {
22
23
  const { text, reactionCounts, pending, error, attachments, author } = message;
23
- const styles = useMessageStyles(message);
24
+ const deletingMessageIds = useDeletingIds('deleteMessage');
25
+ const isDeleting = deletingMessageIds.has(message.id);
26
+ const styles = useMessageStyles(message.mine, isDeleting);
24
27
  const navigation = useNavigation();
25
28
  const { colors } = useTheme();
26
29
  const hasReactions = reactionCounts.length > 0;
@@ -132,7 +135,7 @@ export function Message({ canDeleteNonAuthoredMessages, conversation_id, latestR
132
135
  handleNavigateToReplyPress();
133
136
  }
134
137
  };
135
- return (<Pressable onLongPress={handleMessageLongPress} onPress={handleMessagePress} onPressIn={handleMessagePressIn} onPressOut={handleMessagePressOut} android_ripple={{ color: colors.androidRippleNeutral, borderless: false, foreground: true }} accessibilityRole="button" accessibilityLabel={accessibilityLabel} accessibilityHint="Long press to view message actions like reacting and copying." accessibilityActions={isReplyRootMessage ? accessibilityActions : undefined} onAccessibilityAction={isReplyRootMessage ? handleAccessibilityAction : undefined} disabled={isDeletedReplyRootMessage}>
138
+ return (<Pressable onLongPress={isDeleting ? undefined : handleMessageLongPress} onPress={isDeleting ? undefined : handleMessagePress} onPressIn={isDeleting ? undefined : handleMessagePressIn} onPressOut={isDeleting ? undefined : handleMessagePressOut} android_ripple={{ color: colors.androidRippleNeutral, borderless: false, foreground: true }} accessibilityRole="button" accessibilityLabel={accessibilityLabel} accessibilityHint="Long press to view message actions like reacting and copying." accessibilityActions={isReplyRootMessage ? accessibilityActions : undefined} onAccessibilityAction={isReplyRootMessage ? handleAccessibilityAction : undefined} disabled={isDeletedReplyRootMessage || isDeleting}>
136
139
  <Animated.View style={[styles.message, animatedBackgroundColor]}>
137
140
  {!message.mine && (<View>
138
141
  {renderAuthor ? (<Avatar size={'md'} sourceUri={author.avatar} style={styles.avatar} maxFontSizeMultiplier={1} minFontSizeMultiplier={1} fallbackIconName={isDeletedReplyRootMessage ? 'publishing.trash' : 'general.person'} showFallback={isDeletedReplyRootMessage}/>) : (<View style={styles.avatarPlaceholder}/>)}
@@ -186,7 +189,7 @@ export function Message({ canDeleteNonAuthoredMessages, conversation_id, latestR
186
189
  </Animated.View>
187
190
  </Pressable>);
188
191
  }
189
- const useMessageStyles = ({ mine }) => {
192
+ const useMessageStyles = (mine, isDeleting) => {
190
193
  const { colors } = useTheme();
191
194
  const myMessageBackgroundColor = useInteractionGhostBackgroundColor();
192
195
  const { width } = useWindowDimensions();
@@ -197,6 +200,7 @@ const useMessageStyles = ({ mine }) => {
197
200
  gap: 8,
198
201
  flexDirection: mine ? 'row-reverse' : 'row',
199
202
  paddingHorizontal: CONVERSATION_MESSAGE_LIST_PADDING_HORIZONTAL,
203
+ opacity: isDeleting ? 0.5 : 1,
200
204
  },
201
205
  messageContent: {
202
206
  flex: 1,
@@ -1 +1 @@
1
- {"version":3,"file":"message.js","sourceRoot":"","sources":["../../../src/components/conversation/message.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAA;AACxD,OAAO,KAAK,EAAE,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AACx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,EAAE,wBAAwB;SACrC;QACD,yBAAyB,EAAE;YACzB,aAAa,EAAE,KAAK;YACpB,UAAU,EAAE,QAAQ;YACpB,GAAG,EAAE,CAAC;SACP;QACD,cAAc,EAAE;YACd,aAAa,EAAE,KAAK;YACpB,UAAU,EAAE,QAAQ;YACpB,GAAG,EAAE,CAAC;SACP;QACD,SAAS,EAAE;YACT,KAAK,EAAE,MAAM,CAAC,eAAe;SAC9B;QACD,SAAS,EAAE;YACT,KAAK,EAAE,MAAM,CAAC,eAAe;SAC9B;QACD,oBAAoB,EAAE;YACpB,KAAK,EAAE,MAAM,CAAC,yBAAyB;YACvC,SAAS,EAAE,QAAQ;SACpB;KACF,CAAC,CAAA;AACJ,CAAC,CAAA","sourcesContent":["import { useNavigation } from '@react-navigation/native'\nimport React, { useEffect } from 'react'\nimport {\n AccessibilityActionEvent,\n Pressable,\n StyleSheet,\n useWindowDimensions,\n View,\n} from 'react-native'\nimport { MessageReaction } from '../../components/conversation/message_reaction'\nimport { Avatar, Icon, Spinner, Text, TextButton, TextInlineButton } from '../../components/display'\nimport {\n useAnimatedMessageBackgroundColor,\n useInteractionGhostBackgroundColor,\n useTheme,\n} from '../../hooks'\nimport { MessageResource } from '../../types'\nimport { ReactionCountResource } from '../../types/resources/reaction'\nimport { MessageAttachments } from './message_attachments'\nimport ErrorBoundary from '../page/error_boundary'\nimport { MessageMarkdown } from './message_markdown'\nimport { DenormalizedMessageAttachmentResource } from '../../types/resources/denormalized_attachment_resource'\nimport {\n CONVERSATION_MESSAGE_LIST_PADDING_HORIZONTAL,\n MESSAGE_AUTHOR_AVATAR_COLUMN_WIDTH,\n platformFontWeightMedium,\n} from '../../utils/styles'\nimport Animated from 'react-native-reanimated'\nimport { useLiveRelativeTime } from '../../hooks/use_live_relative_time'\nimport { MessageReadReceipts } from './message_read_receipts'\nimport { useMessageCreateOrUpdate } from '../../hooks/use_message_create_or_update'\nimport { Haptic } from '../../utils/native_adapters'\nimport { TheirReplyConnector, MyReplyConnector, AVATAR_CONNECTOR_SPACING } from './reply_connectors'\nimport { pluralize } from '../../utils'\nimport { useConversationMessage } from '../../hooks/use_conversation_message'\nimport { some } from 'lodash'\nimport { isNewMessage } from '../../utils/cache/messages_cache'\n\n/** Message\n * Component for display of a message within a conversation list\n */\ninterface MessageProps extends MessageResource {\n canDeleteNonAuthoredMessages: boolean\n conversation_id: number\n latestReadMessageSortKey?: string\n inReplyScreen?: boolean\n repliesEnabled?: boolean\n}\n\nexport function Message({\n canDeleteNonAuthoredMessages,\n conversation_id,\n latestReadMessageSortKey,\n inReplyScreen,\n repliesEnabled,\n ...message\n}: MessageProps) {\n const { text, reactionCounts, pending, error, attachments, author } = message\n const styles = useMessageStyles(message)\n const navigation = useNavigation()\n const { colors } = useTheme()\n const hasReactions = reactionCounts.length > 0\n const [showMessageMetaToggle, setShowMessageMetaToggle] = React.useState(false)\n const showMessageMeta =\n showMessageMetaToggle || message.myLatestInConversation || !!pending || !!error || false\n const timestamp = useLiveRelativeTime(message.createdAt)\n const wasEdited = Boolean(message.textEditedAt)\n const isPersisted = !isNewMessage(message)\n const [temporarilyHidePendingState, setTemporarilyHidePendingState] = React.useState(true)\n const [messageBubbleHeight, setMessageBubbleHeight] = React.useState(0)\n const { animatedBackgroundColor, handleMessagePressIn, handleMessagePressOut } =\n useAnimatedMessageBackgroundColor()\n const { message: replyRootMessage } = useConversationMessage({\n conversation_id,\n messageId: message.replyRootId || '',\n enabled: !!message.replyRootId,\n })\n\n const metaProps = {\n authorName: author.name,\n createdAt: message.createdAt,\n }\n\n const renderAuthor = (!message.mine && message.renderAuthor) || false\n const showReplyCountButton =\n !inReplyScreen && message.replyRootId === message.id && repliesEnabled\n const isReplyRootMessage = message.replyRootId === message.id\n const isDeletedReplyRootMessage = isReplyRootMessage && !!message.deletedAt\n const replyToReplyRootMessage = repliesEnabled && !isReplyRootMessage && !!message.replyRootId\n\n const replyCountText = pluralize(message.replyCount, 'reply')\n const messagePendingLabel = isPersisted ? 'Saving' : 'Sending'\n const replyRootAuthorName = message.replyRootId ? replyRootMessage?.author.name : author.name\n const messageText = isDeletedReplyRootMessage ? 'Message deleted' : text\n\n const messageBottomMargin =\n message.lastInGroup || message.nextIsReplyShadowMessage\n ? 16\n : hasReactions || showMessageMeta || showReplyCountButton\n ? 8\n : 4\n\n const messageIsReplyLabel = replyToReplyRootMessage ? 'Reply' : ''\n const attachmentLabel = some(attachments) ? pluralize(attachments.length, 'attachment') : ''\n const replyCountLabel = isReplyRootMessage ? replyCountText : ''\n const accessibilityLabel = `${author?.name || ''} ${messageIsReplyLabel} ${attachmentLabel} ${messageText || ''} ${timestamp} ${replyCountLabel}`\n\n useEffect(() => {\n if (pending) {\n const timer = setTimeout(() => {\n setTemporarilyHidePendingState(false)\n }, 2000)\n return () => clearTimeout(timer)\n }\n return () => {}\n }, [pending])\n\n const retryFailedSaveMutation = useMessageCreateOrUpdate({\n conversationId: conversation_id,\n message,\n })\n\n const handleRetry = () => {\n if (text && error) {\n retryFailedSaveMutation.mutateAsync({\n text,\n attachments: message.attachmentsForCreate,\n })\n }\n }\n\n const handleMessagePress = () => {\n setShowMessageMetaToggle(!showMessageMetaToggle)\n }\n\n const handleMessageLongPress = () => {\n if (!isPersisted) return\n\n Haptic.impactLight()\n navigation.navigate('MessageActions', {\n message_id: message.id,\n conversation_id,\n canDeleteNonAuthoredMessages,\n inReplyScreen,\n reply_root_author_name: replyRootAuthorName,\n })\n }\n\n const handleReactionLongPress = (reaction: ReactionCountResource) => {\n Haptic.impactLight()\n navigation.navigate('Reactions', {\n message_id: message.id,\n conversation_id,\n reaction_value: reaction.value,\n })\n }\n\n const handleMessageAttachmentLongPress = (attachment: DenormalizedMessageAttachmentResource) => {\n Haptic.impactLight()\n navigation.navigate('AttachmentActions', {\n attachmentId: attachment?.id,\n attachmentContentType: attachment?.attributes.contentType,\n attachmentUrl: attachment?.attributes.url,\n conversation_id,\n canDeleteNonAuthoredMessages,\n myMessage: message.mine,\n })\n }\n\n const handleNavigateToReplyPress = () => {\n navigation.navigate('ConversationReply', {\n conversation_id,\n reply_root_id: message.id,\n reply_root_author_name: author.name,\n })\n }\n\n const accessibilityActions = [\n {\n name: 'navigateToReplies',\n label: 'Navigate to replies',\n },\n ]\n\n const handleAccessibilityAction = (event: AccessibilityActionEvent) => {\n if (event.nativeEvent.actionName === 'navigateToReplies') {\n handleNavigateToReplyPress()\n }\n }\n\n return (\n <Pressable\n onLongPress={handleMessageLongPress}\n onPress={handleMessagePress}\n onPressIn={handleMessagePressIn}\n onPressOut={handleMessagePressOut}\n android_ripple={{ color: colors.androidRippleNeutral, borderless: false, foreground: true }}\n accessibilityRole=\"button\"\n accessibilityLabel={accessibilityLabel}\n accessibilityHint=\"Long press to view message actions like reacting and copying.\"\n accessibilityActions={isReplyRootMessage ? accessibilityActions : undefined}\n onAccessibilityAction={isReplyRootMessage ? handleAccessibilityAction : undefined}\n disabled={isDeletedReplyRootMessage}\n >\n <Animated.View style={[styles.message, animatedBackgroundColor]}>\n {!message.mine && (\n <View>\n {renderAuthor ? (\n <Avatar\n size={'md'}\n sourceUri={author.avatar}\n style={styles.avatar}\n maxFontSizeMultiplier={1}\n minFontSizeMultiplier={1}\n fallbackIconName={isDeletedReplyRootMessage ? 'publishing.trash' : 'general.person'}\n showFallback={isDeletedReplyRootMessage}\n />\n ) : (\n <View style={styles.avatarPlaceholder} />\n )}\n {repliesEnabled && (\n <TheirReplyConnector message={message} messageBubbleHeight={messageBubbleHeight} />\n )}\n </View>\n )}\n <View style={[styles.messageContent, { marginBottom: messageBottomMargin }]}>\n {renderAuthor && !isDeletedReplyRootMessage && (\n <Text variant=\"footnote\" style={styles.authorName}>\n {author.name}\n </Text>\n )}\n <View\n style={styles.messageBubble}\n onLayout={e => setMessageBubbleHeight(e.nativeEvent.layout.height)}\n >\n {isDeletedReplyRootMessage ? (\n <View style={styles.messageText}>\n <Text style={styles.replyRootDeletedText}>{messageText}</Text>\n </View>\n ) : (\n <>\n <ErrorBoundary>\n <MessageAttachments\n attachments={attachments}\n metaProps={metaProps}\n onMessageAttachmentLongPress={handleMessageAttachmentLongPress}\n onMessageLongPress={handleMessageLongPress}\n />\n </ErrorBoundary>\n {text && (\n <View style={styles.messageText}>\n <MessageMarkdown text={text} />\n </View>\n )}\n </>\n )}\n </View>\n {showReplyCountButton && (\n <TextButton\n variant=\"footnote\"\n onPress={handleNavigateToReplyPress}\n style={styles.messageReplyCount}\n accessibilityHint=\"Navigates to reply screen for this message\"\n accessibilityRole=\"link\"\n >\n {replyCountText}\n </TextButton>\n )}\n {hasReactions && !isDeletedReplyRootMessage && (\n <View style={styles.messageReactions}>\n {reactionCounts.map(reaction => (\n <MessageReaction\n key={reaction.value}\n reaction={reaction}\n onLongPress={handleReactionLongPress}\n message={message}\n conversationId={conversation_id}\n />\n ))}\n </View>\n )}\n {showMessageMeta && !isDeletedReplyRootMessage && (\n <View style={styles.messageMeta}>\n {message.mine && !pending && !error && (\n <MessageReadReceipts\n message={message}\n latestReadMessageSortKey={latestReadMessageSortKey}\n />\n )}\n {error ? (\n <View style={styles.errorContainer}>\n {retryFailedSaveMutation.isPending ? (\n <Spinner size={12} />\n ) : (\n <Icon name=\"general.exclamationTriangle\" size={12} style={styles.errorIcon} />\n )}\n <Text variant=\"footnote\" style={styles.errorText}>\n Failed to {isPersisted ? 'edit' : 'send'} |{' '}\n <TextInlineButton\n onPress={handleRetry}\n variant=\"footnote\"\n appearance=\"danger\"\n disabled={retryFailedSaveMutation.isPending}\n >\n Try again\n </TextInlineButton>\n </Text>\n </View>\n ) : pending && (!temporarilyHidePendingState || isPersisted) ? (\n <View style={styles.pendingIndicatorContainer}>\n <Icon\n name=\"general.outlinedClock\"\n size={12}\n color={colors.iconColorDefaultSecondary}\n />\n <Text variant=\"footnote\">{messagePendingLabel}</Text>\n </View>\n ) : isPersisted ? (\n <Text variant=\"footnote\">{timestamp}</Text>\n ) : null}\n {!pending && !error && wasEdited && (\n <Text variant=\"footnote\">\n |{' '}\n <Text variant=\"footnote\" style={styles.editedText}>\n Edited\n </Text>\n </Text>\n )}\n </View>\n )}\n </View>\n {repliesEnabled && message.mine && (\n <MyReplyConnector message={message} messageBubbleHeight={messageBubbleHeight} />\n )}\n </Animated.View>\n </Pressable>\n )\n}\n\nconst useMessageStyles = ({ mine }: MessageResource) => {\n const { colors } = useTheme()\n const myMessageBackgroundColor = useInteractionGhostBackgroundColor()\n const { width } = useWindowDimensions()\n const tabletWidth = width >= 744 // Smallest iPad Mini's width\n\n const messageBubbleBackgroundColor = mine ? myMessageBackgroundColor : colors.fillColorNeutral070\n\n return StyleSheet.create({\n message: {\n gap: 8,\n flexDirection: mine ? 'row-reverse' : 'row',\n paddingHorizontal: CONVERSATION_MESSAGE_LIST_PADDING_HORIZONTAL,\n },\n messageContent: {\n flex: 1,\n gap: 4,\n },\n avatar: {\n marginBottom: AVATAR_CONNECTOR_SPACING,\n },\n avatarPlaceholder: {\n width: MESSAGE_AUTHOR_AVATAR_COLUMN_WIDTH, // Same width as avatar\n },\n authorName: {\n fontWeight: platformFontWeightMedium,\n },\n messageBubble: {\n backgroundColor: messageBubbleBackgroundColor,\n borderRadius: 8,\n maxWidth: tabletWidth ? 360 : '80%',\n alignSelf: mine ? 'flex-end' : 'flex-start',\n },\n messageText: {\n paddingVertical: 6,\n paddingHorizontal: 8,\n },\n messageReactions: {\n flexDirection: 'row',\n gap: 4,\n justifyContent: mine ? 'flex-end' : 'flex-start',\n },\n messageReplyCount: {\n alignSelf: mine ? 'flex-end' : 'flex-start',\n },\n messageMeta: {\n flexDirection: 'row',\n alignItems: 'center',\n justifyContent: mine ? 'flex-end' : 'flex-start',\n gap: 4,\n },\n editedText: {\n fontWeight: platformFontWeightMedium,\n },\n pendingIndicatorContainer: {\n flexDirection: 'row',\n alignItems: 'center',\n gap: 4,\n },\n errorContainer: {\n flexDirection: 'row',\n alignItems: 'center',\n gap: 4,\n },\n errorIcon: {\n color: colors.statusErrorIcon,\n },\n errorText: {\n color: colors.statusErrorText,\n },\n replyRootDeletedText: {\n color: colors.textColorDefaultSecondary,\n fontStyle: 'italic',\n },\n })\n}\n"]}
1
+ {"version":3,"file":"message.js","sourceRoot":"","sources":["../../../src/components/conversation/message.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAA;AACxD,OAAO,KAAK,EAAE,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AACxC,OAAO,EAEL,SAAS,EACT,UAAU,EACV,mBAAmB,EACnB,IAAI,GACL,MAAM,cAAc,CAAA;AACrB,OAAO,EAAE,eAAe,EAAE,MAAM,gDAAgD,CAAA;AAChF,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,UAAU,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAA;AACpG,OAAO,EACL,iCAAiC,EACjC,kCAAkC,EAClC,QAAQ,GACT,MAAM,aAAa,CAAA;AAGpB,OAAO,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAA;AAC1D,OAAO,aAAa,MAAM,wBAAwB,CAAA;AAClD,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAA;AAEpD,OAAO,EACL,4CAA4C,EAC5C,kCAAkC,EAClC,wBAAwB,GACzB,MAAM,oBAAoB,CAAA;AAC3B,OAAO,QAAQ,MAAM,yBAAyB,CAAA;AAC9C,OAAO,EAAE,mBAAmB,EAAE,MAAM,oCAAoC,CAAA;AACxE,OAAO,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAA;AAC7D,OAAO,EAAE,wBAAwB,EAAE,MAAM,0CAA0C,CAAA;AACnF,OAAO,EAAE,MAAM,EAAE,MAAM,6BAA6B,CAAA;AACpD,OAAO,EAAE,mBAAmB,EAAE,gBAAgB,EAAE,wBAAwB,EAAE,MAAM,oBAAoB,CAAA;AACpG,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAA;AACvC,OAAO,EAAE,sBAAsB,EAAE,MAAM,sCAAsC,CAA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\nimport React, { useEffect } from 'react'\nimport {\n AccessibilityActionEvent,\n Pressable,\n StyleSheet,\n useWindowDimensions,\n View,\n} from 'react-native'\nimport { MessageReaction } from '../../components/conversation/message_reaction'\nimport { Avatar, Icon, Spinner, Text, TextButton, TextInlineButton } from '../../components/display'\nimport {\n useAnimatedMessageBackgroundColor,\n useInteractionGhostBackgroundColor,\n useTheme,\n} from '../../hooks'\nimport { MessageResource } from '../../types'\nimport { ReactionCountResource } from '../../types/resources/reaction'\nimport { MessageAttachments } from './message_attachments'\nimport ErrorBoundary from '../page/error_boundary'\nimport { MessageMarkdown } from './message_markdown'\nimport { DenormalizedMessageAttachmentResource } from '../../types/resources/denormalized_attachment_resource'\nimport {\n CONVERSATION_MESSAGE_LIST_PADDING_HORIZONTAL,\n MESSAGE_AUTHOR_AVATAR_COLUMN_WIDTH,\n platformFontWeightMedium,\n} from '../../utils/styles'\nimport Animated from 'react-native-reanimated'\nimport { useLiveRelativeTime } from '../../hooks/use_live_relative_time'\nimport { MessageReadReceipts } from './message_read_receipts'\nimport { useMessageCreateOrUpdate } from '../../hooks/use_message_create_or_update'\nimport { Haptic } from '../../utils/native_adapters'\nimport { TheirReplyConnector, MyReplyConnector, AVATAR_CONNECTOR_SPACING } from './reply_connectors'\nimport { pluralize } from '../../utils'\nimport { useConversationMessage } from '../../hooks/use_conversation_message'\nimport { some } from 'lodash'\nimport { isNewMessage } from '../../utils/cache/messages_cache'\nimport { useDeletingIds } from '../../hooks'\n\n/** Message\n * Component for display of a message within a conversation list\n */\ninterface MessageProps extends MessageResource {\n canDeleteNonAuthoredMessages: boolean\n conversation_id: number\n latestReadMessageSortKey?: string\n inReplyScreen?: boolean\n repliesEnabled?: boolean\n}\n\nexport function Message({\n canDeleteNonAuthoredMessages,\n conversation_id,\n latestReadMessageSortKey,\n inReplyScreen,\n repliesEnabled,\n ...message\n}: MessageProps) {\n const { text, reactionCounts, pending, error, attachments, author } = message\n const deletingMessageIds = useDeletingIds('deleteMessage')\n const isDeleting = deletingMessageIds.has(message.id)\n const styles = useMessageStyles(message.mine, isDeleting)\n const navigation = useNavigation()\n const { colors } = useTheme()\n const hasReactions = reactionCounts.length > 0\n const [showMessageMetaToggle, setShowMessageMetaToggle] = React.useState(false)\n const showMessageMeta =\n showMessageMetaToggle || message.myLatestInConversation || !!pending || !!error || false\n const timestamp = useLiveRelativeTime(message.createdAt)\n const wasEdited = Boolean(message.textEditedAt)\n const isPersisted = !isNewMessage(message)\n const [temporarilyHidePendingState, setTemporarilyHidePendingState] = React.useState(true)\n const [messageBubbleHeight, setMessageBubbleHeight] = React.useState(0)\n const { animatedBackgroundColor, handleMessagePressIn, handleMessagePressOut } =\n useAnimatedMessageBackgroundColor()\n const { message: replyRootMessage } = useConversationMessage({\n conversation_id,\n messageId: message.replyRootId || '',\n enabled: !!message.replyRootId,\n })\n\n const metaProps = {\n authorName: author.name,\n createdAt: message.createdAt,\n }\n\n const renderAuthor = (!message.mine && message.renderAuthor) || false\n const showReplyCountButton =\n !inReplyScreen && message.replyRootId === message.id && repliesEnabled\n const isReplyRootMessage = message.replyRootId === message.id\n const isDeletedReplyRootMessage = isReplyRootMessage && !!message.deletedAt\n const replyToReplyRootMessage = repliesEnabled && !isReplyRootMessage && !!message.replyRootId\n\n const replyCountText = pluralize(message.replyCount, 'reply')\n const messagePendingLabel = isPersisted ? 'Saving' : 'Sending'\n const replyRootAuthorName = message.replyRootId ? replyRootMessage?.author.name : author.name\n const messageText = isDeletedReplyRootMessage ? 'Message deleted' : text\n\n const messageBottomMargin =\n message.lastInGroup || message.nextIsReplyShadowMessage\n ? 16\n : hasReactions || showMessageMeta || showReplyCountButton\n ? 8\n : 4\n\n const messageIsReplyLabel = replyToReplyRootMessage ? 'Reply' : ''\n const attachmentLabel = some(attachments) ? pluralize(attachments.length, 'attachment') : ''\n const replyCountLabel = isReplyRootMessage ? replyCountText : ''\n const accessibilityLabel = `${author?.name || ''} ${messageIsReplyLabel} ${attachmentLabel} ${messageText || ''} ${timestamp} ${replyCountLabel}`\n\n useEffect(() => {\n if (pending) {\n const timer = setTimeout(() => {\n setTemporarilyHidePendingState(false)\n }, 2000)\n return () => clearTimeout(timer)\n }\n return () => {}\n }, [pending])\n\n const retryFailedSaveMutation = useMessageCreateOrUpdate({\n conversationId: conversation_id,\n message,\n })\n\n const handleRetry = () => {\n if (text && error) {\n retryFailedSaveMutation.mutateAsync({\n text,\n attachments: message.attachmentsForCreate,\n })\n }\n }\n\n const handleMessagePress = () => {\n setShowMessageMetaToggle(!showMessageMetaToggle)\n }\n\n const handleMessageLongPress = () => {\n if (!isPersisted) return\n\n Haptic.impactLight()\n navigation.navigate('MessageActions', {\n message_id: message.id,\n conversation_id,\n canDeleteNonAuthoredMessages,\n inReplyScreen,\n reply_root_author_name: replyRootAuthorName,\n })\n }\n\n const handleReactionLongPress = (reaction: ReactionCountResource) => {\n Haptic.impactLight()\n navigation.navigate('Reactions', {\n message_id: message.id,\n conversation_id,\n reaction_value: reaction.value,\n })\n }\n\n const handleMessageAttachmentLongPress = (attachment: DenormalizedMessageAttachmentResource) => {\n Haptic.impactLight()\n navigation.navigate('AttachmentActions', {\n attachmentId: attachment?.id,\n attachmentContentType: attachment?.attributes.contentType,\n attachmentUrl: attachment?.attributes.url,\n conversation_id,\n canDeleteNonAuthoredMessages,\n myMessage: message.mine,\n })\n }\n\n const handleNavigateToReplyPress = () => {\n navigation.navigate('ConversationReply', {\n conversation_id,\n reply_root_id: message.id,\n reply_root_author_name: author.name,\n })\n }\n\n const accessibilityActions = [\n {\n name: 'navigateToReplies',\n label: 'Navigate to replies',\n },\n ]\n\n const handleAccessibilityAction = (event: AccessibilityActionEvent) => {\n if (event.nativeEvent.actionName === 'navigateToReplies') {\n handleNavigateToReplyPress()\n }\n }\n\n return (\n <Pressable\n onLongPress={isDeleting ? undefined : handleMessageLongPress}\n onPress={isDeleting ? undefined : handleMessagePress}\n onPressIn={isDeleting ? undefined : handleMessagePressIn}\n onPressOut={isDeleting ? undefined : handleMessagePressOut}\n android_ripple={{ color: colors.androidRippleNeutral, borderless: false, foreground: true }}\n accessibilityRole=\"button\"\n accessibilityLabel={accessibilityLabel}\n accessibilityHint=\"Long press to view message actions like reacting and copying.\"\n accessibilityActions={isReplyRootMessage ? accessibilityActions : undefined}\n onAccessibilityAction={isReplyRootMessage ? handleAccessibilityAction : undefined}\n disabled={isDeletedReplyRootMessage || isDeleting}\n >\n <Animated.View style={[styles.message, animatedBackgroundColor]}>\n {!message.mine && (\n <View>\n {renderAuthor ? (\n <Avatar\n size={'md'}\n sourceUri={author.avatar}\n style={styles.avatar}\n maxFontSizeMultiplier={1}\n minFontSizeMultiplier={1}\n fallbackIconName={isDeletedReplyRootMessage ? 'publishing.trash' : 'general.person'}\n showFallback={isDeletedReplyRootMessage}\n />\n ) : (\n <View style={styles.avatarPlaceholder} />\n )}\n {repliesEnabled && (\n <TheirReplyConnector message={message} messageBubbleHeight={messageBubbleHeight} />\n )}\n </View>\n )}\n <View style={[styles.messageContent, { marginBottom: messageBottomMargin }]}>\n {renderAuthor && !isDeletedReplyRootMessage && (\n <Text variant=\"footnote\" style={styles.authorName}>\n {author.name}\n </Text>\n )}\n <View\n style={styles.messageBubble}\n onLayout={e => setMessageBubbleHeight(e.nativeEvent.layout.height)}\n >\n {isDeletedReplyRootMessage ? (\n <View style={styles.messageText}>\n <Text style={styles.replyRootDeletedText}>{messageText}</Text>\n </View>\n ) : (\n <>\n <ErrorBoundary>\n <MessageAttachments\n attachments={attachments}\n metaProps={metaProps}\n onMessageAttachmentLongPress={handleMessageAttachmentLongPress}\n onMessageLongPress={handleMessageLongPress}\n />\n </ErrorBoundary>\n {text && (\n <View style={styles.messageText}>\n <MessageMarkdown text={text} />\n </View>\n )}\n </>\n )}\n </View>\n {showReplyCountButton && (\n <TextButton\n variant=\"footnote\"\n onPress={handleNavigateToReplyPress}\n style={styles.messageReplyCount}\n accessibilityHint=\"Navigates to reply screen for this message\"\n accessibilityRole=\"link\"\n >\n {replyCountText}\n </TextButton>\n )}\n {hasReactions && !isDeletedReplyRootMessage && (\n <View style={styles.messageReactions}>\n {reactionCounts.map(reaction => (\n <MessageReaction\n key={reaction.value}\n reaction={reaction}\n onLongPress={handleReactionLongPress}\n message={message}\n conversationId={conversation_id}\n />\n ))}\n </View>\n )}\n {showMessageMeta && !isDeletedReplyRootMessage && (\n <View style={styles.messageMeta}>\n {message.mine && !pending && !error && (\n <MessageReadReceipts\n message={message}\n latestReadMessageSortKey={latestReadMessageSortKey}\n />\n )}\n {error ? (\n <View style={styles.errorContainer}>\n {retryFailedSaveMutation.isPending ? (\n <Spinner size={12} />\n ) : (\n <Icon name=\"general.exclamationTriangle\" size={12} style={styles.errorIcon} />\n )}\n <Text variant=\"footnote\" style={styles.errorText}>\n Failed to {isPersisted ? 'edit' : 'send'} |{' '}\n <TextInlineButton\n onPress={handleRetry}\n variant=\"footnote\"\n appearance=\"danger\"\n disabled={retryFailedSaveMutation.isPending}\n >\n Try again\n </TextInlineButton>\n </Text>\n </View>\n ) : pending && (!temporarilyHidePendingState || isPersisted) ? (\n <View style={styles.pendingIndicatorContainer}>\n <Icon\n name=\"general.outlinedClock\"\n size={12}\n color={colors.iconColorDefaultSecondary}\n />\n <Text variant=\"footnote\">{messagePendingLabel}</Text>\n </View>\n ) : isPersisted ? (\n <Text variant=\"footnote\">{timestamp}</Text>\n ) : null}\n {!pending && !error && wasEdited && (\n <Text variant=\"footnote\">\n |{' '}\n <Text variant=\"footnote\" style={styles.editedText}>\n Edited\n </Text>\n </Text>\n )}\n </View>\n )}\n </View>\n {repliesEnabled && message.mine && (\n <MyReplyConnector message={message} messageBubbleHeight={messageBubbleHeight} />\n )}\n </Animated.View>\n </Pressable>\n )\n}\n\nconst useMessageStyles = (mine: boolean, isDeleting: boolean) => {\n const { colors } = useTheme()\n const myMessageBackgroundColor = useInteractionGhostBackgroundColor()\n const { width } = useWindowDimensions()\n const tabletWidth = width >= 744 // Smallest iPad Mini's width\n\n const messageBubbleBackgroundColor = mine ? myMessageBackgroundColor : colors.fillColorNeutral070\n\n return StyleSheet.create({\n message: {\n gap: 8,\n flexDirection: mine ? 'row-reverse' : 'row',\n paddingHorizontal: CONVERSATION_MESSAGE_LIST_PADDING_HORIZONTAL,\n opacity: isDeleting ? 0.5 : 1,\n },\n messageContent: {\n flex: 1,\n gap: 4,\n },\n avatar: {\n marginBottom: AVATAR_CONNECTOR_SPACING,\n },\n avatarPlaceholder: {\n width: MESSAGE_AUTHOR_AVATAR_COLUMN_WIDTH, // Same width as avatar\n },\n authorName: {\n fontWeight: platformFontWeightMedium,\n },\n messageBubble: {\n backgroundColor: messageBubbleBackgroundColor,\n borderRadius: 8,\n maxWidth: tabletWidth ? 360 : '80%',\n alignSelf: mine ? 'flex-end' : 'flex-start',\n },\n messageText: {\n paddingVertical: 6,\n paddingHorizontal: 8,\n },\n messageReactions: {\n flexDirection: 'row',\n gap: 4,\n justifyContent: mine ? 'flex-end' : 'flex-start',\n },\n messageReplyCount: {\n alignSelf: mine ? 'flex-end' : 'flex-start',\n },\n messageMeta: {\n flexDirection: 'row',\n alignItems: 'center',\n justifyContent: mine ? 'flex-end' : 'flex-start',\n gap: 4,\n },\n editedText: {\n fontWeight: platformFontWeightMedium,\n },\n pendingIndicatorContainer: {\n flexDirection: 'row',\n alignItems: 'center',\n gap: 4,\n },\n errorContainer: {\n flexDirection: 'row',\n alignItems: 'center',\n gap: 4,\n },\n errorIcon: {\n color: colors.statusErrorIcon,\n },\n errorText: {\n color: colors.statusErrorText,\n },\n replyRootDeletedText: {\n color: colors.textColorDefaultSecondary,\n fontStyle: 'italic',\n },\n })\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"message_attachments.d.ts","sourceRoot":"","sources":["../../../src/components/conversation/message_attachments.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AAEzB,OAAO,EACL,8BAA8B,EAC9B,qCAAqC,EACtC,MAAM,wDAAwD,CAAA;AAM/D,OAAO,EAAmB,KAAK,SAAS,EAAE,MAAM,gCAAgC,CAAA;AAEhF,wBAAgB,kBAAkB,CAAC,KAAK,EAAE;IACxC,WAAW,EAAE,8BAA8B,EAAE,CAAA;IAC7C,SAAS,EAAE,SAAS,CAAA;IACpB,4BAA4B,EAAE,CAAC,UAAU,EAAE,qCAAqC,KAAK,IAAI,CAAA;IACzF,kBAAkB,EAAE,MAAM,IAAI,CAAA;CAC/B,4BA2DA"}
1
+ {"version":3,"file":"message_attachments.d.ts","sourceRoot":"","sources":["../../../src/components/conversation/message_attachments.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AAEzB,OAAO,EACL,8BAA8B,EAC9B,qCAAqC,EACtC,MAAM,wDAAwD,CAAA;AAM/D,OAAO,EAAmB,KAAK,SAAS,EAAE,MAAM,gCAAgC,CAAA;AAGhF,wBAAgB,kBAAkB,CAAC,KAAK,EAAE;IACxC,WAAW,EAAE,8BAA8B,EAAE,CAAA;IAC7C,SAAS,EAAE,SAAS,CAAA;IACpB,4BAA4B,EAAE,CAAC,UAAU,EAAE,qCAAqC,KAAK,IAAI,CAAA;IACzF,kBAAkB,EAAE,MAAM,IAAI,CAAA;CAC/B,4BA8DA"}
@@ -6,9 +6,11 @@ import { GiphyAttachment } from './attachments/giphy_attachment';
6
6
  import { GenericFileAttachment } from './attachments/generic_file_attachment';
7
7
  import { ExpandedLink } from './attachments/expanded_link';
8
8
  import { ImageAttachment } from './attachments/image_attachment';
9
+ import { useDeletingIds } from '../../hooks';
9
10
  export function MessageAttachments(props) {
10
11
  const styles = useStyles();
11
12
  const { attachments, metaProps, onMessageAttachmentLongPress, onMessageLongPress } = props;
13
+ const deletingAttachmentIds = useDeletingIds('deleteAttachment');
12
14
  if (!attachments || attachments.length === 0)
13
15
  return null;
14
16
  const imageAttachments = attachments.filter(attachment => attachment.type === 'MessageAttachment' &&
@@ -16,12 +18,12 @@ export function MessageAttachments(props) {
16
18
  const showImageAttachmentGroup = imageAttachments.length > 0;
17
19
  return (<View style={styles.attachmentsContainer}>
18
20
  {showImageAttachmentGroup &&
19
- imageAttachments.map((image, index) => (<ImageAttachment key={`${image.id}-${index}`} attachment={image} imageAttachments={imageAttachments} currentImageIndex={index} metaProps={metaProps} onMessageAttachmentLongPress={onMessageAttachmentLongPress}/>))}
21
+ imageAttachments.map((image, index) => (<ImageAttachment key={`${image.id}-${index}`} attachment={image} imageAttachments={imageAttachments} currentImageIndex={index} metaProps={metaProps} onMessageAttachmentLongPress={onMessageAttachmentLongPress} isDeleting={deletingAttachmentIds.has(image.id)}/>))}
20
22
 
21
23
  {attachments.map((attachment, index) => {
22
24
  switch (attachment.type) {
23
25
  case 'MessageAttachment':
24
- return (<MessageAttachment key={`${attachment.id}-${index}`} attachment={attachment} onMessageAttachmentLongPress={onMessageAttachmentLongPress}/>);
26
+ return (<MessageAttachment key={`${attachment.id}-${index}`} attachment={attachment} onMessageAttachmentLongPress={onMessageAttachmentLongPress} isDeleting={deletingAttachmentIds.has(attachment.id)}/>);
25
27
  case 'giphy':
26
28
  return (<GiphyAttachment key={`${attachment.id || attachment.titleLink}-${index}`} attachment={attachment} onMessageLongPress={onMessageLongPress}/>);
27
29
  case 'ExpandedLink':
@@ -32,17 +34,17 @@ export function MessageAttachments(props) {
32
34
  })}
33
35
  </View>);
34
36
  }
35
- function MessageAttachment({ attachment, onMessageAttachmentLongPress, }) {
37
+ function MessageAttachment({ attachment, onMessageAttachmentLongPress, isDeleting, }) {
36
38
  const { attributes } = attachment;
37
39
  const contentType = attributes?.contentType;
38
40
  const basicType = contentType ? contentType.split('/')[0] : '';
39
41
  switch (basicType) {
40
42
  case 'video':
41
- return (<VideoAttachment attachment={attachment} onMessageAttachmentLongPress={onMessageAttachmentLongPress}/>);
43
+ return (<VideoAttachment attachment={attachment} onMessageAttachmentLongPress={onMessageAttachmentLongPress} isDeleting={isDeleting}/>);
42
44
  case 'audio':
43
- return (<AudioAttachment attachment={attachment} onMessageAttachmentLongPress={onMessageAttachmentLongPress}/>);
45
+ return (<AudioAttachment attachment={attachment} onMessageAttachmentLongPress={onMessageAttachmentLongPress} isDeleting={isDeleting}/>);
44
46
  case 'application':
45
- return (<GenericFileAttachment attachment={attachment} onMessageAttachmentLongPress={onMessageAttachmentLongPress}/>);
47
+ return (<GenericFileAttachment attachment={attachment} onMessageAttachmentLongPress={onMessageAttachmentLongPress} isDeleting={isDeleting}/>);
46
48
  default:
47
49
  return null;
48
50
  }
@@ -1 +1 @@
1
- {"version":3,"file":"message_attachments.js","sourceRoot":"","sources":["../../../src/components/conversation/message_attachments.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AACzB,OAAO,EAAE,IAAI,EAAE,UAAU,EAAE,MAAM,cAAc,CAAA;AAK/C,OAAO,EAAE,eAAe,EAAE,MAAM,gCAAgC,CAAA;AAChE,OAAO,EAAE,eAAe,EAAE,MAAM,gCAAgC,CAAA;AAChE,OAAO,EAAE,eAAe,EAAE,MAAM,gCAAgC,CAAA;AAChE,OAAO,EAAE,qBAAqB,EAAE,MAAM,uCAAuC,CAAA;AAC7E,OAAO,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAA;AAC1D,OAAO,EAAE,eAAe,EAAkB,MAAM,gCAAgC,CAAA;AAEhF,MAAM,UAAU,kBAAkB,CAAC,KAKlC;IACC,MAAM,MAAM,GAAG,SAAS,EAAE,CAAA;IAC1B,MAAM,EAAE,WAAW,EAAE,SAAS,EAAE,4BAA4B,EAAE,kBAAkB,EAAE,GAAG,KAAK,CAAA;IAC1F,IAAI,CAAC,WAAW,IAAI,WAAW,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,IAAI,CAAA;IAEzD,MAAM,gBAAgB,GAAG,WAAW,CAAC,MAAM,CACzC,UAAU,CAAC,EAAE,CACX,UAAU,CAAC,IAAI,KAAK,mBAAmB;QACvC,UAAU,CAAC,UAAU,EAAE,WAAW,EAAE,UAAU,CAAC,QAAQ,CAAC,CAChB,CAAA;IAE5C,MAAM,w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C,CACjC,UAAU,CAAC,CAAC,UAAU,CAAC,CACvB,kBAAkB,CAAC,CAAC,kBAAkB,CAAC,EACvC,CACH,CAAA;gBACH;oBACE,OAAO,IAAI,CAAA;YACf,CAAC;QACH,CAAC,CAAC,CACJ;IAAA,EAAE,IAAI,CAAC,CACR,CAAA;AACH,CAAC;AAED,SAAS,iBAAiB,CAAC,EACzB,UAAU,EACV,4BAA4B,GAI7B;IACC,MAAM,EAAE,UAAU,EAAE,GAAG,UAAU,CAAA;IACjC,MAAM,WAAW,GAAG,UAAU,EAAE,WAAW,CAAA;IAC3C,MAAM,SAAS,GAAG,WAAW,CAAC,CAAC,CAAC,WAAW,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAA;IAE9D,QAAQ,SAAS,EAAE,CAAC;QAClB,KAAK,OAAO;YACV,OAAO,CACL,CAAC,eAAe,CACd,UAAU,CAAC,CAAC,UAAU,CAAC,CACvB,4BAA4B,CAAC,CAAC,4BAA4B,CAAC,EAC3D,CACH,CAAA;QACH,KAAK,OAAO;YACV,OAAO,CACL,CAAC,eAAe,CACd,UAAU,CAAC,CAAC,UAAU,CAAC,CACvB,4BAA4B,CAAC,CAAC,4BAA4B,CAAC,EAC3D,CACH,CAAA;QACH,KAAK,aAAa;YAChB,OAAO,CACL,CAAC,qBAAqB,CACpB,UAAU,CAAC,CAAC,UAAU,CAAC,CACvB,4BAA4B,CAAC,CAAC,4BAA4B,CAAC,EAC3D,CACH,CAAA;QACH;YACE,OAAO,IAAI,CAAA;IACf,CAAC;AACH,CAAC;AAED,MAAM,SAAS,GAAG,GAAG,EAAE;IACrB,OAAO,UAAU,CAAC,MAAM,CAAC;QACvB,oBAAoB,EAAE;YACpB,GAAG,EAAE,CAAC;YACN,OAAO,EAAE,CAAC;SACX;KACF,CAAC,CAAA;AACJ,CAAC,CAAA","sourcesContent":["import React from 'react'\nimport { View, StyleSheet } from 'react-native'\nimport {\n DenormalizedAttachmentResource,\n DenormalizedMessageAttachmentResource,\n} from '../../types/resources/denormalized_attachment_resource'\nimport { AudioAttachment } from './attachments/audio_attachment'\nimport { VideoAttachment } from './attachments/video_attachment'\nimport { GiphyAttachment } from './attachments/giphy_attachment'\nimport { GenericFileAttachment } from './attachments/generic_file_attachment'\nimport { ExpandedLink } from './attachments/expanded_link'\nimport { ImageAttachment, type MetaProps } from './attachments/image_attachment'\n\nexport function MessageAttachments(props: {\n attachments: DenormalizedAttachmentResource[]\n metaProps: MetaProps\n onMessageAttachmentLongPress: (attachment: DenormalizedMessageAttachmentResource) => void\n onMessageLongPress: () => void\n}) {\n const styles = useStyles()\n const { attachments, metaProps, onMessageAttachmentLongPress, onMessageLongPress } = props\n if (!attachments || attachments.length === 0) return null\n\n const imageAttachments = attachments.filter(\n attachment =>\n attachment.type === 'MessageAttachment' &&\n attachment.attributes?.contentType?.startsWith('image/')\n ) as DenormalizedMessageAttachmentResource[]\n\n const showImageAttachmentGroup = imageAttachments.length > 0\n\n return (\n <View style={styles.attachmentsContainer}>\n {showImageAttachmentGroup &&\n imageAttachments.map((image, index) => (\n <ImageAttachment\n key={`${image.id}-${index}`}\n attachment={image}\n imageAttachments={imageAttachments}\n currentImageIndex={index}\n metaProps={metaProps}\n onMessageAttachmentLongPress={onMessageAttachmentLongPress}\n />\n ))}\n\n {attachments.map((attachment, index) => {\n switch (attachment.type) {\n case 'MessageAttachment':\n return (\n <MessageAttachment\n key={`${attachment.id}-${index}`}\n attachment={attachment}\n onMessageAttachmentLongPress={onMessageAttachmentLongPress}\n />\n )\n case 'giphy':\n return (\n <GiphyAttachment\n key={`${attachment.id || attachment.titleLink}-${index}`}\n attachment={attachment}\n onMessageLongPress={onMessageLongPress}\n />\n )\n case 'ExpandedLink':\n return (\n <ExpandedLink\n key={`${attachment.id}-${index}`}\n attachment={attachment}\n onMessageLongPress={onMessageLongPress}\n />\n )\n default:\n return null\n }\n })}\n </View>\n )\n}\n\nfunction MessageAttachment({\n attachment,\n onMessageAttachmentLongPress,\n}: {\n attachment: DenormalizedMessageAttachmentResource\n onMessageAttachmentLongPress: (attachment: DenormalizedMessageAttachmentResource) => void\n}) {\n const { attributes } = attachment\n const contentType = attributes?.contentType\n const basicType = contentType ? contentType.split('/')[0] : ''\n\n switch (basicType) {\n case 'video':\n return (\n <VideoAttachment\n attachment={attachment}\n onMessageAttachmentLongPress={onMessageAttachmentLongPress}\n />\n )\n case 'audio':\n return (\n <AudioAttachment\n attachment={attachment}\n onMessageAttachmentLongPress={onMessageAttachmentLongPress}\n />\n )\n case 'application':\n return (\n <GenericFileAttachment\n attachment={attachment}\n onMessageAttachmentLongPress={onMessageAttachmentLongPress}\n />\n )\n default:\n return null\n }\n}\n\nconst useStyles = () => {\n return StyleSheet.create({\n attachmentsContainer: {\n gap: 2,\n padding: 2,\n },\n })\n}\n"]}
1
+ {"version":3,"file":"message_attachments.js","sourceRoot":"","sources":["../../../src/components/conversation/message_attachments.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AACzB,OAAO,EAAE,IAAI,EAAE,UAAU,EAAE,MAAM,cAAc,CAAA;AAK/C,OAAO,EAAE,eAAe,EAAE,MAAM,gCAAgC,CAAA;AAChE,OAAO,EAAE,eAAe,EAAE,MAAM,gCAAgC,CAAA;AAChE,OAAO,EAAE,eAAe,EAAE,MAAM,gCAAgC,CAAA;AAChE,OAAO,EAAE,qBAAqB,EAAE,MAAM,uCAAuC,CAAA;AAC7E,OAAO,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAA;AAC1D,OAAO,EAAE,eAAe,EAAkB,MAAM,gCAAgC,CAAA;AAChF,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAA;AAE5C,MAAM,UAAU,kBAAkB,CAAC,KAKlC;IACC,MAAM,MAAM,GAAG,SAAS,EAAE,CAAA;IAC1B,MAAM,EAAE,WAAW,EAAE,SAAS,EAAE,4BAA4B,EAAE,kBAAkB,EAAE,GAAG,KAAK,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AK,OAAO;YACV,OAAO,CACL,CAAC,eAAe,CACd,UAAU,CAAC,CAAC,UAAU,CAAC,CACvB,4BAA4B,CAAC,CAAC,4BAA4B,CAAC,CAC3D,UAAU,CAAC,CAAC,UAAU,CAAC,EACvB,CACH,CAAA;QACH,KAAK,aAAa;YAChB,OAAO,CACL,CAAC,qBAAqB,CACpB,UAAU,CAAC,CAAC,UAAU,CAAC,CACvB,4BAA4B,CAAC,CAAC,4BAA4B,CAAC,CAC3D,UAAU,CAAC,CAAC,UAAU,CAAC,EACvB,CACH,CAAA;QACH;YACE,OAAO,IAAI,CAAA;IACf,CAAC;AACH,CAAC;AAED,MAAM,SAAS,GAAG,GAAG,EAAE;IACrB,OAAO,UAAU,CAAC,MAAM,CAAC;QACvB,oBAAoB,EAAE;YACpB,GAAG,EAAE,CAAC;YACN,OAAO,EAAE,CAAC;SACX;KACF,CAAC,CAAA;AACJ,CAAC,CAAA","sourcesContent":["import React from 'react'\nimport { View, StyleSheet } from 'react-native'\nimport {\n DenormalizedAttachmentResource,\n DenormalizedMessageAttachmentResource,\n} from '../../types/resources/denormalized_attachment_resource'\nimport { AudioAttachment } from './attachments/audio_attachment'\nimport { VideoAttachment } from './attachments/video_attachment'\nimport { GiphyAttachment } from './attachments/giphy_attachment'\nimport { GenericFileAttachment } from './attachments/generic_file_attachment'\nimport { ExpandedLink } from './attachments/expanded_link'\nimport { ImageAttachment, type MetaProps } from './attachments/image_attachment'\nimport { useDeletingIds } from '../../hooks'\n\nexport function MessageAttachments(props: {\n attachments: DenormalizedAttachmentResource[]\n metaProps: MetaProps\n onMessageAttachmentLongPress: (attachment: DenormalizedMessageAttachmentResource) => void\n onMessageLongPress: () => void\n}) {\n const styles = useStyles()\n const { attachments, metaProps, onMessageAttachmentLongPress, onMessageLongPress } = props\n const deletingAttachmentIds = useDeletingIds('deleteAttachment')\n if (!attachments || attachments.length === 0) return null\n\n const imageAttachments = attachments.filter(\n attachment =>\n attachment.type === 'MessageAttachment' &&\n attachment.attributes?.contentType?.startsWith('image/')\n ) as DenormalizedMessageAttachmentResource[]\n\n const showImageAttachmentGroup = imageAttachments.length > 0\n\n return (\n <View style={styles.attachmentsContainer}>\n {showImageAttachmentGroup &&\n imageAttachments.map((image, index) => (\n <ImageAttachment\n key={`${image.id}-${index}`}\n attachment={image}\n imageAttachments={imageAttachments}\n currentImageIndex={index}\n metaProps={metaProps}\n onMessageAttachmentLongPress={onMessageAttachmentLongPress}\n isDeleting={deletingAttachmentIds.has(image.id)}\n />\n ))}\n\n {attachments.map((attachment, index) => {\n switch (attachment.type) {\n case 'MessageAttachment':\n return (\n <MessageAttachment\n key={`${attachment.id}-${index}`}\n attachment={attachment}\n onMessageAttachmentLongPress={onMessageAttachmentLongPress}\n isDeleting={deletingAttachmentIds.has(attachment.id)}\n />\n )\n case 'giphy':\n return (\n <GiphyAttachment\n key={`${attachment.id || attachment.titleLink}-${index}`}\n attachment={attachment}\n onMessageLongPress={onMessageLongPress}\n />\n )\n case 'ExpandedLink':\n return (\n <ExpandedLink\n key={`${attachment.id}-${index}`}\n attachment={attachment}\n onMessageLongPress={onMessageLongPress}\n />\n )\n default:\n return null\n }\n })}\n </View>\n )\n}\n\nfunction MessageAttachment({\n attachment,\n onMessageAttachmentLongPress,\n isDeleting,\n}: {\n attachment: DenormalizedMessageAttachmentResource\n onMessageAttachmentLongPress: (attachment: DenormalizedMessageAttachmentResource) => void\n isDeleting: boolean\n}) {\n const { attributes } = attachment\n const contentType = attributes?.contentType\n const basicType = contentType ? contentType.split('/')[0] : ''\n\n switch (basicType) {\n case 'video':\n return (\n <VideoAttachment\n attachment={attachment}\n onMessageAttachmentLongPress={onMessageAttachmentLongPress}\n isDeleting={isDeleting}\n />\n )\n case 'audio':\n return (\n <AudioAttachment\n attachment={attachment}\n onMessageAttachmentLongPress={onMessageAttachmentLongPress}\n isDeleting={isDeleting}\n />\n )\n case 'application':\n return (\n <GenericFileAttachment\n attachment={attachment}\n onMessageAttachmentLongPress={onMessageAttachmentLongPress}\n isDeleting={isDeleting}\n />\n )\n default:\n return null\n }\n}\n\nconst useStyles = () => {\n return StyleSheet.create({\n attachmentsContainer: {\n gap: 2,\n padding: 2,\n },\n })\n}\n"]}
@@ -3,6 +3,7 @@ export * from './use_animated_message_background_color';
3
3
  export * from './use_theme';
4
4
  export * from './use_suspense_api';
5
5
  export * from './use_current_person';
6
+ export * from './use_deleting_ids';
6
7
  export * from './use_font_scale';
7
8
  export * from './use_create_android_ripple_color';
8
9
  export * from './use_chat_permissions';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/hooks/index.ts"],"names":[],"mappings":"AAAA,cAAc,qBAAqB,CAAA;AACnC,cAAc,yCAAyC,CAAA;AACvD,cAAc,aAAa,CAAA;AAC3B,cAAc,oBAAoB,CAAA;AAClC,cAAc,sBAAsB,CAAA;AACpC,cAAc,kBAAkB,CAAA;AAChC,cAAc,mCAAmC,CAAA;AACjD,cAAc,wBAAwB,CAAA;AACtC,cAAc,kBAAkB,CAAA;AAChC,cAAc,qBAAqB,CAAA;AACnC,cAAc,cAAc,CAAA;AAC5B,cAAc,WAAW,CAAA;AACzB,cAAc,kBAAkB,CAAA;AAChC,cAAc,+BAA+B,CAAA;AAC7C,cAAc,+BAA+B,CAAA;AAC7C,cAAc,gCAAgC,CAAA;AAC9C,cAAc,wBAAwB,CAAA;AACtC,cAAc,gCAAgC,CAAA;AAC9C,cAAc,wBAAwB,CAAA;AACtC,cAAc,oBAAoB,CAAA;AAClC,cAAc,yBAAyB,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/hooks/index.ts"],"names":[],"mappings":"AAAA,cAAc,qBAAqB,CAAA;AACnC,cAAc,yCAAyC,CAAA;AACvD,cAAc,aAAa,CAAA;AAC3B,cAAc,oBAAoB,CAAA;AAClC,cAAc,sBAAsB,CAAA;AACpC,cAAc,oBAAoB,CAAA;AAClC,cAAc,kBAAkB,CAAA;AAChC,cAAc,mCAAmC,CAAA;AACjD,cAAc,wBAAwB,CAAA;AACtC,cAAc,kBAAkB,CAAA;AAChC,cAAc,qBAAqB,CAAA;AACnC,cAAc,cAAc,CAAA;AAC5B,cAAc,WAAW,CAAA;AACzB,cAAc,kBAAkB,CAAA;AAChC,cAAc,+BAA+B,CAAA;AAC7C,cAAc,+BAA+B,CAAA;AAC7C,cAAc,gCAAgC,CAAA;AAC9C,cAAc,wBAAwB,CAAA;AACtC,cAAc,gCAAgC,CAAA;AAC9C,cAAc,wBAAwB,CAAA;AACtC,cAAc,oBAAoB,CAAA;AAClC,cAAc,yBAAyB,CAAA"}
@@ -3,6 +3,7 @@ export * from './use_animated_message_background_color';
3
3
  export * from './use_theme';
4
4
  export * from './use_suspense_api';
5
5
  export * from './use_current_person';
6
+ export * from './use_deleting_ids';
6
7
  export * from './use_font_scale';
7
8
  export * from './use_create_android_ripple_color';
8
9
  export * from './use_chat_permissions';
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/hooks/index.ts"],"names":[],"mappings":"AAAA,cAAc,qBAAqB,CAAA;AACnC,cAAc,yCAAyC,CAAA;AACvD,cAAc,aAAa,CAAA;AAC3B,cAAc,oBAAoB,CAAA;AAClC,cAAc,sBAAsB,CAAA;AACpC,cAAc,kBAAkB,CAAA;AAChC,cAAc,mCAAmC,CAAA;AACjD,cAAc,wBAAwB,CAAA;AACtC,cAAc,kBAAkB,CAAA;AAChC,cAAc,qBAAqB,CAAA;AACnC,cAAc,cAAc,CAAA;AAC5B,cAAc,WAAW,CAAA;AACzB,cAAc,kBAAkB,CAAA;AAChC,cAAc,+BAA+B,CAAA;AAC7C,cAAc,+BAA+B,CAAA;AAC7C,cAAc,gCAAgC,CAAA;AAC9C,cAAc,wBAAwB,CAAA;AACtC,cAAc,gCAAgC,CAAA;AAC9C,cAAc,wBAAwB,CAAA;AACtC,cAAc,oBAAoB,CAAA;AAClC,cAAc,yBAAyB,CAAA","sourcesContent":["export * from './use_async_storage'\nexport * from './use_animated_message_background_color'\nexport * from './use_theme'\nexport * from './use_suspense_api'\nexport * from './use_current_person'\nexport * from './use_font_scale'\nexport * from './use_create_android_ripple_color'\nexport * from './use_chat_permissions'\nexport * from './use_api_client'\nexport * from './use_groups_groups'\nexport * from './use_groups'\nexport * from './use_api'\nexport * from './use_api_client'\nexport * from './use_message_reaction_toggle'\nexport * from './use_interaction_ghost_color'\nexport * from './use_at_font_scale_breakpoint'\nexport * from './use_qualified_by_age'\nexport * from './use_scalable_number_of_lines'\nexport * from './use_submit_age_check'\nexport * from './use_organization'\nexport * from './use_product_analytics'\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/hooks/index.ts"],"names":[],"mappings":"AAAA,cAAc,qBAAqB,CAAA;AACnC,cAAc,yCAAyC,CAAA;AACvD,cAAc,aAAa,CAAA;AAC3B,cAAc,oBAAoB,CAAA;AAClC,cAAc,sBAAsB,CAAA;AACpC,cAAc,oBAAoB,CAAA;AAClC,cAAc,kBAAkB,CAAA;AAChC,cAAc,mCAAmC,CAAA;AACjD,cAAc,wBAAwB,CAAA;AACtC,cAAc,kBAAkB,CAAA;AAChC,cAAc,qBAAqB,CAAA;AACnC,cAAc,cAAc,CAAA;AAC5B,cAAc,WAAW,CAAA;AACzB,cAAc,kBAAkB,CAAA;AAChC,cAAc,+BAA+B,CAAA;AAC7C,cAAc,+BAA+B,CAAA;AAC7C,cAAc,gCAAgC,CAAA;AAC9C,cAAc,wBAAwB,CAAA;AACtC,cAAc,gCAAgC,CAAA;AAC9C,cAAc,wBAAwB,CAAA;AACtC,cAAc,oBAAoB,CAAA;AAClC,cAAc,yBAAyB,CAAA","sourcesContent":["export * from './use_async_storage'\nexport * from './use_animated_message_background_color'\nexport * from './use_theme'\nexport * from './use_suspense_api'\nexport * from './use_current_person'\nexport * from './use_deleting_ids'\nexport * from './use_font_scale'\nexport * from './use_create_android_ripple_color'\nexport * from './use_chat_permissions'\nexport * from './use_api_client'\nexport * from './use_groups_groups'\nexport * from './use_groups'\nexport * from './use_api'\nexport * from './use_api_client'\nexport * from './use_message_reaction_toggle'\nexport * from './use_interaction_ghost_color'\nexport * from './use_at_font_scale_breakpoint'\nexport * from './use_qualified_by_age'\nexport * from './use_scalable_number_of_lines'\nexport * from './use_submit_age_check'\nexport * from './use_organization'\nexport * from './use_product_analytics'\n"]}
@@ -0,0 +1,4 @@
1
+ type DeletableResourceEvent = 'deleteAttachment' | 'deleteMessage';
2
+ export declare function useDeletingIds(event: DeletableResourceEvent): Set<string>;
3
+ export {};
4
+ //# sourceMappingURL=use_deleting_ids.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use_deleting_ids.d.ts","sourceRoot":"","sources":["../../src/hooks/use_deleting_ids.ts"],"names":[],"mappings":"AAGA,KAAK,sBAAsB,GAAG,kBAAkB,GAAG,eAAe,CAAA;AAElE,wBAAgB,cAAc,CAAC,KAAK,EAAE,sBAAsB,GAAG,GAAG,CAAC,MAAM,CAAC,CAgBzE"}
@@ -0,0 +1,19 @@
1
+ import { useMutationState } from '@tanstack/react-query';
2
+ import { useMemo } from 'react';
3
+ export function useDeletingIds(event) {
4
+ const ids = useMutationState({
5
+ filters: {
6
+ mutationKey: [event],
7
+ status: 'pending',
8
+ },
9
+ select: mutation => {
10
+ // Extract the item ID from the mutation key: [ event, id ]
11
+ const key = mutation.options.mutationKey;
12
+ return key && Array.isArray(key) && typeof key[1] === 'string' ? key[1] : null;
13
+ },
14
+ });
15
+ return useMemo(() => {
16
+ return new Set(ids.filter(id => id !== null));
17
+ }, [ids]);
18
+ }
19
+ //# sourceMappingURL=use_deleting_ids.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use_deleting_ids.js","sourceRoot":"","sources":["../../src/hooks/use_deleting_ids.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAA;AACxD,OAAO,EAAE,OAAO,EAAE,MAAM,OAAO,CAAA;AAI/B,MAAM,UAAU,cAAc,CAAC,KAA6B;IAC1D,MAAM,GAAG,GAAG,gBAAgB,CAAC;QAC3B,OAAO,EAAE;YACP,WAAW,EAAE,CAAC,KAAK,CAAC;YACpB,MAAM,EAAE,SAAS;SAClB;QACD,MAAM,EAAE,QAAQ,CAAC,EAAE;YACjB,2DAA2D;YAC3D,MAAM,GAAG,GAAG,QAAQ,CAAC,OAAO,CAAC,WAAW,CAAA;YACxC,OAAO,GAAG,IAAI,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,OAAO,GAAG,CAAC,CAAC,CAAC,KAAK,QAAQ,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAA;QAChF,CAAC;KACF,CAAC,CAAA;IAEF,OAAO,OAAO,CAAC,GAAG,EAAE;QAClB,OAAO,IAAI,GAAG,CAAC,GAAG,CAAC,MAAM,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,KAAK,IAAI,CAAC,CAAC,CAAA;IAC/C,CAAC,EAAE,CAAC,GAAG,CAAC,CAAC,CAAA;AACX,CAAC","sourcesContent":["import { useMutationState } from '@tanstack/react-query'\nimport { useMemo } from 'react'\n\ntype DeletableResourceEvent = 'deleteAttachment' | 'deleteMessage'\n\nexport function useDeletingIds(event: DeletableResourceEvent): Set<string> {\n const ids = useMutationState({\n filters: {\n mutationKey: [event],\n status: 'pending',\n },\n select: mutation => {\n // Extract the item ID from the mutation key: [ event, id ]\n const key = mutation.options.mutationKey\n return key && Array.isArray(key) && typeof key[1] === 'string' ? key[1] : null\n },\n })\n\n return useMemo(() => {\n return new Set(ids.filter(id => id !== null))\n }, [ids])\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"attachment_actions_screen.d.ts","sourceRoot":"","sources":["../../../src/screens/attachment_actions/attachment_actions_screen.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAiB,MAAM,0BAA0B,CAAA;AAC3E,OAAO,KAAsB,MAAM,OAAO,CAAA;AAK1C,eAAO,MAAM,8BAA8B,uEAEzC,CAAA;AAEF,MAAM,MAAM,4BAA4B,GAAG,iBAAiB,CAAC;IAC3D,YAAY,EAAE,MAAM,CAAA;IACpB,qBAAqB,EAAE,MAAM,CAAA;IAC7B,aAAa,EAAE,MAAM,CAAA;IACrB,eAAe,EAAE,MAAM,CAAA;IACvB,4BAA4B,EAAE,OAAO,CAAA;IACrC,SAAS,EAAE,OAAO,CAAA;CACnB,CAAC,CAAA;AAEF,wBAAgB,uBAAuB,CAAC,EAAE,KAAK,EAAE,EAAE,4BAA4B,qBAyD9E"}
1
+ {"version":3,"file":"attachment_actions_screen.d.ts","sourceRoot":"","sources":["../../../src/screens/attachment_actions/attachment_actions_screen.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAiB,MAAM,0BAA0B,CAAA;AAC3E,OAAO,KAAsB,MAAM,OAAO,CAAA;AAK1C,eAAO,MAAM,8BAA8B,uEAEzC,CAAA;AAEF,MAAM,MAAM,4BAA4B,GAAG,iBAAiB,CAAC;IAC3D,YAAY,EAAE,MAAM,CAAA;IACpB,qBAAqB,EAAE,MAAM,CAAA;IAC7B,aAAa,EAAE,MAAM,CAAA;IACrB,eAAe,EAAE,MAAM,CAAA;IACvB,4BAA4B,EAAE,OAAO,CAAA;IACrC,SAAS,EAAE,OAAO,CAAA;CACnB,CAAC,CAAA;AAEF,wBAAgB,uBAAuB,CAAC,EAAE,KAAK,EAAE,EAAE,4BAA4B,qBAgE9E"}
@@ -20,9 +20,16 @@ export function AttachmentActionsScreen({ route }) {
20
20
  const handleDeleteConfirm = useCallback(() => {
21
21
  Alert.alert(`Delete ${attachmentName}`, 'Are you sure you want to permanently delete this attachment?', [
22
22
  { text: 'Cancel', style: 'cancel' },
23
- { text: 'Delete', style: 'destructive', onPress: () => handleDeleteAttachment() },
23
+ {
24
+ text: 'Delete',
25
+ style: 'destructive',
26
+ onPress: () => {
27
+ handleDeleteAttachment();
28
+ navigation.goBack();
29
+ },
30
+ },
24
31
  ]);
25
- }, [attachmentName, handleDeleteAttachment]);
32
+ }, [attachmentName, handleDeleteAttachment, navigation]);
26
33
  const handleOpenInBrowser = () => {
27
34
  Linking.openURL(attachmentUrl);
28
35
  navigation.goBack();
@@ -1 +1 @@
1
- {"version":3,"file":"attachment_actions_screen.js","sourceRoot":"","sources":["../../../src/screens/attachment_actions/attachment_actions_screen.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAqB,aAAa,EAAE,MAAM,0BAA0B,CAAA;AAC3E,OAAO,KAAK,EAAE,EAAE,WAAW,EAAE,MAAM,OAAO,CAAA;AAC1C,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAA;AACzD,OAAO,SAAS,EAAE,EAAE,yBAAyB,EAAE,MAAM,uCAAuC,CAAA;AAC5F,OAAO,EAAE,mBAAmB,EAAE,MAAM,6BAA6B,CAAA;AAEjE,MAAM,CAAC,MAAM,8BAA8B,GAAG,yBAAyB,CAAC;IACtE,WAAW,EAAE,oBAAoB;CAClC,CAAC,CAAA;AAWF,MAAM,UAAU,uBAAuB,CAAC,EAAE,KAAK,EAAgC;IAC7E,MAAM,UAAU,GAAG,aAAa,EAAE,CAAA;IAClC,MAAM,EACJ,YAAY,EACZ,qBAAqB,EACrB,aAAa,EACb,eAAe,EACf,4BAA4B,EAC5B,SAAS,GACV,GAAG,KAAK,CAAC,MAAM,CAAA;IAEhB,MAAM,cAAc,GAAG,sBAAsB,CAAC,qBAAqB,CAAC,CAAA;IACpE,MAAM,SAAS,GAAG,SAAS,IAAI,4BAA4B,CAAA;IAC3D,MAAM,MAAM,GAAG,SAAS,EAAE,CAAA;IAE1B,MAAM,EAAE,sBAAsB,EAAE,GAAG,mBAAmB,CAAC;QACrD,eAAe;QACf,YAAY;QACZ,cAAc;KACf,CAAC,CAAA;IAEF,MAAM,mBAAmB,GAAG,WAAW,CAAC,GAAG,EAAE;QAC3C,KAAK,CAAC,KAAK,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S,sBAAsB,CAAC,WAAmB;IACjD,IAAI,WAAW,CAAC,UAAU,CAAC,QAAQ,CAAC;QAAE,OAAO,OAAO,CAAA;IACpD,IAAI,WAAW,CAAC,UAAU,CAAC,QAAQ,CAAC;QAAE,OAAO,OAAO,CAAA;IACpD,IAAI,WAAW,CAAC,UAAU,CAAC,QAAQ,CAAC;QAAE,OAAO,OAAO,CAAA;IACpD,IAAI,WAAW,KAAK,iBAAiB;QAAE,OAAO,KAAK,CAAA;IACnD,IAAI,WAAW,CAAC,UAAU,CAAC,cAAc,CAAC;QAAE,OAAO,MAAM,CAAA;IAEzD,OAAO,EAAE,CAAA;AACX,CAAC","sourcesContent":["import { StaticScreenProps, useNavigation } from '@react-navigation/native'\nimport React, { useCallback } from 'react'\nimport { Alert, Linking, StyleSheet } from 'react-native'\nimport FormSheet, { getFormSheetScreenOptions } from '../../components/primitive/form_sheet'\nimport { useDeleteAttachment } from './hooks/useDeleteAttachment'\n\nexport const AttachmentActionsScreenOptions = getFormSheetScreenOptions({\n headerTitle: 'Attachment actions',\n})\n\nexport type AttachmentActionsScreenProps = StaticScreenProps<{\n attachmentId: string\n attachmentContentType: string\n attachmentUrl: string\n conversation_id: number\n canDeleteNonAuthoredMessages: boolean\n myMessage: boolean\n}>\n\nexport function AttachmentActionsScreen({ route }: AttachmentActionsScreenProps) {\n const navigation = useNavigation()\n const {\n attachmentId,\n attachmentContentType,\n attachmentUrl,\n conversation_id,\n canDeleteNonAuthoredMessages,\n myMessage,\n } = route.params\n\n const attachmentName = getAttachmentLabelName(attachmentContentType)\n const canDelete = myMessage || canDeleteNonAuthoredMessages\n const styles = useStyles()\n\n const { handleDeleteAttachment } = useDeleteAttachment({\n conversation_id,\n attachmentId,\n attachmentName,\n })\n\n const handleDeleteConfirm = useCallback(() => {\n Alert.alert(\n `Delete ${attachmentName}`,\n 'Are you sure you want to permanently delete this attachment?',\n [\n { text: 'Cancel', style: 'cancel' },\n { text: 'Delete', style: 'destructive', onPress: () => handleDeleteAttachment() },\n ]\n )\n }, [attachmentName, handleDeleteAttachment])\n\n const handleOpenInBrowser = () => {\n Linking.openURL(attachmentUrl)\n navigation.goBack()\n }\n\n return (\n <FormSheet.Root contentStyle={styles.formSheetContent}>\n <FormSheet.Action\n iconName=\"general.newWindow\"\n title=\"Open in browser\"\n accessibilityRole=\"link\"\n accessibilityLabel={`Open ${attachmentName} in browser`}\n accessibilityHint={`${attachmentName} can be downloaded and shared through the browser.`}\n onPress={handleOpenInBrowser}\n />\n {canDelete && (\n <FormSheet.Action\n appearance=\"danger\"\n iconName=\"publishing.trash\"\n title={`Delete ${attachmentName}`}\n onPress={handleDeleteConfirm}\n />\n )}\n </FormSheet.Root>\n )\n}\n\nconst useStyles = () => {\n return StyleSheet.create({\n formSheetContent: {\n paddingTop: 16,\n },\n })\n}\n\nfunction getAttachmentLabelName(contentType: string) {\n if (contentType.startsWith('image/')) return 'image'\n if (contentType.startsWith('video/')) return 'video'\n if (contentType.startsWith('audio/')) return 'audio'\n if (contentType === 'application/pdf') return 'PDF'\n if (contentType.startsWith('application/')) return 'file'\n\n return ''\n}\n"]}
1
+ {"version":3,"file":"attachment_actions_screen.js","sourceRoot":"","sources":["../../../src/screens/attachment_actions/attachment_actions_screen.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAqB,aAAa,EAAE,MAAM,0BAA0B,CAAA;AAC3E,OAAO,KAAK,EAAE,EAAE,WAAW,EAAE,MAAM,OAAO,CAAA;AAC1C,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAA;AACzD,OAAO,SAAS,EAAE,EAAE,yBAAyB,EAAE,MAAM,uCAAuC,CAAA;AAC5F,OAAO,EAAE,mBAAmB,EAAE,MAAM,6BAA6B,CAAA;AAEjE,MAAM,CAAC,MAAM,8BAA8B,GAAG,yBAAyB,CAAC;IACtE,WAAW,EAAE,oBAAoB;CAClC,CAAC,CAAA;AAWF,MAAM,UAAU,uBAAuB,CAAC,EAAE,K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xB,kBAAkB,CAAC,CAAC,QAAQ,cAAc,aAAa,CAAC,CACxD,iBAAiB,CAAC,CAAC,GAAG,cAAc,oDAAoD,CAAC,CACzF,OAAO,CAAC,CAAC,mBAAmB,CAAC,EAE/B;MAAA,CAAC,SAAS,IAAI,CACZ,CAAC,SAAS,CAAC,MAAM,CACf,UAAU,CAAC,QAAQ,CACnB,QAAQ,CAAC,kBAAkB,CAC3B,KAAK,CAAC,CAAC,UAAU,cAAc,EAAE,CAAC,CAClC,OAAO,CAAC,CAAC,mBAAmB,CAAC,EAC7B,CACH,CACH;IAAA,EAAE,SAAS,CAAC,IAAI,CAAC,CAClB,CAAA;AACH,CAAC;AAED,MAAM,SAAS,GAAG,GAAG,EAAE;IACrB,OAAO,UAAU,CAAC,MAAM,CAAC;QACvB,gBAAgB,EAAE;YAChB,UAAU,EAAE,EAAE;SACf;KACF,CAAC,CAAA;AACJ,CAAC,CAAA;AAED,SAAS,sBAAsB,CAAC,WAAmB;IACjD,IAAI,WAAW,CAAC,UAAU,CAAC,QAAQ,CAAC;QAAE,OAAO,OAAO,CAAA;IACpD,IAAI,WAAW,CAAC,UAAU,CAAC,QAAQ,CAAC;QAAE,OAAO,OAAO,CAAA;IACpD,IAAI,WAAW,CAAC,UAAU,CAAC,QAAQ,CAAC;QAAE,OAAO,OAAO,CAAA;IACpD,IAAI,WAAW,KAAK,iBAAiB;QAAE,OAAO,KAAK,CAAA;IACnD,IAAI,WAAW,CAAC,UAAU,CAAC,cAAc,CAAC;QAAE,OAAO,MAAM,CAAA;IAEzD,OAAO,EAAE,CAAA;AACX,CAAC","sourcesContent":["import { StaticScreenProps, useNavigation } from '@react-navigation/native'\nimport React, { useCallback } from 'react'\nimport { Alert, Linking, StyleSheet } from 'react-native'\nimport FormSheet, { getFormSheetScreenOptions } from '../../components/primitive/form_sheet'\nimport { useDeleteAttachment } from './hooks/useDeleteAttachment'\n\nexport const AttachmentActionsScreenOptions = getFormSheetScreenOptions({\n headerTitle: 'Attachment actions',\n})\n\nexport type AttachmentActionsScreenProps = StaticScreenProps<{\n attachmentId: string\n attachmentContentType: string\n attachmentUrl: string\n conversation_id: number\n canDeleteNonAuthoredMessages: boolean\n myMessage: boolean\n}>\n\nexport function AttachmentActionsScreen({ route }: AttachmentActionsScreenProps) {\n const navigation = useNavigation()\n const {\n attachmentId,\n attachmentContentType,\n attachmentUrl,\n conversation_id,\n canDeleteNonAuthoredMessages,\n myMessage,\n } = route.params\n\n const attachmentName = getAttachmentLabelName(attachmentContentType)\n const canDelete = myMessage || canDeleteNonAuthoredMessages\n const styles = useStyles()\n\n const { handleDeleteAttachment } = useDeleteAttachment({\n conversation_id,\n attachmentId,\n attachmentName,\n })\n\n const handleDeleteConfirm = useCallback(() => {\n Alert.alert(\n `Delete ${attachmentName}`,\n 'Are you sure you want to permanently delete this attachment?',\n [\n { text: 'Cancel', style: 'cancel' },\n {\n text: 'Delete',\n style: 'destructive',\n onPress: () => {\n handleDeleteAttachment()\n navigation.goBack()\n },\n },\n ]\n )\n }, [attachmentName, handleDeleteAttachment, navigation])\n\n const handleOpenInBrowser = () => {\n Linking.openURL(attachmentUrl)\n navigation.goBack()\n }\n\n return (\n <FormSheet.Root contentStyle={styles.formSheetContent}>\n <FormSheet.Action\n iconName=\"general.newWindow\"\n title=\"Open in browser\"\n accessibilityRole=\"link\"\n accessibilityLabel={`Open ${attachmentName} in browser`}\n accessibilityHint={`${attachmentName} can be downloaded and shared through the browser.`}\n onPress={handleOpenInBrowser}\n />\n {canDelete && (\n <FormSheet.Action\n appearance=\"danger\"\n iconName=\"publishing.trash\"\n title={`Delete ${attachmentName}`}\n onPress={handleDeleteConfirm}\n />\n )}\n </FormSheet.Root>\n )\n}\n\nconst useStyles = () => {\n return StyleSheet.create({\n formSheetContent: {\n paddingTop: 16,\n },\n })\n}\n\nfunction getAttachmentLabelName(contentType: string) {\n if (contentType.startsWith('image/')) return 'image'\n if (contentType.startsWith('video/')) return 'video'\n if (contentType.startsWith('audio/')) return 'audio'\n if (contentType === 'application/pdf') return 'PDF'\n if (contentType.startsWith('application/')) return 'file'\n\n return ''\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"useDeleteAttachment.d.ts","sourceRoot":"","sources":["../../../../src/screens/attachment_actions/hooks/useDeleteAttachment.tsx"],"names":[],"mappings":"AAQA,KAAK,wBAAwB,GAAG;IAC9B,eAAe,EAAE,MAAM,CAAA;IACvB,YAAY,EAAE,MAAM,GAAG,SAAS,CAAA;IAChC,cAAc,EAAE,MAAM,CAAA;CACvB,CAAA;AAED,wBAAgB,mBAAmB,CAAC,EAClC,eAAe,EACf,YAAY,EACZ,cAAc,GACf,EAAE,wBAAwB;;EA6B1B"}
1
+ {"version":3,"file":"useDeleteAttachment.d.ts","sourceRoot":"","sources":["../../../../src/screens/attachment_actions/hooks/useDeleteAttachment.tsx"],"names":[],"mappings":"AAOA,KAAK,wBAAwB,GAAG;IAC9B,eAAe,EAAE,MAAM,CAAA;IACvB,YAAY,EAAE,MAAM,GAAG,SAAS,CAAA;IAChC,cAAc,EAAE,MAAM,CAAA;CACvB,CAAA;AAED,wBAAgB,mBAAmB,CAAC,EAClC,eAAe,EACf,YAAY,EACZ,cAAc,GACf,EAAE,wBAAwB;;EA4B1B"}
@@ -1,5 +1,4 @@
1
1
  import { Alert } from 'react-native';
2
- import { useNavigation } from '@react-navigation/native';
3
2
  import { useMutation } from '@tanstack/react-query';
4
3
  import { useApiClient } from '../../../hooks/use_api_client';
5
4
  import { useCallback } from 'react';
@@ -7,7 +6,6 @@ import { useConversationMessages } from '../../../hooks/use_conversation_message
7
6
  import { Haptic } from '../../../utils/native_adapters';
8
7
  export function useDeleteAttachment({ conversation_id, attachmentId, attachmentName, }) {
9
8
  const apiClient = useApiClient();
10
- const navigation = useNavigation();
11
9
  const { refetch } = useConversationMessages({ conversation_id }, { refetchOnMount: false });
12
10
  const deleteAttachment = useCallback(() => {
13
11
  const url = `/me/conversations/${conversation_id}/message_attachments/${attachmentId}`;
@@ -15,10 +13,10 @@ export function useDeleteAttachment({ conversation_id, attachmentId, attachmentN
15
13
  }, [apiClient, conversation_id, attachmentId]);
16
14
  const { mutate: handleDeleteAttachment } = useMutation({
17
15
  mutationFn: deleteAttachment,
16
+ mutationKey: ['deleteAttachment', attachmentId],
18
17
  onSuccess: () => {
19
18
  refetch();
20
19
  Haptic.notificationSuccess();
21
- navigation.goBack();
22
20
  },
23
21
  onError: () => {
24
22
  Alert.alert('Oops', `We were unable to delete this ${attachmentName} attachment. Please try again.`);
@@ -1 +1 @@
1
- {"version":3,"file":"useDeleteAttachment.js","sourceRoot":"","sources":["../../../../src/screens/attachment_actions/hooks/useDeleteAttachment.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,cAAc,CAAA;AACpC,OAAO,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAA;AACxD,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAA;AACnD,OAAO,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAA;AAC5D,OAAO,EAAE,WAAW,EAAE,MAAM,OAAO,CAAA;AACnC,OAAO,EAAE,uBAAuB,EAAE,MAAM,0CAA0C,CAAA;AAClF,OAAO,EAAE,MAAM,EAAE,MAAM,gCAAgC,CAAA;AAQvD,MAAM,UAAU,mBAAmB,CAAC,EAClC,eAAe,EACf,YAAY,EACZ,cAAc,GACW;IACzB,MAAM,SAAS,GAAG,YAAY,EAAE,CAAA;IAChC,MAAM,UAAU,GAAG,aAAa,EAAE,CAAA;IAClC,MAAM,EAAE,OAAO,EAAE,GAAG,uBAAuB,CAAC,EAAE,eAAe,EAAE,EAAE,EAAE,cAAc,EAAE,KAAK,EAAE,CAAC,CAAA;IAE3F,MAAM,gBAAgB,GAAG,WAAW,CAAC,GAAG,EAAE;QACxC,MAAM,GAAG,GAAG,qBAAqB,eAAe,wBAAwB,YAAY,EAAE,CAAA;QAEtF,OAAO,SAAS,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,GAAG,EAAE,CAAC,CAAA;IACvC,CAAC,EAAE,CAAC,SAAS,EAAE,eAAe,EAAE,YAAY,CAAC,CAAC,CAAA;IAE9C,MAAM,EAAE,MAAM,EAAE,sBAAsB,EAAE,GAAG,WAAW,CAAC;QACrD,UAAU,EAAE,gBAAgB;QAC5B,SAAS,EAAE,GAAG,EAAE;YACd,OAAO,EAAE,CAAA;YACT,MAAM,CAAC,mBAAmB,EAAE,CAAA;YAC5B,UAAU,CAAC,MAAM,EAAE,CAAA;QACrB,CAAC;QACD,OAAO,EAAE,GAAG,EAAE;YACZ,KAAK,CAAC,KAAK,CACT,MAAM,EACN,iCAAiC,cAAc,gCAAgC,CAChF,CAAA;QACH,CAAC;KACF,CAAC,CAAA;IAEF,OAAO;QACL,sBAAsB;KACvB,CAAA;AACH,CAAC","sourcesContent":["import { Alert } from 'react-native'\nimport { useNavigation } from '@react-navigation/native'\nimport { useMutation } from '@tanstack/react-query'\nimport { useApiClient } from '../../../hooks/use_api_client'\nimport { useCallback } from 'react'\nimport { useConversationMessages } from '../../../hooks/use_conversation_messages'\nimport { Haptic } from '../../../utils/native_adapters'\n\ntype UseDeleteAttachmentProps = {\n conversation_id: number\n attachmentId: string | undefined\n attachmentName: string\n}\n\nexport function useDeleteAttachment({\n conversation_id,\n attachmentId,\n attachmentName,\n}: UseDeleteAttachmentProps) {\n const apiClient = useApiClient()\n const navigation = useNavigation()\n const { refetch } = useConversationMessages({ conversation_id }, { refetchOnMount: false })\n\n const deleteAttachment = useCallback(() => {\n const url = `/me/conversations/${conversation_id}/message_attachments/${attachmentId}`\n\n return apiClient.chat.delete({ url })\n }, [apiClient, conversation_id, attachmentId])\n\n const { mutate: handleDeleteAttachment } = useMutation({\n mutationFn: deleteAttachment,\n onSuccess: () => {\n refetch()\n Haptic.notificationSuccess()\n navigation.goBack()\n },\n onError: () => {\n Alert.alert(\n 'Oops',\n `We were unable to delete this ${attachmentName} attachment. Please try again.`\n )\n },\n })\n\n return {\n handleDeleteAttachment,\n }\n}\n"]}
1
+ {"version":3,"file":"useDeleteAttachment.js","sourceRoot":"","sources":["../../../../src/screens/attachment_actions/hooks/useDeleteAttachment.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,cAAc,CAAA;AACpC,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAA;AACnD,OAAO,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAA;AAC5D,OAAO,EAAE,WAAW,EAAE,MAAM,OAAO,CAAA;AACnC,OAAO,EAAE,uBAAuB,EAAE,MAAM,0CAA0C,CAAA;AAClF,OAAO,EAAE,MAAM,EAAE,MAAM,gCAAgC,CAAA;AAQvD,MAAM,UAAU,mBAAmB,CAAC,EAClC,eAAe,EACf,YAAY,EACZ,cAAc,GACW;IACzB,MAAM,SAAS,GAAG,YAAY,EAAE,CAAA;IAChC,MAAM,EAAE,OAAO,EAAE,GAAG,uBAAuB,CAAC,EAAE,eAAe,EAAE,EAAE,EAAE,cAAc,EAAE,KAAK,EAAE,CAAC,CAAA;IAE3F,MAAM,gBAAgB,GAAG,WAAW,CAAC,GAAG,EAAE;QACxC,MAAM,GAAG,GAAG,qBAAqB,eAAe,wBAAwB,YAAY,EAAE,CAAA;QAEtF,OAAO,SAAS,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,GAAG,EAAE,CAAC,CAAA;IACvC,CAAC,EAAE,CAAC,SAAS,EAAE,eAAe,EAAE,YAAY,CAAC,CAAC,CAAA;IAE9C,MAAM,EAAE,MAAM,EAAE,sBAAsB,EAAE,GAAG,WAAW,CAAC;QACrD,UAAU,EAAE,gBAAgB;QAC5B,WAAW,EAAE,CAAC,kBAAkB,EAAE,YAAY,CAAC;QAC/C,SAAS,EAAE,GAAG,EAAE;YACd,OAAO,EAAE,CAAA;YACT,MAAM,CAAC,mBAAmB,EAAE,CAAA;QAC9B,CAAC;QACD,OAAO,EAAE,GAAG,EAAE;YACZ,KAAK,CAAC,KAAK,CACT,MAAM,EACN,iCAAiC,cAAc,gCAAgC,CAChF,CAAA;QACH,CAAC;KACF,CAAC,CAAA;IAEF,OAAO;QACL,sBAAsB;KACvB,CAAA;AACH,CAAC","sourcesContent":["import { Alert } from 'react-native'\nimport { useMutation } from '@tanstack/react-query'\nimport { useApiClient } from '../../../hooks/use_api_client'\nimport { useCallback } from 'react'\nimport { useConversationMessages } from '../../../hooks/use_conversation_messages'\nimport { Haptic } from '../../../utils/native_adapters'\n\ntype UseDeleteAttachmentProps = {\n conversation_id: number\n attachmentId: string | undefined\n attachmentName: string\n}\n\nexport function useDeleteAttachment({\n conversation_id,\n attachmentId,\n attachmentName,\n}: UseDeleteAttachmentProps) {\n const apiClient = useApiClient()\n const { refetch } = useConversationMessages({ conversation_id }, { refetchOnMount: false })\n\n const deleteAttachment = useCallback(() => {\n const url = `/me/conversations/${conversation_id}/message_attachments/${attachmentId}`\n\n return apiClient.chat.delete({ url })\n }, [apiClient, conversation_id, attachmentId])\n\n const { mutate: handleDeleteAttachment } = useMutation({\n mutationFn: deleteAttachment,\n mutationKey: ['deleteAttachment', attachmentId],\n onSuccess: () => {\n refetch()\n Haptic.notificationSuccess()\n },\n onError: () => {\n Alert.alert(\n 'Oops',\n `We were unable to delete this ${attachmentName} attachment. Please try again.`\n )\n },\n })\n\n return {\n handleDeleteAttachment,\n }\n}\n"]}
@@ -75,10 +75,10 @@ function MessageActionsScreenContent({ message, conversation_id, canDeleteNonAut
75
75
  }, [apiClient, conversation_id, message.id]);
76
76
  const { mutate: handleDeleteMessage } = useMutation({
77
77
  mutationFn: deleteMessage,
78
+ mutationKey: ['deleteMessage', message.id],
78
79
  onSuccess: () => {
79
80
  refetchMessages();
80
81
  Haptic.notificationSuccess();
81
- navigation.goBack();
82
82
  },
83
83
  onError: () => {
84
84
  Alert.alert('Oops', 'We were unable to delete this message. Please try again.');
@@ -87,9 +87,16 @@ function MessageActionsScreenContent({ message, conversation_id, canDeleteNonAut
87
87
  const handleDeleteConfirm = useCallback(() => {
88
88
  Alert.alert('Delete message', 'Are you sure you want to permanently delete this message?', [
89
89
  { text: 'Cancel', style: 'cancel' },
90
- { text: 'Delete', style: 'destructive', onPress: () => handleDeleteMessage() },
90
+ {
91
+ text: 'Delete',
92
+ style: 'destructive',
93
+ onPress: () => {
94
+ handleDeleteMessage();
95
+ navigation.goBack();
96
+ },
97
+ },
91
98
  ]);
92
- }, [handleDeleteMessage]);
99
+ }, [handleDeleteMessage, navigation]);
93
100
  const handleEditPress = useCallback(() => {
94
101
  const state = navigation.getState?.();
95
102
  const targetRouteName = inReplyScreen ? 'ConversationReply' : 'Conversation';