@planningcenter/chat-react-native 3.24.0-rc.8 → 3.24.0

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 (51) hide show
  1. package/build/components/display/platform_modal_header_buttons.d.ts +8 -0
  2. package/build/components/display/platform_modal_header_buttons.d.ts.map +1 -1
  3. package/build/components/display/platform_modal_header_buttons.js +8 -0
  4. package/build/components/display/platform_modal_header_buttons.js.map +1 -1
  5. package/build/navigation/index.d.ts +29 -79
  6. package/build/navigation/index.d.ts.map +1 -1
  7. package/build/navigation/index.js +20 -28
  8. package/build/navigation/index.js.map +1 -1
  9. package/build/screens/group_notification_settings_screen.d.ts +8 -0
  10. package/build/screens/group_notification_settings_screen.d.ts.map +1 -0
  11. package/build/screens/group_notification_settings_screen.js +79 -0
  12. package/build/screens/group_notification_settings_screen.js.map +1 -0
  13. package/build/screens/index.d.ts +1 -0
  14. package/build/screens/index.d.ts.map +1 -1
  15. package/build/screens/index.js +1 -0
  16. package/build/screens/index.js.map +1 -1
  17. package/build/screens/message_report/components/message_preview.d.ts.map +1 -1
  18. package/build/screens/message_report/components/message_preview.js +12 -19
  19. package/build/screens/message_report/components/message_preview.js.map +1 -1
  20. package/build/screens/notification_settings/hooks/groups.d.ts +94 -0
  21. package/build/screens/notification_settings/hooks/groups.d.ts.map +1 -0
  22. package/build/screens/notification_settings/hooks/groups.js +92 -0
  23. package/build/screens/notification_settings/hooks/groups.js.map +1 -0
  24. package/build/screens/notification_settings_screen.d.ts.map +1 -1
  25. package/build/screens/notification_settings_screen.js +50 -32
  26. package/build/screens/notification_settings_screen.js.map +1 -1
  27. package/build/screens/preferred_app_selection_screen.js +1 -1
  28. package/build/screens/preferred_app_selection_screen.js.map +1 -1
  29. package/build/types/resources/group_membership.d.ts +6 -0
  30. package/build/types/resources/group_membership.d.ts.map +1 -0
  31. package/build/types/resources/group_membership.js +2 -0
  32. package/build/types/resources/group_membership.js.map +1 -0
  33. package/build/types/resources/group_resource.d.ts +4 -0
  34. package/build/types/resources/group_resource.d.ts.map +1 -1
  35. package/build/types/resources/group_resource.js.map +1 -1
  36. package/build/types/resources/index.d.ts +2 -0
  37. package/build/types/resources/index.d.ts.map +1 -1
  38. package/build/types/resources/index.js +2 -0
  39. package/build/types/resources/index.js.map +1 -1
  40. package/package.json +2 -2
  41. package/src/components/display/platform_modal_header_buttons.tsx +16 -0
  42. package/src/navigation/index.tsx +27 -31
  43. package/src/screens/group_notification_settings_screen.tsx +92 -0
  44. package/src/screens/index.ts +1 -0
  45. package/src/screens/message_report/components/message_preview.tsx +15 -22
  46. package/src/screens/notification_settings/hooks/groups.ts +101 -0
  47. package/src/screens/notification_settings_screen.tsx +61 -34
  48. package/src/screens/preferred_app_selection_screen.tsx +1 -1
  49. package/src/types/resources/group_membership.ts +6 -0
  50. package/src/types/resources/group_resource.ts +5 -0
  51. package/src/types/resources/index.ts +2 -0
@@ -3,31 +3,30 @@ import { View, StyleSheet } from 'react-native';
3
3
  import { Avatar, Text, Icon } from '../../../components';
4
4
  import { useTheme } from '../../../hooks';
5
5
  export function MessagePreview({ message, style }) {
6
- const styles = useStyles();
7
6
  const hasImages = message.attachments.some(att => att.type === 'MessageAttachment' && att.attributes?.contentType?.startsWith('image/'));
7
+ const imageOnly = hasImages && !message.text;
8
+ const styles = useStyles({ imageOnly });
8
9
  return (<View style={[styles.previewContainer, style]}>
9
10
  <View style={styles.previewHeader}>
10
11
  <Avatar sourceUri={message.author.avatar} size="md"/>
11
12
  <Text style={styles.authorName}>{message.author.name}</Text>
12
13
  </View>
13
14
 
14
- <View style={styles.messageBubbleContainer}>
15
- {message.text && (<View style={styles.messageBubble}>
16
- <Text style={styles.messageText} numberOfLines={5}>
17
- {message.text}
18
- </Text>
19
- </View>)}
20
-
15
+ <View style={styles.messageBubble}>
21
16
  {hasImages && (<View style={styles.imagePlaceholder}>
22
17
  <Icon name="general.image" style={styles.placeholderIcon}/>
23
18
  <Text variant="secondary" style={styles.placeholderText}>
24
19
  Image hidden
25
20
  </Text>
26
21
  </View>)}
22
+
23
+ {message.text && (<Text style={styles.messageText} numberOfLines={5}>
24
+ {message.text}
25
+ </Text>)}
27
26
  </View>
28
27
  </View>);
29
28
  }
