@planningcenter/chat-react-native 4.5.1-rc.0 → 4.6.0-rc.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (53) hide show
  1. package/build/components/conversation/attachments/giphy_attachment.d.ts.map +1 -1
  2. package/build/components/conversation/attachments/giphy_attachment.js +2 -2
  3. package/build/components/conversation/attachments/giphy_attachment.js.map +1 -1
  4. package/build/components/conversation/attachments/image_attachment.d.ts.map +1 -1
  5. package/build/components/conversation/attachments/image_attachment.js +5 -3
  6. package/build/components/conversation/attachments/image_attachment.js.map +1 -1
  7. package/build/components/conversation/message_form.d.ts.map +1 -1
  8. package/build/components/conversation/message_form.js +2 -2
  9. package/build/components/conversation/message_form.js.map +1 -1
  10. package/build/screens/age_check/age_check_underage_screen.d.ts.map +1 -1
  11. package/build/screens/age_check/age_check_underage_screen.js +2 -1
  12. package/build/screens/age_check/age_check_underage_screen.js.map +1 -1
  13. package/build/screens/attachment_actions/attachment_actions_screen.d.ts.map +1 -1
  14. package/build/screens/attachment_actions/attachment_actions_screen.js +5 -2
  15. package/build/screens/attachment_actions/attachment_actions_screen.js.map +1 -1
  16. package/build/screens/bug_report_screen.d.ts.map +1 -1
  17. package/build/screens/bug_report_screen.js +2 -2
  18. package/build/screens/bug_report_screen.js.map +1 -1
  19. package/build/screens/conversation_new/components/groups_form.js +25 -18
  20. package/build/screens/conversation_new/components/groups_form.js.map +1 -1
  21. package/build/screens/conversation_new/components/services_form.js +51 -40
  22. package/build/screens/conversation_new/components/services_form.js.map +1 -1
  23. package/build/screens/get_help_screen.js +2 -2
  24. package/build/screens/get_help_screen.js.map +1 -1
  25. package/build/utils/index.d.ts +1 -0
  26. package/build/utils/index.d.ts.map +1 -1
  27. package/build/utils/index.js +1 -0
  28. package/build/utils/index.js.map +1 -1
  29. package/build/utils/membership_sync_info_text.d.ts +2 -0
  30. package/build/utils/membership_sync_info_text.d.ts.map +1 -0
  31. package/build/utils/membership_sync_info_text.js +4 -0
  32. package/build/utils/membership_sync_info_text.js.map +1 -0
  33. package/build/utils/native_adapters/linking.d.ts +11 -3
  34. package/build/utils/native_adapters/linking.d.ts.map +1 -1
  35. package/build/utils/native_adapters/linking.js.map +1 -1
  36. package/package.json +2 -2
  37. package/src/__tests__/components/conversation/attachments/giphy_attachment.test.tsx +76 -0
  38. package/src/__tests__/screens/get_help_screen.test.ts +36 -0
  39. package/src/components/conversation/attachments/giphy_attachment.tsx +2 -3
  40. package/src/components/conversation/attachments/image_attachment.tsx +2 -3
  41. package/src/components/conversation/message_form.tsx +1 -1
  42. package/src/screens/age_check/age_check_underage_screen.tsx +2 -1
  43. package/src/screens/attachment_actions/__tests__/attachment_actions_screen.test.tsx +37 -1
  44. package/src/screens/attachment_actions/attachment_actions_screen.tsx +3 -2
  45. package/src/screens/bug_report_screen.tsx +2 -10
  46. package/src/screens/conversation_new/components/groups_form.tsx +2 -2
  47. package/src/screens/conversation_new/components/services_form.tsx +2 -2
  48. package/src/screens/get_help_screen.tsx +2 -2
  49. package/src/utils/__tests__/membership_sync_info_text.test.ts +15 -0
  50. package/src/utils/index.ts +1 -0
  51. package/src/utils/membership_sync_info_text.ts +3 -0
  52. package/src/utils/native_adapters/__tests__/linking.test.ts +12 -0
  53. package/src/utils/native_adapters/linking.ts +12 -3
