Skip to content

Commit

Permalink
feat: update uix add
Browse files Browse the repository at this point in the history
  • Loading branch information
ilharp committed Oct 5, 2024
1 parent 8540f32 commit bdfc39a
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 1 deletion.
14 changes: 13 additions & 1 deletion packages/engine-chronocat-api/src/handler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import type {
OnMsgInfoListUpdate,
OnOpenParamChange,
OnProfileChanged,
OnProfileSimpleChanged,
OnRecentContactListChangedVer2,
OnRecvMsg,
OnRichMediaDownloadComplete,
Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -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

Expand Down
23 changes: 23 additions & 0 deletions packages/engine-chronocat-event/src/handler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import type {
OnMsgInfoListUpdate,
OnOpenParamChange,
OnProfileChanged,
OnProfileSimpleChanged,
OnRecentContactListChangedVer2,
OnRecvMsg,
Peer,
Expand Down Expand Up @@ -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':
Expand All @@ -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

Expand Down
4 changes: 4 additions & 0 deletions packages/red/src/redIpcEntity.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,10 @@ export interface OnProfileChanged {
info: Profile
}

export interface OnProfileSimpleChanged {
profiles: Record<string, UserSimpleInfo>
}

export interface OnMemberInfoChange {
groupCode: string
dataSource: number
Expand Down

0 comments on commit bdfc39a

Please sign in to comment.