@planningcenter/chat-react-native 3.39.0-rc.7 → 3.39.0-rc.9

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 (60) hide show
  1. package/build/hooks/index.d.ts +1 -0
  2. package/build/hooks/index.d.ts.map +1 -1
  3. package/build/hooks/index.js +1 -0
  4. package/build/hooks/index.js.map +1 -1
  5. package/build/hooks/use_current_person.d.ts.map +1 -1
  6. package/build/hooks/use_current_person.js +1 -0
  7. package/build/hooks/use_current_person.js.map +1 -1
  8. package/build/hooks/use_has_direct_messages.d.ts.map +1 -1
  9. package/build/hooks/use_has_direct_messages.js +3 -1
  10. package/build/hooks/use_has_direct_messages.js.map +1 -1
  11. package/build/hooks/use_person_settings.d.ts +6 -0
  12. package/build/hooks/use_person_settings.d.ts.map +1 -0
  13. package/build/hooks/use_person_settings.js +26 -0
  14. package/build/hooks/use_person_settings.js.map +1 -0
  15. package/build/navigation/index.d.ts +13 -0
  16. package/build/navigation/index.d.ts.map +1 -1
  17. package/build/navigation/index.js +9 -0
  18. package/build/navigation/index.js.map +1 -1
  19. package/build/screens/conversation_filters/components/conversation_filters.d.ts.map +1 -1
  20. package/build/screens/conversation_filters/components/conversation_filters.js +20 -5
  21. package/build/screens/conversation_filters/components/conversation_filters.js.map +1 -1
  22. package/build/screens/conversation_filters/components/rows.d.ts +2 -1
  23. package/build/screens/conversation_filters/components/rows.d.ts.map +1 -1
  24. package/build/screens/conversation_filters/components/rows.js +2 -2
  25. package/build/screens/conversation_filters/components/rows.js.map +1 -1
  26. package/build/screens/conversation_filters/context/conversation_filter_context.d.ts.map +1 -1
  27. package/build/screens/conversation_filters/context/conversation_filter_context.js +4 -0
  28. package/build/screens/conversation_filters/context/conversation_filter_context.js.map +1 -1
  29. package/build/screens/conversation_filters/filter_types.d.ts +1 -0
  30. package/build/screens/conversation_filters/filter_types.d.ts.map +1 -1
  31. package/build/screens/conversation_filters/filter_types.js +1 -0
  32. package/build/screens/conversation_filters/filter_types.js.map +1 -1
  33. package/build/screens/conversations/components/list_header_component.d.ts.map +1 -1
  34. package/build/screens/conversations/components/list_header_component.js +7 -6
  35. package/build/screens/conversations/components/list_header_component.js.map +1 -1
  36. package/build/screens/index.d.ts +1 -0
  37. package/build/screens/index.d.ts.map +1 -1
  38. package/build/screens/index.js +1 -0
  39. package/build/screens/index.js.map +1 -1
  40. package/build/screens/settings_screen.d.ts +5 -0
  41. package/build/screens/settings_screen.d.ts.map +1 -0
  42. package/build/screens/settings_screen.js +56 -0
  43. package/build/screens/settings_screen.js.map +1 -0
  44. package/build/types/resources/person.d.ts +1 -0
  45. package/build/types/resources/person.d.ts.map +1 -1
  46. package/build/types/resources/person.js.map +1 -1
  47. package/package.json +2 -2
  48. package/src/hooks/index.ts +1 -0
  49. package/src/hooks/use_current_person.ts +1 -0
  50. package/src/hooks/use_has_direct_messages.ts +3 -1
  51. package/src/hooks/use_person_settings.ts +29 -0
  52. package/src/navigation/index.tsx +11 -0
  53. package/src/screens/conversation_filters/components/conversation_filters.tsx +25 -5
  54. package/src/screens/conversation_filters/components/rows.tsx +16 -3
  55. package/src/screens/conversation_filters/context/conversation_filter_context.tsx +4 -0
  56. package/src/screens/conversation_filters/filter_types.ts +1 -0
  57. package/src/screens/conversations/components/list_header_component.tsx +23 -6
  58. package/src/screens/index.ts +1 -0
  59. package/src/screens/settings_screen.tsx +67 -0
  60. package/src/types/resources/person.ts +1 -0
@@ -1,5 +1,6 @@
1
1
  export enum FilterTypes {
2
2
  All = 'All conversations',
3
+ DirectMessages = 'Direct messages',
3
4
  Groups = 'All my groups',
4
5
  Teams = 'All my teams and plans',
5
6
  More = 'More',
@@ -2,14 +2,18 @@ import { RouteProp, useNavigation, useRoute } from '@react-navigation/native'
2
2
  import React, { useCallback, useMemo } from 'react'
3
3
  import { Alert, ScrollView, StyleSheet, View } from 'react-native'
4
4
  import { Heading, TextButton, ToggleButton } from '../../../components'
5
- import { useAtFontScaleBreakpoint, useCurrentPersonCache, useTheme } from '../../../hooks'
6
- import { useCanCreateConversations } from '../../../hooks'
5
+ import {
6
+ useAtFontScaleBreakpoint,
7
+ useCanCreateConversations,
8
+ useCurrentPersonCache,
9
+ useDirectMessagesEnabled,
10
+ useHasDirectMessages,
11
+ useNewConversationEntry,
12
+ useTheme,
13
+ } from '../../../hooks'
7
14
  import { useAppName } from '../../../hooks/use_app_name'
8
15
  import { useMarkAllRead } from '../../../hooks/use_conversations_actions'
9
- import { useDirectMessagesEnabled } from '../../../hooks/use_direct_messages_enabled'
10
16
  import { useCanDisplayGroups } from '../../../hooks/use_groups'
11
- import { useHasDirectMessages } from '../../../hooks/use_has_direct_messages'
12
- import { useNewConversationEntry } from '../../../hooks/use_new_conversation_entry'
13
17
  import { useNewConversationFromFilter } from '../../../hooks/use_new_conversation_from_filter'
14
18
  import { GraphId } from '../../../types/resources/group_resource'
15
19
  import { MAX_FONT_SIZE_MULTIPLIER_LANDMARK } from '../../../utils'
@@ -87,6 +91,10 @@ export const ListHeaderComponent = () => {
87
91
  }
88
92
  }, [navigation, route.params, entryMode, newConversationFromFilter])
