@planningcenter/chat-react-native 3.16.0-rc.2 → 3.16.0-rc.4

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 (104) hide show
  1. package/build/components/conversation/attachments/giphy_attachment.d.ts.map +1 -1
  2. package/build/components/conversation/attachments/giphy_attachment.js +1 -11
  3. package/build/components/conversation/attachments/giphy_attachment.js.map +1 -1
  4. package/build/components/conversation/message.d.ts +2 -1
  5. package/build/components/conversation/message.d.ts.map +1 -1
  6. package/build/components/conversation/message.js +23 -23
  7. package/build/components/conversation/message.js.map +1 -1
  8. package/build/components/conversation/message_form.d.ts +2 -1
  9. package/build/components/conversation/message_form.d.ts.map +1 -1
  10. package/build/components/conversation/message_form.js +38 -16
  11. package/build/components/conversation/message_form.js.map +1 -1
  12. package/build/components/conversation/reply_connectors.js +1 -1
  13. package/build/components/conversation/reply_connectors.js.map +1 -1
  14. package/build/components/conversation/shadow_message.d.ts +8 -0
  15. package/build/components/conversation/shadow_message.d.ts.map +1 -0
  16. package/build/components/conversation/shadow_message.js +161 -0
  17. package/build/components/conversation/shadow_message.js.map +1 -0
  18. package/build/components/display/icon.d.ts +3 -1
  19. package/build/components/display/icon.d.ts.map +1 -1
  20. package/build/components/display/icon.js +2 -0
  21. package/build/components/display/icon.js.map +1 -1
  22. package/build/components/primitive/avatar_primitive.d.ts +1 -0
  23. package/build/components/primitive/avatar_primitive.d.ts.map +1 -1
  24. package/build/components/primitive/avatar_primitive.js +4 -0
  25. package/build/components/primitive/avatar_primitive.js.map +1 -1
  26. package/build/hooks/index.d.ts +1 -0
  27. package/build/hooks/index.d.ts.map +1 -1
  28. package/build/hooks/index.js +1 -0
  29. package/build/hooks/index.js.map +1 -1
  30. package/build/hooks/use_animated_message_background_color.d.ts +8 -0
  31. package/build/hooks/use_animated_message_background_color.d.ts.map +1 -0
  32. package/build/hooks/use_animated_message_background_color.js +29 -0
  33. package/build/hooks/use_animated_message_background_color.js.map +1 -0
  34. package/build/hooks/use_conversation_messages.d.ts +6 -3
  35. package/build/hooks/use_conversation_messages.d.ts.map +1 -1
  36. package/build/hooks/use_conversation_messages.js +32 -25
  37. package/build/hooks/use_conversation_messages.js.map +1 -1
  38. package/build/hooks/use_message_create_or_update.d.ts +2 -1
  39. package/build/hooks/use_message_create_or_update.d.ts.map +1 -1
  40. package/build/hooks/use_message_create_or_update.js +6 -2
  41. package/build/hooks/use_message_create_or_update.js.map +1 -1
  42. package/build/hooks/use_suspense_api.d.ts +3 -1
  43. package/build/hooks/use_suspense_api.d.ts.map +1 -1
  44. package/build/hooks/use_suspense_api.js +1 -0
  45. package/build/hooks/use_suspense_api.js.map +1 -1
  46. package/build/navigation/index.d.ts +6 -0
  47. package/build/navigation/index.d.ts.map +1 -1
  48. package/build/navigation/index.js +6 -0
  49. package/build/navigation/index.js.map +1 -1
  50. package/build/screens/conversation_screen.d.ts +2 -1
  51. package/build/screens/conversation_screen.d.ts.map +1 -1
  52. package/build/screens/conversation_screen.js +7 -5
  53. package/build/screens/conversation_screen.js.map +1 -1
  54. package/build/screens/message_actions_screen.d.ts +1 -0
  55. package/build/screens/message_actions_screen.d.ts.map +1 -1
  56. package/build/screens/message_actions_screen.js +16 -3
  57. package/build/screens/message_actions_screen.js.map +1 -1
  58. package/build/types/jolt_events/message_events.d.ts +2 -0
  59. package/build/types/jolt_events/message_events.d.ts.map +1 -1
  60. package/build/types/jolt_events/message_events.js.map +1 -1
  61. package/build/types/resources/message.d.ts +2 -0
  62. package/build/types/resources/message.d.ts.map +1 -1
  63. package/build/types/resources/message.js.map +1 -1
  64. package/build/utils/assert_keys_are_numbers.d.ts +2 -0
  65. package/build/utils/assert_keys_are_numbers.d.ts.map +1 -0
  66. package/build/utils/assert_keys_are_numbers.js +12 -0
  67. package/build/utils/assert_keys_are_numbers.js.map +1 -0
  68. package/build/utils/cache/optimistically_create_message.d.ts.map +1 -1
  69. package/build/utils/cache/optimistically_create_message.js +2 -0
  70. package/build/utils/cache/optimistically_create_message.js.map +1 -1
  71. package/build/utils/index.d.ts +2 -0
  72. package/build/utils/index.d.ts.map +1 -1
  73. package/build/utils/index.js +2 -0
  74. package/build/utils/index.js.map +1 -1
  75. package/build/utils/jolt/transform_message_event_data_to_message_resource.d.ts.map +1 -1
  76. package/build/utils/jolt/transform_message_event_data_to_message_resource.js +2 -0
  77. package/build/utils/jolt/transform_message_event_data_to_message_resource.js.map +1 -1
  78. package/build/utils/replies_local_feature_flag.d.ts +2 -0
  79. package/build/utils/replies_local_feature_flag.d.ts.map +1 -0
  80. package/build/utils/replies_local_feature_flag.js +3 -0
  81. package/build/utils/replies_local_feature_flag.js.map +1 -0
  82. package/package.json +2 -2
  83. package/src/components/conversation/attachments/giphy_attachment.tsx +1 -14
  84. package/src/components/conversation/message.tsx +40 -36
  85. package/src/components/conversation/message_form.tsx +85 -15
  86. package/src/components/conversation/reply_connectors.tsx +1 -1
  87. package/src/components/conversation/shadow_message.tsx +274 -0
  88. package/src/components/display/icon.tsx +3 -0
  89. package/src/components/primitive/avatar_primitive.tsx +4 -0
  90. package/src/hooks/index.ts +1 -0
  91. package/src/hooks/use_animated_message_background_color.ts +44 -0
  92. package/src/hooks/use_conversation_messages.ts +45 -25
  93. package/src/hooks/use_message_create_or_update.ts +7 -2
  94. package/src/hooks/use_suspense_api.ts +3 -0
  95. package/src/navigation/index.tsx +6 -0
  96. package/src/screens/conversation_screen.tsx +9 -4
  97. package/src/screens/message_actions_screen.tsx +27 -1
  98. package/src/types/jolt_events/message_events.ts +2 -0
  99. package/src/types/resources/message.ts +2 -0
  100. package/src/utils/assert_keys_are_numbers.ts +13 -0
  101. package/src/utils/cache/optimistically_create_message.ts +2 -0
  102. package/src/utils/index.ts +2 -0
  103. package/src/utils/jolt/transform_message_event_data_to_message_resource.ts +2 -0
  104. package/src/utils/replies_local_feature_flag.ts +2 -0
