@planningcenter/chat-react-native 4.4.1-qa-staging.22 → 4.4.1-qa-staging.24
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/giphy_attachment.d.ts.map +1 -1
- package/build/components/conversation/attachments/giphy_attachment.js +2 -2
- package/build/components/conversation/attachments/giphy_attachment.js.map +1 -1
- package/build/components/conversation/message_form.d.ts.map +1 -1
- package/build/components/conversation/message_form.js +2 -2
- package/build/components/conversation/message_form.js.map +1 -1
- package/build/screens/age_check/age_check_underage_screen.d.ts.map +1 -1
- package/build/screens/age_check/age_check_underage_screen.js +2 -3
- package/build/screens/age_check/age_check_underage_screen.js.map +1 -1
- package/build/screens/bug_report_screen.d.ts.map +1 -1
- package/build/screens/bug_report_screen.js +2 -2
- package/build/screens/bug_report_screen.js.map +1 -1
- package/build/screens/conversation_details_screen.d.ts.map +1 -1
- package/build/screens/conversation_details_screen.js +190 -190
- package/build/screens/conversation_details_screen.js.map +1 -1
- package/build/screens/get_help_screen.js +4 -4
- package/build/screens/get_help_screen.js.map +1 -1
- package/package.json +3 -3
- package/src/components/conversation/attachments/giphy_attachment.tsx +3 -2
- package/src/components/conversation/message_form.tsx +1 -1
- package/src/screens/__tests__/conversation_details_screen.test.tsx +8 -0
- package/src/screens/age_check/age_check_underage_screen.tsx +2 -3
- package/src/screens/bug_report_screen.tsx +10 -2
- package/src/screens/conversation_details_screen.tsx +2 -1
- package/src/screens/get_help_screen.tsx +4 -4
- package/src/__tests__/components/conversation/attachments/giphy_attachment.test.tsx +0 -76
- package/src/__tests__/screens/get_help_screen.test.ts +0 -40
|
@@ -127,6 +127,7 @@ export function ConversationDetailsScreen({ route }: ConversationDetailsScreenPr
|
|
|
127
127
|
conversation?.conversationMembership?.notificationLevelDescription
|
|
128
128
|
const archived = isArchivedConversation(conversation)
|
|
129
129
|
const canUpdate = conversation.memberAbility?.canUpdate || false
|
|
130
|
+
const canSaveTitle = canUpdate && !emptyTitle
|
|
130
131
|
const canDelete = conversation.memberAbility?.canDelete || false
|
|
131
132
|
const canArchive = manualArchivingEnabled && (conversation.memberAbility?.canArchive || false)
|
|
132
133
|
const isLeader = conversation.memberAbility?.leader || false
|
|
@@ -252,7 +253,7 @@ export function ConversationDetailsScreen({ route }: ConversationDetailsScreenPr
|
|
|
252
253
|
icon: 'general.check',
|
|
253
254
|
accessibilityLabel: 'Done',
|
|
254
255
|
onPress: () => {
|
|
255
|
-
if (
|
|
256
|
+
if (canSaveTitle) saveTitle({ title: trimmedTitle })
|
|
256
257
|
navigation.goBack()
|
|
257
258
|
},
|
|
258
259
|
})
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { StaticScreenProps, useNavigation } from '@react-navigation/native'
|
|
2
2
|
import { useCallback, useMemo } from 'react'
|
|
3
|
-
import { Alert, Linking
|
|
3
|
+
import { Alert, Linking, StyleSheet, View } from 'react-native'
|
|
4
4
|
import { Heading, PressableRow, Text, TextInlineButton } from '../components'
|
|
5
5
|
import { useApiGet, useTheme } from '../hooks'
|
|
6
6
|
import { useAppName } from '../hooks/use_app_name'
|
|
7
7
|
import { useOrganization } from '../hooks/use_organization'
|
|
8
8
|
import { ResourceObject } from '../types'
|
|
9
|
-
import { Clipboard
|
|
9
|
+
import { Clipboard } from '../utils'
|
|
10
10
|
|
|
11
11
|
type GetHelpScreenRouteProps = {
|
|
12
12
|
type?: 'chat' | 'general'
|
|
@@ -119,7 +119,7 @@ export function sendEmail(email: string) {
|
|
|
119
119
|
|
|
120
120
|
const url = encodeURI(`mailto:${email}`)
|
|
121
121
|
|
|
122
|
-
|
|
122
|
+
Linking.openURL(url).catch(() => {
|
|
123
123
|
Alert.alert('Oops', `Unable to open: ${email}`, [
|
|
124
124
|
{ text: 'Copy to clipboard', onPress: () => Clipboard.setStringAsync(email) },
|
|
125
125
|
{ text: 'OK' },
|
|
@@ -132,7 +132,7 @@ export function placePhoneCall(phoneNumber: string) {
|
|
|
132
132
|
|
|
133
133
|
const url = encodeURI(`tel:${phoneNumber}`)
|
|
134
134
|
|
|
135
|
-
|
|
135
|
+
Linking.openURL(url).catch(() => {
|
|
136
136
|
Alert.alert('Oops', `Unable to open: ${phoneNumber}`, [
|
|
137
137
|
{ text: 'Copy to clipboard', onPress: () => Clipboard.setStringAsync(phoneNumber) },
|
|
138
138
|
{ text: 'OK' },
|
|
@@ -1,76 +0,0 @@
|
|
|
1
|
-
import { DefaultTheme, ThemeProvider } from '@react-navigation/native'
|
|
2
|
-
import { fireEvent, render } from '@testing-library/react-native'
|
|
3
|
-
import React from 'react'
|
|
4
|
-
import { Linking as RNLinking } from 'react-native'
|
|
5
|
-
import { GiphyAttachment } from '../../../../components/conversation/attachments/giphy_attachment'
|
|
6
|
-
import {
|
|
7
|
-
DenormalizedGiphyAttachmentResource,
|
|
8
|
-
GiphyAttachmentVariant,
|
|
9
|
-
} from '../../../../types/resources/denormalized_attachment_resource'
|
|
10
|
-
import {
|
|
11
|
-
AudioAdapter,
|
|
12
|
-
ChatAdapters,
|
|
13
|
-
ClipboardAdapter,
|
|
14
|
-
ImagePickerAdapter,
|
|
15
|
-
LinkingAdapter,
|
|
16
|
-
VideoAdapter,
|
|
17
|
-
} from '../../../../utils/native_adapters'
|
|
18
|
-
|
|
19
|
-
const variant: GiphyAttachmentVariant = {
|
|
20
|
-
url: 'https://media.giphy.com/cat.gif',
|
|
21
|
-
width: '200',
|
|
22
|
-
height: '100',
|
|
23
|
-
size: '1',
|
|
24
|
-
frames: '1',
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
const attachment: DenormalizedGiphyAttachmentResource = {
|
|
28
|
-
type: 'giphy',
|
|
29
|
-
id: '1',
|
|
30
|
-
title: 'cat',
|
|
31
|
-
titleLink: 'https://giphy.com/gifs/cat',
|
|
32
|
-
thumbUrl: variant.url,
|
|
33
|
-
giphy: {
|
|
34
|
-
original: variant,
|
|
35
|
-
fixedHeight: variant,
|
|
36
|
-
fixedHeightStill: variant,
|
|
37
|
-
fixedHeightDownsampled: variant,
|
|
38
|
-
fixedWidth: variant,
|
|
39
|
-
fixedWidthStill: variant,
|
|
40
|
-
fixedWidthDownsampled: variant,
|
|
41
|
-
},
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
const hostOpenURL = jest.fn(async (_: string) => {})
|
|
45
|
-
|
|
46
|
-
describe('GiphyAttachment', () => {
|
|
47
|
-
beforeAll(() => {
|
|
48
|
-
ChatAdapters.configure({
|
|
49
|
-
clipboard: new ClipboardAdapter({
|
|
50
|
-
getStringAsync: async () => '',
|
|
51
|
-
setStringAsync: async () => {},
|
|
52
|
-
}),
|
|
53
|
-
audio: new AudioAdapter({ useAudio: () => ({}) as any }),
|
|
54
|
-
video: new VideoAdapter({ Player: React.forwardRef(() => null) }),
|
|
55
|
-
imagePicker: new ImagePickerAdapter({
|
|
56
|
-
openCameraAsync: async () => ({ canceled: true, assets: null }),
|
|
57
|
-
openImageLibraryAsync: async () => ({ canceled: true, assets: null }),
|
|
58
|
-
}),
|
|
59
|
-
linking: new LinkingAdapter({ openURL: hostOpenURL, canOpenURL: async () => true }),
|
|
60
|
-
})
|
|
61
|
-
})
|
|
62
|
-
|
|
63
|
-
it("opens the Giphy link through the host app's linking adapter", () => {
|
|
64
|
-
const rnOpenURL = jest.spyOn(RNLinking, 'openURL')
|
|
65
|
-
const { getByText } = render(
|
|
66
|
-
<ThemeProvider value={DefaultTheme}>
|
|
67
|
-
<GiphyAttachment attachment={attachment} onMessageLongPress={jest.fn()} />
|
|
68
|
-
</ThemeProvider>
|
|
69
|
-
)
|
|
70
|
-
|
|
71
|
-
fireEvent.press(getByText('/giphy'))
|
|
72
|
-
|
|
73
|
-
expect(hostOpenURL).toHaveBeenCalledWith('https://giphy.com/gifs/cat')
|
|
74
|
-
expect(rnOpenURL).not.toHaveBeenCalled()
|
|
75
|
-
})
|
|
76
|
-
})
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
import React from 'react'
|
|
2
|
-
import { Linking as RNLinking } from 'react-native'
|
|
3
|
-
import { sendEmail } from '../../screens/get_help_screen'
|
|
4
|
-
import {
|
|
5
|
-
AudioAdapter,
|
|
6
|
-
ChatAdapters,
|
|
7
|
-
ClipboardAdapter,
|
|
8
|
-
ImagePickerAdapter,
|
|
9
|
-
LinkingAdapter,
|
|
10
|
-
VideoAdapter,
|
|
11
|
-
} from '../../utils/native_adapters'
|
|
12
|
-
|
|
13
|
-
const hostOpenURL = jest.fn(async (_: string) => {})
|
|
14
|
-
|
|
15
|
-
describe('sendEmail', () => {
|
|
16
|
-
beforeAll(() => {
|
|
17
|
-
ChatAdapters.configure({
|
|
18
|
-
clipboard: new ClipboardAdapter({
|
|
19
|
-
getStringAsync: async () => '',
|
|
20
|
-
setStringAsync: async () => {},
|
|
21
|
-
}),
|
|
22
|
-
audio: new AudioAdapter({ useAudio: () => ({}) as any }),
|
|
23
|
-
video: new VideoAdapter({ Player: React.forwardRef(() => null) }),
|
|
24
|
-
imagePicker: new ImagePickerAdapter({
|
|
25
|
-
openCameraAsync: async () => ({ canceled: true, assets: null }),
|
|
26
|
-
openImageLibraryAsync: async () => ({ canceled: true, assets: null }),
|
|
27
|
-
}),
|
|
28
|
-
linking: new LinkingAdapter({ openURL: hostOpenURL, canOpenURL: async () => true }),
|
|
29
|
-
})
|
|
30
|
-
})
|
|
31
|
-
|
|
32
|
-
it("opens mailto with the system, not the host app's linking adapter", () => {
|
|
33
|
-
const rnOpenURL = jest.spyOn(RNLinking, 'openURL').mockResolvedValue(undefined)
|
|
34
|
-
|
|
35
|
-
sendEmail('help@example.com')
|
|
36
|
-
|
|
37
|
-
expect(rnOpenURL).toHaveBeenCalledWith('mailto:help@example.com')
|
|
38
|
-
expect(hostOpenURL).not.toHaveBeenCalled()
|
|
39
|
-
})
|
|
40
|
-
})
|