feat: implement uix add

This commit is contained in:
Il Harper 2024-03-06 13:03:02 +08:00
parent f9205d279e
commit 73d9fbd7dc
No known key found for this signature in database
GPG Key ID: 4B71FCA698E7E8EC
4 changed files with 44 additions and 2 deletions

View File

@ -6,6 +6,7 @@ import type {
OnMemberInfoChange,
OnMemberListChange,
OnMsgInfoListUpdate,
OnOpenParamChange,
OnProfileChanged,
OnRecentContactListChangedVer2,
OnRecvMsg,
@ -19,6 +20,7 @@ import type { ChronocatContext } from '@chronocat/shell'
import type { IpcManData } from 'ipcman'
import { ipcMan } from 'ipcman'
import { buildAssetsGet } from './api/internal/assets/get'
import { buildMessageCreate } from './api/message/create'
import {
chronoEventEmitter,
friendMap,
@ -29,7 +31,6 @@ import {
sendCallbackMap,
sendQueue,
} from './globalVars'
import { buildMessageCreate } from './api/message/create'
declare const __DEFINE_CHRONO_VERSION__: string
@ -156,6 +157,18 @@ export const apply = async (ctx: ChronocatContext) => {
return
}
case 'onOpenParamChange': {
const { data } = payload as OnOpenParamChange
for (const contact of data) {
ctx.chronocat.uix.add(contact.senderUid, contact.senderUin)
if (contact.chatType === ChatType.Private)
ctx.chronocat.uix.add(contact.peerUid, contact.peerUin)
}
return
}
case 'nodeIKernelMsgListener/onAddSendMsg': {
const { msgRecord } = payload as OnAddSendMsg
// msgRecord.sendStatus === 1, sending

View File

@ -6,6 +6,7 @@ import type {
OnMemberInfoChange,
OnMemberListChange,
OnMsgInfoListUpdate,
OnOpenParamChange,
OnProfileChanged,
OnRecentContactListChangedVer2,
OnRecvMsg,
@ -135,6 +136,18 @@ export const apply = async (ctx: ChronocatContext) => {
return
}
case 'onOpenParamChange': {
const { data } = payload as OnOpenParamChange
for (const contact of data) {
ctx.chronocat.uix.add(contact.senderUid, contact.senderUin)
if (contact.chatType === ChatType.Private)
ctx.chronocat.uix.add(contact.peerUid, contact.peerUin)
}
return
}
case 'nodeIKernelMsgService/getMsgsIncludeSelf': {
const { msgList } = payload as MsgsIncludeSelf

View File

@ -688,7 +688,7 @@ export interface Contact {
msgId: string
notifiedType: number
isBlock: boolean
listOfSpecificEventTypeInfosInMsgBox: unknown
listOfSpecificEventTypeInfosInMsgBox: SpecificEventTypeInfo[]
guildContactInfo: unknown
vasPersonalInfo: VasPersonalInfo
vasMsgInfo: VasMsgInfo
@ -749,6 +749,17 @@ export interface VasMsgInfo {
bubbleId: 0
}
export interface SpecificEventTypeInfo {
eventTypeInMsgBox: number // 2001
msgInfos: [
{
msgSeq: string
msgTime: string // '1700000000'
highlightDigest: ''
},
]
}
export interface ContactList {
listType: number
sortedContactList: string[]

View File

@ -1,4 +1,5 @@
import type {
Contact,
ContactList,
Group,
Member,
@ -154,3 +155,7 @@ export interface MsgsIncludeSelf {
errMsg: ''
msgList: RedMessage[]
}
export interface OnOpenParamChange {
data: Contact[]
}