@planningcenter/chat-react-native 3.4.1-rc.1 → 3.4.1-rc.11

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 (178) hide show
  1. package/build/components/conversation/attachments/audio_attachment.d.ts +2 -1
  2. package/build/components/conversation/attachments/audio_attachment.d.ts.map +1 -1
  3. package/build/components/conversation/attachments/audio_attachment.js +14 -11
  4. package/build/components/conversation/attachments/audio_attachment.js.map +1 -1
  5. package/build/components/conversation/attachments/expanded_link.d.ts +4 -2
  6. package/build/components/conversation/attachments/expanded_link.d.ts.map +1 -1
  7. package/build/components/conversation/attachments/expanded_link.js +5 -4
  8. package/build/components/conversation/attachments/expanded_link.js.map +1 -1
  9. package/build/components/conversation/attachments/generic_file_attachment.d.ts +2 -1
  10. package/build/components/conversation/attachments/generic_file_attachment.d.ts.map +1 -1
  11. package/build/components/conversation/attachments/generic_file_attachment.js +5 -4
  12. package/build/components/conversation/attachments/generic_file_attachment.js.map +1 -1
  13. package/build/components/conversation/attachments/giphy_attachment.d.ts +2 -1
  14. package/build/components/conversation/attachments/giphy_attachment.d.ts.map +1 -1
  15. package/build/components/conversation/attachments/giphy_attachment.js +2 -2
  16. package/build/components/conversation/attachments/giphy_attachment.js.map +1 -1
  17. package/build/components/conversation/attachments/image_attachment.d.ts +9 -2
  18. package/build/components/conversation/attachments/image_attachment.d.ts.map +1 -1
  19. package/build/components/conversation/attachments/image_attachment.js +126 -11
  20. package/build/components/conversation/attachments/image_attachment.js.map +1 -1
  21. package/build/components/conversation/attachments/video_attachment.d.ts +2 -1
  22. package/build/components/conversation/attachments/video_attachment.d.ts.map +1 -1
  23. package/build/components/conversation/attachments/video_attachment.js +5 -4
  24. package/build/components/conversation/attachments/video_attachment.js.map +1 -1
  25. package/build/components/conversation/disabled_replies_banners.d.ts +3 -0
  26. package/build/components/conversation/disabled_replies_banners.d.ts.map +1 -0
  27. package/build/components/conversation/disabled_replies_banners.js +41 -0
  28. package/build/components/conversation/disabled_replies_banners.js.map +1 -0
  29. package/build/components/conversation/empty_conversation_blank_state.d.ts +2 -0
  30. package/build/components/conversation/empty_conversation_blank_state.d.ts.map +1 -0
  31. package/build/components/conversation/empty_conversation_blank_state.js +5 -0
  32. package/build/components/conversation/empty_conversation_blank_state.js.map +1 -0
  33. package/build/components/conversation/message.d.ts.map +1 -1
  34. package/build/components/conversation/message.js +10 -1
  35. package/build/components/conversation/message.js.map +1 -1
  36. package/build/components/conversation/message_attachments.d.ts +3 -0
  37. package/build/components/conversation/message_attachments.d.ts.map +1 -1
  38. package/build/components/conversation/message_attachments.js +9 -9
  39. package/build/components/conversation/message_attachments.js.map +1 -1
  40. package/build/components/conversation/message_form.d.ts +3 -2
  41. package/build/components/conversation/message_form.d.ts.map +1 -1
  42. package/build/components/conversation/message_form.js +68 -18
  43. package/build/components/conversation/message_form.js.map +1 -1
  44. package/build/components/display/blank_state.d.ts +13 -0
  45. package/build/components/display/blank_state.d.ts.map +1 -0
  46. package/build/components/display/blank_state.js +46 -0
  47. package/build/components/display/blank_state.js.map +1 -0
  48. package/build/components/display/image.d.ts +11 -2
  49. package/build/components/display/image.d.ts.map +1 -1
  50. package/build/components/display/image.js +5 -3
  51. package/build/components/display/image.js.map +1 -1
  52. package/build/components/display/keyboard_view.d.ts.map +1 -1
  53. package/build/components/display/keyboard_view.js +23 -22
  54. package/build/components/display/keyboard_view.js.map +1 -1
  55. package/build/components/page/error_boundary.d.ts.map +1 -1
  56. package/build/components/page/error_boundary.js +4 -3
  57. package/build/components/page/error_boundary.js.map +1 -1
  58. package/build/components/primitive/actions_form_sheet.d.ts +34 -0
  59. package/build/components/primitive/actions_form_sheet.d.ts.map +1 -0
  60. package/build/components/primitive/actions_form_sheet.js +91 -0
  61. package/build/components/primitive/actions_form_sheet.js.map +1 -0
  62. package/build/contexts/chat_context.d.ts +7 -6
  63. package/build/contexts/chat_context.d.ts.map +1 -1
  64. package/build/contexts/chat_context.js +2 -2
  65. package/build/contexts/chat_context.js.map +1 -1
  66. package/build/hooks/use_conversation.d.ts +4 -4
  67. package/build/hooks/use_conversation.js +1 -1
  68. package/build/hooks/use_conversation.js.map +1 -1
  69. package/build/hooks/use_conversation_messages.d.ts.map +1 -1
  70. package/build/hooks/use_conversation_messages.js +0 -4
  71. package/build/hooks/use_conversation_messages.js.map +1 -1
  72. package/build/hooks/use_jolt.d.ts.map +1 -1
  73. package/build/hooks/use_jolt.js +33 -19
  74. package/build/hooks/use_jolt.js.map +1 -1
  75. package/build/hooks/{use_message_create.d.ts → use_message_create_or_update.d.ts} +3 -2
  76. package/build/hooks/use_message_create_or_update.d.ts.map +1 -0
  77. package/build/hooks/{use_message_create.js → use_message_create_or_update.js} +21 -11
  78. package/build/hooks/use_message_create_or_update.js.map +1 -0
  79. package/build/hooks/use_suspense_api.d.ts +6 -5
  80. package/build/hooks/use_suspense_api.d.ts.map +1 -1
  81. package/build/hooks/use_suspense_api.js +16 -3
  82. package/build/hooks/use_suspense_api.js.map +1 -1
  83. package/build/index.d.ts +6 -4
  84. package/build/index.d.ts.map +1 -1
  85. package/build/index.js +6 -4
  86. package/build/index.js.map +1 -1
  87. package/build/navigation/index.d.ts +5 -0
  88. package/build/navigation/index.d.ts.map +1 -1
  89. package/build/navigation/index.js +6 -0
  90. package/build/navigation/index.js.map +1 -1
  91. package/build/screens/attachment_actions/attachment_actions_screen.d.ts +9 -0
  92. package/build/screens/attachment_actions/attachment_actions_screen.d.ts.map +1 -0
  93. package/build/screens/attachment_actions/attachment_actions_screen.js +39 -0
  94. package/build/screens/attachment_actions/attachment_actions_screen.js.map +1 -0
  95. package/build/screens/conversation_screen.d.ts +1 -0
  96. package/build/screens/conversation_screen.d.ts.map +1 -1
  97. package/build/screens/conversation_screen.js +23 -13
  98. package/build/screens/conversation_screen.js.map +1 -1
  99. package/build/screens/design_system_screen.d.ts.map +1 -1
  100. package/build/screens/design_system_screen.js +11 -0
  101. package/build/screens/design_system_screen.js.map +1 -1
  102. package/build/screens/message_actions_screen.d.ts +1 -0
  103. package/build/screens/message_actions_screen.d.ts.map +1 -1
  104. package/build/screens/message_actions_screen.js +15 -5
  105. package/build/screens/message_actions_screen.js.map +1 -1
  106. package/build/screens/send_giphy_screen.d.ts.map +1 -1
  107. package/build/screens/send_giphy_screen.js +4 -2
  108. package/build/screens/send_giphy_screen.js.map +1 -1
  109. package/build/types/api_primitives.d.ts +1 -1
  110. package/build/types/api_primitives.d.ts.map +1 -1
  111. package/build/types/api_primitives.js.map +1 -1
  112. package/build/types/resources/member_ability.d.ts +1 -0
  113. package/build/types/resources/member_ability.d.ts.map +1 -1
  114. package/build/types/resources/member_ability.js.map +1 -1
  115. package/build/utils/index.d.ts +1 -0
  116. package/build/utils/index.d.ts.map +1 -1
  117. package/build/utils/index.js +1 -0
  118. package/build/utils/index.js.map +1 -1
  119. package/build/utils/native_adapters/configuration.d.ts +8 -5
  120. package/build/utils/native_adapters/configuration.d.ts.map +1 -1
  121. package/build/utils/native_adapters/configuration.js +7 -5
  122. package/build/utils/native_adapters/configuration.js.map +1 -1
  123. package/build/utils/native_adapters/index.d.ts +1 -0
  124. package/build/utils/native_adapters/index.d.ts.map +1 -1
  125. package/build/utils/native_adapters/index.js +1 -0
  126. package/build/utils/native_adapters/index.js.map +1 -1
  127. package/build/utils/native_adapters/log.d.ts +15 -0
  128. package/build/utils/native_adapters/log.d.ts.map +1 -0
  129. package/build/utils/native_adapters/log.js +21 -0
  130. package/build/utils/native_adapters/log.js.map +1 -0
  131. package/build/utils/navigation_constants.d.ts +2 -0
  132. package/build/utils/navigation_constants.d.ts.map +1 -0
  133. package/build/utils/navigation_constants.js +11 -0
  134. package/build/utils/navigation_constants.js.map +1 -0
  135. package/build/utils/response_error.d.ts +9 -0
  136. package/build/utils/response_error.d.ts.map +1 -0
  137. package/build/utils/response_error.js +15 -0
  138. package/build/utils/response_error.js.map +1 -0
  139. package/package.json +2 -2
  140. package/src/components/conversation/attachments/audio_attachment.tsx +25 -17
  141. package/src/components/conversation/attachments/expanded_link.tsx +17 -4
  142. package/src/components/conversation/attachments/generic_file_attachment.tsx +9 -3
  143. package/src/components/conversation/attachments/giphy_attachment.tsx +8 -1
  144. package/src/components/conversation/attachments/image_attachment.tsx +237 -14
  145. package/src/components/conversation/attachments/video_attachment.tsx +9 -3
  146. package/src/components/conversation/disabled_replies_banners.tsx +58 -0
  147. package/src/components/conversation/empty_conversation_blank_state.tsx +11 -0
  148. package/src/components/conversation/message.tsx +17 -1
  149. package/src/components/conversation/message_attachments.tsx +55 -11
  150. package/src/components/conversation/message_form.tsx +98 -28
  151. package/src/components/display/blank_state.tsx +61 -0
  152. package/src/components/display/image.tsx +17 -2
  153. package/src/components/display/keyboard_view.tsx +31 -25
  154. package/src/components/page/error_boundary.tsx +4 -3
  155. package/src/components/primitive/actions_form_sheet.tsx +159 -0
  156. package/src/contexts/chat_context.tsx +12 -8
  157. package/src/hooks/use_conversation.ts +1 -1
  158. package/src/hooks/use_conversation_messages.ts +0 -5
  159. package/src/hooks/use_jolt.ts +32 -19
  160. package/src/hooks/{use_message_create.ts → use_message_create_or_update.ts} +21 -11
  161. package/src/hooks/use_suspense_api.ts +23 -7
  162. package/src/index.tsx +6 -12
  163. package/src/navigation/index.tsx +6 -0
  164. package/src/screens/attachment_actions/attachment_actions_screen.tsx +56 -0
  165. package/src/screens/conversation_screen.tsx +49 -22
  166. package/src/screens/design_system_screen.tsx +19 -0
  167. package/src/screens/message_actions_screen.tsx +26 -9
  168. package/src/screens/send_giphy_screen.tsx +4 -2
  169. package/src/types/api_primitives.ts +1 -1
  170. package/src/types/resources/member_ability.ts +1 -0
  171. package/src/utils/index.ts +1 -0
  172. package/src/utils/native_adapters/configuration.ts +8 -5
  173. package/src/utils/native_adapters/index.ts +1 -0
  174. package/src/utils/native_adapters/log.ts +29 -0
  175. package/src/utils/navigation_constants.ts +12 -0
  176. package/src/utils/response_error.ts +17 -0
  177. package/build/hooks/use_message_create.d.ts.map +0 -1
  178. package/build/hooks/use_message_create.js.map +0 -1
