|
|
|
@ -52,6 +52,14 @@ const initialConversationState = {
|
|
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
const globalNotifySlice = (set) => ({
|
|
|
|
|
globalNotify: [],
|
|
|
|
|
setGlobalNotify: (notify) => set(() => ({ globalNotify: notify })),
|
|
|
|
|
addGlobalNotify: (notify) => set((state) => ({ globalNotify: [...state.globalNotify, notify] })),
|
|
|
|
|
removeGlobalNotify: (id) => set((state) => ({ globalNotify: state.globalNotify.filter(item => item.id !== id) })),
|
|
|
|
|
clearGlobalNotify: () => set(() => ({ globalNotify: [] })),
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
// 顾问的自定义标签
|
|
|
|
|
const tagsSlice = (set) => ({
|
|
|
|
|
tags: [],
|
|
|
|
@ -143,7 +151,7 @@ const websocketSlice = (set, get) => ({
|
|
|
|
|
handleMessage: (data) => {
|
|
|
|
|
olog('handleMessage------------------');
|
|
|
|
|
// console.log(data);
|
|
|
|
|
const { updateMessageItem, sentOrReceivedNewMessage } = get();
|
|
|
|
|
const { updateMessageItem, sentOrReceivedNewMessage, addGlobalNotify } = get();
|
|
|
|
|
const { errcode, errmsg, result } = data;
|
|
|
|
|
|
|
|
|
|
if (!result) {
|
|
|
|
@ -172,6 +180,12 @@ const websocketSlice = (set, get) => ({
|
|
|
|
|
...(msgRender.type === 'photo' ? { image: msgRender.data.uri } : {}),
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
if ([
|
|
|
|
|
'email.action.received',
|
|
|
|
|
].includes(resultType)) {
|
|
|
|
|
const msgNotify = receivedMsgTypeMapped[resultType].contentToNotify(msgObj);
|
|
|
|
|
addGlobalNotify(msgNotify);
|
|
|
|
|
}
|
|
|
|
|
console.log('handleMessage*******************');
|
|
|
|
|
},
|
|
|
|
|
});
|
|
|
|
@ -405,6 +419,7 @@ export const useConversationStore = create(
|
|
|
|
|
...complexMsgSlice(set, get),
|
|
|
|
|
...tagsSlice(set, get),
|
|
|
|
|
...filterSlice(set, get),
|
|
|
|
|
...globalNotifySlice(set, get),
|
|
|
|
|
|
|
|
|
|
// state actions
|
|
|
|
|
addError: (error) => set((state) => ({ errors: [...state.errors, error] })),
|
|
|
|
|