feat: method & types update (#9)
This commit is contained in:
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
14
package-lock.json
generated
14
package-lock.json
generated
@@ -1,12 +1,12 @@
|
|||||||
{
|
{
|
||||||
"name": "@openim/electron-client-sdk",
|
"name": "@openim/electron-client-sdk",
|
||||||
"version": "1.0.9",
|
"version": "1.1.0",
|
||||||
"lockfileVersion": 3,
|
"lockfileVersion": 3,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"packages": {
|
"packages": {
|
||||||
"": {
|
"": {
|
||||||
"name": "@openim/electron-client-sdk",
|
"name": "@openim/electron-client-sdk",
|
||||||
"version": "1.0.9",
|
"version": "1.1.0",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"koffi": "^2.8.0",
|
"koffi": "^2.8.0",
|
||||||
@@ -15,7 +15,7 @@
|
|||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@commitlint/cli": "^16.2.4",
|
"@commitlint/cli": "^16.2.4",
|
||||||
"@commitlint/config-conventional": "^16.2.4",
|
"@commitlint/config-conventional": "^16.2.4",
|
||||||
"@openim/wasm-client-sdk": "^3.8.0",
|
"@openim/wasm-client-sdk": "^3.8.2-beta.4",
|
||||||
"@rollup/plugin-alias": "^5.1.0",
|
"@rollup/plugin-alias": "^5.1.0",
|
||||||
"@rollup/plugin-terser": "^0.4.4",
|
"@rollup/plugin-terser": "^0.4.4",
|
||||||
"@types/ffi-napi": "^4.0.10",
|
"@types/ffi-napi": "^4.0.10",
|
||||||
@@ -43,7 +43,7 @@
|
|||||||
"node": ">=12.0"
|
"node": ">=12.0"
|
||||||
},
|
},
|
||||||
"peerDependencies": {
|
"peerDependencies": {
|
||||||
"@openim/wasm-client-sdk": "^3.8.0",
|
"@openim/wasm-client-sdk": "^3.8.2-beta.3",
|
||||||
"electron": ">=12.0.0"
|
"electron": ">=12.0.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@@ -1882,9 +1882,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@openim/wasm-client-sdk": {
|
"node_modules/@openim/wasm-client-sdk": {
|
||||||
"version": "3.8.1",
|
"version": "3.8.2-beta.4",
|
||||||
"resolved": "https://registry.npmjs.org/@openim/wasm-client-sdk/-/wasm-client-sdk-3.8.1.tgz",
|
"resolved": "https://registry.npmjs.org/@openim/wasm-client-sdk/-/wasm-client-sdk-3.8.2-beta.4.tgz",
|
||||||
"integrity": "sha512-1z90Z5A24MCeIuQtvP68GhQ2bEaS+XjpqtSnpLA9qcahaQqErzanzwJ4kDbo+1+Z0MFNqnDzjlnUjyf2FRv41Q==",
|
"integrity": "sha512-AH1FgOiQFM9bL1R18/z2oZkZwXKVZTy6EpMaBfSV6giM/++fwV4zLS0W/vJ7u8CrZgkcIPaY7h+JR3ICxn/3vg==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=12.0"
|
"node": ">=12.0"
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@openim/electron-client-sdk",
|
"name": "@openim/electron-client-sdk",
|
||||||
"version": "1.0.9",
|
"version": "1.1.0",
|
||||||
"description": "open im sdk for node",
|
"description": "open im sdk for node",
|
||||||
"source": "src/index.ts",
|
"source": "src/index.ts",
|
||||||
"main": "lib/index.js",
|
"main": "lib/index.js",
|
||||||
@@ -43,9 +43,9 @@
|
|||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@commitlint/cli": "^16.2.4",
|
"@commitlint/cli": "^16.2.4",
|
||||||
"@commitlint/config-conventional": "^16.2.4",
|
"@commitlint/config-conventional": "^16.2.4",
|
||||||
|
"@openim/wasm-client-sdk": "^3.8.2-beta.4",
|
||||||
"@rollup/plugin-alias": "^5.1.0",
|
"@rollup/plugin-alias": "^5.1.0",
|
||||||
"@rollup/plugin-terser": "^0.4.4",
|
"@rollup/plugin-terser": "^0.4.4",
|
||||||
"@openim/wasm-client-sdk": "^3.8.0",
|
|
||||||
"@types/ffi-napi": "^4.0.10",
|
"@types/ffi-napi": "^4.0.10",
|
||||||
"@types/node": "^12.20.55",
|
"@types/node": "^12.20.55",
|
||||||
"@types/uuid": "^8.3.4",
|
"@types/uuid": "^8.3.4",
|
||||||
@@ -80,7 +80,7 @@
|
|||||||
"uuid": "^9.0.0"
|
"uuid": "^9.0.0"
|
||||||
},
|
},
|
||||||
"peerDependencies": {
|
"peerDependencies": {
|
||||||
"@openim/wasm-client-sdk": "^3.8.0",
|
"@openim/wasm-client-sdk": "^3.8.2-beta.3",
|
||||||
"electron": ">=12.0.0"
|
"electron": ">=12.0.0"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -24,6 +24,7 @@ import { CbEvents, LoginStatus, LogLevel } from '@openim/wasm-client-sdk';
|
|||||||
import { SelfUserInfo } from '@openim/wasm-client-sdk/lib/types/entity';
|
import { SelfUserInfo } from '@openim/wasm-client-sdk/lib/types/entity';
|
||||||
import {
|
import {
|
||||||
SetConversationExParams,
|
SetConversationExParams,
|
||||||
|
SetConversationParams,
|
||||||
SetFriendExParams,
|
SetFriendExParams,
|
||||||
UploadFileParams,
|
UploadFileParams,
|
||||||
} from '@openim/wasm-client-sdk/lib/types/params';
|
} from '@openim/wasm-client-sdk/lib/types/params';
|
||||||
@@ -364,47 +365,17 @@ class OpenIMSDK
|
|||||||
'void',
|
'void',
|
||||||
['baseCallback *', 'str', 'str']
|
['baseCallback *', 'str', 'str']
|
||||||
);
|
);
|
||||||
this.libOpenIMSDK.get_conversation_recv_message_opt = this.lib.func(
|
|
||||||
'__stdcall',
|
|
||||||
'get_conversation_recv_message_opt',
|
|
||||||
'void',
|
|
||||||
['baseCallback *', 'str', 'str']
|
|
||||||
);
|
|
||||||
this.libOpenIMSDK.set_conversation_draft = this.lib.func(
|
this.libOpenIMSDK.set_conversation_draft = this.lib.func(
|
||||||
'__stdcall',
|
'__stdcall',
|
||||||
'set_conversation_draft',
|
'set_conversation_draft',
|
||||||
'void',
|
'void',
|
||||||
['baseCallback *', 'str', 'str', 'str']
|
['baseCallback *', 'str', 'str', 'str']
|
||||||
);
|
);
|
||||||
this.libOpenIMSDK.reset_conversation_group_at_type = this.lib.func(
|
this.libOpenIMSDK.set_conversation = this.lib.func(
|
||||||
'__stdcall',
|
'__stdcall',
|
||||||
'reset_conversation_group_at_type',
|
'set_conversation',
|
||||||
'void',
|
'void',
|
||||||
['baseCallback *', 'str', 'str']
|
['baseCallback *', 'str', 'str', 'str']
|
||||||
);
|
|
||||||
this.libOpenIMSDK.pin_conversation = this.lib.func(
|
|
||||||
'__stdcall',
|
|
||||||
'pin_conversation',
|
|
||||||
'void',
|
|
||||||
['baseCallback *', 'str', 'str', 'int']
|
|
||||||
);
|
|
||||||
this.libOpenIMSDK.set_conversation_private_chat = this.lib.func(
|
|
||||||
'__stdcall',
|
|
||||||
'set_conversation_private_chat',
|
|
||||||
'void',
|
|
||||||
['baseCallback *', 'str', 'str', 'int']
|
|
||||||
);
|
|
||||||
this.libOpenIMSDK.set_conversation_burn_duration = this.lib.func(
|
|
||||||
'__stdcall',
|
|
||||||
'set_conversation_burn_duration',
|
|
||||||
'void',
|
|
||||||
['baseCallback *', 'str', 'str', 'int']
|
|
||||||
);
|
|
||||||
this.libOpenIMSDK.set_conversation_recv_message_opt = this.lib.func(
|
|
||||||
'__stdcall',
|
|
||||||
'set_conversation_recv_message_opt',
|
|
||||||
'void',
|
|
||||||
['baseCallback *', 'str', 'str', 'int']
|
|
||||||
);
|
);
|
||||||
this.libOpenIMSDK.get_total_unread_msg_count = this.lib.func(
|
this.libOpenIMSDK.get_total_unread_msg_count = this.lib.func(
|
||||||
'__stdcall',
|
'__stdcall',
|
||||||
@@ -544,11 +515,11 @@ class OpenIMSDK
|
|||||||
'void',
|
'void',
|
||||||
['baseCallback *', 'str', 'str']
|
['baseCallback *', 'str', 'str']
|
||||||
);
|
);
|
||||||
this.libOpenIMSDK.get_users_info_with_cache = this.lib.func(
|
this.libOpenIMSDK.get_users_info = this.lib.func(
|
||||||
'__stdcall',
|
'__stdcall',
|
||||||
'get_users_info_with_cache',
|
'get_users_info',
|
||||||
'void',
|
'void',
|
||||||
['baseCallback *', 'str', 'str', 'str']
|
['baseCallback *', 'str', 'str']
|
||||||
);
|
);
|
||||||
this.libOpenIMSDK.set_self_info = this.lib.func(
|
this.libOpenIMSDK.set_self_info = this.lib.func(
|
||||||
'__stdcall',
|
'__stdcall',
|
||||||
@@ -556,12 +527,6 @@ class OpenIMSDK
|
|||||||
'void',
|
'void',
|
||||||
['baseCallback *', 'str', 'str']
|
['baseCallback *', 'str', 'str']
|
||||||
);
|
);
|
||||||
this.libOpenIMSDK.set_global_recv_message_opt = this.lib.func(
|
|
||||||
'__stdcall',
|
|
||||||
'set_global_recv_message_opt',
|
|
||||||
'void',
|
|
||||||
['baseCallback *', 'str', 'int']
|
|
||||||
);
|
|
||||||
this.libOpenIMSDK.get_self_user_info = this.lib.func(
|
this.libOpenIMSDK.get_self_user_info = this.lib.func(
|
||||||
'__stdcall',
|
'__stdcall',
|
||||||
'get_self_user_info',
|
'get_self_user_info',
|
||||||
@@ -593,23 +558,29 @@ class OpenIMSDK
|
|||||||
['baseCallback *', 'str', 'str']
|
['baseCallback *', 'str', 'str']
|
||||||
);
|
);
|
||||||
// Friend functions
|
// Friend functions
|
||||||
this.libOpenIMSDK.get_specified_friends_info = this.lib.func(
|
this.libOpenIMSDK.update_friends = this.lib.func(
|
||||||
'__stdcall',
|
'__stdcall',
|
||||||
'get_specified_friends_info',
|
'get_specified_friends_info',
|
||||||
'void',
|
'void',
|
||||||
['baseCallback *', 'str', 'str']
|
['baseCallback *', 'str', 'str']
|
||||||
);
|
);
|
||||||
|
this.libOpenIMSDK.get_specified_friends_info = this.lib.func(
|
||||||
|
'__stdcall',
|
||||||
|
'get_specified_friends_info',
|
||||||
|
'void',
|
||||||
|
['baseCallback *', 'str', 'str', 'int']
|
||||||
|
);
|
||||||
this.libOpenIMSDK.get_friend_list = this.lib.func(
|
this.libOpenIMSDK.get_friend_list = this.lib.func(
|
||||||
'__stdcall',
|
'__stdcall',
|
||||||
'get_friend_list',
|
'get_friend_list',
|
||||||
'void',
|
'void',
|
||||||
['baseCallback *', 'str']
|
['baseCallback *', 'str', 'int']
|
||||||
);
|
);
|
||||||
this.libOpenIMSDK.get_friend_list_page = this.lib.func(
|
this.libOpenIMSDK.get_friend_list_page = this.lib.func(
|
||||||
'__stdcall',
|
'__stdcall',
|
||||||
'get_friend_list_page',
|
'get_friend_list_page',
|
||||||
'void',
|
'void',
|
||||||
['baseCallback *', 'str', 'int', 'int']
|
['baseCallback *', 'str', 'int', 'int', 'int']
|
||||||
);
|
);
|
||||||
this.libOpenIMSDK.search_friends = this.lib.func(
|
this.libOpenIMSDK.search_friends = this.lib.func(
|
||||||
'__stdcall',
|
'__stdcall',
|
||||||
@@ -629,12 +600,6 @@ class OpenIMSDK
|
|||||||
'void',
|
'void',
|
||||||
['baseCallback *', 'str', 'str']
|
['baseCallback *', 'str', 'str']
|
||||||
);
|
);
|
||||||
this.libOpenIMSDK.set_friend_remark = this.lib.func(
|
|
||||||
'__stdcall',
|
|
||||||
'set_friend_remark',
|
|
||||||
'void',
|
|
||||||
['baseCallback *', 'str', 'str']
|
|
||||||
);
|
|
||||||
this.libOpenIMSDK.delete_friend = this.lib.func(
|
this.libOpenIMSDK.delete_friend = this.lib.func(
|
||||||
'__stdcall',
|
'__stdcall',
|
||||||
'delete_friend',
|
'delete_friend',
|
||||||
@@ -720,12 +685,6 @@ class OpenIMSDK
|
|||||||
'void',
|
'void',
|
||||||
['baseCallback *', 'str', 'str', 'str', 'int']
|
['baseCallback *', 'str', 'str', 'str', 'int']
|
||||||
);
|
);
|
||||||
this.libOpenIMSDK.set_group_member_role_level = this.lib.func(
|
|
||||||
'__stdcall',
|
|
||||||
'set_group_member_role_level',
|
|
||||||
'void',
|
|
||||||
['baseCallback *', 'str', 'str', 'str', 'int']
|
|
||||||
);
|
|
||||||
this.libOpenIMSDK.set_group_member_info = this.lib.func(
|
this.libOpenIMSDK.set_group_member_info = this.lib.func(
|
||||||
'__stdcall',
|
'__stdcall',
|
||||||
'set_group_member_info',
|
'set_group_member_info',
|
||||||
@@ -880,18 +839,6 @@ class OpenIMSDK
|
|||||||
|
|
||||||
// advance
|
// advance
|
||||||
if (this.enterprise) {
|
if (this.enterprise) {
|
||||||
this.libOpenIMSDK.set_conversation_msg_destruct_time = this.lib.func(
|
|
||||||
'__stdcall',
|
|
||||||
'set_conversation_msg_destruct_time',
|
|
||||||
'void',
|
|
||||||
['baseCallback *', 'str', 'str', 'long long']
|
|
||||||
);
|
|
||||||
this.libOpenIMSDK.set_conversation_is_msg_destruct = this.lib.func(
|
|
||||||
'__stdcall',
|
|
||||||
'set_conversation_is_msg_destruct',
|
|
||||||
'void',
|
|
||||||
['baseCallback *', 'str', 'str', 'int']
|
|
||||||
);
|
|
||||||
this.libOpenIMSDK.send_group_message_read_receipt = this.lib.func(
|
this.libOpenIMSDK.send_group_message_read_receipt = this.lib.func(
|
||||||
'__stdcall',
|
'__stdcall',
|
||||||
'send_group_message_read_receipt',
|
'send_group_message_read_receipt',
|
||||||
@@ -973,48 +920,6 @@ class OpenIMSDK
|
|||||||
['baseCallback *', 'str']
|
['baseCallback *', 'str']
|
||||||
);
|
);
|
||||||
|
|
||||||
this.libOpenIMSDK.signaling_create_meeting = this.lib.func(
|
|
||||||
'__stdcall',
|
|
||||||
'signaling_create_meeting',
|
|
||||||
'void',
|
|
||||||
['baseCallback *', 'str', 'str']
|
|
||||||
);
|
|
||||||
|
|
||||||
this.libOpenIMSDK.signaling_join_meeting = this.lib.func(
|
|
||||||
'__stdcall',
|
|
||||||
'signaling_join_meeting',
|
|
||||||
'void',
|
|
||||||
['baseCallback *', 'str', 'str']
|
|
||||||
);
|
|
||||||
|
|
||||||
this.libOpenIMSDK.signaling_update_meeting_info = this.lib.func(
|
|
||||||
'__stdcall',
|
|
||||||
'signaling_update_meeting_info',
|
|
||||||
'void',
|
|
||||||
['baseCallback *', 'str', 'str']
|
|
||||||
);
|
|
||||||
|
|
||||||
this.libOpenIMSDK.signaling_close_room = this.lib.func(
|
|
||||||
'__stdcall',
|
|
||||||
'signaling_close_room',
|
|
||||||
'void',
|
|
||||||
['baseCallback *', 'str', 'str']
|
|
||||||
);
|
|
||||||
|
|
||||||
this.libOpenIMSDK.signaling_get_meetings = this.lib.func(
|
|
||||||
'__stdcall',
|
|
||||||
'signaling_get_meetings',
|
|
||||||
'void',
|
|
||||||
['baseCallback *', 'str']
|
|
||||||
);
|
|
||||||
|
|
||||||
this.libOpenIMSDK.signaling_operate_stream = this.lib.func(
|
|
||||||
'__stdcall',
|
|
||||||
'signaling_operate_stream',
|
|
||||||
'void',
|
|
||||||
['baseCallback *', 'str', 'str', 'str', 'str', 'int', 'int']
|
|
||||||
);
|
|
||||||
|
|
||||||
this.libOpenIMSDK.signaling_send_custom_signal = this.lib.func(
|
this.libOpenIMSDK.signaling_send_custom_signal = this.lib.func(
|
||||||
'__stdcall',
|
'__stdcall',
|
||||||
'signaling_send_custom_signal',
|
'signaling_send_custom_signal',
|
||||||
@@ -1350,7 +1255,7 @@ class OpenIMSDK
|
|||||||
// implements user api
|
// implements user api
|
||||||
getSelfUserInfo!: UserModuleApi['getSelfUserInfo'];
|
getSelfUserInfo!: UserModuleApi['getSelfUserInfo'];
|
||||||
setSelfInfo!: UserModuleApi['setSelfInfo'];
|
setSelfInfo!: UserModuleApi['setSelfInfo'];
|
||||||
getUsersInfoWithCache!: UserModuleApi['getUsersInfoWithCache'];
|
getUsersInfo!: UserModuleApi['getUsersInfo'];
|
||||||
subscribeUsersStatus!: UserModuleApi['subscribeUsersStatus'];
|
subscribeUsersStatus!: UserModuleApi['subscribeUsersStatus'];
|
||||||
unsubscribeUsersStatus!: UserModuleApi['unsubscribeUsersStatus'];
|
unsubscribeUsersStatus!: UserModuleApi['unsubscribeUsersStatus'];
|
||||||
getSubscribeUsersStatus!: UserModuleApi['getSubscribeUsersStatus'];
|
getSubscribeUsersStatus!: UserModuleApi['getSubscribeUsersStatus'];
|
||||||
@@ -1376,6 +1281,7 @@ class OpenIMSDK
|
|||||||
removeBlack!: FriendModuleApi['removeBlack'];
|
removeBlack!: FriendModuleApi['removeBlack'];
|
||||||
searchFriends!: FriendModuleApi['searchFriends'];
|
searchFriends!: FriendModuleApi['searchFriends'];
|
||||||
setFriendRemark!: FriendModuleApi['setFriendRemark'];
|
setFriendRemark!: FriendModuleApi['setFriendRemark'];
|
||||||
|
updateFriends!: FriendModuleApi['updateFriends'];
|
||||||
|
|
||||||
// implements group api
|
// implements group api
|
||||||
createGroup!: GroupModuleApi['createGroup'];
|
createGroup!: GroupModuleApi['createGroup'];
|
||||||
@@ -1409,6 +1315,7 @@ class OpenIMSDK
|
|||||||
getAllConversationList!: ConversationModuleApi['getAllConversationList'];
|
getAllConversationList!: ConversationModuleApi['getAllConversationList'];
|
||||||
getConversationListSplit!: ConversationModuleApi['getConversationListSplit'];
|
getConversationListSplit!: ConversationModuleApi['getConversationListSplit'];
|
||||||
getOneConversation!: ConversationModuleApi['getOneConversation'];
|
getOneConversation!: ConversationModuleApi['getOneConversation'];
|
||||||
|
setConversation!: ConversationModuleApi['setConversation'];
|
||||||
setConversationEx!: (
|
setConversationEx!: (
|
||||||
params: SetConversationExParams,
|
params: SetConversationExParams,
|
||||||
opid?: string | undefined
|
opid?: string | undefined
|
||||||
@@ -1480,12 +1387,7 @@ class OpenIMSDK
|
|||||||
signalingGetRoomByGroupID!: SignalingModuleApi['signalingGetRoomByGroupID'];
|
signalingGetRoomByGroupID!: SignalingModuleApi['signalingGetRoomByGroupID'];
|
||||||
signalingGetTokenByRoomID!: SignalingModuleApi['signalingGetTokenByRoomID'];
|
signalingGetTokenByRoomID!: SignalingModuleApi['signalingGetTokenByRoomID'];
|
||||||
signalingSendCustomSignal!: SignalingModuleApi['signalingSendCustomSignal'];
|
signalingSendCustomSignal!: SignalingModuleApi['signalingSendCustomSignal'];
|
||||||
signalingCreateMeeting!: SignalingModuleApi['signalingCreateMeeting'];
|
getSignalingInvitationInfoStartApp!: SignalingModuleApi['getSignalingInvitationInfoStartApp'];
|
||||||
signalingJoinMeeting!: SignalingModuleApi['signalingJoinMeeting'];
|
|
||||||
signalingUpdateMeetingInfo!: SignalingModuleApi['signalingUpdateMeetingInfo'];
|
|
||||||
signalingCloseRoom!: SignalingModuleApi['signalingCloseRoom'];
|
|
||||||
signalingGetMeetings!: SignalingModuleApi['signalingGetMeetings'];
|
|
||||||
signalingOperateStream!: SignalingModuleApi['signalingOperateStream'];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export default OpenIMSDK;
|
export default OpenIMSDK;
|
||||||
|
|||||||
@@ -12,8 +12,10 @@ import {
|
|||||||
SetConversationExParams,
|
SetConversationExParams,
|
||||||
SetConversationMsgDestructTimeParams,
|
SetConversationMsgDestructTimeParams,
|
||||||
SetConversationMsgDestructParams,
|
SetConversationMsgDestructParams,
|
||||||
|
SetConversationParams,
|
||||||
} from '@openim/wasm-client-sdk/lib/types/params';
|
} from '@openim/wasm-client-sdk/lib/types/params';
|
||||||
import { ConversationItem } from '@openim/wasm-client-sdk/lib/types/entity';
|
import { ConversationItem } from '@openim/wasm-client-sdk/lib/types/entity';
|
||||||
|
import { GroupAtType } from '@openim/wasm-client-sdk';
|
||||||
|
|
||||||
export function setupConversationModule(openIMSDK: OpenIMSDK) {
|
export function setupConversationModule(openIMSDK: OpenIMSDK) {
|
||||||
return {
|
return {
|
||||||
@@ -47,11 +49,13 @@ export function setupConversationModule(openIMSDK: OpenIMSDK) {
|
|||||||
}),
|
}),
|
||||||
setConversationEx: (params: SetConversationExParams, opid = uuidV4()) =>
|
setConversationEx: (params: SetConversationExParams, opid = uuidV4()) =>
|
||||||
new Promise<BaseResponse<void>>((resolve, reject) => {
|
new Promise<BaseResponse<void>>((resolve, reject) => {
|
||||||
openIMSDK.libOpenIMSDK.set_conversation_ex(
|
openIMSDK.libOpenIMSDK.set_conversation(
|
||||||
openIMSDK.baseCallbackWrap<void>(resolve, reject),
|
openIMSDK.baseCallbackWrap<void>(resolve, reject),
|
||||||
opid,
|
opid,
|
||||||
params.conversationID,
|
params.conversationID,
|
||||||
params.ex
|
JSON.stringify({
|
||||||
|
ex: params.ex,
|
||||||
|
})
|
||||||
);
|
);
|
||||||
}),
|
}),
|
||||||
getMultipleConversation: (conversationIDList: string, opid = uuidV4()) =>
|
getMultipleConversation: (conversationIDList: string, opid = uuidV4()) =>
|
||||||
@@ -101,13 +105,24 @@ export function setupConversationModule(openIMSDK: OpenIMSDK) {
|
|||||||
params.draftText
|
params.draftText
|
||||||
);
|
);
|
||||||
}),
|
}),
|
||||||
pinConversation: (params: SetConversationPinParams, opid = uuidV4()) =>
|
setConversation: (params: SetConversationParams, opid = uuidV4()) =>
|
||||||
new Promise<BaseResponse<void>>((resolve, reject) => {
|
new Promise<BaseResponse<void>>((resolve, reject) => {
|
||||||
openIMSDK.libOpenIMSDK.pin_conversation(
|
openIMSDK.libOpenIMSDK.set_conversation(
|
||||||
openIMSDK.baseCallbackWrap<void>(resolve, reject),
|
openIMSDK.baseCallbackWrap<void>(resolve, reject),
|
||||||
opid,
|
opid,
|
||||||
params.conversationID,
|
params.conversationID,
|
||||||
params.isPinned ? 1 : 0
|
JSON.stringify(params)
|
||||||
|
);
|
||||||
|
}),
|
||||||
|
pinConversation: (params: SetConversationPinParams, opid = uuidV4()) =>
|
||||||
|
new Promise<BaseResponse<void>>((resolve, reject) => {
|
||||||
|
openIMSDK.libOpenIMSDK.set_conversation(
|
||||||
|
openIMSDK.baseCallbackWrap<void>(resolve, reject),
|
||||||
|
opid,
|
||||||
|
params.conversationID,
|
||||||
|
JSON.stringify({
|
||||||
|
isPinned: params.isPinned,
|
||||||
|
})
|
||||||
);
|
);
|
||||||
}),
|
}),
|
||||||
setConversationRecvMessageOpt: (
|
setConversationRecvMessageOpt: (
|
||||||
@@ -115,11 +130,13 @@ export function setupConversationModule(openIMSDK: OpenIMSDK) {
|
|||||||
opid = uuidV4()
|
opid = uuidV4()
|
||||||
) =>
|
) =>
|
||||||
new Promise<BaseResponse<void>>((resolve, reject) => {
|
new Promise<BaseResponse<void>>((resolve, reject) => {
|
||||||
openIMSDK.libOpenIMSDK.set_conversation_recv_message_opt(
|
openIMSDK.libOpenIMSDK.set_conversation(
|
||||||
openIMSDK.baseCallbackWrap<void>(resolve, reject),
|
openIMSDK.baseCallbackWrap<void>(resolve, reject),
|
||||||
opid,
|
opid,
|
||||||
params.conversationID,
|
params.conversationID,
|
||||||
params.opt
|
JSON.stringify({
|
||||||
|
recvMsgOpt: params.opt,
|
||||||
|
})
|
||||||
);
|
);
|
||||||
}),
|
}),
|
||||||
setConversationPrivateChat: (
|
setConversationPrivateChat: (
|
||||||
@@ -127,11 +144,13 @@ export function setupConversationModule(openIMSDK: OpenIMSDK) {
|
|||||||
opid = uuidV4()
|
opid = uuidV4()
|
||||||
) =>
|
) =>
|
||||||
new Promise<BaseResponse<void>>((resolve, reject) => {
|
new Promise<BaseResponse<void>>((resolve, reject) => {
|
||||||
openIMSDK.libOpenIMSDK.set_conversation_private_chat(
|
openIMSDK.libOpenIMSDK.set_conversation(
|
||||||
openIMSDK.baseCallbackWrap<void>(resolve, reject),
|
openIMSDK.baseCallbackWrap<void>(resolve, reject),
|
||||||
opid,
|
opid,
|
||||||
params.conversationID,
|
params.conversationID,
|
||||||
params.isPrivate ? 1 : 0
|
JSON.stringify({
|
||||||
|
isPrivateChat: params.isPrivate,
|
||||||
|
})
|
||||||
);
|
);
|
||||||
}),
|
}),
|
||||||
setConversationBurnDuration: (
|
setConversationBurnDuration: (
|
||||||
@@ -139,19 +158,24 @@ export function setupConversationModule(openIMSDK: OpenIMSDK) {
|
|||||||
opid = uuidV4()
|
opid = uuidV4()
|
||||||
) =>
|
) =>
|
||||||
new Promise<BaseResponse<void>>((resolve, reject) => {
|
new Promise<BaseResponse<void>>((resolve, reject) => {
|
||||||
openIMSDK.libOpenIMSDK.set_conversation_burn_duration(
|
openIMSDK.libOpenIMSDK.set_conversation(
|
||||||
openIMSDK.baseCallbackWrap<void>(resolve, reject),
|
openIMSDK.baseCallbackWrap<void>(resolve, reject),
|
||||||
opid,
|
opid,
|
||||||
params.conversationID,
|
params.conversationID,
|
||||||
params.burnDuration
|
JSON.stringify({
|
||||||
|
burnDuration: params.burnDuration,
|
||||||
|
})
|
||||||
);
|
);
|
||||||
}),
|
}),
|
||||||
resetConversationGroupAtType: (groupID: string, opid = uuidV4()) =>
|
resetConversationGroupAtType: (conversationID: string, opid = uuidV4()) =>
|
||||||
new Promise<BaseResponse<void>>((resolve, reject) => {
|
new Promise<BaseResponse<void>>((resolve, reject) => {
|
||||||
openIMSDK.libOpenIMSDK.reset_conversation_group_at_type(
|
openIMSDK.libOpenIMSDK.set_conversation(
|
||||||
openIMSDK.baseCallbackWrap<void>(resolve, reject),
|
openIMSDK.baseCallbackWrap<void>(resolve, reject),
|
||||||
opid,
|
opid,
|
||||||
groupID
|
conversationID,
|
||||||
|
JSON.stringify({
|
||||||
|
groupAtType: GroupAtType.AtNormal,
|
||||||
|
})
|
||||||
);
|
);
|
||||||
}),
|
}),
|
||||||
hideConversation: (conversationID: string, opid = uuidV4()) =>
|
hideConversation: (conversationID: string, opid = uuidV4()) =>
|
||||||
@@ -196,11 +220,13 @@ export function setupConversationModule(openIMSDK: OpenIMSDK) {
|
|||||||
opid = uuidV4()
|
opid = uuidV4()
|
||||||
) =>
|
) =>
|
||||||
new Promise<BaseResponse<void>>((resolve, reject) => {
|
new Promise<BaseResponse<void>>((resolve, reject) => {
|
||||||
openIMSDK.libOpenIMSDK.set_conversation_msg_destruct_time(
|
openIMSDK.libOpenIMSDK.set_conversation(
|
||||||
openIMSDK.baseCallbackWrap<void>(resolve, reject),
|
openIMSDK.baseCallbackWrap<void>(resolve, reject),
|
||||||
opid,
|
opid,
|
||||||
params.conversationID,
|
params.conversationID,
|
||||||
params.msgDestructTime
|
JSON.stringify({
|
||||||
|
msgDestructTime: params.msgDestructTime,
|
||||||
|
})
|
||||||
);
|
);
|
||||||
}),
|
}),
|
||||||
setConversationIsMsgDestruct: (
|
setConversationIsMsgDestruct: (
|
||||||
@@ -208,11 +234,11 @@ export function setupConversationModule(openIMSDK: OpenIMSDK) {
|
|||||||
opid = uuidV4()
|
opid = uuidV4()
|
||||||
) =>
|
) =>
|
||||||
new Promise<BaseResponse<void>>((resolve, reject) => {
|
new Promise<BaseResponse<void>>((resolve, reject) => {
|
||||||
openIMSDK.libOpenIMSDK.set_conversation_is_msg_destruct(
|
openIMSDK.libOpenIMSDK.set_conversation(
|
||||||
openIMSDK.baseCallbackWrap<void>(resolve, reject),
|
openIMSDK.baseCallbackWrap<void>(resolve, reject),
|
||||||
opid,
|
opid,
|
||||||
params.conversationID,
|
params.conversationID,
|
||||||
params.isMsgDestruct ? 1 : 0
|
JSON.stringify({ isMsgDestruct: params.isMsgDestruct })
|
||||||
);
|
);
|
||||||
}),
|
}),
|
||||||
};
|
};
|
||||||
@@ -255,6 +281,10 @@ export interface ConversationModuleApi {
|
|||||||
params: SplitConversationParams,
|
params: SplitConversationParams,
|
||||||
opid?: string
|
opid?: string
|
||||||
) => Promise<BaseResponse<void>>;
|
) => Promise<BaseResponse<void>>;
|
||||||
|
setConversation: (
|
||||||
|
params: SetConversationParams,
|
||||||
|
opid?: string
|
||||||
|
) => Promise<BaseResponse<void>>;
|
||||||
setConversationRecvMessageOpt: (
|
setConversationRecvMessageOpt: (
|
||||||
params: SetConversationRecvOptParams,
|
params: SetConversationRecvOptParams,
|
||||||
opid?: string
|
opid?: string
|
||||||
@@ -268,7 +298,7 @@ export interface ConversationModuleApi {
|
|||||||
opid?: string
|
opid?: string
|
||||||
) => Promise<BaseResponse<void>>;
|
) => Promise<BaseResponse<void>>;
|
||||||
resetConversationGroupAtType: (
|
resetConversationGroupAtType: (
|
||||||
groupID: string,
|
conversationID: string,
|
||||||
opid?: string
|
opid?: string
|
||||||
) => Promise<BaseResponse<void>>;
|
) => Promise<BaseResponse<void>>;
|
||||||
hideConversation: (
|
hideConversation: (
|
||||||
|
|||||||
@@ -6,17 +6,20 @@ import {
|
|||||||
AccessFriendApplicationParams,
|
AccessFriendApplicationParams,
|
||||||
AddBlackParams,
|
AddBlackParams,
|
||||||
AddFriendParams,
|
AddFriendParams,
|
||||||
|
GetSpecifiedFriendsParams,
|
||||||
OffsetParams,
|
OffsetParams,
|
||||||
|
PinFriendParams,
|
||||||
RemarkFriendParams,
|
RemarkFriendParams,
|
||||||
SearchFriendParams,
|
SearchFriendParams,
|
||||||
SetFriendExParams,
|
SetFriendExParams,
|
||||||
|
UpdateFriendsParams,
|
||||||
} from '@openim/wasm-client-sdk/lib/types/params';
|
} from '@openim/wasm-client-sdk/lib/types/params';
|
||||||
import {
|
import {
|
||||||
FriendshipInfo,
|
FriendshipInfo,
|
||||||
BlackUserItem,
|
BlackUserItem,
|
||||||
FriendApplicationItem,
|
FriendApplicationItem,
|
||||||
FullUserItem,
|
|
||||||
SearchedFriendsInfo,
|
SearchedFriendsInfo,
|
||||||
|
FriendUserItem,
|
||||||
} from '@openim/wasm-client-sdk/lib/types/entity';
|
} from '@openim/wasm-client-sdk/lib/types/entity';
|
||||||
|
|
||||||
export function setupFriendModule(openIMSDK: OpenIMSDK) {
|
export function setupFriendModule(openIMSDK: OpenIMSDK) {
|
||||||
@@ -72,11 +75,13 @@ export function setupFriendModule(openIMSDK: OpenIMSDK) {
|
|||||||
|
|
||||||
setFriendsEx: (params: SetFriendExParams, opid = uuidV4()) =>
|
setFriendsEx: (params: SetFriendExParams, opid = uuidV4()) =>
|
||||||
new Promise<BaseResponse<void>>((resolve, reject) => {
|
new Promise<BaseResponse<void>>((resolve, reject) => {
|
||||||
openIMSDK.libOpenIMSDK.set_friends_ex(
|
openIMSDK.libOpenIMSDK.update_friends(
|
||||||
openIMSDK.baseCallbackWrap<void>(resolve, reject),
|
openIMSDK.baseCallbackWrap<void>(resolve, reject),
|
||||||
opid,
|
opid,
|
||||||
JSON.stringify(params),
|
JSON.stringify({
|
||||||
params.ex ?? ''
|
friendUserIDs: params.toUserIDs,
|
||||||
|
ex: params.ex,
|
||||||
|
})
|
||||||
);
|
);
|
||||||
}),
|
}),
|
||||||
|
|
||||||
@@ -104,29 +109,47 @@ export function setupFriendModule(openIMSDK: OpenIMSDK) {
|
|||||||
);
|
);
|
||||||
}),
|
}),
|
||||||
|
|
||||||
getFriendList: (opid = uuidV4()) =>
|
getFriendList: (filterBlack?: boolean, opid = uuidV4()) =>
|
||||||
new Promise<BaseResponse<FullUserItem[]>>((resolve, reject) => {
|
new Promise<BaseResponse<FriendUserItem[]>>((resolve, reject) => {
|
||||||
openIMSDK.libOpenIMSDK.get_friend_list(
|
openIMSDK.libOpenIMSDK.get_friend_list(
|
||||||
openIMSDK.baseCallbackWrap<FullUserItem[]>(resolve, reject),
|
openIMSDK.baseCallbackWrap<FriendUserItem[]>(resolve, reject),
|
||||||
opid
|
opid,
|
||||||
|
filterBlack ? 1 : 0
|
||||||
);
|
);
|
||||||
}),
|
}),
|
||||||
getFriendListPage: (params: OffsetParams, opid = uuidV4()) =>
|
getFriendListPage: (
|
||||||
new Promise<BaseResponse<FullUserItem[]>>((resolve, reject) => {
|
params: OffsetParams & { filterBlack?: boolean },
|
||||||
|
opid = uuidV4()
|
||||||
|
) =>
|
||||||
|
new Promise<BaseResponse<FriendUserItem[]>>((resolve, reject) => {
|
||||||
openIMSDK.libOpenIMSDK.get_friend_list_page(
|
openIMSDK.libOpenIMSDK.get_friend_list_page(
|
||||||
openIMSDK.baseCallbackWrap<FullUserItem[]>(resolve, reject),
|
openIMSDK.baseCallbackWrap<FriendUserItem[]>(resolve, reject),
|
||||||
opid,
|
opid,
|
||||||
params.offset,
|
params.offset,
|
||||||
params.count
|
params.count,
|
||||||
|
params.filterBlack ? 1 : 0
|
||||||
);
|
);
|
||||||
}),
|
}),
|
||||||
|
|
||||||
getSpecifiedFriendsInfo: (userIDList: string[], opid = uuidV4()) =>
|
updateFriends: (params: UpdateFriendsParams, opid = uuidV4()) =>
|
||||||
new Promise<BaseResponse<FullUserItem[]>>((resolve, reject) => {
|
new Promise<BaseResponse<FriendUserItem[]>>((resolve, reject) => {
|
||||||
openIMSDK.libOpenIMSDK.get_specified_friends_info(
|
openIMSDK.libOpenIMSDK.update_friends(
|
||||||
openIMSDK.baseCallbackWrap<FullUserItem[]>(resolve, reject),
|
openIMSDK.baseCallbackWrap<FriendUserItem[]>(resolve, reject),
|
||||||
opid,
|
opid,
|
||||||
JSON.stringify(userIDList)
|
JSON.stringify(params)
|
||||||
|
);
|
||||||
|
}),
|
||||||
|
|
||||||
|
getSpecifiedFriendsInfo: (
|
||||||
|
params: GetSpecifiedFriendsParams,
|
||||||
|
opid = uuidV4()
|
||||||
|
) =>
|
||||||
|
new Promise<BaseResponse<FriendUserItem[]>>((resolve, reject) => {
|
||||||
|
openIMSDK.libOpenIMSDK.get_specified_friends_info(
|
||||||
|
openIMSDK.baseCallbackWrap<FriendUserItem[]>(resolve, reject),
|
||||||
|
opid,
|
||||||
|
JSON.stringify(params.friendUserIDList),
|
||||||
|
params.filterBlack ? 1 : 0
|
||||||
);
|
);
|
||||||
}),
|
}),
|
||||||
|
|
||||||
@@ -162,10 +185,25 @@ export function setupFriendModule(openIMSDK: OpenIMSDK) {
|
|||||||
|
|
||||||
setFriendRemark: (params: RemarkFriendParams, opid = uuidV4()) =>
|
setFriendRemark: (params: RemarkFriendParams, opid = uuidV4()) =>
|
||||||
new Promise<BaseResponse<void>>((resolve, reject) => {
|
new Promise<BaseResponse<void>>((resolve, reject) => {
|
||||||
openIMSDK.libOpenIMSDK.set_friend_remark(
|
openIMSDK.libOpenIMSDK.update_friends(
|
||||||
openIMSDK.baseCallbackWrap<void>(resolve, reject),
|
openIMSDK.baseCallbackWrap<void>(resolve, reject),
|
||||||
opid,
|
opid,
|
||||||
JSON.stringify(params)
|
JSON.stringify({
|
||||||
|
friendUserIDs: [params.toUserID],
|
||||||
|
remark: params.remark,
|
||||||
|
})
|
||||||
|
);
|
||||||
|
}),
|
||||||
|
|
||||||
|
pinFriends: (params: PinFriendParams, opid = uuidV4()) =>
|
||||||
|
new Promise<BaseResponse<void>>((resolve, reject) => {
|
||||||
|
openIMSDK.libOpenIMSDK.update_friends(
|
||||||
|
openIMSDK.baseCallbackWrap<void>(resolve, reject),
|
||||||
|
opid,
|
||||||
|
JSON.stringify({
|
||||||
|
friendUserIDs: params.toUserIDs,
|
||||||
|
isPinned: params.isPinned,
|
||||||
|
})
|
||||||
);
|
);
|
||||||
}),
|
}),
|
||||||
};
|
};
|
||||||
@@ -194,15 +232,22 @@ export interface FriendModuleApi {
|
|||||||
getFriendApplicationListAsRecipient: (
|
getFriendApplicationListAsRecipient: (
|
||||||
opid?: string
|
opid?: string
|
||||||
) => Promise<BaseResponse<FriendApplicationItem[]>>;
|
) => Promise<BaseResponse<FriendApplicationItem[]>>;
|
||||||
getFriendList: (opid?: string) => Promise<BaseResponse<FullUserItem[]>>;
|
getFriendList: (
|
||||||
|
filterBlack?: boolean,
|
||||||
|
opid?: string
|
||||||
|
) => Promise<BaseResponse<FriendUserItem[]>>;
|
||||||
getFriendListPage: (
|
getFriendListPage: (
|
||||||
params: OffsetParams,
|
params: OffsetParams & { filterBlack?: boolean },
|
||||||
opid?: string
|
opid?: string
|
||||||
) => Promise<BaseResponse<FullUserItem[]>>;
|
) => Promise<BaseResponse<FriendUserItem[]>>;
|
||||||
|
updateFriends: (
|
||||||
|
params: UpdateFriendsParams,
|
||||||
|
opid?: string
|
||||||
|
) => Promise<BaseResponse<void>>;
|
||||||
getSpecifiedFriendsInfo: (
|
getSpecifiedFriendsInfo: (
|
||||||
userIDList: string[],
|
params: GetSpecifiedFriendsParams,
|
||||||
opid?: string
|
opid?: string
|
||||||
) => Promise<BaseResponse<FullUserItem[]>>;
|
) => Promise<BaseResponse<FriendUserItem[]>>;
|
||||||
refuseFriendApplication: (
|
refuseFriendApplication: (
|
||||||
params: AccessFriendApplicationParams,
|
params: AccessFriendApplicationParams,
|
||||||
opid?: string
|
opid?: string
|
||||||
|
|||||||
@@ -2,17 +2,13 @@ import { v4 as uuidV4 } from 'uuid';
|
|||||||
import OpenIMSDK from '..';
|
import OpenIMSDK from '..';
|
||||||
import { BaseResponse } from '@/types/entity';
|
import { BaseResponse } from '@/types/entity';
|
||||||
import {
|
import {
|
||||||
CreateMeetingParams,
|
|
||||||
CustomSignalParams,
|
CustomSignalParams,
|
||||||
MeetingOperateStreamParams,
|
|
||||||
RtcActionParams,
|
RtcActionParams,
|
||||||
SignalingInviteParams,
|
SignalingInviteParams,
|
||||||
UpdateMeetingParams,
|
|
||||||
} from '@openim/wasm-client-sdk/lib/types/params';
|
} from '@openim/wasm-client-sdk/lib/types/params';
|
||||||
import {
|
import {
|
||||||
RtcInviteResults,
|
RtcInviteResults,
|
||||||
CallingRoomData,
|
CallingRoomData,
|
||||||
MeetingRecord,
|
|
||||||
} from '@openim/wasm-client-sdk/lib/types/entity';
|
} from '@openim/wasm-client-sdk/lib/types/entity';
|
||||||
|
|
||||||
export function setupSignalingModule(openIMSDK: OpenIMSDK) {
|
export function setupSignalingModule(openIMSDK: OpenIMSDK) {
|
||||||
@@ -81,6 +77,13 @@ export function setupSignalingModule(openIMSDK: OpenIMSDK) {
|
|||||||
roomID
|
roomID
|
||||||
);
|
);
|
||||||
}),
|
}),
|
||||||
|
getSignalingInvitationInfoStartApp: (opid = uuidV4()) =>
|
||||||
|
new Promise<BaseResponse<RtcInviteResults>>((resolve, reject) => {
|
||||||
|
openIMSDK.libOpenIMSDK.get_signaling_invitation_info_start_app(
|
||||||
|
openIMSDK.baseCallbackWrap<RtcInviteResults>(resolve, reject),
|
||||||
|
opid
|
||||||
|
);
|
||||||
|
}),
|
||||||
signalingSendCustomSignal: (params: CustomSignalParams, opid = uuidV4()) =>
|
signalingSendCustomSignal: (params: CustomSignalParams, opid = uuidV4()) =>
|
||||||
new Promise<BaseResponse<void>>((resolve, reject) => {
|
new Promise<BaseResponse<void>>((resolve, reject) => {
|
||||||
openIMSDK.libOpenIMSDK.signaling_send_custom_signal(
|
openIMSDK.libOpenIMSDK.signaling_send_custom_signal(
|
||||||
@@ -90,70 +93,6 @@ export function setupSignalingModule(openIMSDK: OpenIMSDK) {
|
|||||||
params.roomID
|
params.roomID
|
||||||
);
|
);
|
||||||
}),
|
}),
|
||||||
signalingCreateMeeting: (params: CreateMeetingParams, opid = uuidV4()) =>
|
|
||||||
new Promise<BaseResponse<RtcInviteResults>>((resolve, reject) => {
|
|
||||||
openIMSDK.libOpenIMSDK.signaling_create_meeting(
|
|
||||||
openIMSDK.baseCallbackWrap<RtcInviteResults>(resolve, reject),
|
|
||||||
opid,
|
|
||||||
JSON.stringify(params)
|
|
||||||
);
|
|
||||||
}),
|
|
||||||
signalingJoinMeeting: (roomID: string, opid = uuidV4()) =>
|
|
||||||
new Promise<BaseResponse<RtcInviteResults>>((resolve, reject) => {
|
|
||||||
openIMSDK.libOpenIMSDK.signaling_join_meeting(
|
|
||||||
openIMSDK.baseCallbackWrap<RtcInviteResults>(resolve, reject),
|
|
||||||
opid,
|
|
||||||
JSON.stringify({
|
|
||||||
roomID,
|
|
||||||
})
|
|
||||||
);
|
|
||||||
}),
|
|
||||||
signalingUpdateMeetingInfo: (
|
|
||||||
params: Partial<UpdateMeetingParams> & { roomID: string },
|
|
||||||
opid = uuidV4()
|
|
||||||
) =>
|
|
||||||
new Promise<BaseResponse<void>>((resolve, reject) => {
|
|
||||||
openIMSDK.libOpenIMSDK.signaling_update_meeting_info(
|
|
||||||
openIMSDK.baseCallbackWrap<void>(resolve, reject),
|
|
||||||
opid,
|
|
||||||
JSON.stringify(params)
|
|
||||||
);
|
|
||||||
}),
|
|
||||||
signalingCloseRoom: (roomID: string, opid = uuidV4()) =>
|
|
||||||
new Promise<BaseResponse<void>>((resolve, reject) => {
|
|
||||||
openIMSDK.libOpenIMSDK.signaling_close_room(
|
|
||||||
openIMSDK.baseCallbackWrap<void>(resolve, reject),
|
|
||||||
opid,
|
|
||||||
roomID
|
|
||||||
);
|
|
||||||
}),
|
|
||||||
signalingGetMeetings: (opid = uuidV4()) =>
|
|
||||||
new Promise<BaseResponse<{ meetingInfoList: MeetingRecord[] }>>(
|
|
||||||
(resolve, reject) => {
|
|
||||||
openIMSDK.libOpenIMSDK.signaling_get_meetings(
|
|
||||||
openIMSDK.baseCallbackWrap<{ meetingInfoList: MeetingRecord[] }>(
|
|
||||||
resolve,
|
|
||||||
reject
|
|
||||||
),
|
|
||||||
opid
|
|
||||||
);
|
|
||||||
}
|
|
||||||
),
|
|
||||||
signalingOperateStream: (
|
|
||||||
params: MeetingOperateStreamParams,
|
|
||||||
opid = uuidV4()
|
|
||||||
) =>
|
|
||||||
new Promise<BaseResponse<void>>((resolve, reject) => {
|
|
||||||
openIMSDK.libOpenIMSDK.signaling_operate_stream(
|
|
||||||
openIMSDK.baseCallbackWrap<void>(resolve, reject),
|
|
||||||
opid,
|
|
||||||
params.streamType,
|
|
||||||
params.roomID,
|
|
||||||
params.userID ?? '',
|
|
||||||
params.mute ? 1 : 0,
|
|
||||||
params.muteAll ? 1 : 0
|
|
||||||
);
|
|
||||||
}),
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -190,31 +129,11 @@ export interface SignalingModuleApi {
|
|||||||
roomID: string,
|
roomID: string,
|
||||||
opid?: string
|
opid?: string
|
||||||
) => Promise<BaseResponse<RtcInviteResults>>;
|
) => Promise<BaseResponse<RtcInviteResults>>;
|
||||||
|
getSignalingInvitationInfoStartApp: (
|
||||||
|
opid?: string
|
||||||
|
) => Promise<BaseResponse<RtcInviteResults>>;
|
||||||
signalingSendCustomSignal: (
|
signalingSendCustomSignal: (
|
||||||
params: CustomSignalParams,
|
params: CustomSignalParams,
|
||||||
opid?: string
|
opid?: string
|
||||||
) => Promise<BaseResponse<void>>;
|
) => Promise<BaseResponse<void>>;
|
||||||
signalingCreateMeeting: (
|
|
||||||
params: CreateMeetingParams,
|
|
||||||
opid?: string
|
|
||||||
) => Promise<BaseResponse<RtcInviteResults>>;
|
|
||||||
signalingJoinMeeting: (
|
|
||||||
meetingID: string,
|
|
||||||
opid?: string
|
|
||||||
) => Promise<BaseResponse<RtcInviteResults>>;
|
|
||||||
signalingUpdateMeetingInfo: (
|
|
||||||
params: Partial<UpdateMeetingParams> & { roomID: string },
|
|
||||||
opid?: string
|
|
||||||
) => Promise<BaseResponse<void>>;
|
|
||||||
signalingCloseRoom: (
|
|
||||||
roomID: string,
|
|
||||||
opid?: string
|
|
||||||
) => Promise<BaseResponse<void>>;
|
|
||||||
signalingGetMeetings: (
|
|
||||||
opid?: string
|
|
||||||
) => Promise<BaseResponse<{ meetingInfoList: MeetingRecord[] }>>;
|
|
||||||
signalingOperateStream: (
|
|
||||||
params: MeetingOperateStreamParams,
|
|
||||||
opid?: string
|
|
||||||
) => Promise<BaseResponse<void>>;
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,13 +4,10 @@ import OpenIMSDK from '..';
|
|||||||
import { MessageReceiveOptType } from '@openim/wasm-client-sdk';
|
import { MessageReceiveOptType } from '@openim/wasm-client-sdk';
|
||||||
import {
|
import {
|
||||||
SelfUserInfo,
|
SelfUserInfo,
|
||||||
FullUserItemWithCache,
|
|
||||||
UserOnlineState,
|
UserOnlineState,
|
||||||
|
PublicUserItem,
|
||||||
} from '@openim/wasm-client-sdk/lib/types/entity';
|
} from '@openim/wasm-client-sdk/lib/types/entity';
|
||||||
import {
|
import { PartialUserItem } from '@openim/wasm-client-sdk/lib/types/params';
|
||||||
GetUserInfoWithCacheParams,
|
|
||||||
PartialUserItem,
|
|
||||||
} from '@openim/wasm-client-sdk/lib/types/params';
|
|
||||||
|
|
||||||
export function setupUserModule(openIMSDK: OpenIMSDK) {
|
export function setupUserModule(openIMSDK: OpenIMSDK) {
|
||||||
return {
|
return {
|
||||||
@@ -31,16 +28,12 @@ export function setupUserModule(openIMSDK: OpenIMSDK) {
|
|||||||
);
|
);
|
||||||
}),
|
}),
|
||||||
|
|
||||||
getUsersInfoWithCache: (
|
getUsersInfo: (params: string[], opid = uuidV4()) =>
|
||||||
params: GetUserInfoWithCacheParams,
|
new Promise<BaseResponse<PublicUserItem[]>>((resolve, reject) => {
|
||||||
opid = uuidV4()
|
openIMSDK.libOpenIMSDK.get_users_info(
|
||||||
) =>
|
openIMSDK.baseCallbackWrap<PublicUserItem[]>(resolve, reject),
|
||||||
new Promise<BaseResponse<FullUserItemWithCache[]>>((resolve, reject) => {
|
|
||||||
openIMSDK.libOpenIMSDK.get_users_info_with_cache(
|
|
||||||
openIMSDK.baseCallbackWrap<FullUserItemWithCache[]>(resolve, reject),
|
|
||||||
opid,
|
opid,
|
||||||
JSON.stringify(params.userIDList),
|
JSON.stringify(params)
|
||||||
params.groupID ?? ''
|
|
||||||
);
|
);
|
||||||
}),
|
}),
|
||||||
|
|
||||||
@@ -75,10 +68,12 @@ export function setupUserModule(openIMSDK: OpenIMSDK) {
|
|||||||
opid = uuidV4()
|
opid = uuidV4()
|
||||||
) =>
|
) =>
|
||||||
new Promise<BaseResponse<void>>((resolve, reject) => {
|
new Promise<BaseResponse<void>>((resolve, reject) => {
|
||||||
openIMSDK.libOpenIMSDK.set_global_recv_message_opt(
|
openIMSDK.libOpenIMSDK.set_self_info(
|
||||||
openIMSDK.baseCallbackWrap<void>(resolve, reject),
|
openIMSDK.baseCallbackWrap<void>(resolve, reject),
|
||||||
opid,
|
opid,
|
||||||
msgReceiveOptType
|
JSON.stringify({
|
||||||
|
globalRecvMsgOpt: msgReceiveOptType,
|
||||||
|
})
|
||||||
);
|
);
|
||||||
}),
|
}),
|
||||||
};
|
};
|
||||||
@@ -90,10 +85,10 @@ export interface UserModuleApi {
|
|||||||
params: PartialUserItem,
|
params: PartialUserItem,
|
||||||
opid?: string
|
opid?: string
|
||||||
) => Promise<BaseResponse<void>>;
|
) => Promise<BaseResponse<void>>;
|
||||||
getUsersInfoWithCache: (
|
getUsersInfo: (
|
||||||
params: GetUserInfoWithCacheParams,
|
params: string[],
|
||||||
opid?: string
|
opid?: string
|
||||||
) => Promise<BaseResponse<FullUserItemWithCache[]>>;
|
) => Promise<BaseResponse<PublicUserItem[]>>;
|
||||||
subscribeUsersStatus: (
|
subscribeUsersStatus: (
|
||||||
userIDList: string[],
|
userIDList: string[],
|
||||||
opid?: string
|
opid?: string
|
||||||
|
|||||||
12
src/main.ts
12
src/main.ts
@@ -1,4 +1,4 @@
|
|||||||
import { ipcMain, WebContents } from 'electron';
|
import { ipcMain, powerMonitor, WebContents } from 'electron';
|
||||||
import { CbEvents } from '@openim/wasm-client-sdk';
|
import { CbEvents } from '@openim/wasm-client-sdk';
|
||||||
import OpenIMSDK from './core';
|
import OpenIMSDK from './core';
|
||||||
|
|
||||||
@@ -10,9 +10,19 @@ class OpenIMSDKMain {
|
|||||||
if (webContent) {
|
if (webContent) {
|
||||||
this.webContents = [webContent];
|
this.webContents = [webContent];
|
||||||
}
|
}
|
||||||
|
this.systemStateHandler();
|
||||||
this.initMethodsHandler();
|
this.initMethodsHandler();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private systemStateHandler = () => {
|
||||||
|
powerMonitor.on('suspend', () => {
|
||||||
|
this.sdk.setAppBackgroundStatus(true);
|
||||||
|
});
|
||||||
|
powerMonitor.on('resume', () => {
|
||||||
|
this.sdk.setAppBackgroundStatus(false);
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
private initMethodsHandler = () => {
|
private initMethodsHandler = () => {
|
||||||
ipcMain.handle('openim-sdk-ipc-methods', async (_, method, ...args) => {
|
ipcMain.handle('openim-sdk-ipc-methods', async (_, method, ...args) => {
|
||||||
try {
|
try {
|
||||||
|
|||||||
@@ -1,5 +1,11 @@
|
|||||||
import { contextBridge, ipcRenderer } from 'electron';
|
import { contextBridge, ipcRenderer } from 'electron';
|
||||||
|
|
||||||
|
const updateOnlineStatus = () =>
|
||||||
|
ipcRenderer.invoke('openim-sdk-ipc-methods', 'networkStatusChanged');
|
||||||
|
|
||||||
|
window.addEventListener('online', updateOnlineStatus);
|
||||||
|
window.addEventListener('offline', updateOnlineStatus);
|
||||||
|
|
||||||
contextBridge.exposeInMainWorld('openIMRenderApi', {
|
contextBridge.exposeInMainWorld('openIMRenderApi', {
|
||||||
subscribe: (channel: string, callback: (...args: any[]) => void) => {
|
subscribe: (channel: string, callback: (...args: any[]) => void) => {
|
||||||
const subscription = (_: unknown, ...args: any[]) => callback(...args);
|
const subscription = (_: unknown, ...args: any[]) => callback(...args);
|
||||||
|
|||||||
122
src/types/libOpenIMSDK.d.ts
vendored
122
src/types/libOpenIMSDK.d.ts
vendored
@@ -158,18 +158,6 @@ declare module 'libOpenIMSDK' {
|
|||||||
operationID: string,
|
operationID: string,
|
||||||
conversationIDList: string
|
conversationIDList: string
|
||||||
): void;
|
): void;
|
||||||
set_conversation_msg_destruct_time(
|
|
||||||
cCallback: CB_S_I_S_S,
|
|
||||||
operationID: string,
|
|
||||||
conversationID: string,
|
|
||||||
msgDestructTime: number
|
|
||||||
): void;
|
|
||||||
set_conversation_is_msg_destruct(
|
|
||||||
cCallback: CB_S_I_S_S,
|
|
||||||
operationID: string,
|
|
||||||
conversationID: string,
|
|
||||||
isMsgDestruct: number
|
|
||||||
): void;
|
|
||||||
send_group_message_read_receipt(
|
send_group_message_read_receipt(
|
||||||
cCallback: CB_S_I_S_S,
|
cCallback: CB_S_I_S_S,
|
||||||
operationID: string,
|
operationID: string,
|
||||||
@@ -190,57 +178,23 @@ declare module 'libOpenIMSDK' {
|
|||||||
operationID: string,
|
operationID: string,
|
||||||
conversationID: string
|
conversationID: string
|
||||||
): void;
|
): void;
|
||||||
get_conversation_recv_message_opt(
|
|
||||||
cCallback: CB_S_I_S_S,
|
|
||||||
operationID: string,
|
|
||||||
conversationIDList: string
|
|
||||||
): void;
|
|
||||||
set_conversation_draft(
|
set_conversation_draft(
|
||||||
cCallback: CB_S_I_S_S,
|
cCallback: CB_S_I_S_S,
|
||||||
operationID: string,
|
operationID: string,
|
||||||
conversationID: string,
|
conversationID: string,
|
||||||
draftText: string
|
draftText: string
|
||||||
): void;
|
): void;
|
||||||
reset_conversation_group_at_type(
|
set_conversation(
|
||||||
cCallback: CB_S_I_S_S,
|
|
||||||
operationID: string,
|
|
||||||
conversationID: string
|
|
||||||
): void;
|
|
||||||
pin_conversation(
|
|
||||||
cCallback: CB_S_I_S_S,
|
cCallback: CB_S_I_S_S,
|
||||||
operationID: string,
|
operationID: string,
|
||||||
conversationID: string,
|
conversationID: string,
|
||||||
isPinned: number
|
conversationFields: string
|
||||||
): void;
|
|
||||||
set_conversation_private_chat(
|
|
||||||
cCallback: CB_S_I_S_S,
|
|
||||||
operationID: string,
|
|
||||||
conversationID: string,
|
|
||||||
isPrivate: number
|
|
||||||
): void;
|
|
||||||
set_conversation_burn_duration(
|
|
||||||
cCallback: CB_S_I_S_S,
|
|
||||||
operationID: string,
|
|
||||||
conversationID: string,
|
|
||||||
duration: number
|
|
||||||
): void;
|
|
||||||
set_conversation_recv_message_opt(
|
|
||||||
cCallback: CB_S_I_S_S,
|
|
||||||
operationID: string,
|
|
||||||
conversationID: string,
|
|
||||||
opt: number
|
|
||||||
): void;
|
): void;
|
||||||
get_total_unread_msg_count(
|
get_total_unread_msg_count(
|
||||||
cCallback: CB_S_I_S_S,
|
cCallback: CB_S_I_S_S,
|
||||||
operationID: string
|
operationID: string
|
||||||
): void;
|
): void;
|
||||||
get_at_all_tag(operationID: string): string;
|
get_at_all_tag(operationID: string): string;
|
||||||
set_conversation_ex(
|
|
||||||
cCallback: CB_S_I_S_S,
|
|
||||||
operationID: string,
|
|
||||||
conversationID: string,
|
|
||||||
ex: string
|
|
||||||
): void;
|
|
||||||
get_conversation_id_by_session_type(
|
get_conversation_id_by_session_type(
|
||||||
operationID: string,
|
operationID: string,
|
||||||
sourceID: string,
|
sourceID: string,
|
||||||
@@ -355,13 +309,7 @@ declare module 'libOpenIMSDK' {
|
|||||||
operationID: string,
|
operationID: string,
|
||||||
userIDs: string
|
userIDs: string
|
||||||
): void;
|
): void;
|
||||||
get_users_info_with_cache(
|
get_users_info(
|
||||||
cCallback: CB_S_I_S_S,
|
|
||||||
operationID: string,
|
|
||||||
userIDs: string,
|
|
||||||
groupID: string
|
|
||||||
): void;
|
|
||||||
get_users_info_from_srv(
|
|
||||||
cCallback: CB_S_I_S_S,
|
cCallback: CB_S_I_S_S,
|
||||||
operationID: string,
|
operationID: string,
|
||||||
userIDs: string
|
userIDs: string
|
||||||
@@ -371,11 +319,6 @@ declare module 'libOpenIMSDK' {
|
|||||||
operationID: string,
|
operationID: string,
|
||||||
userInfo: string
|
userInfo: string
|
||||||
): void;
|
): void;
|
||||||
set_global_recv_message_opt(
|
|
||||||
cCallback: CB_S_I_S_S,
|
|
||||||
operationID: string,
|
|
||||||
opt: number
|
|
||||||
): void;
|
|
||||||
get_self_user_info(cCallback: CB_S_I_S_S, operationID: string): void;
|
get_self_user_info(cCallback: CB_S_I_S_S, operationID: string): void;
|
||||||
update_msg_sender_info(
|
update_msg_sender_info(
|
||||||
cCallback: CB_S_I_S_S,
|
cCallback: CB_S_I_S_S,
|
||||||
@@ -406,26 +349,26 @@ declare module 'libOpenIMSDK' {
|
|||||||
get_specified_friends_info(
|
get_specified_friends_info(
|
||||||
cCallback: CB_S_I_S_S,
|
cCallback: CB_S_I_S_S,
|
||||||
operationID: string,
|
operationID: string,
|
||||||
userIDList: string
|
userIDList: string,
|
||||||
|
filterBlack?: number
|
||||||
|
): void;
|
||||||
|
get_friend_list(
|
||||||
|
cCallback: CB_S_I_S_S,
|
||||||
|
operationID: string,
|
||||||
|
filterBlack?: number
|
||||||
): void;
|
): void;
|
||||||
get_friend_list(cCallback: CB_S_I_S_S, operationID: string): void;
|
|
||||||
get_friend_list_page(
|
get_friend_list_page(
|
||||||
cCallback: CB_S_I_S_S,
|
cCallback: CB_S_I_S_S,
|
||||||
operationID: string,
|
operationID: string,
|
||||||
offset: number,
|
offset: number,
|
||||||
count: number
|
count: number,
|
||||||
|
filterBlack?: number
|
||||||
): void;
|
): void;
|
||||||
search_friends(
|
search_friends(
|
||||||
cCallback: CB_S_I_S_S,
|
cCallback: CB_S_I_S_S,
|
||||||
operationID: string,
|
operationID: string,
|
||||||
searchParam: string
|
searchParam: string
|
||||||
): void;
|
): void;
|
||||||
set_friends_ex(
|
|
||||||
cCallback: CB_S_I_S_S,
|
|
||||||
operationID: string,
|
|
||||||
toUserIDs: string,
|
|
||||||
ex: string
|
|
||||||
): void;
|
|
||||||
check_friend(
|
check_friend(
|
||||||
cCallback: CB_S_I_S_S,
|
cCallback: CB_S_I_S_S,
|
||||||
operationID: string,
|
operationID: string,
|
||||||
@@ -436,10 +379,10 @@ declare module 'libOpenIMSDK' {
|
|||||||
operationID: string,
|
operationID: string,
|
||||||
userIDReqMsg: string
|
userIDReqMsg: string
|
||||||
): void;
|
): void;
|
||||||
set_friend_remark(
|
update_friends(
|
||||||
cCallback: CB_S_I_S_S,
|
cCallback: CB_S_I_S_S,
|
||||||
operationID: string,
|
operationID: string,
|
||||||
userIDRemark: string
|
friendInfos: string
|
||||||
): void;
|
): void;
|
||||||
delete_friend(
|
delete_friend(
|
||||||
cCallback: CB_S_I_S_S,
|
cCallback: CB_S_I_S_S,
|
||||||
@@ -513,13 +456,6 @@ declare module 'libOpenIMSDK' {
|
|||||||
cUserID: string,
|
cUserID: string,
|
||||||
cMutedSeconds: number
|
cMutedSeconds: number
|
||||||
): void;
|
): void;
|
||||||
set_group_member_role_level(
|
|
||||||
cCallback: CB_S_I_S_S,
|
|
||||||
operationID: string,
|
|
||||||
cGroupID: string,
|
|
||||||
cUserID: string,
|
|
||||||
cRoleLevel: number
|
|
||||||
): void;
|
|
||||||
set_group_member_info(
|
set_group_member_info(
|
||||||
cCallback: CB_S_I_S_S,
|
cCallback: CB_S_I_S_S,
|
||||||
operationID: string,
|
operationID: string,
|
||||||
@@ -703,36 +639,6 @@ declare module 'libOpenIMSDK' {
|
|||||||
cCallback: CB_S_I_S_S,
|
cCallback: CB_S_I_S_S,
|
||||||
operationID: string
|
operationID: string
|
||||||
): void;
|
): void;
|
||||||
signaling_create_meeting(
|
|
||||||
cCallback: CB_S_I_S_S,
|
|
||||||
operationID: string,
|
|
||||||
cSignalingCreateMeetingReq: string
|
|
||||||
): void;
|
|
||||||
signaling_join_meeting(
|
|
||||||
cCallback: CB_S_I_S_S,
|
|
||||||
operationID: string,
|
|
||||||
cSignalingJoinMeetingReq: string
|
|
||||||
): void;
|
|
||||||
signaling_update_meeting_info(
|
|
||||||
cCallback: CB_S_I_S_S,
|
|
||||||
operationID: string,
|
|
||||||
cSignalingUpdateMeetingInfoReq: string
|
|
||||||
): void;
|
|
||||||
signaling_close_room(
|
|
||||||
cCallback: CB_S_I_S_S,
|
|
||||||
operationID: string,
|
|
||||||
cRoomID: string
|
|
||||||
): void;
|
|
||||||
signaling_get_meetings(cCallback: CB_S_I_S_S, operationID: string): void;
|
|
||||||
signaling_operate_stream(
|
|
||||||
cCallback: CB_S_I_S_S,
|
|
||||||
operationID: string,
|
|
||||||
cStreamType: string,
|
|
||||||
cRoomID: string,
|
|
||||||
cUserID: string,
|
|
||||||
mute: number,
|
|
||||||
muteAll: number
|
|
||||||
): void;
|
|
||||||
signaling_send_custom_signal(
|
signaling_send_custom_signal(
|
||||||
cCallback: CB_S_I_S_S,
|
cCallback: CB_S_I_S_S,
|
||||||
operationID: string,
|
operationID: string,
|
||||||
|
|||||||
Reference in New Issue
Block a user