@@ -1,6 +1,7 @@
1
1
  import React from 'react';
2
2
  import { DenormalizedMessageAttachmentResource } from '../../../types/resources/denormalized_attachment_resource';
3
- export declare function AudioAttachment({ attachment, }: {
3
+ export declare function AudioAttachment({ attachment, onAttachmentLongPress, }: {
4
4
  attachment: DenormalizedMessageAttachmentResource;
5
+ onAttachmentLongPress: (attachment: DenormalizedMessageAttachmentResource) => void;
5
6
  }): React.JSX.Element;
6
7
  //# sourceMappingURL=audio_attachment.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"audio_attachment.d.ts","sourceRoot":"","sources":["../../../../src/components/conversation/attachments/audio_attachment.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AAEzB,OAAO,EAAE,qCAAqC,EAAE,MAAM,2DAA2D,CAAA;AAOjH,wBAAgB,eAAe,CAAC,EAC9B,UAAU,GACX,EAAE;IACD,UAAU,EAAE,qCAAqC,CAAA;CAClD,qBA6CA"}
1
+ {"version":3,"file":"audio_attachment.d.ts","sourceRoot":"","sources":["../../../../src/components/conversation/attachments/audio_attachment.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AAEzB,OAAO,EAAE,qCAAqC,EAAE,MAAM,2DAA2D,CAAA;AAQjH,wBAAgB,eAAe,CAAC,EAC9B,UAAU,EACV,qBAAqB,GACtB,EAAE;IACD,UAAU,EAAE,qCAAqC,CAAA;IACjD,qBAAqB,EAAE,CAAC,UAAU,EAAE,qCAAqC,KAAK,IAAI,CAAA;CACnF,qBAkDA"}
@@ -5,7 +5,8 @@ import { AttachmentCard, AttachmentCardTitle } from './attachment_card';
5
5
  import { tokens } from '../../../vendor/tapestry/tokens';
6
6
  import { useTheme } from '../../../hooks';
7
7
  import { Audio } from '../../../utils/native_adapters';
8
- export function AudioAttachment({ attachment, }) {
8
+ import { PlatformPressable } from '@react-navigation/elements';
9
+ export function AudioAttachment({ attachment, onAttachmentLongPress, }) {
9
10
  const styles = useStyles();
10
11
  const { attributes } = attachment;
11
12
  const { url, filename } = attributes;
@@ -27,18 +28,20 @@ export function AudioAttachment({ attachment, }) {
27
28
  return 'Loading...';
28
29
  }
29
30
  }
30
- return (<AttachmentCard>
31
- <View style={styles.container}>
32
- <IconButton name={sound.isPlaying ? 'services.pause' : 'services.play'} size="md" accessibilityLabel={sound.isPlaying ? 'Pause' : 'Play'} onPress={toggleAudio} disabled={!sound} style={styles.button}/>
33
- <View style={styles.details}>
34
- <AttachmentCardTitle>{filename}</AttachmentCardTitle>
35
- <View style={styles.progressContainer}>
36
- <View style={[styles.progressBar, { width: `${progress * 100}%` }]}/>
31
+ return (<PlatformPressable onLongPress={() => onAttachmentLongPress(attachment)} accessibilityHint="Long press for more options">
32
+ <AttachmentCard>
33
+ <View style={styles.container}>
34
+ <IconButton name={sound.isPlaying ? 'services.pause' : 'services.play'} size="md" accessibilityLabel={sound.isPlaying ? 'Pause' : 'Play'} onPress={toggleAudio} disabled={!sound} style={styles.button}/>
35
+ <View style={styles.details}>
36
+ <AttachmentCardTitle>{filename}</AttachmentCardTitle>
37
+ <View style={styles.progressContainer}>
38
+ <View style={[styles.progressBar, { width: `${progress * 100}%` }]}/>
39
+ </View>
40
+ <Text style={styles.durationText}>{durationText()}</Text>
37
41
  </View>
38
- <Text style={styles.durationText}>{durationText()}</Text>
39
42
  </View>
40
- </View>
41
- </AttachmentCard>);
43
+ </AttachmentCard>
44
+ </PlatformPressable>);
42
45
  }
43
46
  const useStyles = () => {
44
47
  const { colors } = useTheme();
@@ -1 +1 @@
1
- {"version":3,"file":"audio_attachment.js","sourceRoot":"","sources":["../../../../src/components/conversation/attachments/audio_attachment.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AACzB,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,UAAU,EAAE,MAAM,cAAc,CAAA;AAErD,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAA;AAC1C,OAAO,EAAE,cA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AAY,EAAE,EAAE;YAChB,eAAe,EAAE,MAAM;YACvB,WAAW,EAAE,MAAM;YACnB,WAAW,EAAE,CAAC;SACf;QACD,UAAU,EAAE;YACV,QAAQ,EAAE,EAAE;YACZ,UAAU,EAAE,EAAE;SACf;QACD,OAAO,EAAE;YACP,IAAI,EAAE,CAAC;YACP,UAAU,EAAE,EAAE;YACd,GAAG,EAAE,CAAC;SACP;QACD,iBAAiB,EAAE;YACjB,MAAM,EAAE,CAAC;YACT,eAAe,EAAE,MAAM;YACvB,YAAY,EAAE,GAAG;YACjB,QAAQ,EAAE,QAAQ;SACnB;QACD,WAAW,EAAE;YACX,MAAM,EAAE,MAAM;YACd,eAAe,EAAE,MAAM;SACxB;QACD,YAAY,EAAE;YACZ,QAAQ,EAAE,MAAM,CAAC,UAAU;YAC3B,KAAK,EAAE,MAAM,CAAC,yBAAyB;SACxC;KACF,CAAC,CAAA;AACJ,CAAC,CAAA","sourcesContent":["import React from 'react'\nimport { View, Text, StyleSheet } from 'react-native'\nimport { DenormalizedMessageAttachmentResource } from '../../../types/resources/denormalized_attachment_resource'\nimport { IconButton } from '../../display'\nimport { AttachmentCard, AttachmentCardTitle } from './attachment_card'\nimport { tokens } from '../../../vendor/tapestry/tokens'\nimport { useTheme } from '../../../hooks'\nimport { Audio } from '../../../utils/native_adapters'\n\nexport function AudioAttachment({\n attachment,\n}: {\n attachment: DenormalizedMessageAttachmentResource\n}) {\n const styles = useStyles()\n const { attributes } = attachment\n const { url, filename } = attributes\n const sound = Audio.useAudio(url)\n\n function toggleAudio() {\n if (!sound.isPlaying) {\n sound.play()\n } else {\n sound.pause()\n }\n }\n\n const progress = sound.duration > 0 ? sound.position / sound.duration : 0\n\n function durationText() {\n if (sound.duration > 0) {\n return `${Math.floor(sound.position / 1000)}s / ${Math.floor(sound.duration / 1000)}s`\n } else {\n return 'Loading...'\n }\n }\n\n return (\n <AttachmentCard>\n <View style={styles.container}>\n <IconButton\n name={sound.isPlaying ? 'services.pause' : 'services.play'}\n size=\"md\"\n accessibilityLabel={sound.isPlaying ? 'Pause' : 'Play'}\n onPress={toggleAudio}\n disabled={!sound}\n style={styles.button}\n />\n <View style={styles.details}>\n <AttachmentCardTitle>{filename}</AttachmentCardTitle>\n <View style={styles.progressContainer}>\n <View style={[styles.progressBar, { width: `${progress * 100}%` }]} />\n </View>\n <Text style={styles.durationText}>{durationText()}</Text>\n </View>\n </View>\n </AttachmentCard>\n )\n}\n\nconst useStyles = () => {\n const { colors } = useTheme()\n\n return StyleSheet.create({\n container: {\n flexDirection: 'row',\n },\n button: {\n width: 42,\n height: 42,\n justifyContent: 'center',\n alignItems: 'center',\n borderRadius: 25,\n backgroundColor: '#eee',\n borderColor: '#aaa',\n borderWidth: 1,\n },\n buttonText: {\n fontSize: 32,\n lineHeight: 32,\n },\n details: {\n flex: 1,\n marginLeft: 10,\n gap: 5,\n },\n progressContainer: {\n height: 5,\n backgroundColor: '#ccc',\n borderRadius: 2.5,\n overflow: 'hidden',\n },\n progressBar: {\n height: '100%',\n backgroundColor: 'blue',\n },\n durationText: {\n fontSize: tokens.fontSizeXs,\n color: colors.textColorDefaultSecondary,\n },\n })\n}\n"]}
1
+ {"version":3,"file":"audio_attachment.js","sourceRoot":"","sources":["../../../../src/components/conversation/attachments/audio_attachment.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AACzB,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,UAAU,EAAE,MAAM,cAAc,CAAA;AAErD,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAA;AAC1C,OAAO,EAAE,cAAc,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAA;AACvE,OAAO,EAAE,MAAM,EAAE,MAAM,iCAAiC,CAAA;AACxD,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAA;AACzC,OAAO,EAAE,KAAK,EAAE,MAAM,gCAAgC,CAAA;AACtD,OAAO,EAAE,iBAAiB,EAAE,MAAM,4B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E;YAChB,eAAe,EAAE,MAAM;YACvB,WAAW,EAAE,MAAM;YACnB,WAAW,EAAE,CAAC;SACf;QACD,UAAU,EAAE;YACV,QAAQ,EAAE,EAAE;YACZ,UAAU,EAAE,EAAE;SACf;QACD,OAAO,EAAE;YACP,IAAI,EAAE,CAAC;YACP,UAAU,EAAE,EAAE;YACd,GAAG,EAAE,CAAC;SACP;QACD,iBAAiB,EAAE;YACjB,MAAM,EAAE,CAAC;YACT,eAAe,EAAE,MAAM;YACvB,YAAY,EAAE,GAAG;YACjB,QAAQ,EAAE,QAAQ;SACnB;QACD,WAAW,EAAE;YACX,MAAM,EAAE,MAAM;YACd,eAAe,EAAE,MAAM;SACxB;QACD,YAAY,EAAE;YACZ,QAAQ,EAAE,MAAM,CAAC,UAAU;YAC3B,KAAK,EAAE,MAAM,CAAC,yBAAyB;SACxC;KACF,CAAC,CAAA;AACJ,CAAC,CAAA","sourcesContent":["import React from 'react'\nimport { View, Text, StyleSheet } from 'react-native'\nimport { DenormalizedMessageAttachmentResource } from '../../../types/resources/denormalized_attachment_resource'\nimport { IconButton } from '../../display'\nimport { AttachmentCard, AttachmentCardTitle } from './attachment_card'\nimport { tokens } from '../../../vendor/tapestry/tokens'\nimport { useTheme } from '../../../hooks'\nimport { Audio } from '../../../utils/native_adapters'\nimport { PlatformPressable } from '@react-navigation/elements'\n\nexport function AudioAttachment({\n attachment,\n onAttachmentLongPress,\n}: {\n attachment: DenormalizedMessageAttachmentResource\n onAttachmentLongPress: (attachment: DenormalizedMessageAttachmentResource) => void\n}) {\n const styles = useStyles()\n const { attributes } = attachment\n const { url, filename } = attributes\n const sound = Audio.useAudio(url)\n\n function toggleAudio() {\n if (!sound.isPlaying) {\n sound.play()\n } else {\n sound.pause()\n }\n }\n\n const progress = sound.duration > 0 ? sound.position / sound.duration : 0\n\n function durationText() {\n if (sound.duration > 0) {\n return `${Math.floor(sound.position / 1000)}s / ${Math.floor(sound.duration / 1000)}s`\n } else {\n return 'Loading...'\n }\n }\n\n return (\n <PlatformPressable\n onLongPress={() => onAttachmentLongPress(attachment)}\n accessibilityHint=\"Long press for more options\"\n >\n <AttachmentCard>\n <View style={styles.container}>\n <IconButton\n name={sound.isPlaying ? 'services.pause' : 'services.play'}\n size=\"md\"\n accessibilityLabel={sound.isPlaying ? 'Pause' : 'Play'}\n onPress={toggleAudio}\n disabled={!sound}\n style={styles.button}\n />\n <View style={styles.details}>\n <AttachmentCardTitle>{filename}</AttachmentCardTitle>\n <View style={styles.progressContainer}>\n <View style={[styles.progressBar, { width: `${progress * 100}%` }]} />\n </View>\n <Text style={styles.durationText}>{durationText()}</Text>\n </View>\n </View>\n </AttachmentCard>\n </PlatformPressable>\n )\n}\n\nconst useStyles = () => {\n const { colors } = useTheme()\n\n return StyleSheet.create({\n container: {\n flexDirection: 'row',\n },\n button: {\n width: 42,\n height: 42,\n justifyContent: 'center',\n alignItems: 'center',\n borderRadius: 25,\n backgroundColor: '#eee',\n borderColor: '#aaa',\n borderWidth: 1,\n },\n buttonText: {\n fontSize: 32,\n lineHeight: 32,\n },\n details: {\n flex: 1,\n marginLeft: 10,\n gap: 5,\n },\n progressContainer: {\n height: 5,\n backgroundColor: '#ccc',\n borderRadius: 2.5,\n overflow: 'hidden',\n },\n progressBar: {\n height: '100%',\n backgroundColor: 'blue',\n },\n durationText: {\n fontSize: tokens.fontSizeXs,\n color: colors.textColorDefaultSecondary,\n },\n })\n}\n"]}
@@ -1,5 +1,7 @@
1
1
  import React from 'react';
2
- export declare function ExpandedLink({ attachment }: {
3
- attachment: any;
2
+ import { DenormalizedExpandedLinkAttachmentResource } from '../../../types/resources/denormalized_attachment_resource';
3
+ export declare function ExpandedLink({ attachment, onAttachmentLongPress, }: {
4
+ attachment: DenormalizedExpandedLinkAttachmentResource;
5
+ onAttachmentLongPress: (attachment: DenormalizedExpandedLinkAttachmentResource) => void;
4
6
  }): React.JSX.Element;
5
7
  //# sourceMappingURL=expanded_link.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"expanded_link.d.ts","sourceRoot":"","sources":["../../../../src/components/conversation/attachments/expanded_link.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AAKzB,wBAAgB,YAAY,CAAC,EAAE,UAAU,EAAE,EAAE;IAAE,UAAU,EAAE,GAAG,CAAA;CAAE,qBAwB/D"}
1
+ {"version":3,"file":"expanded_link.d.ts","sourceRoot":"","sources":["../../../../src/components/conversation/attachments/expanded_link.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AAIzB,OAAO,EAAE,0CAA0C,EAAE,MAAM,2DAA2D,CAAA;AAGtH,wBAAgB,YAAY,CAAC,EAC3B,UAAU,EACV,qBAAqB,GACtB,EAAE;IACD,UAAU,EAAE,0CAA0C,CAAA;IACtD,qBAAqB,EAAE,CAAC,UAAU,EAAE,0CAA0C,KAAK,IAAI,CAAA;CACxF,qBA6BA"}
@@ -1,8 +1,9 @@
1
1
  import React from 'react';
2
- import { Image, Linking, Pressable, StyleSheet, Text, View } from 'react-native';
2
+ import { Image, Linking, StyleSheet, Text, View } from 'react-native';
3
3
  import { useTheme } from '../../../hooks';
4
4
  import { tokens } from '../../../vendor/tapestry/tokens';
5
- export function ExpandedLink({ attachment }) {
5
+ import { PlatformPressable } from '@react-navigation/elements';
6
+ export function ExpandedLink({ attachment, onAttachmentLongPress, }) {
6
7
  const styles = useStyles();
7
8
  const { attributes } = attachment;
8
9
  const { url, title, description, imageUrl, imageHeight, imageWidth } = attributes;
@@ -11,13 +12,13 @@ export function ExpandedLink({ attachment }) {
11
12
  if (url)
12
13
  Linking.openURL(url);
13
14
  }
14
- return (<Pressable style={styles.container} onPress={openUrl}>
15
+ return (<PlatformPressable style={styles.container} onPress={openUrl} onLongPress={() => onAttachmentLongPress(attachment)} accessibilityHint="Long press for more options">
15
16
  {imageUrl && (<Image source={{ uri: imageUrl }} style={[styles.image, { aspectRatio }]} alt={title}/>)}
16
17
  {(title || description) && (<View style={styles.textWrapper}>
17
18
  {title && <Text style={styles.title}>{title}</Text>}
18
19
  {description && <Text style={styles.description}>{description}</Text>}
19
20
  </View>)}
20
- </Pressable>);
21
+ </PlatformPressable>);
21
22
  }
22
23
  const useStyles = () => {
23
24
  const { colors } = useTheme();
@@ -1 +1 @@
1
- {"version":3,"file":"expanded_link.js","sourceRoot":"","sources":["../../../../src/components/conversation/attachments/expanded_link.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AACzB,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,cAAc,CAAA;AAChF,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAA;AACzC,OAAO,EAAE,MAAM,EAAE,MAAM,iCAAiC,CAAA;AAExD,MAAM,UAAU,YAAY,CAAC,EAAE,UAAU,EAAuB;IAC9D,MAAM,MAAM,GAAG,SAAS,EAAE,CAAA;IAC1B,MAAM,EAAE,UAAU,EAAE,GAAG,UAAU,CAAA;IACjC,MAAM,EAAE,GAAG,EAAE,KAAK,EAAE,WAAW,EAAE,QAAQ,EAAE,WAAW,EAAE,UAAU,EAAE,GAAG,UAAU,CAAA;IAEjF,MAAM,WAAW,GAAG,UAAU,IAAI,WAAW,CAAC,CAAC,CAAC,UAAU,GAAG,WAAW,CAAC,CAAC,CAAC,CAAC,CAAA;IAE5E,KAAK,UAAU,OAAO;QACpB,IAAI,GAAG;YAAE,OAAO,CAAC,OAAO,CAAC,GAAG,CAAC,CAAA;IAC/B,CAAC;IAED,OAAO,CACL,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC,OAAO,CAAC,CAAC,OAAO,CAAC,CACnD;MAAA,CAAC,QAAQ,IAAI,CACX,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,EAAE,GAAG,EAAE,QAAQ,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,EAAE,EAAE,WAAW,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,KAAK,CAAC,EAAG,CACzF,CACD;MAAA,CAAC,CAAC,KAAK,IAAI,WAAW,CAAC,IAAI,CACzB,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,MAAM,CAAC,WAAW,CAAC,CAC9B;UAAA,CAAC,KAAK,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,EAAE,IAAI,CAAC,CACnD;UAAA,CAAC,WAAW,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,MAAM,CAAC,WAAW,CAAC,CAAC,CAAC,WAAW,CAAC,EAAE,IAAI,CAAC,CACvE;QAAA,EAAE,IAAI,CAAC,CACR,CACH;IAAA,EAAE,SAAS,CAAC,CACb,CAAA;AACH,CAAC;AAED,MAAM,SAAS,GAAG,GAAG,EAAE;IACrB,MAAM,EAAE,MAAM,EAAE,GAAG,QAAQ,EAAE,CAAA;IAE7B,OAAO,UAAU,CAAC,MAAM,CAAC;QACvB,SAAS,EAAE,EAAE;QACb,KAAK,EAAE;YACL,YAAY,EAAE,CAAC;SAChB;QACD,WAAW,EAAE;YACX,GAAG,EAAE,CAAC;YACN,OAAO,EAAE,CAAC;SACX;QACD,KAAK,EAAE;YACL,QAAQ,EAAE,MAAM,CAAC,UAAU;YAC3B,UAAU,EAAE,MAAM,CAAC,gBAAgB;YACnC,KAAK,EAAE,MAAM,CAAC,uBAAuB;SACtC;QACD,WAAW,EAAE;YACX,QAAQ,EAAE,MAAM,CAAC,UAAU;YAC3B,KAAK,EAAE,MAAM,CAAC,uBAAuB;SACtC;KACF,CAAC,CAAA;AACJ,CAAC,CAAA","sourcesContent":["import React from 'react'\nimport { Image, Linking, Pressable, StyleSheet, Text, View } from 'react-native'\nimport { useTheme } from '../../../hooks'\nimport { tokens } from '../../../vendor/tapestry/tokens'\n\nexport function ExpandedLink({ attachment }: { attachment: any }) {\n const styles = useStyles()\n const { attributes } = attachment\n const { url, title, description, imageUrl, imageHeight, imageWidth } = attributes\n\n const aspectRatio = imageWidth && imageHeight ? imageWidth / imageHeight : 1\n\n async function openUrl() {\n if (url) Linking.openURL(url)\n }\n\n return (\n <Pressable style={styles.container} onPress={openUrl}>\n {imageUrl && (\n <Image source={{ uri: imageUrl }} style={[styles.image, { aspectRatio }]} alt={title} />\n )}\n {(title || description) && (\n <View style={styles.textWrapper}>\n {title && <Text style={styles.title}>{title}</Text>}\n {description && <Text style={styles.description}>{description}</Text>}\n </View>\n )}\n </Pressable>\n )\n}\n\nconst useStyles = () => {\n const { colors } = useTheme()\n\n return StyleSheet.create({\n container: {},\n image: {\n borderRadius: 8,\n },\n textWrapper: {\n gap: 4,\n padding: 8,\n },\n title: {\n fontSize: tokens.fontSizeSm,\n fontWeight: tokens.fontWeightMedium,\n color: colors.textColorDefaultPrimary,\n },\n description: {\n fontSize: tokens.fontSizeXs,\n color: colors.textColorDefaultPrimary,\n },\n })\n}\n"]}
1
+ {"version":3,"file":"expanded_link.js","sourceRoot":"","sources":["../../../../src/components/conversation/attachments/expanded_link.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AACzB,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,cAAc,CAAA;AACrE,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAA;AACzC,OAAO,EAAE,MAAM,EAAE,MAAM,iCAAiC,CAAA;AAExD,OAAO,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAA;AAE9D,MAAM,UAAU,YAAY,CAAC,EAC3B,UAAU,EACV,qBAAqB,GAItB;IACC,MAAM,MAAM,GAAG,SAAS,EAAE,CAAA;IAC1B,MAAM,EAAE,UAAU,EAAE,GAAG,UAAU,CAAA;IACjC,MAAM,EAAE,GAAG,EAAE,KAAK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M,SAAS,GAAG,GAAG,EAAE;IACrB,MAAM,EAAE,MAAM,EAAE,GAAG,QAAQ,EAAE,CAAA;IAE7B,OAAO,UAAU,CAAC,MAAM,CAAC;QACvB,SAAS,EAAE,EAAE;QACb,KAAK,EAAE;YACL,YAAY,EAAE,CAAC;SAChB;QACD,WAAW,EAAE;YACX,GAAG,EAAE,CAAC;YACN,OAAO,EAAE,CAAC;SACX;QACD,KAAK,EAAE;YACL,QAAQ,EAAE,MAAM,CAAC,UAAU;YAC3B,UAAU,EAAE,MAAM,CAAC,gBAAgB;YACnC,KAAK,EAAE,MAAM,CAAC,uBAAuB;SACtC;QACD,WAAW,EAAE;YACX,QAAQ,EAAE,MAAM,CAAC,UAAU;YAC3B,KAAK,EAAE,MAAM,CAAC,uBAAuB;SACtC;KACF,CAAC,CAAA;AACJ,CAAC,CAAA","sourcesContent":["import React from 'react'\nimport { Image, Linking, StyleSheet, Text, View } from 'react-native'\nimport { useTheme } from '../../../hooks'\nimport { tokens } from '../../../vendor/tapestry/tokens'\nimport { DenormalizedExpandedLinkAttachmentResource } from '../../../types/resources/denormalized_attachment_resource'\nimport { PlatformPressable } from '@react-navigation/elements'\n\nexport function ExpandedLink({\n attachment,\n onAttachmentLongPress,\n}: {\n attachment: DenormalizedExpandedLinkAttachmentResource\n onAttachmentLongPress: (attachment: DenormalizedExpandedLinkAttachmentResource) => void\n}) {\n const styles = useStyles()\n const { attributes } = attachment\n const { url, title, description, imageUrl, imageHeight, imageWidth } = attributes\n\n const aspectRatio = imageWidth && imageHeight ? imageWidth / imageHeight : 1\n\n async function openUrl() {\n if (url) Linking.openURL(url)\n }\n\n return (\n <PlatformPressable\n style={styles.container}\n onPress={openUrl}\n onLongPress={() => onAttachmentLongPress(attachment)}\n accessibilityHint=\"Long press for more options\"\n >\n {imageUrl && (\n <Image source={{ uri: imageUrl }} style={[styles.image, { aspectRatio }]} alt={title} />\n )}\n {(title || description) && (\n <View style={styles.textWrapper}>\n {title && <Text style={styles.title}>{title}</Text>}\n {description && <Text style={styles.description}>{description}</Text>}\n </View>\n )}\n </PlatformPressable>\n )\n}\n\nconst useStyles = () => {\n const { colors } = useTheme()\n\n return StyleSheet.create({\n container: {},\n image: {\n borderRadius: 8,\n },\n textWrapper: {\n gap: 4,\n padding: 8,\n },\n title: {\n fontSize: tokens.fontSizeSm,\n fontWeight: tokens.fontWeightMedium,\n color: colors.textColorDefaultPrimary,\n },\n description: {\n fontSize: tokens.fontSizeXs,\n color: colors.textColorDefaultPrimary,\n },\n })\n}\n"]}
@@ -1,7 +1,8 @@
1
1
  import React from 'react';
2
2
  import { DenormalizedMessageAttachmentResource } from '../../../types/resources/denormalized_attachment_resource';
3
- export declare function GenericFileAttachment({ attachment, }: {
3
+ export declare function GenericFileAttachment({ attachment, onAttachmentLongPress, }: {
4
4
  attachment: DenormalizedMessageAttachmentResource;
5
+ onAttachmentLongPress: (attachment: DenormalizedMessageAttachmentResource) => void;
5
6
  }): React.JSX.Element;
6
7
  export declare function getAttachmentIconName(type: string): "general.outlinedImageFile" | "general.outlinedVideoFile" | "general.outlinedMusicFile" | "general.outlinedPdfFile" | "general.outlinedGenericFile";
7
8
  //# sourceMappingURL=generic_file_attachment.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"generic_file_attachment.d.ts","sourceRoot":"","sources":["../../../../src/components/conversation/attachments/generic_file_attachment.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AAEzB,OAAO,EAAE,qCAAqC,EAAE,MAAM,2DAA2D,CAAA;AAMjH,wBAAgB,qBAAqB,CAAC,EACpC,UAAU,GACX,EAAE;IACD,UAAU,EAAE,qCAAqC,CAAA;CAClD,qBAuBA;AA4BD,wBAAgB,qBAAqB,CAAC,IAAI,EAAE,MAAM,uJAWjD"}
1
+ {"version":3,"file":"generic_file_attachment.d.ts","sourceRoot":"","sources":["../../../../src/components/conversation/attachments/generic_file_attachment.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AAEzB,OAAO,EAAE,qCAAqC,EAAE,MAAM,2DAA2D,CAAA;AAOjH,wBAAgB,qBAAqB,CAAC,EACpC,UAAU,EACV,qBAAqB,GACtB,EAAE;IACD,UAAU,EAAE,qCAAqC,CAAA;IACjD,qBAAqB,EAAE,CAAC,UAAU,EAAE,qCAAqC,KAAK,IAAI,CAAA;CACnF,qBA0BA;AA4BD,wBAAgB,qBAAqB,CAAC,IAAI,EAAE,MAAM,uJAWjD"}
@@ -1,15 +1,16 @@
1
1
  import React from 'react';
2
- import { Pressable, StyleSheet, View } from 'react-native';
2
+ import { StyleSheet, View } from 'react-native';
3
3
  import { AttachmentCard, AttachmentCardTitle } from './attachment_card';
4
4
  import { Icon } from '../../display';
5
5
  import { DownloadAttachmentButton } from './download_attachment_button';
6
6
  import { useTheme } from '../../../hooks';
7
- export function GenericFileAttachment({ attachment, }) {
7
+ import { PlatformPressable } from '@react-navigation/elements';
8
+ export function GenericFileAttachment({ attachment, onAttachmentLongPress, }) {
8
9
  const styles = useStyles();
9
10
  const { url, filename, contentType } = attachment.attributes;
10
11
  const iconName = getAttachmentIconName(contentType);
11
12
  const fileTypeLabel = contentType === 'application/pdf' ? 'PDF' : 'file';
12
- return (<Pressable>
13
+ return (<PlatformPressable onLongPress={() => onAttachmentLongPress(attachment)} accessibilityHint="Long press for more options">
13
14
  <AttachmentCard>
14
15
  <View style={styles.container}>
15
16
  <View style={styles.stack}>
@@ -19,7 +20,7 @@ export function GenericFileAttachment({ attachment, }) {
19
20
  <DownloadAttachmentButton to={url} filename={filename} title={`Download ${fileTypeLabel}`}/>
20
21
  </View>
21
22
  </AttachmentCard>
22
- </Pressable>);
23
+ </PlatformPressable>);
23
24
  }
24
25
  const useStyles = () => {
25
26
  const { colors } = useTheme();
@@ -1 +1 @@
1
- {"version":3,"file":"generic_file_attachment.js","sourceRoot":"","sources":["../../../../src/components/conversation/attachments/generic_file_attachment.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK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ACH,CAAC;AAED,MAAM,SAAS,GAAG,GAAG,EAAE;IACrB,MAAM,EAAE,MAAM,EAAE,GAAG,QAAQ,EAAE,CAAA;IAE7B,OAAO,UAAU,CAAC,MAAM,CAAC;QACvB,SAAS,EAAE;YACT,OAAO,EAAE,CAAC;YACV,GAAG,EAAE,CAAC;YACN,aAAa,EAAE,KAAK;YACpB,UAAU,EAAE,QAAQ;YACpB,cAAc,EAAE,eAAe;YAC/B,SAAS,EAAE,EAAE;SACd;QACD,KAAK,EAAE;YACL,GAAG,EAAE,CAAC;YACN,aAAa,EAAE,KAAK;YACpB,UAAU,EAAE,QAAQ;YACpB,QAAQ,EAAE,KAAK;SAChB;QACD,IAAI,EAAE;YACJ,KAAK,EAAE,MAAM,CAAC,uBAAuB;YACrC,KAAK,EAAE,EAAE;YACT,MAAM,EAAE,EAAE;SACX;KACF,CAAC,CAAA;AACJ,CAAC,CAAA;AAED,MAAM,UAAU,qBAAqB,CAAC,IAAY;IAChD,MAAM,OAAO,GAAG,IAAI,CAAC,UAAU,CAAC,QAAQ,CAAC,CAAA;IACzC,MAAM,OAAO,GAAG,IAAI,CAAC,UAAU,CAAC,QAAQ,CAAC,CAAA;IACzC,MAAM,OAAO,GAAG,IAAI,CAAC,UAAU,CAAC,QAAQ,CAAC,CAAA;IACzC,MAAM,KAAK,GAAG,IAAI,KAAK,iBAAiB,CAAA;IAExC,IAAI,OAAO;QAAE,OAAO,2BAA2B,CAAA;IAC/C,IAAI,OAAO;QAAE,OAAO,2BAA2B,CAAA;IAC/C,IAAI,OAAO;QAAE,OAAO,2BAA2B,CAAA;IAC/C,IAAI,KAAK;QAAE,OAAO,yBAAyB,CAAA;IAC3C,OAAO,6BAA6B,CAAA;AACtC,CAAC","sourcesContent":["import React from 'react'\nimport { Pressable, StyleSheet, View } from 'react-native'\nimport { DenormalizedMessageAttachmentResource } from '../../../types/resources/denormalized_attachment_resource'\nimport { AttachmentCard, AttachmentCardTitle } from './attachment_card'\nimport { Icon } from '../../display'\nimport { DownloadAttachmentButton } from './download_attachment_button'\nimport { useTheme } from '../../../hooks'\n\nexport function GenericFileAttachment({\n attachment,\n}: {\n attachment: DenormalizedMessageAttachmentResource\n}) {\n const styles = useStyles()\n const { url, filename, contentType } = attachment.attributes\n const iconName = getAttachmentIconName(contentType)\n const fileTypeLabel = contentType === 'application/pdf' ? 'PDF' : 'file'\n\n return (\n <Pressable>\n <AttachmentCard>\n <View style={styles.container}>\n <View style={styles.stack}>\n <Icon name={iconName} />\n <AttachmentCardTitle>{filename}</AttachmentCardTitle>\n </View>\n <DownloadAttachmentButton\n to={url}\n filename={filename}\n title={`Download ${fileTypeLabel}`}\n />\n </View>\n </AttachmentCard>\n </Pressable>\n )\n}\n\nconst useStyles = () => {\n const { colors } = useTheme()\n\n return StyleSheet.create({\n container: {\n padding: 8,\n gap: 4,\n flexDirection: 'row',\n alignItems: 'center',\n justifyContent: 'space-between',\n minHeight: 48,\n },\n stack: {\n gap: 4,\n flexDirection: 'row',\n alignItems: 'center',\n maxWidth: '70%',\n },\n icon: {\n color: colors.textColorDefaultPrimary,\n width: 24,\n height: 24,\n },\n })\n}\n\nexport function getAttachmentIconName(type: string) {\n const isImage = type.startsWith('image/')\n const isVideo = type.startsWith('video/')\n const isAudio = type.startsWith('audio/')\n const isPdf = type === 'application/pdf'\n\n if (isImage) return 'general.outlinedImageFile'\n if (isVideo) return 'general.outlinedVideoFile'\n if (isAudio) return 'general.outlinedMusicFile'\n if (isPdf) return 'general.outlinedPdfFile'\n return 'general.outlinedGenericFile'\n}\n"]}
1
+ {"version":3,"file":"generic_file_attachment.js","sourceRoot":"","sources":["../../../../src/components/conversation/attachments/generic_file_attachment.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AACzB,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,cAAc,CAAA;AAE/C,OAAO,EAAE,cAAc,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAA;AACvE,OAAO,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,CAAA;AACH,CAAC;AAED,MAAM,SAAS,GAAG,GAAG,EAAE;IACrB,MAAM,EAAE,MAAM,EAAE,GAAG,QAAQ,EAAE,CAAA;IAE7B,OAAO,UAAU,CAAC,MAAM,CAAC;QACvB,SAAS,EAAE;YACT,OAAO,EAAE,CAAC;YACV,GAAG,EAAE,CAAC;YACN,aAAa,EAAE,KAAK;YACpB,UAAU,EAAE,QAAQ;YACpB,cAAc,EAAE,eAAe;YAC/B,SAAS,EAAE,EAAE;SACd;QACD,KAAK,EAAE;YACL,GAAG,EAAE,CAAC;YACN,aAAa,EAAE,KAAK;YACpB,UAAU,EAAE,QAAQ;YACpB,QAAQ,EAAE,KAAK;SAChB;QACD,IAAI,EAAE;YACJ,KAAK,EAAE,MAAM,CAAC,uBAAuB;YACrC,KAAK,EAAE,EAAE;YACT,MAAM,EAAE,EAAE;SACX;KACF,CAAC,CAAA;AACJ,CAAC,CAAA;AAED,MAAM,UAAU,qBAAqB,CAAC,IAAY;IAChD,MAAM,OAAO,GAAG,IAAI,CAAC,UAAU,CAAC,QAAQ,CAAC,CAAA;IACzC,MAAM,OAAO,GAAG,IAAI,CAAC,UAAU,CAAC,QAAQ,CAAC,CAAA;IACzC,MAAM,OAAO,GAAG,IAAI,CAAC,UAAU,CAAC,QAAQ,CAAC,CAAA;IACzC,MAAM,KAAK,GAAG,IAAI,KAAK,iBAAiB,CAAA;IAExC,IAAI,OAAO;QAAE,OAAO,2BAA2B,CAAA;IAC/C,IAAI,OAAO;QAAE,OAAO,2BAA2B,CAAA;IAC/C,IAAI,OAAO;QAAE,OAAO,2BAA2B,CAAA;IAC/C,IAAI,KAAK;QAAE,OAAO,yBAAyB,CAAA;IAC3C,OAAO,6BAA6B,CAAA;AACtC,CAAC","sourcesContent":["import React from 'react'\nimport { StyleSheet, View } from 'react-native'\nimport { DenormalizedMessageAttachmentResource } from '../../../types/resources/denormalized_attachment_resource'\nimport { AttachmentCard, AttachmentCardTitle } from './attachment_card'\nimport { Icon } from '../../display'\nimport { DownloadAttachmentButton } from './download_attachment_button'\nimport { useTheme } from '../../../hooks'\nimport { PlatformPressable } from '@react-navigation/elements'\n\nexport function GenericFileAttachment({\n attachment,\n onAttachmentLongPress,\n}: {\n attachment: DenormalizedMessageAttachmentResource\n onAttachmentLongPress: (attachment: DenormalizedMessageAttachmentResource) => void\n}) {\n const styles = useStyles()\n const { url, filename, contentType } = attachment.attributes\n const iconName = getAttachmentIconName(contentType)\n const fileTypeLabel = contentType === 'application/pdf' ? 'PDF' : 'file'\n\n return (\n <PlatformPressable\n onLongPress={() => onAttachmentLongPress(attachment)}\n accessibilityHint=\"Long press for more options\"\n >\n <AttachmentCard>\n <View style={styles.container}>\n <View style={styles.stack}>\n <Icon name={iconName} />\n <AttachmentCardTitle>{filename}</AttachmentCardTitle>\n </View>\n <DownloadAttachmentButton\n to={url}\n filename={filename}\n title={`Download ${fileTypeLabel}`}\n />\n </View>\n </AttachmentCard>\n </PlatformPressable>\n )\n}\n\nconst useStyles = () => {\n const { colors } = useTheme()\n\n return StyleSheet.create({\n container: {\n padding: 8,\n gap: 4,\n flexDirection: 'row',\n alignItems: 'center',\n justifyContent: 'space-between',\n minHeight: 48,\n },\n stack: {\n gap: 4,\n flexDirection: 'row',\n alignItems: 'center',\n maxWidth: '70%',\n },\n icon: {\n color: colors.textColorDefaultPrimary,\n width: 24,\n height: 24,\n },\n })\n}\n\nexport function getAttachmentIconName(type: string) {\n const isImage = type.startsWith('image/')\n const isVideo = type.startsWith('video/')\n const isAudio = type.startsWith('audio/')\n const isPdf = type === 'application/pdf'\n\n if (isImage) return 'general.outlinedImageFile'\n if (isVideo) return 'general.outlinedVideoFile'\n if (isAudio) return 'general.outlinedMusicFile'\n if (isPdf) return 'general.outlinedPdfFile'\n return 'general.outlinedGenericFile'\n}\n"]}
@@ -1,6 +1,7 @@
1
1
  import React from 'react';
2
2
  import { DenormalizedGiphyAttachmentResource } from '../../../types/resources/denormalized_attachment_resource';
3
- export declare function GiphyAttachment({ attachment, }: {
3
+ export declare function GiphyAttachment({ attachment, onAttachmentLongPress, }: {
4
4
  attachment: DenormalizedGiphyAttachmentResource;
5
+ onAttachmentLongPress: (attachment: DenormalizedGiphyAttachmentResource) => void;
5
6
  }): React.JSX.Element;
6
7
  //# sourceMappingURL=giphy_attachment.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"giphy_attachment.d.ts","sourceRoot":"","sources":["../../../../src/components/conversation/attachments/giphy_attachment.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AAIzB,OAAO,EAAE,mCAAmC,EAAE,MAAM,2DAA2D,CAAA;AAE/G,wBAAgB,eAAe,CAAC,EAC9B,UAAU,GACX,EAAE;IACD,UAAU,EAAE,mCAAmC,CAAA;CAChD,qBAwBA"}
1
+ {"version":3,"file":"giphy_attachment.d.ts","sourceRoot":"","sources":["../../../../src/components/conversation/attachments/giphy_attachment.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AAIzB,OAAO,EAAE,mCAAmC,EAAE,MAAM,2DAA2D,CAAA;AAE/G,wBAAgB,eAAe,CAAC,EAC9B,UAAU,EACV,qBAAqB,GACtB,EAAE;IACD,UAAU,EAAE,mCAAmC,CAAA;IAC/C,qBAAqB,EAAE,CAAC,UAAU,EAAE,mCAAmC,KAAK,IAAI,CAAA;CACjF,qBA6BA"}
@@ -2,7 +2,7 @@ import React from 'react';
2
2
  import { Text, Image, StyleSheet, Linking, Pressable } from 'react-native';
3
3
  import { tokens } from '../../../vendor/tapestry/tokens';
4
4
  import { useTheme } from '../../../hooks';
5
- export function GiphyAttachment({ attachment, }) {
5
+ export function GiphyAttachment({ attachment, onAttachmentLongPress, }) {
6
6
  const styles = useStyles();
7
7
  const { title, titleLink, giphy } = attachment;
8
8
  const { url, width, height } = giphy.fixedWidth;
@@ -12,7 +12,7 @@ export function GiphyAttachment({ attachment, }) {
12
12
  Linking.openURL(titleLink);
13
13
  }
14
14
  }
15
- return (<Pressable onPress={handlePress} style={styles.container}>
15
+ return (<Pressable onPress={handlePress} style={styles.container} onLongPress={() => onAttachmentLongPress(attachment)} accessibilityHint="Long press for more options">
16
16
  <Image source={{ uri: url }} style={[styles.image, { width, height }]} accessibilityLabel={title}/>
17
17
  <Text style={styles.link}>
18
18
  <Text style={styles.tag}>/giphy</Text> {title}
@@ -1 +1 @@
1
- {"version":3,"file":"giphy_attachment.js","sourceRoot":"","sources":["../../../../src/components/conversation/attachments/giphy_attachment.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AACzB,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,UAAU,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAA;AAC1E,OAAO,EAAE,MAAM,EAAE,MAAM,iCAAiC,CAAA;AACxD,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAA;AAGzC,MAAM,UAAU,eAAe,CAAC,EAC9B,UAAU,GAGX;IACC,MAAM,MAAM,GAAG,SAAS,EAAE,CAAA;IAC1B,MAAM,EAAE,KAAK,EAAE,SAAS,EAAE,KAAK,EAAE,GAAG,UAAU,CAAA;IAC9C,MAAM,EAAE,GAAG,EAAE,KAAK,EAAE,MAAM,EAAE,GAAG,KAAK,CAAC,UAAU,CAAA;IAE/C,SAAS,WAAW;QAClB,IAAI,SAAS,EAAE,CAAC;YACd,6CAA6C;YAC7C,OAAO,CAAC,OAAO,CAAC,SAAS,CAAC,CAAA;QAC5B,CAAC;IACH,CAAC;IAED,OAAO,CACL,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC,WAAW,CAAC,CAAC,KAAK,CAAC,CAAC,MAAM,CAAC,SAAS,CAAC,CACvD;MAAA,CAAC,KAAK,CACJ,MAAM,CAAC,CAAC,EAAE,GAAG,EAAE,GAAG,EAAE,CAAC,CACrB,KAAK,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE,CAAC,CAAC,CACzC,kBAAkB,CAAC,CAAC,KAAK,CAAC,EAE5B;MAAA,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,CACvB;QAAA,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,IAAI,CAAE,CAAA,CAAC,KAAK,CAC/C;MAAA,EAAE,IAAI,CACR;IAAA,EAAE,SAAS,CAAC,CACb,CAAA;AACH,CAAC;AAED,MAAM,SAAS,GAAG,GAAG,EAAE;IACrB,MAAM,EAAE,MAAM,EAAE,GAAG,QAAQ,EAAE,CAAA;IAC7B,OAAO,UAAU,CAAC,MAAM,CAAC;QACvB,SAAS,EAAE;YACT,GAAG,EAAE,CAAC;SACP;QACD,KAAK,EAAE;YACL,YAAY,EAAE,CAAC;SAChB;QACD,IAAI,EAAE;YACJ,QAAQ,EAAE,MAAM,CAAC,UAAU;YAC3B,KAAK,EAAE,MAAM,CAAC,2BAA2B;YACzC,iBAAiB,EAAE,CAAC;YACpB,eAAe,EAAE,CAAC;SACnB;QACD,GAAG,EAAE;YACH,UAAU,EAAE,MAAM;SACnB;KACF,CAAC,CAAA;AACJ,CAAC,CAAA","sourcesContent":["import React from 'react'\nimport { Text, Image, StyleSheet, Linking, Pressable } from 'react-native'\nimport { tokens } from '../../../vendor/tapestry/tokens'\nimport { useTheme } from '../../../hooks'\nimport { DenormalizedGiphyAttachmentResource } from '../../../types/resources/denormalized_attachment_resource'\n\nexport function GiphyAttachment({\n attachment,\n}: {\n attachment: DenormalizedGiphyAttachmentResource\n}) {\n const styles = useStyles()\n const { title, titleLink, giphy } = attachment\n const { url, width, height } = giphy.fixedWidth\n\n function handlePress() {\n if (titleLink) {\n // Open Giphy link in the default web browser\n Linking.openURL(titleLink)\n }\n }\n\n return (\n <Pressable onPress={handlePress} style={styles.container}>\n <Image\n source={{ uri: url }}\n style={[styles.image, { width, height }]}\n accessibilityLabel={title}\n />\n <Text style={styles.link}>\n <Text style={styles.tag}>/giphy</Text> {title}\n </Text>\n </Pressable>\n )\n}\n\nconst useStyles = () => {\n const { colors } = useTheme()\n return StyleSheet.create({\n container: {\n gap: 4,\n },\n image: {\n borderRadius: 8,\n },\n link: {\n fontSize: tokens.fontSizeSm,\n color: colors.fillColorInteractionDefault,\n paddingHorizontal: 8,\n paddingVertical: 6,\n },\n tag: {\n fontWeight: 'bold',\n },\n })\n}\n"]}
1
+ {"version":3,"file":"giphy_attachment.js","sourceRoot":"","sources":["../../../../src/components/conversation/attachments/giphy_attachment.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AACzB,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,UAAU,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAA;AAC1E,OAAO,EAAE,MAAM,EAAE,MAAM,iCAAiC,CAAA;AACxD,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAA;AAGzC,MAAM,UAAU,eAAe,CAAC,EAC9B,UAAU,EACV,qBAAqB,GAItB;IACC,MAAM,MAAM,GAAG,SAAS,EAAE,CAAA;IAC1B,MAAM,EAAE,KAAK,EAAE,SAAS,EAAE,KAAK,EAAE,GAAG,UAAU,CAAA;IAC9C,MAAM,EAAE,GAAG,EAAE,KAAK,EAAE,MAAM,EAAE,GAAG,KAAK,CAAC,UAAU,CAAA;IAE/C,SAAS,WAAW;QAClB,IAAI,SAAS,EAAE,CAAC;YACd,6CAA6C;YAC7C,OAAO,CAAC,OAAO,CAAC,SAAS,CAAC,CAAA;QAC5B,CAAC;IACH,CAAC;IAED,OAAO,CACL,CAAC,SAAS,CACR,OAAO,CAAC,CAAC,WAAW,CAAC,CACrB,KAAK,CAAC,CAAC,MAAM,CAAC,SAAS,CAAC,CACxB,WAAW,CAAC,CAAC,GAAG,EAAE,CAAC,qBAAqB,CAAC,UAAU,CAAC,CAAC,CACrD,iBAAiB,CAAC,6BAA6B,CAE/C;MAAA,CAAC,KAAK,CACJ,MAAM,CAAC,CAAC,EAAE,GAAG,EAAE,GAAG,EAAE,CAAC,CACrB,KAAK,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE,CAAC,CAAC,CACzC,kBAAkB,CAAC,CAAC,KAAK,CAAC,EAE5B;MAAA,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,CACvB;QAAA,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,IAAI,CAAE,CAAA,CAAC,KAAK,CAC/C;MAAA,EAAE,IAAI,CACR;IAAA,EAAE,SAAS,CAAC,CACb,CAAA;AACH,CAAC;AAED,MAAM,SAAS,GAAG,GAAG,EAAE;IACrB,MAAM,EAAE,MAAM,EAAE,GAAG,QAAQ,EAAE,CAAA;IAC7B,OAAO,UAAU,CAAC,MAAM,CAAC;QACvB,SAAS,EAAE;YACT,GAAG,EAAE,CAAC;SACP;QACD,KAAK,EAAE;YACL,YAAY,EAAE,CAAC;SAChB;QACD,IAAI,EAAE;YACJ,QAAQ,EAAE,MAAM,CAAC,UAAU;YAC3B,KAAK,EAAE,MAAM,CAAC,2BAA2B;YACzC,iBAAiB,EAAE,CAAC;YACpB,eAAe,EAAE,CAAC;SACnB;QACD,GAAG,EAAE;YACH,UAAU,EAAE,MAAM;SACnB;KACF,CAAC,CAAA;AACJ,CAAC,CAAA","sourcesContent":["import React from 'react'\nimport { Text, Image, StyleSheet, Linking, Pressable } from 'react-native'\nimport { tokens } from '../../../vendor/tapestry/tokens'\nimport { useTheme } from '../../../hooks'\nimport { DenormalizedGiphyAttachmentResource } from '../../../types/resources/denormalized_attachment_resource'\n\nexport function GiphyAttachment({\n attachment,\n onAttachmentLongPress,\n}: {\n attachment: DenormalizedGiphyAttachmentResource\n onAttachmentLongPress: (attachment: DenormalizedGiphyAttachmentResource) => void\n}) {\n const styles = useStyles()\n const { title, titleLink, giphy } = attachment\n const { url, width, height } = giphy.fixedWidth\n\n function handlePress() {\n if (titleLink) {\n // Open Giphy link in the default web browser\n Linking.openURL(titleLink)\n }\n }\n\n return (\n <Pressable\n onPress={handlePress}\n style={styles.container}\n onLongPress={() => onAttachmentLongPress(attachment)}\n accessibilityHint=\"Long press for more options\"\n >\n <Image\n source={{ uri: url }}\n style={[styles.image, { width, height }]}\n accessibilityLabel={title}\n />\n <Text style={styles.link}>\n <Text style={styles.tag}>/giphy</Text> {title}\n </Text>\n </Pressable>\n )\n}\n\nconst useStyles = () => {\n const { colors } = useTheme()\n return StyleSheet.create({\n container: {\n gap: 4,\n },\n image: {\n borderRadius: 8,\n },\n link: {\n fontSize: tokens.fontSizeSm,\n color: colors.fillColorInteractionDefault,\n paddingHorizontal: 8,\n paddingVertical: 6,\n },\n tag: {\n fontWeight: 'bold',\n },\n })\n}\n"]}
@@ -1,5 +1,12 @@
1
1
  import React from 'react';
2
- export declare function ImageAttachment({ attachment }: {
3
- attachment: any;
2
+ import { DenormalizedMessageAttachmentResource } from '../../../types/resources/denormalized_attachment_resource';
3
+ export type MetaProps = {
4
+ authorName: string;
5
+ createdAt: string;
6
+ };
7
+ export declare function ImageAttachment({ attachment, metaProps, onAttachmentLongPress, }: {
8
+ attachment: DenormalizedMessageAttachmentResource;
9
+ metaProps: MetaProps;
10
+ onAttachmentLongPress: (attachment: DenormalizedMessageAttachmentResource) => void;
4
11
  }): React.JSX.Element;
5
12
  //# sourceMappingURL=image_attachment.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"image_attachment.d.ts","sourceRoot":"","sources":["../../../../src/components/conversation/attachments/image_attachment.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AAGzB,wBAAgB,eAAe,CAAC,EAAE,UAAU,EAAE,EAAE;IAAE,UAAU,EAAE,GAAG,CAAA;CAAE,qBAelE"}
1
+ {"version":3,"file":"image_attachment.d.ts","sourceRoot":"","sources":["../../../../src/components/conversation/attachments/image_attachment.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAyC,MAAM,OAAO,CAAA;AA2B7D,OAAO,EAAE,qCAAqC,EAAE,MAAM,2DAA2D,CAAA;AAKjH,MAAM,MAAM,SAAS,GAAG;IACtB,UAAU,EAAE,MAAM,CAAA;IAClB,SAAS,EAAE,MAAM,CAAA;CAClB,CAAA;AAED,wBAAgB,eAAe,CAAC,EAC9B,UAAU,EACV,SAAS,EACT,qBAAqB,GACtB,EAAE;IACD,UAAU,EAAE,qCAAqC,CAAA;IACjD,SAAS,EAAE,SAAS,CAAA;IACpB,qBAAqB,EAAE,CAAC,UAAU,EAAE,qCAAqC,KAAK,IAAI,CAAA;CACnF,qBA4DA"}
@@ -1,23 +1,138 @@
1
- import React from 'react';
2
- import { View, Image, StyleSheet } from 'react-native';
3
- export function ImageAttachment({ attachment }) {
4
- const styles = useStyles();
1
+ import React, { useCallback, useMemo, useState } from 'react';
2
+ import { StyleSheet, Modal, useWindowDimensions, SafeAreaView, View, Linking, } from 'react-native';
3
+ import { Gesture, GestureDetector, GestureHandlerRootView, } from 'react-native-gesture-handler';
4
+ import { runOnJS, useAnimatedStyle, useSharedValue, withTiming, } from 'react-native-reanimated';
5
+ import { tokens } from '../../../vendor/tapestry/tokens';
6
+ import { IconButton, Image, Heading, Text } from '../../display';
7
+ import colorFunction from 'color';
8
+ import { formatDatePreview } from '../../../utils/date';
9
+ import { PlatformPressable } from '@react-navigation/elements';
10
+ const PAN_THRESHOLD_PX = 300;
11
+ export function ImageAttachment({ attachment, metaProps, onAttachmentLongPress, }) {
5
12
  const { attributes } = attachment;
6
13
  const { url, urlMedium, filename, metadata = {} } = attributes;
7
- const width = metadata.width || 100;
8
- const height = metadata.height || 100;
9
- return (<View style={styles.container}>
10
- <Image source={{ uri: urlMedium || url }} style={[styles.image, { aspectRatio: width / height }]} accessibilityLabel={filename}/>
11
- </View>);
14
+ const styles = useStyles({ imageWidth: metadata.width, imageHeight: metadata.height });
15
+ const [visible, setVisible] = useState(false);
16
+ // shared values run on the native UI thread and prevents clogging up the JS thread
17
+ const dismissY = useSharedValue(0);
18
+ const opacity = useSharedValue(1);
19
+ const resetAnimations = useCallback(() => {
20
+ dismissY.value = withTiming(0);
21
+ opacity.value = withTiming(1);
22
+ }, [dismissY, opacity]);
23
+ const handleCloseModal = useCallback(() => {
24
+ setVisible(false);
25
+ resetAnimations();
26
+ }, [setVisible, resetAnimations]);
27
+ const panGesture = Gesture.Pan()
28
+ .onUpdate(e => {
29
+ dismissY.value = e.translationY;
30
+ opacity.value = 1 - Math.abs(e.translationY) / PAN_THRESHOLD_PX;
31
+ })
32
+ .onEnd(() => {
33
+ runOnJS(handleCloseModal)(); // Ensures we can call a JS function
34
+ });
35
+ const animatedImageStyle = useAnimatedStyle(() => ({
36
+ transform: [{ translateY: dismissY.value }],
37
+ opacity: opacity.value,
38
+ }));
39
+ return (<>
40
+ <PlatformPressable style={styles.container} onPress={() => setVisible(true)} onLongPress={() => onAttachmentLongPress(attachment)} accessibilityHint="Long press for more options">
41
+ <Image source={{ uri: urlMedium || url }} style={{ borderRadius: 8 }} wrapperStyle={styles.imageWrapper} alt={filename}/>
42
+ </PlatformPressable>
43
+ <LightboxModal visible={visible} handleCloseModal={handleCloseModal} uri={urlMedium || url} metaProps={metaProps} panGesture={panGesture} animatedImageStyle={animatedImageStyle}/>
44
+ </>);
12
45
  }
13
- const useStyles = () => {
46
+ const LightboxModal = ({ uri, visible, handleCloseModal, metaProps, panGesture, animatedImageStyle, }) => {
47
+ const styles = useStyles();
48
+ const { authorName, createdAt } = metaProps;
49
+ const handleOpenInBrowser = () => {
50
+ Linking.openURL(uri);
51
+ };
52
+ return (<Modal visible={visible} transparent animationType="fade" onRequestClose={handleCloseModal}>
53
+ <SafeAreaView style={styles.modal}>
54
+ <GestureHandlerRootView>
55
+ <GestureDetector gesture={panGesture}>
56
+ <Image source={{ uri }} loadingBackgroundStyles={styles.lightboxImageLoading} style={styles.lightboxImage} animatedImageStyle={animatedImageStyle} resizeMode="contain" animated={true} alt=""/>
57
+ </GestureDetector>
58
+ <View style={styles.actionToolbar} accessibilityRole="toolbar">
59
+ <View style={styles.actionToolbarTextMeta}>
60
+ <Heading variant="h3" style={styles.actionToolbarTitle} numberOfLines={1}>
61
+ {authorName}
62
+ </Heading>
63
+ <Text variant="tertiary" style={styles.actionToolbarSubtitle}>
64
+ {formatDatePreview(createdAt)}
65
+ </Text>
66
+ </View>
67
+ <IconButton onPress={handleOpenInBrowser} name="general.newWindow" accessibilityRole="link" accessibilityLabel="Open image in browser" accessibilityHint="Image can be downloaded and shared through the browser." style={styles.actionButton} iconStyle={styles.actionButtonIcon} size="lg"/>
68
+ <IconButton onPress={handleCloseModal} name="general.x" accessibilityLabel="Close image" style={styles.actionButton} iconStyle={styles.actionButtonIcon}/>
69
+ </View>
70
+ </GestureHandlerRootView>
71
+ </SafeAreaView>
72
+ </Modal>);
73
+ };
74
+ const useStyles = ({ imageWidth = 100, imageHeight = 100 } = {}) => {
75
+ const { width: windowWidth } = useWindowDimensions();
76
+ const backgroundColor = tokens.colorNeutral7;
77
+ const transparentBackgroundColor = useMemo(() => colorFunction(backgroundColor).alpha(0.8).toString(), [backgroundColor]);
14
78
  return StyleSheet.create({
15
79
  container: {
16
80
  maxWidth: '100%',
17
81
  },
82
+ imageWrapper: {
83
+ minWidth: 200,
84
+ aspectRatio: imageWidth / imageHeight,
85
+ },
18
86
  image: {
19
87
  borderRadius: 8,
20
- minWidth: 200,
88
+ },
89
+ modal: {
90
+ flex: 1,
91
+ backgroundColor,
92
+ justifyContent: 'center',
93
+ alignItems: 'center',
94
+ },
95
+ lightboxImage: {
96
+ height: '100%',
97
+ width: windowWidth,
98
+ backgroundColor,
99
+ },
100
+ lightboxImageLoading: {
101
+ backgroundColor,
102
+ },
103
+ actionToolbar: {
104
+ width: '100%',
105
+ position: 'absolute',
106
+ top: 0,
107
+ flexDirection: 'row',
108
+ alignItems: 'center',
109
+ gap: 20,
110
+ paddingHorizontal: 16,
111
+ paddingTop: 16,
112
+ paddingBottom: 8,
113
+ backgroundColor: transparentBackgroundColor,
114
+ },
115
+ actionToolbarTextMeta: {
116
+ flex: 1,
117
+ },
118
+ actionToolbarTitle: {
119
+ marginRight: 'auto',
120
+ flexShrink: 1,
121
+ color: tokens.colorNeutral88,
122
+ },
123
+ actionToolbarSubtitle: {
124
+ color: tokens.colorNeutral68,
125
+ },
126
+ actionButton: {
127
+ backgroundColor,
128
+ height: 40,
129
+ width: 40,
130
+ borderRadius: 50,
131
+ borderWidth: 1,
132
+ borderColor: tokens.colorNeutral24,
133
+ },
134
+ actionButtonIcon: {
135
+ color: tokens.colorNeutral88,
21
136
  },
22
137
  });
23
138
  };
@@ -1 +1 @@
1
- {"version":3,"file":"image_attachment.js","sourceRoot":"","sources":["../../../../src/components/conversation/attachments/image_attachment.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AACzB,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,UAAU,EAAE,MAAM,cAAc,CAAA;AAEtD,MAAM,UAAU,eAAe,CAAC,EAAE,UAAU,EAAuB;IACjE,MAAM,MAAM,GAAG,SAAS,EAAE,CAAA;IAC1B,MAAM,EAAE,UAAU,EAAE,GAAG,UAAU,CAAA;IACjC,MAAM,EAAE,GAAG,EAAE,SAAS,EAAE,QAAQ,EAAE,QAAQ,GAAG,EAAE,EAAE,GAAG,UAAU,CAAA;IAC9D,MAAM,KAAK,GAAG,QAAQ,CAAC,KAAK,IAAI,GAAG,CAAA;IACnC,MAAM,MAAM,GAAG,QAAQ,CAAC,MAAM,IAAI,GAAG,CAAA;IACrC,OAAO,CACL,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,MAAM,CAAC,SAAS,CAAC,CAC5B;MAAA,CAAC,KAAK,CACJ,MAAM,CAAC,CAAC,EAAE,GAAG,EAAE,SAAS,IAAI,GAAG,EAAE,CAAC,CAClC,KAAK,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,EAAE,EAAE,WAAW,EAAE,KAAK,GAAG,MAAM,EAAE,CAAC,CAAC,CACvD,kBAAkB,CAAC,CAAC,QAAQ,CAAC,EAEjC;IAAA,EAAE,IAAI,CAAC,CACR,CAAA;AACH,CAAC;AAED,MAAM,SAAS,GAAG,GAAG,EAAE;IACrB,OAAO,UAAU,CAAC,MAAM,CAAC;QACvB,SAAS,EAAE;YACT,QAAQ,EAAE,MAAM;SACjB;QACD,KAAK,EAAE;YACL,YAAY,EAAE,CAAC;YACf,QAAQ,EAAE,GAAG;SACd;KACF,CAAC,CAAA;AACJ,CAAC,CAAA","sourcesContent":["import React from 'react'\nimport { View, Image, StyleSheet } from 'react-native'\n\nexport function ImageAttachment({ attachment }: { attachment: any }) {\n const styles = useStyles()\n const { attributes } = attachment\n const { url, urlMedium, filename, metadata = {} } = attributes\n const width = metadata.width || 100\n const height = metadata.height || 100\n return (\n <View style={styles.container}>\n <Image\n source={{ uri: urlMedium || url }}\n style={[styles.image, { aspectRatio: width / height }]}\n accessibilityLabel={filename}\n />\n </View>\n )\n}\n\nconst useStyles = () => {\n return StyleSheet.create({\n container: {\n maxWidth: '100%',\n },\n image: {\n borderRadius: 8,\n minWidth: 200,\n },\n })\n}\n"]}
1
+ {"version":3,"file":"image_attachment.js","sourceRoot":"","sources":["../../../../src/components/conversation/attachments/image_attachment.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,WAAW,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAA;AAC7D,OAAO,EACL,UAAU,EACV,KAAK,EACL,mBAAmB,EACnB,YAAY,EACZ,IAAI,EACJ,OAAO,GAER,MAAM,cAAc,CAAA;AACrB,OAAO,EACL,OAAO,EACP,eAAe,EACf,sBAAsB,GAEvB,MAAM,8BAA8B,CAAA;AACrC,OAAO,EACL,OAAO,EACP,gBAAgB,EAChB,cAAc,EACd,UAAU,GAEX,MAAM,yBAAyB,C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AC7B;QACD,YAAY,EAAE;YACZ,eAAe;YACf,MAAM,EAAE,EAAE;YACV,KAAK,EAAE,EAAE;YACT,YAAY,EAAE,EAAE;YAChB,WAAW,EAAE,CAAC;YACd,WAAW,EAAE,MAAM,CAAC,cAAc;SACnC;QACD,gBAAgB,EAAE;YAChB,KAAK,EAAE,MAAM,CAAC,cAAc;SAC7B;KACF,CAAC,CAAA;AACJ,CAAC,CAAA","sourcesContent":["import React, { useCallback, useMemo, useState } from 'react'\nimport {\n StyleSheet,\n Modal,\n useWindowDimensions,\n SafeAreaView,\n View,\n Linking,\n ImageStyle,\n} from 'react-native'\nimport {\n Gesture,\n GestureDetector,\n GestureHandlerRootView,\n type PanGesture,\n} from 'react-native-gesture-handler'\nimport {\n runOnJS,\n useAnimatedStyle,\n useSharedValue,\n withTiming,\n type AnimatedStyle,\n} from 'react-native-reanimated'\nimport { tokens } from '../../../vendor/tapestry/tokens'\nimport { IconButton, Image, Heading, Text } from '../../display'\nimport colorFunction from 'color'\nimport { formatDatePreview } from '../../../utils/date'\nimport { DenormalizedMessageAttachmentResource } from '../../../types/resources/denormalized_attachment_resource'\nimport { PlatformPressable } from '@react-navigation/elements'\n\nconst PAN_THRESHOLD_PX = 300\n\nexport type MetaProps = {\n authorName: string\n createdAt: string\n}\n\nexport function ImageAttachment({\n attachment,\n metaProps,\n onAttachmentLongPress,\n}: {\n attachment: DenormalizedMessageAttachmentResource\n metaProps: MetaProps\n onAttachmentLongPress: (attachment: DenormalizedMessageAttachmentResource) => void\n}) {\n const { attributes } = attachment\n const { url, urlMedium, filename, metadata = {} } = attributes\n\n const styles = useStyles({ imageWidth: metadata.width, imageHeight: metadata.height })\n const [visible, setVisible] = useState(false)\n\n // shared values run on the native UI thread and prevents clogging up the JS thread\n const dismissY = useSharedValue(0)\n const opacity = useSharedValue(1)\n\n const resetAnimations = useCallback(() => {\n dismissY.value = withTiming(0)\n opacity.value = withTiming(1)\n }, [dismissY, opacity])\n\n const handleCloseModal = useCallback(() => {\n setVisible(false)\n resetAnimations()\n }, [setVisible, resetAnimations])\n\n const panGesture = Gesture.Pan()\n .onUpdate(e => {\n dismissY.value = e.translationY\n opacity.value = 1 - Math.abs(e.translationY) / PAN_THRESHOLD_PX\n })\n .onEnd(() => {\n runOnJS(handleCloseModal)() // Ensures we can call a JS function\n })\n\n const animatedImageStyle = useAnimatedStyle(() => ({\n transform: [{ translateY: dismissY.value }],\n opacity: opacity.value,\n }))\n\n return (\n <>\n <PlatformPressable\n style={styles.container}\n onPress={() => setVisible(true)}\n onLongPress={() => onAttachmentLongPress(attachment)}\n accessibilityHint=\"Long press for more options\"\n >\n <Image\n source={{ uri: urlMedium || url }}\n style={{ borderRadius: 8 }}\n wrapperStyle={styles.imageWrapper}\n alt={filename}\n />\n </PlatformPressable>\n <LightboxModal\n visible={visible}\n handleCloseModal={handleCloseModal}\n uri={urlMedium || url}\n metaProps={metaProps}\n panGesture={panGesture}\n animatedImageStyle={animatedImageStyle}\n />\n </>\n )\n}\n\ninterface LightboxModalProps {\n visible: boolean\n handleCloseModal: () => void\n uri: string\n metaProps: MetaProps\n panGesture: PanGesture\n animatedImageStyle: AnimatedStyle<ImageStyle>\n}\n\nconst LightboxModal = ({\n uri,\n visible,\n handleCloseModal,\n metaProps,\n panGesture,\n animatedImageStyle,\n}: LightboxModalProps) => {\n const styles = useStyles()\n\n const { authorName, createdAt } = metaProps\n\n const handleOpenInBrowser = () => {\n Linking.openURL(uri)\n }\n\n return (\n <Modal visible={visible} transparent animationType=\"fade\" onRequestClose={handleCloseModal}>\n <SafeAreaView style={styles.modal}>\n <GestureHandlerRootView>\n <GestureDetector gesture={panGesture}>\n <Image\n source={{ uri }}\n loadingBackgroundStyles={styles.lightboxImageLoading}\n style={styles.lightboxImage}\n animatedImageStyle={animatedImageStyle}\n resizeMode=\"contain\"\n animated={true}\n alt=\"\"\n />\n </GestureDetector>\n <View style={styles.actionToolbar} accessibilityRole=\"toolbar\">\n <View style={styles.actionToolbarTextMeta}>\n <Heading variant=\"h3\" style={styles.actionToolbarTitle} numberOfLines={1}>\n {authorName}\n </Heading>\n <Text variant=\"tertiary\" style={styles.actionToolbarSubtitle}>\n {formatDatePreview(createdAt)}\n </Text>\n </View>\n <IconButton\n onPress={handleOpenInBrowser}\n name=\"general.newWindow\"\n accessibilityRole=\"link\"\n accessibilityLabel=\"Open image in browser\"\n accessibilityHint=\"Image can be downloaded and shared through the browser.\"\n style={styles.actionButton}\n iconStyle={styles.actionButtonIcon}\n size=\"lg\"\n />\n <IconButton\n onPress={handleCloseModal}\n name=\"general.x\"\n accessibilityLabel=\"Close image\"\n style={styles.actionButton}\n iconStyle={styles.actionButtonIcon}\n />\n </View>\n </GestureHandlerRootView>\n </SafeAreaView>\n </Modal>\n )\n}\n\ninterface UseStylesProps {\n imageWidth?: number\n imageHeight?: number\n}\n\nconst useStyles = ({ imageWidth = 100, imageHeight = 100 }: UseStylesProps = {}) => {\n const { width: windowWidth } = useWindowDimensions()\n const backgroundColor = tokens.colorNeutral7\n const transparentBackgroundColor = useMemo(\n () => colorFunction(backgroundColor).alpha(0.8).toString(),\n [backgroundColor]\n )\n\n return StyleSheet.create({\n container: {\n maxWidth: '100%',\n },\n imageWrapper: {\n minWidth: 200,\n aspectRatio: imageWidth / imageHeight,\n },\n image: {\n borderRadius: 8,\n },\n modal: {\n flex: 1,\n backgroundColor,\n justifyContent: 'center',\n alignItems: 'center',\n },\n lightboxImage: {\n height: '100%',\n width: windowWidth,\n backgroundColor,\n },\n lightboxImageLoading: {\n backgroundColor,\n },\n actionToolbar: {\n width: '100%',\n position: 'absolute',\n top: 0,\n flexDirection: 'row',\n alignItems: 'center',\n gap: 20,\n paddingHorizontal: 16,\n paddingTop: 16,\n paddingBottom: 8,\n backgroundColor: transparentBackgroundColor,\n },\n actionToolbarTextMeta: {\n flex: 1,\n },\n actionToolbarTitle: {\n marginRight: 'auto',\n flexShrink: 1,\n color: tokens.colorNeutral88,\n },\n actionToolbarSubtitle: {\n color: tokens.colorNeutral68,\n },\n actionButton: {\n backgroundColor,\n height: 40,\n width: 40,\n borderRadius: 50,\n borderWidth: 1,\n borderColor: tokens.colorNeutral24,\n },\n actionButtonIcon: {\n color: tokens.colorNeutral88,\n },\n })\n}\n"]}
@@ -1,6 +1,7 @@
1
1
  import React from 'react';
2
2
  import { DenormalizedMessageAttachmentResource } from '../../../types/resources/denormalized_attachment_resource';
3
- export declare function VideoAttachment({ attachment, }: {
3
+ export declare function VideoAttachment({ attachment, onAttachmentLongPress, }: {
4
4
  attachment: DenormalizedMessageAttachmentResource;
5
+ onAttachmentLongPress: (attachment: DenormalizedMessageAttachmentResource) => void;
5
6
  }): React.JSX.Element;
6
7
  //# 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;AAKjH,wBAAgB,eAAe,CAAC,EAC9B,UAAU,GACX,EAAE;IACD,UAAU,EAAE,qCAAqC,CAAA;CAClD,qBAgDA"}
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;AAMjH,wBAAgB,eAAe,CAAC,EAC9B,UAAU,EACV,qBAAqB,GACtB,EAAE;IACD,UAAU,EAAE,qCAAqC,CAAA;IACjD,qBAAqB,EAAE,CAAC,UAAU,EAAE,qCAAqC,KAAK,IAAI,CAAA;CACnF,qBAmDA"}
@@ -1,9 +1,10 @@
1
1
  import React, { useRef, useState } from 'react';
2
- import { View, StyleSheet, Pressable } from 'react-native';
2
+ import { View, StyleSheet } from 'react-native';
3
3
  import { MESSAGE_ATTACHMENT_WIDTH_SINGLE } from './constants';
4
4
  import { IconButton } from '../../display';
5
5
  import { Video } from '../../../utils/native_adapters';
6
- export function VideoAttachment({ attachment, }) {
6
+ import { PlatformPressable } from '@react-navigation/elements';
7
+ export function VideoAttachment({ attachment, onAttachmentLongPress, }) {
7
8
  const { attributes } = attachment;
8
9
  const { width = MESSAGE_ATTACHMENT_WIDTH_SINGLE, height = MESSAGE_ATTACHMENT_WIDTH_SINGLE } = attributes.metadata || {};
9
10
  const { url } = attributes;
@@ -22,12 +23,12 @@ export function VideoAttachment({ attachment, }) {
22
23
  }
23
24
  const viewRef = useRef(null);
24
25
  return (<View style={styles.container} ref={viewRef}>
25
- <Pressable onPress={openVideo}>
26
+ <PlatformPressable onLongPress={() => onAttachmentLongPress(attachment)} accessibilityHint="Long press for more options">
26
27
  <Video.Player ref={videoRef} source={{ uri: url }} aspectRatio={width / height} style={styles.video} onFullscreenPlayerWillDismiss={onFullscreenPlayerWillDismiss}/>
27
28
  {!isOpen && (<View style={styles.playButtonWrapper}>
28
29
  <IconButton name="services.play" size="md" accessibilityLabel="Play Video" onPress={openVideo} style={styles.button}/>
29
30
  </View>)}
30
- </Pressable>
31
+ </PlatformPressable>
31
32
  </View>);
32
33
  }
33
34
  const styles = StyleSheet.create({
@@ -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,SAAS,EAAE,MAAM,cAAc,CAAA;AAE1D,OAAO,EAAE,+BAA+B,EAAE,MAAM,aAAa,CAAA;AAC7D,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAA;AAC1C,OAAO,EAAE,KAAK,EAAqB,MAAM,gCAAgC,CAAA;AAEzE,MAAM,UAAU,eAAe,CAAC,E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AA,CAAC,CAAC,MAAM,IAAI,CACV,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,MAAM,CAAC,iBAAiB,CAAC,CACpC;YAAA,CAAC,UAAU,CACT,IAAI,CAAC,eAAe,CACpB,IAAI,CAAC,IAAI,CACT,kBAAkB,CAAC,YAAY,CAC/B,OAAO,CAAC,CAAC,SAAS,CAAC,CACnB,KAAK,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC,EAEzB;UAAA,EAAE,IAAI,CAAC,CACR,CACH;MAAA,EAAE,SAAS,CACb;IAAA,EAAE,IAAI,CAAC,CACR,CAAA;AACH,CAAC;AAED,MAAM,MAAM,GAAG,UAAU,CAAC,MAAM,CAAC;IAC/B,SAAS,EAAE;QACT,QAAQ,EAAE,GAAG;QACb,SAAS,EAAE,GAAG;KACf;IACD,KAAK,EAAE;QACL,KAAK,EAAE,MAAM;QACb,MAAM,EAAE,MAAM;QACd,eAAe,EAAE,OAAO;QACxB,YAAY,EAAE,CAAC;KAChB;IACD,iBAAiB,EAAE;QACjB,QAAQ,EAAE,UAAU;QACpB,GAAG,EAAE,CAAC;QACN,IAAI,EAAE,CAAC;QACP,KAAK,EAAE,CAAC;QACR,MAAM,EAAE,CAAC;QACT,cAAc,EAAE,QAAQ;QACxB,UAAU,EAAE,QAAQ;KACrB;IACD,MAAM,EAAE;QACN,KAAK,EAAE,EAAE;QACT,MAAM,EAAE,EAAE;QACV,cAAc,EAAE,QAAQ;QACxB,UAAU,EAAE,QAAQ;QACpB,YAAY,EAAE,EAAE;QAChB,eAAe,EAAE,MAAM;QACvB,WAAW,EAAE,MAAM;QACnB,WAAW,EAAE,CAAC;KACf;CACF,CAAC,CAAA","sourcesContent":["import React, { useRef, useState } from 'react'\nimport { View, StyleSheet, Pressable } from 'react-native'\nimport { DenormalizedMessageAttachmentResource } from '../../../types/resources/denormalized_attachment_resource'\nimport { MESSAGE_ATTACHMENT_WIDTH_SINGLE } from './constants'\nimport { IconButton } from '../../display'\nimport { Video, VideoPlayerHandle } from '../../../utils/native_adapters'\n\nexport function VideoAttachment({\n attachment,\n}: {\n attachment: DenormalizedMessageAttachmentResource\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 <Pressable onPress={openVideo}>\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.playButtonWrapper}>\n <IconButton\n name=\"services.play\"\n size=\"md\"\n accessibilityLabel=\"Play Video\"\n onPress={openVideo}\n style={styles.button}\n />\n </View>\n )}\n </Pressable>\n </View>\n )\n}\n\nconst styles = StyleSheet.create({\n container: {\n maxWidth: 320,\n maxHeight: 320,\n },\n video: {\n width: '100%',\n height: 'auto',\n backgroundColor: 'black',\n borderRadius: 8,\n },\n playButtonWrapper: {\n position: 'absolute',\n top: 0,\n left: 0,\n right: 0,\n bottom: 0,\n justifyContent: 'center',\n alignItems: 'center',\n },\n button: {\n width: 42,\n height: 42,\n justifyContent: 'center',\n alignItems: 'center',\n borderRadius: 25,\n backgroundColor: '#eee',\n borderColor: '#aaa',\n borderWidth: 1,\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,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M,EAAE;QACN,KAAK,EAAE,EAAE;QACT,MAAM,EAAE,EAAE;QACV,cAAc,EAAE,QAAQ;QACxB,UAAU,EAAE,QAAQ;QACpB,YAAY,EAAE,EAAE;QAChB,eAAe,EAAE,MAAM;QACvB,WAAW,EAAE,MAAM;QACnB,WAAW,EAAE,CAAC;KACf;CACF,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 { IconButton } from '../../display'\nimport { Video, VideoPlayerHandle } from '../../../utils/native_adapters'\nimport { PlatformPressable } from '@react-navigation/elements'\n\nexport function VideoAttachment({\n attachment,\n onAttachmentLongPress,\n}: {\n attachment: DenormalizedMessageAttachmentResource\n onAttachmentLongPress: (attachment: DenormalizedMessageAttachmentResource) => void\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 onLongPress={() => onAttachmentLongPress(attachment)}\n accessibilityHint=\"Long press for more options\"\n >\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.playButtonWrapper}>\n <IconButton\n name=\"services.play\"\n size=\"md\"\n accessibilityLabel=\"Play Video\"\n onPress={openVideo}\n style={styles.button}\n />\n </View>\n )}\n </PlatformPressable>\n </View>\n )\n}\n\nconst styles = StyleSheet.create({\n container: {\n maxWidth: 320,\n maxHeight: 320,\n },\n video: {\n width: '100%',\n height: 'auto',\n backgroundColor: 'black',\n borderRadius: 8,\n },\n playButtonWrapper: {\n position: 'absolute',\n top: 0,\n left: 0,\n right: 0,\n bottom: 0,\n justifyContent: 'center',\n alignItems: 'center',\n },\n button: {\n width: 42,\n height: 42,\n justifyContent: 'center',\n alignItems: 'center',\n borderRadius: 25,\n backgroundColor: '#eee',\n borderColor: '#aaa',\n borderWidth: 1,\n },\n})\n"]}
@@ -0,0 +1,3 @@
1
+ export declare const LeaderDisabledRepliesBanner: () => import("react").JSX.Element;
2
+ export declare const MemberDisabledRepliesBanner: () => import("react").JSX.Element;
3
+ //# sourceMappingURL=disabled_replies_banners.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"disabled_replies_banners.d.ts","sourceRoot":"","sources":["../../../src/components/conversation/disabled_replies_banners.tsx"],"names":[],"mappings":"AAKA,eAAO,MAAM,2BAA2B,mCAEvC,CAAA;AAED,eAAO,MAAM,2BAA2B,mCAQvC,CAAA"}