feat: Add scanCache to NTQQApi

This commit is contained in:
Misa Liu 2024-02-27 17:47:30 +08:00
parent afe0ff89a7
commit f521873ba7
No known key found for this signature in database
GPG Key ID: F70B23D0A4FED791
3 changed files with 37 additions and 3 deletions

View File

@ -24,7 +24,8 @@ export enum ReceiveCmd {
MEDIA_DOWNLOAD_COMPLETE = "nodeIKernelMsgListener/onRichMediaDownloadComplete",
UNREAD_GROUP_NOTIFY = "nodeIKernelGroupListener/onGroupNotifiesUnreadCountUpdated",
GROUP_NOTIFY = "nodeIKernelGroupListener/onGroupSingleScreenNotifies",
FRIEND_REQUEST = "nodeIKernelBuddyListener/onBuddyReqChange"
FRIEND_REQUEST = "nodeIKernelBuddyListener/onBuddyReqChange",
CACHE_SCAN_FINISH = "nodeIKernelStorageCleanListener/onFinishScan",
}
interface NTQQApiReturnData<PayloadType = unknown> extends Array<any> {

View File

@ -16,6 +16,7 @@ import {
SelfInfo,
SendMessageElement,
User,
CacheScanResult,
ChatCacheList,
ChatCacheListItemBasic
} from "./types";
@ -79,7 +80,7 @@ export enum NTQQApiMethod {
CACHE_PATH_HOT_UPDATE = 'getHotUpdateCachePath', // TODO: Unused method
CACHE_PATH_DESKTOP_TEMP = 'getDesktopTmpPath', // TODO: Unused method
CACHE_PATH_SESSION = 'getCleanableAppSessionPathList', // TODO: Unused method
CACHE_SCAN = 'nodeIKernelStorageCleanService/scanCache',
CACHE_SCAN = 'nodeIKernelStorageCleanService/scanCache',
CACHE_CLEAR = '', // TODO
CACHE_CHAT_SCAN = 'nodeIKernelStorageCleanService/getChatCacheInfo',
@ -707,6 +708,20 @@ export class NTQQApi {
});
}
static scanCache() {
callNTQQApi<GeneralCallResult>({
channel: NTQQApiChannel.IPC_UP_3,
methodName: ReceiveCmd.CACHE_SCAN_FINISH,
classNameIsRegister: true,
}).then();
return callNTQQApi<CacheScanResult>({
channel: NTQQApiChannel.IPC_UP_3,
methodName: NTQQApiMethod.CACHE_SCAN,
args: [null, null],
timeoutSecond: 300,
});
}
static getChatCacheList(type: 1 | 2, pageSize: number = 80, pageIndex: number = 0) {
return new Promise<ChatCacheList>((res, rej) => {
callNTQQApi<ChatCacheList>({

View File

@ -355,6 +355,22 @@ export interface FriendRequestNotify {
buddyReqs: FriendRequest[]
}
}
export interface CacheScanResult {
result: number,
size: [ // 单位为字节
string, // 系统总存储空间
string, // 系统可用存储空间
string, // 系统已用存储空间
string, // QQ总大小
string, // 「聊天与文件」大小
string, // 未知
string, // 「缓存数据」大小
string, // 「其他数据」大小
string, // 未知
]
}
export interface ChatCacheList {
pageCount: number,
infos: ChatCacheListItem[]
@ -372,5 +388,7 @@ export interface ChatCacheListItemBasic {
uid: string,
uin: string,
remarkName: string,
nickName: string
nickName: string,
chatType?: 1 | 2,
isChecked?: boolean
}