30
- const useStyles = () => {
29
+ const useStyles = ({ imageOnly }) => {
31
30
  const { colors } = useTheme();
32
31
  return StyleSheet.create({
33
32
  previewContainer: {
@@ -43,31 +42,25 @@ const useStyles = () => {
43
42
  fontWeight: '600',
44
43
  color: colors.textColorDefaultPrimary,
45
44
  },
46
- messageBubbleContainer: {
47
- gap: 8,
48
- },
49
45
  messageBubble: {
50
46
  backgroundColor: colors.fillColorNeutral060,
51
47
  borderRadius: 16,
52
- paddingHorizontal: 16,
53
- paddingVertical: 12,
48
+ overflow: 'hidden',
54
49
  alignSelf: 'flex-start',
55
- maxWidth: '80%',
50
+ maxWidth: imageOnly ? '40%' : '80%',
56
51
  },
57
52
  messageText: {
58
53
  fontSize: 14,
59
54
  color: colors.textColorDefaultPrimary,
60
55
  lineHeight: 20,
56
+ paddingHorizontal: 16,
57
+ paddingVertical: 12,
61
58
  },
62
59
  imagePlaceholder: {
63
60
  height: 120,
64
- backgroundColor: colors.fillColorNeutral060,
65
- borderRadius: 16,
66
61
  justifyContent: 'center',
67
62
  alignItems: 'center',
68
63
  gap: 8,
69
- maxWidth: '80%',
70
- alignSelf: 'flex-start',
71
64
  },
72
65
  placeholderIcon: {
73
66
  fontSize: 32,
@@ -1 +1 @@
1
- {"version":3,"file":"message_preview.js","sourceRoot":"","sources":["../../../../src/screens/message_report/components/message_preview.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AACzB,OAAO,EAAE,IAAI,EAAE,UAAU,EAAa,MAAM,cAAc,CAAA;AAC1D,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,qBAAqB,CAAA;AACxD,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAA;AAQzC,MAAM,UA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f,SAAS,EAAE,YAAY;SACxB;QACD,eAAe,EAAE;YACf,QAAQ,EAAE,EAAE;YACZ,KAAK,EAAE,MAAM,CAAC,yBAAyB;SACxC;QACD,eAAe,EAAE;YACf,QAAQ,EAAE,EAAE;SACb;KACF,CAAC,CAAA;AACJ,CAAC,CAAA","sourcesContent":["import React from 'react'\nimport { View, StyleSheet, ViewStyle } from 'react-native'\nimport { Avatar, Text, Icon } from '../../../components'\nimport { useTheme } from '../../../hooks'\nimport { MessageResource } from '../../../types'\n\ninterface MessagePreviewProps {\n message: MessageResource\n style?: ViewStyle\n}\n\nexport function MessagePreview({ message, style }: MessagePreviewProps) {\n const styles = useStyles()\n\n const hasImages = message.attachments.some(\n att => att.type === 'MessageAttachment' && att.attributes?.contentType?.startsWith('image/')\n )\n\n return (\n <View style={[styles.previewContainer, style]}>\n <View style={styles.previewHeader}>\n <Avatar sourceUri={message.author.avatar} size=\"md\" />\n <Text style={styles.authorName}>{message.author.name}</Text>\n </View>\n\n <View style={styles.messageBubbleContainer}>\n {message.text && (\n <View style={styles.messageBubble}>\n <Text style={styles.messageText} numberOfLines={5}>\n {message.text}\n </Text>\n </View>\n )}\n\n {hasImages && (\n <View style={styles.imagePlaceholder}>\n <Icon name=\"general.image\" style={styles.placeholderIcon} />\n <Text variant=\"secondary\" style={styles.placeholderText}>\n Image hidden\n </Text>\n </View>\n )}\n </View>\n </View>\n )\n}\n\nconst useStyles = () => {\n const { colors } = useTheme()\n\n return StyleSheet.create({\n previewContainer: {\n gap: 12,\n },\n previewHeader: {\n flexDirection: 'row',\n alignItems: 'center',\n gap: 12,\n },\n authorName: {\n fontSize: 14,\n fontWeight: '600',\n color: colors.textColorDefaultPrimary,\n },\n messageBubbleContainer: {\n gap: 8,\n },\n messageBubble: {\n backgroundColor: colors.fillColorNeutral060,\n borderRadius: 16,\n paddingHorizontal: 16,\n paddingVertical: 12,\n alignSelf: 'flex-start',\n maxWidth: '80%',\n },\n messageText: {\n fontSize: 14,\n color: colors.textColorDefaultPrimary,\n lineHeight: 20,\n },\n imagePlaceholder: {\n height: 120,\n backgroundColor: colors.fillColorNeutral060,\n borderRadius: 16,\n justifyContent: 'center',\n alignItems: 'center',\n gap: 8,\n maxWidth: '80%',\n alignSelf: 'flex-start',\n },\n placeholderIcon: {\n fontSize: 32,\n color: colors.iconColorDefaultSecondary,\n },\n placeholderText: {\n fontSize: 14,\n },\n })\n}\n"]}
1
+ {"version":3,"file":"message_preview.js","sourceRoot":"","sources":["../../../../src/screens/message_report/components/message_preview.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AACzB,OAAO,EAAE,IAAI,EAAE,UAAU,EAAa,MAAM,cAAc,CAAA;AAC1D,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,qBAAqB,CAAA;AACxD,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAA;AAQzC,MAAM,UAAU,cAAc,CAAC,EAAE,OAAO,EAAE,KAAK,EAAuB;IACpE,MAAM,SAAS,GAAG,OAAO,CAAC,WAAW,CAAC,IAAI,CACxC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,IAAI,KAAK,mBAAmB,IAAI,GAAG,CAAC,UAAU,EAAE,WAAW,EAAE,UAAU,CAAC,QAAQ,CAAC,CAC7F,CAAA;IAED,MAAM,SAAS,GAAG,SAAS,IAAI,CAAC,OAAO,CAAC,IAAI,CAAA;IAC5C,MAAM,MAAM,GAAG,SAAS,CAAC,EAAE,SAAS,EAAE,CAAC,CAAA;IAEvC,OAAO,CACL,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,CAAC,gBAAgB,EAAE,KAAK,CAAC,CAAC,CAC5C;MAAA,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,MAAM,CAAC,aAAa,CAAC,CAChC;QAAA,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC,OAAO,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,IA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EAAE,KAAK;YACjB,KAAK,EAAE,MAAM,CAAC,uBAAuB;SACtC;QACD,aAAa,EAAE;YACb,eAAe,EAAE,MAAM,CAAC,mBAAmB;YAC3C,YAAY,EAAE,EAAE;YAChB,QAAQ,EAAE,QAAQ;YAClB,SAAS,EAAE,YAAY;YACvB,QAAQ,EAAE,SAAS,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,KAAK;SACpC;QACD,WAAW,EAAE;YACX,QAAQ,EAAE,EAAE;YACZ,KAAK,EAAE,MAAM,CAAC,uBAAuB;YACrC,UAAU,EAAE,EAAE;YACd,iBAAiB,EAAE,EAAE;YACrB,eAAe,EAAE,EAAE;SACpB;QACD,gBAAgB,EAAE;YAChB,MAAM,EAAE,GAAG;YACX,cAAc,EAAE,QAAQ;YACxB,UAAU,EAAE,QAAQ;YACpB,GAAG,EAAE,CAAC;SACP;QACD,eAAe,EAAE;YACf,QAAQ,EAAE,EAAE;YACZ,KAAK,EAAE,MAAM,CAAC,yBAAyB;SACxC;QACD,eAAe,EAAE;YACf,QAAQ,EAAE,EAAE;SACb;KACF,CAAC,CAAA;AACJ,CAAC,CAAA","sourcesContent":["import React from 'react'\nimport { View, StyleSheet, ViewStyle } from 'react-native'\nimport { Avatar, Text, Icon } from '../../../components'\nimport { useTheme } from '../../../hooks'\nimport { MessageResource } from '../../../types'\n\ninterface MessagePreviewProps {\n message: MessageResource\n style?: ViewStyle\n}\n\nexport function MessagePreview({ message, style }: MessagePreviewProps) {\n const hasImages = message.attachments.some(\n att => att.type === 'MessageAttachment' && att.attributes?.contentType?.startsWith('image/')\n )\n\n const imageOnly = hasImages && !message.text\n const styles = useStyles({ imageOnly })\n\n return (\n <View style={[styles.previewContainer, style]}>\n <View style={styles.previewHeader}>\n <Avatar sourceUri={message.author.avatar} size=\"md\" />\n <Text style={styles.authorName}>{message.author.name}</Text>\n </View>\n\n <View style={styles.messageBubble}>\n {hasImages && (\n <View style={styles.imagePlaceholder}>\n <Icon name=\"general.image\" style={styles.placeholderIcon} />\n <Text variant=\"secondary\" style={styles.placeholderText}>\n Image hidden\n </Text>\n </View>\n )}\n\n {message.text && (\n <Text style={styles.messageText} numberOfLines={5}>\n {message.text}\n </Text>\n )}\n </View>\n </View>\n )\n}\n\nconst useStyles = ({ imageOnly }: { imageOnly: boolean }) => {\n const { colors } = useTheme()\n\n return StyleSheet.create({\n previewContainer: {\n gap: 12,\n },\n previewHeader: {\n flexDirection: 'row',\n alignItems: 'center',\n gap: 12,\n },\n authorName: {\n fontSize: 14,\n fontWeight: '600',\n color: colors.textColorDefaultPrimary,\n },\n messageBubble: {\n backgroundColor: colors.fillColorNeutral060,\n borderRadius: 16,\n overflow: 'hidden',\n alignSelf: 'flex-start',\n maxWidth: imageOnly ? '40%' : '80%',\n },\n messageText: {\n fontSize: 14,\n color: colors.textColorDefaultPrimary,\n lineHeight: 20,\n paddingHorizontal: 16,\n paddingVertical: 12,\n },\n imagePlaceholder: {\n height: 120,\n justifyContent: 'center',\n alignItems: 'center',\n gap: 8,\n },\n placeholderIcon: {\n fontSize: 32,\n color: colors.iconColorDefaultSecondary,\n },\n placeholderText: {\n fontSize: 14,\n },\n })\n}\n"]}
@@ -0,0 +1,94 @@
1
+ import { ApiResource } from '../../../types';
2
+ import { GroupMembership, GroupResourceWithMembership } from '../../../types/resources';
3
+ export declare const getGroupsRequestArgs: () => {
4
+ url: string;
5
+ data: {
6
+ perPage: number;
7
+ include: string[];
8
+ filter: string;
9
+ fields: {
10
+ Group: never[];
11
+ GroupMembership: string[];
12
+ };
13
+ order: string;
14
+ };
15
+ };
16
+ export declare const getGroupRequestArgs: ({ groupId }: {
17
+ groupId: number | string;
18
+ }) => {
19
+ url: string;
20
+ data: {
21
+ include: string[];
22
+ fields: {
23
+ Group: string[];
24
+ GroupMembership: string[];
25
+ };
26
+ };
27
+ };
28
+ export declare const useGroups: () => {
29
+ data: GroupResourceWithMembership[];
30
+ totalCount: number;
31
+ error: Response | null;
32
+ status: "success" | "error";
33
+ isError: boolean;
34
+ isPending: false;
35
+ isLoading: false;
36
+ isLoadingError: false;
37
+ isRefetchError: boolean;
38
+ isSuccess: boolean;
39
+ dataUpdatedAt: number;
40
+ errorUpdatedAt: number;
41
+ failureCount: number;
42
+ failureReason: Response | null;
43
+ errorUpdateCount: number;
44
+ isFetched: boolean;
45
+ isFetchedAfterMount: boolean;
46
+ isFetching: boolean;
47
+ isInitialLoading: boolean;
48
+ isPaused: boolean;
49
+ isRefetching: boolean;
50
+ isStale: boolean;
51
+ refetch: (options?: import("@tanstack/react-query").RefetchOptions) => Promise<import("@tanstack/react-query").QueryObserverResult<import("@tanstack/react-query").InfiniteData<import("../../../types").ApiCollection<GroupResourceWithMembership>, unknown>, Response>>;
52
+ fetchStatus: import("@tanstack/react-query").FetchStatus;
53
+ fetchNextPage: (options?: import("@tanstack/react-query").FetchNextPageOptions) => Promise<import("@tanstack/react-query").InfiniteQueryObserverResult<import("@tanstack/react-query").InfiniteData<import("../../../types").ApiCollection<GroupResourceWithMembership>, unknown>, Response>>;
54
+ fetchPreviousPage: (options?: import("@tanstack/react-query").FetchPreviousPageOptions) => Promise<import("@tanstack/react-query").InfiniteQueryObserverResult<import("@tanstack/react-query").InfiniteData<import("../../../types").ApiCollection<GroupResourceWithMembership>, unknown>, Response>>;
55
+ hasNextPage: boolean;
56
+ hasPreviousPage: boolean;
57
+ isFetchNextPageError: boolean;
58
+ isFetchingNextPage: boolean;
59
+ isFetchPreviousPageError: boolean;
60
+ isFetchingPreviousPage: boolean;
61
+ };
62
+ export declare const useGroup: ({ groupId }: {
63
+ groupId: number | string;
64
+ }) => {
65
+ error: import("../../../types").FailedResponse | null;
66
+ status: "success" | "error";
67
+ isError: boolean;
68
+ isPending: false;
69
+ isLoading: false;
70
+ isLoadingError: false;
71
+ isRefetchError: boolean;
72
+ isSuccess: boolean;
73
+ dataUpdatedAt: number;
74
+ errorUpdatedAt: number;
75
+ failureCount: number;
76
+ failureReason: import("../../../types").FailedResponse | null;
77
+ errorUpdateCount: number;
78
+ isFetched: boolean;
79
+ isFetchedAfterMount: boolean;
80
+ isFetching: boolean;
81
+ isInitialLoading: boolean;
82
+ isPaused: boolean;
83
+ isRefetching: boolean;
84
+ isStale: boolean;
85
+ refetch: (options?: import("@tanstack/react-query").RefetchOptions) => Promise<import("@tanstack/react-query").QueryObserverResult<ApiResource<GroupResourceWithMembership>, import("../../../types").FailedResponse>>;
86
+ fetchStatus: import("@tanstack/react-query").FetchStatus;
87
+ data: GroupResourceWithMembership;
88
+ links: Record<string, string>;
89
+ meta: Record<string, unknown>;
90
+ };
91
+ export declare const useGroupMembershipUpdate: ({ groupId }: {
92
+ groupId: number | string;
93
+ }) => import("@tanstack/react-query").UseMutationResult<ApiResource<GroupMembership>, Error, string, void>;
94
+ //# sourceMappingURL=groups.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"groups.d.ts","sourceRoot":"","sources":["../../../../src/screens/notification_settings/hooks/groups.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAA;AAC5C,OAAO,EAAE,eAAe,EAAE,2BAA2B,EAAE,MAAM,0BAA0B,CAAA;AAGvF,eAAO,MAAM,oBAAoB;;;;;;;;;;;;CAY/B,CAAA;AAEF,eAAO,MAAM,mBAAmB,gBAAiB;IAAE,OAAO,EAAE,MAAM,GAAG,MAAM,CAAA;CAAE;;;;;;;;;CAS3E,CAAA;AAEF,eAAO,MAAM,SAAS;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAIrB,CAAA;AAED,eAAO,MAAM,QAAQ,gBAAiB;IAAE,OAAO,EAAE,MAAM,GAAG,MAAM,CAAA;CAAE;;;;;;;;;;;;;;;;;;;;;;;;;;CAIjE,CAAA;AAED,eAAO,MAAM,wBAAwB,gBAAiB;IAAE,OAAO,EAAE,MAAM,GAAG,MAAM,CAAA;CAAE,yGAwDjF,CAAA"}
@@ -0,0 +1,92 @@
1
+ import { useMutation, useQueryClient } from '@tanstack/react-query';
2
+ import { getRequestQueryKey, useApiClient } from '../../../hooks';
3
+ import { useSuspenseGet, useSuspensePaginator } from '../../../hooks';
4
+ import { throwResponseError } from '../../../utils/response_error';
5
+ export const getGroupsRequestArgs = () => ({
6
+ url: '/me/groups',
7
+ data: {
8
+ perPage: 100,
9
+ include: ['my_group_membership'],
10
+ filter: 'user_settable_notification_level',
11
+ fields: {
12
+ Group: [],
13
+ GroupMembership: ['notification_level', 'notification_level_description'],
14
+ },
15
+ order: 'name',
16
+ },
17
+ });
18
+ export const getGroupRequestArgs = ({ groupId }) => ({
19
+ url: `/me/groups/${groupId}`,
20
+ data: {
21
+ include: ['my_group_membership'],
22
+ fields: {
23
+ Group: ['name', 'source_app_name', 'source_type', 'my_group_membership'],
24
+ GroupMembership: ['notification_level', 'notification_level_description'],
25
+ },
26
+ },
27
+ });
28
+ export const useGroups = () => {
29
+ const args = getGroupsRequestArgs();
30
+ return useSuspensePaginator(args);
31
+ };
32
+ export const useGroup = ({ groupId }) => {
33
+ const args = getGroupRequestArgs({ groupId });
34
+ return useSuspenseGet(args);
35
+ };
36
+ export const useGroupMembershipUpdate = ({ groupId }) => {
37
+ const apiClient = useApiClient();
38
+ const queryClient = useQueryClient();
39
+ const requestArgs = getGroupRequestArgs({ groupId });
40
+ const queryKey = getRequestQueryKey(requestArgs);
41
+ return useMutation({
42
+ throwOnError: true,
43
+ onMutate: notificationLevel => {
44
+ queryClient.setQueryData(queryKey, groupData => {
45
+ if (!groupData?.data.myGroupMembership)
46
+ return groupData;
47
+ return {
48
+ ...groupData,
49
+ data: {
50
+ ...groupData.data,
51
+ myGroupMembership: {
52
+ ...groupData.data.myGroupMembership,
53
+ notificationLevel,
54
+ },
55
+ },
56
+ };
57
+ });
58
+ },
59
+ onSuccess: response => {
60
+ queryClient.setQueryData(queryKey, groupData => {
61
+ if (!groupData?.data.myGroupMembership)
62
+ return groupData;
63
+ return {
64
+ ...groupData,
65
+ data: {
66
+ ...groupData.data,
67
+ myGroupMembership: {
68
+ ...groupData.data.myGroupMembership,
69
+ ...response.data,
70
+ },
71
+ },
72
+ };
73
+ });
74
+ },
75
+ mutationFn: (notificationLevel) => {
76
+ return apiClient.chat
77
+ .patch({
78
+ url: `/me/groups/${groupId}/my_group_membership`,
79
+ data: {
80
+ data: {
81
+ type: 'GroupMembership',
82
+ attributes: {
83
+ notification_level: notificationLevel,
84
+ },
85
+ },
86
+ },
87
+ })
88
+ .catch(throwResponseError);
89
+ },
90
+ });
91
+ };
92
+ //# sourceMappingURL=groups.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"groups.js","sourceRoot":"","sources":["../../../../src/screens/notification_settings/hooks/groups.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAA;AACnE,OAAO,EAAE,kBAAkB,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAA;AACjE,OAAO,EAAE,cAAc,EAAE,oBAAoB,EAAE,MAAM,gBAAgB,CAAA;AAGrE,OAAO,EAAE,kBAAkB,EAAE,MAAM,+BAA+B,CAAA;AAElE,MAAM,CAAC,MAAM,oBAAoB,GAAG,GAAG,EAAE,CAAC,CAAC;IACzC,GAAG,EAAE,YAAY;IACjB,IAAI,EAAE;QACJ,OAAO,EAAE,GAAG;QACZ,OAAO,EAAE,CAAC,qBAAqB,CAAC;QAChC,MAAM,EAAE,kCAAkC;QAC1C,MAAM,EAAE;YACN,KAAK,EAAE,EAAE;YACT,eAAe,EAAE,CAAC,oBAAoB,EAAE,gCAAgC,CAAC;SAC1E;QACD,KAAK,EAAE,MAAM;KACd;CACF,CAAC,CAAA;AAEF,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAC,EAAE,OAAO,EAAgC,EAAE,EAAE,CAAC,CAAC;IACjF,GAAG,EAAE,cAAc,OAAO,EAAE;IAC5B,IAAI,EAAE;QACJ,OAAO,EAAE,CAAC,qBAAqB,CAAC;QAChC,MAAM,EAAE;YACN,KAAK,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,CAAA;QACJ,CAAC;QACD,SAAS,EAAE,QAAQ,CAAC,EAAE;YACpB,WAAW,CAAC,YAAY,CAA2C,QAAQ,EAAE,SAAS,CAAC,EAAE;gBACvF,IAAI,CAAC,SAAS,EAAE,IAAI,CAAC,iBAAiB;oBAAE,OAAO,SAAS,CAAA;gBAExD,OAAO;oBACL,GAAG,SAAS;oBACZ,IAAI,EAAE;wBACJ,GAAG,SAAS,CAAC,IAAI;wBACjB,iBAAiB,EAAE;4BACjB,GAAG,SAAS,CAAC,IAAI,CAAC,iBAAiB;4BACnC,GAAG,QAAQ,CAAC,IAAI;yBACjB;qBACF;iBACF,CAAA;YACH,CAAC,CAAC,CAAA;QACJ,CAAC;QACD,UAAU,EAAE,CAAC,iBAAyB,EAAE,EAAE;YACxC,OAAO,SAAS,CAAC,IAAI;iBAClB,KAAK,CAA+B;gBACnC,GAAG,EAAE,cAAc,OAAO,sBAAsB;gBAChD,IAAI,EAAE;oBACJ,IAAI,EAAE;wBACJ,IAAI,EAAE,iBAAiB;wBACvB,UAAU,EAAE;4BACV,kBAAkB,EAAE,iBAAiB;yBACtC;qBACF;iBACF;aACF,CAAC;iBACD,KAAK,CAAC,kBAAkB,CAAC,CAAA;QAC9B,CAAC;KACF,CAAC,CAAA;AACJ,CAAC,CAAA","sourcesContent":["import { useMutation, useQueryClient } from '@tanstack/react-query'\nimport { getRequestQueryKey, useApiClient } from '../../../hooks'\nimport { useSuspenseGet, useSuspensePaginator } from '../../../hooks'\nimport { ApiResource } from '../../../types'\nimport { GroupMembership, GroupResourceWithMembership } from '../../../types/resources'\nimport { throwResponseError } from '../../../utils/response_error'\n\nexport const getGroupsRequestArgs = () => ({\n url: '/me/groups',\n data: {\n perPage: 100,\n include: ['my_group_membership'],\n filter: 'user_settable_notification_level',\n fields: {\n Group: [],\n GroupMembership: ['notification_level', 'notification_level_description'],\n },\n order: 'name',\n },\n})\n\nexport const getGroupRequestArgs = ({ groupId }: { groupId: number | string }) => ({\n url: `/me/groups/${groupId}`,\n data: {\n include: ['my_group_membership'],\n fields: {\n Group: ['name', 'source_app_name', 'source_type', 'my_group_membership'],\n GroupMembership: ['notification_level', 'notification_level_description'],\n },\n },\n})\n\nexport const useGroups = () => {\n const args = getGroupsRequestArgs()\n\n return useSuspensePaginator<GroupResourceWithMembership>(args)\n}\n\nexport const useGroup = ({ groupId }: { groupId: number | string }) => {\n const args = getGroupRequestArgs({ groupId })\n\n return useSuspenseGet<GroupResourceWithMembership>(args)\n}\n\nexport const useGroupMembershipUpdate = ({ groupId }: { groupId: number | string }) => {\n const apiClient = useApiClient()\n const queryClient = useQueryClient()\n const requestArgs = getGroupRequestArgs({ groupId })\n const queryKey = getRequestQueryKey(requestArgs)\n\n return useMutation({\n throwOnError: true,\n onMutate: notificationLevel => {\n queryClient.setQueryData<ApiResource<GroupResourceWithMembership>>(queryKey, groupData => {\n if (!groupData?.data.myGroupMembership) return groupData\n\n return {\n ...groupData,\n data: {\n ...groupData.data,\n myGroupMembership: {\n ...groupData.data.myGroupMembership,\n notificationLevel,\n },\n },\n }\n })\n },\n onSuccess: response => {\n queryClient.setQueryData<ApiResource<GroupResourceWithMembership>>(queryKey, groupData => {\n if (!groupData?.data.myGroupMembership) return groupData\n\n return {\n ...groupData,\n data: {\n ...groupData.data,\n myGroupMembership: {\n ...groupData.data.myGroupMembership,\n ...response.data,\n },\n },\n }\n })\n },\n mutationFn: (notificationLevel: string) => {\n return apiClient.chat\n .patch<ApiResource<GroupMembership>>({\n url: `/me/groups/${groupId}/my_group_membership`,\n data: {\n data: {\n type: 'GroupMembership',\n attributes: {\n notification_level: notificationLevel,\n },\n },\n },\n })\n .catch(throwResponseError)\n },\n })\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"notification_settings_screen.d.ts","sourceRoot":"","sources":["../../src/screens/notification_settings_screen.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,iBAAiB,EAAiB,MAAM,0BAA0B,CAAA;AAE3E,OAAO,KAAiD,MAAM,OAAO,CAAA;AA8CrE,MAAM,MAAM,+BAA+B,GAAG,iBAAiB,CAAC,EAAE,CAAC,CAAA;AAEnE,wBAAgB,0BAA0B,CAAC,EAAE,EAAE,+BAA+B,qBAiJ7E"}
1
+ {"version":3,"file":"notification_settings_screen.d.ts","sourceRoot":"","sources":["../../src/screens/notification_settings_screen.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,iBAAiB,EAAiB,MAAM,0BAA0B,CAAA;AAE3E,OAAO,KAAiD,MAAM,OAAO,CAAA;AAiDrE,MAAM,MAAM,+BAA+B,GAAG,iBAAiB,CAAC,EAAE,CAAC,CAAA;AAEnE,wBAAgB,0BAA0B,CAAC,EAAE,EAAE,+BAA+B,qBAiK7E"}
@@ -2,10 +2,11 @@ import { PlatformPressable } from '@react-navigation/elements';
2
2
  import { useNavigation } from '@react-navigation/native';
3
3
  import React, { useCallback, useEffect } from 'react';
4
4
  import { FlatList, Platform, StyleSheet, View } from 'react-native';
5
- import { Heading, Icon, Text } from '../components';
5
+ import { Badge, Heading, Icon, Text } from '../components';
6
6
  import { HeaderTextButton } from '../components/display/platform_modal_header_buttons';
7
7
  import { useTheme } from '../hooks';
8
8
  import { isDefined } from '../types';
9
+ import { useGroups } from './notification_settings/hooks/groups';
9
10
  import { useChatTypes } from './preferred_app/hooks/use_chat_types';
10
11
  var SectionTypes;
11
12
  (function (SectionTypes) {
@@ -19,6 +20,7 @@ export function NotificationSettingsScreen({}) {
19
20
  const navigation = useNavigation();
20
21
  const styles = useStyles();
21
22
  const { data: chatTypes } = useChatTypes();
23
+ const { data: groups } = useGroups();
22
24
  // Header configuration
23
25
  const HeaderRight = useCallback(() => {
24
26
  return (<HeaderTextButton onPress={() => {
@@ -41,7 +43,7 @@ export function NotificationSettingsScreen({}) {
41
43
  {
42
44
  type: SectionTypes.view,
43
45
  data: {
44
- children: (<Text variant="footnote" style={styles.sectionDescription}>
46
+ children: (<Text variant="tertiary" style={styles.sectionDescription}>
45
47
  Choose which app receives each type of chat notification
46
48
  </Text>),
47
49
  },
@@ -51,31 +53,43 @@ export function NotificationSettingsScreen({}) {
51
53
  type: SectionTypes.link,
52
54
  data: {
53
55
  title: `${type.title} Conversations`,
54
- subtitle: type.preferredApp,
56
+ rightLabel: type.preferredApp,
55
57
  onPress: () => navigation.navigate('PreferredAppSelection', {
56
58
  chatTypeId: type.id,
57
59
  }),
58
60
  },
61
+ sectionInnerStyle: { paddingVertical: 0 },
62
+ showBottomBorder: true,
63
+ })),
64
+ {
65
+ type: SectionTypes.header,
66
+ data: {
67
+ title: 'Manage chat settings',
68
+ },
69
+ sectionInnerStyle: styles.sectionInnerHeader,
70
+ },
71
+ {
72
+ type: SectionTypes.view,
73
+ data: {
74
+ children: (<Text variant="tertiary" style={styles.sectionDescription}>
75
+ Notification settings for all of your group, team and event related conversations
76
+ </Text>),
77
+ },
78
+ showBottomBorder: true,
79
+ },
80
+ ...groups.map(group => ({
81
+ type: SectionTypes.link,
82
+ data: {
83
+ title: group.name,
84
+ rightLabel: group.sourceType,
85
+ onPress: () => navigation.navigate('GroupNotificationSettings', {
86
+ groupId: group.id,
87
+ title: group.name || 'Group',
88
+ }),
89
+ },
90
+ sectionInnerStyle: { paddingVertical: 0 },
59
91
  showBottomBorder: true,
60
92
  })),
61
- // {
62
- // type: SectionTypes.header,
63
- // data: {
64
- // title: 'Manage chat settings',
65
- // },
66
- // sectionInnerStyle: styles.sectionInnerHeader,
67
- // },
68
- // {
69
- // type: SectionTypes.view,
70
- // data: {
71
- // children: (
72
- // <Text variant="footnote" style={styles.sectionDescription}>
73
- // Notification settings for all of your group, team and event related conversations
74
- // </Text>
75
- // ),
76
- // },
77
- // showBottomBorder: true,
78
- // },
79
93
  ].filter(item => item.type !== SectionTypes.hidden);
80
94
  const headerIndices = listData
81
95
  .map(({ type }, index) => (type === SectionTypes.header ? index : undefined))
@@ -89,7 +103,7 @@ export function NotificationSettingsScreen({}) {
89
103
  switch (item.type) {
90
104
  case SectionTypes.header:
91
105
  return (<ListSection isStart={isStart} isEnd={isEnd} showBottomBorder={item?.showBottomBorder} outerStyle={item?.sectionOuterStyle} innerStyle={item?.sectionInnerStyle}>
92
- <Heading variant="h3">{item.data.title}</Heading>
106
+ <Heading variant="h2">{item.data.title}</Heading>
93
107
  </ListSection>);
94
108
  case SectionTypes.setting:
95
109
  return (<ListSection isStart={isStart} isEnd={isEnd} showBottomBorder={item?.showBottomBorder} outerStyle={item?.sectionOuterStyle} innerStyle={item?.sectionInnerStyle}>
@@ -116,27 +130,30 @@ function ListSection({ isStart, isEnd, showBottomBorder, outerStyle, innerStyle,
116
130
  <View style={[styles.sectionInnerBase, bottomBorder, innerStyle]}>{children}</View>
117
131
  </View>);
118
132
  }
119
- function SettingRow({ title, style, subtitle, rightItem, rightItemStyle = {} }) {
133
+ function SettingRow({ title, style, rightLabel, rightItem, rightItemStyle = {} }) {
120
134
  const styles = useStyles();
121
135
  return (<View style={[styles.settingRow, style]}>
122
136
  <View style={styles.settingRowContent}>
123
137
  <Text variant="plain" style={styles.settingRowText}>
124
138
  {title}
125
139
  </Text>
126
- {Boolean(subtitle) && <Text variant="footnote">{subtitle}</Text>}
140
+ {Boolean(rightLabel) && <Text variant="footnote">{rightLabel}</Text>}
127
141
  </View>
128
142
  {Boolean(rightItem) && <View style={rightItemStyle}>{rightItem}</View>}
129
143
  </View>);
130
144
  }
131
- function LinkRow({ title, subtitle, onPress }) {
145
+ function LinkRow({ title, rightLabel, onPress }) {
132
146
  const styles = useLinkRowStyles();
147
+ const isSourceType = rightLabel === 'Team' || rightLabel === 'Group' || rightLabel === 'PlanTeam';
133
148
  return (<PlatformPressable style={styles.row} onPress={onPress} accessibilityRole="link" accessibilityLabel={title} accessibilityHint={`Navigate to ${title} settings`}>
134
149
  <View style={styles.innerContainer}>
135
150
  <Text style={styles.title} numberOfLines={2}>
136
151
  {title}
137
152
  </Text>
138
153
  <View style={styles.rightContent}>
139
- <Text numberOfLines={1}>{subtitle}</Text>
154
+ {isSourceType ? (<Badge label={rightLabel} appearance="neutral" variant="meta"/>) : (<Text numberOfLines={1} style={styles.rightLabelText}>
155
+ {rightLabel}
156
+ </Text>)}
140
157
  {Platform.OS === 'ios' && (<Icon name="general.rightChevron" size={16} style={styles.icon}/>)}
141
158
  </View>
142
159
  </View>
@@ -145,23 +162,20 @@ function LinkRow({ title, subtitle, onPress }) {
145
162
  // =================================
146
163
  // ====== Styles ===================
147
164
  // =================================
148
- const useStyles = ({ isStart, isEnd } = {}) => {
165
+ const useStyles = ({} = {}) => {
149
166
  const { colors } = useTheme();
150
167
  const headerBottomPadding = 0;
151
168
  return StyleSheet.create({
152
169
  listContainer: {
153
170
  flex: 1,
154
- backgroundColor: colors.surfaceColor080,
155
171
  },
156
172
  contentContainer: {},
157
173
  sectionOuterBase: {
158
174
  paddingLeft: 16,
159
- backgroundColor: colors.surfaceColor100,
160
175
  },
161
176
  sectionInnerBase: {
162
177
  paddingRight: 16,
163
- paddingTop: isStart ? 16 : 12,
164
- paddingBottom: isEnd ? 16 : 12,
178
+ paddingVertical: 16,
165
179
  },
166
180
  sectionInnerHeader: {
167
181
  paddingBottom: headerBottomPadding,
@@ -192,13 +206,13 @@ const useLinkRowStyles = () => {
192
206
  return StyleSheet.create({
193
207
  row: {
194
208
  paddingLeft: 0,
209
+ paddingVertical: 16,
195
210
  },
196
211
  innerContainer: {
197
212
  flexDirection: 'row',
198
213
  alignItems: 'center',
199
214
  justifyContent: 'space-between',
200
215
  gap: 12,
201
- paddingVertical: 4,
202
216
  },
203
217
  rightContent: {
204
218
  flexDirection: 'row',
@@ -207,6 +221,10 @@ const useLinkRowStyles = () => {
207
221
  },
208
222
  title: {
209
223
  flexShrink: 1,
224
+ alignSelf: 'center',
225
+ },
226
+ rightLabelText: {
227
+ color: theme.colors.textColorDefaultSecondary,
210
228
  },
211
229
  icon: {
212
230
  color: theme.colors.iconColorDefaultDisabled,
@@ -1 +1 @@
1
- {"version":3,"file":"notification_settings_screen.js","sourceRoot":"","sources":["../../src/screens/notification_settings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AAM,gBAAgB,GAAG,GAAG,EAAE;IAC5B,MAAM,KAAK,GAAG,QAAQ,EAAE,CAAA;IAExB,OAAO,UAAU,CAAC,MAAM,CAAC;QACvB,GAAG,EAAE;YACH,WAAW,EAAE,CAAC;SACf;QACD,cAAc,EAAE;YACd,aAAa,EAAE,KAAK;YACpB,UAAU,EAAE,QAAQ;YACpB,cAAc,EAAE,eAAe;YAC/B,GAAG,EAAE,EAAE;YACP,eAAe,EAAE,CAAC;SACnB;QACD,YAAY,EAAE;YACZ,aAAa,EAAE,KAAK;YACpB,UAAU,EAAE,QAAQ;YACpB,GAAG,EAAE,CAAC;SACP;QACD,KAAK,EAAE;YACL,UAAU,EAAE,CAAC;SACd;QACD,IAAI,EAAE;YACJ,KAAK,EAAE,KAAK,CAAC,MAAM,CAAC,wBAAwB;SAC7C;KACF,CAAC,CAAA;AACJ,CAAC,CAAA","sourcesContent":["import { PlatformPressable } from '@react-navigation/elements'\nimport { StaticScreenProps, useNavigation } from '@react-navigation/native'\nimport type { NativeStackNavigationProp } from '@react-navigation/native-stack'\nimport React, { useCallback, useEffect, type ReactNode } from 'react'\nimport { FlatList, Platform, StyleSheet, View, type ViewProps, type ViewStyle } from 'react-native'\nimport { Heading, Icon, Text } from '../components'\nimport { HeaderTextButton } from '../components/display/platform_modal_header_buttons'\nimport { useTheme } from '../hooks'\nimport { isDefined } from '../types'\nimport { useChatTypes } from './preferred_app/hooks/use_chat_types'\nimport type { PreferredAppSelectionScreenProps } from './preferred_app_selection_screen'\n\n// =========================================\n// ====== Factory Constants & Types ========\n// =========================================\n\ntype NotificationSettingsStackParamList = {\n NotificationSettings: {}\n PreferredAppSelection: PreferredAppSelectionScreenProps['route']['params']\n}\n\nenum SectionTypes {\n header,\n hidden,\n setting,\n view,\n link,\n}\n\ntype SectionListData = Array<\n | DataItem<{ title: string }, SectionTypes.header>\n | DataItem<ViewProps, SectionTypes.view>\n | DataItem<SettingRowProps, SectionTypes.setting>\n | DataItem<LinkRowProps, SectionTypes.link>\n | DataItem<any, SectionTypes.hidden>\n>\n\ninterface DataItem<T, TName extends SectionTypes> {\n type: TName\n data: T\n sectionOuterStyle?: ViewStyle\n sectionInnerStyle?: ViewStyle\n showBottomBorder?: boolean\n}\n\n// =================================\n// ====== Components ===============\n// =================================\n\nexport type NotificationSettingsScreenProps = StaticScreenProps<{}>\n\nexport function NotificationSettingsScreen({}: NotificationSettingsScreenProps) {\n const navigation = useNavigation<NativeStackNavigationProp<NotificationSettingsStackParamList>>()\n const styles = useStyles()\n const { data: chatTypes } = useChatTypes()\n\n // Header configuration\n const HeaderRight = useCallback(() => {\n return (\n <HeaderTextButton\n onPress={() => {\n // Save settings logic would go here\n navigation.goBack()\n }}\n title=\"Done\"\n />\n )\n }, [navigation])\n\n useEffect(() => {\n navigation.setOptions({\n headerRight: HeaderRight,\n })\n }, [HeaderRight, navigation])\n\n // Build section data\n const listData = [\n {\n type: SectionTypes.header,\n data: { title: 'Preferred app' },\n sectionInnerStyle: styles.sectionInnerHeader,\n },\n {\n type: SectionTypes.view,\n data: {\n children: (\n <Text variant=\"footnote\" style={styles.sectionDescription}>\n Choose which app receives each type of chat notification\n </Text>\n ),\n },\n showBottomBorder: true,\n },\n ...chatTypes.map(type => ({\n type: SectionTypes.link,\n data: {\n title: `${type.title} Conversations`,\n subtitle: type.preferredApp,\n onPress: () =>\n navigation.navigate('PreferredAppSelection', {\n chatTypeId: type.id,\n }),\n },\n showBottomBorder: true,\n })),\n // {\n // type: SectionTypes.header,\n // data: {\n // title: 'Manage chat settings',\n // },\n // sectionInnerStyle: styles.sectionInnerHeader,\n // },\n // {\n // type: SectionTypes.view,\n // data: {\n // children: (\n // <Text variant=\"footnote\" style={styles.sectionDescription}>\n // Notification settings for all of your group, team and event related conversations\n // </Text>\n // ),\n // },\n // showBottomBorder: true,\n // },\n ].filter(item => item.type !== SectionTypes.hidden)\n\n const headerIndices = listData\n .map(({ type }, index) => (type === SectionTypes.header ? index : undefined))\n .filter(isDefined)\n\n return (\n <View style={styles.listContainer}>\n <FlatList\n data={listData as SectionListData}\n contentContainerStyle={styles.contentContainer}\n renderItem={({ item, index }) => {\n const [isStart, isEnd] = [\n index === 0 || headerIndices.includes(index),\n index === listData.length - 1 || headerIndices.includes(index + 1),\n ]\n\n switch (item.type) {\n case SectionTypes.header:\n return (\n <ListSection\n isStart={isStart}\n isEnd={isEnd}\n showBottomBorder={item?.showBottomBorder}\n outerStyle={item?.sectionOuterStyle}\n innerStyle={item?.sectionInnerStyle}\n >\n <Heading variant=\"h3\">{item.data.title}</Heading>\n </ListSection>\n )\n case SectionTypes.setting:\n return (\n <ListSection\n isStart={isStart}\n isEnd={isEnd}\n showBottomBorder={item?.showBottomBorder}\n outerStyle={item?.sectionOuterStyle}\n innerStyle={item?.sectionInnerStyle}\n >\n <SettingRow {...item.data} />\n </ListSection>\n )\n case SectionTypes.view:\n return (\n <ListSection\n isStart={isStart}\n isEnd={isEnd}\n showBottomBorder={item?.showBottomBorder}\n outerStyle={item?.sectionOuterStyle}\n innerStyle={item?.sectionInnerStyle}\n >\n <View {...item.data} style={item.data.style} />\n </ListSection>\n )\n case SectionTypes.link:\n return (\n <ListSection\n isStart={isStart}\n isEnd={isEnd}\n showBottomBorder={item?.showBottomBorder}\n outerStyle={item?.sectionOuterStyle}\n innerStyle={item?.sectionInnerStyle}\n >\n <LinkRow {...item.data} />\n </ListSection>\n )\n default:\n return null\n }\n }}\n />\n </View>\n )\n}\n\ninterface ListSectionProps {\n isStart?: boolean\n isEnd?: boolean\n showBottomBorder?: boolean\n outerStyle?: ViewStyle\n innerStyle?: ViewStyle\n children: ReactNode\n}\n\nfunction ListSection({\n isStart,\n isEnd,\n showBottomBorder,\n outerStyle,\n innerStyle,\n children,\n}: ListSectionProps) {\n const styles = useStyles({ isStart, isEnd })\n const bottomBorder = showBottomBorder ? styles.sectionInnerBottomBorder : {}\n\n return (\n <View style={[styles.sectionOuterBase, outerStyle]}>\n <View style={[styles.sectionInnerBase, bottomBorder, innerStyle]}>{children}</View>\n </View>\n )\n}\n\ninterface SettingRowProps {\n title: string\n style?: ViewStyle\n rightItem?: ReactNode\n subtitle?: string\n rightItemStyle?: ViewStyle\n}\n\nfunction SettingRow({ title, style, subtitle, rightItem, rightItemStyle = {} }: SettingRowProps) {\n const styles = useStyles()\n\n return (\n <View style={[styles.settingRow, style]}>\n <View style={styles.settingRowContent}>\n <Text variant=\"plain\" style={styles.settingRowText}>\n {title}\n </Text>\n {Boolean(subtitle) && <Text variant=\"footnote\">{subtitle}</Text>}\n </View>\n {Boolean(rightItem) && <View style={rightItemStyle}>{rightItem}</View>}\n </View>\n )\n}\n\ninterface LinkRowProps {\n title: string\n subtitle: string\n onPress: () => void\n}\n\nfunction LinkRow({ title, subtitle, onPress }: LinkRowProps) {\n const styles = useLinkRowStyles()\n\n return (\n <PlatformPressable\n style={styles.row}\n onPress={onPress}\n accessibilityRole=\"link\"\n accessibilityLabel={title}\n accessibilityHint={`Navigate to ${title} settings`}\n >\n <View style={styles.innerContainer}>\n <Text style={styles.title} numberOfLines={2}>\n {title}\n </Text>\n <View style={styles.rightContent}>\n <Text numberOfLines={1}>{subtitle}</Text>\n {Platform.OS === 'ios' && (\n <Icon name=\"general.rightChevron\" size={16} style={styles.icon} />\n )}\n </View>\n </View>\n </PlatformPressable>\n )\n}\n\n// =================================\n// ====== Styles ===================\n// =================================\n\nconst useStyles = ({ isStart, isEnd }: { isStart?: boolean; isEnd?: boolean } = {}) => {\n const { colors } = useTheme()\n const headerBottomPadding = 0\n\n return StyleSheet.create({\n listContainer: {\n flex: 1,\n backgroundColor: colors.surfaceColor080,\n },\n contentContainer: {},\n sectionOuterBase: {\n paddingLeft: 16,\n backgroundColor: colors.surfaceColor100,\n },\n sectionInnerBase: {\n paddingRight: 16,\n paddingTop: isStart ? 16 : 12,\n paddingBottom: isEnd ? 16 : 12,\n },\n sectionInnerHeader: {\n paddingBottom: headerBottomPadding,\n },\n sectionInnerBottomBorder: {\n borderBottomColor: colors.borderColorDefaultBase,\n borderBottomWidth: 1,\n },\n sectionDescription: {\n color: colors.textColorDefaultSecondary,\n },\n settingRow: {\n flexDirection: 'row',\n justifyContent: 'space-between',\n alignItems: 'center',\n gap: 8,\n },\n settingRowContent: {\n flex: 1,\n },\n settingRowText: {\n lineHeight: 20,\n },\n })\n}\n\nconst useLinkRowStyles = () => {\n const theme = useTheme()\n\n return StyleSheet.create({\n row: {\n paddingLeft: 0,\n },\n innerContainer: {\n flexDirection: 'row',\n alignItems: 'center',\n justifyContent: 'space-between',\n gap: 12,\n paddingVertical: 4,\n },\n rightContent: {\n flexDirection: 'row',\n alignItems: 'center',\n gap: 8,\n },\n title: {\n flexShrink: 1,\n },\n icon: {\n color: theme.colors.iconColorDefaultDisabled,\n },\n })\n}\n"]}
1
+ {"version":3,"file":"notification_settings_screen.js","sourceRoot":"","sources":["../../src/screens/notification_settings_screen.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAA;AAC9D,OAAO,EAAqB,aAAa,EAAE,MAAM,0BAA0B,CAAA;AAE3E,OAAO,KAAK,EAAE,EAAE,WAAW,EAAE,SAAS,EAAkB,MAAM,OAAO,CAAA;AACrE,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,UAAU,EAAE,IAAI,EAAkC,MAAM,cAAc,CAAA;AACnG,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,eAAe,CAAA;AAC1D,OAAO,EAAE,gBAAgB,EAAE,MAAM,qDAAqD,CAAA;AACtF,OAAO,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAA;AACnC,OAAO,EAAE,SAAS,EAAE,MAAM,UAAU,CAAA;AAEpC,OAAO,EAAE,SAAS,EAAE,MAAM,sCAAsC,CAAA;AAChE,OAAO,EAAE,YAAY,EAAE,MAAM,sCAAsC,CAAA;AAanE,IAAK,YAMJ;AAND,WAAK,YAAY;IACf,mDAAM,CAAA;IACN,mD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;YACpB,cAAc,EAAE,eAAe;YAC/B,UAAU,EAAE,QAAQ;YACpB,GAAG,EAAE,CAAC;SACP;QACD,iBAAiB,EAAE;YACjB,IAAI,EAAE,CAAC;SACR;QACD,cAAc,EAAE;YACd,UAAU,EAAE,EAAE;SACf;KACF,CAAC,CAAA;AACJ,CAAC,CAAA;AAED,MAAM,gBAAgB,GAAG,GAAG,EAAE;IAC5B,MAAM,KAAK,GAAG,QAAQ,EAAE,CAAA;IAExB,OAAO,UAAU,CAAC,MAAM,CAAC;QACvB,GAAG,EAAE;YACH,WAAW,EAAE,CAAC;YACd,eAAe,EAAE,EAAE;SACpB;QACD,cAAc,EAAE;YACd,aAAa,EAAE,KAAK;YACpB,UAAU,EAAE,QAAQ;YACpB,cAAc,EAAE,eAAe;YAC/B,GAAG,EAAE,EAAE;SACR;QACD,YAAY,EAAE;YACZ,aAAa,EAAE,KAAK;YACpB,UAAU,EAAE,QAAQ;YACpB,GAAG,EAAE,CAAC;SACP;QACD,KAAK,EAAE;YACL,UAAU,EAAE,CAAC;YACb,SAAS,EAAE,QAAQ;SACpB;QACD,cAAc,EAAE;YACd,KAAK,EAAE,KAAK,CAAC,MAAM,CAAC,yBAAyB;SAC9C;QACD,IAAI,EAAE;YACJ,KAAK,EAAE,KAAK,CAAC,MAAM,CAAC,wBAAwB;SAC7C;KACF,CAAC,CAAA;AACJ,CAAC,CAAA","sourcesContent":["import { PlatformPressable } from '@react-navigation/elements'\nimport { StaticScreenProps, useNavigation } from '@react-navigation/native'\nimport type { NativeStackNavigationProp } from '@react-navigation/native-stack'\nimport React, { useCallback, useEffect, type ReactNode } from 'react'\nimport { FlatList, Platform, StyleSheet, View, type ViewProps, type ViewStyle } from 'react-native'\nimport { Badge, Heading, Icon, Text } from '../components'\nimport { HeaderTextButton } from '../components/display/platform_modal_header_buttons'\nimport { useTheme } from '../hooks'\nimport { isDefined } from '../types'\nimport type { GroupNotificationSettingsScreenProps } from './group_notification_settings_screen'\nimport { useGroups } from './notification_settings/hooks/groups'\nimport { useChatTypes } from './preferred_app/hooks/use_chat_types'\nimport type { PreferredAppSelectionScreenProps } from './preferred_app_selection_screen'\n\n// =========================================\n// ====== Factory Constants & Types ========\n// =========================================\n\ntype NotificationSettingsStackParamList = {\n NotificationSettings: {}\n PreferredAppSelection: PreferredAppSelectionScreenProps['route']['params']\n GroupNotificationSettings: GroupNotificationSettingsScreenProps['route']['params']\n}\n\nenum SectionTypes {\n header,\n hidden,\n setting,\n view,\n link,\n}\n\ntype SectionListData = Array<\n | DataItem<{ title: string }, SectionTypes.header>\n | DataItem<ViewProps, SectionTypes.view>\n | DataItem<SettingRowProps, SectionTypes.setting>\n | DataItem<LinkRowProps, SectionTypes.link>\n | DataItem<any, SectionTypes.hidden>\n>\n\ninterface DataItem<T, TName extends SectionTypes> {\n type: TName\n data: T\n sectionOuterStyle?: ViewStyle\n sectionInnerStyle?: ViewStyle\n showBottomBorder?: boolean\n}\n\n// =================================\n// ====== Components ===============\n// =================================\n\nexport type NotificationSettingsScreenProps = StaticScreenProps<{}>\n\nexport function NotificationSettingsScreen({}: NotificationSettingsScreenProps) {\n const navigation = useNavigation<NativeStackNavigationProp<NotificationSettingsStackParamList>>()\n const styles = useStyles()\n const { data: chatTypes } = useChatTypes()\n const { data: groups } = useGroups()\n\n // Header configuration\n const HeaderRight = useCallback(() => {\n return (\n <HeaderTextButton\n onPress={() => {\n // Save settings logic would go here\n navigation.goBack()\n }}\n title=\"Done\"\n />\n )\n }, [navigation])\n\n useEffect(() => {\n navigation.setOptions({\n headerRight: HeaderRight,\n })\n }, [HeaderRight, navigation])\n\n // Build section data\n const listData = [\n {\n type: SectionTypes.header,\n data: { title: 'Preferred app' },\n sectionInnerStyle: styles.sectionInnerHeader,\n },\n {\n type: SectionTypes.view,\n data: {\n children: (\n <Text variant=\"tertiary\" style={styles.sectionDescription}>\n Choose which app receives each type of chat notification\n </Text>\n ),\n },\n showBottomBorder: true,\n },\n ...chatTypes.map(type => ({\n type: SectionTypes.link,\n data: {\n title: `${type.title} Conversations`,\n rightLabel: type.preferredApp,\n onPress: () =>\n navigation.navigate('PreferredAppSelection', {\n chatTypeId: type.id,\n }),\n },\n sectionInnerStyle: { paddingVertical: 0 },\n showBottomBorder: true,\n })),\n {\n type: SectionTypes.header,\n data: {\n title: 'Manage chat settings',\n },\n sectionInnerStyle: styles.sectionInnerHeader,\n },\n {\n type: SectionTypes.view,\n data: {\n children: (\n <Text variant=\"tertiary\" style={styles.sectionDescription}>\n Notification settings for all of your group, team and event related conversations\n </Text>\n ),\n },\n showBottomBorder: true,\n },\n ...groups.map(group => ({\n type: SectionTypes.link,\n data: {\n title: group.name,\n rightLabel: group.sourceType,\n onPress: () =>\n navigation.navigate('GroupNotificationSettings', {\n groupId: group.id,\n title: group.name || 'Group',\n }),\n },\n sectionInnerStyle: { paddingVertical: 0 },\n showBottomBorder: true,\n })),\n ].filter(item => item.type !== SectionTypes.hidden)\n\n const headerIndices = listData\n .map(({ type }, index) => (type === SectionTypes.header ? index : undefined))\n .filter(isDefined)\n\n return (\n <View style={styles.listContainer}>\n <FlatList\n data={listData as SectionListData}\n contentContainerStyle={styles.contentContainer}\n renderItem={({ item, index }) => {\n const [isStart, isEnd] = [\n index === 0 || headerIndices.includes(index),\n index === listData.length - 1 || headerIndices.includes(index + 1),\n ]\n\n switch (item.type) {\n case SectionTypes.header:\n return (\n <ListSection\n isStart={isStart}\n isEnd={isEnd}\n showBottomBorder={item?.showBottomBorder}\n outerStyle={item?.sectionOuterStyle}\n innerStyle={item?.sectionInnerStyle}\n >\n <Heading variant=\"h2\">{item.data.title}</Heading>\n </ListSection>\n )\n case SectionTypes.setting:\n return (\n <ListSection\n isStart={isStart}\n isEnd={isEnd}\n showBottomBorder={item?.showBottomBorder}\n outerStyle={item?.sectionOuterStyle}\n innerStyle={item?.sectionInnerStyle}\n >\n <SettingRow {...item.data} />\n </ListSection>\n )\n case SectionTypes.view:\n return (\n <ListSection\n isStart={isStart}\n isEnd={isEnd}\n showBottomBorder={item?.showBottomBorder}\n outerStyle={item?.sectionOuterStyle}\n innerStyle={item?.sectionInnerStyle}\n >\n <View {...item.data} style={item.data.style} />\n </ListSection>\n )\n case SectionTypes.link:\n return (\n <ListSection\n isStart={isStart}\n isEnd={isEnd}\n showBottomBorder={item?.showBottomBorder}\n outerStyle={item?.sectionOuterStyle}\n innerStyle={item?.sectionInnerStyle}\n >\n <LinkRow {...item.data} />\n </ListSection>\n )\n default:\n return null\n }\n }}\n />\n </View>\n )\n}\n\ninterface ListSectionProps {\n isStart?: boolean\n isEnd?: boolean\n showBottomBorder?: boolean\n outerStyle?: ViewStyle\n innerStyle?: ViewStyle\n children: ReactNode\n}\n\nfunction ListSection({\n isStart,\n isEnd,\n showBottomBorder,\n outerStyle,\n innerStyle,\n children,\n}: ListSectionProps) {\n const styles = useStyles({ isStart, isEnd })\n const bottomBorder = showBottomBorder ? styles.sectionInnerBottomBorder : {}\n\n return (\n <View style={[styles.sectionOuterBase, outerStyle]}>\n <View style={[styles.sectionInnerBase, bottomBorder, innerStyle]}>{children}</View>\n </View>\n )\n}\n\ninterface SettingRowProps {\n title: string\n style?: ViewStyle\n rightItem?: ReactNode\n rightLabel?: string\n rightItemStyle?: ViewStyle\n}\n\nfunction SettingRow({ title, style, rightLabel, rightItem, rightItemStyle = {} }: SettingRowProps) {\n const styles = useStyles()\n\n return (\n <View style={[styles.settingRow, style]}>\n <View style={styles.settingRowContent}>\n <Text variant=\"plain\" style={styles.settingRowText}>\n {title}\n </Text>\n {Boolean(rightLabel) && <Text variant=\"footnote\">{rightLabel}</Text>}\n </View>\n {Boolean(rightItem) && <View style={rightItemStyle}>{rightItem}</View>}\n </View>\n )\n}\n\ninterface LinkRowProps {\n title: string\n rightLabel: string\n onPress: () => void\n}\n\nfunction LinkRow({ title, rightLabel, onPress }: LinkRowProps) {\n const styles = useLinkRowStyles()\n const isSourceType = rightLabel === 'Team' || rightLabel === 'Group' || rightLabel === 'PlanTeam'\n\n return (\n <PlatformPressable\n style={styles.row}\n onPress={onPress}\n accessibilityRole=\"link\"\n accessibilityLabel={title}\n accessibilityHint={`Navigate to ${title} settings`}\n >\n <View style={styles.innerContainer}>\n <Text style={styles.title} numberOfLines={2}>\n {title}\n </Text>\n <View style={styles.rightContent}>\n {isSourceType ? (\n <Badge label={rightLabel} appearance=\"neutral\" variant=\"meta\" />\n ) : (\n <Text numberOfLines={1} style={styles.rightLabelText}>\n {rightLabel}\n </Text>\n )}\n {Platform.OS === 'ios' && (\n <Icon name=\"general.rightChevron\" size={16} style={styles.icon} />\n )}\n </View>\n </View>\n </PlatformPressable>\n )\n}\n\n// =================================\n// ====== Styles ===================\n// =================================\n\nconst useStyles = ({}: { isStart?: boolean; isEnd?: boolean } = {}) => {\n const { colors } = useTheme()\n const headerBottomPadding = 0\n\n return StyleSheet.create({\n listContainer: {\n flex: 1,\n },\n contentContainer: {},\n sectionOuterBase: {\n paddingLeft: 16,\n },\n sectionInnerBase: {\n paddingRight: 16,\n paddingVertical: 16,\n },\n sectionInnerHeader: {\n paddingBottom: headerBottomPadding,\n },\n sectionInnerBottomBorder: {\n borderBottomColor: colors.borderColorDefaultBase,\n borderBottomWidth: 1,\n },\n sectionDescription: {\n color: colors.textColorDefaultSecondary,\n },\n settingRow: {\n flexDirection: 'row',\n justifyContent: 'space-between',\n alignItems: 'center',\n gap: 8,\n },\n settingRowContent: {\n flex: 1,\n },\n settingRowText: {\n lineHeight: 20,\n },\n })\n}\n\nconst useLinkRowStyles = () => {\n const theme = useTheme()\n\n return StyleSheet.create({\n row: {\n paddingLeft: 0,\n paddingVertical: 16,\n },\n innerContainer: {\n flexDirection: 'row',\n alignItems: 'center',\n justifyContent: 'space-between',\n gap: 12,\n },\n rightContent: {\n flexDirection: 'row',\n alignItems: 'center',\n gap: 8,\n },\n title: {\n flexShrink: 1,\n alignSelf: 'center',\n },\n rightLabelText: {\n color: theme.colors.textColorDefaultSecondary,\n },\n icon: {\n color: theme.colors.iconColorDefaultDisabled,\n },\n })\n}\n"]}
@@ -21,7 +21,7 @@ export function PreferredAppSelectionScreen({ route }) {
21
21
  mutationFn: (app) => {
22
22
  return apiClient.chat
23
23
  .post({
24
- url: `/me/chat_types/${chatTypeId}/set_preferred_appz`,
24
+ url: `/me/chat_types/${chatTypeId}/set_preferred_app`,
25
25
  data: { data: { type: 'ChatType', attributes: { app } } },
26
26
  })
27
27
  .catch(throwResponseError);