@planningcenter/chat-react-native 3.1.0-rc.13 → 3.1.0-rc.14
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 +10 -6
- 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/conversations.d.ts +6 -1
- package/build/components/conversations.d.ts.map +1 -1
- package/build/components/conversations.js +19 -24
- package/build/components/conversations.js.map +1 -1
- 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/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.js +1 -1
- 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 +86 -62
- 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 +2 -1
- 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/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/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/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 +10 -5
- package/src/components/conversation/message_attachments.tsx +61 -0
- package/src/components/conversations.tsx +37 -35
- 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/hooks/use_api.ts +11 -10
- package/src/hooks/use_api_client.ts +1 -1
- package/src/hooks/use_conversation.ts +1 -1
- 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 +149 -117
- package/src/screens/conversation_filters_screen.tsx +488 -0
- package/src/screens/conversation_screen.tsx +8 -1
- 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/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/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
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/utils/native_adapters/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAA;AAC3B,cAAc,iBAAiB,CAAA","sourcesContent":["export * from './clipboard'\nexport * from './configuration'\n"]}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/utils/native_adapters/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAA;AAC3B,cAAc,iBAAiB,CAAA;AAC/B,cAAc,SAAS,CAAA;AACvB,cAAc,SAAS,CAAA","sourcesContent":["export * from './clipboard'\nexport * from './configuration'\nexport * from './audio'\nexport * from './video'\n"]}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { StyleProp, ViewStyle } from 'react-native';
|
|
2
|
+
export interface VideoPlayerProps {
|
|
3
|
+
source: {
|
|
4
|
+
uri: string;
|
|
5
|
+
};
|
|
6
|
+
aspectRatio?: number;
|
|
7
|
+
style?: StyleProp<ViewStyle>;
|
|
8
|
+
onFullscreenPlayerWillPresent?: () => void;
|
|
9
|
+
onFullscreenPlayerDidPresent?: () => void;
|
|
10
|
+
onFullscreenPlayerWillDismiss?: () => void;
|
|
11
|
+
onFullscreenPlayerDidDismiss?: () => void;
|
|
12
|
+
}
|
|
13
|
+
export interface VideoPlayerHandle {
|
|
14
|
+
play: () => void;
|
|
15
|
+
pause: () => void;
|
|
16
|
+
presentFullscreenPlayer: () => void;
|
|
17
|
+
dismissFullscreen: () => void;
|
|
18
|
+
}
|
|
19
|
+
type VideoPlayer = React.ForwardRefExoticComponent<VideoPlayerProps & React.RefAttributes<VideoPlayerHandle>>;
|
|
20
|
+
export declare class VideoAdapter {
|
|
21
|
+
Player: VideoPlayer;
|
|
22
|
+
constructor(methods: VideoAdapter);
|
|
23
|
+
}
|
|
24
|
+
export {};
|
|
25
|
+
//# sourceMappingURL=video.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"video.d.ts","sourceRoot":"","sources":["../../../src/utils/native_adapters/video.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,cAAc,CAAA;AAEnD,MAAM,WAAW,gBAAgB;IAC/B,MAAM,EAAE;QAAE,GAAG,EAAE,MAAM,CAAA;KAAE,CAAA;IACvB,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,KAAK,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAA;IAC5B,6BAA6B,CAAC,EAAE,MAAM,IAAI,CAAA;IAC1C,4BAA4B,CAAC,EAAE,MAAM,IAAI,CAAA;IACzC,6BAA6B,CAAC,EAAE,MAAM,IAAI,CAAA;IAC1C,4BAA4B,CAAC,EAAE,MAAM,IAAI,CAAA;CAC1C;AAED,MAAM,WAAW,iBAAiB;IAChC,IAAI,EAAE,MAAM,IAAI,CAAA;IAChB,KAAK,EAAE,MAAM,IAAI,CAAA;IACjB,uBAAuB,EAAE,MAAM,IAAI,CAAA;IACnC,iBAAiB,EAAE,MAAM,IAAI,CAAA;CAC9B;AAED,KAAK,WAAW,GAAG,KAAK,CAAC,yBAAyB,CAChD,gBAAgB,GAAG,KAAK,CAAC,aAAa,CAAC,iBAAiB,CAAC,CAC1D,CAAA;AAED,qBAAa,YAAY;IACvB,MAAM,EAAE,WAAW,CAAA;gBAEP,OAAO,EAAE,YAAY;CAGlC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"video.js","sourceRoot":"","sources":["../../../src/utils/native_adapters/video.ts"],"names":[],"mappings":"AAuBA,MAAM,OAAO,YAAY;IACvB,MAAM,CAAa;IAEnB,YAAY,OAAqB;QAC/B,IAAI,CAAC,MAAM,GAAG,OAAO,CAAC,MAAM,CAAA;IAC9B,CAAC;CACF","sourcesContent":["import { StyleProp, ViewStyle } from 'react-native'\n\nexport interface VideoPlayerProps {\n source: { uri: string }\n aspectRatio?: number\n style?: StyleProp<ViewStyle>\n onFullscreenPlayerWillPresent?: () => void\n onFullscreenPlayerDidPresent?: () => void\n onFullscreenPlayerWillDismiss?: () => void\n onFullscreenPlayerDidDismiss?: () => void\n}\n\nexport interface VideoPlayerHandle {\n play: () => void\n pause: () => void\n presentFullscreenPlayer: () => void\n dismissFullscreen: () => void\n}\n\ntype VideoPlayer = React.ForwardRefExoticComponent<\n VideoPlayerProps & React.RefAttributes<VideoPlayerHandle>\n>\n\nexport class VideoAdapter {\n Player: VideoPlayer\n\n constructor(methods: VideoAdapter) {\n this.Player = methods.Player\n }\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pluralize.d.ts","sourceRoot":"","sources":["../../src/utils/pluralize.ts"],"names":[],"mappings":"AAEA,wBAAgB,SAAS,CAAC,KAAK,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,EAAE,YAAY,UAAO,UAQjF"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
const irregularInflections = { person: 'people' };
|
|
2
|
+
export function pluralize(count, singularWord, includeCount = true) {
|
|
3
|
+
const plural = count !== 1;
|
|
4
|
+
const pluralWord = irregularInflections[singularWord] || `${singularWord}s`;
|
|
5
|
+
return [
|
|
6
|
+
includeCount ? `${count.toLocaleString()} ` : '',
|
|
7
|
+
plural ? pluralWord : singularWord,
|
|
8
|
+
].join('');
|
|
9
|
+
}
|
|
10
|
+
//# sourceMappingURL=pluralize.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pluralize.js","sourceRoot":"","sources":["../../src/utils/pluralize.ts"],"names":[],"mappings":"AAAA,MAAM,oBAAoB,GAA2B,EAAE,MAAM,EAAE,QAAQ,EAAE,CAAA;AAEzE,MAAM,UAAU,SAAS,CAAC,KAAa,EAAE,YAAoB,EAAE,YAAY,GAAG,IAAI;IAChF,MAAM,MAAM,GAAG,KAAK,KAAK,CAAC,CAAA;IAC1B,MAAM,UAAU,GAAG,oBAAoB,CAAC,YAAY,CAAC,IAAI,GAAG,YAAY,GAAG,CAAA;IAE3E,OAAO;QACL,YAAY,CAAC,CAAC,CAAC,GAAG,KAAK,CAAC,cAAc,EAAE,GAAG,CAAC,CAAC,CAAC,EAAE;QAChD,MAAM,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,YAAY;KACnC,CAAC,IAAI,CAAC,EAAE,CAAC,CAAA;AACZ,CAAC","sourcesContent":["const irregularInflections: Record<string, string> = { person: 'people' }\n\nexport function pluralize(count: number, singularWord: string, includeCount = true) {\n const plural = count !== 1\n const pluralWord = irregularInflections[singularWord] || `${singularWord}s`\n\n return [\n includeCount ? `${count.toLocaleString()} ` : '',\n plural ? pluralWord : singularWord,\n ].join('')\n}\n"]}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { GetRequest } from '../client/types';
|
|
2
|
+
export interface ConversationRequestArgs {
|
|
3
|
+
filter: string;
|
|
4
|
+
gids: string;
|
|
5
|
+
group: string;
|
|
6
|
+
chat_group_graph_id?: string;
|
|
7
|
+
group_source_app_name?: string;
|
|
8
|
+
}
|
|
9
|
+
export declare const getConversationsRequestArgs: ({ filter, gids, group, group_source_app_name, }?: Partial<ConversationRequestArgs>) => GetRequest;
|
|
10
|
+
//# sourceMappingURL=conversation.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"conversation.d.ts","sourceRoot":"","sources":["../../../src/utils/request/conversation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAA;AAE5C,MAAM,WAAW,uBAAuB;IACtC,MAAM,EAAE,MAAM,CAAA;IACd,IAAI,EAAE,MAAM,CAAA;IACZ,KAAK,EAAE,MAAM,CAAA;IACb,mBAAmB,CAAC,EAAE,MAAM,CAAA;IAC5B,qBAAqB,CAAC,EAAE,MAAM,CAAA;CAC/B;AAED,eAAO,MAAM,2BAA2B,qDAKrC,OAAO,CAAC,uBAAuB,CAAC,KAAQ,UA8BzC,CAAA"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
export const getConversationsRequestArgs = ({ filter, gids, group, group_source_app_name, } = {}) => ({
|
|
2
|
+
url: '/me/conversations',
|
|
3
|
+
data: {
|
|
4
|
+
perPage: 20,
|
|
5
|
+
order: '-last_message',
|
|
6
|
+
filter,
|
|
7
|
+
group,
|
|
8
|
+
gids,
|
|
9
|
+
group_source_app_name,
|
|
10
|
+
fields: {
|
|
11
|
+
Conversation: [
|
|
12
|
+
'created_at',
|
|
13
|
+
'badges',
|
|
14
|
+
'groups',
|
|
15
|
+
'last_message_author_id',
|
|
16
|
+
'last_message_author_name',
|
|
17
|
+
'last_message_created_at',
|
|
18
|
+
'last_message_text_preview',
|
|
19
|
+
'preview_avatar_urls',
|
|
20
|
+
'member_ability',
|
|
21
|
+
'muted',
|
|
22
|
+
'replies_disabled',
|
|
23
|
+
'title',
|
|
24
|
+
'unread_count',
|
|
25
|
+
'updated_at',
|
|
26
|
+
],
|
|
27
|
+
ConversationBadge: ['app_name', 'pco_resource_type', 'text'],
|
|
28
|
+
},
|
|
29
|
+
include: ['badges'],
|
|
30
|
+
},
|
|
31
|
+
});
|
|
32
|
+
//# sourceMappingURL=conversation.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"conversation.js","sourceRoot":"","sources":["../../../src/utils/request/conversation.ts"],"names":[],"mappings":"AAUA,MAAM,CAAC,MAAM,2BAA2B,GAAG,CAAC,EAC1C,MAAM,EACN,IAAI,EACJ,KAAK,EACL,qBAAqB,MACe,EAAE,EAAc,EAAE,CAAC,CAAC;IACxD,GAAG,EAAE,mBAAmB;IACxB,IAAI,EAAE;QACJ,OAAO,EAAE,EAAE;QACX,KAAK,EAAE,eAAe;QACtB,MAAM;QACN,KAAK;QACL,IAAI;QACJ,qBAAqB;QACrB,MAAM,EAAE;YACN,YAAY,EAAE;gBACZ,YAAY;gBACZ,QAAQ;gBACR,QAAQ;gBACR,wBAAwB;gBACxB,0BAA0B;gBAC1B,yBAAyB;gBACzB,2BAA2B;gBAC3B,qBAAqB;gBACrB,gBAAgB;gBAChB,OAAO;gBACP,kBAAkB;gBAClB,OAAO;gBACP,cAAc;gBACd,YAAY;aACb;YACD,iBAAiB,EAAE,CAAC,UAAU,EAAE,mBAAmB,EAAE,MAAM,CAAC;SAC7D;QACD,OAAO,EAAE,CAAC,QAAQ,CAAC;KACpB;CACF,CAAC,CAAA","sourcesContent":["import { GetRequest } from '../client/types'\n\nexport interface ConversationRequestArgs {\n filter: string\n gids: string\n group: string\n chat_group_graph_id?: string\n group_source_app_name?: string\n}\n\nexport const getConversationsRequestArgs = ({\n filter,\n gids,\n group,\n group_source_app_name,\n}: Partial<ConversationRequestArgs> = {}): GetRequest => ({\n url: '/me/conversations',\n data: {\n perPage: 20,\n order: '-last_message',\n filter,\n group,\n gids,\n group_source_app_name,\n fields: {\n Conversation: [\n 'created_at',\n 'badges',\n 'groups',\n 'last_message_author_id',\n 'last_message_author_name',\n 'last_message_created_at',\n 'last_message_text_preview',\n 'preview_avatar_urls',\n 'member_ability',\n 'muted',\n 'replies_disabled',\n 'title',\n 'unread_count',\n 'updated_at',\n ],\n ConversationBadge: ['app_name', 'pco_resource_type', 'text'],\n },\n include: ['badges'],\n },\n})\n"]}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export declare const getMessagesRequestArgs: ({ conversation_id }: {
|
|
2
|
+
conversation_id: number;
|
|
3
|
+
}) => {
|
|
4
|
+
url: string;
|
|
5
|
+
data: {
|
|
6
|
+
perPage: number;
|
|
7
|
+
fields: {
|
|
8
|
+
Message: string[];
|
|
9
|
+
Person: string[];
|
|
10
|
+
ReactionCount: string[];
|
|
11
|
+
};
|
|
12
|
+
include: string[];
|
|
13
|
+
};
|
|
14
|
+
};
|
|
15
|
+
//# sourceMappingURL=messages.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"messages.d.ts","sourceRoot":"","sources":["../../../src/utils/request/messages.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,sBAAsB,wBAAyB;IAAE,eAAe,EAAE,MAAM,CAAA;CAAE;;;;;;;;;;;CAoBrF,CAAA"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
export const getMessagesRequestArgs = ({ conversation_id }) => ({
|
|
2
|
+
url: `/me/conversations/${conversation_id}/messages`,
|
|
3
|
+
data: {
|
|
4
|
+
perPage: 25,
|
|
5
|
+
fields: {
|
|
6
|
+
Message: [
|
|
7
|
+
'text',
|
|
8
|
+
'text_edited_at',
|
|
9
|
+
'mine',
|
|
10
|
+
'attachments',
|
|
11
|
+
'created_at',
|
|
12
|
+
'deleted_at',
|
|
13
|
+
'author',
|
|
14
|
+
'reaction_counts',
|
|
15
|
+
],
|
|
16
|
+
Person: ['name', 'avatar'],
|
|
17
|
+
ReactionCount: ['value', 'count', 'mine', 'message_id', 'author_ids'],
|
|
18
|
+
},
|
|
19
|
+
include: ['author', 'reaction_counts'],
|
|
20
|
+
},
|
|
21
|
+
});
|
|
22
|
+
//# sourceMappingURL=messages.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"messages.js","sourceRoot":"","sources":["../../../src/utils/request/messages.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,sBAAsB,GAAG,CAAC,EAAE,eAAe,EAA+B,EAAE,EAAE,CAAC,CAAC;IAC3F,GAAG,EAAE,qBAAqB,eAAe,WAAW;IACpD,IAAI,EAAE;QACJ,OAAO,EAAE,EAAE;QACX,MAAM,EAAE;YACN,OAAO,EAAE;gBACP,MAAM;gBACN,gBAAgB;gBAChB,MAAM;gBACN,aAAa;gBACb,YAAY;gBACZ,YAAY;gBACZ,QAAQ;gBACR,iBAAiB;aAClB;YACD,MAAM,EAAE,CAAC,MAAM,EAAE,QAAQ,CAAC;YAC1B,aAAa,EAAE,CAAC,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,YAAY,EAAE,YAAY,CAAC;SACtE;QACD,OAAO,EAAE,CAAC,QAAQ,EAAE,iBAAiB,CAAC;KACvC;CACF,CAAC,CAAA","sourcesContent":["export const getMessagesRequestArgs = ({ conversation_id }: { conversation_id: number }) => ({\n url: `/me/conversations/${conversation_id}/messages`,\n data: {\n perPage: 25,\n fields: {\n Message: [\n 'text',\n 'text_edited_at',\n 'mine',\n 'attachments',\n 'created_at',\n 'deleted_at',\n 'author',\n 'reaction_counts',\n ],\n Person: ['name', 'avatar'],\n ReactionCount: ['value', 'count', 'mine', 'message_id', 'author_ids'],\n },\n include: ['author', 'reaction_counts'],\n },\n})\n"]}
|
package/build/utils/theme.d.ts
CHANGED
|
@@ -22,7 +22,7 @@ export interface DefaultTheme {
|
|
|
22
22
|
button: {
|
|
23
23
|
borderRadius: number;
|
|
24
24
|
};
|
|
25
|
-
|
|
25
|
+
showBadgeProductLogo: boolean;
|
|
26
26
|
}
|
|
27
27
|
export declare const defaultTheme: (colorScheme: ColorSchemeName) => ChatTheme;
|
|
28
28
|
export type TemporaryDefaultColorsType = Partial<ChatColors>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"theme.d.ts","sourceRoot":"","sources":["../../src/utils/theme.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAA;AAE9C,OAAO,EAAE,mBAAmB,EAAE,MAAM,2CAA2C,CAAA;AAE/E,MAAM,WAAW,SAAU,SAAQ,YAAY;IAC7C,MAAM,EAAE,YAAY,CAAC,QAAQ,CAAC,GAC5B,CAAC,OAAO,mBAAmB,CAAC,KAAK,GAAG,OAAO,mBAAmB,CAAC,IAAI,CAAC,CAAA;CACvE;AAED;;;;;;;;;;;;;gDAagD;AAEhD,MAAM,WAAW,YAAY;IAC3B,MAAM,EAAE,UAAU,CAAA;IAClB,MAAM,EAAE;QACN,YAAY,EAAE,MAAM,CAAA;KACrB,CAAA;IACD,
|
|
1
|
+
{"version":3,"file":"theme.d.ts","sourceRoot":"","sources":["../../src/utils/theme.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAA;AAE9C,OAAO,EAAE,mBAAmB,EAAE,MAAM,2CAA2C,CAAA;AAE/E,MAAM,WAAW,SAAU,SAAQ,YAAY;IAC7C,MAAM,EAAE,YAAY,CAAC,QAAQ,CAAC,GAC5B,CAAC,OAAO,mBAAmB,CAAC,KAAK,GAAG,OAAO,mBAAmB,CAAC,IAAI,CAAC,CAAA;CACvE;AAED;;;;;;;;;;;;;gDAagD;AAEhD,MAAM,WAAW,YAAY;IAC3B,MAAM,EAAE,UAAU,CAAA;IAClB,MAAM,EAAE;QACN,YAAY,EAAE,MAAM,CAAA;KACrB,CAAA;IACD,oBAAoB,EAAE,OAAO,CAAA;CAC9B;AAED,eAAO,MAAM,YAAY,gBAAiB,eAAe,KAAG,SAe3D,CAAA;AAED,MAAM,MAAM,0BAA0B,GAAG,OAAO,CAAC,UAAU,CAAC,CAAA;AAE5D,UAAU,UAAU;IAClB,IAAI,EAAE,MAAM,CAAA;IACZ,WAAW,EAAE,MAAM,GAAG,SAAS,CAAA;IAC/B,SAAS,EAAE,MAAM,GAAG,SAAS,CAAA;IAC7B,WAAW,EAAE,MAAM,CAAA;IACnB,eAAe,EAAE,MAAM,GAAG,SAAS,CAAA;IACnC,gBAAgB,EAAE,MAAM,GAAG,SAAS,CAAA;IACpC,gBAAgB,EAAE,MAAM,GAAG,SAAS,CAAA;IACpC,SAAS,EAAE,MAAM,CAAA;IACjB,cAAc,EAAE,MAAM,CAAA;IACtB,cAAc,EAAE,MAAM,CAAA;IACtB,oBAAoB,EAAE,MAAM,CAAA;IAC5B,iBAAiB,EAAE,MAAM,CAAA;IACzB,iBAAiB,EAAE,MAAM,CAAA;IACzB,uBAAuB,EAAE,MAAM,CAAA;IAC/B,iBAAiB,EAAE,MAAM,CAAA;IACzB,iBAAiB,EAAE,MAAM,CAAA;IACzB,uBAAuB,EAAE,MAAM,CAAA;IAC/B,eAAe,EAAE,MAAM,CAAA;IACvB,eAAe,EAAE,MAAM,CAAA;IACvB,qBAAqB,EAAE,MAAM,CAAA;IAC7B,iBAAiB,EAAE,MAAM,CAAA;IACzB,iBAAiB,EAAE,MAAM,CAAA;IACzB,uBAAuB,EAAE,MAAM,CAAA;IAC/B,sBAAsB,EAAE,MAAM,CAAA;CAC/B"}
|
package/build/utils/theme.js
CHANGED
|
@@ -11,7 +11,7 @@ export const defaultTheme = (colorScheme) => {
|
|
|
11
11
|
button: {
|
|
12
12
|
borderRadius: 40,
|
|
13
13
|
},
|
|
14
|
-
|
|
14
|
+
showBadgeProductLogo: true, // Overrides visibility of the product logo in `src/display/badge.tsx`
|
|
15
15
|
};
|
|
16
16
|
};
|
|
17
17
|
const colorsChatLight = {
|
package/build/utils/theme.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"theme.js","sourceRoot":"","sources":["../../src/utils/theme.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,MAAM,2BAA2B,CAAA;AAClD,OAAO,EAAE,mBAAmB,EAAE,MAAM,2CAA2C,CAAA;AA8B/E,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC,WAA4B,EAAa,EAAE;IACtE,MAAM,MAAM,GAAG,WAAW,IAAI,OAAO,CAAA;IAErC,MAAM,aAAa,GAAG;QACpB,GAAG,iBAAiB,CAAC,MAAM,CAAC;QAC5B,GAAG,mBAAmB,CAAC,MAAM,CAAC;KAC/B,CAAA;IAED,OAAO;QACL,MAAM,EAAE,aAAa;QACrB,MAAM,EAAE;YACN,YAAY,EAAE,EAAE;SACjB;QACD,
|
|
1
|
+
{"version":3,"file":"theme.js","sourceRoot":"","sources":["../../src/utils/theme.ts"],"names":[],"mappings":"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","sourcesContent":["import { ColorSchemeName } from 'react-native'\nimport { tokens } from '../vendor/tapestry/tokens'\nimport { aliasTokensColorMap } from '../vendor/tapestry/alias_tokens_color_map'\n\nexport interface ChatTheme extends DefaultTheme {\n colors: DefaultTheme['colors'] &\n (typeof aliasTokensColorMap.light | typeof aliasTokensColorMap.dark)\n}\n\n/** =============================================\n NOTE: The specific values for `colors` and the `productBadge` are temporary examples that can be replaced once we start building out UI. This line's comment can be removed at that time too.\n\n The default theme is intended to support two types of customizations:\n 1. Specific color properties for a chat component (eg. `primaryButtonBackgroundColor`)\n 2. Any styles for a specific component. (Use only one level of nesting.)\n ```\n primaryButton: {\n borderRadius: number\n container: ViewStyle\n text: TextStyle\n }\n ```\n============================================= */\n\nexport interface DefaultTheme {\n colors: ChatColors\n button: {\n borderRadius: number\n }\n showBadgeProductLogo: boolean\n}\n\nexport const defaultTheme = (colorScheme: ColorSchemeName): ChatTheme => {\n const scheme = colorScheme || 'light'\n\n const defaultColors = {\n ...chatThemeColorMap[scheme],\n ...aliasTokensColorMap[scheme],\n }\n\n return {\n colors: defaultColors,\n button: {\n borderRadius: 40,\n },\n showBadgeProductLogo: true, // Overrides visibility of the product logo in `src/display/badge.tsx`\n }\n}\n\nexport type TemporaryDefaultColorsType = Partial<ChatColors>\n\ninterface ChatColors {\n name: string\n buttonStart: string | undefined\n buttonEnd: string | undefined\n interaction: string\n switchTrackTrue: string | undefined\n switchTrackFalse: string | undefined\n switchThumbColor: string | undefined\n testColor: string\n statusInfoIcon: string\n statusInfoText: string\n statusInfoBackground: string\n statusSuccessIcon: string\n statusSuccessText: string\n statusSuccessBackground: string\n statusWarningIcon: string\n statusWarningText: string\n statusWarningBackground: string\n statusErrorIcon: string\n statusErrorText: string\n statusErrorBackground: string\n statusNeutralIcon: string\n statusNeutralText: string\n statusNeutralBackground: string\n borderColorStatusError: string\n}\n\nconst colorsChatLight: ChatColors = {\n name: 'light',\n buttonStart: undefined,\n buttonEnd: undefined,\n interaction: tokens.fillColorInteractionDefault,\n switchTrackTrue: undefined,\n switchTrackFalse: undefined,\n switchThumbColor: undefined,\n testColor: 'hotpink',\n statusInfoIcon: tokens.iconColorStatusInfoPrimary,\n statusInfoText: tokens.textColorStatusInfo,\n statusInfoBackground: tokens.fillColorStatusInfoGhost,\n statusSuccessIcon: tokens.iconColorStatusSuccessPrimary,\n statusSuccessText: tokens.textColorStatusSuccess,\n statusSuccessBackground: tokens.fillColorStatusSuccessGhost,\n statusWarningIcon: tokens.iconColorStatusWarningPrimary,\n statusWarningText: tokens.textColorStatusWarning,\n statusWarningBackground: tokens.fillColorStatusWarningGhost,\n statusErrorIcon: tokens.iconColorStatusErrorPrimary,\n statusErrorText: tokens.textColorStatusError,\n statusErrorBackground: tokens.fillColorStatusErrorGhost,\n statusNeutralIcon: tokens.iconColorStatusNeutralPrimary,\n statusNeutralText: tokens.textColorStatusNeutral,\n statusNeutralBackground: tokens.fillColorStatusNeutralGhost,\n borderColorStatusError: tokens.borderColorStatusError,\n}\n\nconst colorsChatDark: ChatColors = {\n name: 'dark',\n buttonStart: undefined,\n buttonEnd: undefined,\n interaction: tokens.fillColorInteractionDefaultDark,\n switchTrackTrue: undefined,\n switchTrackFalse: undefined,\n switchThumbColor: undefined,\n testColor: 'pink',\n statusInfoIcon: tokens.iconColorStatusInfoPrimaryDark,\n statusInfoText: tokens.textColorStatusInfoDark,\n statusInfoBackground: tokens.fillColorStatusInfoGhostDark,\n statusSuccessIcon: tokens.iconColorStatusSuccessPrimaryDark,\n statusSuccessText: tokens.textColorStatusSuccessDark,\n statusSuccessBackground: tokens.fillColorStatusSuccessGhostDark,\n statusWarningIcon: tokens.iconColorStatusWarningPrimaryDark,\n statusWarningText: tokens.textColorStatusWarningDark,\n statusWarningBackground: tokens.fillColorStatusWarningGhostDark,\n statusErrorIcon: tokens.iconColorStatusErrorPrimaryDark,\n statusErrorText: tokens.textColorStatusErrorDark,\n statusErrorBackground: tokens.fillColorStatusErrorGhostDark,\n statusNeutralIcon: tokens.iconColorStatusNeutralPrimaryDark,\n statusNeutralText: tokens.textColorStatusNeutralDark,\n statusNeutralBackground: tokens.fillColorStatusNeutralGhostDark,\n borderColorStatusError: tokens.borderColorStatusErrorDark,\n}\n\nconst chatThemeColorMap = {\n light: colorsChatLight,\n dark: colorsChatDark,\n}\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@planningcenter/chat-react-native",
|
|
3
|
-
"version": "3.1.0-rc.
|
|
3
|
+
"version": "3.1.0-rc.14",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "build/index.js",
|
|
6
6
|
"types": "build/index.d.ts",
|
|
@@ -52,5 +52,5 @@
|
|
|
52
52
|
"prettier": "^3.4.2",
|
|
53
53
|
"typescript": "<5.6.0"
|
|
54
54
|
},
|
|
55
|
-
"gitHead": "
|
|
55
|
+
"gitHead": "48ab2ec3519c19745d277059d6f3ed4f2576e6e5"
|
|
56
56
|
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { pluralize } from '../../utils'
|
|
2
|
+
|
|
3
|
+
describe('pluralize', () => {
|
|
4
|
+
it('includes count and adds an s', () => {
|
|
5
|
+
expect(pluralize(0, 'kid')).toEqual('0 kids')
|
|
6
|
+
expect(pluralize(1, 'kid')).toEqual('1 kid')
|
|
7
|
+
expect(pluralize(2, 'kid')).toEqual('2 kids')
|
|
8
|
+
expect(pluralize(10, 'kid')).toEqual('10 kids')
|
|
9
|
+
})
|
|
10
|
+
it('can optionally not include count', () => {
|
|
11
|
+
expect(pluralize(1, 'kid', false)).toEqual('kid')
|
|
12
|
+
expect(pluralize(2, 'kid', false)).toEqual('kids')
|
|
13
|
+
})
|
|
14
|
+
it('can convert "person" to "people"', () => {
|
|
15
|
+
expect(pluralize(2, 'person', false)).toEqual('people')
|
|
16
|
+
})
|
|
17
|
+
})
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import React, { ComponentProps, ReactNode } 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
|
+
|
|
8
|
+
type AttachmentCardProps = ComponentProps<typeof View>
|
|
9
|
+
|
|
10
|
+
export function AttachmentCard({ children, ...props }: AttachmentCardProps) {
|
|
11
|
+
const styles = useStyles()
|
|
12
|
+
|
|
13
|
+
return (
|
|
14
|
+
<View style={styles.card} {...props}>
|
|
15
|
+
{children}
|
|
16
|
+
</View>
|
|
17
|
+
)
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export function AttachmentCardTitle({ children }: { children: ReactNode }) {
|
|
21
|
+
const styles = useStyles()
|
|
22
|
+
|
|
23
|
+
return (
|
|
24
|
+
<Text style={styles.title} numberOfLines={1} ellipsizeMode="tail" selectable={false}>
|
|
25
|
+
{children}
|
|
26
|
+
</Text>
|
|
27
|
+
)
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
const useStyles = () => {
|
|
31
|
+
const { colors } = useTheme()
|
|
32
|
+
|
|
33
|
+
return StyleSheet.create({
|
|
34
|
+
card: {
|
|
35
|
+
padding: 4,
|
|
36
|
+
backgroundColor: 'white',
|
|
37
|
+
borderRadius: 8,
|
|
38
|
+
minWidth: MESSAGE_ATTACHMENT_WIDTH_SINGLE,
|
|
39
|
+
minHeight: 48,
|
|
40
|
+
},
|
|
41
|
+
title: {
|
|
42
|
+
color: colors.textColorDefaultPrimary,
|
|
43
|
+
fontSize: tokens.fontSizeSm,
|
|
44
|
+
},
|
|
45
|
+
})
|
|
46
|
+
}
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
import { View, Text, StyleSheet } from 'react-native'
|
|
3
|
+
import { DenormalizedMessageAttachmentResource } from '../../../types/resources/denormalized_attachment_resource'
|
|
4
|
+
import { IconButton } from '../../display'
|
|
5
|
+
import { AttachmentCard, AttachmentCardTitle } from './attachment_card'
|
|
6
|
+
import { tokens } from '../../../vendor/tapestry/tokens'
|
|
7
|
+
import { useTheme } from '../../../hooks'
|
|
8
|
+
import { Audio } from '../../../utils/native_adapters'
|
|
9
|
+
|
|
10
|
+
export function AudioAttachment({
|
|
11
|
+
attachment,
|
|
12
|
+
}: {
|
|
13
|
+
attachment: DenormalizedMessageAttachmentResource
|
|
14
|
+
}) {
|
|
15
|
+
const styles = useStyles()
|
|
16
|
+
const { attributes } = attachment
|
|
17
|
+
const { url, filename } = attributes
|
|
18
|
+
const sound = Audio.useAudio(url)
|
|
19
|
+
|
|
20
|
+
function toggleAudio() {
|
|
21
|
+
if (!sound.isPlaying) {
|
|
22
|
+
sound.play()
|
|
23
|
+
} else {
|
|
24
|
+
sound.pause()
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
const progress = sound.duration > 0 ? sound.position / sound.duration : 0
|
|
29
|
+
|
|
30
|
+
function durationText() {
|
|
31
|
+
if (sound.duration > 0) {
|
|
32
|
+
return `${Math.floor(sound.position / 1000)}s / ${Math.floor(sound.duration / 1000)}s`
|
|
33
|
+
} else {
|
|
34
|
+
return 'Loading...'
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
return (
|
|
39
|
+
<AttachmentCard>
|
|
40
|
+
<View style={styles.container}>
|
|
41
|
+
<IconButton
|
|
42
|
+
name={sound.isPlaying ? 'services.pause' : 'services.play'}
|
|
43
|
+
size="md"
|
|
44
|
+
accessibilityLabel={sound.isPlaying ? 'Pause' : 'Play'}
|
|
45
|
+
onPress={toggleAudio}
|
|
46
|
+
disabled={!sound}
|
|
47
|
+
style={styles.button}
|
|
48
|
+
/>
|
|
49
|
+
<View style={styles.details}>
|
|
50
|
+
<AttachmentCardTitle>{filename}</AttachmentCardTitle>
|
|
51
|
+
<View style={styles.progressContainer}>
|
|
52
|
+
<View style={[styles.progressBar, { width: `${progress * 100}%` }]} />
|
|
53
|
+
</View>
|
|
54
|
+
<Text style={styles.durationText}>{durationText()}</Text>
|
|
55
|
+
</View>
|
|
56
|
+
</View>
|
|
57
|
+
</AttachmentCard>
|
|
58
|
+
)
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
const useStyles = () => {
|
|
62
|
+
const { colors } = useTheme()
|
|
63
|
+
|
|
64
|
+
return StyleSheet.create({
|
|
65
|
+
container: {
|
|
66
|
+
flexDirection: 'row',
|
|
67
|
+
},
|
|
68
|
+
button: {
|
|
69
|
+
width: 42,
|
|
70
|
+
height: 42,
|
|
71
|
+
justifyContent: 'center',
|
|
72
|
+
alignItems: 'center',
|
|
73
|
+
borderRadius: 25,
|
|
74
|
+
backgroundColor: '#eee',
|
|
75
|
+
borderColor: '#aaa',
|
|
76
|
+
borderWidth: 1,
|
|
77
|
+
},
|
|
78
|
+
buttonText: {
|
|
79
|
+
fontSize: 32,
|
|
80
|
+
lineHeight: 32,
|
|
81
|
+
},
|
|
82
|
+
details: {
|
|
83
|
+
flex: 1,
|
|
84
|
+
marginLeft: 10,
|
|
85
|
+
gap: 5,
|
|
86
|
+
},
|
|
87
|
+
progressContainer: {
|
|
88
|
+
height: 5,
|
|
89
|
+
backgroundColor: '#ccc',
|
|
90
|
+
borderRadius: 2.5,
|
|
91
|
+
overflow: 'hidden',
|
|
92
|
+
},
|
|
93
|
+
progressBar: {
|
|
94
|
+
height: '100%',
|
|
95
|
+
backgroundColor: 'blue',
|
|
96
|
+
},
|
|
97
|
+
durationText: {
|
|
98
|
+
fontSize: tokens.fontSizeXs,
|
|
99
|
+
color: colors.textColorDefaultSecondary,
|
|
100
|
+
},
|
|
101
|
+
})
|
|
102
|
+
}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
import { IconButton } from '../../display'
|
|
3
|
+
import { useTheme } from '../../../hooks'
|
|
4
|
+
import { Linking, StyleSheet } from 'react-native'
|
|
5
|
+
|
|
6
|
+
interface DownloadAttachmentButtonProps {
|
|
7
|
+
to: string
|
|
8
|
+
filename: string
|
|
9
|
+
title: string
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export function DownloadAttachmentButton({ to, title }: DownloadAttachmentButtonProps) {
|
|
13
|
+
const styles = useStyles()
|
|
14
|
+
async function handleDownload() {
|
|
15
|
+
if (to) {
|
|
16
|
+
// Open link in the default web browser
|
|
17
|
+
Linking.openURL(to)
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
return (
|
|
22
|
+
<IconButton
|
|
23
|
+
name="general.fromCloudArrow"
|
|
24
|
+
size="md"
|
|
25
|
+
accessibilityLabel={title}
|
|
26
|
+
onPress={handleDownload}
|
|
27
|
+
style={styles.iconButton}
|
|
28
|
+
/>
|
|
29
|
+
)
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
const useStyles = () => {
|
|
33
|
+
const { colors } = useTheme()
|
|
34
|
+
|
|
35
|
+
return StyleSheet.create({
|
|
36
|
+
iconButton: {
|
|
37
|
+
color: colors.fillColorInteractionDefault,
|
|
38
|
+
backgroundColor: colors.fillColorNeutral070,
|
|
39
|
+
borderWidth: 1,
|
|
40
|
+
borderColor: colors.fillColorNeutral060,
|
|
41
|
+
borderRadius: 4,
|
|
42
|
+
width: 24,
|
|
43
|
+
height: 24,
|
|
44
|
+
},
|
|
45
|
+
})
|
|
46
|
+
}
|
|
@@ -0,0 +1,54 @@
|
|
|
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
|
+
|
|
6
|
+
export function ExpandedLink({ attachment }: { attachment: any }) {
|
|
7
|
+
const styles = useStyles()
|
|
8
|
+
const { attributes } = attachment
|
|
9
|
+
const { url, title, description, imageUrl, imageHeight, imageWidth } = attributes
|
|
10
|
+
|
|
11
|
+
const aspectRatio = imageWidth && imageHeight ? imageWidth / imageHeight : 1
|
|
12
|
+
|
|
13
|
+
async function openUrl() {
|
|
14
|
+
if (url) Linking.openURL(url)
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
return (
|
|
18
|
+
<Pressable style={styles.container} onPress={openUrl}>
|
|
19
|
+
{imageUrl && (
|
|
20
|
+
<Image source={{ uri: imageUrl }} style={[styles.image, { aspectRatio }]} alt={title} />
|
|
21
|
+
)}
|
|
22
|
+
{(title || description) && (
|
|
23
|
+
<View style={styles.textWrapper}>
|
|
24
|
+
{title && <Text style={styles.title}>{title}</Text>}
|
|
25
|
+
{description && <Text style={styles.description}>{description}</Text>}
|
|
26
|
+
</View>
|
|
27
|
+
)}
|
|
28
|
+
</Pressable>
|
|
29
|
+
)
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
const useStyles = () => {
|
|
33
|
+
const { colors } = useTheme()
|
|
34
|
+
|
|
35
|
+
return StyleSheet.create({
|
|
36
|
+
container: {},
|
|
37
|
+
image: {
|
|
38
|
+
borderRadius: 8,
|
|
39
|
+
},
|
|
40
|
+
textWrapper: {
|
|
41
|
+
gap: 4,
|
|
42
|
+
padding: 8,
|
|
43
|
+
},
|
|
44
|
+
title: {
|
|
45
|
+
fontSize: tokens.fontSizeSm,
|
|
46
|
+
fontWeight: tokens.fontWeightMedium,
|
|
47
|
+
color: colors.textColorDefaultPrimary,
|
|
48
|
+
},
|
|
49
|
+
description: {
|
|
50
|
+
fontSize: tokens.fontSizeXs,
|
|
51
|
+
color: colors.textColorDefaultPrimary,
|
|
52
|
+
},
|
|
53
|
+
})
|
|
54
|
+
}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
import { Pressable, StyleSheet, View } from 'react-native'
|
|
3
|
+
import { DenormalizedMessageAttachmentResource } from '../../../types/resources/denormalized_attachment_resource'
|
|
4
|
+
import { AttachmentCard, AttachmentCardTitle } from './attachment_card'
|
|
5
|
+
import { Icon } from '../../display'
|
|
6
|
+
import { DownloadAttachmentButton } from './download_attachment_button'
|
|
7
|
+
import { useTheme } from '../../../hooks'
|
|
8
|
+
|
|
9
|
+
export function GenericFileAttachment({
|
|
10
|
+
attachment,
|
|
11
|
+
}: {
|
|
12
|
+
attachment: DenormalizedMessageAttachmentResource
|
|
13
|
+
}) {
|
|
14
|
+
const styles = useStyles()
|
|
15
|
+
const { url, filename, contentType } = attachment.attributes
|
|
16
|
+
const iconName = getAttachmentIconName(contentType)
|
|
17
|
+
const fileTypeLabel = contentType === 'application/pdf' ? 'PDF' : 'file'
|
|
18
|
+
|
|
19
|
+
return (
|
|
20
|
+
<Pressable>
|
|
21
|
+
<AttachmentCard>
|
|
22
|
+
<View style={styles.container}>
|
|
23
|
+
<View style={styles.stack}>
|
|
24
|
+
<Icon name={iconName} />
|
|
25
|
+
<AttachmentCardTitle>{filename}</AttachmentCardTitle>
|
|
26
|
+
</View>
|
|
27
|
+
<DownloadAttachmentButton
|
|
28
|
+
to={url}
|
|
29
|
+
filename={filename}
|
|
30
|
+
title={`Download ${fileTypeLabel}`}
|
|
31
|
+
/>
|
|
32
|
+
</View>
|
|
33
|
+
</AttachmentCard>
|
|
34
|
+
</Pressable>
|
|
35
|
+
)
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
const useStyles = () => {
|
|
39
|
+
const { colors } = useTheme()
|
|
40
|
+
|
|
41
|
+
return StyleSheet.create({
|
|
42
|
+
container: {
|
|
43
|
+
padding: 8,
|
|
44
|
+
gap: 4,
|
|
45
|
+
flexDirection: 'row',
|
|
46
|
+
alignItems: 'center',
|
|
47
|
+
justifyContent: 'space-between',
|
|
48
|
+
minHeight: 48,
|
|
49
|
+
},
|
|
50
|
+
stack: {
|
|
51
|
+
gap: 4,
|
|
52
|
+
flexDirection: 'row',
|
|
53
|
+
alignItems: 'center',
|
|
54
|
+
maxWidth: '70%',
|
|
55
|
+
},
|
|
56
|
+
icon: {
|
|
57
|
+
color: colors.textColorDefaultPrimary,
|
|
58
|
+
width: 24,
|
|
59
|
+
height: 24,
|
|
60
|
+
},
|
|
61
|
+
})
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
export function getAttachmentIconName(type: string) {
|
|
65
|
+
const isImage = type.startsWith('image/')
|
|
66
|
+
const isVideo = type.startsWith('video/')
|
|
67
|
+
const isAudio = type.startsWith('audio/')
|
|
68
|
+
const isPdf = type === 'application/pdf'
|
|
69
|
+
|
|
70
|
+
if (isImage) return 'general.outlinedImageFile'
|
|
71
|
+
if (isVideo) return 'general.outlinedVideoFile'
|
|
72
|
+
if (isAudio) return 'general.outlinedMusicFile'
|
|
73
|
+
if (isPdf) return 'general.outlinedPdfFile'
|
|
74
|
+
return 'general.outlinedGenericFile'
|
|
75
|
+
}
|