@planningcenter/chat-react-native 4.6.0-rc.5 → 4.6.0-rc.7
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_list.d.ts.map +1 -1
- package/build/components/conversation/message_list.js +155 -123
- package/build/components/conversation/message_list.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/components/display/conversation_avatar.d.ts +3 -1
- package/build/components/display/conversation_avatar.d.ts.map +1 -1
- package/build/components/display/conversation_avatar.js +77 -66
- package/build/components/display/conversation_avatar.js.map +1 -1
- package/build/components/display/keyboard_scroll_view.d.ts.map +1 -1
- package/build/components/display/keyboard_scroll_view.js +1 -0
- package/build/components/display/keyboard_scroll_view.js.map +1 -1
- package/build/hooks/use_conversation_avatar_update.d.ts +4 -3
- package/build/hooks/use_conversation_avatar_update.d.ts.map +1 -1
- package/build/hooks/use_conversation_avatar_update.js +146 -48
- package/build/hooks/use_conversation_avatar_update.js.map +1 -1
- package/build/navigation/index.d.ts.map +1 -1
- package/build/navigation/index.js +3 -1
- package/build/navigation/index.js.map +1 -1
- package/build/screens/age_check/age_check_required_screen.d.ts.map +1 -1
- package/build/screens/age_check/age_check_required_screen.js +1 -0
- package/build/screens/age_check/age_check_required_screen.js.map +1 -1
- package/build/screens/avatar_picker/avatar_picker_screen.d.ts.map +1 -1
- package/build/screens/avatar_picker/avatar_picker_screen.js +76 -66
- package/build/screens/avatar_picker/avatar_picker_screen.js.map +1 -1
- package/build/screens/conversation_details_screen.d.ts.map +1 -1
- package/build/screens/conversation_details_screen.js +1 -0
- package/build/screens/conversation_details_screen.js.map +1 -1
- package/build/screens/conversation_new/components/form_list.d.ts.map +1 -1
- package/build/screens/conversation_new/components/form_list.js +1 -0
- package/build/screens/conversation_new/components/form_list.js.map +1 -1
- package/build/screens/conversation_select_recipients/conversation_new_entry_screen.d.ts.map +1 -1
- package/build/screens/conversation_select_recipients/conversation_new_entry_screen.js +1 -0
- package/build/screens/conversation_select_recipients/conversation_new_entry_screen.js.map +1 -1
- package/build/screens/conversation_select_recipients/conversation_select_direct_message_recipients_screen.js +68 -62
- package/build/screens/conversation_select_recipients/conversation_select_direct_message_recipients_screen.js.map +1 -1
- package/build/screens/conversation_select_recipients/conversation_select_group_recipients_screen.d.ts.map +1 -1
- package/build/screens/conversation_select_recipients/conversation_select_group_recipients_screen.js +1 -0
- package/build/screens/conversation_select_recipients/conversation_select_group_recipients_screen.js.map +1 -1
- package/build/screens/conversation_select_recipients/conversation_select_teams_i_lead_recipients_screen.d.ts.map +1 -1
- package/build/screens/conversation_select_recipients/conversation_select_teams_i_lead_recipients_screen.js +1 -0
- package/build/screens/conversation_select_recipients/conversation_select_teams_i_lead_recipients_screen.js.map +1 -1
- package/build/screens/get_help_screen.js +56 -62
- package/build/screens/get_help_screen.js.map +1 -1
- package/build/screens/group_notification_settings_screen.js +3 -2
- package/build/screens/group_notification_settings_screen.js.map +1 -1
- package/build/screens/notification_settings_screen.d.ts.map +1 -1
- package/build/screens/notification_settings_screen.js +1 -0
- package/build/screens/notification_settings_screen.js.map +1 -1
- package/build/screens/preferred_app_selection_screen.js +45 -39
- package/build/screens/preferred_app_selection_screen.js.map +1 -1
- package/build/screens/search/components/search_results_list.d.ts.map +1 -1
- package/build/screens/search/components/search_results_list.js +1 -0
- package/build/screens/search/components/search_results_list.js.map +1 -1
- package/build/screens/settings_screen.d.ts.map +1 -1
- package/build/screens/settings_screen.js +7 -6
- package/build/screens/settings_screen.js.map +1 -1
- package/package.json +2 -2
- package/src/__utils__/render_with_query_client.tsx +13 -0
- package/src/components/conversation/__tests__/message_list.test.tsx +4 -0
- package/src/components/conversation/message_list.tsx +6 -0
- package/src/components/conversations/__tests__/conversation_preview.test.tsx +2 -2
- package/src/components/conversations/conversations.tsx +1 -0
- package/src/components/display/__tests__/conversation_avatar.test.tsx +94 -0
- package/src/components/display/conversation_avatar.tsx +9 -2
- package/src/components/display/keyboard_scroll_view.tsx +1 -0
- package/src/hooks/__tests__/use_conversation_avatar_update.test.tsx +40 -0
- package/src/hooks/use_conversation_avatar_update.ts +67 -11
- package/src/navigation/index.tsx +6 -2
- package/src/screens/age_check/age_check_required_screen.tsx +5 -1
- package/src/screens/avatar_picker/__tests__/avatar_picker_screen.test.tsx +67 -0
- package/src/screens/avatar_picker/avatar_picker_screen.tsx +7 -1
- package/src/screens/conversation_details_screen.tsx +1 -0
- package/src/screens/conversation_new/components/form_list.tsx +1 -0
- package/src/screens/conversation_select_recipients/conversation_new_entry_screen.tsx +4 -1
- package/src/screens/conversation_select_recipients/conversation_select_direct_message_recipients_screen.tsx +1 -0
- package/src/screens/conversation_select_recipients/conversation_select_group_recipients_screen.tsx +1 -0
- package/src/screens/conversation_select_recipients/conversation_select_teams_i_lead_recipients_screen.tsx +1 -0
- package/src/screens/get_help_screen.tsx +4 -4
- package/src/screens/group_notification_settings_screen.tsx +3 -3
- package/src/screens/notification_settings_screen.tsx +1 -0
- package/src/screens/preferred_app_selection_screen.tsx +4 -4
- package/src/screens/search/__tests__/search_screen.test.tsx +6 -5
- package/src/screens/search/components/__tests__/conversation_results.test.tsx +14 -5
- package/src/screens/search/components/__tests__/message_result_row.test.tsx +5 -4
- package/src/screens/search/components/__tests__/search_results_list.test.tsx +4 -3
- package/src/screens/search/components/search_results_list.tsx +1 -0
- package/src/screens/settings_screen.tsx +25 -25
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { c as _c } from "react/compiler-runtime";
|
|
2
2
|
import React from 'react';
|
|
3
|
+
import { applyAvatarUpdate, usePendingConversationAvatarUpdate } from '../../hooks/use_conversation_avatar_update';
|
|
3
4
|
import AvatarPrimitive from '../primitive/avatar_primitive';
|
|
4
5
|
import { AvatarGroup } from './avatar_group';
|
|
5
6
|
import { EmojiAvatar } from './emoji_avatar';
|
|
@@ -32,7 +33,7 @@ function resolveAvatar(conversation) {
|
|
|
32
33
|
};
|
|
33
34
|
}
|
|
34
35
|
export function ConversationAvatar(t0) {
|
|
35
|
-
const $ = _c(
|
|
36
|
+
const $ = _c(29);
|
|
36
37
|
const {
|
|
37
38
|
conversation,
|
|
38
39
|
size: t1,
|
|
@@ -44,123 +45,133 @@ export function ConversationAvatar(t0) {
|
|
|
44
45
|
const size = t1 === undefined ? "lg" : t1;
|
|
45
46
|
const showFallback = t2 === undefined ? false : t2;
|
|
46
47
|
const fallbackIconName = t3 === undefined ? "general.person" : t3;
|
|
48
|
+
const pendingUpdate = usePendingConversationAvatarUpdate(conversation.id);
|
|
47
49
|
let t4;
|
|
48
|
-
if ($[0] !== conversation) {
|
|
49
|
-
t4 =
|
|
50
|
+
if ($[0] !== conversation || $[1] !== pendingUpdate) {
|
|
51
|
+
t4 = pendingUpdate ? applyAvatarUpdate(conversation, pendingUpdate) : conversation;
|
|
50
52
|
$[0] = conversation;
|
|
51
|
-
$[1] =
|
|
53
|
+
$[1] = pendingUpdate;
|
|
54
|
+
$[2] = t4;
|
|
52
55
|
} else {
|
|
53
|
-
t4 = $[
|
|
56
|
+
t4 = $[2];
|
|
54
57
|
}
|
|
55
|
-
const avatar = t4;
|
|
56
58
|
let t5;
|
|
57
|
-
if ($[
|
|
58
|
-
t5 =
|
|
59
|
+
if ($[3] !== t4) {
|
|
60
|
+
t5 = resolveAvatar(t4);
|
|
61
|
+
$[3] = t4;
|
|
62
|
+
$[4] = t5;
|
|
63
|
+
} else {
|
|
64
|
+
t5 = $[4];
|
|
65
|
+
}
|
|
66
|
+
const avatar = t5;
|
|
67
|
+
let t6;
|
|
68
|
+
if ($[5] !== maxFontSizeMultiplier || $[6] !== size || $[7] !== style) {
|
|
69
|
+
t6 = {
|
|
59
70
|
size,
|
|
60
71
|
maxFontSizeMultiplier,
|
|
61
72
|
style
|
|
62
73
|
};
|
|
63
|
-
$[
|
|
64
|
-
$[
|
|
65
|
-
$[
|
|
66
|
-
$[
|
|
74
|
+
$[5] = maxFontSizeMultiplier;
|
|
75
|
+
$[6] = size;
|
|
76
|
+
$[7] = style;
|
|
77
|
+
$[8] = t6;
|
|
67
78
|
} else {
|
|
68
|
-
|
|
79
|
+
t6 = $[8];
|
|
69
80
|
}
|
|
70
|
-
const sizeProps =
|
|
81
|
+
const sizeProps = t6;
|
|
71
82
|
switch (avatar.kind) {
|
|
72
83
|
case "image":
|
|
73
84
|
{
|
|
74
|
-
let
|
|
75
|
-
if ($[
|
|
76
|
-
|
|
85
|
+
let t7;
|
|
86
|
+
if ($[9] !== avatar.url) {
|
|
87
|
+
t7 = /*#__PURE__*/_jsx(AvatarPrimitive.Mask, {
|
|
77
88
|
children: /*#__PURE__*/_jsx(AvatarPrimitive.Image, {
|
|
78
89
|
sourceUri: avatar.url
|
|
79
90
|
})
|
|
80
91
|
});
|
|
81
|
-
$[
|
|
82
|
-
$[
|
|
92
|
+
$[9] = avatar.url;
|
|
93
|
+
$[10] = t7;
|
|
83
94
|
} else {
|
|
84
|
-
|
|
95
|
+
t7 = $[10];
|
|
85
96
|
}
|
|
86
|
-
let
|
|
87
|
-
if ($[
|
|
88
|
-
|
|
97
|
+
let t8;
|
|
98
|
+
if ($[11] !== sizeProps || $[12] !== t7) {
|
|
99
|
+
t8 = /*#__PURE__*/_jsx(AvatarPrimitive.Root, {
|
|
89
100
|
...sizeProps,
|
|
90
|
-
children:
|
|
101
|
+
children: t7
|
|
91
102
|
});
|
|
92
|
-
$[
|
|
93
|
-
$[
|
|
94
|
-
$[
|
|
103
|
+
$[11] = sizeProps;
|
|
104
|
+
$[12] = t7;
|
|
105
|
+
$[13] = t8;
|
|
95
106
|
} else {
|
|
96
|
-
|
|
107
|
+
t8 = $[13];
|
|
97
108
|
}
|
|
98
|
-
return
|
|
109
|
+
return t8;
|
|
99
110
|
}
|
|
100
111
|
case "icon":
|
|
101
112
|
{
|
|
102
|
-
let
|
|
103
|
-
if ($[
|
|
104
|
-
|
|
113
|
+
let t7;
|
|
114
|
+
if ($[14] !== avatar.color || $[15] !== avatar.iconKey || $[16] !== sizeProps) {
|
|
115
|
+
t7 = /*#__PURE__*/_jsx(IconAvatar, {
|
|
105
116
|
iconKey: avatar.iconKey,
|
|
106
117
|
color: avatar.color,
|
|
107
118
|
...sizeProps
|
|
108
119
|
});
|
|
109
|
-
$[
|
|
110
|
-
$[
|
|
111
|
-
$[
|
|
112
|
-
$[
|
|
120
|
+
$[14] = avatar.color;
|
|
121
|
+
$[15] = avatar.iconKey;
|
|
122
|
+
$[16] = sizeProps;
|
|
123
|
+
$[17] = t7;
|
|
113
124
|
} else {
|
|
114
|
-
|
|
125
|
+
t7 = $[17];
|
|
115
126
|
}
|
|
116
|
-
return
|
|
127
|
+
return t7;
|
|
117
128
|
}
|
|
118
129
|
case "emoji":
|
|
119
130
|
{
|
|
120
|
-
let
|
|
121
|
-
if ($[
|
|
122
|
-
|
|
131
|
+
let t7;
|
|
132
|
+
if ($[18] !== avatar.color || $[19] !== avatar.emoji || $[20] !== sizeProps) {
|
|
133
|
+
t7 = /*#__PURE__*/_jsx(EmojiAvatar, {
|
|
123
134
|
emoji: avatar.emoji,
|
|
124
135
|
color: avatar.color,
|
|
125
136
|
...sizeProps
|
|
126
137
|
});
|
|
127
|
-
$[
|
|
128
|
-
$[
|
|
129
|
-
$[
|
|
130
|
-
$[
|
|
138
|
+
$[18] = avatar.color;
|
|
139
|
+
$[19] = avatar.emoji;
|
|
140
|
+
$[20] = sizeProps;
|
|
141
|
+
$[21] = t7;
|
|
131
142
|
} else {
|
|
132
|
-
|
|
143
|
+
t7 = $[21];
|
|
133
144
|
}
|
|
134
|
-
return
|
|
145
|
+
return t7;
|
|
135
146
|
}
|
|
136
147
|
case "group":
|
|
137
148
|
{
|
|
138
|
-
let
|
|
139
|
-
if ($[
|
|
140
|
-
|
|
141
|
-
$[
|
|
142
|
-
$[
|
|
149
|
+
let t7;
|
|
150
|
+
if ($[22] !== avatar.sources) {
|
|
151
|
+
t7 = avatar.sources || [];
|
|
152
|
+
$[22] = avatar.sources;
|
|
153
|
+
$[23] = t7;
|
|
143
154
|
} else {
|
|
144
|
-
|
|
155
|
+
t7 = $[23];
|
|
145
156
|
}
|
|
146
|
-
const
|
|
147
|
-
let
|
|
148
|
-
if ($[
|
|
149
|
-
|
|
150
|
-
sourceUris:
|
|
151
|
-
showFallback:
|
|
157
|
+
const t8 = showFallback || !avatar.sources || avatar.sources.length === 0;
|
|
158
|
+
let t9;
|
|
159
|
+
if ($[24] !== fallbackIconName || $[25] !== sizeProps || $[26] !== t7 || $[27] !== t8) {
|
|
160
|
+
t9 = /*#__PURE__*/_jsx(AvatarGroup, {
|
|
161
|
+
sourceUris: t7,
|
|
162
|
+
showFallback: t8,
|
|
152
163
|
fallbackIconName: fallbackIconName,
|
|
153
164
|
...sizeProps
|
|
154
165
|
});
|
|
155
|
-
$[
|
|
156
|
-
$[
|
|
157
|
-
$[
|
|
158
|
-
$[
|
|
159
|
-
$[
|
|
166
|
+
$[24] = fallbackIconName;
|
|
167
|
+
$[25] = sizeProps;
|
|
168
|
+
$[26] = t7;
|
|
169
|
+
$[27] = t8;
|
|
170
|
+
$[28] = t9;
|
|
160
171
|
} else {
|
|
161
|
-
|
|
172
|
+
t9 = $[28];
|
|
162
173
|
}
|
|
163
|
-
return
|
|
174
|
+
return t9;
|
|
164
175
|
}
|
|
165
176
|
}
|
|
166
177
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"conversation_avatar.js","names":["React","AvatarPrimitive","AvatarGroup","EmojiAvatar","IconAvatar","jsx","_jsx","resolveAvatar","conversation","customAvatarType","customAvatarImageUrl","kind","url","customAvatarKey","iconKey","color","customAvatarColor","emoji","sources","previewAvatarUrls","ConversationAvatar","t0","$","_c","size","t1","showFallback","t2","fallbackIconName","t3","style","maxFontSizeMultiplier","undefined","t4","avatar","
|
|
1
|
+
{"version":3,"file":"conversation_avatar.js","names":["React","applyAvatarUpdate","usePendingConversationAvatarUpdate","AvatarPrimitive","AvatarGroup","EmojiAvatar","IconAvatar","jsx","_jsx","resolveAvatar","conversation","customAvatarType","customAvatarImageUrl","kind","url","customAvatarKey","iconKey","color","customAvatarColor","emoji","sources","previewAvatarUrls","ConversationAvatar","t0","$","_c","size","t1","showFallback","t2","fallbackIconName","t3","style","maxFontSizeMultiplier","undefined","pendingUpdate","id","t4","t5","avatar","t6","sizeProps","t7","Mask","children","Image","sourceUri","t8","Root","length","t9","sourceUris"],"sources":["../../../src/components/display/conversation_avatar.tsx"],"sourcesContent":["import React from 'react'\nimport type { ViewStyle } from 'react-native'\nimport {\n applyAvatarUpdate,\n usePendingConversationAvatarUpdate,\n} from '../../hooks/use_conversation_avatar_update'\nimport type { ConversationAvatarData } from '../../types'\nimport AvatarPrimitive, { type AvatarRootProps } from '../primitive/avatar_primitive'\nimport { AvatarGroup } from './avatar_group'\nimport { EmojiAvatar } from './emoji_avatar'\nimport { type IconString } from './icon'\nimport { IconAvatar } from './icon_avatar'\n\ntype ResolvedAvatar =\n | { kind: 'image'; url: string }\n | { kind: 'icon'; iconKey: string; color: string | null }\n | { kind: 'emoji'; emoji: string; color: string | null }\n | { kind: 'group'; sources: string[] | undefined }\n\nfunction resolveAvatar(conversation: ConversationAvatarData): ResolvedAvatar {\n if (conversation.customAvatarType === 'image' && conversation.customAvatarImageUrl) {\n return { kind: 'image', url: conversation.customAvatarImageUrl }\n }\n\n if (conversation.customAvatarType === 'icon' && conversation.customAvatarKey) {\n return {\n kind: 'icon',\n iconKey: conversation.customAvatarKey,\n color: conversation.customAvatarColor ?? null,\n }\n }\n\n if (conversation.customAvatarType === 'emoji' && conversation.customAvatarKey) {\n return {\n kind: 'emoji',\n emoji: conversation.customAvatarKey,\n color: conversation.customAvatarColor ?? null,\n }\n }\n\n return { kind: 'group', sources: conversation.previewAvatarUrls }\n}\n\ninterface ConversationAvatarProps {\n conversation: ConversationAvatarData & { id?: number }\n size?: AvatarRootProps['size']\n showFallback?: boolean\n fallbackIconName?: IconString\n style?: ViewStyle\n maxFontSizeMultiplier?: AvatarRootProps['maxFontSizeMultiplier']\n}\n\nexport function ConversationAvatar({\n conversation,\n size = 'lg',\n showFallback = false,\n fallbackIconName = 'general.person',\n style,\n maxFontSizeMultiplier,\n}: ConversationAvatarProps) {\n const pendingUpdate = usePendingConversationAvatarUpdate(conversation.id)\n const avatar = resolveAvatar(\n pendingUpdate ? applyAvatarUpdate(conversation, pendingUpdate) : conversation\n )\n const sizeProps = { size, maxFontSizeMultiplier, style }\n\n switch (avatar.kind) {\n case 'image':\n return (\n <AvatarPrimitive.Root {...sizeProps}>\n <AvatarPrimitive.Mask>\n <AvatarPrimitive.Image sourceUri={avatar.url} />\n </AvatarPrimitive.Mask>\n </AvatarPrimitive.Root>\n )\n case 'icon':\n return <IconAvatar iconKey={avatar.iconKey} color={avatar.color} {...sizeProps} />\n case 'emoji':\n return <EmojiAvatar emoji={avatar.emoji} color={avatar.color} {...sizeProps} />\n case 'group':\n return (\n <AvatarGroup\n sourceUris={avatar.sources || []}\n showFallback={showFallback || !avatar.sources || avatar.sources.length === 0}\n fallbackIconName={fallbackIconName}\n {...sizeProps}\n />\n )\n }\n}\n"],"mappings":";AAAA,OAAOA,KAAK,MAAM,OAAO;AAEzB,SACEC,iBAAiB,EACjBC,kCAAkC,QAC7B,4CAA4C;AAEnD,OAAOC,eAAe,MAAgC,+BAA+B;AACrF,SAASC,WAAW,QAAQ,gBAAgB;AAC5C,SAASC,WAAW,QAAQ,gBAAgB;AAE5C,SAASC,UAAU,QAAQ,eAAe;AAAA,SAAAC,GAAA,IAAAC,IAAA;AAQ1C,SAASC,aAAaA,CAACC,YAAoC,EAAkB;EAC3E,IAAIA,YAAY,CAACC,gBAAgB,KAAK,OAAO,IAAID,YAAY,CAACE,oBAAoB,EAAE;IAClF,OAAO;MAAEC,IAAI,EAAE,OAAO;MAAEC,GAAG,EAAEJ,YAAY,CAACE;IAAqB,CAAC;EAClE;EAEA,IAAIF,YAAY,CAACC,gBAAgB,KAAK,MAAM,IAAID,YAAY,CAACK,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
{"version":3,"file":"keyboard_scroll_view.d.ts","sourceRoot":"","sources":["../../../src/components/display/keyboard_scroll_view.tsx"],"names":[],"mappings":"AACA,OAAO,EAAwB,eAAe,EAAa,MAAM,cAAc,CAAA;AAK/E,KAAK,uBAAuB,GAAG,IAAI,CAAC,eAAe,EAAE,UAAU,GAAG,uBAAuB,CAAC,CAAA;AAE1F,wBAAgB,kBAAkB,CAAC,EAAE,QAAQ,EAAE,qBAAqB,EAAE,EAAE,uBAAuB,2CA8C9F"}
|
|
@@ -53,6 +53,7 @@ export function KeyboardScrollView(t0) {
|
|
|
53
53
|
t2 = /*#__PURE__*/_jsx(KeyboardView, {
|
|
54
54
|
children: /*#__PURE__*/_jsx(ScrollView, {
|
|
55
55
|
ref: scrollViewRef,
|
|
56
|
+
contentInsetAdjustmentBehavior: "automatic",
|
|
56
57
|
contentContainerStyle: contentContainerStyle,
|
|
57
58
|
onLayout: scrollFocusedInputIntoView,
|
|
58
59
|
onContentSizeChange: scrollFocusedInputIntoView,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"keyboard_scroll_view.js","names":["React","useCallback","useRef","Keyboard","ScrollView","TextInput","KeyboardView","jsx","_jsx","FOCUSED_INPUT_BOTTOM_MARGIN","KeyboardScrollView","t0","$","_c","children","contentContainerStyle","scrollViewRef","t1","Symbol","for","scrollView","current","input","State","currentlyFocusedInput","nativeScrollView","getNativeScrollRef","innerView","getInnerViewRef","measureInWindow","_scrollX","scrollTop","_scrollWidth","scrollHeight","keyboardTop","metrics","screenY","scrollBottom","visibleBottom","undefined","Math","min","visibleHeight","_inputX","inputTop","_inputWidth","inputHeight","inputBottom","measureLayout","_left","contentTop","_contentWidth","contentHeight","scrollTo","y","animated","scrollFocusedInputIntoView","t2"],"sources":["../../../src/components/display/keyboard_scroll_view.tsx"],"sourcesContent":["import React, { useCallback, useRef } from 'react'\nimport { Keyboard, ScrollView, ScrollViewProps, TextInput } from 'react-native'\nimport { KeyboardView } from './keyboard_view'\n\nconst FOCUSED_INPUT_BOTTOM_MARGIN = 32\n\ntype KeyboardScrollViewProps = Pick<ScrollViewProps, 'children' | 'contentContainerStyle'>\n\nexport function KeyboardScrollView({ children, contentContainerStyle }: KeyboardScrollViewProps) {\n const scrollViewRef = useRef<ScrollView>(null)\n\n const scrollFocusedInputIntoView = useCallback(() => {\n const scrollView = scrollViewRef.current\n const input = TextInput.State.currentlyFocusedInput()\n if (!scrollView || !input) return\n\n const nativeScrollView = scrollView.getNativeScrollRef()\n const innerView = scrollView.getInnerViewRef()\n if (!nativeScrollView || !innerView) return\n\n nativeScrollView.measureInWindow((_scrollX, scrollTop, _scrollWidth, scrollHeight) => {\n const keyboardTop = Keyboard.metrics()?.screenY\n const scrollBottom = scrollTop + scrollHeight\n const visibleBottom =\n keyboardTop === undefined ? scrollBottom : Math.min(scrollBottom, keyboardTop)\n const visibleHeight = visibleBottom - scrollTop\n\n input.measureInWindow((_inputX, inputTop, _inputWidth, inputHeight) => {\n const inputBottom = inputTop + inputHeight + FOCUSED_INPUT_BOTTOM_MARGIN\n if (inputBottom <= visibleBottom) return\n\n input.measureLayout(innerView, (_left, contentTop, _contentWidth, contentHeight) => {\n scrollView.scrollTo({\n y: contentTop + contentHeight + FOCUSED_INPUT_BOTTOM_MARGIN - visibleHeight,\n animated: true,\n })\n })\n })\n })\n }, [])\n\n return (\n <KeyboardView>\n <ScrollView\n ref={scrollViewRef}\n contentContainerStyle={contentContainerStyle}\n onLayout={scrollFocusedInputIntoView}\n onContentSizeChange={scrollFocusedInputIntoView}\n >\n {children}\n </ScrollView>\n </KeyboardView>\n )\n}\n"],"mappings":";AAAA,OAAOA,KAAK,IAAIC,WAAW,EAAEC,MAAM,QAAQ,OAAO;AAClD,SAASC,QAAQ,EAAEC,UAAU,EAAmBC,SAAS,QAAQ,cAAc;AAC/E,SAASC,YAAY,QAAQ,iBAAiB;AAAA,SAAAC,GAAA,IAAAC,IAAA;AAE9C,MAAMC,2BAA2B,GAAG,EAAE;AAIt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AA0B,aAAc,CAACrB,SAAS,EAAE,CAAAsB,KAAA,EAAAC,UAAA,EAAAC,aAAA,EAAAC,aAAA;YAC7BhC,UAAU,CAAAiC,QAAS,CAAC;cAAAC,CAAA,EACfJ,UAAU,GAAGE,aAAa,GAAG3C,2BAA2B,GAAGiC,aAAa;cAAAa,QAAA,EACjE;YACZ,CAAC,CAAC;UAAA,CACH,CAAC;QAAA,CACH,CAAC;MAAA,CACH,CAAC;IAAA,CACH;IAAA3C,CAAA,MAAAK,EAAA;EAAA;IAAAA,EAAA,GAAAL,CAAA;EAAA;EA5BD,MAAA4C,0BAAA,GAAmCvC,EA4B7B;EAAA,IAAAwC,EAAA;EAAA,IAAA7C,CAAA,QAAAE,QAAA,IAAAF,CAAA,QAAAG,qBAAA;IAGJ0C,EAAA,gBAAAjD,IAAA,CAACF,YAAY;MAAAQ,QAAA,eACXN,IAAA,CAACJ,UAAU;QACJY,GAAa,EAAbA,aAAa;
|
|
1
|
+
{"version":3,"file":"keyboard_scroll_view.js","names":["React","useCallback","useRef","Keyboard","ScrollView","TextInput","KeyboardView","jsx","_jsx","FOCUSED_INPUT_BOTTOM_MARGIN","KeyboardScrollView","t0","$","_c","children","contentContainerStyle","scrollViewRef","t1","Symbol","for","scrollView","current","input","State","currentlyFocusedInput","nativeScrollView","getNativeScrollRef","innerView","getInnerViewRef","measureInWindow","_scrollX","scrollTop","_scrollWidth","scrollHeight","keyboardTop","metrics","screenY","scrollBottom","visibleBottom","undefined","Math","min","visibleHeight","_inputX","inputTop","_inputWidth","inputHeight","inputBottom","measureLayout","_left","contentTop","_contentWidth","contentHeight","scrollTo","y","animated","scrollFocusedInputIntoView","t2","contentInsetAdjustmentBehavior"],"sources":["../../../src/components/display/keyboard_scroll_view.tsx"],"sourcesContent":["import React, { useCallback, useRef } from 'react'\nimport { Keyboard, ScrollView, ScrollViewProps, TextInput } from 'react-native'\nimport { KeyboardView } from './keyboard_view'\n\nconst FOCUSED_INPUT_BOTTOM_MARGIN = 32\n\ntype KeyboardScrollViewProps = Pick<ScrollViewProps, 'children' | 'contentContainerStyle'>\n\nexport function KeyboardScrollView({ children, contentContainerStyle }: KeyboardScrollViewProps) {\n const scrollViewRef = useRef<ScrollView>(null)\n\n const scrollFocusedInputIntoView = useCallback(() => {\n const scrollView = scrollViewRef.current\n const input = TextInput.State.currentlyFocusedInput()\n if (!scrollView || !input) return\n\n const nativeScrollView = scrollView.getNativeScrollRef()\n const innerView = scrollView.getInnerViewRef()\n if (!nativeScrollView || !innerView) return\n\n nativeScrollView.measureInWindow((_scrollX, scrollTop, _scrollWidth, scrollHeight) => {\n const keyboardTop = Keyboard.metrics()?.screenY\n const scrollBottom = scrollTop + scrollHeight\n const visibleBottom =\n keyboardTop === undefined ? scrollBottom : Math.min(scrollBottom, keyboardTop)\n const visibleHeight = visibleBottom - scrollTop\n\n input.measureInWindow((_inputX, inputTop, _inputWidth, inputHeight) => {\n const inputBottom = inputTop + inputHeight + FOCUSED_INPUT_BOTTOM_MARGIN\n if (inputBottom <= visibleBottom) return\n\n input.measureLayout(innerView, (_left, contentTop, _contentWidth, contentHeight) => {\n scrollView.scrollTo({\n y: contentTop + contentHeight + FOCUSED_INPUT_BOTTOM_MARGIN - visibleHeight,\n animated: true,\n })\n })\n })\n })\n }, [])\n\n return (\n <KeyboardView>\n <ScrollView\n ref={scrollViewRef}\n contentInsetAdjustmentBehavior=\"automatic\"\n contentContainerStyle={contentContainerStyle}\n onLayout={scrollFocusedInputIntoView}\n onContentSizeChange={scrollFocusedInputIntoView}\n >\n {children}\n </ScrollView>\n </KeyboardView>\n )\n}\n"],"mappings":";AAAA,OAAOA,KAAK,IAAIC,WAAW,EAAEC,MAAM,QAAQ,OAAO;AAClD,SAASC,QAAQ,EAAEC,UAAU,EAAmBC,SAAS,QAAQ,cAAc;AAC/E,SAASC,YAAY,QAAQ,iBAAiB;AAAA,SAAAC,GAAA,IAAAC,IAAA;AAE9C,MAAMC,2BAA2B,GAAG,EAAE;AAItC,OAAO,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Ac,CAACrB,SAAS,EAAE,CAAAsB,KAAA,EAAAC,UAAA,EAAAC,aAAA,EAAAC,aAAA;YAC7BhC,UAAU,CAAAiC,QAAS,CAAC;cAAAC,CAAA,EACfJ,UAAU,GAAGE,aAAa,GAAG3C,2BAA2B,GAAGiC,aAAa;cAAAa,QAAA,EACjE;YACZ,CAAC,CAAC;UAAA,CACH,CAAC;QAAA,CACH,CAAC;MAAA,CACH,CAAC;IAAA,CACH;IAAA3C,CAAA,MAAAK,EAAA;EAAA;IAAAA,EAAA,GAAAL,CAAA;EAAA;EA5BD,MAAA4C,0BAAA,GAAmCvC,EA4B7B;EAAA,IAAAwC,EAAA;EAAA,IAAA7C,CAAA,QAAAE,QAAA,IAAAF,CAAA,QAAAG,qBAAA;IAGJ0C,EAAA,gBAAAjD,IAAA,CAACF,YAAY;MAAAQ,QAAA,eACXN,IAAA,CAACJ,UAAU;QACJY,GAAa,EAAbA,aAAa;QACa0C,8BAAW,EAAX,WAAW;QACnB3C,qBAAqB,EAArBA,qBAAqB;QAClCyC,QAA0B,EAA1BA,0BAA0B;QACfA,mBAA0B,EAA1BA,0BAA0B;QAAA1C,QAAA,EAE9CA;MAAQ,CACC;IAAC,CACD,CAAC;IAAAF,CAAA,MAAAE,QAAA;IAAAF,CAAA,MAAAG,qBAAA;IAAAH,CAAA,MAAA6C,EAAA;EAAA;IAAAA,EAAA,GAAA7C,CAAA;EAAA;EAAA,OAVf6C,EAUe;AAAA","ignoreList":[]}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import type { ConversationResource } from '../types';
|
|
2
|
-
import type { ApiResource } from '../types';
|
|
1
|
+
import type { ApiResource, ConversationAvatarData, ConversationResource } from '../types';
|
|
3
2
|
import type { ImagePickerAsset } from '../utils/native_adapters/image_picker';
|
|
4
3
|
import { ApiClient } from './use_api_client';
|
|
5
4
|
import { useUploadClient } from './use_upload_client';
|
|
@@ -15,12 +14,14 @@ export type AvatarUpdatePayload = {
|
|
|
15
14
|
} | {
|
|
16
15
|
kind: 'clear';
|
|
17
16
|
};
|
|
17
|
+
export declare const usePendingConversationAvatarUpdate: (conversationId: number | undefined) => AvatarUpdatePayload | undefined;
|
|
18
18
|
export declare const useConversationAvatarUpdate: ({ conversationId }: {
|
|
19
19
|
conversationId: number;
|
|
20
|
-
}) => import("@tanstack/react-query").UseMutationResult<ApiResource<ConversationResource
|
|
20
|
+
}) => import("@tanstack/react-query").UseMutationResult<ApiResource<ConversationResource> | null, Error, AvatarUpdatePayload, {
|
|
21
21
|
previous: ApiResource<ConversationResource> | undefined;
|
|
22
22
|
}>;
|
|
23
23
|
export declare function patchConversationAvatar(apiClient: ApiClient, uploadClient: ReturnType<typeof useUploadClient>, conversationId: number, payload: Exclude<AvatarUpdatePayload, {
|
|
24
24
|
kind: 'clear';
|
|
25
25
|
}>): Promise<void>;
|
|
26
|
+
export declare function applyAvatarUpdate<T extends ConversationAvatarData>(data: T, payload: AvatarUpdatePayload): T;
|
|
26
27
|
//# sourceMappingURL=use_conversation_avatar_update.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use_conversation_avatar_update.d.ts","sourceRoot":"","sources":["../../src/hooks/use_conversation_avatar_update.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"use_conversation_avatar_update.d.ts","sourceRoot":"","sources":["../../src/hooks/use_conversation_avatar_update.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAEV,WAAW,EACX,sBAAsB,EACtB,oBAAoB,EACrB,MAAM,UAAU,CAAA;AAGjB,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,uCAAuC,CAAA;AAC7E,OAAO,EAAE,SAAS,EAAgB,MAAM,kBAAkB,CAAA;AAG1D,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAA;AAErD,MAAM,MAAM,UAAU,GAAG,MAAM,GAAG,OAAO,GAAG,OAAO,CAAA;AAEnD,MAAM,MAAM,mBAAmB,GAC3B;IAAE,IAAI,EAAE,OAAO,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,CAAC;IAAC,GAAG,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,GAC3E;IAAE,IAAI,EAAE,OAAO,CAAC,UAAU,EAAE,OAAO,CAAC,CAAC;IAAC,UAAU,EAAE,gBAAgB,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,GACnF;IAAE,IAAI,EAAE,OAAO,CAAA;CAAE,CAAA;AAIrB,eAAO,MAAM,kCAAkC,GAAI,gBAAgB,MAAM,GAAG,SAAS,oCAQpF,CAAA;AAED,eAAO,MAAM,2BAA2B,GAAI,oBAAoB;IAAE,cAAc,EAAE,MAAM,CAAA;CAAE;;EAoEzF,CAAA;AAED,wBAAsB,uBAAuB,CAC3C,SAAS,EAAE,SAAS,EACpB,YAAY,EAAE,UAAU,CAAC,OAAO,eAAe,CAAC,EAChD,cAAc,EAAE,MAAM,EACtB,OAAO,EAAE,OAAO,CAAC,mBAAmB,EAAE;IAAE,IAAI,EAAE,OAAO,CAAA;CAAE,CAAC,iBAiBzD;AAeD,wBAAgB,iBAAiB,CAAC,CAAC,SAAS,sBAAsB,EAChE,IAAI,EAAE,CAAC,EACP,OAAO,EAAE,mBAAmB,GAC3B,CAAC,CAmCH"}
|
|
@@ -1,13 +1,46 @@
|
|
|
1
1
|
import { c as _c } from "react/compiler-runtime";
|
|
2
|
-
import { useMutation, useQueryClient } from '@tanstack/react-query';
|
|
3
|
-
import { Alert } from 'react-native';
|
|
2
|
+
import { useMutation, useMutationState, useQueryClient } from '@tanstack/react-query';
|
|
3
|
+
import { Alert, Image } from 'react-native';
|
|
4
|
+
import { updateAllRecordsInPagesData } from '../utils/cache/page_mutations';
|
|
4
5
|
import { transformGetToPost } from '../utils/client/request_helpers';
|
|
5
6
|
import { useApiClient } from './use_api_client';
|
|
6
7
|
import { getConversationRequestArgs } from './use_conversation';
|
|
7
8
|
import { getRequestQueryKey } from './use_suspense_api';
|
|
8
9
|
import { useUploadClient } from './use_upload_client';
|
|
10
|
+
const MUTATION_KEY = 'updateConversationAvatar';
|
|
11
|
+
export const usePendingConversationAvatarUpdate = conversationId => {
|
|
12
|
+
const $ = _c(4);
|
|
13
|
+
let t0;
|
|
14
|
+
if ($[0] !== conversationId) {
|
|
15
|
+
t0 = {
|
|
16
|
+
filters: {
|
|
17
|
+
mutationKey: [MUTATION_KEY, conversationId],
|
|
18
|
+
exact: true
|
|
19
|
+
},
|
|
20
|
+
select: _temp
|
|
21
|
+
};
|
|
22
|
+
$[0] = conversationId;
|
|
23
|
+
$[1] = t0;
|
|
24
|
+
} else {
|
|
25
|
+
t0 = $[1];
|
|
26
|
+
}
|
|
27
|
+
const t1 = useMutationState(t0);
|
|
28
|
+
let t2;
|
|
29
|
+
if ($[2] !== t1) {
|
|
30
|
+
t2 = t1.at(-1);
|
|
31
|
+
$[2] = t1;
|
|
32
|
+
$[3] = t2;
|
|
33
|
+
} else {
|
|
34
|
+
t2 = $[3];
|
|
35
|
+
}
|
|
36
|
+
const newest = t2;
|
|
37
|
+
if (conversationId === undefined || newest?.status !== "pending") {
|
|
38
|
+
return;
|
|
39
|
+
}
|
|
40
|
+
return newest.variables;
|
|
41
|
+
};
|
|
9
42
|
export const useConversationAvatarUpdate = t0 => {
|
|
10
|
-
const $ = _c(
|
|
43
|
+
const $ = _c(31);
|
|
11
44
|
const {
|
|
12
45
|
conversationId
|
|
13
46
|
} = t0;
|
|
@@ -30,18 +63,34 @@ export const useConversationAvatarUpdate = t0 => {
|
|
|
30
63
|
}
|
|
31
64
|
const queryKey = t1;
|
|
32
65
|
let t2;
|
|
33
|
-
if ($[3] !== conversationId) {
|
|
34
|
-
t2 =
|
|
66
|
+
if ($[3] !== conversationId || $[4] !== queryClient) {
|
|
67
|
+
t2 = payload => queryClient.getMutationCache().findAll({
|
|
68
|
+
mutationKey: [MUTATION_KEY, conversationId],
|
|
69
|
+
exact: true
|
|
70
|
+
}).at(-1)?.state.variables !== payload;
|
|
35
71
|
$[3] = conversationId;
|
|
36
|
-
$[4] =
|
|
72
|
+
$[4] = queryClient;
|
|
73
|
+
$[5] = t2;
|
|
37
74
|
} else {
|
|
38
|
-
t2 = $[
|
|
75
|
+
t2 = $[5];
|
|
39
76
|
}
|
|
77
|
+
const isSuperseded = t2;
|
|
40
78
|
let t3;
|
|
41
|
-
if ($[
|
|
42
|
-
t3 =
|
|
79
|
+
if ($[6] !== conversationId) {
|
|
80
|
+
t3 = [MUTATION_KEY, conversationId];
|
|
81
|
+
$[6] = conversationId;
|
|
82
|
+
$[7] = t3;
|
|
83
|
+
} else {
|
|
84
|
+
t3 = $[7];
|
|
85
|
+
}
|
|
86
|
+
let t4;
|
|
87
|
+
if ($[8] !== apiClient || $[9] !== conversationId || $[10] !== isSuperseded || $[11] !== requestArgs || $[12] !== uploadClient) {
|
|
88
|
+
t4 = async payload_0 => {
|
|
43
89
|
const postArgs = transformGetToPost(requestArgs).data;
|
|
44
|
-
const attributes = await buildAttributes(
|
|
90
|
+
const attributes = await buildAttributes(payload_0, uploadClient);
|
|
91
|
+
if (isSuperseded(payload_0)) {
|
|
92
|
+
return null;
|
|
93
|
+
}
|
|
45
94
|
return apiClient.chat.patch({
|
|
46
95
|
url: `/me/conversations/${conversationId}/`,
|
|
47
96
|
data: {
|
|
@@ -53,19 +102,18 @@ export const useConversationAvatarUpdate = t0 => {
|
|
|
53
102
|
}
|
|
54
103
|
});
|
|
55
104
|
};
|
|
56
|
-
$[
|
|
57
|
-
$[
|
|
58
|
-
$[
|
|
59
|
-
$[
|
|
60
|
-
$[
|
|
105
|
+
$[8] = apiClient;
|
|
106
|
+
$[9] = conversationId;
|
|
107
|
+
$[10] = isSuperseded;
|
|
108
|
+
$[11] = requestArgs;
|
|
109
|
+
$[12] = uploadClient;
|
|
110
|
+
$[13] = t4;
|
|
61
111
|
} else {
|
|
62
|
-
|
|
112
|
+
t4 = $[13];
|
|
63
113
|
}
|
|
64
|
-
let t4;
|
|
65
114
|
let t5;
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
t4 = async payload_0 => {
|
|
115
|
+
if ($[14] !== queryClient || $[15] !== queryKey) {
|
|
116
|
+
t5 = async payload_1 => {
|
|
69
117
|
await queryClient.cancelQueries({
|
|
70
118
|
queryKey
|
|
71
119
|
});
|
|
@@ -76,54 +124,89 @@ export const useConversationAvatarUpdate = t0 => {
|
|
|
76
124
|
}
|
|
77
125
|
return {
|
|
78
126
|
...prev,
|
|
79
|
-
data:
|
|
127
|
+
data: applyAvatarUpdate(prev.data, payload_1)
|
|
80
128
|
};
|
|
81
129
|
});
|
|
82
130
|
return {
|
|
83
131
|
previous
|
|
84
132
|
};
|
|
85
133
|
};
|
|
86
|
-
|
|
134
|
+
$[14] = queryClient;
|
|
135
|
+
$[15] = queryKey;
|
|
136
|
+
$[16] = t5;
|
|
137
|
+
} else {
|
|
138
|
+
t5 = $[16];
|
|
139
|
+
}
|
|
140
|
+
let t6;
|
|
141
|
+
if ($[17] !== conversationId || $[18] !== queryClient || $[19] !== queryKey) {
|
|
142
|
+
t6 = async (response, _payload, _context) => {
|
|
143
|
+
if (!response) {
|
|
144
|
+
return;
|
|
145
|
+
}
|
|
87
146
|
queryClient.setQueryData(queryKey, () => response);
|
|
147
|
+
queryClient.setQueriesData({
|
|
148
|
+
queryKey: ["/me/conversations"]
|
|
149
|
+
}, prev_0 => {
|
|
150
|
+
if (!prev_0?.pages) {
|
|
151
|
+
return prev_0;
|
|
152
|
+
}
|
|
153
|
+
return updateAllRecordsInPagesData({
|
|
154
|
+
data: prev_0,
|
|
155
|
+
processRecord: record => record.id === conversationId ? applySavedAvatar(record, response.data) : record
|
|
156
|
+
});
|
|
157
|
+
});
|
|
88
158
|
queryClient.invalidateQueries({
|
|
89
159
|
queryKey: ["/me/conversations"]
|
|
90
160
|
});
|
|
161
|
+
const imageUrl = response.data.customAvatarImageUrl;
|
|
162
|
+
if (imageUrl) {
|
|
163
|
+
await Image.prefetch(imageUrl).catch(_temp2);
|
|
164
|
+
}
|
|
91
165
|
};
|
|
92
|
-
|
|
166
|
+
$[17] = conversationId;
|
|
167
|
+
$[18] = queryClient;
|
|
168
|
+
$[19] = queryKey;
|
|
169
|
+
$[20] = t6;
|
|
170
|
+
} else {
|
|
171
|
+
t6 = $[20];
|
|
172
|
+
}
|
|
173
|
+
let t7;
|
|
174
|
+
if ($[21] !== isSuperseded || $[22] !== queryClient || $[23] !== queryKey) {
|
|
175
|
+
t7 = (_error, payload_2, context) => {
|
|
176
|
+
if (isSuperseded(payload_2)) {
|
|
177
|
+
return;
|
|
178
|
+
}
|
|
93
179
|
if (context?.previous) {
|
|
94
180
|
queryClient.setQueryData(queryKey, context.previous);
|
|
95
181
|
}
|
|
96
182
|
Alert.alert("Error", "Failed to update conversation avatar. Please try again.");
|
|
97
183
|
};
|
|
98
|
-
$[
|
|
99
|
-
$[
|
|
100
|
-
$[
|
|
101
|
-
$[
|
|
102
|
-
$[14] = t6;
|
|
184
|
+
$[21] = isSuperseded;
|
|
185
|
+
$[22] = queryClient;
|
|
186
|
+
$[23] = queryKey;
|
|
187
|
+
$[24] = t7;
|
|
103
188
|
} else {
|
|
104
|
-
|
|
105
|
-
t5 = $[13];
|
|
106
|
-
t6 = $[14];
|
|
189
|
+
t7 = $[24];
|
|
107
190
|
}
|
|
108
|
-
let
|
|
109
|
-
if ($[
|
|
110
|
-
|
|
111
|
-
mutationKey:
|
|
112
|
-
mutationFn:
|
|
113
|
-
onMutate:
|
|
114
|
-
onSuccess:
|
|
115
|
-
onError:
|
|
191
|
+
let t8;
|
|
192
|
+
if ($[25] !== t3 || $[26] !== t4 || $[27] !== t5 || $[28] !== t6 || $[29] !== t7) {
|
|
193
|
+
t8 = {
|
|
194
|
+
mutationKey: t3,
|
|
195
|
+
mutationFn: t4,
|
|
196
|
+
onMutate: t5,
|
|
197
|
+
onSuccess: t6,
|
|
198
|
+
onError: t7
|
|
116
199
|
};
|
|
117
|
-
$[
|
|
118
|
-
$[
|
|
119
|
-
$[
|
|
120
|
-
$[
|
|
121
|
-
$[
|
|
122
|
-
$[
|
|
200
|
+
$[25] = t3;
|
|
201
|
+
$[26] = t4;
|
|
202
|
+
$[27] = t5;
|
|
203
|
+
$[28] = t6;
|
|
204
|
+
$[29] = t7;
|
|
205
|
+
$[30] = t8;
|
|
123
206
|
} else {
|
|
124
|
-
|
|
207
|
+
t8 = $[30];
|
|
125
208
|
}
|
|
126
|
-
return useMutation(
|
|
209
|
+
return useMutation(t8);
|
|
127
210
|
};
|
|
128
211
|
export async function patchConversationAvatar(apiClient, uploadClient, conversationId, payload) {
|
|
129
212
|
const requestArgs = getConversationRequestArgs({
|
|
@@ -146,7 +229,16 @@ export async function patchConversationAvatar(apiClient, uploadClient, conversat
|
|
|
146
229
|
Alert.alert('Avatar not saved', 'The conversation was created, but the avatar could not be saved. You can update it from the conversation details.');
|
|
147
230
|
}
|
|
148
231
|
}
|
|
149
|
-
function
|
|
232
|
+
function applySavedAvatar(data, saved) {
|
|
233
|
+
return {
|
|
234
|
+
...data,
|
|
235
|
+
customAvatarType: saved.customAvatarType,
|
|
236
|
+
customAvatarKey: saved.customAvatarKey,
|
|
237
|
+
customAvatarColor: saved.customAvatarColor,
|
|
238
|
+
customAvatarImageUrl: saved.customAvatarImageUrl
|
|
239
|
+
};
|
|
240
|
+
}
|
|
241
|
+
export function applyAvatarUpdate(data, payload) {
|
|
150
242
|
switch (payload.kind) {
|
|
151
243
|
case 'icon':
|
|
152
244
|
return {
|
|
@@ -217,4 +309,10 @@ async function buildAttributes(payload, uploadClient) {
|
|
|
217
309
|
};
|
|
218
310
|
}
|
|
219
311
|
}
|
|
312
|
+
function _temp(mutation) {
|
|
313
|
+
return mutation.state;
|
|
314
|
+
}
|
|
315
|
+
function _temp2() {
|
|
316
|
+
return false;
|
|
317
|
+
}
|
|
220
318
|
//# sourceMappingURL=use_conversation_avatar_update.js.map
|