From 7bb5a660850b514aa8fdc3389c4da4f81da63f90 Mon Sep 17 00:00:00 2001 From: x86 <1960867973@qq.com> Date: Thu, 17 Oct 2024 19:49:39 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E6=8C=82=E6=96=AD=E9=9F=B3?= =?UTF-8?q?=E8=A7=86=E9=A2=91=E9=80=9A=E8=AF=9D=E4=B9=8B=E5=90=8E=EF=BC=8C?= =?UTF-8?q?=E6=B6=88=E6=81=AF=E5=88=97=E8=A1=A8=E7=9A=84=20callStart=20?= =?UTF-8?q?=E6=B6=88=E6=81=AF=E6=9C=AA=E5=AE=9E=E6=97=B6=E5=88=B7=E6=96=B0?= =?UTF-8?q?=20fix=20#440?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/store.js | 9 ++++++--- src/wfc/client/wfcEvent.js | 2 ++ src/wfc/proto/proto.min.js | 4 +++- 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/src/store.js b/src/store.js index c7ca84f2..0ae0158e 100644 --- a/src/store.js +++ b/src/store.js @@ -360,7 +360,7 @@ let store = { } }); - wfc.eventEmitter.on(EventType.MessageStatusUpdate, (message) => { + const messageStatusOrContentUpdateListener = (message) => { console.log('message status update', message) if (!this._isDisplayMessage(message)) { return; @@ -381,9 +381,12 @@ let store = { if (conversationState.currentConversationInfo.lastMessage && conversationState.currentConversationInfo.lastMessage.messageId === message.messageId) { Object.assign(conversationState.currentConversationInfo.lastMessage, message); - } - }); + } + + wfc.eventEmitter.on(EventType.MessageStatusUpdate, messageStatusOrContentUpdateListener); + + wfc.eventEmitter.on(EventType.MessageContentUpdate, messageStatusOrContentUpdateListener); wfc.eventEmitter.on(EventType.MessageRead, (readEntries) => { diff --git a/src/wfc/client/wfcEvent.js b/src/wfc/client/wfcEvent.js index 2381a596..862cfe6f 100644 --- a/src/wfc/client/wfcEvent.js +++ b/src/wfc/client/wfcEvent.js @@ -22,6 +22,8 @@ export default class EventType { static DeleteMessage = 'deleteMsg'; // function (message) {} static MessageStatusUpdate = 'msgStatusUpdate'; + // function (message) {} + static MessageContentUpdate = 'msgContentUpdate'; // function (connectionStatus) {} static ConnectionStatusChanged = 'connectionStatusChanged'; // function (host/ip/port) {} diff --git a/src/wfc/proto/proto.min.js b/src/wfc/proto/proto.min.js index acdfe6f5..273d38d8 100644 --- a/src/wfc/proto/proto.min.js +++ b/src/wfc/proto/proto.min.js @@ -499,7 +499,7 @@ class WfcImpl { } getConnectedNetworkType() { - return protoProxy.invoke('getConnectedNetworkType'); + return protoProxy.invoke('getConnectedNetworkType'); } setProtoUserAgent(userAgent) { @@ -2533,6 +2533,8 @@ class WfcImpl { async updateMessageContent(messageId, messageContent) { let protoMessageContent = messageContent.encode(); protoProxy.invoke('updateMessage', messageId, JSON.stringify(protoMessageContent)); + let msg = this.getMessageById(messageId) + this.eventEmitter.emit(EventType.MessageContentUpdate, msg); } async updateMessageStatus(messageId, status) {