@@ -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;AAI/G,wBAAgB,eAAe,CAAC,EAC9B,UAAU,EACV,kBAAkB,GACnB,EAAE;IACD,UAAU,EAAE,mCAAmC,CAAA;IAC/C,kBAAkB,EAAE,MAAM,IAAI,CAAA;CAC/B,qBAgCA"}
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;AAK/G,wBAAgB,eAAe,CAAC,EAC9B,UAAU,EACV,kBAAkB,GACnB,EAAE;IACD,UAAU,EAAE,mCAAmC,CAAA;IAC/C,kBAAkB,EAAE,MAAM,IAAI,CAAA;CAC/B,qBAgCA"}
@@ -4,6 +4,7 @@ import { tokens } from '../../../vendor/tapestry/tokens';
4
4
  import { useTheme } from '../../../hooks';
5
5
  import { PlatformPressable } from '@react-navigation/elements';
6
6
  import { Image } from '../../display';
7
+ import { assertKeysAreNumbers } from '../../../utils';
7
8
  export function GiphyAttachment({ attachment, onMessageLongPress, }) {
8
9
  const { colors } = useTheme();
9
10
  const { title, titleLink, giphy } = attachment;
@@ -23,17 +24,6 @@ export function GiphyAttachment({ attachment, onMessageLongPress, }) {
23
24
  </Text>
24
25
  </PlatformPressable>);
25
26
  }