@@ -1,8 +1,9 @@
1
1
  import { StaticScreenProps, useNavigation } from '@react-navigation/native'
2
2
  import React, { useCallback } from 'react'
3
- import { Alert, Linking, StyleSheet } from 'react-native'
3
+ import { Alert, StyleSheet } from 'react-native'
4
4
  import FormSheet, { getFormSheetScreenOptions } from '../../components/primitive/form_sheet'
5
5
  import { useConversation } from '../../hooks/use_conversation'
6
+ import { Linking } from '../../utils'
6
7
  import { useDeleteAttachment } from './hooks/useDeleteAttachment'
7
8
 
8
9
  export const AttachmentActionsScreenOptions = getFormSheetScreenOptions({
@@ -59,7 +60,7 @@ export function AttachmentActionsScreen({ route }: AttachmentActionsScreenProps)
59
60
  }, [attachmentName, handleDeleteAttachment, navigation])
60
61
 
61
62
  const handleOpenInBrowser = () => {
62
- Linking.openURL(attachmentUrl)
63
+ Linking.openURL(attachmentUrl, { forceOpenInBrowser: true })
63
64
  navigation.goBack()
64
65
  }
65
66
 
@@ -5,15 +5,7 @@ import type {
5
5
  } from '@react-navigation/native-stack'
6
6
  import { startsWith } from 'lodash'
7
7
  import React, { useCallback, useState } from 'react'
8
- import {
9
- View,
10
- StyleSheet,
11
- TextInput,
12
- Linking,
13
- ScrollView,
14
- TouchableOpacity,
15
- Platform,
16
- } from 'react-native'
8
+ import { View, StyleSheet, TextInput, ScrollView, TouchableOpacity, Platform } from 'react-native'
17
9
  import { useSafeAreaInsets } from 'react-native-safe-area-context'
