|
|
|
@ -69,26 +69,31 @@ const Conversations = () => {
|
|
|
|
|
receivedMessageList(item.sn, data);
|
|
|
|
|
};
|
|
|
|
|
const switchConversation = async (item) => {
|
|
|
|
|
setCurrentConversation(item);
|
|
|
|
|
fetchCleanUnreadMsgCount({ opisn: item.opi_sn, whatsappid: item.whatsapp_phone_number });
|
|
|
|
|
const messagesList = activeConversations[`${item.sn}`] || [];
|
|
|
|
|
if (messagesList.length < 20) {
|
|
|
|
|
getMessages(item);
|
|
|
|
|
}
|
|
|
|
|
if (String(item.sn) === String(currentConversation.sn)) {
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
setCurrentConversation(item);
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
const onSwitchConversation = async (item) => {
|
|
|
|
|
if (!isEmpty(item.coli_sn)) {
|
|
|
|
|
switchConversation(item);
|
|
|
|
|
if (isEmpty(item.coli_sn)) {
|
|
|
|
|
navigate(`/order/chat`, { replace: true });
|
|
|
|
|
} else {
|
|
|
|
|
setSwitchToC(item);
|
|
|
|
|
setShouldFetchCList(false);
|
|
|
|
|
navigate(`/order/chat/${item.coli_sn}`, { replace: true });
|
|
|
|
|
} else {
|
|
|
|
|
navigate(`/order/chat`, { replace: true });
|
|
|
|
|
}
|
|
|
|
|
switchConversation(item);
|
|
|
|
|
// if (!isEmpty(item.coli_sn)) {
|
|
|
|
|
// setSwitchToC(item);
|
|
|
|
|
// setShouldFetchCList(false);
|
|
|
|
|
// navigate(`/order/chat/${item.coli_sn}`, { replace: true });
|
|
|
|
|
// } else {
|
|
|
|
|
// navigate(`/order/chat`, { replace: true });
|
|
|
|
|
// }
|
|
|
|
|
// switchConversation(item);
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
const handleConversationItemClose = async (item) => {
|
|
|
|
|