@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.
- package/build/hooks/index.d.ts +1 -0
- package/build/hooks/index.d.ts.map +1 -1
- package/build/hooks/index.js +1 -0
- package/build/hooks/index.js.map +1 -1
- package/build/hooks/use_current_person.d.ts.map +1 -1
- package/build/hooks/use_current_person.js +1 -0
- package/build/hooks/use_current_person.js.map +1 -1
- package/build/hooks/use_has_direct_messages.d.ts.map +1 -1
- package/build/hooks/use_has_direct_messages.js +3 -1
- package/build/hooks/use_has_direct_messages.js.map +1 -1
- package/build/hooks/use_person_settings.d.ts +6 -0
- package/build/hooks/use_person_settings.d.ts.map +1 -0
- package/build/hooks/use_person_settings.js +26 -0
- package/build/hooks/use_person_settings.js.map +1 -0
- package/build/navigation/index.d.ts +13 -0
- package/build/navigation/index.d.ts.map +1 -1
- package/build/navigation/index.js +9 -0
- package/build/navigation/index.js.map +1 -1
- package/build/screens/conversation_filters/components/conversation_filters.d.ts.map +1 -1
- package/build/screens/conversation_filters/components/conversation_filters.js +20 -5
- package/build/screens/conversation_filters/components/conversation_filters.js.map +1 -1
- package/build/screens/conversation_filters/components/rows.d.ts +2 -1
- package/build/screens/conversation_filters/components/rows.d.ts.map +1 -1
- package/build/screens/conversation_filters/components/rows.js +2 -2
- package/build/screens/conversation_filters/components/rows.js.map +1 -1
- package/build/screens/conversation_filters/context/conversation_filter_context.d.ts.map +1 -1
- package/build/screens/conversation_filters/context/conversation_filter_context.js +4 -0
- package/build/screens/conversation_filters/context/conversation_filter_context.js.map +1 -1
- package/build/screens/conversation_filters/filter_types.d.ts +1 -0
- package/build/screens/conversation_filters/filter_types.d.ts.map +1 -1
- package/build/screens/conversation_filters/filter_types.js +1 -0
- package/build/screens/conversation_filters/filter_types.js.map +1 -1
- package/build/screens/conversations/components/list_header_component.d.ts.map +1 -1
- package/build/screens/conversations/components/list_header_component.js +7 -6
- package/build/screens/conversations/components/list_header_component.js.map +1 -1
- package/build/screens/index.d.ts +1 -0
- package/build/screens/index.d.ts.map +1 -1
- package/build/screens/index.js +1 -0
- package/build/screens/index.js.map +1 -1
- package/build/screens/settings_screen.d.ts +5 -0
- package/build/screens/settings_screen.d.ts.map +1 -0
- package/build/screens/settings_screen.js +56 -0
- package/build/screens/settings_screen.js.map +1 -0
- package/build/types/resources/person.d.ts +1 -0
- package/build/types/resources/person.d.ts.map +1 -1
- package/build/types/resources/person.js.map +1 -1
- package/package.json +2 -2
- package/src/hooks/index.ts +1 -0
- package/src/hooks/use_current_person.ts +1 -0
- package/src/hooks/use_has_direct_messages.ts +3 -1
- package/src/hooks/use_person_settings.ts +29 -0
- package/src/navigation/index.tsx +11 -0
- package/src/screens/conversation_filters/components/conversation_filters.tsx +25 -5
- package/src/screens/conversation_filters/components/rows.tsx +16 -3
- package/src/screens/conversation_filters/context/conversation_filter_context.tsx +4 -0
- package/src/screens/conversation_filters/filter_types.ts +1 -0
- package/src/screens/conversations/components/list_header_component.tsx +23 -6
- package/src/screens/index.ts +1 -0
- package/src/screens/settings_screen.tsx +67 -0
- package/src/types/resources/person.ts +1 -0
|
@@ -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 {
|
|
6
|
-
|
|
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"
|
package/src/screens/index.ts
CHANGED
|
@@ -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
|
+
}
|