feat(im): 添加即时通讯SDK核心功能
- 实现IM API接口定义,包括消息、群组、好友、黑名单等功能 - 定义IM消息相关数据模型,包含聊天类型、消息类型、用户资料等 - 实现ImSDK单例类,提供登录、消息发送、群组管理、好友管理等核心功能 - 添加WebSocket连接管理,支持自动重连机制 - 实现历史消息查询、群组操作、用户资料管理等API调用 - 添加会话状态管理,支持置顶、静音、草稿等功能 - 集成文件上传结果,支持多媒体消息发送 - 实现连接状态监听和事件回调机制
这个提交包含在:
父节点
d7f156f160
当前提交
c656bdd202
2
.hvigor/cache/file-cache.json
vendored
2
.hvigor/cache/file-cache.json
vendored
文件差异因一行或多行过长而隐藏
2
.hvigor/cache/task-cache.json
vendored
2
.hvigor/cache/task-cache.json
vendored
文件差异因一行或多行过长而隐藏
@ -16,13 +16,13 @@
|
|||||||
"IS_COMMAND_LINE_ENTRY_MODULE": false,
|
"IS_COMMAND_LINE_ENTRY_MODULE": false,
|
||||||
"MODULE_TYPE": "entry",
|
"MODULE_TYPE": "entry",
|
||||||
"INCREMENTAL_TASKS": {
|
"INCREMENTAL_TASKS": {
|
||||||
"COMPILE_ARKTS": false
|
"COMPILE_ARKTS": true
|
||||||
},
|
},
|
||||||
"IS_INCREMENTAL_MODULE": false
|
"IS_INCREMENTAL_MODULE": true
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"NATIVE_COMPILER": "Default",
|
"NATIVE_COMPILER": "Default",
|
||||||
"IS_FULL_BUILD": true,
|
"IS_FULL_BUILD": false,
|
||||||
"BUILD_MODE": "debug"
|
"BUILD_MODE": "debug"
|
||||||
},
|
},
|
||||||
"HVIGOR": {
|
"HVIGOR": {
|
||||||
@ -32,28 +32,20 @@
|
|||||||
"IS_HVIGORFILE_TYPE_CHECK": false,
|
"IS_HVIGORFILE_TYPE_CHECK": false,
|
||||||
"TASK_TIME": {
|
"TASK_TIME": {
|
||||||
"923fe53966c6cd9343e11af776cd4b05be315ea4b200b02e4d5dfb0f929b73bf": {
|
"923fe53966c6cd9343e11af776cd4b05be315ea4b200b02e4d5dfb0f929b73bf": {
|
||||||
"CreateModuleInfo": 327208,
|
"CreateModuleInfo": 388167,
|
||||||
"PreCheckSyscap": 124792,
|
"PreCheckSyscap": 136375,
|
||||||
"ProcessIntegratedHsp": 226959,
|
"ProcessIntegratedHsp": 322375,
|
||||||
"SyscapTransform": 6058625,
|
"SyscapTransform": 12371834,
|
||||||
"ProcessStartupConfig": 545625,
|
"ProcessStartupConfig": 1027750,
|
||||||
"ConfigureCmake": 60125,
|
"ConfigureCmake": 63042,
|
||||||
"BuildNativeWithCmake": 69833,
|
"BuildNativeWithCmake": 75791,
|
||||||
"BuildNativeWithNinja": 146584,
|
"BuildNativeWithNinja": 124459,
|
||||||
"BuildJS": 700000,
|
"BuildJS": 962083
|
||||||
"CompileArkTS": 2592629166,
|
|
||||||
"GeneratePkgModuleJson": 988958,
|
|
||||||
"ProcessCompiledResources": 154291,
|
|
||||||
"PackageHap": 252960708,
|
|
||||||
"PackingCheck": 2527625,
|
|
||||||
"SignHap": 375083,
|
|
||||||
"CollectDebugSymbol": 263875,
|
|
||||||
"assembleHap": 49500
|
|
||||||
},
|
},
|
||||||
"77aabe6c19463543339f337db9c84e4d10fd2f56ea0aedaf85a0214d59e93ec4": {
|
"77aabe6c19463543339f337db9c84e4d10fd2f56ea0aedaf85a0214d59e93ec4": {
|
||||||
"ConfigureCmake": 69459,
|
"ConfigureCmake": 70375,
|
||||||
"BuildNativeWithCmake": 70958,
|
"BuildNativeWithCmake": 86667,
|
||||||
"BuildNativeWithNinja": 202959
|
"BuildNativeWithNinja": 204500
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"APIS": [
|
"APIS": [
|
||||||
@ -64,7 +56,13 @@
|
|||||||
"ENABLE_CPP_FUNCTION_LEVEL_INCREMENTAL": false
|
"ENABLE_CPP_FUNCTION_LEVEL_INCREMENTAL": false
|
||||||
},
|
},
|
||||||
"CONFIG_PROPERTIES": {},
|
"CONFIG_PROPERTIES": {},
|
||||||
"BUILD_ID": "202604281921524500",
|
"BUILD_ID": "202604282057530700",
|
||||||
"TOTAL_TIME": 3511224541
|
"ERROR_MESSAGE": [
|
||||||
|
{
|
||||||
|
"CODE": "00000000",
|
||||||
|
"TIMESTAMP": "1777381083000"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"TOTAL_TIME": 9931347791
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
文件差异内容过多而无法显示
加载差异
文件差异内容过多而无法显示
加载差异
文件差异内容过多而无法显示
加载差异
文件差异内容过多而无法显示
加载差异
@ -271,6 +271,33 @@ export class ImClient {
|
|||||||
return HttpClient.get<ImGroup>('/api/im/groups/' + encodeURIComponent(groupId), this.buildAppQuery())
|
return HttpClient.get<ImGroup>('/api/im/groups/' + encodeURIComponent(groupId), this.buildAppQuery())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async searchUsers(keyword: string, size: number = 20): Promise<UserProfile[]> {
|
||||||
|
return HttpClient.get<UserProfile[]>(
|
||||||
|
'/api/im/admin/users/search',
|
||||||
|
this.buildSearchQuery(keyword, size),
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
async searchGroups(keyword: string, size: number = 20): Promise<ImGroup[]> {
|
||||||
|
return HttpClient.get<ImGroup[]>(
|
||||||
|
'/api/im/admin/groups/search',
|
||||||
|
this.buildSearchQuery(keyword, size),
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
async searchMessages(
|
||||||
|
keyword: string = '',
|
||||||
|
chatType: ChatType | '' = '',
|
||||||
|
msgType: MsgType | '' = '',
|
||||||
|
page: number = 0,
|
||||||
|
size: number = 20,
|
||||||
|
): Promise<PageResult<ImMessage>> {
|
||||||
|
return HttpClient.get<PageResult<ImMessage>>(
|
||||||
|
'/api/im/admin/messages/search',
|
||||||
|
this.buildMessageSearchQuery(keyword, chatType, msgType, page, size),
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
async sendFriendRequest(toUserId: string, remark: string | null = null): Promise<FriendRequest> {
|
async sendFriendRequest(toUserId: string, remark: string | null = null): Promise<FriendRequest> {
|
||||||
const params = new FriendRequestBody()
|
const params = new FriendRequestBody()
|
||||||
params.appId = SDKContext.getConfig().appKey
|
params.appId = SDKContext.getConfig().appKey
|
||||||
@ -366,6 +393,35 @@ export class ImClient {
|
|||||||
return 'appId=' + encodeURIComponent(SDKContext.getConfig().appKey) + '&direction=' + encodeURIComponent(direction)
|
return 'appId=' + encodeURIComponent(SDKContext.getConfig().appKey) + '&direction=' + encodeURIComponent(direction)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private buildSearchQuery(keyword: string, size: number): string {
|
||||||
|
return 'appId=' + encodeURIComponent(SDKContext.getConfig().appKey) +
|
||||||
|
'&keyword=' + encodeURIComponent(keyword) +
|
||||||
|
'&size=' + encodeURIComponent(size)
|
||||||
|
}
|
||||||
|
|
||||||
|
private buildMessageSearchQuery(
|
||||||
|
keyword: string,
|
||||||
|
chatType: ChatType | '',
|
||||||
|
msgType: MsgType | '',
|
||||||
|
page: number,
|
||||||
|
size: number,
|
||||||
|
): string {
|
||||||
|
const parts: string[] = []
|
||||||
|
parts.push('appId=' + encodeURIComponent(SDKContext.getConfig().appKey))
|
||||||
|
if (keyword !== '') {
|
||||||
|
parts.push('keyword=' + encodeURIComponent(keyword))
|
||||||
|
}
|
||||||
|
if (chatType !== '') {
|
||||||
|
parts.push('chatType=' + encodeURIComponent(chatType))
|
||||||
|
}
|
||||||
|
if (msgType !== '') {
|
||||||
|
parts.push('msgType=' + encodeURIComponent(msgType))
|
||||||
|
}
|
||||||
|
parts.push('page=' + encodeURIComponent(page))
|
||||||
|
parts.push('size=' + encodeURIComponent(size))
|
||||||
|
return parts.join('&')
|
||||||
|
}
|
||||||
|
|
||||||
private buildHistoryQuery(page: number, size: number, query: HistoryQuery): string {
|
private buildHistoryQuery(page: number, size: number, query: HistoryQuery): string {
|
||||||
const parts: string[] = []
|
const parts: string[] = []
|
||||||
parts.push('appId=' + encodeURIComponent(SDKContext.getConfig().appKey))
|
parts.push('appId=' + encodeURIComponent(SDKContext.getConfig().appKey))
|
||||||
|
|||||||
正在加载...
在新工单中引用
屏蔽一个用户