From bdfc39acf9569d48fa34b30efec4c975fef52ae1 Mon Sep 17 00:00:00 2001 From: Il Harper Date: Sat, 5 Oct 2024 11:49:14 +0800 Subject: [PATCH] feat: update uix add --- packages/engine-chronocat-api/src/handler.ts | 14 ++++++++++- .../engine-chronocat-event/src/handler.ts | 23 +++++++++++++++++++ packages/red/src/redIpcEntity.ts | 4 ++++ 3 files changed, 40 insertions(+), 1 deletion(-) diff --git a/packages/engine-chronocat-api/src/handler.ts b/packages/engine-chronocat-api/src/handler.ts index 6e37b79..2dbefa2 100644 --- a/packages/engine-chronocat-api/src/handler.ts +++ b/packages/engine-chronocat-api/src/handler.ts @@ -10,6 +10,7 @@ import type { OnMsgInfoListUpdate, OnOpenParamChange, OnProfileChanged, + OnProfileSimpleChanged, OnRecentContactListChangedVer2, OnRecvMsg, OnRichMediaDownloadComplete, @@ -111,7 +112,8 @@ const responseDispatcher = async ( ) => { switch (method) { case 'nodeIKernelMsgListener/onRecvActiveMsg': - case 'nodeIKernelMsgListener/onRecvMsg': { + case 'nodeIKernelMsgListener/onRecvMsg': + case 'nodeIKernelMsgService/getAioFirstViewLatestMsgsAndAddActiveChat': { const { msgList } = payload as OnRecvMsg for (const msg of msgList) { @@ -169,6 +171,16 @@ const responseDispatcher = async ( return } + case 'onProfileSimpleChanged': { + const { profiles } = payload as OnProfileSimpleChanged + + if (profiles) + for (const uid in profiles) + ctx.chronocat.uix.add(uid, profiles[uid]!.uin) + + return + } + case 'nodeIKernelGroupListener/onMemberInfoChange': { const { members } = payload as OnMemberInfoChange diff --git a/packages/engine-chronocat-event/src/handler.ts b/packages/engine-chronocat-event/src/handler.ts index 235e31c..4a1a79b 100644 --- a/packages/engine-chronocat-event/src/handler.ts +++ b/packages/engine-chronocat-event/src/handler.ts @@ -11,6 +11,7 @@ import type { OnMsgInfoListUpdate, OnOpenParamChange, OnProfileChanged, + OnProfileSimpleChanged, OnRecentContactListChangedVer2, OnRecvMsg, Peer, @@ -122,6 +123,18 @@ const dispatcher = async ( return } + case 'nodeIKernelMsgService/getAioFirstViewLatestMsgsAndAddActiveChat': { + const { msgList } = payload as OnRecvMsg + + for (const msg of msgList) { + ctx.chronocat.uix.add(msg.senderUid, msg.senderUin) + if (msg.chatType === ChatType.Private) + ctx.chronocat.uix.add(msg.peerUid, msg.peerUin) + } + + return + } + case 'nodeIKernelProfileListener/onProfileSimpleChanged': case 'nodeIKernelProfileListener/onProfileDetailInfoChanged': case 'nodeIKernelGroupListener/onSearchMemberChange': @@ -142,6 +155,16 @@ const dispatcher = async ( return } + case 'onProfileSimpleChanged': { + const { profiles } = payload as OnProfileSimpleChanged + + if (profiles) + for (const uid in profiles) + ctx.chronocat.uix.add(uid, profiles[uid]!.uin) + + return + } + case 'nodeIKernelGroupListener/onMemberInfoChange': { const { members } = payload as OnMemberInfoChange diff --git a/packages/red/src/redIpcEntity.ts b/packages/red/src/redIpcEntity.ts index 6a27a30..5b1485e 100644 --- a/packages/red/src/redIpcEntity.ts +++ b/packages/red/src/redIpcEntity.ts @@ -36,6 +36,10 @@ export interface OnProfileChanged { info: Profile } +export interface OnProfileSimpleChanged { + profiles: Record +} + export interface OnMemberInfoChange { groupCode: string dataSource: number