@planningcenter/chat-react-native 3.1.0-rc.9 → 3.2.0-rc.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/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 +76 -0
- package/build/hooks/use_conversation.d.ts.map +1 -1
- package/build/hooks/use_conversation.js +47 -3
- 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 +4 -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 +139 -59
- package/build/screens/conversation_details_screen.js.map +1 -1
- package/build/screens/conversation_filters/components/conversation_filters.d.ts +3 -0
- package/build/screens/conversation_filters/components/conversation_filters.d.ts.map +1 -0
- package/build/screens/conversation_filters/components/conversation_filters.js +173 -0
- package/build/screens/conversation_filters/components/conversation_filters.js.map +1 -0
- package/build/screens/conversation_filters/components/rows.d.ts +31 -0
- package/build/screens/conversation_filters/components/rows.d.ts.map +1 -0
- package/build/screens/conversation_filters/components/rows.js +111 -0
- package/build/screens/conversation_filters/components/rows.js.map +1 -0
- package/build/screens/conversation_filters/context/conversation_filter_context.d.ts +23 -0
- package/build/screens/conversation_filters/context/conversation_filter_context.d.ts.map +1 -0
- package/build/screens/conversation_filters/context/conversation_filter_context.js +51 -0
- package/build/screens/conversation_filters/context/conversation_filter_context.js.map +1 -0
- package/build/screens/conversation_filters/filter_types.d.ts +7 -0
- package/build/screens/conversation_filters/filter_types.d.ts.map +1 -0
- package/build/screens/conversation_filters/filter_types.js +8 -0
- package/build/screens/conversation_filters/filter_types.js.map +1 -0
- package/build/screens/conversation_filters/group_filters.d.ts +6 -0
- package/build/screens/conversation_filters/group_filters.d.ts.map +1 -0
- package/build/screens/conversation_filters/group_filters.js +15 -0
- package/build/screens/conversation_filters/group_filters.js.map +1 -0
- package/build/screens/conversation_filters/hooks/filters.d.ts +415 -0
- package/build/screens/conversation_filters/hooks/filters.d.ts.map +1 -0
- package/build/screens/conversation_filters/hooks/filters.js +41 -0
- package/build/screens/conversation_filters/hooks/filters.js.map +1 -0
- package/build/screens/conversation_filters/screen_props.d.ts +13 -0
- package/build/screens/conversation_filters/screen_props.d.ts.map +1 -0
- package/build/screens/conversation_filters/screen_props.js +2 -0
- package/build/screens/conversation_filters/screen_props.js.map +1 -0
- package/build/screens/conversation_filters/team_filters.d.ts +6 -0
- package/build/screens/conversation_filters/team_filters.d.ts.map +1 -0
- package/build/screens/conversation_filters/team_filters.js +15 -0
- package/build/screens/conversation_filters/team_filters.js.map +1 -0
- package/build/screens/conversation_filters_screen.d.ts +6 -0
- package/build/screens/conversation_filters_screen.d.ts.map +1 -0
- package/build/screens/conversation_filters_screen.js +125 -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/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 +51 -3
- 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 +224 -111
- package/src/screens/conversation_filters/components/conversation_filters.tsx +233 -0
- package/src/screens/conversation_filters/components/rows.tsx +164 -0
- package/src/screens/conversation_filters/context/conversation_filter_context.tsx +65 -0
- package/src/screens/conversation_filters/filter_types.ts +6 -0
- package/src/screens/conversation_filters/group_filters.tsx +31 -0
- package/src/screens/conversation_filters/hooks/filters.ts +68 -0
- package/src/screens/conversation_filters/screen_props.ts +15 -0
- package/src/screens/conversation_filters/team_filters.tsx +31 -0
- package/src/screens/conversation_filters_screen.tsx +152 -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,152 @@
|
|
|
1
|
+
import { HeaderTitle, HeaderTitleProps, useHeaderHeight } from '@react-navigation/elements'
|
|
2
|
+
import { createComponentForStaticNavigation, RouteProp, useRoute } from '@react-navigation/native'
|
|
3
|
+
import {
|
|
4
|
+
createNativeStackNavigator,
|
|
5
|
+
NativeStackNavigationOptions,
|
|
6
|
+
} from '@react-navigation/native-stack'
|
|
7
|
+
import React from 'react'
|
|
8
|
+
import { Platform, StyleSheet, useWindowDimensions, View } from 'react-native'
|
|
9
|
+
import { useSafeAreaInsets } from 'react-native-safe-area-context'
|
|
10
|
+
import { Button, TextButton } from '../components'
|
|
11
|
+
import {
|
|
12
|
+
FilterContext,
|
|
13
|
+
FilterProvider,
|
|
14
|
+
} from './conversation_filters/context/conversation_filter_context'
|
|
15
|
+
import { ConversationFilters } from './conversation_filters/components/conversation_filters'
|
|
16
|
+
import { GroupFilters } from './conversation_filters/group_filters'
|
|
17
|
+
import {
|
|
18
|
+
ConversationFiltersScreenProps,
|
|
19
|
+
ConversationFilterStackParamList,
|
|
20
|
+
} from './conversation_filters/screen_props'
|
|
21
|
+
import { useTheme } from '../hooks'
|
|
22
|
+
import { TeamFilters } from './conversation_filters/team_filters'
|
|
23
|
+
|
|
24
|
+
const FilterHeaderTitle = ({ tintColor }: HeaderTitleProps) => {
|
|
25
|
+
const styles = useStyles()
|
|
26
|
+
return <HeaderTitle style={[styles.headerTitle, { color: tintColor }]}>Filters</HeaderTitle>
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
const HeaderRight = () => {
|
|
30
|
+
const { resetFilter, applyFilters } = React.useContext(FilterContext)
|
|
31
|
+
const route = useRoute<RouteProp<ConversationFiltersScreenProps['route']>>()
|
|
32
|
+
const styles = useStyles()
|
|
33
|
+
|
|
34
|
+
return (
|
|
35
|
+
<View style={styles.headerRight}>
|
|
36
|
+
<TextButton onPress={resetFilter}>Reset</TextButton>
|
|
37
|
+
<Button title="Apply" onPress={() => applyFilters(route.params)} />
|
|
38
|
+
</View>
|
|
39
|
+
)
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
const HeaderRightWithContext = () => {
|
|
43
|
+
return (
|
|
44
|
+
<FilterProvider>
|
|
45
|
+
<HeaderRight />
|
|
46
|
+
</FilterProvider>
|
|
47
|
+
)
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
export const ConversationFiltersScreenOptions: NativeStackNavigationOptions = {
|
|
51
|
+
presentation: Platform.select({ android: 'modal', ios: 'formSheet' }),
|
|
52
|
+
sheetAllowedDetents: Platform.select({
|
|
53
|
+
android: [0.75, 0.94],
|
|
54
|
+
default: [0.75, 1],
|
|
55
|
+
}),
|
|
56
|
+
sheetGrabberVisible: true,
|
|
57
|
+
headerBackVisible: false,
|
|
58
|
+
headerRight: HeaderRightWithContext,
|
|
59
|
+
headerTitle: FilterHeaderTitle,
|
|
60
|
+
headerTitleAlign: 'left',
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
const FilterNavigator = createNativeStackNavigator<ConversationFilterStackParamList>({
|
|
64
|
+
initialRouteName: 'Filters',
|
|
65
|
+
screens: {
|
|
66
|
+
Filters: {
|
|
67
|
+
screen: ConversationFilters,
|
|
68
|
+
options: {
|
|
69
|
+
headerShown: false,
|
|
70
|
+
},
|
|
71
|
+
},
|
|
72
|
+
GroupFilters: {
|
|
73
|
+
screen: GroupFilters,
|
|
74
|
+
options: {
|
|
75
|
+
headerTitle: Platform.select({
|
|
76
|
+
android: 'Groups',
|
|
77
|
+
ios: '',
|
|
78
|
+
}),
|
|
79
|
+
headerBackTitle: 'Groups',
|
|
80
|
+
},
|
|
81
|
+
},
|
|
82
|
+
TeamFilters: {
|
|
83
|
+
screen: TeamFilters,
|
|
84
|
+
options: {
|
|
85
|
+
headerTitle: Platform.select({
|
|
86
|
+
android: 'Teams',
|
|
87
|
+
ios: '',
|
|
88
|
+
}),
|
|
89
|
+
headerBackTitle: 'Teams',
|
|
90
|
+
},
|
|
91
|
+
},
|
|
92
|
+
},
|
|
93
|
+
})
|
|
94
|
+
|
|
95
|
+
const Filters = createComponentForStaticNavigation(FilterNavigator, 'Filters')
|
|
96
|
+
|
|
97
|
+
export const ConversationFiltersScreen = (_props: ConversationFiltersScreenProps) => {
|
|
98
|
+
const styles = useStyles()
|
|
99
|
+
|
|
100
|
+
return (
|
|
101
|
+
<FilterProvider>
|
|
102
|
+
<View style={styles.container}>
|
|
103
|
+
<Filters />
|
|
104
|
+
</View>
|
|
105
|
+
</FilterProvider>
|
|
106
|
+
)
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
const useStyles = () => {
|
|
110
|
+
const { top } = useSafeAreaInsets()
|
|
111
|
+
const { height } = useWindowDimensions()
|
|
112
|
+
const headerHeight = useHeaderHeight()
|
|
113
|
+
const theme = useTheme()
|
|
114
|
+
|
|
115
|
+
const containerHeight = Platform.select({
|
|
116
|
+
android: height,
|
|
117
|
+
ios: height - top - headerHeight,
|
|
118
|
+
})
|
|
119
|
+
|
|
120
|
+
return StyleSheet.create({
|
|
121
|
+
container: {
|
|
122
|
+
height: containerHeight,
|
|
123
|
+
},
|
|
124
|
+
headerTitle: {
|
|
125
|
+
textAlign: 'left',
|
|
126
|
+
flex: 1,
|
|
127
|
+
},
|
|
128
|
+
filterBar: {
|
|
129
|
+
backgroundColor: theme.colors.fillColorNeutral100Inverted,
|
|
130
|
+
flexDirection: 'row',
|
|
131
|
+
justifyContent: 'space-between',
|
|
132
|
+
alignItems: 'center',
|
|
133
|
+
paddingHorizontal: 16,
|
|
134
|
+
paddingVertical: 16,
|
|
135
|
+
gap: 8,
|
|
136
|
+
},
|
|
137
|
+
filterBarScroll: {
|
|
138
|
+
elevation: 4,
|
|
139
|
+
boxShadow: '0px 4px 4px rgba(0, 0, 0, 0.1)',
|
|
140
|
+
},
|
|
141
|
+
filterBarActions: {
|
|
142
|
+
flexDirection: 'row',
|
|
143
|
+
gap: 8,
|
|
144
|
+
alignItems: 'center',
|
|
145
|
+
},
|
|
146
|
+
headerRight: {
|
|
147
|
+
flexDirection: 'row',
|
|
148
|
+
gap: 8,
|
|
149
|
+
alignItems: 'center',
|
|
150
|
+
},
|
|
151
|
+
})
|
|
152
|
+
}
|
|
@@ -8,7 +8,7 @@ import {
|
|
|
8
8
|
import React, { useCallback, useEffect } from 'react'
|
|
9
9
|
import { FlatList, Platform, StyleSheet, View } from 'react-native'
|
|
10
10
|
import { useSafeAreaInsets } from 'react-native-safe-area-context'
|
|
11
|
-
import {
|
|
11
|
+
import { Badge, Icon } from '../components'
|
|
12
12
|
import { Message } from '../components/conversation/message'
|
|
13
13
|
import { MessageForm } from '../components/conversation/message_form'
|
|
14
14
|
import { KeyboardView } from '../components/display/keyboard_view'
|
|
@@ -74,7 +74,9 @@ const PressableHeaderTitle = ({ style, children }: HeaderTitleProps) => {
|
|
|
74
74
|
|
|
75
75
|
const { data: conversation } = useConversation(route.params)
|
|
76
76
|
const badge = conversation.badges?.[0]
|
|
77
|
-
const
|
|
77
|
+
const resourceType = badge?.pcoResourceType || ''
|
|
78
|
+
const productName = badge?.appName
|
|
79
|
+
const name = badge?.text || undefined
|
|
78
80
|
|
|
79
81
|
return (
|
|
80
82
|
<PlatformPressable
|
|
@@ -87,7 +89,13 @@ const PressableHeaderTitle = ({ style, children }: HeaderTitleProps) => {
|
|
|
87
89
|
<HeaderTitle style={[styles.title, style]}>{children}</HeaderTitle>
|
|
88
90
|
<Icon name="general.downChevron" size={12} />
|
|
89
91
|
</View>
|
|
90
|
-
<
|
|
92
|
+
<Badge
|
|
93
|
+
variant="metaSubtle"
|
|
94
|
+
productLogoName={productName}
|
|
95
|
+
label={resourceType}
|
|
96
|
+
metaLabel={name}
|
|
97
|
+
style={styles.badge}
|
|
98
|
+
/>
|
|
91
99
|
</PlatformPressable>
|
|
92
100
|
)
|
|
93
101
|
}
|
|
@@ -99,13 +107,17 @@ const usePressableHeaderStyle = () => {
|
|
|
99
107
|
},
|
|
100
108
|
titleWrapper: {
|
|
101
109
|
alignItems: 'center',
|
|
102
|
-
columnGap:
|
|
110
|
+
columnGap: 4,
|
|
103
111
|
flexDirection: 'row',
|
|
104
112
|
},
|
|
105
113
|
title: {
|
|
106
114
|
padding: 0,
|
|
107
115
|
margin: 0,
|
|
108
116
|
},
|
|
117
|
+
badge: {
|
|
118
|
+
alignSelf: Platform.select({ android: 'flex-start', default: 'center' }),
|
|
119
|
+
marginTop: 2,
|
|
120
|
+
},
|
|
109
121
|
})
|
|
110
122
|
}
|
|
111
123
|
|
|
@@ -1,25 +1,222 @@
|
|
|
1
|
-
import { StaticScreenProps } from '@react-navigation/native'
|
|
2
|
-
import React from 'react'
|
|
1
|
+
import { RouteProp, StaticScreenProps, useNavigation, useRoute } from '@react-navigation/native'
|
|
2
|
+
import React, { useCallback, useMemo } from 'react'
|
|
3
3
|
import { StyleSheet, View } from 'react-native'
|
|
4
|
-
import { Conversations } from '../components'
|
|
4
|
+
import { Badge, Button, ButtonProps, Conversations, Heading, TextButton } from '../components'
|
|
5
|
+
import { ActionButton } from '../components/display/action_button'
|
|
6
|
+
import { useCanCreateConversations, useTheme } from '../hooks'
|
|
7
|
+
import { useApiGet } from '../hooks/use_api'
|
|
8
|
+
import { GraphId, GroupResource } from '../types/resources/group_resource'
|
|
9
|
+
import { useCanDisplayGroups } from '../hooks/use_groups'
|
|
5
10
|
|
|
6
11
|
export type ConversationScreenProps = StaticScreenProps<{
|
|
7
12
|
title?: string
|
|
8
|
-
chat_group_graph_id?:
|
|
13
|
+
chat_group_graph_id?: GraphId
|
|
14
|
+
group_source_app_name?: string
|
|
9
15
|
}>
|
|
10
16
|
|
|
11
|
-
export function ConversationsScreen(
|
|
17
|
+
export function ConversationsScreen({ route }: ConversationScreenProps) {
|
|
18
|
+
const navigation = useNavigation()
|
|
19
|
+
const canCreateConversations = useCanCreateConversations()
|
|
20
|
+
const styles = useStyles()
|
|
21
|
+
const { chat_group_graph_id, group_source_app_name } = route.params
|
|
22
|
+
|
|
23
|
+
const filter = useMemo(() => {
|
|
24
|
+
if (chat_group_graph_id) {
|
|
25
|
+
return 'group'
|
|
26
|
+
} else if (group_source_app_name) {
|
|
27
|
+
return 'group_source_app_name'
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
return 'mine_or_not_empty'
|
|
31
|
+
}, [chat_group_graph_id, group_source_app_name])
|
|
32
|
+
|
|
12
33
|
return (
|
|
13
34
|
<View style={styles.container}>
|
|
14
|
-
<Conversations
|
|
35
|
+
<Conversations
|
|
36
|
+
ListHeaderComponent={ListHeaderComponent}
|
|
37
|
+
group={chat_group_graph_id}
|
|
38
|
+
group_source_app_name={group_source_app_name}
|
|
39
|
+
filter={filter}
|
|
40
|
+
/>
|
|
41
|
+
<ActionButton
|
|
42
|
+
visible={canCreateConversations}
|
|
43
|
+
title="New conversation"
|
|
44
|
+
onPress={() => navigation.navigate('Create')}
|
|
45
|
+
/>
|
|
46
|
+
</View>
|
|
47
|
+
)
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
enum FilterTypes {
|
|
51
|
+
All = 'All',
|
|
52
|
+
Groups = 'Groups',
|
|
53
|
+
Teams = 'Teams',
|
|
54
|
+
More = 'More',
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
const ListHeaderComponent = () => {
|
|
58
|
+
const styles = useStyles()
|
|
59
|
+
const navigation = useNavigation()
|
|
60
|
+
const canFilterByTeams = useCanDisplayGroups({ source_app_name: 'Services', source_type: 'Team' })
|
|
61
|
+
const canFilterByGroups = useCanDisplayGroups({ source_app_name: 'Groups', source_type: 'Group' })
|
|
62
|
+
const route = useRoute<RouteProp<ConversationScreenProps['route']>>()
|
|
63
|
+
const { chat_group_graph_id, group_source_app_name = '' } = route.params
|
|
64
|
+
|
|
65
|
+
const active: FilterTypes = useMemo(() => {
|
|
66
|
+
if (chat_group_graph_id) {
|
|
67
|
+
return FilterTypes.More
|
|
68
|
+
} else if (/groups/i.test(group_source_app_name)) {
|
|
69
|
+
return FilterTypes.Groups
|
|
70
|
+
} else if (/services/i.test(group_source_app_name)) {
|
|
71
|
+
return FilterTypes.Teams
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
return FilterTypes.All
|
|
75
|
+
}, [chat_group_graph_id, group_source_app_name])
|
|
76
|
+
|
|
77
|
+
const hideAppFilters = !canFilterByGroups || !canFilterByTeams
|
|
78
|
+
|
|
79
|
+
return (
|
|
80
|
+
<View style={styles.listHeader}>
|
|
81
|
+
<View style={styles.titleRow}>
|
|
82
|
+
<Heading numberOfLines={1} variant="h2">
|
|
83
|
+
Conversations
|
|
84
|
+
</Heading>
|
|
85
|
+
<TextButton>Mark all read</TextButton>
|
|
86
|
+
</View>
|
|
87
|
+
<View style={styles.filterRow}>
|
|
88
|
+
<FilterButton
|
|
89
|
+
title={FilterTypes.All}
|
|
90
|
+
activeTitle={active}
|
|
91
|
+
hidden={!canFilterByGroups || !canFilterByTeams}
|
|
92
|
+
onPress={() =>
|
|
93
|
+
navigation.setParams({
|
|
94
|
+
chat_group_graph_id: undefined,
|
|
95
|
+
group_source_app_name: undefined,
|
|
96
|
+
})
|
|
97
|
+
}
|
|
98
|
+
/>
|
|
99
|
+
<FilterButton
|
|
100
|
+
title={FilterTypes.Groups}
|
|
101
|
+
activeTitle={active}
|
|
102
|
+
hidden={hideAppFilters}
|
|
103
|
+
onPress={() =>
|
|
104
|
+
navigation.setParams({
|
|
105
|
+
chat_group_graph_id: undefined,
|
|
106
|
+
group_source_app_name: 'Groups',
|
|
107
|
+
})
|
|
108
|
+
}
|
|
109
|
+
/>
|
|
110
|
+
<FilterButton
|
|
111
|
+
title={FilterTypes.Teams}
|
|
112
|
+
activeTitle={active}
|
|
113
|
+
hidden={hideAppFilters}
|
|
114
|
+
onPress={() =>
|
|
115
|
+
navigation.setParams({
|
|
116
|
+
chat_group_graph_id: undefined,
|
|
117
|
+
group_source_app_name: 'Services',
|
|
118
|
+
})
|
|
119
|
+
}
|
|
120
|
+
/>
|
|
121
|
+
<Button
|
|
122
|
+
title={hideAppFilters ? 'Filter' : FilterTypes.More}
|
|
123
|
+
onPress={() =>
|
|
124
|
+
navigation.navigate('ConversationFilters', {
|
|
125
|
+
chat_group_graph_id,
|
|
126
|
+
group_source_app_name,
|
|
127
|
+
})
|
|
128
|
+
}
|
|
129
|
+
variant={active === FilterTypes.More ? 'fill' : 'outline'}
|
|
130
|
+
iconNameRight="general.threeReducingHorizontalBars"
|
|
131
|
+
/>
|
|
132
|
+
</View>
|
|
133
|
+
<Badges />
|
|
15
134
|
</View>
|
|
16
135
|
)
|
|
17
136
|
}
|
|
18
137
|
|
|
19
|
-
const
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
}
|
|
25
|
-
}
|
|
138
|
+
const Badges = () => {
|
|
139
|
+
const styles = useStyles()
|
|
140
|
+
const navigation = useNavigation()
|
|
141
|
+
const route = useRoute<RouteProp<ConversationScreenProps['route']>>()
|
|
142
|
+
const { chat_group_graph_id } = route.params
|
|
143
|
+
const { data: group } = useApiGet<GroupResource>({
|
|
144
|
+
url: `/me/groups/${chat_group_graph_id}`,
|
|
145
|
+
data: {
|
|
146
|
+
fields: {
|
|
147
|
+
Group: [],
|
|
148
|
+
},
|
|
149
|
+
},
|
|
150
|
+
enabled: !!chat_group_graph_id,
|
|
151
|
+
app: 'chat',
|
|
152
|
+
})
|
|
153
|
+
|
|
154
|
+
const handleBadgePress = useCallback(() => {
|
|
155
|
+
navigation.setParams({
|
|
156
|
+
chat_group_graph_id: undefined,
|
|
157
|
+
group_source_app_name: undefined,
|
|
158
|
+
})
|
|
159
|
+
}, [navigation])
|
|
160
|
+
|
|
161
|
+
if (!group) return null
|
|
162
|
+
|
|
163
|
+
return (
|
|
164
|
+
<View style={styles.groupBadge}>
|
|
165
|
+
<Badge iconNameRight="general.x" label={group?.name || ''} onPress={handleBadgePress} />
|
|
166
|
+
</View>
|
|
167
|
+
)
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
function FilterButton({
|
|
171
|
+
title,
|
|
172
|
+
activeTitle,
|
|
173
|
+
onPress,
|
|
174
|
+
hidden = false,
|
|
175
|
+
...restProps
|
|
176
|
+
}: {
|
|
177
|
+
title: string
|
|
178
|
+
activeTitle: string
|
|
179
|
+
onPress: () => void
|
|
180
|
+
hidden?: boolean
|
|
181
|
+
} & ButtonProps) {
|
|
182
|
+
if (hidden) return null
|
|
183
|
+
|
|
184
|
+
return (
|
|
185
|
+
<Button
|
|
186
|
+
title={title}
|
|
187
|
+
variant={activeTitle === title ? 'fill' : 'outline'}
|
|
188
|
+
onPress={onPress}
|
|
189
|
+
{...restProps}
|
|
190
|
+
/>
|
|
191
|
+
)
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
const useStyles = () => {
|
|
195
|
+
const theme = useTheme()
|
|
196
|
+
return StyleSheet.create({
|
|
197
|
+
container: {
|
|
198
|
+
flex: 1,
|
|
199
|
+
justifyContent: 'center',
|
|
200
|
+
},
|
|
201
|
+
listHeader: {
|
|
202
|
+
borderBottomWidth: 1,
|
|
203
|
+
borderBottomColor: theme.colors.fillColorNeutral050Base,
|
|
204
|
+
paddingHorizontal: 16,
|
|
205
|
+
paddingBottom: 16,
|
|
206
|
+
gap: 12,
|
|
207
|
+
},
|
|
208
|
+
titleRow: {
|
|
209
|
+
flexDirection: 'row',
|
|
210
|
+
justifyContent: 'space-between',
|
|
211
|
+
paddingTop: 8,
|
|
212
|
+
},
|
|
213
|
+
filterRow: {
|
|
214
|
+
flexDirection: 'row',
|
|
215
|
+
justifyContent: 'flex-start',
|
|
216
|
+
gap: 8,
|
|
217
|
+
},
|
|
218
|
+
groupBadge: {
|
|
219
|
+
flexDirection: 'row',
|
|
220
|
+
},
|
|
221
|
+
})
|
|
222
|
+
}
|
|
@@ -4,8 +4,9 @@ import React from 'react'
|
|
|
4
4
|
import { ScrollView, StyleSheet, View } from 'react-native'
|
|
5
5
|
import { useSafeAreaInsets } from 'react-native-safe-area-context'
|
|
6
6
|
import { Button, Heading, Icon, Image, Text } from '../../components'
|
|
7
|
-
import {
|
|
7
|
+
import { useTheme } from '../../hooks'
|
|
8
8
|
import { GroupsGroupResource } from '../../types'
|
|
9
|
+
import { useGroupsGroups } from '../../hooks/use_groups_groups'
|
|
9
10
|
|
|
10
11
|
type ConversationSelectRecipientsScreenProps = StaticScreenProps<{
|
|
11
12
|
chat_group_graph_id?: string
|
|
@@ -18,16 +19,7 @@ const THUMBNAIL_HEIGHT = THUMBNAIL_WIDTH / ASPECT_RATIO
|
|
|
18
19
|
export const ConversationSelectRecipientsScreen = ({}: ConversationSelectRecipientsScreenProps) => {
|
|
19
20
|
const styles = useStyles()
|
|
20
21
|
const navigation = useNavigation()
|
|
21
|
-
const { data: groups = [] } =
|
|
22
|
-
url: '/me/groups',
|
|
23
|
-
data: {
|
|
24
|
-
perPage: 100,
|
|
25
|
-
fields: {
|
|
26
|
-
Group: ['can_create_conversation', 'name', 'header_image', 'memberships_count'],
|
|
27
|
-
},
|
|
28
|
-
},
|
|
29
|
-
app: 'groups',
|
|
30
|
-
})
|
|
22
|
+
const { data: groups = [] } = useGroupsGroups()
|
|
31
23
|
const groupsWithCreatePermission = groups.filter(g => g.canCreateConversation)
|
|
32
24
|
|
|
33
25
|
const handleNavigateToCreateConversation = (group: GroupsGroupResource) => {
|
|
@@ -1,10 +1,13 @@
|
|
|
1
1
|
import { AppName } from './app_name'
|
|
2
2
|
|
|
3
|
+
export type SourceType = 'Team' | 'Group' | 'PlanTeam'
|
|
4
|
+
export type GraphId = `${AppName}-${SourceType}-${number}`
|
|
5
|
+
|
|
3
6
|
export interface GroupResource {
|
|
7
|
+
id: GraphId
|
|
4
8
|
type: 'Group'
|
|
5
|
-
id: string
|
|
6
9
|
links: { self: string }
|
|
7
10
|
name: string | null
|
|
8
11
|
sourceAppName: AppName
|
|
9
|
-
sourceType:
|
|
12
|
+
sourceType: SourceType
|
|
10
13
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './team_resource'
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
// All of our calls out to services go out to /chat, which isn't a typical pco-api vertex.
|
|
2
|
+
// They all have a shared type of 'Chat' which has the following array attributes:
|
|
3
|
+
// group_identifiers, people, plans, teams and, teams_i_lead.
|
|
4
|
+
// All of these have a type array, are only rendered on request, and are exclusively used for this form.
|
|
5
|
+
// There is also a payload which is a string, and is used to create a conversation in chat.
|
|
6
|
+
|
|
7
|
+
import { ResourceObject } from '../../api_primitives'
|
|
8
|
+
|
|
9
|
+
interface ServicesChatResource extends ResourceObject {
|
|
10
|
+
type: 'Chat'
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export interface TeamResource extends ServicesChatResource {
|
|
14
|
+
teamsILead: TeamResponseItem[]
|
|
15
|
+
}
|
|
16
|
+
export interface TeamResponseItem {
|
|
17
|
+
name: string
|
|
18
|
+
value: {
|
|
19
|
+
teamId: number
|
|
20
|
+
serviceTypeId: number
|
|
21
|
+
}
|
|
22
|
+
serviceTypeName: string
|
|
23
|
+
teamName: string
|
|
24
|
+
order: [number, string, string] // [serviceTypeId, serviceTypeName, teamName]
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export interface TeamOptionResource extends ServicesChatResource {
|
|
28
|
+
teams: TeamOptionResponseItem[]
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export interface TeamOptionResponseItem extends TeamResponseItem {
|
|
32
|
+
group: TeamOptionResponseItemGroupName
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
export type TeamOptionResponseItemGroupName = 'teams_i_lead' | 'other_teams'
|
|
36
|
+
|
|
37
|
+
export interface PlansResource extends ServicesChatResource {
|
|
38
|
+
plans: PlansResponseItem[]
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
interface PlansResponseItem {
|
|
42
|
+
value: number
|
|
43
|
+
name: string
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
export interface TeamPeopleResource extends ServicesChatResource {
|
|
47
|
+
people: PersonResponseItem[]
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
interface PersonResponseItem {
|
|
51
|
+
id: number
|
|
52
|
+
name: string
|
|
53
|
+
avatar: string
|
|
54
|
+
badges: { title: string }[]
|
|
55
|
+
child: boolean
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
export interface ServicesChatPayloadResource extends ServicesChatResource {
|
|
59
|
+
payload: string
|
|
60
|
+
}
|
|
@@ -16,6 +16,7 @@ export interface GenericRequest {
|
|
|
16
16
|
|
|
17
17
|
export interface GetRequest extends GenericRequest {
|
|
18
18
|
data: {
|
|
19
|
+
filter?: string
|
|
19
20
|
fields: Record<string, string[]>
|
|
20
21
|
where?: Record<string, string>
|
|
21
22
|
include?: string[]
|
|
@@ -23,7 +24,7 @@ export interface GetRequest extends GenericRequest {
|
|
|
23
24
|
perPage?: number
|
|
24
25
|
offset?: number
|
|
25
26
|
walk?: boolean
|
|
26
|
-
}
|
|
27
|
+
} & Record<string, unknown>
|
|
27
28
|
}
|
|
28
29
|
|
|
29
30
|
export interface Relationship {
|
package/src/utils/index.ts
CHANGED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
interface Audio {
|
|
2
|
+
play: () => void
|
|
3
|
+
pause: () => void
|
|
4
|
+
isPlaying: boolean
|
|
5
|
+
duration: number
|
|
6
|
+
position: number
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export class AudioAdapter {
|
|
10
|
+
useAudio: (_: string) => Audio
|
|
11
|
+
|
|
12
|
+
constructor(methods: AudioAdapter) {
|
|
13
|
+
this.useAudio = methods.useAudio
|
|
14
|
+
}
|
|
15
|
+
}
|
|
@@ -1,12 +1,18 @@
|
|
|
1
|
+
import { AudioAdapter } from './audio'
|
|
1
2
|
import { ClipboardAdapter } from './clipboard'
|
|
3
|
+
import { VideoAdapter } from './video'
|
|
2
4
|
|
|
3
5
|
type ChatConfigurations = {
|
|
4
6
|
clipboard: ClipboardAdapter
|
|
7
|
+
audio: AudioAdapter
|
|
8
|
+
video: VideoAdapter
|
|
5
9
|
}
|
|
6
10
|
|
|
7
11
|
export class ChatAdapters {
|
|
8
12
|
static configure(configurations: ChatConfigurations) {
|
|
9
13
|
Clipboard = configurations.clipboard
|
|
14
|
+
Audio = configurations.audio
|
|
15
|
+
Video = configurations.video
|
|
10
16
|
}
|
|
11
17
|
}
|
|
12
18
|
|
|
@@ -22,4 +28,21 @@ let Clipboard: ClipboardAdapter = new ClipboardAdapter({
|
|
|
22
28
|
setStringAsync: async (_: string) => methodMissing(),
|
|
23
29
|
})
|
|
24
30
|
|
|
25
|
-
|
|
31
|
+
let Audio: AudioAdapter = new AudioAdapter({
|
|
32
|
+
useAudio: (_: string) => {
|
|
33
|
+
methodMissing()
|
|
34
|
+
return {} as any
|
|
35
|
+
},
|
|
36
|
+
})
|
|
37
|
+
|
|
38
|
+
let Video: VideoAdapter = new VideoAdapter({
|
|
39
|
+
Player: Object.assign(
|
|
40
|
+
() => {
|
|
41
|
+
methodMissing()
|
|
42
|
+
return null
|
|
43
|
+
},
|
|
44
|
+
{ $$typeof: Symbol.for('react.forward_ref') }
|
|
45
|
+
),
|
|
46
|
+
})
|
|
47
|
+
|
|
48
|
+
export { Clipboard, Audio, Video }
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { StyleProp, ViewStyle } from 'react-native'
|
|
2
|
+
|
|
3
|
+
export interface VideoPlayerProps {
|
|
4
|
+
source: { uri: string }
|
|
5
|
+
aspectRatio?: number
|
|
6
|
+
style?: StyleProp<ViewStyle>
|
|
7
|
+
onFullscreenPlayerWillPresent?: () => void
|
|
8
|
+
onFullscreenPlayerDidPresent?: () => void
|
|
9
|
+
onFullscreenPlayerWillDismiss?: () => void
|
|
10
|
+
onFullscreenPlayerDidDismiss?: () => void
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export interface VideoPlayerHandle {
|
|
14
|
+
play: () => void
|
|
15
|
+
pause: () => void
|
|
16
|
+
presentFullscreenPlayer: () => void
|
|
17
|
+
dismissFullscreen: () => void
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
type VideoPlayer = React.ForwardRefExoticComponent<
|
|
21
|
+
VideoPlayerProps & React.RefAttributes<VideoPlayerHandle>
|
|
22
|
+
>
|
|
23
|
+
|
|
24
|
+
export class VideoAdapter {
|
|
25
|
+
Player: VideoPlayer
|
|
26
|
+
|
|
27
|
+
constructor(methods: VideoAdapter) {
|
|
28
|
+
this.Player = methods.Player
|
|
29
|
+
}
|
|
30
|
+
}
|