@planningcenter/chat-react-native 3.24.4 → 3.24.5-qa-563.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.
- package/build/components/conversation/message.d.ts +1 -2
- package/build/components/conversation/message.d.ts.map +1 -1
- package/build/components/conversation/message.js +5 -5
- package/build/components/conversation/message.js.map +1 -1
- package/build/components/conversation/message_form.d.ts.map +1 -1
- package/build/components/conversation/message_form.js +1 -4
- package/build/components/conversation/message_form.js.map +1 -1
- package/build/components/conversation/messages_disabled_banners.d.ts.map +1 -1
- package/build/components/conversation/messages_disabled_banners.js +2 -14
- package/build/components/conversation/messages_disabled_banners.js.map +1 -1
- package/build/components/conversations/conversation_actions.js +3 -3
- package/build/components/conversations/conversation_actions.js.map +1 -1
- package/build/components/conversations/conversations.d.ts.map +1 -1
- package/build/components/conversations/conversations.js +1 -0
- package/build/components/conversations/conversations.js.map +1 -1
- package/build/hooks/use_conversation.d.ts.map +1 -1
- package/build/hooks/use_conversation.js +13 -1
- package/build/hooks/use_conversation.js.map +1 -1
- package/build/hooks/use_conversation_membership.d.ts +5 -0
- package/build/hooks/use_conversation_membership.d.ts.map +1 -0
- package/build/hooks/use_conversation_membership.js +63 -0
- package/build/hooks/use_conversation_membership.js.map +1 -0
- package/build/hooks/use_conversations_actions.d.ts.map +1 -1
- package/build/hooks/use_conversations_actions.js +4 -0
- package/build/hooks/use_conversations_actions.js.map +1 -1
- package/build/hooks/use_features.d.ts +1 -1
- package/build/hooks/use_features.js +1 -1
- package/build/hooks/use_features.js.map +1 -1
- package/build/navigation/index.d.ts +10 -0
- package/build/navigation/index.d.ts.map +1 -1
- package/build/navigation/index.js +12 -2
- package/build/navigation/index.js.map +1 -1
- package/build/screens/conversation_details_screen.d.ts.map +1 -1
- package/build/screens/conversation_details_screen.js +51 -19
- package/build/screens/conversation_details_screen.js.map +1 -1
- package/build/screens/conversation_notification_level_select_screen.d.ts +8 -0
- package/build/screens/conversation_notification_level_select_screen.d.ts.map +1 -0
- package/build/screens/conversation_notification_level_select_screen.js +49 -0
- package/build/screens/conversation_notification_level_select_screen.js.map +1 -0
- package/build/screens/conversation_screen.d.ts +4 -3
- package/build/screens/conversation_screen.d.ts.map +1 -1
- package/build/screens/conversation_screen.js +20 -14
- package/build/screens/conversation_screen.js.map +1 -1
- package/build/screens/group_notification_level_select_screen.d.ts +8 -0
- package/build/screens/group_notification_level_select_screen.d.ts.map +1 -0
- package/build/screens/group_notification_level_select_screen.js +40 -0
- package/build/screens/group_notification_level_select_screen.js.map +1 -0
- package/build/screens/group_notification_settings_screen.d.ts.map +1 -1
- package/build/screens/group_notification_settings_screen.js +30 -17
- package/build/screens/group_notification_settings_screen.js.map +1 -1
- package/build/screens/message_actions_screen.js +1 -2
- package/build/screens/message_actions_screen.js.map +1 -1
- package/build/screens/notification_settings/hooks/groups.d.ts +6 -5
- package/build/screens/notification_settings/hooks/groups.d.ts.map +1 -1
- package/build/screens/notification_settings/hooks/groups.js +63 -36
- package/build/screens/notification_settings/hooks/groups.js.map +1 -1
- package/build/screens/notification_settings_screen.d.ts.map +1 -1
- package/build/screens/notification_settings_screen.js +25 -11
- package/build/screens/notification_settings_screen.js.map +1 -1
- package/build/types/resources/conversation.d.ts +2 -3
- package/build/types/resources/conversation.d.ts.map +1 -1
- package/build/types/resources/conversation.js.map +1 -1
- package/build/types/resources/conversation_membership.d.ts +16 -0
- package/build/types/resources/conversation_membership.d.ts.map +1 -0
- package/build/types/resources/conversation_membership.js +2 -0
- package/build/types/resources/conversation_membership.js.map +1 -0
- package/build/types/resources/group_membership.d.ts +7 -0
- package/build/types/resources/group_membership.d.ts.map +1 -1
- package/build/types/resources/group_membership.js.map +1 -1
- package/build/types/resources/index.d.ts +1 -0
- package/build/types/resources/index.d.ts.map +1 -1
- package/build/types/resources/index.js +1 -0
- package/build/types/resources/index.js.map +1 -1
- package/build/utils/deep_snake_case_keys.d.ts +4 -0
- package/build/utils/deep_snake_case_keys.d.ts.map +1 -0
- package/build/utils/deep_snake_case_keys.js +13 -0
- package/build/utils/deep_snake_case_keys.js.map +1 -0
- package/package.json +2 -2
- package/src/components/conversation/message.tsx +4 -9
- package/src/components/conversation/message_form.tsx +1 -4
- package/src/components/conversation/messages_disabled_banners.tsx +9 -17
- package/src/components/conversations/conversation_actions.tsx +3 -3
- package/src/components/conversations/conversations.tsx +1 -0
- package/src/hooks/use_conversation.ts +13 -1
- package/src/hooks/use_conversation_membership.ts +91 -0
- package/src/hooks/use_conversations_actions.ts +4 -0
- package/src/hooks/use_features.ts +1 -1
- package/src/navigation/index.tsx +19 -1
- package/src/screens/conversation_details_screen.tsx +88 -25
- package/src/screens/conversation_notification_level_select_screen.tsx +73 -0
- package/src/screens/conversation_screen.tsx +20 -17
- package/src/screens/group_notification_level_select_screen.tsx +62 -0
- package/src/screens/group_notification_settings_screen.tsx +53 -18
- package/src/screens/message_actions_screen.tsx +1 -2
- package/src/screens/notification_settings/hooks/groups.ts +76 -37
- package/src/screens/notification_settings_screen.tsx +24 -21
- package/src/types/resources/conversation.ts +2 -3
- package/src/types/resources/conversation_membership.ts +17 -0
- package/src/types/resources/group_membership.ts +7 -0
- package/src/types/resources/index.ts +1 -0
- package/src/utils/deep_snake_case_keys.ts +16 -0
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import { useMutation, useQueryClient } from '@tanstack/react-query';
|
|
2
|
+
import { merge } from 'lodash';
|
|
2
3
|
import { getRequestQueryKey, useApiClient } from '../../../hooks';
|
|
3
4
|
import { useSuspenseGet, useSuspensePaginator } from '../../../hooks';
|
|
4
5
|
import { throwResponseError } from '../../../utils/response_error';
|
|
6
|
+
import { updateRecordInPagesData } from '../../../utils';
|
|
5
7
|
export const getGroupsRequestArgs = () => ({
|
|
6
8
|
url: '/me/groups',
|
|
7
9
|
data: {
|
|
@@ -10,7 +12,11 @@ export const getGroupsRequestArgs = () => ({
|
|
|
10
12
|
filter: 'user_settable_notification_level',
|
|
11
13
|
fields: {
|
|
12
14
|
Group: [],
|
|
13
|
-
GroupMembership: [
|
|
15
|
+
GroupMembership: [
|
|
16
|
+
'notification_level',
|
|
17
|
+
'notification_level_description',
|
|
18
|
+
'notification_level_options',
|
|
19
|
+
],
|
|
14
20
|
},
|
|
15
21
|
order: 'name',
|
|
16
22
|
},
|
|
@@ -21,7 +27,11 @@ export const getGroupRequestArgs = ({ groupId }) => ({
|
|
|
21
27
|
include: ['my_group_membership'],
|
|
22
28
|
fields: {
|
|
23
29
|
Group: ['name', 'source_app_name', 'source_type', 'my_group_membership'],
|
|
24
|
-
GroupMembership: [
|
|
30
|
+
GroupMembership: [
|
|
31
|
+
'notification_level',
|
|
32
|
+
'notification_level_description',
|
|
33
|
+
'notification_level_options',
|
|
34
|
+
],
|
|
25
35
|
},
|
|
26
36
|
},
|
|
27
37
|
});
|
|
@@ -31,48 +41,63 @@ export const useGroups = () => {
|
|
|
31
41
|
};
|
|
32
42
|
export const useGroup = ({ groupId }) => {
|
|
33
43
|
const args = getGroupRequestArgs({ groupId });
|
|
34
|
-
return useSuspenseGet(args);
|
|
44
|
+
return useSuspenseGet(args, { refetchOnMount: false });
|
|
35
45
|
};
|
|
36
46
|
export const useGroupMembershipUpdate = ({ groupId }) => {
|
|
37
47
|
const apiClient = useApiClient();
|
|
38
48
|
const queryClient = useQueryClient();
|
|
39
|
-
const
|
|
40
|
-
const
|
|
49
|
+
const groupRequestArgs = getGroupRequestArgs({ groupId });
|
|
50
|
+
const groupsRequestArgs = getGroupsRequestArgs();
|
|
51
|
+
const groupQueryKey = getRequestQueryKey(groupRequestArgs);
|
|
52
|
+
const enrichGroupMembership = (membership) => {
|
|
53
|
+
const cachedGroup = queryClient.getQueryData(groupQueryKey);
|
|
54
|
+
const currentOptions = cachedGroup?.data.myGroupMembership?.notificationLevelOptions ?? [];
|
|
55
|
+
const { notificationLevel } = membership;
|
|
56
|
+
const selectedOption = notificationLevel
|
|
57
|
+
? currentOptions.find(o => o.value === notificationLevel)
|
|
58
|
+
: undefined;
|
|
59
|
+
const notificationLevelDescription = membership.notificationLevelDescription ?? selectedOption?.description;
|
|
60
|
+
return {
|
|
61
|
+
...membership,
|
|
62
|
+
notificationLevelDescription,
|
|
63
|
+
...(notificationLevel && {
|
|
64
|
+
notificationLevelOptions: currentOptions.map(o => ({
|
|
65
|
+
...o,
|
|
66
|
+
enabled: o.value === notificationLevel,
|
|
67
|
+
})),
|
|
68
|
+
}),
|
|
69
|
+
};
|
|
70
|
+
};
|
|
71
|
+
const updateGroupsMembershipCache = (membership) => {
|
|
72
|
+
queryClient.setQueryData(getRequestQueryKey(groupsRequestArgs), prev => updateRecordInPagesData({
|
|
73
|
+
data: prev,
|
|
74
|
+
record: { id: groupId },
|
|
75
|
+
processRecord: (_record, current) => merge({}, current, { myGroupMembership: membership }),
|
|
76
|
+
}));
|
|
77
|
+
};
|
|
78
|
+
const updateGroupMembershipCache = (membership) => {
|
|
79
|
+
queryClient.setQueryData(groupQueryKey, groupData => {
|
|
80
|
+
if (!groupData?.data.myGroupMembership)
|
|
81
|
+
return groupData;
|
|
82
|
+
return merge({}, groupData, { data: { myGroupMembership: membership } });
|
|
83
|
+
});
|
|
84
|
+
};
|
|
41
85
|
return useMutation({
|
|
42
86
|
throwOnError: true,
|
|
43
|
-
onMutate:
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
return {
|
|
48
|
-
...groupData,
|
|
49
|
-
data: {
|
|
50
|
-
...groupData.data,
|
|
51
|
-
myGroupMembership: {
|
|
52
|
-
...groupData.data.myGroupMembership,
|
|
53
|
-
notificationLevel,
|
|
54
|
-
},
|
|
55
|
-
},
|
|
56
|
-
};
|
|
57
|
-
});
|
|
87
|
+
onMutate: membership => {
|
|
88
|
+
const enriched = enrichGroupMembership(membership);
|
|
89
|
+
updateGroupsMembershipCache(enriched);
|
|
90
|
+
updateGroupMembershipCache(enriched);
|
|
58
91
|
},
|
|
59
92
|
onSuccess: response => {
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
...groupData.data,
|
|
67
|
-
myGroupMembership: {
|
|
68
|
-
...groupData.data.myGroupMembership,
|
|
69
|
-
...response.data,
|
|
70
|
-
},
|
|
71
|
-
},
|
|
72
|
-
};
|
|
73
|
-
});
|
|
93
|
+
const enriched = enrichGroupMembership(response.data);
|
|
94
|
+
updateGroupsMembershipCache(enriched);
|
|
95
|
+
updateGroupMembershipCache(enriched);
|
|
96
|
+
// Updating conversations without access to the current filters
|
|
97
|
+
// is a hard itch to scratch so we just need to refetch.
|
|
98
|
+
queryClient.invalidateQueries({ queryKey: ['/me/conversations'] });
|
|
74
99
|
},
|
|
75
|
-
mutationFn: (
|
|
100
|
+
mutationFn: (membership) => {
|
|
76
101
|
return apiClient.chat
|
|
77
102
|
.patch({
|
|
78
103
|
url: `/me/groups/${groupId}/my_group_membership`,
|
|
@@ -80,7 +105,9 @@ export const useGroupMembershipUpdate = ({ groupId }) => {
|
|
|
80
105
|
data: {
|
|
81
106
|
type: 'GroupMembership',
|
|
82
107
|
attributes: {
|
|
83
|
-
|
|
108
|
+
...(membership.notificationLevel !== undefined && {
|
|
109
|
+
notification_level: membership.notificationLevel,
|
|
110
|
+
}),
|
|
84
111
|
},
|
|
85
112
|
},
|
|
86
113
|
},
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"groups.js","sourceRoot":"","sources":["../../../../src/screens/notification_settings/hooks/groups.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"groups.js","sourceRoot":"","sources":["../../../../src/screens/notification_settings/hooks/groups.ts"],"names":[],"mappings":"AAAA,OAAO,EAAgB,WAAW,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAA;AACjF,OAAO,EAAE,KAAK,EAAE,MAAM,QAAQ,CAAA;AAC9B,OAAO,EAAE,kBAAkB,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAA;AACjE,OAAO,EAAE,cAAc,EAA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AAC;QACD,UAAU,EAAE,CAAC,UAAoC,EAAE,EAAE;YACnD,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,GAAG,CAAC,UAAU,CAAC,iBAAiB,KAAK,SAAS,IAAI;gCAChD,kBAAkB,EAAE,UAAU,CAAC,iBAAiB;6BACjD,CAAC;yBACH;qBACF;iBACF;aACF,CAAC;iBACD,KAAK,CAAC,kBAAkB,CAAC,CAAA;QAC9B,CAAC;KACF,CAAC,CAAA;AACJ,CAAC,CAAA","sourcesContent":["import { InfiniteData, useMutation, useQueryClient } from '@tanstack/react-query'\nimport { merge } from 'lodash'\nimport { getRequestQueryKey, useApiClient } from '../../../hooks'\nimport { useSuspenseGet, useSuspensePaginator } from '../../../hooks'\nimport { ApiCollection, ApiResource } from '../../../types'\nimport { GroupMembership, GroupResourceWithMembership } from '../../../types/resources'\nimport { throwResponseError } from '../../../utils/response_error'\nimport { updateRecordInPagesData } from '../../../utils'\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: [\n 'notification_level',\n 'notification_level_description',\n 'notification_level_options',\n ],\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: [\n 'notification_level',\n 'notification_level_description',\n 'notification_level_options',\n ],\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, { refetchOnMount: false })\n}\n\ntype GroupsQueryData = InfiniteData<ApiCollection<GroupResourceWithMembership>>\n\nexport const useGroupMembershipUpdate = ({ groupId }: { groupId: number | string }) => {\n const apiClient = useApiClient()\n const queryClient = useQueryClient()\n const groupRequestArgs = getGroupRequestArgs({ groupId })\n const groupsRequestArgs = getGroupsRequestArgs()\n const groupQueryKey = getRequestQueryKey(groupRequestArgs)\n\n const enrichGroupMembership = (\n membership: Partial<GroupMembership>\n ): Partial<GroupMembership> => {\n const cachedGroup =\n queryClient.getQueryData<ApiResource<GroupResourceWithMembership>>(groupQueryKey)\n const currentOptions = cachedGroup?.data.myGroupMembership?.notificationLevelOptions ?? []\n const { notificationLevel } = membership\n const selectedOption = notificationLevel\n ? currentOptions.find(o => o.value === notificationLevel)\n : undefined\n const notificationLevelDescription =\n membership.notificationLevelDescription ?? selectedOption?.description\n\n return {\n ...membership,\n notificationLevelDescription,\n ...(notificationLevel && {\n notificationLevelOptions: currentOptions.map(o => ({\n ...o,\n enabled: o.value === notificationLevel,\n })),\n }),\n }\n }\n\n const updateGroupsMembershipCache = (membership: Partial<GroupMembership>) => {\n queryClient.setQueryData<GroupsQueryData>(getRequestQueryKey(groupsRequestArgs), prev =>\n updateRecordInPagesData({\n data: prev,\n record: { id: groupId } as GroupResourceWithMembership,\n processRecord: (_record, current) => merge({}, current, { myGroupMembership: membership }),\n })\n )\n }\n\n const updateGroupMembershipCache = (membership: Partial<GroupMembership>) => {\n queryClient.setQueryData<ApiResource<GroupResourceWithMembership>>(groupQueryKey, groupData => {\n if (!groupData?.data.myGroupMembership) return groupData\n return merge({}, groupData, { data: { myGroupMembership: membership } })\n })\n }\n\n return useMutation({\n throwOnError: true,\n onMutate: membership => {\n const enriched = enrichGroupMembership(membership)\n updateGroupsMembershipCache(enriched)\n updateGroupMembershipCache(enriched)\n },\n onSuccess: response => {\n const enriched = enrichGroupMembership(response.data)\n updateGroupsMembershipCache(enriched)\n updateGroupMembershipCache(enriched)\n\n // Updating conversations without access to the current filters\n // is a hard itch to scratch so we just need to refetch.\n queryClient.invalidateQueries({ queryKey: ['/me/conversations'] })\n },\n mutationFn: (membership: Partial<GroupMembership>) => {\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 ...(membership.notificationLevel !== undefined && {\n notification_level: membership.notificationLevel,\n }),\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;
|
|
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;AAC3E,OAAO,KAAiD,MAAM,OAAO,CAAA;AA0CrE,MAAM,MAAM,+BAA+B,GAAG,iBAAiB,CAAC,EAAE,CAAC,CAAA;AAEnE,wBAAgB,0BAA0B,CAAC,EAAE,EAAE,+BAA+B,qBAmK7E"}
|
|
@@ -5,9 +5,13 @@ import { FlatList, Platform, StyleSheet, View } from 'react-native';
|
|
|
5
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
|
+
import { useSafeAreaInsets } from 'react-native-safe-area-context';
|
|
8
9
|
import { isDefined } from '../types';
|
|
9
10
|
import { useGroups } from './notification_settings/hooks/groups';
|
|
10
11
|
import { useChatTypes } from './preferred_app/hooks/use_chat_types';
|
|
12
|
+
// =========================================
|
|
13
|
+
// ====== Factory Constants & Types ========
|
|
14
|
+
// =========================================
|
|
11
15
|
var SectionTypes;
|
|
12
16
|
(function (SectionTypes) {
|
|
13
17
|
SectionTypes[SectionTypes["header"] = 0] = "header";
|
|
@@ -62,14 +66,14 @@ export function NotificationSettingsScreen({}) {
|
|
|
62
66
|
showBottomBorder: true,
|
|
63
67
|
})),
|
|
64
68
|
{
|
|
65
|
-
type: SectionTypes.header,
|
|
69
|
+
type: groups.length === 0 ? SectionTypes.hidden : SectionTypes.header,
|
|
66
70
|
data: {
|
|
67
71
|
title: 'Manage chat settings',
|
|
68
72
|
},
|
|
69
73
|
sectionInnerStyle: styles.sectionInnerHeader,
|
|
70
74
|
},
|
|
71
75
|
{
|
|
72
|
-
type: SectionTypes.view,
|
|
76
|
+
type: groups.length === 0 ? SectionTypes.hidden : SectionTypes.view,
|
|
73
77
|
data: {
|
|
74
78
|
children: (<Text variant="tertiary" style={styles.sectionDescription}>
|
|
75
79
|
Notification settings for all of your group, team and event related conversations
|
|
@@ -81,6 +85,7 @@ export function NotificationSettingsScreen({}) {
|
|
|
81
85
|
type: SectionTypes.link,
|
|
82
86
|
data: {
|
|
83
87
|
title: group.name,
|
|
88
|
+
subtitle: group.myGroupMembership?.notificationLevelDescription,
|
|
84
89
|
rightLabel: group.sourceType,
|
|
85
90
|
onPress: () => navigation.navigate('GroupNotificationSettings', {
|
|
86
91
|
groupId: group.id,
|
|
@@ -117,6 +122,7 @@ export function NotificationSettingsScreen({}) {
|
|
|
117
122
|
return (<ListSection isStart={isStart} isEnd={isEnd} showBottomBorder={item?.showBottomBorder} outerStyle={item?.sectionOuterStyle} innerStyle={item?.sectionInnerStyle}>
|
|
118
123
|
<LinkRow {...item.data}/>
|
|
119
124
|
</ListSection>);
|
|
125
|
+
case SectionTypes.hidden:
|
|
120
126
|
default:
|
|
121
127
|
return null;
|
|
122
128
|
}
|
|
@@ -142,14 +148,17 @@ function SettingRow({ title, style, rightLabel, rightItem, rightItemStyle = {} }
|
|
|
142
148
|
{Boolean(rightItem) && <View style={rightItemStyle}>{rightItem}</View>}
|
|
143
149
|
</View>);
|
|
144
150
|
}
|
|
145
|
-
function LinkRow({ title, rightLabel, onPress }) {
|
|
151
|
+
function LinkRow({ title, subtitle, rightLabel, onPress }) {
|
|
146
152
|
const styles = useLinkRowStyles();
|
|
147
153
|
const isSourceType = rightLabel === 'Team' || rightLabel === 'Group' || rightLabel === 'PlanTeam';
|
|
148
154
|
return (<PlatformPressable style={styles.row} onPress={onPress} accessibilityRole="link" accessibilityLabel={title} accessibilityHint={`Navigate to ${title} settings`}>
|
|
149
155
|
<View style={styles.innerContainer}>
|
|
150
|
-
<
|
|
151
|
-
{title}
|
|
152
|
-
|
|
156
|
+
<View style={styles.leftContent}>
|
|
157
|
+
<Text style={styles.title} numberOfLines={2}>
|
|
158
|
+
{title}
|
|
159
|
+
</Text>
|
|
160
|
+
{Boolean(subtitle) && <Text variant="footnote">{subtitle}</Text>}
|
|
161
|
+
</View>
|
|
153
162
|
<View style={styles.rightContent}>
|
|
154
163
|
{isSourceType ? (<Badge label={rightLabel} appearance="neutral" variant="meta"/>) : (<Text numberOfLines={1} style={styles.rightLabelText}>
|
|
155
164
|
{rightLabel}
|
|
@@ -164,12 +173,15 @@ function LinkRow({ title, rightLabel, onPress }) {
|
|
|
164
173
|
// =================================
|
|
165
174
|
const useStyles = ({} = {}) => {
|
|
166
175
|
const { colors } = useTheme();
|
|
176
|
+
const { bottom } = useSafeAreaInsets();
|
|
167
177
|
const headerBottomPadding = 0;
|
|
168
178
|
return StyleSheet.create({
|
|
169
179
|
listContainer: {
|
|
170
180
|
flex: 1,
|
|
171
181
|
},
|
|
172
|
-
contentContainer: {
|
|
182
|
+
contentContainer: {
|
|
183
|
+
paddingBottom: bottom,
|
|
184
|
+
},
|
|
173
185
|
sectionOuterBase: {
|
|
174
186
|
paddingLeft: 16,
|
|
175
187
|
},
|
|
@@ -178,6 +190,7 @@ const useStyles = ({} = {}) => {
|
|
|
178
190
|
paddingVertical: 16,
|
|
179
191
|
},
|
|
180
192
|
sectionInnerHeader: {
|
|
193
|
+
paddingTop: 24,
|
|
181
194
|
paddingBottom: headerBottomPadding,
|
|
182
195
|
},
|
|
183
196
|
sectionInnerBottomBorder: {
|
|
@@ -214,15 +227,16 @@ const useLinkRowStyles = () => {
|
|
|
214
227
|
justifyContent: 'space-between',
|
|
215
228
|
gap: 12,
|
|
216
229
|
},
|
|
230
|
+
leftContent: {
|
|
231
|
+
flex: 1,
|
|
232
|
+
gap: 4,
|
|
233
|
+
},
|
|
217
234
|
rightContent: {
|
|
218
235
|
flexDirection: 'row',
|
|
219
236
|
alignItems: 'center',
|
|
220
237
|
gap: 8,
|
|
221
238
|
},
|
|
222
|
-
title: {
|
|
223
|
-
flexShrink: 1,
|
|
224
|
-
alignSelf: 'center',
|
|
225
|
-
},
|
|
239
|
+
title: {},
|
|
226
240
|
rightLabelText: {
|
|
227
241
|
color: theme.colors.textColorDefaultSecondary,
|
|
228
242
|
},
|
|
@@ -1 +1 @@
|
|
|
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,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,MAAM,CAAC,sBAAsB;YAChD,iBAAiB,EAAE,CAAC;SACrB;QACD,kBAAkB,EAAE;YAClB,KAAK,EAAE,MAAM,CAAC,yBAAyB;SACxC;QACD,UAAU,EAAE;YACV,aAAa,EAAE,KAAK;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"]}
|
|
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;AAC3E,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,iBAAiB,EAAE,MAAM,gCAAgC,CAAA;AAClE,OAAO,EAAE,SAAS,EAAE,MAAM,UAAU,CAAA;AACpC,OAAO,EAAE,SAAS,EAAE,MAAM,sCAAsC,CAAA;AAChE,OAAO,EAAE,YAAY,EAAE,MAAM,sCAAsC,CAAA;AAEnE,4CAA4C;AAC5C,4CAA4C;AAC5C,4CAA4C;AAE5C,IAAK,YAMJ;AAND,WAAK,YAAY;IACf,mDAAM,CAAA;IACN,mDAAM,CAAA;IACN,qDAAO,CAAA;IACP,+CAAI,CAAA;IACJ,+CAAI,CAAA;AACN,CAAC,EANI,YAAY,KAAZ,YAAY,QAMhB;AAwBD,MAAM,UAAU,0BAA0B,CAAC,EAAmC;IAC5E,MAAM,UAAU,GAAG,aAAa,EAAE,CAAA;IAClC,MAAM,M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B;SAC7C;KACF,CAAC,CAAA;AACJ,CAAC,CAAA","sourcesContent":["import { PlatformPressable } from '@react-navigation/elements'\nimport { StaticScreenProps, useNavigation } from '@react-navigation/native'\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 { useSafeAreaInsets } from 'react-native-safe-area-context'\nimport { isDefined } from '../types'\nimport { useGroups } from './notification_settings/hooks/groups'\nimport { useChatTypes } from './preferred_app/hooks/use_chat_types'\n\n// =========================================\n// ====== Factory Constants & Types ========\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()\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: groups.length === 0 ? SectionTypes.hidden : SectionTypes.header,\n data: {\n title: 'Manage chat settings',\n },\n sectionInnerStyle: styles.sectionInnerHeader,\n },\n {\n type: groups.length === 0 ? SectionTypes.hidden : 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 subtitle: group.myGroupMembership?.notificationLevelDescription,\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 case SectionTypes.hidden:\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 subtitle?: string\n rightLabel: string\n onPress: () => void\n}\n\nfunction LinkRow({ title, subtitle, 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 <View style={styles.leftContent}>\n <Text style={styles.title} numberOfLines={2}>\n {title}\n </Text>\n {Boolean(subtitle) && <Text variant=\"footnote\">{subtitle}</Text>}\n </View>\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 { bottom } = useSafeAreaInsets()\n const headerBottomPadding = 0\n\n return StyleSheet.create({\n listContainer: {\n flex: 1,\n },\n contentContainer: {\n paddingBottom: bottom,\n },\n sectionOuterBase: {\n paddingLeft: 16,\n },\n sectionInnerBase: {\n paddingRight: 16,\n paddingVertical: 16,\n },\n sectionInnerHeader: {\n paddingTop: 24,\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 leftContent: {\n flex: 1,\n gap: 4,\n },\n rightContent: {\n flexDirection: 'row',\n alignItems: 'center',\n gap: 8,\n },\n title: {},\n rightLabelText: {\n color: theme.colors.textColorDefaultSecondary,\n },\n icon: {\n color: theme.colors.iconColorDefaultDisabled,\n },\n })\n}\n"]}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { AnalyticsMetadataResource } from './analytics_metadata';
|
|
2
2
|
import { ConversationBadgeResource } from './conversation_badge';
|
|
3
|
+
import { ConversationMembershipResource } from './conversation_membership';
|
|
3
4
|
import { GroupResource } from './group_resource';
|
|
4
5
|
import { MemberAbilityResource } from './member_ability';
|
|
5
6
|
export interface ConversationResource {
|
|
@@ -7,9 +8,7 @@ export interface ConversationResource {
|
|
|
7
8
|
id: number;
|
|
8
9
|
badges?: ConversationBadgeResource[];
|
|
9
10
|
analyticsMetadata?: AnalyticsMetadataResource;
|
|
10
|
-
conversationMembership?:
|
|
11
|
-
lastReadMessageSortKey: string;
|
|
12
|
-
};
|
|
11
|
+
conversationMembership?: Partial<ConversationMembershipResource>;
|
|
13
12
|
createdAt: string;
|
|
14
13
|
deleted?: boolean;
|
|
15
14
|
groups?: GroupResource[];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"conversation.d.ts","sourceRoot":"","sources":["../../../src/types/resources/conversation.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,sBAAsB,CAAA;AACrE,OAAO,EAAE,yBAAyB,EAAE,MAAM,sBAAsB,CAAA;AAChE,OAAO,EAAE,aAAa,EAAE,MAAM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AqB,CAAA;IACrC,KAAK,EAAE,OAAO,CAAA;IACd,eAAe,EAAE,OAAO,CAAA;IACxB,KAAK,EAAE,MAAM,CAAA;IACb,WAAW,EAAE,MAAM,CAAA;IACnB,mBAAmB,CAAC,EAAE,MAAM,CAAA;IAC5B,SAAS,EAAE,MAAM,CAAA;CAClB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"conversation.js","sourceRoot":"","sources":["../../../src/types/resources/conversation.ts"],"names":[],"mappings":"","sourcesContent":["import type { AnalyticsMetadataResource } from './analytics_metadata'\nimport { ConversationBadgeResource } from './conversation_badge'\nimport { GroupResource } from './group_resource'\nimport { MemberAbilityResource } from './member_ability'\n\nexport interface ConversationResource {\n type: 'Conversation'\n id: number\n badges?: ConversationBadgeResource[]\n analyticsMetadata?: AnalyticsMetadataResource\n conversationMembership?:
|
|
1
|
+
{"version":3,"file":"conversation.js","sourceRoot":"","sources":["../../../src/types/resources/conversation.ts"],"names":[],"mappings":"","sourcesContent":["import type { AnalyticsMetadataResource } from './analytics_metadata'\nimport { ConversationBadgeResource } from './conversation_badge'\nimport { ConversationMembershipResource } from './conversation_membership'\nimport { GroupResource } from './group_resource'\nimport { MemberAbilityResource } from './member_ability'\n\nexport interface ConversationResource {\n type: 'Conversation'\n id: number\n badges?: ConversationBadgeResource[]\n analyticsMetadata?: AnalyticsMetadataResource\n conversationMembership?: Partial<ConversationMembershipResource>\n createdAt: string\n deleted?: boolean\n groups?: GroupResource[]\n previewAvatarUrls?: string[]\n lastMessageAuthorId?: string\n lastMessageAuthorName?: string\n lastMessageCreatedAt?: string\n lastMessageTextPreview?: string\n latestReadMessageSortKey?: string\n memberAbility?: MemberAbilityResource\n muted: boolean\n repliesDisabled: boolean\n title: string\n unreadCount: number\n unreadReactionCount?: number // Derived from Jolt events\n updatedAt: string\n}\n"]}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { ResourceObject } from '../api_primitives';
|
|
2
|
+
export type NotificationLevelValue = 'everything' | 'nothing';
|
|
3
|
+
export type NotificationLevelDescription = string;
|
|
4
|
+
export interface ConversationMembershipResource extends ResourceObject {
|
|
5
|
+
type: 'ConversationMembership';
|
|
6
|
+
lastReadMessageSortKey: string;
|
|
7
|
+
muted: boolean;
|
|
8
|
+
notificationLevel: NotificationLevelValue;
|
|
9
|
+
notificationLevelDescription: NotificationLevelDescription;
|
|
10
|
+
notificationLevelOptions: Array<{
|
|
11
|
+
description: NotificationLevelDescription;
|
|
12
|
+
enabled: boolean;
|
|
13
|
+
value: NotificationLevelValue;
|
|
14
|
+
}>;
|
|
15
|
+
}
|
|
16
|
+
//# sourceMappingURL=conversation_membership.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"conversation_membership.d.ts","sourceRoot":"","sources":["../../../src/types/resources/conversation_membership.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAA;AAElD,MAAM,MAAM,sBAAsB,GAAG,YAAY,GAAG,SAAS,CAAA;AAC7D,MAAM,MAAM,4BAA4B,GAAG,MAAM,CAAA;AAEjD,MAAM,WAAW,8BAA+B,SAAQ,cAAc;IACpE,IAAI,EAAE,wBAAwB,CAAA;IAC9B,sBAAsB,EAAE,MAAM,CAAA;IAC9B,KAAK,EAAE,OAAO,CAAA;IACd,iBAAiB,EAAE,sBAAsB,CAAA;IACzC,4BAA4B,EAAE,4BAA4B,CAAA;IAC1D,wBAAwB,EAAE,KAAK,CAAC;QAC9B,WAAW,EAAE,4BAA4B,CAAA;QACzC,OAAO,EAAE,OAAO,CAAA;QAChB,KAAK,EAAE,sBAAsB,CAAA;KAC9B,CAAC,CAAA;CACH"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"conversation_membership.js","sourceRoot":"","sources":["../../../src/types/resources/conversation_membership.ts"],"names":[],"mappings":"","sourcesContent":["import { ResourceObject } from '../api_primitives'\n\nexport type NotificationLevelValue = 'everything' | 'nothing'\nexport type NotificationLevelDescription = string\n\nexport interface ConversationMembershipResource extends ResourceObject {\n type: 'ConversationMembership'\n lastReadMessageSortKey: string\n muted: boolean\n notificationLevel: NotificationLevelValue\n notificationLevelDescription: NotificationLevelDescription\n notificationLevelOptions: Array<{\n description: NotificationLevelDescription\n enabled: boolean\n value: NotificationLevelValue\n }>\n}\n"]}
|
|
@@ -1,6 +1,13 @@
|
|
|
1
1
|
import { ResourceObject } from '../api_primitives';
|
|
2
|
+
interface GroupNotificationLevelOption {
|
|
3
|
+
value: string;
|
|
4
|
+
description: string;
|
|
5
|
+
enabled: boolean;
|
|
6
|
+
}
|
|
2
7
|
export interface GroupMembership extends ResourceObject {
|
|
3
8
|
notificationLevel: string;
|
|
4
9
|
notificationLevelDescription: string;
|
|
10
|
+
notificationLevelOptions: GroupNotificationLevelOption[];
|
|
5
11
|
}
|
|
12
|
+
export {};
|
|
6
13
|
//# sourceMappingURL=group_membership.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"group_membership.d.ts","sourceRoot":"","sources":["../../../src/types/resources/group_membership.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAA;AAElD,MAAM,WAAW,eAAgB,SAAQ,cAAc;IACrD,iBAAiB,EAAE,MAAM,CAAA;IACzB,4BAA4B,EAAE,MAAM,CAAA;
|
|
1
|
+
{"version":3,"file":"group_membership.d.ts","sourceRoot":"","sources":["../../../src/types/resources/group_membership.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAA;AAElD,UAAU,4BAA4B;IACpC,KAAK,EAAE,MAAM,CAAA;IACb,WAAW,EAAE,MAAM,CAAA;IACnB,OAAO,EAAE,OAAO,CAAA;CACjB;AAED,MAAM,WAAW,eAAgB,SAAQ,cAAc;IACrD,iBAAiB,EAAE,MAAM,CAAA;IACzB,4BAA4B,EAAE,MAAM,CAAA;IACpC,wBAAwB,EAAE,4BAA4B,EAAE,CAAA;CACzD"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"group_membership.js","sourceRoot":"","sources":["../../../src/types/resources/group_membership.ts"],"names":[],"mappings":"","sourcesContent":["import { ResourceObject } from '../api_primitives'\n\nexport interface GroupMembership extends ResourceObject {\n notificationLevel: string\n notificationLevelDescription: string\n}\n"]}
|
|
1
|
+
{"version":3,"file":"group_membership.js","sourceRoot":"","sources":["../../../src/types/resources/group_membership.ts"],"names":[],"mappings":"","sourcesContent":["import { ResourceObject } from '../api_primitives'\n\ninterface GroupNotificationLevelOption {\n value: string\n description: string\n enabled: boolean\n}\n\nexport interface GroupMembership extends ResourceObject {\n notificationLevel: string\n notificationLevelDescription: string\n notificationLevelOptions: GroupNotificationLevelOption[]\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/types/resources/index.ts"],"names":[],"mappings":"AAAA,cAAc,sBAAsB,CAAA;AACpC,cAAc,gBAAgB,CAAA;AAC9B,cAAc,UAAU,CAAA;AACxB,cAAc,WAAW,CAAA;AACzB,cAAc,eAAe,CAAA;AAC7B,cAAc,UAAU,CAAA;AACxB,cAAc,UAAU,CAAA;AACxB,cAAc,aAAa,CAAA;AAC3B,cAAc,YAAY,CAAA;AAC1B,cAAc,gBAAgB,CAAA;AAC9B,cAAc,oBAAoB,CAAA;AAClC,cAAc,kBAAkB,CAAA"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/types/resources/index.ts"],"names":[],"mappings":"AAAA,cAAc,sBAAsB,CAAA;AACpC,cAAc,gBAAgB,CAAA;AAC9B,cAAc,2BAA2B,CAAA;AACzC,cAAc,UAAU,CAAA;AACxB,cAAc,WAAW,CAAA;AACzB,cAAc,eAAe,CAAA;AAC7B,cAAc,UAAU,CAAA;AACxB,cAAc,UAAU,CAAA;AACxB,cAAc,aAAa,CAAA;AAC3B,cAAc,YAAY,CAAA;AAC1B,cAAc,gBAAgB,CAAA;AAC9B,cAAc,oBAAoB,CAAA;AAClC,cAAc,kBAAkB,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/types/resources/index.ts"],"names":[],"mappings":"AAAA,cAAc,sBAAsB,CAAA;AACpC,cAAc,gBAAgB,CAAA;AAC9B,cAAc,UAAU,CAAA;AACxB,cAAc,WAAW,CAAA;AACzB,cAAc,eAAe,CAAA;AAC7B,cAAc,UAAU,CAAA;AACxB,cAAc,UAAU,CAAA;AACxB,cAAc,aAAa,CAAA;AAC3B,cAAc,YAAY,CAAA;AAC1B,cAAc,gBAAgB,CAAA;AAC9B,cAAc,oBAAoB,CAAA;AAClC,cAAc,kBAAkB,CAAA","sourcesContent":["export * from './analytics_metadata'\nexport * from './conversation'\nexport * from './member'\nexport * from './message'\nexport * from './oauth_token'\nexport * from './person'\nexport * from './groups'\nexport * from './app_grant'\nexport * from './services'\nexport * from './organization'\nexport * from './group_membership'\nexport * from './group_resource'\n"]}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/types/resources/index.ts"],"names":[],"mappings":"AAAA,cAAc,sBAAsB,CAAA;AACpC,cAAc,gBAAgB,CAAA;AAC9B,cAAc,2BAA2B,CAAA;AACzC,cAAc,UAAU,CAAA;AACxB,cAAc,WAAW,CAAA;AACzB,cAAc,eAAe,CAAA;AAC7B,cAAc,UAAU,CAAA;AACxB,cAAc,UAAU,CAAA;AACxB,cAAc,aAAa,CAAA;AAC3B,cAAc,YAAY,CAAA;AAC1B,cAAc,gBAAgB,CAAA;AAC9B,cAAc,oBAAoB,CAAA;AAClC,cAAc,kBAAkB,CAAA","sourcesContent":["export * from './analytics_metadata'\nexport * from './conversation'\nexport * from './conversation_membership'\nexport * from './member'\nexport * from './message'\nexport * from './oauth_token'\nexport * from './person'\nexport * from './groups'\nexport * from './app_grant'\nexport * from './services'\nexport * from './organization'\nexport * from './group_membership'\nexport * from './group_resource'\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"deep_snake_case_keys.d.ts","sourceRoot":"","sources":["../../src/utils/deep_snake_case_keys.ts"],"names":[],"mappings":"AAEA,KAAK,OAAO,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,OAAO,EAAE,GAAG,OAAO,CAAA;AAE5D,wBAAgB,iBAAiB,CAAC,CAAC,SAAS,OAAO,EAAE,GAAG,EAAE,CAAC,GAAG,CAAC,CAW9D"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { isArray, isObject, mapKeys, mapValues, snakeCase } from 'lodash';
|
|
2
|
+
export function deepSnakeCaseKeys(obj) {
|
|
3
|
+
if (isArray(obj)) {
|
|
4
|
+
return obj.map(deepSnakeCaseKeys);
|
|
5
|
+
}
|
|
6
|
+
else if (isObject(obj)) {
|
|
7
|
+
return mapValues(
|
|
8
|
+
// @ts-ignore This mutates the object, but we don't care about the type here
|
|
9
|
+
mapKeys(obj, (_value, key) => snakeCase(key)), deepSnakeCaseKeys);
|
|
10
|
+
}
|
|
11
|
+
return obj;
|
|
12
|
+
}
|
|
13
|
+
//# sourceMappingURL=deep_snake_case_keys.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"deep_snake_case_keys.js","sourceRoot":"","sources":["../../src/utils/deep_snake_case_keys.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,QAAQ,CAAA;AAIzE,MAAM,UAAU,iBAAiB,CAAoB,GAAM;IACzD,IAAI,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC;QACjB,OAAO,GAAG,CAAC,GAAG,CAAC,iBAAiB,CAAM,CAAA;IACxC,CAAC;SAAM,IAAI,QAAQ,CAAC,GAAG,CAAC,EAAE,CAAC;QACzB,OAAO,SAAS;QACd,4EAA4E;QAC5E,OAAO,CAAC,GAAG,EAAE,CAAC,MAAc,EAAE,GAAW,EAAE,EAAE,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC,EAC7D,iBAAiB,CACb,CAAA;IACR,CAAC;IACD,OAAO,GAAG,CAAA;AACZ,CAAC","sourcesContent":["import { isArray, isObject, mapKeys, mapValues, snakeCase } from 'lodash'\n\ntype ObjType = Record<string, unknown> | unknown[] | unknown\n\nexport function deepSnakeCaseKeys<T extends ObjType>(obj: T): T {\n if (isArray(obj)) {\n return obj.map(deepSnakeCaseKeys) as T\n } else if (isObject(obj)) {\n return mapValues(\n // @ts-ignore This mutates the object, but we don't care about the type here\n mapKeys(obj, (_value: string, key: string) => snakeCase(key)),\n deepSnakeCaseKeys\n ) as T\n }\n return obj\n}\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@planningcenter/chat-react-native",
|
|
3
|
-
"version": "3.24.
|
|
3
|
+
"version": "3.24.5-qa-563.0",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "build/index.js",
|
|
6
6
|
"types": "build/index.d.ts",
|
|
@@ -59,5 +59,5 @@
|
|
|
59
59
|
"react-native-url-polyfill": "^2.0.0",
|
|
60
60
|
"typescript": "<5.6.0"
|
|
61
61
|
},
|
|
62
|
-
"gitHead": "
|
|
62
|
+
"gitHead": "64bf5a6d6851254f119ee95474ef8033a7f6deb8"
|
|
63
63
|
}
|