18
10
  import {
19
11
  Button,
@@ -38,7 +30,7 @@ import { useTheme } from '../hooks'
38
30
  import { useAppName } from '../hooks/use_app_name'
39
31
  import { useReportBugAction } from '../hooks/use_report_bug_action'
40
32
  import { useUploadClient } from '../hooks/use_upload_client'
41
- import { ImagePicker, ImagePickerResult, platformFontWeightBold } from '../utils'
33
+ import { ImagePicker, ImagePickerResult, Linking, platformFontWeightBold } from '../utils'
42
34
 
43
35
  const MAX_DESCRIPTION_LENGTH = 2000
44
36
 
@@ -22,7 +22,7 @@ import { useMyGender } from '../../../hooks/use_my_gender'
22
22
  import { useUploadClient } from '../../../hooks/use_upload_client'
23
23
  import { GroupsGroupResource } from '../../../types'
24
24
  import { GraphId } from '../../../types/resources/group_resource'
25
- import { pluralize } from '../../../utils'
25
+ import { membershipSyncInfoText, pluralize } from '../../../utils'
26
26
  import { genderDisplayLabel } from '../../../utils/gender_display_label'
27
27
  import { Haptic } from '../../../utils/native_adapters'
28
28
  import { AvatarSelectionRow } from './avatar_selection_row'
@@ -147,7 +147,7 @@ export const GroupsForm = ({ groupId, chat_group_graph_id, avatarSelection }: Gr
147
147
  disabled={!title || isPending || validationPending || warnings.length > 0}
148
148
  title="Start Conversation"
149
149
  onPress={() => handleSave()}
150
- infoText="Conversation will be automatically updated if any members are added or removed from this group."
150
+ infoText={membershipSyncInfoText('the group')}
151
151
  warnings={warnings}
152
152
  />
153
153
  </KeyboardView>
@@ -17,7 +17,7 @@ import { useConversationValidate } from '../../../hooks/use_conversation_validat
17
17
  import { availableFeatures, useFeatures } from '../../../hooks/use_features'
18
18
  import { useUploadClient } from '../../../hooks/use_upload_client'
19
19
  import { MemberResource } from '../../../types'
20
- import { pluralize } from '../../../utils'
20
+ import { membershipSyncInfoText, pluralize } from '../../../utils'
21
21
  import { Haptic } from '../../../utils/native_adapters'
22
22
  import { tokens } from '../../../vendor/tapestry/tokens'
23
23
  import { TeamFilterTypes } from '../../conversation_filter_recipients/types'
@@ -139,7 +139,7 @@ export const ServicesForm = ({
139
139
  }
140
140
  title={selectionHasConversation ? 'Open conversation' : 'Start conversation'}
141
141
  onPress={createConversation}
142
- infoText="Conversation will be automatically updated if any members are added or removed from included teams."
142
+ infoText={membershipSyncInfoText(selectedTeamIds.length === 1 ? 'the team' : 'the teams')}
143
143
  loading={isLoadingConversationCheck}
144
144
  warnings={warnings}
145
145
  />
@@ -1,12 +1,12 @@
1
1
  import { StaticScreenProps, useNavigation } from '@react-navigation/native'
2
2
  import { useCallback, useMemo } from 'react'
3
- import { Alert, Linking, StyleSheet, View } from 'react-native'
3
+ import { Alert, 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 } from '../utils'
9
+ import { Clipboard, Linking } from '../utils'
10
10
 
11
11
  type GetHelpScreenRouteProps = {
12
12
  type?: 'chat' | 'general'
@@ -0,0 +1,15 @@
1
+ import { membershipSyncInfoText } from '../membership_sync_info_text'
2
+
3
+ describe('membershipSyncInfoText', () => {
4
+ it('explains membership sync and history visibility for a group', () => {
5
+ expect(membershipSyncInfoText('the group')).toBe(
6
+ 'This conversation will stay in sync with the group. Members will automatically be added or removed, and new members will see the history.'
7
+ )
8
+ })
9
+
10
+ it('explains membership sync and history visibility for teams', () => {
11
+ expect(membershipSyncInfoText('the teams')).toBe(
12
+ 'This conversation will stay in sync with the teams. Members will automatically be added or removed, and new members will see the history.'
13
+ )
14
+ })
15
+ })
@@ -8,6 +8,7 @@ export * from './convert_attachments_for_create'
8
8
  export * from './destructure_chat_group_graph_id'
9
9
  export * from './host_bridge'
10
10
  export * from './liquid_glass'
11
+ export * from './membership_sync_info_text'
11
12
  export * from './native_adapters'
12
13
  export * from './pluralize'
13
14
  export * from './conversation_safety_constants'
@@ -0,0 +1,3 @@
1
+ export function membershipSyncInfoText(source: string): string {
2
+ return `This conversation will stay in sync with ${source}. Members will automatically be added or removed, and new members will see the history.`
3
+ }
@@ -0,0 +1,12 @@
1
+ import { LinkingAdapter } from '../linking'
2
+
3
+ describe('LinkingAdapter', () => {
4
+ it('forwards open options to the host', async () => {
5
+ const openURL = jest.fn(async () => {})
6
+ const adapter = new LinkingAdapter({ openURL, canOpenURL: async () => true })
7
+
8
+ await adapter.openURL('https://example.com', { forceOpenInBrowser: true })
9
+
10
+ expect(openURL).toHaveBeenCalledWith('https://example.com', { forceOpenInBrowser: true })
11
+ })
12
+ })
@@ -1,10 +1,19 @@
1
1
  import { Linking } from 'react-native'
2
2
 
3
- export class LinkingAdapter {
4
- openURL: Linking['openURL']
3
+ export type LinkingOpenURLOptions = {
4
+ forceOpenInBrowser?: boolean
5
+ }
6
+
7
+ type LinkingMethods = {
8
+ openURL: (url: string, options?: LinkingOpenURLOptions) => Promise<unknown>
5
9
  canOpenURL: Linking['canOpenURL']
10
+ }
11
+
12
+ export class LinkingAdapter {
13
+ openURL: LinkingMethods['openURL']
14
+ canOpenURL: LinkingMethods['canOpenURL']
6
15
 
7
- constructor(methods: Pick<Linking, 'openURL' | 'canOpenURL'>) {
16
+ constructor(methods: LinkingMethods) {
8
17
  this.openURL = methods.openURL.bind(Linking)
9
18
  this.canOpenURL = methods.canOpenURL.bind(Linking)
10
19
  }