@droppii-org/chat-mobile 0.2.107 → 0.2.108
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/lib/module/components/ThreadCard/ThreadCard.js +2 -0
- package/lib/module/components/ThreadCard/ThreadCard.js.map +1 -1
- package/lib/module/components/messages/fileMessage/index.js +9 -2
- package/lib/module/components/messages/fileMessage/index.js.map +1 -1
- package/lib/module/components/messages/quotedMessage/index.js +6 -1
- package/lib/module/components/messages/quotedMessage/index.js.map +1 -1
- package/lib/module/context/TimelinePressGuardContext.js +14 -0
- package/lib/module/context/TimelinePressGuardContext.js.map +1 -0
- package/lib/module/hooks/useConversationList.js +4 -0
- package/lib/module/hooks/useConversationList.js.map +1 -1
- package/lib/module/hooks/useDismissKeyboardFirst.js +19 -0
- package/lib/module/hooks/useDismissKeyboardFirst.js.map +1 -0
- package/lib/module/hooks/useExpandableText.js +6 -1
- package/lib/module/hooks/useExpandableText.js.map +1 -1
- package/lib/module/hooks/useGuardedPress.js +19 -0
- package/lib/module/hooks/useGuardedPress.js.map +1 -0
- package/lib/module/screens/chat-detail/ChatComposer.js +89 -498
- package/lib/module/screens/chat-detail/ChatComposer.js.map +1 -1
- package/lib/module/screens/chat-detail/ChatDetail.js +38 -20
- package/lib/module/screens/chat-detail/ChatDetail.js.map +1 -1
- package/lib/module/screens/chat-detail/ChatListLegend.js +113 -76
- package/lib/module/screens/chat-detail/ChatListLegend.js.map +1 -1
- package/lib/module/screens/chat-detail/components/ChatComposerAccessorySlot.js +47 -0
- package/lib/module/screens/chat-detail/components/ChatComposerAccessorySlot.js.map +1 -0
- package/lib/module/screens/chat-detail/components/ChatComposerInputArea.js +149 -0
- package/lib/module/screens/chat-detail/components/ChatComposerInputArea.js.map +1 -0
- package/lib/module/screens/chat-detail/components/ChatComposerStatusBanner.js +104 -0
- package/lib/module/screens/chat-detail/components/ChatComposerStatusBanner.js.map +1 -0
- package/lib/module/screens/chat-detail/hooks/useChatComposerAnimation.js +0 -17
- package/lib/module/screens/chat-detail/hooks/useChatComposerAnimation.js.map +1 -1
- package/lib/module/screens/chat-detail/hooks/useChatComposerState.js +16 -2
- package/lib/module/screens/chat-detail/hooks/useChatComposerState.js.map +1 -1
- package/lib/module/screens/chat-detail/hooks/useComposerBotMenu.js +122 -0
- package/lib/module/screens/chat-detail/hooks/useComposerBotMenu.js.map +1 -0
- package/lib/module/screens/chat-detail/hooks/useComposerPanelActions.js +46 -0
- package/lib/module/screens/chat-detail/hooks/useComposerPanelActions.js.map +1 -0
- package/lib/module/screens/chat-detail/hooks/useComposerPanelDismiss.js +75 -0
- package/lib/module/screens/chat-detail/hooks/useComposerPanelDismiss.js.map +1 -0
- package/lib/module/screens/chat-detail/hooks/useComposerPanels.js +136 -0
- package/lib/module/screens/chat-detail/hooks/useComposerPanels.js.map +1 -0
- package/lib/module/screens/chat-detail/hooks/useComposerSend.js +74 -0
- package/lib/module/screens/chat-detail/hooks/useComposerSend.js.map +1 -0
- package/lib/module/screens/chat-detail/legend/LegendChatMessage.js +2 -0
- package/lib/module/screens/chat-detail/legend/LegendChatMessage.js.map +1 -1
- package/lib/module/screens/chat-detail/types.js +5 -0
- package/lib/module/screens/chat-detail/types.js.map +1 -1
- package/lib/module/store/message.js +14 -0
- package/lib/module/store/message.js.map +1 -1
- package/lib/module/utils/composerPanelDismissGesture.js +52 -0
- package/lib/module/utils/composerPanelDismissGesture.js.map +1 -0
- package/lib/module/utils/perf-marker.js +44 -0
- package/lib/module/utils/perf-marker.js.map +1 -0
- package/lib/typescript/src/components/ThreadCard/ThreadCard.d.ts.map +1 -1
- package/lib/typescript/src/components/messages/fileMessage/index.d.ts.map +1 -1
- package/lib/typescript/src/components/messages/quotedMessage/index.d.ts.map +1 -1
- package/lib/typescript/src/context/TimelinePressGuardContext.d.ts +3 -0
- package/lib/typescript/src/context/TimelinePressGuardContext.d.ts.map +1 -0
- package/lib/typescript/src/hooks/useConversationList.d.ts.map +1 -1
- package/lib/typescript/src/hooks/useDismissKeyboardFirst.d.ts +8 -0
- package/lib/typescript/src/hooks/useDismissKeyboardFirst.d.ts.map +1 -0
- package/lib/typescript/src/hooks/useExpandableText.d.ts.map +1 -1
- package/lib/typescript/src/hooks/useGuardedPress.d.ts +9 -0
- package/lib/typescript/src/hooks/useGuardedPress.d.ts.map +1 -0
- package/lib/typescript/src/screens/chat-detail/ChatComposer.d.ts +7 -3
- package/lib/typescript/src/screens/chat-detail/ChatComposer.d.ts.map +1 -1
- package/lib/typescript/src/screens/chat-detail/ChatDetail.d.ts.map +1 -1
- package/lib/typescript/src/screens/chat-detail/ChatListLegend.d.ts +5 -1
- package/lib/typescript/src/screens/chat-detail/ChatListLegend.d.ts.map +1 -1
- package/lib/typescript/src/screens/chat-detail/components/ChatComposerAccessorySlot.d.ts +12 -0
- package/lib/typescript/src/screens/chat-detail/components/ChatComposerAccessorySlot.d.ts.map +1 -0
- package/lib/typescript/src/screens/chat-detail/components/ChatComposerInputArea.d.ts +30 -0
- package/lib/typescript/src/screens/chat-detail/components/ChatComposerInputArea.d.ts.map +1 -0
- package/lib/typescript/src/screens/chat-detail/components/ChatComposerStatusBanner.d.ts +19 -0
- package/lib/typescript/src/screens/chat-detail/components/ChatComposerStatusBanner.d.ts.map +1 -0
- package/lib/typescript/src/screens/chat-detail/hooks/useChatComposerAnimation.d.ts +0 -1
- package/lib/typescript/src/screens/chat-detail/hooks/useChatComposerAnimation.d.ts.map +1 -1
- package/lib/typescript/src/screens/chat-detail/hooks/useChatComposerState.d.ts +7 -0
- package/lib/typescript/src/screens/chat-detail/hooks/useChatComposerState.d.ts.map +1 -1
- package/lib/typescript/src/screens/chat-detail/hooks/useComposerBotMenu.d.ts +7 -0
- package/lib/typescript/src/screens/chat-detail/hooks/useComposerBotMenu.d.ts.map +1 -0
- package/lib/typescript/src/screens/chat-detail/hooks/useComposerPanelActions.d.ts +17 -0
- package/lib/typescript/src/screens/chat-detail/hooks/useComposerPanelActions.d.ts.map +1 -0
- package/lib/typescript/src/screens/chat-detail/hooks/useComposerPanelDismiss.d.ts +12 -0
- package/lib/typescript/src/screens/chat-detail/hooks/useComposerPanelDismiss.d.ts.map +1 -0
- package/lib/typescript/src/screens/chat-detail/hooks/useComposerPanels.d.ts +25 -0
- package/lib/typescript/src/screens/chat-detail/hooks/useComposerPanels.d.ts.map +1 -0
- package/lib/typescript/src/screens/chat-detail/hooks/useComposerSend.d.ts +16 -0
- package/lib/typescript/src/screens/chat-detail/hooks/useComposerSend.d.ts.map +1 -0
- package/lib/typescript/src/screens/chat-detail/legend/LegendChatMessage.d.ts.map +1 -1
- package/lib/typescript/src/screens/chat-detail/types.d.ts +8 -0
- package/lib/typescript/src/screens/chat-detail/types.d.ts.map +1 -1
- package/lib/typescript/src/store/message.d.ts.map +1 -1
- package/lib/typescript/src/utils/composerPanelDismissGesture.d.ts +33 -0
- package/lib/typescript/src/utils/composerPanelDismissGesture.d.ts.map +1 -0
- package/lib/typescript/src/utils/perf-marker.d.ts +8 -0
- package/lib/typescript/src/utils/perf-marker.d.ts.map +1 -0
- package/package.json +2 -1
- package/src/components/ThreadCard/ThreadCard.tsx +2 -0
- package/src/components/messages/fileMessage/index.tsx +17 -3
- package/src/components/messages/quotedMessage/index.tsx +5 -1
- package/src/context/TimelinePressGuardContext.tsx +15 -0
- package/src/hooks/useConversationList.ts +2 -0
- package/src/hooks/useDismissKeyboardFirst.ts +19 -0
- package/src/hooks/useExpandableText.ts +5 -1
- package/src/hooks/useGuardedPress.ts +20 -0
- package/src/screens/chat-detail/ChatComposer.tsx +105 -631
- package/src/screens/chat-detail/ChatDetail.tsx +38 -20
- package/src/screens/chat-detail/ChatListLegend.tsx +122 -71
- package/src/screens/chat-detail/components/ChatComposerAccessorySlot.tsx +61 -0
- package/src/screens/chat-detail/components/ChatComposerInputArea.tsx +198 -0
- package/src/screens/chat-detail/components/ChatComposerStatusBanner.tsx +116 -0
- package/src/screens/chat-detail/hooks/useChatComposerAnimation.ts +0 -29
- package/src/screens/chat-detail/hooks/useChatComposerState.ts +25 -2
- package/src/screens/chat-detail/hooks/useComposerBotMenu.tsx +140 -0
- package/src/screens/chat-detail/hooks/useComposerPanelActions.ts +57 -0
- package/src/screens/chat-detail/hooks/useComposerPanelDismiss.ts +111 -0
- package/src/screens/chat-detail/hooks/useComposerPanels.ts +197 -0
- package/src/screens/chat-detail/hooks/useComposerSend.ts +98 -0
- package/src/screens/chat-detail/legend/LegendChatMessage.tsx +2 -0
- package/src/screens/chat-detail/types.ts +9 -0
- package/src/store/message.ts +14 -0
- package/src/utils/composerPanelDismissGesture.ts +72 -0
- package/src/utils/perf-marker.ts +39 -0
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import { useCallback, useMemo } from 'react';
|
|
4
|
+
import { KContainer, KColors, KLabel } from '@droppii/libs';
|
|
5
|
+
import { trans } from "../../../translation/index.js";
|
|
6
|
+
import { UIUtils } from "../../../utils/UIUtils.js";
|
|
7
|
+
import { useCloseSupportSession, useResetFlow, useRunFlow } from "../../../hooks/flows/useFlow.js";
|
|
8
|
+
import { DEFAULT_BUTTON_ID, isContextButton } from "../../../utils/flows.js";
|
|
9
|
+
import { DFlowState } from "../../../types/chat.js";
|
|
10
|
+
import { useChatDetailContext } from "../../../context/ChatDetailContext.js";
|
|
11
|
+
import { openBotMenuSheet } from "../BotMenuSheet.js";
|
|
12
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
13
|
+
export const useComposerBotMenu = () => {
|
|
14
|
+
const {
|
|
15
|
+
isBotConversation,
|
|
16
|
+
conversationFlow,
|
|
17
|
+
conversationFlowMainMenu,
|
|
18
|
+
flowState
|
|
19
|
+
} = useChatDetailContext();
|
|
20
|
+
const {
|
|
21
|
+
mutate: runFlow,
|
|
22
|
+
isPending
|
|
23
|
+
} = useRunFlow();
|
|
24
|
+
const {
|
|
25
|
+
mutate: resetFlow
|
|
26
|
+
} = useResetFlow();
|
|
27
|
+
const {
|
|
28
|
+
mutateAsync: closeSupportSession
|
|
29
|
+
} = useCloseSupportSession();
|
|
30
|
+
const onStartConversationFlow = useCallback(() => {
|
|
31
|
+
runFlow({
|
|
32
|
+
groupId: conversationFlow?.flowCurrentStep?.id || '',
|
|
33
|
+
actionId: null,
|
|
34
|
+
childId: null,
|
|
35
|
+
plainText: trans('start')
|
|
36
|
+
});
|
|
37
|
+
}, [runFlow, conversationFlow]);
|
|
38
|
+
const botMenuOptions = useMemo(() => {
|
|
39
|
+
const apiOptions = conversationFlowMainMenu?.filter(item => !isContextButton(item.label)) || [];
|
|
40
|
+
const hasDefaultButton = apiOptions.some(item => item.id === DEFAULT_BUTTON_ID);
|
|
41
|
+
if (hasDefaultButton) return apiOptions;
|
|
42
|
+
return [...apiOptions, {
|
|
43
|
+
id: DEFAULT_BUTTON_ID,
|
|
44
|
+
label: trans('restart')
|
|
45
|
+
}];
|
|
46
|
+
}, [conversationFlowMainMenu]);
|
|
47
|
+
const hasBotMenuOptions = isBotConversation && botMenuOptions.length > 0;
|
|
48
|
+
const runBotMenuOption = useCallback(item => {
|
|
49
|
+
if (item.id === DEFAULT_BUTTON_ID) {
|
|
50
|
+
resetFlow();
|
|
51
|
+
return;
|
|
52
|
+
}
|
|
53
|
+
runFlow({
|
|
54
|
+
actionId: item.id,
|
|
55
|
+
groupId: '',
|
|
56
|
+
childId: '',
|
|
57
|
+
plainText: item.label
|
|
58
|
+
});
|
|
59
|
+
}, [runFlow, resetFlow]);
|
|
60
|
+
const handleSelectBotMenuOption = useCallback(item => {
|
|
61
|
+
if (flowState === DFlowState.CS) {
|
|
62
|
+
UIUtils.popup.open({
|
|
63
|
+
header: {
|
|
64
|
+
title: {
|
|
65
|
+
text: trans('chat:end_support_session_title')
|
|
66
|
+
},
|
|
67
|
+
alignment: 'center'
|
|
68
|
+
},
|
|
69
|
+
body: {
|
|
70
|
+
renderContent: () => /*#__PURE__*/_jsx(KContainer.View, {
|
|
71
|
+
padding: '1rem',
|
|
72
|
+
children: /*#__PURE__*/_jsx(KLabel.RichText, {
|
|
73
|
+
typo: "TextMdNormal",
|
|
74
|
+
textAlign: "center",
|
|
75
|
+
color: KColors.gray.dark,
|
|
76
|
+
richTextOptions: {
|
|
77
|
+
i18nKey: trans('chat:end_support_session_desc'),
|
|
78
|
+
components: {
|
|
79
|
+
bold: /*#__PURE__*/_jsx(KLabel.Text, {
|
|
80
|
+
typo: "TextMdBold",
|
|
81
|
+
color: KColors.gray.dark
|
|
82
|
+
})
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
})
|
|
86
|
+
})
|
|
87
|
+
},
|
|
88
|
+
actions: {
|
|
89
|
+
buttons: [{
|
|
90
|
+
label: trans('chat:end_support_session_secondary'),
|
|
91
|
+
kind: 'light',
|
|
92
|
+
onPress: () => {}
|
|
93
|
+
}, {
|
|
94
|
+
label: trans('chat:end_support_session_primary'),
|
|
95
|
+
kind: 'danger',
|
|
96
|
+
onPress: async () => {
|
|
97
|
+
await closeSupportSession();
|
|
98
|
+
runBotMenuOption(item);
|
|
99
|
+
}
|
|
100
|
+
}],
|
|
101
|
+
type: 'horizontal-button'
|
|
102
|
+
}
|
|
103
|
+
});
|
|
104
|
+
return;
|
|
105
|
+
}
|
|
106
|
+
runBotMenuOption(item);
|
|
107
|
+
}, [flowState, runBotMenuOption, closeSupportSession]);
|
|
108
|
+
const handleOpenBotMenu = useCallback(() => {
|
|
109
|
+
if (!hasBotMenuOptions) return;
|
|
110
|
+
openBotMenuSheet({
|
|
111
|
+
options: botMenuOptions,
|
|
112
|
+
onSelect: handleSelectBotMenuOption
|
|
113
|
+
});
|
|
114
|
+
}, [hasBotMenuOptions, botMenuOptions, handleSelectBotMenuOption]);
|
|
115
|
+
return {
|
|
116
|
+
hasBotMenuOptions,
|
|
117
|
+
handleOpenBotMenu,
|
|
118
|
+
onStartConversationFlow,
|
|
119
|
+
isRunFlowPending: isPending
|
|
120
|
+
};
|
|
121
|
+
};
|
|
122
|
+
//# sourceMappingURL=useComposerBotMenu.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["useCallback","useMemo","KContainer","KColors","KLabel","trans","UIUtils","useCloseSupportSession","useResetFlow","useRunFlow","DEFAULT_BUTTON_ID","isContextButton","DFlowState","useChatDetailContext","openBotMenuSheet","jsx","_jsx","useComposerBotMenu","isBotConversation","conversationFlow","conversationFlowMainMenu","flowState","mutate","runFlow","isPending","resetFlow","mutateAsync","closeSupportSession","onStartConversationFlow","groupId","flowCurrentStep","id","actionId","childId","plainText","botMenuOptions","apiOptions","filter","item","label","hasDefaultButton","some","hasBotMenuOptions","length","runBotMenuOption","handleSelectBotMenuOption","CS","popup","open","header","title","text","alignment","body","renderContent","View","padding","children","RichText","typo","textAlign","color","gray","dark","richTextOptions","i18nKey","components","bold","Text","actions","buttons","kind","onPress","type","handleOpenBotMenu","options","onSelect","isRunFlowPending"],"sourceRoot":"../../../../../src","sources":["screens/chat-detail/hooks/useComposerBotMenu.tsx"],"mappings":";;AAAA,SAASA,WAAW,EAAEC,OAAO,QAAQ,OAAO;AAC5C,SAASC,UAAU,EAAEC,OAAO,EAAEC,MAAM,QAAQ,eAAe;AAE3D,SAASC,KAAK,QAAQ,+BAAsB;AAC5C,SAASC,OAAO,QAAQ,2BAAwB;AAChD,SACEC,sBAAsB,EACtBC,YAAY,EACZC,UAAU,QACL,iCAA8B;AAErC,SAASC,iBAAiB,EAAEC,eAAe,QAAQ,yBAAsB;AACzE,SAASC,UAAU,QAAQ,wBAAqB;AAChD,SAASC,oBAAoB,QAAQ,uCAAoC;AACzE,SAASC,gBAAgB,QAAQ,oBAAiB;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAEnD,OAAO,MAAMC,kBAAkB,GAAGA,CAAA,KAAM;EACtC,MAAM;IACJC,iBAAiB;IACjBC,gBAAgB;IAChBC,wBAAwB;IACxBC;EACF,CAAC,GAAGR,oBAAoB,CAAC,CAAC;EAC1B,MAAM;IAAES,MAAM,EAAEC,OAAO;IAAEC;E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kC,CAAC;YAChDkE,IAAI,EAAE,QAAQ;YACdC,OAAO,EAAE,MAAAA,CAAA,KAAY;cACnB,MAAM7C,mBAAmB,CAAC,CAAC;cAC3BiB,gBAAgB,CAACN,IAAI,CAAC;YACxB;UACF,CAAC,CACF;UACDmC,IAAI,EAAE;QACR;MACF,CAAC,CAAC;MACF;IACF;IACA7B,gBAAgB,CAACN,IAAI,CAAC;EACxB,CAAC,EACD,CAACjB,SAAS,EAAEuB,gBAAgB,EAAEjB,mBAAmB,CACnD,CAAC;EAED,MAAM+C,iBAAiB,GAAG1E,WAAW,CAAC,MAAM;IAC1C,IAAI,CAAC0C,iBAAiB,EAAE;IACxB5B,gBAAgB,CAAC;MACf6D,OAAO,EAAExC,cAAc;MACvByC,QAAQ,EAAE/B;IACZ,CAAC,CAAC;EACJ,CAAC,EAAE,CAACH,iBAAiB,EAAEP,cAAc,EAAEU,yBAAyB,CAAC,CAAC;EAElE,OAAO;IACLH,iBAAiB;IACjBgC,iBAAiB;IACjB9C,uBAAuB;IACvBiD,gBAAgB,EAAErD;EACpB,CAAC;AACH,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import { useMemo, useRef } from 'react';
|
|
4
|
+
import { debounce } from 'lodash';
|
|
5
|
+
import { DEFAULT_PANNEL_ACTIONS } from "../constants.js";
|
|
6
|
+
import { DChatPannelActionItemType } from "../types.js";
|
|
7
|
+
// Resolves the attachment panel's actions, wiring Gallery/Documents to
|
|
8
|
+
// debounced pickers unless the consumer supplied its own onPress.
|
|
9
|
+
export const useComposerPanelActions = ({
|
|
10
|
+
pannelActions,
|
|
11
|
+
addImages,
|
|
12
|
+
addFiles
|
|
13
|
+
}) => {
|
|
14
|
+
const addImagesRef = useRef(addImages);
|
|
15
|
+
addImagesRef.current = addImages;
|
|
16
|
+
const debouncedImagePickerRef = useRef(debounce(() => addImagesRef.current?.(), 300, {
|
|
17
|
+
leading: true,
|
|
18
|
+
trailing: false
|
|
19
|
+
}));
|
|
20
|
+
const addFilesRef = useRef(addFiles);
|
|
21
|
+
addFilesRef.current = addFiles;
|
|
22
|
+
const debouncedFilePickerRef = useRef(debounce(() => addFilesRef.current?.(), 300, {
|
|
23
|
+
leading: true,
|
|
24
|
+
trailing: false
|
|
25
|
+
}));
|
|
26
|
+
return useMemo(() => {
|
|
27
|
+
return (pannelActions || DEFAULT_PANNEL_ACTIONS)?.map(p => {
|
|
28
|
+
let onPress;
|
|
29
|
+
switch (p.id) {
|
|
30
|
+
case DChatPannelActionItemType.Gallery:
|
|
31
|
+
onPress = debouncedImagePickerRef.current;
|
|
32
|
+
break;
|
|
33
|
+
case DChatPannelActionItemType.Documents:
|
|
34
|
+
onPress = debouncedFilePickerRef.current;
|
|
35
|
+
break;
|
|
36
|
+
default:
|
|
37
|
+
break;
|
|
38
|
+
}
|
|
39
|
+
return {
|
|
40
|
+
...p,
|
|
41
|
+
onPress: p.onPress || onPress
|
|
42
|
+
};
|
|
43
|
+
});
|
|
44
|
+
}, [pannelActions]);
|
|
45
|
+
};
|
|
46
|
+
//# sourceMappingURL=useComposerPanelActions.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["useMemo","useRef","debounce","DEFAULT_PANNEL_ACTIONS","DChatPannelActionItemType","useComposerPanelActions","pannelActions","addImages","addFiles","addImagesRef","current","debouncedImagePickerRef","leading","trailing","addFilesRef","debouncedFilePickerRef","map","p","onPress","id","Gallery","Documents"],"sourceRoot":"../../../../../src","sources":["screens/chat-detail/hooks/useComposerPanelActions.ts"],"mappings":";;AAAA,SAASA,OAAO,EAAEC,MAAM,QAAQ,OAAO;AACvC,SAASC,QAAQ,QAAQ,QAAQ;AAEjC,SAASC,sBAAsB,QAAQ,iBAAc;AACrD,SAASC,yBAAyB,QAAgC,aAAU;AAQ5E;AACA;AACA,OAAO,MAAMC,uBAAuB,GAAGA,CAAC;EACtCC,aAAa;EACbC,SAAS;EACTC;AAC4B,CAAC,KAAK;EAClC,MAAMC,YAAY,GAAGR,MAAM,CAACM,SAAS,CAAC;EACtCE,YAAY,CAACC,OAAO,GAAGH,SAAS;EAChC,MAAMI,uBAAuB,GAAGV,MAAM,CACpCC,QAAQ,CAAC,MAAMO,YAAY,CAACC,OAAO,GAAG,CAAC,EAAE,GAAG,EAAE;IAC5CE,OAAO,EAAE,IAAI;IACbC,QAAQ,EAAE;EACZ,CAAC,CACH,CAAC;EAED,MAAMC,WAAW,GAAGb,MAAM,CAACO,QAAQ,CAAC;EACpCM,WAAW,CAACJ,OAAO,GAAGF,QAAQ;EAC9B,MAAMO,sBAAsB,GAAGd,MAAM,CACnCC,QAAQ,CAAC,MAAMY,WAAW,CAACJ,OAAO,GAAG,CAAC,EAAE,GAAG,EAAE;IAC3CE,OAAO,EAAE,IAAI;IACbC,QAAQ,EAAE;EACZ,CAAC,CACH,CAAC;EAED,OAAOb,OAAO,CAAC,MAAM;IACnB,OAAO,CAACM,aAAa,IAAIH,sBAAsB,GAAGa,GAAG,CAAEC,CAAC,IAAK;MAC3D,IAAIC,OAAO;MACX,QAAQD,CAAC,CAACE,EAAE;QACV,KAAKf,yBAAyB,CAACgB,OAAO;UACpCF,OAAO,GAAGP,uBAAuB,CAACD,OAAO;UACzC;QACF,KAAKN,yBAAyB,CAACiB,SAAS;UACtCH,OAAO,GAAGH,sBAAsB,CAACL,OAAO;UACxC;QACF;UACE;MACJ;MACA,OAAO;QACL,GAAGO,CAAC;QACJC,OAAO,EAAED,CAAC,CAACC,OAAO,IAAIA;MACxB,CAAC;IACH,CAAC,CAAC;EACJ,CAAC,EAAE,CAACZ,aAAa,CAAC,CAAC;AACrB,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import { useCallback, useMemo, useRef, useState } from 'react';
|
|
4
|
+
import { IDLE_DISMISS_TOUCH, isPressSwallowed, markDismissTouchDragged, moveDismissTouch, shouldDismissOnRelease, startDismissTouch } from "../../../utils/composerPanelDismissGesture.js";
|
|
5
|
+
// Tap-outside dismiss for the composer's attachment/sticker panel
|
|
6
|
+
// (DROPPII-30577).
|
|
7
|
+
//
|
|
8
|
+
// While a panel is open the timeline's content is made non-hittable
|
|
9
|
+
// (`isComposerPanelOpen` → `pointerEvents: 'none'` on the list content), so a
|
|
10
|
+
// tap can never reach a bubble — JS touchables and RNGH gestures alike — yet
|
|
11
|
+
// the scroll view itself still receives the touch and scrolls. Tap vs drag is
|
|
12
|
+
// read from plain touch events on a View wrapping the list; they observe the
|
|
13
|
+
// touch without claiming the JS responder, which on iOS would disable the
|
|
14
|
+
// scroll view's pan (RCTScrollView disables it while an ancestor holds the
|
|
15
|
+
// responder).
|
|
16
|
+
//
|
|
17
|
+
// `pointerEvents` only lands after a React round-trip (open → effect →
|
|
18
|
+
// setState → list re-render), so a tap right after opening a heavy panel can
|
|
19
|
+
// still reach a bubble. `shouldSwallowPress` closes that gap synchronously: it
|
|
20
|
+
// is true for every press belonging to a touch that began with the panel
|
|
21
|
+
// open — while it is down and for SWALLOW_AFTER_RELEASE_MS after it lifts,
|
|
22
|
+
// since RNGH gesture callbacks arrive after touchEnd.
|
|
23
|
+
export const useComposerPanelDismiss = () => {
|
|
24
|
+
const panelControllerRef = useRef(null);
|
|
25
|
+
const touchRef = useRef(IDLE_DISMISS_TOUCH);
|
|
26
|
+
const swallowPressRef = useRef(false);
|
|
27
|
+
// null while the tracked touch is down.
|
|
28
|
+
const releasedAtRef = useRef(null);
|
|
29
|
+
const [isComposerPanelOpen, setIsComposerPanelOpen] = useState(false);
|
|
30
|
+
const dismissAreaTouchProps = useMemo(() => ({
|
|
31
|
+
onTouchStart: event => {
|
|
32
|
+
const panelOpen = !!panelControllerRef.current?.isOpen();
|
|
33
|
+
// A second finger must not restart the tracked touch, but a press it
|
|
34
|
+
// makes while the panel is open is still swallowed.
|
|
35
|
+
if (event.nativeEvent.touches.length > 1) {
|
|
36
|
+
if (panelOpen) swallowPressRef.current = true;
|
|
37
|
+
return;
|
|
38
|
+
}
|
|
39
|
+
touchRef.current = startDismissTouch(panelOpen, event.nativeEvent.pageX, event.nativeEvent.pageY);
|
|
40
|
+
swallowPressRef.current = panelOpen;
|
|
41
|
+
releasedAtRef.current = null;
|
|
42
|
+
},
|
|
43
|
+
onTouchMove: event => {
|
|
44
|
+
touchRef.current = moveDismissTouch(touchRef.current, event.nativeEvent.pageX, event.nativeEvent.pageY);
|
|
45
|
+
},
|
|
46
|
+
onTouchEnd: event => {
|
|
47
|
+
if (event.nativeEvent.touches.length > 0) return;
|
|
48
|
+
if (shouldDismissOnRelease(touchRef.current)) {
|
|
49
|
+
panelControllerRef.current?.close();
|
|
50
|
+
}
|
|
51
|
+
touchRef.current = IDLE_DISMISS_TOUCH;
|
|
52
|
+
releasedAtRef.current = Date.now();
|
|
53
|
+
},
|
|
54
|
+
// The scroll view took the touch over (pan began) — not a tap.
|
|
55
|
+
onTouchCancel: () => {
|
|
56
|
+
touchRef.current = IDLE_DISMISS_TOUCH;
|
|
57
|
+
releasedAtRef.current = Date.now();
|
|
58
|
+
}
|
|
59
|
+
}), []);
|
|
60
|
+
|
|
61
|
+
// The list's onScrollBeginDrag — a drag signal on both platforms.
|
|
62
|
+
const notifyScrollBeginDrag = useCallback(() => {
|
|
63
|
+
touchRef.current = markDismissTouchDragged(touchRef.current);
|
|
64
|
+
}, []);
|
|
65
|
+
const shouldSwallowPress = useCallback(() => isPressSwallowed(swallowPressRef.current, releasedAtRef.current, Date.now()), []);
|
|
66
|
+
return {
|
|
67
|
+
panelControllerRef,
|
|
68
|
+
isComposerPanelOpen,
|
|
69
|
+
onComposerPanelOpenChange: setIsComposerPanelOpen,
|
|
70
|
+
dismissAreaTouchProps,
|
|
71
|
+
notifyScrollBeginDrag,
|
|
72
|
+
shouldSwallowPress
|
|
73
|
+
};
|
|
74
|
+
};
|
|
75
|
+
//# sourceMappingURL=useComposerPanelDismiss.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["useCallback","useMemo","useRef","useState","IDLE_DISMISS_TOUCH","isPressSwallowed","markDismissTouchDragged","moveDismissTouch","shouldDismissOnRelease","startDismissTouch","useComposerPanelDismiss","panelControllerRef","touchRef","swallowPressRef","releasedAtRef","isComposerPanelOpen","setIsComposerPanelOpen","dismissAreaTouchProps","onTouchStart","event","panelOpen","current","isOpen","nativeEvent","touches","length","pageX","pageY","onTouchMove","onTouchEnd","close","Date","now","onTouchCancel","notifyScrollBeginDrag","shouldSwallowPress","onComposerPanelOpenChange"],"sourceRoot":"../../../../../src","sources":["screens/chat-detail/hooks/useComposerPanelDismiss.ts"],"mappings":";;AAAA,SAASA,WAAW,EAAEC,OAAO,EAAEC,MAAM,EAAEC,QAAQ,QAAQ,OAAO;AAI9D,SACEC,kBAAkB,EAClBC,gBAAgB,EAChBC,uBAAuB,EACvBC,gBAAgB,EAChBC,sBAAsB,EACtBC,iBAAiB,QAEZ,+CAA4C;AAOnD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMC,uBAAuB,GAAGA,CAAA,KAAM;EAC3C,MAAMC,kBAAkB,GAAGT,MAAM,CAAiC,IAAI,CAAC;EACvE,MAAMU,QAAQ,GAAGV,MAAM,CAAeE,kBAAkB,CAAC;EACzD,MAAMS,eAAe,GAAGX,MAAM,CAAC,KAAK,CAAC;EACrC;EACA,MAAMY,aAAa,GAAGZ,MAAM,CAAgB,IAAI,CAAC;EACjD,MAAM,CAACa,mBAAmB,EAAEC,sBAAsB,CAAC,GAAGb,QAAQ,CAAC,KAAK,CAAC;EAErE,MAAMc,qBAAqB,GAAGhB,OAAO,CACnC,OAAO;IACLiB,YAAY,EAAGC,KAA4B,IAAK;MAC9C,MAAMC,SAAS,GAAG,CAAC,CAACT,kBAAkB,CAACU,OAAO,EAAEC,MAAM,CAAC,CAAC;MACxD;MACA;MACA,IAA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AC;EAEN,MAAMc,kBAAkB,GAAGnC,WAAW,CACpC,MACEK,gBAAgB,CACdQ,eAAe,CAACQ,OAAO,EACvBP,aAAa,CAACO,OAAO,EACrBU,IAAI,CAACC,GAAG,CAAC,CACX,CAAC,EACH,EACF,CAAC;EAED,OAAO;IACLrB,kBAAkB;IAClBI,mBAAmB;IACnBqB,yBAAyB,EAAEpB,sBAAsB;IACjDC,qBAAqB;IACrBiB,qBAAqB;IACrBC;EACF,CAAC;AACH,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import { useCallback, useEffect, useImperativeHandle, useMemo, useRef } from 'react';
|
|
4
|
+
import { Keyboard } from 'react-native';
|
|
5
|
+
import { useChatComposerAnimation } from "./useChatComposerAnimation.js";
|
|
6
|
+
import { getAttachmentPanelHeight, DEFAULT_PANNEL_ACTIONS } from "../constants.js";
|
|
7
|
+
import { STICKER_PICKER_HEIGHT } from "../../../components/StickerPicker/constants.js";
|
|
8
|
+
|
|
9
|
+
// 'immediate' — no animation (sticker yielding to the keyboard);
|
|
10
|
+
// 'fast' — half-duration (attachment yielding to the keyboard);
|
|
11
|
+
// 'animated' — full duration, same as closing via the toggle icon.
|
|
12
|
+
|
|
13
|
+
export const useComposerPanels = ({
|
|
14
|
+
activePanelType,
|
|
15
|
+
setActivePanelType,
|
|
16
|
+
isAttachmentOpen,
|
|
17
|
+
setIsAttachmentOpen,
|
|
18
|
+
isMentionPanelOpen,
|
|
19
|
+
closeMentionPanel,
|
|
20
|
+
isKeyboardVisible,
|
|
21
|
+
isSlotVisible,
|
|
22
|
+
panelControllerRef,
|
|
23
|
+
onPanelOpenChange
|
|
24
|
+
}) => {
|
|
25
|
+
const attachmentPanelHeight = useMemo(() => getAttachmentPanelHeight(DEFAULT_PANNEL_ACTIONS.length), []);
|
|
26
|
+
const panelHeight = activePanelType === 'sticker' ? STICKER_PICKER_HEIGHT : attachmentPanelHeight;
|
|
27
|
+
|
|
28
|
+
// Mirrors isAttachmentOpen synchronously (written before React commits),
|
|
29
|
+
// so imperative readers — the timeline's tap-outside dismiss — never see
|
|
30
|
+
// a stale value between an open/close and the next render.
|
|
31
|
+
const isAttachmentOpenRef = useRef(false);
|
|
32
|
+
const handleAttachmentOpenChange = useCallback(open => {
|
|
33
|
+
isAttachmentOpenRef.current = open;
|
|
34
|
+
setIsAttachmentOpen(open);
|
|
35
|
+
}, [setIsAttachmentOpen]);
|
|
36
|
+
const {
|
|
37
|
+
accessorySlotStyle,
|
|
38
|
+
openWithHeight,
|
|
39
|
+
closeAttachment
|
|
40
|
+
} = useChatComposerAnimation({
|
|
41
|
+
panelHeight,
|
|
42
|
+
onAttachmentOpenChange: handleAttachmentOpenChange
|
|
43
|
+
});
|
|
44
|
+
const closeActivePanel = useCallback(mode => {
|
|
45
|
+
closeAttachment(mode === 'fast', mode === 'immediate');
|
|
46
|
+
setActivePanelType(null);
|
|
47
|
+
}, [closeAttachment, setActivePanelType]);
|
|
48
|
+
|
|
49
|
+
// Close mode when yielding to the keyboard or the mention picker: the
|
|
50
|
+
// sticker panel closes immediately to avoid a layout conflict between the
|
|
51
|
+
// panel closing and the keyboard appearing; the attachment panel is small
|
|
52
|
+
// enough that animation is fine (speedUp=true).
|
|
53
|
+
const yieldingCloseMode = activePanelType === 'sticker' ? 'immediate' : 'fast';
|
|
54
|
+
|
|
55
|
+
// Mutual exclusion (finding #5 in the mention plan): the mention picker
|
|
56
|
+
// never renders through the attachment/sticker panel slot, but opening
|
|
57
|
+
// one must still close the other — starting a mention query while the
|
|
58
|
+
// attachment/sticker panel is open closes that panel.
|
|
59
|
+
useEffect(() => {
|
|
60
|
+
if (isMentionPanelOpen && isAttachmentOpen) {
|
|
61
|
+
closeActivePanel(yieldingCloseMode);
|
|
62
|
+
}
|
|
63
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
64
|
+
}, [isMentionPanelOpen]);
|
|
65
|
+
|
|
66
|
+
// A panel left open when the slot disappears (composer disabled, bot
|
|
67
|
+
// restarted, removed from group) would otherwise stay "open" invisibly.
|
|
68
|
+
const isSlotVisibleRef = useRef(isSlotVisible);
|
|
69
|
+
isSlotVisibleRef.current = isSlotVisible;
|
|
70
|
+
useEffect(() => {
|
|
71
|
+
if (!isSlotVisible && isAttachmentOpenRef.current) {
|
|
72
|
+
closeActivePanel('immediate');
|
|
73
|
+
}
|
|
74
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
75
|
+
}, [isSlotVisible]);
|
|
76
|
+
const isPanelEffectivelyOpen = isAttachmentOpen && isSlotVisible;
|
|
77
|
+
useEffect(() => {
|
|
78
|
+
onPanelOpenChange?.(isPanelEffectivelyOpen);
|
|
79
|
+
}, [isPanelEffectivelyOpen, onPanelOpenChange]);
|
|
80
|
+
useImperativeHandle(panelControllerRef, () => ({
|
|
81
|
+
isOpen: () => isAttachmentOpenRef.current && isSlotVisibleRef.current,
|
|
82
|
+
close: () => {
|
|
83
|
+
if (isAttachmentOpenRef.current) closeActivePanel('animated');
|
|
84
|
+
}
|
|
85
|
+
}), [closeActivePanel]);
|
|
86
|
+
const handleToggleAttachment = useCallback(() => {
|
|
87
|
+
closeMentionPanel();
|
|
88
|
+
if (activePanelType === 'sticker') {
|
|
89
|
+
// switch from sticker to attachment
|
|
90
|
+
setActivePanelType('attachment');
|
|
91
|
+
openWithHeight(attachmentPanelHeight);
|
|
92
|
+
return;
|
|
93
|
+
}
|
|
94
|
+
// Open/close decided on the same source of truth as the icon: a
|
|
95
|
+
// toggle keyed on the animated height could close a panel that is
|
|
96
|
+
// still collapsing from a tap-outside dismiss while the icon shows it
|
|
97
|
+
// opening.
|
|
98
|
+
if (isAttachmentOpenRef.current) {
|
|
99
|
+
closeActivePanel('animated');
|
|
100
|
+
return;
|
|
101
|
+
}
|
|
102
|
+
if (isKeyboardVisible) {
|
|
103
|
+
Keyboard.dismiss();
|
|
104
|
+
}
|
|
105
|
+
setActivePanelType('attachment');
|
|
106
|
+
openWithHeight(attachmentPanelHeight);
|
|
107
|
+
// Deliberately depend on `closeMentionPanel` (stable — [] deps in
|
|
108
|
+
// useMentionComposer), NOT the whole `mentionComposer` object, which is
|
|
109
|
+
// a fresh literal every render (useMentionComposer doesn't memoize its
|
|
110
|
+
// return value). Depending on the whole object recreated this callback
|
|
111
|
+
// — and therefore every prop built from it, e.g. ChatMessageInput's
|
|
112
|
+
// onEmojiPress — on every single render, which contributed to a real
|
|
113
|
+
// "Maximum update depth exceeded" loop found in testing.
|
|
114
|
+
}, [activePanelType, attachmentPanelHeight, isKeyboardVisible, openWithHeight, closeActivePanel, setActivePanelType, closeMentionPanel]);
|
|
115
|
+
const handleToggleSticker = useCallback(() => {
|
|
116
|
+
closeMentionPanel();
|
|
117
|
+
if (activePanelType === 'sticker') {
|
|
118
|
+
closeActivePanel('animated');
|
|
119
|
+
return;
|
|
120
|
+
}
|
|
121
|
+
if (isKeyboardVisible) {
|
|
122
|
+
Keyboard.dismiss();
|
|
123
|
+
}
|
|
124
|
+
setActivePanelType('sticker');
|
|
125
|
+
openWithHeight(STICKER_PICKER_HEIGHT);
|
|
126
|
+
// Same reasoning as handleToggleAttachment above — see that comment.
|
|
127
|
+
}, [activePanelType, isKeyboardVisible, closeMentionPanel, closeActivePanel, openWithHeight, setActivePanelType]);
|
|
128
|
+
return {
|
|
129
|
+
accessorySlotStyle,
|
|
130
|
+
closeActivePanel,
|
|
131
|
+
yieldingCloseMode,
|
|
132
|
+
handleToggleAttachment,
|
|
133
|
+
handleToggleSticker
|
|
134
|
+
};
|
|
135
|
+
};
|
|
136
|
+
//# sourceMappingURL=useComposerPanels.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["useCallback","useEffect","useImperativeHandle","useMemo","useRef","Keyboard","useChatComposerAnimation","getAttachmentPanelHeight","DEFAULT_PANNEL_ACTIONS","STICKER_PICKER_HEIGHT","useComposerPanels","activePanelType","setActivePanelType","isAttachmentOpen","setIsAttachmentOpen","isMentionPanelOpen","closeMentionPanel","isKeyboardVisible","isSlotVisible","panelControllerRef","onPanelOpenChange","attachmentPanelHeight","length","panelHeight","isAttachmentOpenRef","handleAttachmentOpenChange","open","current","accessorySlotStyle","openWithHeight","closeAttachment","onAttachmentOpenChange","closeActivePanel","mode","yieldingCloseMode","isSlotVisibleRef","isPanelEffectivelyOpen","isOpen","close","handleToggleAttachment","dismiss","handleToggleSticker"],"sourceRoot":"../../../../../src","sources":["screens/chat-detail/hooks/useComposerPanels.ts"],"mappings":";;AAAA,SACEA,WAAW,EACXC,SAAS,EACTC,mBAAmB,EACnBC,OAAO,EACPC,MAAM,QAED,OAAO;AACd,SAASC,QAAQ,QAAQ,cAAc;AAEvC,SAASC,wBAAwB,QAAQ,+BAA4B;AAGrE,SAASC,wBAAwB,EAAEC,sBAAsB,QAAQ,iBAAc;AAC/E,SAASC,qBAAqB,QAAQ,gDAA6C;;AAEnF;AACA;AACA;;AAmBA,OAAO,MAAMC,iBAAiB,GAAGA,CAAC;EAChCC,eAAe;EACfC,kBAAkB;EAClBC,gBAAgB;EAChBC,mBAAmB;EACnBC,kBAAkB;EAClBC,iBAAiB;EACjBC,iBAAiB;EACjBC,aAAa;EACbC,kBAAkB;EAClBC;AACsB,CAAC,KAAK;EAC5B,MAAMC,qBAAqB,GAAGlB,OAAO,CACnC,MAAMI,wBAAwB,CAACC,sBAAsB,CAACc,MAAM,CAAC,EAC7D,EACF,CAAC;EAED,MAAMC,WAAW,GACfZ,eAAe,KAAK,SAAS,GACzBF,qBAAqB,GACrBY,qBAAqB;;EAE3B;EACA;EACA;EACA,MAAMG,mBAAmB,GAAGpB,MAAM,CAAC,KAAK,CAAC;EACzC,MAAMqB,0BAA0B,GAAGzB,WAAW,CAC3C0B,IAAa,IAAK;IACjBF,mBAAmB,CAACG,OAAO,GAAGD,IAAI;IAClCZ,mBAAmB,CAACY,IAAI,CAAC;EAC3B,CAAC,EACD,CAACZ,mBAAmB,CACtB,CAAC;EAED,MAAM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E,iBAAiB;IACjBK,sBAAsB;IACtBE;EACF,CAAC;AACH,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import { useCallback } from 'react';
|
|
4
|
+
import { trans } from "../../../translation/index.js";
|
|
5
|
+
import { UIUtils } from "../../../utils/UIUtils.js";
|
|
6
|
+
import { serializeMentionsForSend, MAX_AT_USER_COUNT } from "../../../utils/mentionSerializer.js";
|
|
7
|
+
export const useComposerSend = ({
|
|
8
|
+
compose,
|
|
9
|
+
isSendMessageAllowed,
|
|
10
|
+
sendDeniedReason,
|
|
11
|
+
mentions,
|
|
12
|
+
clearMentions,
|
|
13
|
+
notifyStoppedTyping,
|
|
14
|
+
inputRef
|
|
15
|
+
}) => useCallback(async () => {
|
|
16
|
+
if (!isSendMessageAllowed) {
|
|
17
|
+
UIUtils.toast.open({
|
|
18
|
+
title: sendDeniedReason,
|
|
19
|
+
theme: 'info'
|
|
20
|
+
});
|
|
21
|
+
return;
|
|
22
|
+
}
|
|
23
|
+
if (compose.isUploading || !compose.canSend) return;
|
|
24
|
+
const mentionsToSend = mentions;
|
|
25
|
+
|
|
26
|
+
// OpenIM's Go core hard-rejects an AtTextMessage tagging more than
|
|
27
|
+
// MAX_AT_USER_COUNT users, so serializeMentionsForSend caps
|
|
28
|
+
// atUserIDList to the first MAX_AT_USER_COUNT (mentionSerializer.ts's
|
|
29
|
+
// doc comment) — the message still sends, with every mention still
|
|
30
|
+
// highlighted in the text, just only the first MAX_AT_USER_COUNT
|
|
31
|
+
// actually get natively tagged/notified. This is a heads-up, not a
|
|
32
|
+
// block, so no `return` here.
|
|
33
|
+
if (mentionsToSend.length > 0) {
|
|
34
|
+
const {
|
|
35
|
+
truncated
|
|
36
|
+
} = serializeMentionsForSend(mentionsToSend);
|
|
37
|
+
if (truncated) {
|
|
38
|
+
UIUtils.toast.open({
|
|
39
|
+
title: trans('group:tag_limit_exceeded', {
|
|
40
|
+
max: String(MAX_AT_USER_COUNT)
|
|
41
|
+
}),
|
|
42
|
+
theme: 'info'
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
// Clear mention state synchronously, in the same tick as
|
|
48
|
+
// compose.send() (which clears `text`) — otherwise there's a real
|
|
49
|
+
// transient render where `value` is already '' but `mentions` still
|
|
50
|
+
// holds the just-sent entries, and the composer can visibly fail to
|
|
51
|
+
// clear (ChatMessageInput stays in children-controlled mode with a
|
|
52
|
+
// "ghost" mention anchored past the end of an empty string). See
|
|
53
|
+
// useMentionComposer.clear()'s doc comment.
|
|
54
|
+
clearMentions();
|
|
55
|
+
// Stop before awaiting the send: the peer should lose the indicator as
|
|
56
|
+
// the message goes out, not once it round-trips.
|
|
57
|
+
notifyStoppedTyping();
|
|
58
|
+
try {
|
|
59
|
+
await compose.send(mentionsToSend);
|
|
60
|
+
} catch (error) {
|
|
61
|
+
if (__DEV__) console.error('[ChatComposer] Failed to send:', error);
|
|
62
|
+
} finally {
|
|
63
|
+
// Belt-and-suspenders: force the native view to actually clear,
|
|
64
|
+
// regardless of whether the value/children mode-switch (triggered
|
|
65
|
+
// by mentions going from non-empty to empty) synced correctly on
|
|
66
|
+
// its own — the underlying nested-Text-in-TextInput technique is
|
|
67
|
+
// known to have platform quirks around this kind of transition.
|
|
68
|
+
inputRef.current?.clear();
|
|
69
|
+
}
|
|
70
|
+
// Depend on mentionComposer.mentions/.clear specifically (both
|
|
71
|
+
// stable-per-value / [] deps), not the whole mentionComposer object —
|
|
72
|
+
// same reasoning as handleToggleAttachment in useComposerPanels.
|
|
73
|
+
}, [compose, isSendMessageAllowed, sendDeniedReason, mentions, clearMentions, notifyStoppedTyping, inputRef]);
|
|
74
|
+
//# sourceMappingURL=useComposerSend.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["useCallback","trans","UIUtils","serializeMentionsForSend","MAX_AT_USER_COUNT","useComposerSend","compose","isSendMessageAllowed","sendDeniedReason","mentions","clearMentions","notifyStoppedTyping","inputRef","toast","open","title","theme","isUploading","canSend","mentionsToSend","length","truncated","max","String","send","error","__DEV__","console","current","clear"],"sourceRoot":"../../../../../src","sources":["screens/chat-detail/hooks/useComposerSend.ts"],"mappings":";;AAAA,SAASA,WAAW,QAAwB,OAAO;AAEnD,SAASC,KAAK,QAAQ,+BAAsB;AAC5C,SAASC,OAAO,QAAQ,2BAAwB;AAChD,SACEC,wBAAwB,EACxBC,iBAAiB,QACZ,qCAAkC;AAgBzC,OAAO,MAAMC,eAAe,GAAGA,CAAC;EAC9BC,OAAO;EACPC,oBAAoB;EACpBC,gBAAgB;EAChBC,QAAQ;EACRC,aAAa;EACbC,mBAAmB;EACnBC;AACoB,CAAC,KACrBZ,WAAW,CAAC,YAAY;EACtB,IAAI,CAACO,oBAAoB,EAAE;IACzBL,OAAO,CAACW,KAAK,CAACC,IAAI,CAAC;MACjBC,KAAK,EAAEP,gBAAgB;MACvBQ,KAAK,EAAE;IACT,CAAC,CAAC;IACF;EACF;EAEA,IAAIV,OAAO,CAACW,WAAW,IAAI,CAACX,OAAO,CAACY,OAAO,EAAE;EAC7C,MAAMC,cAAc,GAAGV,QAAQ;;EAE/B;EACA;EACA;EACA;EACA;EACA;EACA;EACA,IAAIU,cAAc,CAACC,MAAM,GAAG,CAAC,EAAE;IAC7B,MAAM;MAAEC;IAAU,CAAC,GAAGlB,wBAAwB,CAACgB,cAAc,CAAC;IAC9D,IAAIE,SAAS,EAAE;MACbnB,OAAO,CAACW,KAAK,CAACC,IAAI,CAAC;QACjBC,KAAK,EAAEd,KAAK,CAAC,0BAA0B,EAAE;UACvCqB,GAAG,EAAEC,MAAM,CAACnB,iBAAiB;QAC/B,CAAC,CAAC;QACFY,KAAK,EAAE;MACT,CAAC,CAAC;IACJ;EACF;;EAEA;EACA;EACA;EACA;EACA;EACA;EACA;EACAN,aAAa,CAAC,CAAC;EACf;EACA;EACAC,mBAAmB,CAAC,CAAC;EACrB,IAAI;IACF,MAAML,OAAO,CAACkB,IAAI,CAACL,cAAc,CAAC;EACpC,CAAC,CAAC,OAAOM,KAAK,EAAE;IACd,IAAIC,OAAO,EAAEC,OAAO,CAACF,KAAK,CAAC,gCAAgC,EAAEA,KAAK,CAAC;EACrE,CAAC,SAAS;IACR;IACA;IACA;IACA;IACA;IACAb,QAAQ,CAACgB,OAAO,EAAEC,KAAK,CAAC,CAAC;EAC3B;EACA;EACA;EACA;AACF,CAAC,EAAE,CACDvB,OAAO,EACPC,oBAAoB,EACpBC,gBAAgB,EAChBC,QAAQ,EACRC,aAAa,EACbC,mBAAmB,EACnBC,QAAQ,CACT,CAAC","ignoreList":[]}
|
|
@@ -21,6 +21,7 @@ import { StickerMessage } from "../../../components/messages/stickerMessage/inde
|
|
|
21
21
|
import { GROUP_NOTIFICATION_TYPES } from "../../../utils/messageUtils.js";
|
|
22
22
|
import { Avatar } from "../../../components/Avatar/index.js";
|
|
23
23
|
import { TAIL_WIDTH } from "../../../components/messages/BubbleTail.js";
|
|
24
|
+
import { perfCountRender } from "../../../utils/perf-marker.js";
|
|
24
25
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
25
26
|
const messageComponentMap = {
|
|
26
27
|
[MessageType.TextMessage]: TextMessage,
|
|
@@ -65,6 +66,7 @@ export const LegendChatMessage = /*#__PURE__*/memo(({
|
|
|
65
66
|
surface = 'timeline',
|
|
66
67
|
isPreview
|
|
67
68
|
}) => {
|
|
69
|
+
perfCountRender('LegendChatMessage');
|
|
68
70
|
const handlePress = useCallback(() => {
|
|
69
71
|
onPress?.(messageId);
|
|
70
72
|
}, [onPress, messageId]);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["KContainer","KImage","KColors","KLabel","KSpacingValue","StyleSheet","memo","useCallback","useMemo","MessageType","Gesture","GestureDetector","runOnJS","TextMessage","ImageMessage","VideoMessage","FileMessage","LinkMessage","MergedMessage","RevokedMessage","GroupNotificationMessage","MessageStatusIndicator","messageStyles","QuotedMessage","StickerMessage","GROUP_NOTIFICATION_TYPES","Avatar","TAIL_WIDTH","jsx","_jsx","jsxs","_jsxs","messageComponentMap","AtTextMessage","QuoteMessage","UrlTextMessage","PictureMessage","MergeMessage","RevokeMessage","Object","fromEntries","map","type","MEDIA_TYPES","SYSTEM_MESSAGE_TYPES","TIME_REVEAL_EXCLUDED_TYPES","LegendChatMessage","message","messageId","isOutgoing","createdAtTime","onMediaPress","onPressUrl","onRetry","onPress","alwaysHandlePress","onLongPress","customMessageItemFactory","isHighlighted","isTimeRevealed","showName","showAvatar","showSenderGutter","groupPosition","surface","isPreview","handlePress","handleLongPress","customNode","includes","contentType","SystemMessageComponent","View","center","style","styles","systemMessageWrapper","children","MessageComponent","effectiveOnMediaPress","undefined","hasMediaPress","hasUrlPress","canRevealTime","shouldHandlePress","wrapper","row","alignItems","avatarGutter","size","source","senderFaceUrl","fullName","senderNickname","content","Text","typo","color","gray","normal","numberOfLines","marginB","senderName","LongPressWrapper","isPinned","pinBadge","VectorIcons","name","primary","displayName","AVATAR_SIZE","create","position","marginLeft","width","marginRight","alignSelf","marginVertical","top","right","height","borderRadius","justifyContent","backgroundColor","pageBackground","shadowColor","black","shadowOffset","shadowOpacity","shadowRadius","elevation","borderWidth","borderColor","white","zIndex","Number","MAX_SAFE_INTEGER","gesture","gestures","LongPress","onStart","Tap","filter","Boolean","length","Race"],"sourceRoot":"../../../../../src","sources":["screens/chat-detail/legend/LegendChatMessage.tsx"],"mappings":";;AAAA,SACEA,UAAU,EACVC,MAAM,EACNC,OAAO,EACPC,MAAM,EACNC,aAAa,QACR,eAAe;AACtB,SAASC,UAAU,QAAQ,cAAc;AACzC,SAASC,IAAI,EAAEC,WAAW,EAAEC,OAAO,QAAQ,OAAO;AAElD,SAASC,WAAW,QAAQ,+BAA+B;AAE3D,SAASC,OAAO,EAAEC,eAAe,QAAQ,8BAA8B;AACvE,SAASC,OAAO,QAAQ,yBAAyB;AAEjD,SAASC,WAAW,QAAQ,mDAA0C;AACtE,SAASC,YAAY,QAAQ,oDAA2C;AACxE,SAASC,YAAY,QAAQ,oDAA2C;AACxE,SAASC,WAAW,QAAQ,mDAA0C;AACtE,SAASC,WAAW,QAAQ,mDAA0C;AACtE,SAASC,aAAa,QAAQ,qDAA4C;AAC1E,SAASC,cAAc,QAAQ,sDAA6C;AAC5E,SAASC,wBAAwB,QAAQ,gEAAuD;AAChG,SAASC,sBAAsB,QAAQ,wDAAqD;AAE5F,SAASC,aAAa,QAAQ,mBAAgB;AAC9C,OAAOC,aAAa,MAAM,qDAA4C;AACtE,SAASC,cAAc,QAAQ,sDAA6C;AAC5E,SAASC,wBAAwB,QAAQ,gCAA6B;AAGtE,SAASC,MAAM,QAAQ,qCAA4B;AACnD,SAASC,UAAU,QAAQ,4CAAyC;AAAC,SAAAC,GAAA,IAAAC,IAAA,EAAAC,IAAA,IAAAC,KAAA;
|
|
1
|
+
{"version":3,"names":["KContainer","KImage","KColors","KLabel","KSpacingValue","StyleSheet","memo","useCallback","useMemo","MessageType","Gesture","GestureDetector","runOnJS","TextMessage","ImageMessage","VideoMessage","FileMessage","LinkMessage","MergedMessage","RevokedMessage","GroupNotificationMessage","MessageStatusIndicator","messageStyles","QuotedMessage","StickerMessage","GROUP_NOTIFICATION_TYPES","Avatar","TAIL_WIDTH","perfCountRender","jsx","_jsx","jsxs","_jsxs","messageComponentMap","AtTextMessage","QuoteMessage","UrlTextMessage","PictureMessage","MergeMessage","RevokeMessage","Object","fromEntries","map","type","MEDIA_TYPES","SYSTEM_MESSAGE_TYPES","TIME_REVEAL_EXCLUDED_TYPES","LegendChatMessage","message","messageId","isOutgoing","createdAtTime","onMediaPress","onPressUrl","onRetry","onPress","alwaysHandlePress","onLongPress","customMessageItemFactory","isHighlighted","isTimeRevealed","showName","showAvatar","showSenderGutter","groupPosition","surface","isPreview","handlePress","handleLongPress","customNode","includes","contentType","SystemMessageComponent","View","center","style","styles","systemMessageWrapper","children","MessageComponent","effectiveOnMediaPress","undefined","hasMediaPress","hasUrlPress","canRevealTime","shouldHandlePress","wrapper","row","alignItems","avatarGutter","size","source","senderFaceUrl","fullName","senderNickname","content","Text","typo","color","gray","normal","numberOfLines","marginB","senderName","LongPressWrapper","isPinned","pinBadge","VectorIcons","name","primary","displayName","AVATAR_SIZE","create","position","marginLeft","width","marginRight","alignSelf","marginVertical","top","right","height","borderRadius","justifyContent","backgroundColor","pageBackground","shadowColor","black","shadowOffset","shadowOpacity","shadowRadius","elevation","borderWidth","borderColor","white","zIndex","Number","MAX_SAFE_INTEGER","gesture","gestures","LongPress","onStart","Tap","filter","Boolean","length","Race"],"sourceRoot":"../../../../../src","sources":["screens/chat-detail/legend/LegendChatMessage.tsx"],"mappings":";;AAAA,SACEA,UAAU,EACVC,MAAM,EACNC,OAAO,EACPC,MAAM,EACNC,aAAa,QACR,eAAe;AACtB,SAASC,UAAU,QAAQ,cAAc;AACzC,SAASC,IAAI,EAAEC,WAAW,EAAEC,OAAO,QAAQ,OAAO;AAElD,SAASC,WAAW,QAAQ,+BAA+B;AAE3D,SAASC,OAAO,EAAEC,eAAe,QAAQ,8BAA8B;AACvE,SAASC,OAAO,QAAQ,yBAAyB;AAEjD,SAASC,WAAW,QAAQ,mDAA0C;AACtE,SAASC,YAAY,QAAQ,oDAA2C;AACxE,SAASC,YAAY,QAAQ,oDAA2C;AACxE,SAASC,WAAW,QAAQ,mDAA0C;AACtE,SAASC,WAAW,QAAQ,mDAA0C;AACtE,SAASC,aAAa,QAAQ,qDAA4C;AAC1E,SAASC,cAAc,QAAQ,sDAA6C;AAC5E,SAASC,wBAAwB,QAAQ,gEAAuD;AAChG,SAASC,sBAAsB,QAAQ,wDAAqD;AAE5F,SAASC,aAAa,QAAQ,mBAAgB;AAC9C,OAAOC,aAAa,MAAM,qDAA4C;AACtE,SAASC,cAAc,QAAQ,sDAA6C;AAC5E,SAASC,wBAAwB,QAAQ,gCAA6B;AAGtE,SAASC,MAAM,QAAQ,qCAA4B;AACnD,SAAS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jI,OAAO,CAAC6C,WAAW,CAAC,CAAC,CAAC;IACxB,CAAC,CAAC,EACJF,OAAO,IACL7C,OAAO,CAACoI,GAAG,CAAC,CAAC,CAACD,OAAO,CAAC,MAAM;MAC1BjI,OAAO,CAAC2C,OAAO,CAAC,CAAC,CAAC;IACpB,CAAC,CAAC,CACL,CAACwF,MAAM,CAACC,OAAO,CAAqC;IAErD,IAAI,CAACL,QAAQ,CAACM,MAAM,EAAE;MACpB,OAAO,IAAI;IACb;IAEA,OAAON,QAAQ,CAACM,MAAM,GAAG,CAAC,GAAGvI,OAAO,CAACwI,IAAI,CAAC,GAAGP,QAAQ,CAAC,GAAGA,QAAQ,CAAC,CAAC,CAAC;EACtE,CAAC,EAAE,CAACpF,OAAO,EAAEE,WAAW,CAAC,CAAC;EAE1B,IAAI,CAACiF,OAAO,EAAE;IACZ,OAAO5D,QAAQ;EACjB;EAEA,oBACEhD,IAAA,CAACnB,eAAe;IAAC+H,OAAO,EAAEA,OAAQ;IAAA5D,QAAA,eAChChD,IAAA,CAAC9B,UAAU,CAACyE,IAAI;MAAAK,QAAA,EAAEA;IAAQ,CAAkB;EAAC,CAC9B,CAAC;AAEtB,CAAC","ignoreList":[]}
|
|
@@ -15,4 +15,9 @@ export let DChatQuickActionItemType = /*#__PURE__*/function (DChatQuickActionIte
|
|
|
15
15
|
DChatQuickActionItemType["ScamWarning"] = "ScamWarning";
|
|
16
16
|
return DChatQuickActionItemType;
|
|
17
17
|
}({});
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* @internal Imperative handle to the composer's attachment/sticker panel,
|
|
21
|
+
* used by ChatDetail for tap-outside dismiss. Not part of the public API.
|
|
22
|
+
*/
|
|
18
23
|
//# sourceMappingURL=types.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["DChatPannelActionItemType","DChatQuickActionItemType"],"sourceRoot":"../../../../src","sources":["screens/chat-detail/types.ts"],"mappings":";;AAUA,WAAYA,yBAAyB,0BAAzBA,yBAAyB;EAAzBA,yBAAyB;EAAzBA,yBAAyB;EAAzBA,yBAAyB;EAAzBA,yBAAyB;EAAzBA,yBAAyB;EAAzBA,yBAAyB;EAAA,OAAzBA,yBAAyB;AAAA;AASrC,WAAYC,wBAAwB,0BAAxBA,wBAAwB;EAAxBA,wBAAwB;EAAxBA,wBAAwB;EAAxBA,wBAAwB;EAAA,OAAxBA,wBAAwB;AAAA","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["DChatPannelActionItemType","DChatQuickActionItemType"],"sourceRoot":"../../../../src","sources":["screens/chat-detail/types.ts"],"mappings":";;AAUA,WAAYA,yBAAyB,0BAAzBA,yBAAyB;EAAzBA,yBAAyB;EAAzBA,yBAAyB;EAAzBA,yBAAyB;EAAzBA,yBAAyB;EAAzBA,yBAAyB;EAAzBA,yBAAyB;EAAA,OAAzBA,yBAAyB;AAAA;AASrC,WAAYC,wBAAwB,0BAAxBA,wBAAwB;EAAxBA,wBAAwB;EAAxBA,wBAAwB;EAAxBA,wBAAwB;EAAA,OAAxBA,wBAAwB;AAAA;;AA2FpC;AACA;AACA;AACA","ignoreList":[]}
|
|
@@ -7,6 +7,7 @@ import { ChatEvent } from "../types/events.js";
|
|
|
7
7
|
import { mergeMessages } from "../utils/message.js";
|
|
8
8
|
import { isMessageRevoked } from "../utils/messageUtils.js";
|
|
9
9
|
import { useConversationStore } from "./conversation.js";
|
|
10
|
+
import { perfMark } from "../utils/perf-marker.js";
|
|
10
11
|
|
|
11
12
|
// Smaller than a typical "load more" page size elsewhere in the app on
|
|
12
13
|
// purpose: each page becomes a single prepend batch in ChatListLegend, and a
|
|
@@ -73,7 +74,16 @@ export const useMessageStore = create()((set, get) => ({
|
|
|
73
74
|
viewType: ViewType.History,
|
|
74
75
|
applicationType: applicationType
|
|
75
76
|
};
|
|
77
|
+
perfMark('history_page_request', {
|
|
78
|
+
loadMore: !!loadMore,
|
|
79
|
+
loaded: get().messages.length
|
|
80
|
+
});
|
|
76
81
|
const res = await OpenIMSDK.getAdvancedHistoryMessageListApp(params);
|
|
82
|
+
perfMark('history_page_response', {
|
|
83
|
+
loadMore: !!loadMore,
|
|
84
|
+
received: res.messageList?.length ?? 0,
|
|
85
|
+
isEnd: !!res.isEnd
|
|
86
|
+
});
|
|
77
87
|
if (conversationId === useConversationStore.getState().currentConversationId) {
|
|
78
88
|
set(state => ({
|
|
79
89
|
messages: loadMore ? mergeMessages(state.messages, res.messageList || []) : res.messageList || [],
|
|
@@ -81,6 +91,10 @@ export const useMessageStore = create()((set, get) => ({
|
|
|
81
91
|
initLoading: false,
|
|
82
92
|
moreOldLoading: false
|
|
83
93
|
}));
|
|
94
|
+
perfMark('history_list_update', {
|
|
95
|
+
loadMore: !!loadMore,
|
|
96
|
+
total: get().messages.length
|
|
97
|
+
});
|
|
84
98
|
}
|
|
85
99
|
} catch (error) {
|
|
86
100
|
console.log('Failed to get more old messages', error);
|