26
- const assertKeysAreNumbers = (obj) => {
27
- return Object.fromEntries(Object.entries(obj).map(([key, value]) => [key, assertNumber(value)]));
28
- };
29
- const assertNumber = (value) => {
30
- if (typeof value === 'number')
31
- return value;
32
- if (typeof value === 'string' && !isNaN(Number(value))) {
33
- return Number(value);
34
- }
35
- return 0;
36
- };
37
27
  const useStyles = ({ imageWidth, imageHeight }) => {
38
28
  const { colors } = useTheme();
39
29
  return StyleSheet.create({
@@ -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,UAAU,EAAE,OAAO,EAAE,MAAM,cAAc,CAAA;AACxD,OAAO,EAAE,MAAM,EAAE,MAAM,iCAAiC,CAAA;AACxD,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAA;AAEzC,OAAO,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAA;AAC9D,OAAO,EAAE,KAAK,EAAE,MAAM,eAAe,CAAA;AAErC,MAAM,UAAU,eAAe,CAAC,EAC9B,UAAU,EACV,kBAAkB,GAInB;IACC,MAAM,EAAE,MAAM,EAAE,GAAG,QAAQ,EAAE,CAAA;IAC7B,MAAM,EAAE,KAAK,EAAE,SAAS,EAAE,KAAK,EAAE,GAAG,UAAU,CAAA;IAC9C,MAAM,EAAE,GAAG,EAAE,GAAG,KAAK,CAAC,UAAU,CAAA;IAChC,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,GAAG,oBAAoB,CAAC,KAAK,CAAC,UAAU,CAAC,CAAA;IAChE,MAAM,MAAM,GAAG,SAAS,CAAC,EAAE,UAAU,EAAE,KAAK,EAAE,WAAW,EAAE,MAAM,EAAE,CAAC,CAAA;IAEpE,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,iBAAiB,CAChB,OAAO,CAAC,CAAC,WAAW,CAAC,CACrB,WAAW,CAAC,CAAC,kBAAkB,CAAC,CAChC,KAAK,CAAC,CAAC,MAAM,CAAC,SAAS,CAAC,CACxB,cAAc,CAAC,CAAC,EAAE,KAAK,EAAE,MAAM,CAAC,oBAAoB,EA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,CAAA;IAC7B,OAAO,UAAU,CAAC,MAAM,CAAC;QACvB,SAAS,EAAE;YACT,GAAG,EAAE,CAAC;SACP;QACD,YAAY,EAAE;YACZ,KAAK,EAAE,MAAM;YACb,WAAW,EAAE,UAAU,GAAG,WAAW;SACtC;QACD,KAAK,EAAE;YACL,YAAY,EAAE,CAAC;SAChB;QACD,IAAI,EAAE;YACJ,QAAQ,EAAE,MAAM,CAAC,UAAU;YAC3B,KAAK,EAAE,MAAM,CAAC,WAAW;YACzB,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, StyleSheet, Linking } from 'react-native'\nimport { tokens } from '../../../vendor/tapestry/tokens'\nimport { useTheme } from '../../../hooks'\nimport { DenormalizedGiphyAttachmentResource } from '../../../types/resources/denormalized_attachment_resource'\nimport { PlatformPressable } from '@react-navigation/elements'\nimport { Image } from '../../display'\n\nexport function GiphyAttachment({\n attachment,\n onMessageLongPress,\n}: {\n attachment: DenormalizedGiphyAttachmentResource\n onMessageLongPress: () => void\n}) {\n const { colors } = useTheme()\n const { title, titleLink, giphy } = attachment\n const { url } = giphy.fixedWidth\n const { width, height } = assertKeysAreNumbers(giphy.fixedWidth)\n const styles = useStyles({ imageWidth: width, imageHeight: height })\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 <PlatformPressable\n onPress={handlePress}\n onLongPress={onMessageLongPress}\n style={styles.container}\n android_ripple={{ color: colors.androidRippleNeutral, foreground: true }}\n >\n <Image\n source={{ uri: url }}\n wrapperStyle={styles.imageWrapper}\n style={styles.image}\n alt={title}\n />\n <Text style={styles.link}>\n <Text style={styles.tag}>/giphy</Text> {title}\n </Text>\n </PlatformPressable>\n )\n}\n\nconst assertKeysAreNumbers = (obj: Object): Record<any, number> => {\n return Object.fromEntries(Object.entries(obj).map(([key, value]) => [key, assertNumber(value)]))\n}\n\nconst assertNumber = (value: string): number => {\n if (typeof value === 'number') return value\n\n if (typeof value === 'string' && !isNaN(Number(value))) {\n return Number(value)\n }\n\n return 0\n}\n\nconst useStyles = ({ imageWidth, imageHeight }: { imageWidth: number; imageHeight: number }) => {\n const { colors } = useTheme()\n return StyleSheet.create({\n container: {\n gap: 4,\n },\n imageWrapper: {\n width: '100%',\n aspectRatio: imageWidth / imageHeight,\n },\n image: {\n borderRadius: 8,\n },\n link: {\n fontSize: tokens.fontSizeSm,\n color: colors.interaction,\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,UAAU,EAAE,OAAO,EAAE,MAAM,cAAc,CAAA;AACxD,OAAO,EAAE,MAAM,EAAE,MAAM,iCAAiC,CAAA;AACxD,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAA;AAEzC,OAAO,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAA;AAC9D,OAAO,EAAE,KAAK,EAAE,MAAM,eAAe,CAAA;AACrC,OAAO,EAAE,oBAAoB,EAAE,MAAM,gBAAgB,CAAA;AAErD,MAAM,UAAU,eAAe,CAAC,EAC9B,UAAU,EACV,kBAAkB,GAInB;IACC,MAAM,EAAE,MAAM,EAAE,GAAG,QAAQ,EAAE,CAAA;IAC7B,MAAM,EAAE,KAAK,EAAE,SAAS,EAAE,KAAK,EAAE,GAAG,UAAU,CAAA;IAC9C,MAAM,EAAE,GAAG,EAAE,GAAG,KAAK,CAAC,UAAU,CAAA;IAChC,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,GAAG,oBAAoB,CAAC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,EAAE;YACZ,KAAK,EAAE,MAAM;YACb,WAAW,EAAE,UAAU,GAAG,WAAW;SACtC;QACD,KAAK,EAAE;YACL,YAAY,EAAE,CAAC;SAChB;QACD,IAAI,EAAE;YACJ,QAAQ,EAAE,MAAM,CAAC,UAAU;YAC3B,KAAK,EAAE,MAAM,CAAC,WAAW;YACzB,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, StyleSheet, Linking } from 'react-native'\nimport { tokens } from '../../../vendor/tapestry/tokens'\nimport { useTheme } from '../../../hooks'\nimport { DenormalizedGiphyAttachmentResource } from '../../../types/resources/denormalized_attachment_resource'\nimport { PlatformPressable } from '@react-navigation/elements'\nimport { Image } from '../../display'\nimport { assertKeysAreNumbers } from '../../../utils'\n\nexport function GiphyAttachment({\n attachment,\n onMessageLongPress,\n}: {\n attachment: DenormalizedGiphyAttachmentResource\n onMessageLongPress: () => void\n}) {\n const { colors } = useTheme()\n const { title, titleLink, giphy } = attachment\n const { url } = giphy.fixedWidth\n const { width, height } = assertKeysAreNumbers(giphy.fixedWidth)\n const styles = useStyles({ imageWidth: width, imageHeight: height })\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 <PlatformPressable\n onPress={handlePress}\n onLongPress={onMessageLongPress}\n style={styles.container}\n android_ripple={{ color: colors.androidRippleNeutral, foreground: true }}\n >\n <Image\n source={{ uri: url }}\n wrapperStyle={styles.imageWrapper}\n style={styles.image}\n alt={title}\n />\n <Text style={styles.link}>\n <Text style={styles.tag}>/giphy</Text> {title}\n </Text>\n </PlatformPressable>\n )\n}\n\nconst useStyles = ({ imageWidth, imageHeight }: { imageWidth: number; imageHeight: number }) => {\n const { colors } = useTheme()\n return StyleSheet.create({\n container: {\n gap: 4,\n },\n imageWrapper: {\n width: '100%',\n aspectRatio: imageWidth / imageHeight,\n },\n image: {\n borderRadius: 8,\n },\n link: {\n fontSize: tokens.fontSizeSm,\n color: colors.interaction,\n paddingHorizontal: 8,\n paddingVertical: 6,\n },\n tag: {\n fontWeight: 'bold',\n },\n })\n}\n"]}
@@ -7,7 +7,8 @@ interface MessageProps extends MessageResource {
7
7
  canDeleteNonAuthoredMessages: boolean;
8
8
  conversation_id: number;
9
9
  latestReadMessageSortKey?: string;
10
+ inReplyScreen?: boolean;
10
11
  }
11
- export declare function Message({ canDeleteNonAuthoredMessages, conversation_id, latestReadMessageSortKey, ...message }: MessageProps): React.JSX.Element;
12
+ export declare function Message({ canDeleteNonAuthoredMessages, conversation_id, latestReadMessageSortKey, inReplyScreen, ...message }: MessageProps): React.JSX.Element;
12
13
  export {};
13
14
  //# sourceMappingURL=message.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"message.d.ts","sourceRoot":"","sources":["../../../src/components/conversation/message.tsx"],"names":[],"mappings":"AACA,OAAO,KAAoB,MAAM,OAAO,CAAA;AAKxC,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAA;AAwB7C;;GAEG;AACH,UAAU,YAAa,SAAQ,eAAe;IAC5C,4BAA4B,EAAE,OAAO,CAAA;IACrC,eAAe,EAAE,MAAM,CAAA;IACvB,wBAAwB,CAAC,EAAE,MAAM,CAAA;CAClC;AAED,wBAAgB,OAAO,CAAC,EACtB,4BAA4B,EAC5B,eAAe,EACf,wBAAwB,EACxB,GAAG,OAAO,EACX,EAAE,YAAY,qBA0Nd"}
1
+ {"version":3,"file":"message.d.ts","sourceRoot":"","sources":["../../../src/components/conversation/message.tsx"],"names":[],"mappings":"AACA,OAAO,KAAoB,MAAM,OAAO,CAAA;AASxC,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAA;AAmB7C;;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;CACxB;AAED,wBAAgB,OAAO,CAAC,EACtB,4BAA4B,EAC5B,eAAe,EACf,wBAAwB,EACxB,aAAa,EACb,GAAG,OAAO,EACX,EAAE,YAAY,qBA0Nd"}
@@ -1,20 +1,21 @@
1
1
  import { useNavigation } from '@react-navigation/native';
2
2
  import React, { useEffect } from 'react';
3
- import { Platform, Pressable, StyleSheet, useWindowDimensions, View } from 'react-native';
3
+ import { Pressable, StyleSheet, useWindowDimensions, View } from 'react-native';
4
4
  import { MessageReaction } from '../../components/conversation/message_reaction';
5
- import { Avatar, Icon, Spinner, Text, TextInlineButton } from '../../components/display';
6
- import { useInteractionGhostBackgroundColor, useTheme } from '../../hooks';
5
+ import { Avatar, Icon, Spinner, Text, TextButton, TextInlineButton } from '../../components/display';
6
+ import { useAnimatedMessageBackgroundColor, useInteractionGhostBackgroundColor, useTheme, } from '../../hooks';
7
7
  import { MessageAttachments } from './message_attachments';
8
8
  import ErrorBoundary from '../page/error_boundary';
9
9
  import { MessageMarkdown } from './message_markdown';
10
10
  import { CONVERSATION_MESSAGE_LIST_PADDING_HORIZONTAL, MESSAGE_AUTHOR_AVATAR_COLUMN_WIDTH, platformFontWeightMedium, } from '../../utils/styles';
11
- import Animated, { useSharedValue, useAnimatedStyle, withTiming, interpolateColor, Easing, } from 'react-native-reanimated';
11
+ import Animated from 'react-native-reanimated';
12
12
  import { useLiveRelativeTime } from '../../hooks/use_live_relative_time';
13
13
  import { MessageReadReceipts } from './message_read_receipts';
14
14
  import { isNewMessage, useMessageCreateOrUpdate } from '../../hooks/use_message_create_or_update';
15
15
  import { Haptic } from '../../utils/native_adapters';
16
16
  import { TheirReplyConnector, MyReplyConnector } from './reply_connectors';
17
- export function Message({ canDeleteNonAuthoredMessages, conversation_id, latestReadMessageSortKey, ...message }) {
17
+ import { REPLIES_FEATURE_ENABLED } from '../../utils';
18
+ export function Message({ canDeleteNonAuthoredMessages, conversation_id, latestReadMessageSortKey, inReplyScreen, ...message }) {
18
19
  const { text, reactionCounts, pending, error } = message;
19
20
  const styles = useMessageStyles(message);
20
21
  const navigation = useNavigation();
@@ -27,6 +28,7 @@ export function Message({ canDeleteNonAuthoredMessages, conversation_id, latestR
27
28
  const isPersisted = !isNewMessage(message);
28
29
  const [temporarilyHidePendingState, setTemporarilyHidePendingState] = React.useState(true);
29
30
  const [messageBubbleHeight, setMessageBubbleHeight] = React.useState(0);
31
+ const { animatedBackgroundColor, handleMessagePressIn, handleMessagePressOut } = useAnimatedMessageBackgroundColor();
30
32
  useEffect(() => {
31
33
  if (pending) {
32
34
  const timer = setTimeout(() => {
@@ -48,23 +50,6 @@ export function Message({ canDeleteNonAuthoredMessages, conversation_id, latestR
48
50
  });
49
51
  }
50
52
  };
51
- const bgFadeProgress = useSharedValue(0);
52
- const pressedColor = Platform.select({
53
- ios: colors.fillColorNeutral050Base,
54
- default: 'transparent',
55
- });
56
- const animatedBackgroundColor = useAnimatedStyle(() => {
57
- const backgroundColor = interpolateColor(bgFadeProgress.value, [0, 1], ['transparent', pressedColor]);
58
- return {
59
- backgroundColor,
60
- };
61
- });
62
- const handlePressIn = () => {
63
- bgFadeProgress.value = withTiming(1, { duration: 300, easing: Easing.inOut(Easing.ease) });
64
- };
65
- const handlePressOut = () => {
66
- bgFadeProgress.value = withTiming(0, { duration: 300, easing: Easing.inOut(Easing.ease) });
67
- };
68
53
  const handleMessageLongPress = () => {
69
54
  if (!isPersisted)
70
55
  return;
@@ -73,6 +58,7 @@ export function Message({ canDeleteNonAuthoredMessages, conversation_id, latestR
73
58
  message_id: message.id,
74
59
  conversation_id,
75
60
  canDeleteNonAuthoredMessages,
61
+ inReplyScreen,
76
62
  });
77
63
  };
78
64
  const handleReactionLongPress = (reaction) => {
@@ -94,6 +80,13 @@ export function Message({ canDeleteNonAuthoredMessages, conversation_id, latestR
94
80
  myMessage: message.mine,
95
81
  });
96
82
  };
83
+ const handleNavigateToReplyPress = () => {
84
+ navigation.navigate('ConversationReply', {
85
+ conversation_id,
86
+ reply_root_id: message.id,
87
+ // TODO: Add a way to pass the reply root author's name
88
+ });
89
+ };
97
90
  const metaProps = {
98
91
  authorName: message.author.name,
99
92
  createdAt: message.createdAt,
@@ -101,7 +94,8 @@ export function Message({ canDeleteNonAuthoredMessages, conversation_id, latestR
101
94
  const renderAuthor = (!message.mine && message.renderAuthor) || false;
102
95
  const messageBottomMargin = message.lastInGroup ? 12 : hasReactions || showMessageMeta ? 8 : 4;
103
96
  const messagePendingLabel = isPersisted ? 'Saving' : 'Sending';
104
- return (<Pressable onLongPress={handleMessageLongPress} onPress={() => setShowMessageMetaToggle(!showMessageMetaToggle)} onPressIn={handlePressIn} onPressOut={handlePressOut} android_ripple={{ color: colors.androidRippleNeutral }} accessibilityHint="Long press to view message actions like reacting and copying.">
97
+ const showReplyCountButton = !inReplyScreen && message.replyRootId === message.id && REPLIES_FEATURE_ENABLED;
98
+ return (<Pressable onLongPress={handleMessageLongPress} onPress={() => setShowMessageMetaToggle(!showMessageMetaToggle)} onPressIn={handleMessagePressIn} onPressOut={handleMessagePressOut} android_ripple={{ color: colors.androidRippleNeutral }} accessibilityHint="Long press to view message actions like reacting and copying.">
105
99
  <Animated.View style={[styles.message, animatedBackgroundColor]}>
106
100
  {!message.mine && (<View>
107
101
  {renderAuthor ? (<Avatar size={'md'} sourceUri={message.author.avatar} style={styles.avatar} maxFontSizeMultiplier={1} minFontSizeMultiplier={1}/>) : (<View style={styles.avatarPlaceholder}/>)}
@@ -117,6 +111,9 @@ export function Message({ canDeleteNonAuthoredMessages, conversation_id, latestR
117
111
  <MessageMarkdown text={text}/>
118
112
  </View>)}
119
113
  </View>
114
+ {showReplyCountButton && (<TextButton variant="footnote" onPress={handleNavigateToReplyPress} style={styles.messageReplyCount} accessibilityHint="Navigates to reply screen for this message" accessibilityRole="link">
115
+ {message.replyCount} replies
116
+ </TextButton>)}
120
117
  {hasReactions && (<View style={styles.messageReactions}>
121
118
  {reactionCounts.map(reaction => (<MessageReaction key={reaction.value} reaction={reaction} onLongPress={handleReactionLongPress} message={message} conversationId={conversation_id}/>))}
122
119
  </View>)}
@@ -183,6 +180,9 @@ const useMessageStyles = ({ mine }) => {
183
180
  gap: 4,
184
181
  justifyContent: mine ? 'flex-end' : 'flex-start',
185
182
  },
183
+ messageReplyCount: {
184
+ alignSelf: mine ? 'flex-end' : 'flex-start',
185
+ },
186
186
  messageMeta: {
187
187
  flexDirection: 'row',
188
188
  alignItems: 'center',
@@ -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;AACxC,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,UAAU,EAAE,mBAAmB,EAAE,IAAI,EAAE,MAAM,cAAc,CAAA;AACzF,OAAO,EAAE,eAAe,EAAE,MAAM,gDAAgD,CAAA;AAChF,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAA;AACxF,OAAO,EAAE,kCAAkC,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAA;AAG1E,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,EAAE,EACf,cAAc,EACd,gBAAgB,EAChB,UAAU,EACV,gBAAgB,EAChB,MAAM,GACP,MAAM,yBAAyB,CAAA;AAChC,OAAO,EAAE,m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AE;YAChB,aAAa,EAAE,KAAK;YACpB,GAAG,EAAE,CAAC;YACN,cAAc,EAAE,IAAI,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,YAAY;SACjD;QACD,WAAW,EAAE;YACX,aAAa,EAAE,KAAK;YACpB,UAAU,EAAE,QAAQ;YACpB,cAAc,EAAE,IAAI,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,YAAY;YAChD,GAAG,EAAE,CAAC;SACP;QACD,UAAU,EAAE;YACV,UAAU,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;KACF,CAAC,CAAA;AACJ,CAAC,CAAA","sourcesContent":["import { useNavigation } from '@react-navigation/native'\nimport React, { useEffect } from 'react'\nimport { Platform, Pressable, StyleSheet, useWindowDimensions, View } from 'react-native'\nimport { MessageReaction } from '../../components/conversation/message_reaction'\nimport { Avatar, Icon, Spinner, Text, TextInlineButton } from '../../components/display'\nimport { useInteractionGhostBackgroundColor, useTheme } 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, {\n useSharedValue,\n useAnimatedStyle,\n withTiming,\n interpolateColor,\n Easing,\n} from 'react-native-reanimated'\nimport { useLiveRelativeTime } from '../../hooks/use_live_relative_time'\nimport { MessageReadReceipts } from './message_read_receipts'\nimport { isNewMessage, useMessageCreateOrUpdate } from '../../hooks/use_message_create_or_update'\nimport { Haptic } from '../../utils/native_adapters'\nimport { TheirReplyConnector, MyReplyConnector } from './reply_connectors'\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}\n\nexport function Message({\n canDeleteNonAuthoredMessages,\n conversation_id,\n latestReadMessageSortKey,\n ...message\n}: MessageProps) {\n const { text, reactionCounts, pending, error } = 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\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 bgFadeProgress = useSharedValue(0)\n const pressedColor = Platform.select({\n ios: colors.fillColorNeutral050Base,\n default: 'transparent',\n })\n const animatedBackgroundColor = useAnimatedStyle(() => {\n const backgroundColor = interpolateColor(\n bgFadeProgress.value,\n [0, 1],\n ['transparent', pressedColor]\n )\n return {\n backgroundColor,\n }\n })\n\n const handlePressIn = () => {\n bgFadeProgress.value = withTiming(1, { duration: 300, easing: Easing.inOut(Easing.ease) })\n }\n\n const handlePressOut = () => {\n bgFadeProgress.value = withTiming(0, { duration: 300, easing: Easing.inOut(Easing.ease) })\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 })\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 metaProps = {\n authorName: message.author.name,\n createdAt: message.createdAt,\n }\n\n const renderAuthor = (!message.mine && message.renderAuthor) || false\n const messageBottomMargin = message.lastInGroup ? 12 : hasReactions || showMessageMeta ? 8 : 4\n const messagePendingLabel = isPersisted ? 'Saving' : 'Sending'\n\n return (\n <Pressable\n onLongPress={handleMessageLongPress}\n onPress={() => setShowMessageMetaToggle(!showMessageMetaToggle)}\n onPressIn={handlePressIn}\n onPressOut={handlePressOut}\n android_ripple={{ color: colors.androidRippleNeutral }}\n accessibilityHint=\"Long press to view message actions like reacting and copying.\"\n >\n <Animated.View style={[styles.message, animatedBackgroundColor]}>\n {!message.mine && (\n <View>\n {renderAuthor ? (\n <Avatar\n size={'md'}\n sourceUri={message.author.avatar}\n style={styles.avatar}\n maxFontSizeMultiplier={1}\n minFontSizeMultiplier={1}\n />\n ) : (\n <View style={styles.avatarPlaceholder} />\n )}\n <TheirReplyConnector message={message} messageBubbleHeight={messageBubbleHeight} />\n </View>\n )}\n <View style={[styles.messageContent, { marginBottom: messageBottomMargin }]}>\n {renderAuthor && <Text variant=\"tertiary\">{message.author.name}</Text>}\n <View\n style={styles.messageBubble}\n onLayout={e => setMessageBubbleHeight(e.nativeEvent.layout.height)}\n >\n <ErrorBoundary>\n <MessageAttachments\n attachments={message.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 </View>\n {hasReactions && (\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 && (\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 {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: 8,\n },\n avatarPlaceholder: {\n width: MESSAGE_AUTHOR_AVATAR_COLUMN_WIDTH, // Same width as avatar\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 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 })\n}\n"]}
1
+ {"version":3,"file":"message.js","sourceRoot":"","sources":["../../../src/components/conversation/message.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,a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T,KAAK,EAAE,MAAM,CAAC,eAAe;SAC9B;QACD,SAAS,EAAE;YACT,KAAK,EAAE,MAAM,CAAC,eAAe;SAC9B;KACF,CAAC,CAAA;AACJ,CAAC,CAAA","sourcesContent":["import { useNavigation } from '@react-navigation/native'\nimport React, { useEffect } from 'react'\nimport { Pressable, StyleSheet, useWindowDimensions, View } 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 { isNewMessage, useMessageCreateOrUpdate } from '../../hooks/use_message_create_or_update'\nimport { Haptic } from '../../utils/native_adapters'\nimport { TheirReplyConnector, MyReplyConnector } from './reply_connectors'\nimport { REPLIES_FEATURE_ENABLED } from '../../utils'\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}\n\nexport function Message({\n canDeleteNonAuthoredMessages,\n conversation_id,\n latestReadMessageSortKey,\n inReplyScreen,\n ...message\n}: MessageProps) {\n const { text, reactionCounts, pending, error } = 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\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 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 })\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 // TODO: Add a way to pass the reply root author's name\n })\n }\n\n const metaProps = {\n authorName: message.author.name,\n createdAt: message.createdAt,\n }\n\n const renderAuthor = (!message.mine && message.renderAuthor) || false\n const messageBottomMargin = message.lastInGroup ? 12 : hasReactions || showMessageMeta ? 8 : 4\n const messagePendingLabel = isPersisted ? 'Saving' : 'Sending'\n const showReplyCountButton =\n !inReplyScreen && message.replyRootId === message.id && REPLIES_FEATURE_ENABLED\n\n return (\n <Pressable\n onLongPress={handleMessageLongPress}\n onPress={() => setShowMessageMetaToggle(!showMessageMetaToggle)}\n onPressIn={handleMessagePressIn}\n onPressOut={handleMessagePressOut}\n android_ripple={{ color: colors.androidRippleNeutral }}\n accessibilityHint=\"Long press to view message actions like reacting and copying.\"\n >\n <Animated.View style={[styles.message, animatedBackgroundColor]}>\n {!message.mine && (\n <View>\n {renderAuthor ? (\n <Avatar\n size={'md'}\n sourceUri={message.author.avatar}\n style={styles.avatar}\n maxFontSizeMultiplier={1}\n minFontSizeMultiplier={1}\n />\n ) : (\n <View style={styles.avatarPlaceholder} />\n )}\n <TheirReplyConnector message={message} messageBubbleHeight={messageBubbleHeight} />\n </View>\n )}\n <View style={[styles.messageContent, { marginBottom: messageBottomMargin }]}>\n {renderAuthor && <Text variant=\"tertiary\">{message.author.name}</Text>}\n <View\n style={styles.messageBubble}\n onLayout={e => setMessageBubbleHeight(e.nativeEvent.layout.height)}\n >\n <ErrorBoundary>\n <MessageAttachments\n attachments={message.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 </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 {message.replyCount} replies\n </TextButton>\n )}\n {hasReactions && (\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 && (\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 {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: 8,\n },\n avatarPlaceholder: {\n width: MESSAGE_AUTHOR_AVATAR_COLUMN_WIDTH, // Same width as avatar\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 })\n}\n"]}
@@ -11,8 +11,9 @@ export declare const MessageForm: {
11
11
  interface MessagesFormRootProps extends ViewProps {
12
12
  conversation: ConversationResource;
13
13
  currentlyEditingMessage?: MessageResource | null;
14
+ replyRootId?: string;
14
15
  }
15
- declare function MessageFormRoot({ conversation, currentlyEditingMessage, children, }: MessagesFormRootProps): React.JSX.Element;
16
+ declare function MessageFormRoot({ conversation, currentlyEditingMessage, children, replyRootId, }: MessagesFormRootProps): React.JSX.Element;
16
17
  declare function MessageFormInput(): React.JSX.Element;
17
18
  declare function MessageFormSubmitBtn(): React.JSX.Element;
18
19
  declare function MessageFormAttachmentPicker(): React.JSX.Element | null;
@@ -1 +1 @@
1
- {"version":3,"file":"message_form.d.ts","sourceRoot":"","sources":["../../../src/components/conversation/message_form.tsx"],"names":[],"mappings":"AAMA,OAAO,KAAuD,MAAM,OAAO,CAAA;AAC3E,OAAO,EAOL,SAAS,EAEV,MAAM,cAAc,CAAA;AAOrB,OAAO,EAAE,oBAAoB,EAAE,eAAe,EAAE,MAAM,aAAa,CAAA;AAoBnE,eAAO,MAAM,WAAW;;;;;;CAOvB,CAAA;AAED,UAAU,qBAAsB,SAAQ,SAAS;IAC/C,YAAY,EAAE,oBAAoB,CAAA;IAClC,uBAAuB,CAAC,EAAE,eAAe,GAAG,IAAI,CAAA;CACjD;AA4BD,iBAAS,eAAe,CAAC,EACvB,YAAY,EACZ,uBAAuB,EACvB,QAAQ,GACT,EAAE,qBAAqB,qBA+JvB;AAkDD,iBAAS,gBAAgB,sBA+CxB;AAcD,iBAAS,oBAAoB,sBAgD5B;AAED,iBAAS,2BAA2B,6BAoFnC;AAED,iBAAS,mBAAmB,6BAkC3B"}
1
+ {"version":3,"file":"message_form.d.ts","sourceRoot":"","sources":["../../../src/components/conversation/message_form.tsx"],"names":[],"mappings":"AAMA,OAAO,KAAuD,MAAM,OAAO,CAAA;AAC3E,OAAO,EAOL,SAAS,EAEV,MAAM,cAAc,CAAA;AAQrB,OAAO,EAAE,oBAAoB,EAAE,eAAe,EAAE,MAAM,aAAa,CAAA;AAyBnE,eAAO,MAAM,WAAW;;;;;;CAOvB,CAAA;AAED,UAAU,qBAAsB,SAAQ,SAAS;IAC/C,YAAY,EAAE,oBAAoB,CAAA;IAClC,uBAAuB,CAAC,EAAE,eAAe,GAAG,IAAI,CAAA;IAChD,WAAW,CAAC,EAAE,MAAM,CAAA;CACrB;AA8BD,iBAAS,eAAe,CAAC,EACvB,YAAY,EACZ,uBAAuB,EACvB,QAAQ,EACR,WAAW,GACZ,EAAE,qBAAqB,qBAkKvB;AAkDD,iBAAS,gBAAgB,sBA+CxB;AAcD,iBAAS,oBAAoB,sBAgD5B;AAED,iBAAS,2BAA2B,6BAoFnC;AAED,iBAAS,mBAAmB,6BAkC3B"}
@@ -1,11 +1,11 @@
1
1
  import { useNavigation, useTheme as useNavigationTheme, useRoute, } from '@react-navigation/native';
2
2
  import React, { useCallback, useContext, useEffect, useState } from 'react';
3
3
  import { Platform, Pressable, ScrollView, StyleSheet, TextInput, View, Keyboard, } from 'react-native';
4
- import { Icon, IconButton, Text, TextButton } from '../../components';
5
- import { useCreateAndroidRippleColor, useTheme, useInteractionGhostBackgroundColor, } from '../../hooks';
4
+ import { Heading, Icon, IconButton, Text, TextButton } from '../../components';
5
+ import { useCreateAndroidRippleColor, useTheme, useInteractionGhostBackgroundColor, useScalableNumberOfLines, } from '../../hooks';
6
6
  import { ChatContext } from '../../contexts/chat_context';
7
7
  import { Haptic, ImagePicker } from '../../utils/native_adapters';
8
- import { platformFontWeightMedium, platformPressedOpacityStyle } from '../../utils';
8
+ import { MAX_FONT_SIZE_MULTIPLIER_LANDMARK, REPLIES_FEATURE_ENABLED, platformFontWeightMedium, platformPressedOpacityStyle, } from '../../utils';
9
9
  import { useAttachmentUploader } from '../../hooks/use_attachment_uploader';
10
10
  import { useMessageDraft } from '../../hooks/use_message_draft';
11
11
  import { MessageFormAttachmentImage } from './message_form/message_form_attachment_image';
@@ -31,10 +31,11 @@ const MessageFormContext = React.createContext({
31
31
  setUsingGiphy: (_usingGiphy) => { },
32
32
  currentlyEditingMessage: null,
33
33
  reset: () => { },
34
+ replyRootId: undefined,
34
35
  });
35
36
  const GIPHY_MAX_LENGTH = 50;
36
37
  const MAX_MESSAGE_LENGTH = 5000;
37
- function MessageFormRoot({ conversation, currentlyEditingMessage, children, }) {
38
+ function MessageFormRoot({ conversation, currentlyEditingMessage, children, replyRootId, }) {
38
39
  const { giphyApiKey } = useContext(ChatContext);
39
40
  const canGiphy = !!giphyApiKey && !currentlyEditingMessage;
40
41
  const styles = useMessageFormStyles();
@@ -49,6 +50,7 @@ function MessageFormRoot({ conversation, currentlyEditingMessage, children, }) {
49
50
  const { status, isPending, reset: resetMutation, mutateAsync, } = useMessageCreateOrUpdate({
50
51
  conversationId: conversation.id,
51
52
  message: currentlyEditingMessage || undefined,
53
+ replyRootId,
52
54
  });
53
55
  const attachmentUploader = useAttachmentUploader({
54
56
  conversationId: conversation.id,
@@ -171,9 +173,11 @@ function MessageFormRoot({ conversation, currentlyEditingMessage, children, }) {
171
173
  attachmentUploader,
172
174
  currentlyEditingMessage,
173
175
  reset,
176
+ replyRootId,
174
177
  }}>
175
178
  <View style={styles.container}>
176
179
  <EditingIndicator />
180
+ <ReplyIndicator />
177
181
  <View style={styles.textInputContainer}>{children}</View>
178
182
  </View>
179
183
  </MessageFormContext.Provider>);
@@ -327,19 +331,31 @@ function MessageFormCommands() {
327
331
  }
328
332
  function EditingIndicator() {
329
333
  const { currentlyEditingMessage, reset } = React.useContext(MessageFormContext);
330
- const styles = useMessageFormStyles();
331
334
  if (!currentlyEditingMessage) {
332
335
  return null;
333
336
  }
334
- return (<View style={styles.editingIndicator}>
335
- <View style={styles.editingIndicatorTitleContainer}>
336
- <Icon name="accounts.editor" size={16}/>
337
- <Text variant="tertiary" style={styles.editingIndicatorTitle}>
338
- Editing message
339
- </Text>
337
+ return (<FormIndicatorRow title="Editing message" buttonText="Cancel" accessibilityHint="Exit message editing mode without saving" iconName="accounts.editor" onPress={() => reset()}/>);
338
+ }
339
+ function ReplyIndicator() {
340
+ const { replyRootId } = React.useContext(MessageFormContext);
341
+ const navigation = useNavigation();
342
+ if (!REPLIES_FEATURE_ENABLED || !replyRootId)
343
+ return null;
344
+ return (<FormIndicatorRow title="Reply" // TODO: Get root reply author
345
+ buttonText="Exit replies" accessibilityHint="Return to the main conversation" iconName="registrations.undo" onPress={() => navigation.goBack()}/>);
346
+ }
347
+ function FormIndicatorRow({ title, buttonText, accessibilityHint, iconName, onPress, }) {
348
+ const styles = useMessageFormStyles();
349
+ const scalableNumberOfLines = useScalableNumberOfLines(1);
350
+ return (<View style={styles.formIndicatorRow}>
351
+ <View style={styles.formIndicatorRowTitleContainer}>
352
+ <Icon name={iconName} size={16} style={styles.formIndicatorRowIcon}/>
353
+ <Heading variant="h4" style={styles.formIndicatorRowTitle} numberOfLines={scalableNumberOfLines} maxFontSizeMultiplier={MAX_FONT_SIZE_MULTIPLIER_LANDMARK}>
354
+ {title}
355
+ </Heading>
340
356
  </View>
341
- <TextButton onPress={() => reset()} accessibilityHint="Exit message editing mode without saving">
342
- Cancel
357
+ <TextButton onPress={onPress} accessibilityHint={accessibilityHint} maxFontSizeMultiplier={MAX_FONT_SIZE_MULTIPLIER_LANDMARK}>
358
+ {buttonText}
343
359
  </TextButton>
344
360
  </View>);
345
361
  }
@@ -469,20 +485,26 @@ const useMessageFormStyles = () => {
469
485
  paddingHorizontal: 16,
470
486
  paddingVertical: 4,
471
487
  },
472
- editingIndicator: {
488
+ formIndicatorRow: {
473
489
  flexDirection: 'row',
474
490
  alignItems: 'center',
475
491
  justifyContent: 'space-between',
476
492
  gap: 8,
477
493
  paddingBottom: 12,
478
494
  },
479
- editingIndicatorTitleContainer: {
495
+ formIndicatorRowTitleContainer: {
480
496
  flexDirection: 'row',
481
497
  alignItems: 'center',
482
498
  gap: 8,
499
+ flex: 1,
500
+ },
501
+ formIndicatorRowIcon: {
502
+ color: theme.colors.iconColorDefaultSecondary,
483
503
  },
484
- editingIndicatorTitle: {
504
+ formIndicatorRowTitle: {
485
505
  fontWeight: platformFontWeightMedium,
506
+ textTransform: 'none',
507
+ flexShrink: 1,
486
508
  },
487
509
  });
488
510
  };