89
93
 
94
+ const handleChatSettings = useCallback(() => {
95
+ navigation.navigate('ChatSettings', {})
96
+ }, [navigation])
97
+
90
98
  const handleMoreOptions = useCallback(() => {
91
99
  navigation.navigate('ConversationsMoreActions')
92
100
  }, [navigation])
@@ -95,8 +103,9 @@ export const ListHeaderComponent = () => {
95
103
  navigation.navigate('ConversationFilters', {
96
104
  chat_group_graph_id,
97
105
  group_source_app_name,
106
+ show_direct_messages,
98
107
  })
99
- }, [navigation, chat_group_graph_id, group_source_app_name])
108
+ }, [navigation, chat_group_graph_id, group_source_app_name, show_direct_messages])
100
109
 
101
110
  const handleMarkAllRead = useCallback(() => {
102
111
  currentPersonCache.update({ unreadCount: 0 })
@@ -148,6 +157,14 @@ export const ListHeaderComponent = () => {
148
157
  </TextButton>
149
158
  </View>
150
159
  <View style={styles.actionsContainer}>
160
+ {directMessagesEnabled && (
161
+ <ListHeaderActionButton
162
+ name="general.cog"
163
+ onPress={handleChatSettings}
164
+ accessibilityLabel="Chat settings"
165
+ maxFontSizeMultiplier={MAX_FONT_SIZE_MULTIPLIER_LANDMARK}
166
+ />
167
+ )}
151
168
  {canCreateConversations && (
152
169
  <ListHeaderActionButton
153
170
  name="churchCenter.signups"
@@ -1,3 +1,4 @@
1
+ export * from './settings_screen'
1
2
  export * from './design_system_screen'
2
3
  export * from './conversation_details_screen'
3
4
  export * from './conversation_screen'
@@ -0,0 +1,67 @@
1
+ import { StaticScreenProps } from '@react-navigation/native'
2
+ import React from 'react'
3
+ import { StyleSheet, View } from 'react-native'
4
+ import { Heading, Text } from '../components'
5
+ import { Switch } from '../components/display/switch'
6
+ import { useTheme } from '../hooks'
7
+ import { usePersonSettings } from '../hooks/use_person_settings'
8
+
9
+ export type SettingsScreenProps = StaticScreenProps<{}>
10
+
11
+ export function SettingsScreen({}: SettingsScreenProps) {
12
+ const styles = useStyles()
13
+ const { directMessagesDisabled, setDirectMessagesDisabled, isMutating } = usePersonSettings()
14
+
15
+ return (
16
+ <View style={styles.container}>
17
+ <View style={styles.sectionOuter}>
18
+ <View style={styles.sectionHeader}>
19
+ <Heading variant="h2">Messages</Heading>
20
+ </View>
21
+ <View style={styles.settingRow}>
22
+ <View style={styles.settingRowText}>
23
+ <Text>Allow direct messages</Text>
24
+ <Text variant="tertiary">
25
+ When disabled, you won't be able to participate in direct messages.
26
+ </Text>
27
+ </View>
28
+ <Switch
29
+ value={!directMessagesDisabled}
30
+ onValueChange={enabled => setDirectMessagesDisabled(!enabled)}
31
+ disabled={isMutating}
32
+ />
33
+ </View>
34
+ </View>
35
+ </View>
36
+ )
37
+ }
38
+
39
+ const useStyles = () => {
40
+ const { colors } = useTheme()
41
+ return StyleSheet.create({
42
+ container: {
43
+ flex: 1,
44
+ },
45
+ sectionOuter: {
46
+ paddingLeft: 16,
47
+ },
48
+ sectionHeader: {
49
+ paddingRight: 16,
50
+ paddingTop: 24,
51
+ paddingBottom: 12,
52
+ borderBottomWidth: 1,
53
+ borderBottomColor: colors.borderColorDefaultBase,
54
+ },
55
+ settingRow: {
56
+ flexDirection: 'row',
57
+ alignItems: 'flex-start',
58
+ justifyContent: 'space-between',
59
+ paddingRight: 16,
60
+ paddingVertical: 12,
61
+ },
62
+ settingRowText: {
63
+ flex: 1,
64
+ gap: 8,
65
+ },
66
+ })
67
+ }
@@ -21,4 +21,5 @@ export interface CurrentPersonResource extends PersonResource {
21
21
  unreadCount: number
22
22
  pcoChatEnabled: boolean
23
23
  ageQualificationStatus?: AgeQualificationStatus
24
+ directMessagesDisabled: boolean
24
25
  }