@planningcenter/chat-react-native 3.24.0-rc.6 → 3.24.0-rc.8
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/navigation/index.d.ts +82 -0
- package/build/navigation/index.d.ts.map +1 -1
- package/build/navigation/index.js +32 -0
- package/build/navigation/index.js.map +1 -1
- package/build/screens/conversation_select_type_screen.d.ts.map +1 -1
- package/build/screens/conversation_select_type_screen.js +12 -6
- package/build/screens/conversation_select_type_screen.js.map +1 -1
- package/build/screens/index.d.ts +2 -0
- package/build/screens/index.d.ts.map +1 -1
- package/build/screens/index.js +2 -0
- package/build/screens/index.js.map +1 -1
- package/build/screens/notification_settings_screen.d.ts +5 -0
- package/build/screens/notification_settings_screen.d.ts.map +1 -0
- package/build/screens/notification_settings_screen.js +216 -0
- package/build/screens/notification_settings_screen.js.map +1 -0
- package/build/screens/preferred_app/hooks/use_chat_types.d.ts +39 -0
- package/build/screens/preferred_app/hooks/use_chat_types.d.ts.map +1 -0
- package/build/screens/preferred_app/hooks/use_chat_types.js +12 -0
- package/build/screens/preferred_app/hooks/use_chat_types.js.map +1 -0
- package/build/screens/preferred_app_selection_screen.d.ts +10 -0
- package/build/screens/preferred_app_selection_screen.d.ts.map +1 -0
- package/build/screens/preferred_app_selection_screen.js +128 -0
- package/build/screens/preferred_app_selection_screen.js.map +1 -0
- package/package.json +2 -2
- package/src/navigation/index.tsx +35 -0
- package/src/screens/conversation_select_type_screen.tsx +12 -6
- package/src/screens/index.ts +2 -0
- package/src/screens/notification_settings_screen.tsx +356 -0
- package/src/screens/preferred_app/hooks/use_chat_types.ts +25 -0
- package/src/screens/preferred_app_selection_screen.tsx +169 -0
- package/src/types/images.d.ts +14 -0
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { ResourceObject } from '../../../types';
|
|
2
|
+
export type SourceAppName = 'Services' | 'Church Center';
|
|
3
|
+
export type PreferredApp = 'Services' | 'Church Center' | 'Chat' | 'None';
|
|
4
|
+
export interface ChatTypeResource extends ResourceObject {
|
|
5
|
+
type: 'ChatType';
|
|
6
|
+
defaultPreferredApp: PreferredApp;
|
|
7
|
+
preferredApp: PreferredApp;
|
|
8
|
+
preferredAppOptions: PreferredApp[];
|
|
9
|
+
sourceAppName: SourceAppName;
|
|
10
|
+
title: string;
|
|
11
|
+
}
|
|
12
|
+
export declare const useChatTypes: () => {
|
|
13
|
+
error: import("../../../types").FailedResponse | null;
|
|
14
|
+
status: "success" | "error";
|
|
15
|
+
isError: boolean;
|
|
16
|
+
isPending: false;
|
|
17
|
+
isLoading: false;
|
|
18
|
+
isLoadingError: false;
|
|
19
|
+
isRefetchError: boolean;
|
|
20
|
+
isSuccess: boolean;
|
|
21
|
+
dataUpdatedAt: number;
|
|
22
|
+
errorUpdatedAt: number;
|
|
23
|
+
failureCount: number;
|
|
24
|
+
failureReason: import("../../../types").FailedResponse | null;
|
|
25
|
+
errorUpdateCount: number;
|
|
26
|
+
isFetched: boolean;
|
|
27
|
+
isFetchedAfterMount: boolean;
|
|
28
|
+
isFetching: boolean;
|
|
29
|
+
isInitialLoading: boolean;
|
|
30
|
+
isPaused: boolean;
|
|
31
|
+
isRefetching: boolean;
|
|
32
|
+
isStale: boolean;
|
|
33
|
+
refetch: (options?: import("@tanstack/query-core").RefetchOptions) => Promise<import("@tanstack/query-core").QueryObserverResult<import("../../../types").ApiResource<ChatTypeResource[]>, import("../../../types").FailedResponse>>;
|
|
34
|
+
fetchStatus: import("@tanstack/query-core").FetchStatus;
|
|
35
|
+
data: ChatTypeResource[];
|
|
36
|
+
links: Record<string, string>;
|
|
37
|
+
meta: Record<string, unknown>;
|
|
38
|
+
};
|
|
39
|
+
//# sourceMappingURL=use_chat_types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use_chat_types.d.ts","sourceRoot":"","sources":["../../../../src/screens/preferred_app/hooks/use_chat_types.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAA;AAE/C,MAAM,MAAM,aAAa,GAAG,UAAU,GAAG,eAAe,CAAA;AACxD,MAAM,MAAM,YAAY,GAAG,UAAU,GAAG,eAAe,GAAG,MAAM,GAAG,MAAM,CAAA;AAEzE,MAAM,WAAW,gBAAiB,SAAQ,cAAc;IACtD,IAAI,EAAE,UAAU,CAAA;IAChB,mBAAmB,EAAE,YAAY,CAAA;IACjC,YAAY,EAAE,YAAY,CAAA;IAC1B,mBAAmB,EAAE,YAAY,EAAE,CAAA;IACnC,aAAa,EAAE,aAAa,CAAA;IAC5B,KAAK,EAAE,MAAM,CAAA;CACd;AAED,eAAO,MAAM,YAAY;;;;;;;;;;;;;;;;;;;;;;;;;;CASxB,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use_chat_types.js","sourceRoot":"","sources":["../../../../src/screens/preferred_app/hooks/use_chat_types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAA;AAe/C,MAAM,CAAC,MAAM,YAAY,GAAG,GAAG,EAAE;IAC/B,OAAO,cAAc,CAAqB;QACxC,GAAG,EAAE,gBAAgB;QACrB,IAAI,EAAE;YACJ,MAAM,EAAE;gBACN,QAAQ,EAAE,EAAE;aACb;SACF;KACF,CAAC,CAAA;AACJ,CAAC,CAAA","sourcesContent":["import { useSuspenseGet } from '../../../hooks'\nimport { ResourceObject } from '../../../types'\n\nexport type SourceAppName = 'Services' | 'Church Center'\nexport type PreferredApp = 'Services' | 'Church Center' | 'Chat' | 'None'\n\nexport interface ChatTypeResource extends ResourceObject {\n type: 'ChatType'\n defaultPreferredApp: PreferredApp\n preferredApp: PreferredApp\n preferredAppOptions: PreferredApp[]\n sourceAppName: SourceAppName\n title: string\n}\n\nexport const useChatTypes = () => {\n return useSuspenseGet<ChatTypeResource[]>({\n url: '/me/chat_types',\n data: {\n fields: {\n ChatType: [],\n },\n },\n })\n}\n"]}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { StaticScreenProps } from '@react-navigation/native';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { PreferredApp } from './preferred_app/hooks/use_chat_types';
|
|
4
|
+
export type PreferredAppSelectionScreenProps = StaticScreenProps<{
|
|
5
|
+
chatTypeId: number | string;
|
|
6
|
+
conversationType?: 'group' | 'team';
|
|
7
|
+
currentSelection?: PreferredApp;
|
|
8
|
+
}>;
|
|
9
|
+
export declare function PreferredAppSelectionScreen({ route }: PreferredAppSelectionScreenProps): React.JSX.Element;
|
|
10
|
+
//# sourceMappingURL=preferred_app_selection_screen.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"preferred_app_selection_screen.d.ts","sourceRoot":"","sources":["../../src/screens/preferred_app_selection_screen.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAA;AAE5D,OAAO,KAAiC,MAAM,OAAO,CAAA;AAOrD,OAAO,EAAE,YAAY,EAAgB,MAAM,sCAAsC,CAAA;AAIjF,MAAM,MAAM,gCAAgC,GAAG,iBAAiB,CAAC;IAC/D,UAAU,EAAE,MAAM,GAAG,MAAM,CAAA;IAC3B,gBAAgB,CAAC,EAAE,OAAO,GAAG,MAAM,CAAA;IACnC,gBAAgB,CAAC,EAAE,YAAY,CAAA;CAChC,CAAC,CAAA;AAEF,wBAAgB,2BAA2B,CAAC,EAAE,KAAK,EAAE,EAAE,gCAAgC,qBAkDtF"}
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
import { PlatformPressable } from '@react-navigation/elements';
|
|
2
|
+
import { useMutation } from '@tanstack/react-query';
|
|
3
|
+
import React from 'react';
|
|
4
|
+
import { Image, StyleSheet, View } from 'react-native';
|
|
5
|
+
import churchCenterLogo from '../../assets/churchCenter.png';
|
|
6
|
+
import servicesLogo from '../../assets/servicesApp.png';
|
|
7
|
+
import chatLogo from '../../assets/chatLogo.png';
|
|
8
|
+
import { Heading, Icon, Text } from '../components';
|
|
9
|
+
import { useApiClient, useTheme } from '../hooks';
|
|
10
|
+
import { useChatTypes } from './preferred_app/hooks/use_chat_types';
|
|
11
|
+
import { useAppName } from '../hooks/use_app_name';
|
|
12
|
+
import { throwResponseError } from '../utils/response_error';
|
|
13
|
+
export function PreferredAppSelectionScreen({ route }) {
|
|
14
|
+
const { chatTypeId } = route.params;
|
|
15
|
+
const { data: chatTypes, refetch: refetchChatTypes } = useChatTypes();
|
|
16
|
+
const appName = useAppName();
|
|
17
|
+
const apiClient = useApiClient();
|
|
18
|
+
const { mutate: updateChatType } = useMutation({
|
|
19
|
+
throwOnError: true,
|
|
20
|
+
onSuccess: () => refetchChatTypes(),
|
|
21
|
+
mutationFn: (app) => {
|
|
22
|
+
return apiClient.chat
|
|
23
|
+
.post({
|
|
24
|
+
url: `/me/chat_types/${chatTypeId}/set_preferred_appz`,
|
|
25
|
+
data: { data: { type: 'ChatType', attributes: { app } } },
|
|
26
|
+
})
|
|
27
|
+
.catch(throwResponseError);
|
|
28
|
+
},
|
|
29
|
+
});
|
|
30
|
+
const chatType = chatTypes.find(t => t.id === chatTypeId);
|
|
31
|
+
const { preferredAppOptions } = chatType || {};
|
|
32
|
+
const handleSelection = (app) => {
|
|
33
|
+
updateChatType(app);
|
|
34
|
+
};
|
|
35
|
+
const sectionTitle = `${chatType?.title} Conversations`;
|
|
36
|
+
return (<View style={styles.container}>
|
|
37
|
+
<View style={styles.section}>
|
|
38
|
+
<Heading variant="h3" style={styles.sectionHeading}>
|
|
39
|
+
{sectionTitle}
|
|
40
|
+
</Heading>
|
|
41
|
+
{preferredAppOptions?.sort(sortPreferredApp('asc')).map((option, key) => (<PressableRow key={`${key}-${option}`} isActive={chatType?.preferredApp === option} onPress={() => handleSelection(option)}>
|
|
42
|
+
<Image source={getAppImage(option)} style={styles.logo}/>
|
|
43
|
+
<Text>
|
|
44
|
+
{option}
|
|
45
|
+
{appName.includes(option.replace(/\s/, '').toLowerCase()) ? ' ( current )' : ''}
|
|
46
|
+
</Text>
|
|
47
|
+
</PressableRow>))}
|
|
48
|
+
</View>
|
|
49
|
+
</View>);
|
|
50
|
+
}
|
|
51
|
+
const sortPreferredApp = (dir) => (a, b) => {
|
|
52
|
+
if (a === 'None')
|
|
53
|
+
return 1;
|
|
54
|
+
if (a > b)
|
|
55
|
+
return dir === 'asc' ? 1 : -1;
|
|
56
|
+
if (b > a)
|
|
57
|
+
return dir === 'asc' ? -1 : 1;
|
|
58
|
+
return 0;
|
|
59
|
+
};
|
|
60
|
+
const getAppImage = (option) => {
|
|
61
|
+
switch (option) {
|
|
62
|
+
case 'Church Center':
|
|
63
|
+
return churchCenterLogo;
|
|
64
|
+
case 'Services':
|
|
65
|
+
return servicesLogo;
|
|
66
|
+
case 'Chat':
|
|
67
|
+
return chatLogo;
|
|
68
|
+
default:
|
|
69
|
+
return undefined;
|
|
70
|
+
}
|
|
71
|
+
};
|
|
72
|
+
const PressableRow = ({ children, isActive, onPress, style, }) => {
|
|
73
|
+
const styles = useRowStyles({ isActive });
|
|
74
|
+
return (<PlatformPressable style={styles.pressable} onPress={onPress} accessibilityRole="radio" accessibilityState={{ selected: isActive }}>
|
|
75
|
+
<View style={styles.row}>
|
|
76
|
+
<View style={[styles.rowInner, style]}>{children}</View>
|
|
77
|
+
<Icon name="general.check" style={styles.rowIconRight} accessibilityElementsHidden maxFontSizeMultiplier={2.5}/>
|
|
78
|
+
</View>
|
|
79
|
+
</PlatformPressable>);
|
|
80
|
+
};
|
|
81
|
+
const styles = StyleSheet.create({
|
|
82
|
+
container: {
|
|
83
|
+
flex: 1,
|
|
84
|
+
},
|
|
85
|
+
section: {
|
|
86
|
+
paddingTop: 16,
|
|
87
|
+
},
|
|
88
|
+
sectionHeading: {
|
|
89
|
+
paddingHorizontal: 16,
|
|
90
|
+
paddingBottom: 4,
|
|
91
|
+
},
|
|
92
|
+
logo: {
|
|
93
|
+
width: 32,
|
|
94
|
+
height: 32,
|
|
95
|
+
borderRadius: 8,
|
|
96
|
+
},
|
|
97
|
+
});
|
|
98
|
+
const useRowStyles = ({ isActive = false } = {}) => {
|
|
99
|
+
const theme = useTheme();
|
|
100
|
+
return StyleSheet.create({
|
|
101
|
+
pressable: {
|
|
102
|
+
paddingLeft: 16,
|
|
103
|
+
backgroundColor: theme.colors.surfaceColor100,
|
|
104
|
+
},
|
|
105
|
+
row: {
|
|
106
|
+
flexDirection: 'row',
|
|
107
|
+
alignItems: 'center',
|
|
108
|
+
justifyContent: 'space-between',
|
|
109
|
+
gap: 12,
|
|
110
|
+
borderBottomWidth: 1,
|
|
111
|
+
borderBottomColor: theme.colors.borderColorDefaultBase,
|
|
112
|
+
paddingVertical: 12,
|
|
113
|
+
paddingRight: 16,
|
|
114
|
+
},
|
|
115
|
+
rowInner: {
|
|
116
|
+
flexDirection: 'row',
|
|
117
|
+
alignItems: 'center',
|
|
118
|
+
gap: 12,
|
|
119
|
+
flexShrink: 1,
|
|
120
|
+
},
|
|
121
|
+
rowIconRight: {
|
|
122
|
+
fontSize: 16,
|
|
123
|
+
color: theme.colors.statusSuccessIcon,
|
|
124
|
+
opacity: isActive ? 1 : 0,
|
|
125
|
+
},
|
|
126
|
+
});
|
|
127
|
+
};
|
|
128
|
+
//# sourceMappingURL=preferred_app_selection_screen.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"preferred_app_selection_screen.js","sourceRoot":"","sources":["../../src/screens/preferred_app_selection_screen.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAA;AAE9D,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAA;AACnD,OAAO,KAAiC,MAAM,OAAO,CAAA;AACrD,OAAO,EAAE,KAAK,EAAE,UAAU,EAAE,IAAI,EAAkB,MAAM,cAAc,CAAA;AACtE,OAAO,gBAAgB,MAAM,+BAA+B,CAAA;AAC5D,OAAO,YAAY,MAAM,8BAA8B,CAAA;AACvD,O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AAE,QAAQ;YACpB,GAAG,EAAE,EAAE;YACP,UAAU,EAAE,CAAC;SACd;QACD,YAAY,EAAE;YACZ,QAAQ,EAAE,EAAE;YACZ,KAAK,EAAE,KAAK,CAAC,MAAM,CAAC,iBAAiB;YACrC,OAAO,EAAE,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;SAC1B;KACF,CAAC,CAAA;AACJ,CAAC,CAAA","sourcesContent":["import { PlatformPressable } from '@react-navigation/elements'\nimport { StaticScreenProps } from '@react-navigation/native'\nimport { useMutation } from '@tanstack/react-query'\nimport React, { type PropsWithChildren } from 'react'\nimport { Image, StyleSheet, View, type ViewStyle } from 'react-native'\nimport churchCenterLogo from '../../assets/churchCenter.png'\nimport servicesLogo from '../../assets/servicesApp.png'\nimport chatLogo from '../../assets/chatLogo.png'\nimport { Heading, Icon, Text } from '../components'\nimport { useApiClient, useTheme } from '../hooks'\nimport { PreferredApp, useChatTypes } from './preferred_app/hooks/use_chat_types'\nimport { useAppName } from '../hooks/use_app_name'\nimport { throwResponseError } from '../utils/response_error'\n\nexport type PreferredAppSelectionScreenProps = StaticScreenProps<{\n chatTypeId: number | string\n conversationType?: 'group' | 'team'\n currentSelection?: PreferredApp\n}>\n\nexport function PreferredAppSelectionScreen({ route }: PreferredAppSelectionScreenProps) {\n const { chatTypeId } = route.params\n const { data: chatTypes, refetch: refetchChatTypes } = useChatTypes()\n const appName = useAppName()\n\n const apiClient = useApiClient()\n\n const { mutate: updateChatType } = useMutation({\n throwOnError: true,\n onSuccess: () => refetchChatTypes(),\n mutationFn: (app: PreferredApp) => {\n return apiClient.chat\n .post({\n url: `/me/chat_types/${chatTypeId}/set_preferred_appz`,\n data: { data: { type: 'ChatType', attributes: { app } } },\n })\n .catch(throwResponseError)\n },\n })\n const chatType = chatTypes.find(t => t.id === chatTypeId)\n const { preferredAppOptions } = chatType || {}\n\n const handleSelection = (app: PreferredApp) => {\n updateChatType(app)\n }\n\n const sectionTitle = `${chatType?.title} Conversations`\n\n return (\n <View style={styles.container}>\n <View style={styles.section}>\n <Heading variant=\"h3\" style={styles.sectionHeading}>\n {sectionTitle}\n </Heading>\n {preferredAppOptions?.sort(sortPreferredApp('asc')).map((option, key) => (\n <PressableRow\n key={`${key}-${option}`}\n isActive={chatType?.preferredApp === option}\n onPress={() => handleSelection(option)}\n >\n <Image source={getAppImage(option)} style={styles.logo} />\n <Text>\n {option}\n {appName.includes(option.replace(/\\s/, '').toLowerCase()) ? ' ( current )' : ''}\n </Text>\n </PressableRow>\n ))}\n </View>\n </View>\n )\n}\n\nconst sortPreferredApp = (dir?: 'asc' | 'desc') => (a: PreferredApp, b: PreferredApp) => {\n if (a === 'None') return 1\n if (a > b) return dir === 'asc' ? 1 : -1\n if (b > a) return dir === 'asc' ? -1 : 1\n\n return 0\n}\n\nconst getAppImage = (option: PreferredApp) => {\n switch (option) {\n case 'Church Center':\n return churchCenterLogo\n case 'Services':\n return servicesLogo\n case 'Chat':\n return chatLogo\n default:\n return undefined\n }\n}\n\nconst PressableRow = ({\n children,\n isActive,\n onPress,\n style,\n}: PropsWithChildren<{ isActive: boolean; onPress: () => void; style?: ViewStyle }>) => {\n const styles = useRowStyles({ isActive })\n return (\n <PlatformPressable\n style={styles.pressable}\n onPress={onPress}\n accessibilityRole=\"radio\"\n accessibilityState={{ selected: isActive }}\n >\n <View style={styles.row}>\n <View style={[styles.rowInner, style]}>{children}</View>\n <Icon\n name=\"general.check\"\n style={styles.rowIconRight}\n accessibilityElementsHidden\n maxFontSizeMultiplier={2.5}\n />\n </View>\n </PlatformPressable>\n )\n}\n\nconst styles = StyleSheet.create({\n container: {\n flex: 1,\n },\n section: {\n paddingTop: 16,\n },\n sectionHeading: {\n paddingHorizontal: 16,\n paddingBottom: 4,\n },\n logo: {\n width: 32,\n height: 32,\n borderRadius: 8,\n },\n})\n\nconst useRowStyles = ({ isActive = false }: { isActive?: boolean } = {}) => {\n const theme = useTheme()\n\n return StyleSheet.create({\n pressable: {\n paddingLeft: 16,\n backgroundColor: theme.colors.surfaceColor100,\n },\n row: {\n flexDirection: 'row',\n alignItems: 'center',\n justifyContent: 'space-between',\n gap: 12,\n borderBottomWidth: 1,\n borderBottomColor: theme.colors.borderColorDefaultBase,\n paddingVertical: 12,\n paddingRight: 16,\n },\n rowInner: {\n flexDirection: 'row',\n alignItems: 'center',\n gap: 12,\n flexShrink: 1,\n },\n rowIconRight: {\n fontSize: 16,\n color: theme.colors.statusSuccessIcon,\n opacity: isActive ? 1 : 0,\n },\n })\n}\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@planningcenter/chat-react-native",
|
|
3
|
-
"version": "3.24.0-rc.
|
|
3
|
+
"version": "3.24.0-rc.8",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "build/index.js",
|
|
6
6
|
"types": "build/index.d.ts",
|
|
@@ -58,5 +58,5 @@
|
|
|
58
58
|
"react-native-url-polyfill": "^2.0.0",
|
|
59
59
|
"typescript": "<5.6.0"
|
|
60
60
|
},
|
|
61
|
-
"gitHead": "
|
|
61
|
+
"gitHead": "6259e50e7b8ca70aee8b50cc641bc3a6c2d6c11a"
|
|
62
62
|
}
|
package/src/navigation/index.tsx
CHANGED
|
@@ -49,6 +49,8 @@ import {
|
|
|
49
49
|
} from '../screens/message_actions_screen'
|
|
50
50
|
import { MessageReportScreen, MessageReportScreenOptions } from '../screens/message_report_screen'
|
|
51
51
|
import { NotFound } from '../screens/not_found'
|
|
52
|
+
import { NotificationSettingsScreen } from '../screens/notification_settings_screen'
|
|
53
|
+
import { PreferredAppSelectionScreen } from '../screens/preferred_app_selection_screen'
|
|
52
54
|
import { ReactionsScreen, ReactionsScreenOptions } from '../screens/reactions_screen'
|
|
53
55
|
import { ScreenLayoutWithChatAccessGate } from './screenLayout'
|
|
54
56
|
import { SendGiphyScreen, SendGiphyScreenOptions } from '../screens/send_giphy_screen'
|
|
@@ -124,6 +126,32 @@ export const NewConversationStack = createNativeStackNavigator({
|
|
|
124
126
|
},
|
|
125
127
|
})
|
|
126
128
|
|
|
129
|
+
export const NotificationSettingsStack = createNativeStackNavigator({
|
|
130
|
+
initialRouteName: 'NotificationSettings',
|
|
131
|
+
screenOptions: {
|
|
132
|
+
headerBackButtonDisplayMode: 'minimal',
|
|
133
|
+
},
|
|
134
|
+
screenLayout: ScreenLayoutWithChatAccessGate,
|
|
135
|
+
screens: {
|
|
136
|
+
NotificationSettings: {
|
|
137
|
+
screen: NotificationSettingsScreen,
|
|
138
|
+
options: ({ navigation }) => ({
|
|
139
|
+
title: 'Chat',
|
|
140
|
+
headerRight: (props: NativeStackHeaderRightProps) => (
|
|
141
|
+
<HeaderTextButton {...props} onPress={navigation.goBack} title="Done" />
|
|
142
|
+
),
|
|
143
|
+
headerBackVisible: false,
|
|
144
|
+
}),
|
|
145
|
+
},
|
|
146
|
+
PreferredAppSelection: {
|
|
147
|
+
screen: PreferredAppSelectionScreen,
|
|
148
|
+
options: {
|
|
149
|
+
title: 'Preferred app',
|
|
150
|
+
},
|
|
151
|
+
},
|
|
152
|
+
},
|
|
153
|
+
})
|
|
154
|
+
|
|
127
155
|
export const ChatStack = createNativeStackNavigator({
|
|
128
156
|
screenOptions: {
|
|
129
157
|
headerBackButtonDisplayMode: 'minimal',
|
|
@@ -223,6 +251,13 @@ export const ChatStack = createNativeStackNavigator({
|
|
|
223
251
|
),
|
|
224
252
|
}),
|
|
225
253
|
},
|
|
254
|
+
NotificationSettingsStack: {
|
|
255
|
+
screen: NotificationSettingsStack,
|
|
256
|
+
options: {
|
|
257
|
+
headerShown: false,
|
|
258
|
+
presentation: 'modal',
|
|
259
|
+
},
|
|
260
|
+
},
|
|
226
261
|
New: {
|
|
227
262
|
screen: NewConversationStack,
|
|
228
263
|
if: useQualifiedByAge,
|
|
@@ -19,17 +19,23 @@ export function ConversationSelectTypeScreen({ route }: ConversationSelectTypeSc
|
|
|
19
19
|
|
|
20
20
|
const handleGroupPress = () => {
|
|
21
21
|
Haptic.impactLight()
|
|
22
|
-
navigation.
|
|
23
|
-
|
|
24
|
-
|
|
22
|
+
navigation.goBack()
|
|
23
|
+
requestAnimationFrame(() => {
|
|
24
|
+
navigation.navigate('New', {
|
|
25
|
+
screen: 'ConversationSelectGroupRecipients',
|
|
26
|
+
params: { ...route.params },
|
|
27
|
+
})
|
|
25
28
|
})
|
|
26
29
|
}
|
|
27
30
|
|
|
28
31
|
const handleTeamPress = () => {
|
|
29
32
|
Haptic.impactLight()
|
|
30
|
-
navigation.
|
|
31
|
-
|
|
32
|
-
|
|
33
|
+
navigation.goBack()
|
|
34
|
+
requestAnimationFrame(() => {
|
|
35
|
+
navigation.navigate('New', {
|
|
36
|
+
screen: 'ConversationSelectTeamsILeadRecipients',
|
|
37
|
+
params: { ...route.params },
|
|
38
|
+
})
|
|
33
39
|
})
|
|
34
40
|
}
|
|
35
41
|
|
package/src/screens/index.ts
CHANGED
|
@@ -2,6 +2,8 @@ export * from './design_system_screen'
|
|
|
2
2
|
export * from './conversation_details_screen'
|
|
3
3
|
export * from './conversation_screen'
|
|
4
4
|
export * from './conversation_new/conversation_new_screen'
|
|
5
|
+
export * from './notification_settings_screen'
|
|
6
|
+
export * from './preferred_app_selection_screen'
|
|
5
7
|
export * from './conversation_filter_recipients/conversation_filter_recipients_screen'
|
|
6
8
|
export * from './message_actions_screen'
|
|
7
9
|
export * from './message_report_screen'
|