@planningcenter/chat-react-native 3.1.0-rc.8 → 3.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/components/conversation/attachments/attachment_card.d.ts +9 -0
- package/build/components/conversation/attachments/attachment_card.d.ts.map +1 -0
- package/build/components/conversation/attachments/attachment_card.js +35 -0
- package/build/components/conversation/attachments/attachment_card.js.map +1 -0
- package/build/components/conversation/attachments/audio_attachment.d.ts +6 -0
- package/build/components/conversation/attachments/audio_attachment.d.ts.map +1 -0
- package/build/components/conversation/attachments/audio_attachment.js +84 -0
- package/build/components/conversation/attachments/audio_attachment.js.map +1 -0
- package/build/components/conversation/attachments/constants.d.ts +3 -0
- package/build/components/conversation/attachments/constants.d.ts.map +1 -0
- package/build/components/conversation/attachments/constants.js +4 -0
- package/build/components/conversation/attachments/constants.js.map +1 -0
- package/build/components/conversation/attachments/download_attachment_button.d.ts +9 -0
- package/build/components/conversation/attachments/download_attachment_button.d.ts.map +1 -0
- package/build/components/conversation/attachments/download_attachment_button.js +29 -0
- package/build/components/conversation/attachments/download_attachment_button.js.map +1 -0
- package/build/components/conversation/attachments/expanded_link.d.ts +5 -0
- package/build/components/conversation/attachments/expanded_link.d.ts.map +1 -0
- package/build/components/conversation/attachments/expanded_link.js +44 -0
- package/build/components/conversation/attachments/expanded_link.js.map +1 -0
- package/build/components/conversation/attachments/generic_file_attachment.d.ts +7 -0
- package/build/components/conversation/attachments/generic_file_attachment.d.ts.map +1 -0
- package/build/components/conversation/attachments/generic_file_attachment.js +63 -0
- package/build/components/conversation/attachments/generic_file_attachment.js.map +1 -0
- package/build/components/conversation/attachments/giphy_attachment.d.ts +6 -0
- package/build/components/conversation/attachments/giphy_attachment.d.ts.map +1 -0
- package/build/components/conversation/attachments/giphy_attachment.js +42 -0
- package/build/components/conversation/attachments/giphy_attachment.js.map +1 -0
- package/build/components/conversation/attachments/image_attachment.d.ts +5 -0
- package/build/components/conversation/attachments/image_attachment.d.ts.map +1 -0
- package/build/components/conversation/attachments/image_attachment.js +24 -0
- package/build/components/conversation/attachments/image_attachment.js.map +1 -0
- package/build/components/conversation/attachments/video_attachment.d.ts +6 -0
- package/build/components/conversation/attachments/video_attachment.d.ts.map +1 -0
- package/build/components/conversation/attachments/video_attachment.js +64 -0
- package/build/components/conversation/attachments/video_attachment.js.map +1 -0
- package/build/components/conversation/message.d.ts +1 -1
- package/build/components/conversation/message.d.ts.map +1 -1
- package/build/components/conversation/message.js +13 -7
- package/build/components/conversation/message.js.map +1 -1
- package/build/components/conversation/message_attachments.d.ts +6 -0
- package/build/components/conversation/message_attachments.d.ts.map +1 -0
- package/build/components/conversation/message_attachments.js +52 -0
- package/build/components/conversation/message_attachments.js.map +1 -0
- package/build/components/conversation/message_markdown.d.ts +7 -0
- package/build/components/conversation/message_markdown.d.ts.map +1 -0
- package/build/components/conversation/message_markdown.js +38 -0
- package/build/components/conversation/message_markdown.js.map +1 -0
- package/build/components/conversations/conversation_preview.d.ts +9 -0
- package/build/components/conversations/conversation_preview.d.ts.map +1 -0
- package/build/components/conversations/conversation_preview.js +58 -0
- package/build/components/conversations/conversation_preview.js.map +1 -0
- package/build/components/conversations/conversations.d.ts +8 -0
- package/build/components/conversations/conversations.d.ts.map +1 -0
- package/build/components/conversations/conversations.js +40 -0
- package/build/components/conversations/conversations.js.map +1 -0
- package/build/components/conversations/unread_count_badge.d.ts +5 -0
- package/build/components/conversations/unread_count_badge.d.ts.map +1 -0
- package/build/components/conversations/unread_count_badge.js +33 -0
- package/build/components/conversations/unread_count_badge.js.map +1 -0
- package/build/components/display/badge.d.ts +9 -1
- package/build/components/display/badge.d.ts.map +1 -1
- package/build/components/display/badge.js +22 -10
- package/build/components/display/badge.js.map +1 -1
- package/build/components/display/button.d.ts +1 -1
- package/build/components/display/button.d.ts.map +1 -1
- package/build/components/display/button.js.map +1 -1
- package/build/components/display/child_notice.js +2 -2
- package/build/components/display/child_notice.js.map +1 -1
- package/build/components/display/icon.d.ts.map +1 -1
- package/build/components/display/icon.js +10 -8
- package/build/components/display/icon.js.map +1 -1
- package/build/components/display/text.js +2 -8
- package/build/components/display/text.js.map +1 -1
- package/build/components/display/text_button.d.ts +5 -1
- package/build/components/display/text_button.d.ts.map +1 -1
- package/build/components/display/text_button.js +7 -3
- package/build/components/display/text_button.js.map +1 -1
- package/build/components/index.d.ts +1 -1
- package/build/components/index.d.ts.map +1 -1
- package/build/components/index.js +1 -1
- package/build/components/index.js.map +1 -1
- package/build/components/page/error_boundary.d.ts +1 -1
- package/build/hooks/use_api.d.ts +6 -4
- package/build/hooks/use_api.d.ts.map +1 -1
- package/build/hooks/use_api.js +5 -2
- package/build/hooks/use_api.js.map +1 -1
- package/build/hooks/use_api_client.d.ts +1 -2
- package/build/hooks/use_api_client.d.ts.map +1 -1
- package/build/hooks/use_api_client.js.map +1 -1
- package/build/hooks/use_conversation.d.ts +79 -0
- package/build/hooks/use_conversation.d.ts.map +1 -1
- package/build/hooks/use_conversation.js +63 -2
- package/build/hooks/use_conversation.js.map +1 -1
- package/build/hooks/use_conversation_jolt_events.js +1 -1
- package/build/hooks/use_conversation_jolt_events.js.map +1 -1
- package/build/hooks/use_conversation_messages_jolt_events.js +1 -1
- package/build/hooks/use_conversation_messages_jolt_events.js.map +1 -1
- package/build/hooks/use_conversations.d.ts +2 -3
- package/build/hooks/use_conversations.d.ts.map +1 -1
- package/build/hooks/use_conversations.js +3 -29
- package/build/hooks/use_conversations.js.map +1 -1
- package/build/hooks/use_groups.d.ts +214 -0
- package/build/hooks/use_groups.d.ts.map +1 -0
- package/build/hooks/use_groups.js +22 -0
- package/build/hooks/use_groups.js.map +1 -0
- package/build/hooks/use_groups_groups.d.ts +208 -0
- package/build/hooks/use_groups_groups.d.ts.map +1 -0
- package/build/hooks/use_groups_groups.js +18 -0
- package/build/hooks/use_groups_groups.js.map +1 -0
- package/build/hooks/use_services_team.d.ts +4 -0
- package/build/hooks/use_services_team.d.ts.map +1 -0
- package/build/hooks/use_services_team.js +22 -0
- package/build/hooks/use_services_team.js.map +1 -0
- package/build/hooks/use_suspense_api.d.ts +2 -1
- package/build/hooks/use_suspense_api.d.ts.map +1 -1
- package/build/hooks/use_suspense_api.js +2 -1
- package/build/hooks/use_suspense_api.js.map +1 -1
- package/build/hooks/use_teams.d.ts +208 -0
- package/build/hooks/use_teams.d.ts.map +1 -0
- package/build/hooks/use_teams.js +22 -0
- package/build/hooks/use_teams.js.map +1 -0
- package/build/navigation/index.d.ts +11 -0
- package/build/navigation/index.d.ts.map +1 -1
- package/build/navigation/index.js +5 -0
- package/build/navigation/index.js.map +1 -1
- package/build/screens/conversation_details_screen.d.ts.map +1 -1
- package/build/screens/conversation_details_screen.js +176 -56
- package/build/screens/conversation_details_screen.js.map +1 -1
- package/build/screens/conversation_filters_screen.d.ts +13 -0
- package/build/screens/conversation_filters_screen.d.ts.map +1 -0
- package/build/screens/conversation_filters_screen.js +346 -0
- package/build/screens/conversation_filters_screen.js.map +1 -0
- package/build/screens/conversation_screen.js +10 -4
- package/build/screens/conversation_screen.js.map +1 -1
- package/build/screens/conversations_screen.d.ts +4 -2
- package/build/screens/conversations_screen.d.ts.map +1 -1
- package/build/screens/conversations_screen.js +139 -11
- package/build/screens/conversations_screen.js.map +1 -1
- package/build/screens/create/conversation_select_recipients_screen.d.ts.map +1 -1
- package/build/screens/create/conversation_select_recipients_screen.js +3 -11
- package/build/screens/create/conversation_select_recipients_screen.js.map +1 -1
- package/build/types/resources/group_resource.d.ts +4 -2
- package/build/types/resources/group_resource.d.ts.map +1 -1
- package/build/types/resources/group_resource.js.map +1 -1
- package/build/types/resources/index.d.ts +1 -0
- package/build/types/resources/index.d.ts.map +1 -1
- package/build/types/resources/index.js +1 -0
- package/build/types/resources/index.js.map +1 -1
- package/build/types/resources/member_ability.d.ts +1 -0
- package/build/types/resources/member_ability.d.ts.map +1 -1
- package/build/types/resources/member_ability.js.map +1 -1
- package/build/types/resources/services/index.d.ts +2 -0
- package/build/types/resources/services/index.d.ts.map +1 -0
- package/build/types/resources/services/index.js +2 -0
- package/build/types/resources/services/index.js.map +1 -0
- package/build/types/resources/services/team_resource.d.ts +48 -0
- package/build/types/resources/services/team_resource.d.ts.map +1 -0
- package/build/types/resources/services/team_resource.js +7 -0
- package/build/types/resources/services/team_resource.js.map +1 -0
- package/build/utils/index.d.ts +1 -0
- package/build/utils/index.d.ts.map +1 -1
- package/build/utils/index.js +1 -0
- package/build/utils/index.js.map +1 -1
- package/build/utils/native_adapters/audio.d.ts +13 -0
- package/build/utils/native_adapters/audio.d.ts.map +1 -0
- package/build/utils/native_adapters/audio.js +7 -0
- package/build/utils/native_adapters/audio.js.map +1 -0
- package/build/utils/native_adapters/configuration.d.ts +7 -1
- package/build/utils/native_adapters/configuration.d.ts.map +1 -1
- package/build/utils/native_adapters/configuration.js +17 -1
- package/build/utils/native_adapters/configuration.js.map +1 -1
- package/build/utils/native_adapters/index.d.ts +2 -0
- package/build/utils/native_adapters/index.d.ts.map +1 -1
- package/build/utils/native_adapters/index.js +2 -0
- package/build/utils/native_adapters/index.js.map +1 -1
- package/build/utils/native_adapters/video.d.ts +25 -0
- package/build/utils/native_adapters/video.d.ts.map +1 -0
- package/build/utils/native_adapters/video.js +7 -0
- package/build/utils/native_adapters/video.js.map +1 -0
- package/build/utils/parse_simple_markdown.d.ts +7 -0
- package/build/utils/parse_simple_markdown.d.ts.map +1 -0
- package/build/utils/parse_simple_markdown.js +32 -0
- package/build/utils/parse_simple_markdown.js.map +1 -0
- package/build/utils/pluralize.d.ts +2 -0
- package/build/utils/pluralize.d.ts.map +1 -0
- package/build/utils/pluralize.js +10 -0
- package/build/utils/pluralize.js.map +1 -0
- package/build/utils/request/conversation.d.ts +10 -0
- package/build/utils/request/conversation.d.ts.map +1 -0
- package/build/utils/request/conversation.js +32 -0
- package/build/utils/request/conversation.js.map +1 -0
- package/build/utils/request/messages.d.ts +15 -0
- package/build/utils/request/messages.d.ts.map +1 -0
- package/build/utils/request/messages.js +22 -0
- package/build/utils/request/messages.js.map +1 -0
- package/build/utils/theme.d.ts +1 -1
- package/build/utils/theme.d.ts.map +1 -1
- package/build/utils/theme.js +1 -1
- package/build/utils/theme.js.map +1 -1
- package/package.json +2 -2
- package/src/__tests__/utils/parse_simple_markdown.ts +93 -0
- package/src/__tests__/utils/pluralize.tsx +17 -0
- package/src/components/conversation/attachments/attachment_card.tsx +46 -0
- package/src/components/conversation/attachments/audio_attachment.tsx +102 -0
- package/src/components/conversation/attachments/constants.ts +5 -0
- package/src/components/conversation/attachments/download_attachment_button.tsx +46 -0
- package/src/components/conversation/attachments/expanded_link.tsx +54 -0
- package/src/components/conversation/attachments/generic_file_attachment.tsx +75 -0
- package/src/components/conversation/attachments/giphy_attachment.tsx +56 -0
- package/src/components/conversation/attachments/image_attachment.tsx +31 -0
- package/src/components/conversation/attachments/video_attachment.tsx +92 -0
- package/src/components/conversation/message.tsx +15 -6
- package/src/components/conversation/message_attachments.tsx +61 -0
- package/src/components/conversation/message_markdown.tsx +52 -0
- package/src/components/conversations/conversation_preview.tsx +84 -0
- package/src/components/conversations/conversations.tsx +79 -0
- package/src/components/conversations/unread_count_badge.tsx +38 -0
- package/src/components/display/badge.tsx +41 -10
- package/src/components/display/button.tsx +1 -1
- package/src/components/display/child_notice.tsx +2 -2
- package/src/components/display/icon.tsx +10 -8
- package/src/components/display/text.tsx +1 -7
- package/src/components/display/text_button.tsx +12 -2
- package/src/components/index.tsx +1 -1
- package/src/hooks/use_api.ts +11 -10
- package/src/hooks/use_api_client.ts +1 -1
- package/src/hooks/use_conversation.ts +69 -2
- package/src/hooks/use_conversation_jolt_events.ts +1 -1
- package/src/hooks/use_conversation_messages_jolt_events.ts +1 -1
- package/src/hooks/use_conversations.ts +3 -31
- package/src/hooks/use_groups.ts +31 -0
- package/src/hooks/use_groups_groups.ts +20 -0
- package/src/hooks/use_services_team.ts +30 -0
- package/src/hooks/use_suspense_api.ts +4 -4
- package/src/hooks/use_teams.ts +25 -0
- package/src/navigation/index.tsx +8 -0
- package/src/screens/conversation_details_screen.tsx +284 -108
- package/src/screens/conversation_filters_screen.tsx +488 -0
- package/src/screens/conversation_screen.tsx +16 -4
- package/src/screens/conversations_screen.tsx +210 -13
- package/src/screens/create/conversation_select_recipients_screen.tsx +3 -11
- package/src/types/resources/group_resource.ts +5 -2
- package/src/types/resources/index.ts +1 -0
- package/src/types/resources/member_ability.ts +1 -0
- package/src/types/resources/services/index.ts +1 -0
- package/src/types/resources/services/team_resource.ts +60 -0
- package/src/utils/client/types.d.ts +2 -1
- package/src/utils/index.ts +1 -0
- package/src/utils/native_adapters/audio.ts +15 -0
- package/src/utils/native_adapters/configuration.ts +24 -1
- package/src/utils/native_adapters/index.ts +2 -0
- package/src/utils/native_adapters/video.ts +30 -0
- package/src/utils/parse_simple_markdown.ts +40 -0
- package/src/utils/pluralize.ts +11 -0
- package/src/utils/request/conversation.ts +46 -0
- package/src/utils/request/messages.ts +21 -0
- package/src/utils/theme.ts +2 -2
- package/build/components/conversations.d.ts +0 -3
- package/build/components/conversations.d.ts.map +0 -1
- package/build/components/conversations.js +0 -100
- package/build/components/conversations.js.map +0 -1
- package/src/components/conversations.tsx +0 -144
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import React, { ComponentProps, ReactNode } from 'react';
|
|
2
|
+
import { View } from 'react-native';
|
|
3
|
+
type AttachmentCardProps = ComponentProps<typeof View>;
|
|
4
|
+
export declare function AttachmentCard({ children, ...props }: AttachmentCardProps): React.JSX.Element;
|
|
5
|
+
export declare function AttachmentCardTitle({ children }: {
|
|
6
|
+
children: ReactNode;
|
|
7
|
+
}): React.JSX.Element;
|
|
8
|
+
export {};
|
|
9
|
+
//# sourceMappingURL=attachment_card.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"attachment_card.d.ts","sourceRoot":"","sources":["../../../../src/components/conversation/attachments/attachment_card.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,cAAc,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AACxD,OAAO,EAAc,IAAI,EAAE,MAAM,cAAc,CAAA;AAM/C,KAAK,mBAAmB,GAAG,cAAc,CAAC,OAAO,IAAI,CAAC,CAAA;AAEtD,wBAAgB,cAAc,CAAC,EAAE,QAAQ,EAAE,GAAG,KAAK,EAAE,EAAE,mBAAmB,qBAQzE;AAED,wBAAgB,mBAAmB,CAAC,EAAE,QAAQ,EAAE,EAAE;IAAE,QAAQ,EAAE,SAAS,CAAA;CAAE,qBAQxE"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { StyleSheet, View } from 'react-native';
|
|
3
|
+
import { MESSAGE_ATTACHMENT_WIDTH_SINGLE } from './constants';
|
|
4
|
+
import { Text } from '../../display';
|
|
5
|
+
import { tokens } from '../../../vendor/tapestry/tokens';
|
|
6
|
+
import { useTheme } from '../../../hooks';
|
|
7
|
+
export function AttachmentCard({ children, ...props }) {
|
|
8
|
+
const styles = useStyles();
|
|
9
|
+
return (<View style={styles.card} {...props}>
|
|
10
|
+
{children}
|
|
11
|
+
</View>);
|
|
12
|
+
}
|
|
13
|
+
export function AttachmentCardTitle({ children }) {
|
|
14
|
+
const styles = useStyles();
|
|
15
|
+
return (<Text style={styles.title} numberOfLines={1} ellipsizeMode="tail" selectable={false}>
|
|
16
|
+
{children}
|
|
17
|
+
</Text>);
|
|
18
|
+
}
|
|
19
|
+
const useStyles = () => {
|
|
20
|
+
const { colors } = useTheme();
|
|
21
|
+
return StyleSheet.create({
|
|
22
|
+
card: {
|
|
23
|
+
padding: 4,
|
|
24
|
+
backgroundColor: 'white',
|
|
25
|
+
borderRadius: 8,
|
|
26
|
+
minWidth: MESSAGE_ATTACHMENT_WIDTH_SINGLE,
|
|
27
|
+
minHeight: 48,
|
|
28
|
+
},
|
|
29
|
+
title: {
|
|
30
|
+
color: colors.textColorDefaultPrimary,
|
|
31
|
+
fontSize: tokens.fontSizeSm,
|
|
32
|
+
},
|
|
33
|
+
});
|
|
34
|
+
};
|
|
35
|
+
//# sourceMappingURL=attachment_card.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"attachment_card.js","sourceRoot":"","sources":["../../../../src/components/conversation/attachments/attachment_card.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAoC,MAAM,OAAO,CAAA;AACxD,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,cAAc,CAAA;AAC/C,OAAO,EAAE,+BAA+B,EAAE,MAAM,aAAa,CAAA;AAC7D,OAAO,EAAE,IAAI,EAAE,MAAM,eAAe,CAAA;AACpC,OAAO,EAAE,MAAM,EAAE,MAAM,iCAAiC,CAAA;AACxD,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAA;AAIzC,MAAM,UAAU,cAAc,CAAC,EAAE,QAAQ,EAAE,GAAG,KAAK,EAAuB;IACxE,MAAM,MAAM,GAAG,SAAS,EAAE,CAAA;IAE1B,OAAO,CACL,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,IAAI,KAAK,CAAC,CAClC;MAAA,CAAC,QAAQ,CACX;IAAA,EAAE,IAAI,CAAC,CACR,CAAA;AACH,CAAC;AAED,MAAM,UAAU,mBAAmB,CAAC,EAAE,QAAQ,EAA2B;IACvE,MAAM,MAAM,GAAG,SAAS,EAAE,CAAA;IAE1B,OAAO,CACL,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC,CAAC,aAAa,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC,KAAK,CAAC,CAClF;MAAA,CAAC,QAAQ,CACX;IAAA,EAAE,IAAI,CAAC,CACR,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,IAAI,EAAE;YACJ,OAAO,EAAE,CAAC;YACV,eAAe,EAAE,OAAO;YACxB,YAAY,EAAE,CAAC;YACf,QAAQ,EAAE,+BAA+B;YACzC,SAAS,EAAE,EAAE;SACd;QACD,KAAK,EAAE;YACL,KAAK,EAAE,MAAM,CAAC,uBAAuB;YACrC,QAAQ,EAAE,MAAM,CAAC,UAAU;SAC5B;KACF,CAAC,CAAA;AACJ,CAAC,CAAA","sourcesContent":["import React, { ComponentProps, ReactNode } from 'react'\nimport { StyleSheet, View } from 'react-native'\nimport { MESSAGE_ATTACHMENT_WIDTH_SINGLE } from './constants'\nimport { Text } from '../../display'\nimport { tokens } from '../../../vendor/tapestry/tokens'\nimport { useTheme } from '../../../hooks'\n\ntype AttachmentCardProps = ComponentProps<typeof View>\n\nexport function AttachmentCard({ children, ...props }: AttachmentCardProps) {\n const styles = useStyles()\n\n return (\n <View style={styles.card} {...props}>\n {children}\n </View>\n )\n}\n\nexport function AttachmentCardTitle({ children }: { children: ReactNode }) {\n const styles = useStyles()\n\n return (\n <Text style={styles.title} numberOfLines={1} ellipsizeMode=\"tail\" selectable={false}>\n {children}\n </Text>\n )\n}\n\nconst useStyles = () => {\n const { colors } = useTheme()\n\n return StyleSheet.create({\n card: {\n padding: 4,\n backgroundColor: 'white',\n borderRadius: 8,\n minWidth: MESSAGE_ATTACHMENT_WIDTH_SINGLE,\n minHeight: 48,\n },\n title: {\n color: colors.textColorDefaultPrimary,\n fontSize: tokens.fontSizeSm,\n },\n })\n}\n"]}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { DenormalizedMessageAttachmentResource } from '../../../types/resources/denormalized_attachment_resource';
|
|
3
|
+
export declare function AudioAttachment({ attachment, }: {
|
|
4
|
+
attachment: DenormalizedMessageAttachmentResource;
|
|
5
|
+
}): React.JSX.Element;
|
|
6
|
+
//# sourceMappingURL=audio_attachment.d.ts.map
|
|
@@ -0,0 +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"}
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { View, Text, StyleSheet } from 'react-native';
|
|
3
|
+
import { IconButton } from '../../display';
|
|
4
|
+
import { AttachmentCard, AttachmentCardTitle } from './attachment_card';
|
|
5
|
+
import { tokens } from '../../../vendor/tapestry/tokens';
|
|
6
|
+
import { useTheme } from '../../../hooks';
|
|
7
|
+
import { Audio } from '../../../utils/native_adapters';
|
|
8
|
+
export function AudioAttachment({ attachment, }) {
|
|
9
|
+
const styles = useStyles();
|
|
10
|
+
const { attributes } = attachment;
|
|
11
|
+
const { url, filename } = attributes;
|
|
12
|
+
const sound = Audio.useAudio(url);
|
|
13
|
+
function toggleAudio() {
|
|
14
|
+
if (!sound.isPlaying) {
|
|
15
|
+
sound.play();
|
|
16
|
+
}
|
|
17
|
+
else {
|
|
18
|
+
sound.pause();
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
const progress = sound.duration > 0 ? sound.position / sound.duration : 0;
|
|
22
|
+
function durationText() {
|
|
23
|
+
if (sound.duration > 0) {
|
|
24
|
+
return `${Math.floor(sound.position / 1000)}s / ${Math.floor(sound.duration / 1000)}s`;
|
|
25
|
+
}
|
|
26
|
+
else {
|
|
27
|
+
return 'Loading...';
|
|
28
|
+
}
|
|
29
|
+
}
|
|
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}%` }]}/>
|
|
37
|
+
</View>
|
|
38
|
+
<Text style={styles.durationText}>{durationText()}</Text>
|
|
39
|
+
</View>
|
|
40
|
+
</View>
|
|
41
|
+
</AttachmentCard>);
|
|
42
|
+
}
|
|
43
|
+
const useStyles = () => {
|
|
44
|
+
const { colors } = useTheme();
|
|
45
|
+
return StyleSheet.create({
|
|
46
|
+
container: {
|
|
47
|
+
flexDirection: 'row',
|
|
48
|
+
},
|
|
49
|
+
button: {
|
|
50
|
+
width: 42,
|
|
51
|
+
height: 42,
|
|
52
|
+
justifyContent: 'center',
|
|
53
|
+
alignItems: 'center',
|
|
54
|
+
borderRadius: 25,
|
|
55
|
+
backgroundColor: '#eee',
|
|
56
|
+
borderColor: '#aaa',
|
|
57
|
+
borderWidth: 1,
|
|
58
|
+
},
|
|
59
|
+
buttonText: {
|
|
60
|
+
fontSize: 32,
|
|
61
|
+
lineHeight: 32,
|
|
62
|
+
},
|
|
63
|
+
details: {
|
|
64
|
+
flex: 1,
|
|
65
|
+
marginLeft: 10,
|
|
66
|
+
gap: 5,
|
|
67
|
+
},
|
|
68
|
+
progressContainer: {
|
|
69
|
+
height: 5,
|
|
70
|
+
backgroundColor: '#ccc',
|
|
71
|
+
borderRadius: 2.5,
|
|
72
|
+
overflow: 'hidden',
|
|
73
|
+
},
|
|
74
|
+
progressBar: {
|
|
75
|
+
height: '100%',
|
|
76
|
+
backgroundColor: 'blue',
|
|
77
|
+
},
|
|
78
|
+
durationText: {
|
|
79
|
+
fontSize: tokens.fontSizeXs,
|
|
80
|
+
color: colors.textColorDefaultSecondary,
|
|
81
|
+
},
|
|
82
|
+
});
|
|
83
|
+
};
|
|
84
|
+
//# sourceMappingURL=audio_attachment.js.map
|
|
@@ -0,0 +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,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;AAEtD,MAAM,UAAU,eAAe,CAAC,EAC9B,UAAU,GAGX;IACC,MAAM,MAAM,GAAG,SAAS,EAAE,CAAA;IAC1B,MAAM,EAAE,UAAU,EAAE,GAAG,UAAU,CAAA;IACjC,MAAM,EAAE,GAAG,EAAE,QAAQ,EAAE,GAAG,UAAU,CAAA;IACpC,MAAM,KAAK,GAAG,KAAK,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAA;IAEjC,SAAS,WAAW;QAClB,IAAI,CAAC,KAAK,CAAC,SAAS,EAAE,CAAC;YACrB,KAAK,CAAC,IAAI,EAAE,CAAA;QACd,CAAC;aAAM,CAAC;YACN,KAAK,CAAC,KAAK,EAAE,CAAA;QACf,CAAC;IACH,CAAC;IAED,MAAM,QAAQ,GAAG,KAAK,CAAC,QAAQ,GAAG,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,QAAQ,GAAG,KAAK,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAA;IAEzE,SAAS,YAAY;QACnB,IAAI,KAAK,CAAC,QAAQ,GAAG,CAAC,EAAE,CAAC;YACvB,OAAO,GAAG,IAAI,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,EAAE,cAAc,CAAC,CAClB,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,aAAa,EAAE,KAAK;SACrB;QACD,MAAM,EAAE;YACN,KAAK,EAAE,EAAE;YACT,MAAM,EAAE,EAAE;YACV,cAAc,EAAE,QAAQ;YACxB,UAAU,EAAE,QAAQ;YACpB,YAAY,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"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../../src/components/conversation/attachments/constants.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,2BAA2B,MAAM,CAAA;AAC9C,eAAO,MAAM,+BAA+B,QACyB,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../../src/components/conversation/attachments/constants.ts"],"names":[],"mappings":"AAAA,MAAM,iCAAiC,GAAG,CAAC,CAAA;AAE3C,MAAM,CAAC,MAAM,2BAA2B,GAAG,GAAG,CAAA;AAC9C,MAAM,CAAC,MAAM,+BAA+B,GAC1C,2BAA2B,GAAG,iCAAiC,GAAG,CAAC,CAAA","sourcesContent":["const MESSAGE_BUBBLE_ATTACHMENT_PADDING = 2\n\nexport const MESSAGE_BUBBLE_WIDTH_SINGLE = 232\nexport const MESSAGE_ATTACHMENT_WIDTH_SINGLE =\n MESSAGE_BUBBLE_WIDTH_SINGLE - MESSAGE_BUBBLE_ATTACHMENT_PADDING * 2\n"]}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
interface DownloadAttachmentButtonProps {
|
|
3
|
+
to: string;
|
|
4
|
+
filename: string;
|
|
5
|
+
title: string;
|
|
6
|
+
}
|
|
7
|
+
export declare function DownloadAttachmentButton({ to, title }: DownloadAttachmentButtonProps): React.JSX.Element;
|
|
8
|
+
export {};
|
|
9
|
+
//# sourceMappingURL=download_attachment_button.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"download_attachment_button.d.ts","sourceRoot":"","sources":["../../../../src/components/conversation/attachments/download_attachment_button.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AAKzB,UAAU,6BAA6B;IACrC,EAAE,EAAE,MAAM,CAAA;IACV,QAAQ,EAAE,MAAM,CAAA;IAChB,KAAK,EAAE,MAAM,CAAA;CACd;AAED,wBAAgB,wBAAwB,CAAC,EAAE,EAAE,EAAE,KAAK,EAAE,EAAE,6BAA6B,qBAkBpF"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { IconButton } from '../../display';
|
|
3
|
+
import { useTheme } from '../../../hooks';
|
|
4
|
+
import { Linking, StyleSheet } from 'react-native';
|
|
5
|
+
export function DownloadAttachmentButton({ to, title }) {
|
|
6
|
+
const styles = useStyles();
|
|
7
|
+
async function handleDownload() {
|
|
8
|
+
if (to) {
|
|
9
|
+
// Open link in the default web browser
|
|
10
|
+
Linking.openURL(to);
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
return (<IconButton name="general.fromCloudArrow" size="md" accessibilityLabel={title} onPress={handleDownload} style={styles.iconButton}/>);
|
|
14
|
+
}
|
|
15
|
+
const useStyles = () => {
|
|
16
|
+
const { colors } = useTheme();
|
|
17
|
+
return StyleSheet.create({
|
|
18
|
+
iconButton: {
|
|
19
|
+
color: colors.fillColorInteractionDefault,
|
|
20
|
+
backgroundColor: colors.fillColorNeutral070,
|
|
21
|
+
borderWidth: 1,
|
|
22
|
+
borderColor: colors.fillColorNeutral060,
|
|
23
|
+
borderRadius: 4,
|
|
24
|
+
width: 24,
|
|
25
|
+
height: 24,
|
|
26
|
+
},
|
|
27
|
+
});
|
|
28
|
+
};
|
|
29
|
+
//# sourceMappingURL=download_attachment_button.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"download_attachment_button.js","sourceRoot":"","sources":["../../../../src/components/conversation/attachments/download_attachment_button.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AACzB,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAA;AAC1C,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAA;AACzC,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAA;AAQlD,MAAM,UAAU,wBAAwB,CAAC,EAAE,EAAE,EAAE,KAAK,EAAiC;IACnF,MAAM,MAAM,GAAG,SAAS,EAAE,CAAA;IAC1B,KAAK,UAAU,cAAc;QAC3B,IAAI,EAAE,EAAE,CAAC;YACP,uCAAuC;YACvC,OAAO,CAAC,OAAO,CAAC,EAAE,CAAC,CAAA;QACrB,CAAC;IACH,CAAC;IAED,OAAO,CACL,CAAC,UAAU,CACT,IAAI,CAAC,wBAAwB,CAC7B,IAAI,CAAC,IAAI,CACT,kBAAkB,CAAC,CAAC,KAAK,CAAC,CAC1B,OAAO,CAAC,CAAC,cAAc,CAAC,CACxB,KAAK,CAAC,CAAC,MAAM,CAAC,UAAU,CAAC,EACzB,CACH,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,UAAU,EAAE;YACV,KAAK,EAAE,MAAM,CAAC,2BAA2B;YACzC,eAAe,EAAE,MAAM,CAAC,mBAAmB;YAC3C,WAAW,EAAE,CAAC;YACd,WAAW,EAAE,MAAM,CAAC,mBAAmB;YACvC,YAAY,EAAE,CAAC;YACf,KAAK,EAAE,EAAE;YACT,MAAM,EAAE,EAAE;SACX;KACF,CAAC,CAAA;AACJ,CAAC,CAAA","sourcesContent":["import React from 'react'\nimport { IconButton } from '../../display'\nimport { useTheme } from '../../../hooks'\nimport { Linking, StyleSheet } from 'react-native'\n\ninterface DownloadAttachmentButtonProps {\n to: string\n filename: string\n title: string\n}\n\nexport function DownloadAttachmentButton({ to, title }: DownloadAttachmentButtonProps) {\n const styles = useStyles()\n async function handleDownload() {\n if (to) {\n // Open link in the default web browser\n Linking.openURL(to)\n }\n }\n\n return (\n <IconButton\n name=\"general.fromCloudArrow\"\n size=\"md\"\n accessibilityLabel={title}\n onPress={handleDownload}\n style={styles.iconButton}\n />\n )\n}\n\nconst useStyles = () => {\n const { colors } = useTheme()\n\n return StyleSheet.create({\n iconButton: {\n color: colors.fillColorInteractionDefault,\n backgroundColor: colors.fillColorNeutral070,\n borderWidth: 1,\n borderColor: colors.fillColorNeutral060,\n borderRadius: 4,\n width: 24,\n height: 24,\n },\n })\n}\n"]}
|
|
@@ -0,0 +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"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Image, Linking, Pressable, StyleSheet, Text, View } from 'react-native';
|
|
3
|
+
import { useTheme } from '../../../hooks';
|
|
4
|
+
import { tokens } from '../../../vendor/tapestry/tokens';
|
|
5
|
+
export function ExpandedLink({ attachment }) {
|
|
6
|
+
const styles = useStyles();
|
|
7
|
+
const { attributes } = attachment;
|
|
8
|
+
const { url, title, description, imageUrl, imageHeight, imageWidth } = attributes;
|
|
9
|
+
const aspectRatio = imageWidth && imageHeight ? imageWidth / imageHeight : 1;
|
|
10
|
+
async function openUrl() {
|
|
11
|
+
if (url)
|
|
12
|
+
Linking.openURL(url);
|
|
13
|
+
}
|
|
14
|
+
return (<Pressable style={styles.container} onPress={openUrl}>
|
|
15
|
+
{imageUrl && (<Image source={{ uri: imageUrl }} style={[styles.image, { aspectRatio }]} alt={title}/>)}
|
|
16
|
+
{(title || description) && (<View style={styles.textWrapper}>
|
|
17
|
+
{title && <Text style={styles.title}>{title}</Text>}
|
|
18
|
+
{description && <Text style={styles.description}>{description}</Text>}
|
|
19
|
+
</View>)}
|
|
20
|
+
</Pressable>);
|
|
21
|
+
}
|
|
22
|
+
const useStyles = () => {
|
|
23
|
+
const { colors } = useTheme();
|
|
24
|
+
return StyleSheet.create({
|
|
25
|
+
container: {},
|
|
26
|
+
image: {
|
|
27
|
+
borderRadius: 8,
|
|
28
|
+
},
|
|
29
|
+
textWrapper: {
|
|
30
|
+
gap: 4,
|
|
31
|
+
padding: 8,
|
|
32
|
+
},
|
|
33
|
+
title: {
|
|
34
|
+
fontSize: tokens.fontSizeSm,
|
|
35
|
+
fontWeight: tokens.fontWeightMedium,
|
|
36
|
+
color: colors.textColorDefaultPrimary,
|
|
37
|
+
},
|
|
38
|
+
description: {
|
|
39
|
+
fontSize: tokens.fontSizeXs,
|
|
40
|
+
color: colors.textColorDefaultPrimary,
|
|
41
|
+
},
|
|
42
|
+
});
|
|
43
|
+
};
|
|
44
|
+
//# sourceMappingURL=expanded_link.js.map
|
|
@@ -0,0 +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,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AC,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"]}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { DenormalizedMessageAttachmentResource } from '../../../types/resources/denormalized_attachment_resource';
|
|
3
|
+
export declare function GenericFileAttachment({ attachment, }: {
|
|
4
|
+
attachment: DenormalizedMessageAttachmentResource;
|
|
5
|
+
}): React.JSX.Element;
|
|
6
|
+
export declare function getAttachmentIconName(type: string): "general.outlinedImageFile" | "general.outlinedVideoFile" | "general.outlinedMusicFile" | "general.outlinedPdfFile" | "general.outlinedGenericFile";
|
|
7
|
+
//# sourceMappingURL=generic_file_attachment.d.ts.map
|
|
@@ -0,0 +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"}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Pressable, StyleSheet, View } from 'react-native';
|
|
3
|
+
import { AttachmentCard, AttachmentCardTitle } from './attachment_card';
|
|
4
|
+
import { Icon } from '../../display';
|
|
5
|
+
import { DownloadAttachmentButton } from './download_attachment_button';
|
|
6
|
+
import { useTheme } from '../../../hooks';
|
|
7
|
+
export function GenericFileAttachment({ attachment, }) {
|
|
8
|
+
const styles = useStyles();
|
|
9
|
+
const { url, filename, contentType } = attachment.attributes;
|
|
10
|
+
const iconName = getAttachmentIconName(contentType);
|
|
11
|
+
const fileTypeLabel = contentType === 'application/pdf' ? 'PDF' : 'file';
|
|
12
|
+
return (<Pressable>
|
|
13
|
+
<AttachmentCard>
|
|
14
|
+
<View style={styles.container}>
|
|
15
|
+
<View style={styles.stack}>
|
|
16
|
+
<Icon name={iconName}/>
|
|
17
|
+
<AttachmentCardTitle>{filename}</AttachmentCardTitle>
|
|
18
|
+
</View>
|
|
19
|
+
<DownloadAttachmentButton to={url} filename={filename} title={`Download ${fileTypeLabel}`}/>
|
|
20
|
+
</View>
|
|
21
|
+
</AttachmentCard>
|
|
22
|
+
</Pressable>);
|
|
23
|
+
}
|
|
24
|
+
const useStyles = () => {
|
|
25
|
+
const { colors } = useTheme();
|
|
26
|
+
return StyleSheet.create({
|
|
27
|
+
container: {
|
|
28
|
+
padding: 8,
|
|
29
|
+
gap: 4,
|
|
30
|
+
flexDirection: 'row',
|
|
31
|
+
alignItems: 'center',
|
|
32
|
+
justifyContent: 'space-between',
|
|
33
|
+
minHeight: 48,
|
|
34
|
+
},
|
|
35
|
+
stack: {
|
|
36
|
+
gap: 4,
|
|
37
|
+
flexDirection: 'row',
|
|
38
|
+
alignItems: 'center',
|
|
39
|
+
maxWidth: '70%',
|
|
40
|
+
},
|
|
41
|
+
icon: {
|
|
42
|
+
color: colors.textColorDefaultPrimary,
|
|
43
|
+
width: 24,
|
|
44
|
+
height: 24,
|
|
45
|
+
},
|
|
46
|
+
});
|
|
47
|
+
};
|
|
48
|
+
export function getAttachmentIconName(type) {
|
|
49
|
+
const isImage = type.startsWith('image/');
|
|
50
|
+
const isVideo = type.startsWith('video/');
|
|
51
|
+
const isAudio = type.startsWith('audio/');
|
|
52
|
+
const isPdf = type === 'application/pdf';
|
|
53
|
+
if (isImage)
|
|
54
|
+
return 'general.outlinedImageFile';
|
|
55
|
+
if (isVideo)
|
|
56
|
+
return 'general.outlinedVideoFile';
|
|
57
|
+
if (isAudio)
|
|
58
|
+
return 'general.outlinedMusicFile';
|
|
59
|
+
if (isPdf)
|
|
60
|
+
return 'general.outlinedPdfFile';
|
|
61
|
+
return 'general.outlinedGenericFile';
|
|
62
|
+
}
|
|
63
|
+
//# sourceMappingURL=generic_file_attachment.js.map
|
|
@@ -0,0 +1 @@
|
|
|
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,SAAS,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,cAAc,CAAA;AAE1D,OAAO,EAAE,cAAc,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAA;AACvE,OAAO,EAAE,IAAI,EAAE,MAAM,eAAe,CAAA;AACpC,OAAO,EAAE,wBAAwB,EAAE,MAAM,8BAA8B,CAA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AAc,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"]}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { DenormalizedGiphyAttachmentResource } from '../../../types/resources/denormalized_attachment_resource';
|
|
3
|
+
export declare function GiphyAttachment({ attachment, }: {
|
|
4
|
+
attachment: DenormalizedGiphyAttachmentResource;
|
|
5
|
+
}): React.JSX.Element;
|
|
6
|
+
//# sourceMappingURL=giphy_attachment.d.ts.map
|
|
@@ -0,0 +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"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Text, Image, StyleSheet, Linking, Pressable } from 'react-native';
|
|
3
|
+
import { tokens } from '../../../vendor/tapestry/tokens';
|
|
4
|
+
import { useTheme } from '../../../hooks';
|
|
5
|
+
export function GiphyAttachment({ attachment, }) {
|
|
6
|
+
const styles = useStyles();
|
|
7
|
+
const { title, titleLink, giphy } = attachment;
|
|
8
|
+
const { url, width, height } = giphy.fixedWidth;
|
|
9
|
+
function handlePress() {
|
|
10
|
+
if (titleLink) {
|
|
11
|
+
// Open Giphy link in the default web browser
|
|
12
|
+
Linking.openURL(titleLink);
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
return (<Pressable onPress={handlePress} style={styles.container}>
|
|
16
|
+
<Image source={{ uri: url }} style={[styles.image, { width, height }]} accessibilityLabel={title}/>
|
|
17
|
+
<Text style={styles.link}>
|
|
18
|
+
<Text style={styles.tag}>/giphy</Text> {title}
|
|
19
|
+
</Text>
|
|
20
|
+
</Pressable>);
|
|
21
|
+
}
|
|
22
|
+
const useStyles = () => {
|
|
23
|
+
const { colors } = useTheme();
|
|
24
|
+
return StyleSheet.create({
|
|
25
|
+
container: {
|
|
26
|
+
gap: 4,
|
|
27
|
+
},
|
|
28
|
+
image: {
|
|
29
|
+
borderRadius: 8,
|
|
30
|
+
},
|
|
31
|
+
link: {
|
|
32
|
+
fontSize: tokens.fontSizeSm,
|
|
33
|
+
color: colors.fillColorInteractionDefault,
|
|
34
|
+
paddingHorizontal: 8,
|
|
35
|
+
paddingVertical: 6,
|
|
36
|
+
},
|
|
37
|
+
tag: {
|
|
38
|
+
fontWeight: 'bold',
|
|
39
|
+
},
|
|
40
|
+
});
|
|
41
|
+
};
|
|
42
|
+
//# sourceMappingURL=giphy_attachment.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"giphy_att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AE,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"]}
|
|
@@ -0,0 +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"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { View, Image, StyleSheet } from 'react-native';
|
|
3
|
+
export function ImageAttachment({ attachment }) {
|
|
4
|
+
const styles = useStyles();
|
|
5
|
+
const { attributes } = attachment;
|
|
6
|
+
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>);
|
|
12
|
+
}
|
|
13
|
+
const useStyles = () => {
|
|
14
|
+
return StyleSheet.create({
|
|
15
|
+
container: {
|
|
16
|
+
maxWidth: '100%',
|
|
17
|
+
},
|
|
18
|
+
image: {
|
|
19
|
+
borderRadius: 8,
|
|
20
|
+
minWidth: 200,
|
|
21
|
+
},
|
|
22
|
+
});
|
|
23
|
+
};
|
|
24
|
+
//# sourceMappingURL=image_attachment.js.map
|
|
@@ -0,0 +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"]}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { DenormalizedMessageAttachmentResource } from '../../../types/resources/denormalized_attachment_resource';
|
|
3
|
+
export declare function VideoAttachment({ attachment, }: {
|
|
4
|
+
attachment: DenormalizedMessageAttachmentResource;
|
|
5
|
+
}): React.JSX.Element;
|
|
6
|
+
//# sourceMappingURL=video_attachment.d.ts.map
|
|
@@ -0,0 +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"}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import React, { useRef, useState } from 'react';
|
|
2
|
+
import { View, StyleSheet, Pressable } from 'react-native';
|
|
3
|
+
import { MESSAGE_ATTACHMENT_WIDTH_SINGLE } from './constants';
|
|
4
|
+
import { IconButton } from '../../display';
|
|
5
|
+
import { Video } from '../../../utils/native_adapters';
|
|
6
|
+
export function VideoAttachment({ attachment, }) {
|
|
7
|
+
const { attributes } = attachment;
|
|
8
|
+
const { width = MESSAGE_ATTACHMENT_WIDTH_SINGLE, height = MESSAGE_ATTACHMENT_WIDTH_SINGLE } = attributes.metadata || {};
|
|
9
|
+
const { url } = attributes;
|
|
10
|
+
const videoRef = useRef(null);
|
|
11
|
+
const [isOpen, setIsOpen] = useState(false);
|
|
12
|
+
function openVideo() {
|
|
13
|
+
if (!isOpen && videoRef.current) {
|
|
14
|
+
videoRef.current.presentFullscreenPlayer();
|
|
15
|
+
videoRef.current.play();
|
|
16
|
+
setIsOpen(true);
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
function onFullscreenPlayerWillDismiss() {
|
|
20
|
+
videoRef.current?.pause();
|
|
21
|
+
setIsOpen(false);
|
|
22
|
+
}
|
|
23
|
+
const viewRef = useRef(null);
|
|
24
|
+
return (<View style={styles.container} ref={viewRef}>
|
|
25
|
+
<Pressable onPress={openVideo}>
|
|
26
|
+
<Video.Player ref={videoRef} source={{ uri: url }} aspectRatio={width / height} style={styles.video} onFullscreenPlayerWillDismiss={onFullscreenPlayerWillDismiss}/>
|
|
27
|
+
{!isOpen && (<View style={styles.playButtonWrapper}>
|
|
28
|
+
<IconButton name="services.play" size="md" accessibilityLabel="Play Video" onPress={openVideo} style={styles.button}/>
|
|
29
|
+
</View>)}
|
|
30
|
+
</Pressable>
|
|
31
|
+
</View>);
|
|
32
|
+
}
|
|
33
|
+
const styles = StyleSheet.create({
|
|
34
|
+
container: {
|
|
35
|
+
maxWidth: 320,
|
|
36
|
+
maxHeight: 320,
|
|
37
|
+
},
|
|
38
|
+
video: {
|
|
39
|
+
width: '100%',
|
|
40
|
+
height: 'auto',
|
|
41
|
+
backgroundColor: 'black',
|
|
42
|
+
borderRadius: 8,
|
|
43
|
+
},
|
|
44
|
+
playButtonWrapper: {
|
|
45
|
+
position: 'absolute',
|
|
46
|
+
top: 0,
|
|
47
|
+
left: 0,
|
|
48
|
+
right: 0,
|
|
49
|
+
bottom: 0,
|
|
50
|
+
justifyContent: 'center',
|
|
51
|
+
alignItems: 'center',
|
|
52
|
+
},
|
|
53
|
+
button: {
|
|
54
|
+
width: 42,
|
|
55
|
+
height: 42,
|
|
56
|
+
justifyContent: 'center',
|
|
57
|
+
alignItems: 'center',
|
|
58
|
+
borderRadius: 25,
|
|
59
|
+
backgroundColor: '#eee',
|
|
60
|
+
borderColor: '#aaa',
|
|
61
|
+
borderWidth: 1,
|
|
62
|
+
},
|
|
63
|
+
});
|
|
64
|
+
//# sourceMappingURL=video_attachment.js.map
|
|
@@ -0,0 +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,EAC9B,UAAU,GAGX;IACC,MAAM,EAAE,UAAU,EAAE,GAAG,UAAU,CAAA;IACjC,MAAM,EAAE,KAAK,GAAG,+BAA+B,EAAE,MAAM,GAAG,+BAA+B,EAAE,GACzF,UAAU,CAAC,QAAQ,IAAI,EAAE,CAAA;IAC3B,MAAM,EAAE,GAAG,EAAE,GAAG,UAAU,CAAA;IAE1B,MAAM,QAAQ,GAAG,MAAM,CAAoB,IAAI,CAAC,CAAA;IAChD,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAA;IAE3C,SAAS,SAAS;QAChB,IAAI,CAAC,MAAM,IAAI,QAAQ,CAAC,OAAO,EAAE,CAAC;YAChC,QAAQ,CAAC,OAAO,CAAC,uBAAuB,EAAE,CAAA;YAC1C,QAAQ,CAAC,OAAO,CAAC,IAAI,EAAE,CAAA;YACvB,SAAS,CAAC,IAAI,CAAC,CAAA;QACjB,CAAC;IACH,CAAC;IAED,SAAS,6BAA6B;QACpC,QAAQ,CAAC,OAAO,EAAE,KAAK,EAAE,CAAA;QACzB,SAAS,CAAC,KAAK,CAAC,CAAA;IAClB,CAAC;IAED,MAAM,OAAO,GAAG,MAAM,CAAO,IAAI,CAAC,CAAA;IAElC,OAAO,CACL,C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AE,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 +1 @@
|
|
|
1
|
-
{"version":3,"file":"message.d.ts","sourceRoot":"","sources":["../../../src/components/conversation/message.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,MAAM,OAAO,CAAA;AAKzB,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAA;
|
|
1
|
+
{"version":3,"file":"message.d.ts","sourceRoot":"","sources":["../../../src/components/conversation/message.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,MAAM,OAAO,CAAA;AAKzB,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAA;AAM7C;;GAEG;AACH,wBAAgB,OAAO,CAAC,KAAK,EAAE,eAAe,GAAG;IAAE,eAAe,EAAE,MAAM,CAAA;CAAE,qBAiD3E"}
|