diff --git a/assets/linux_arm64/libopenimsdk.so b/assets/linux_arm64/libopenimsdk.so index f525496..32cfc71 100644 Binary files a/assets/linux_arm64/libopenimsdk.so and b/assets/linux_arm64/libopenimsdk.so differ diff --git a/assets/linux_x64/libopenimsdk.so b/assets/linux_x64/libopenimsdk.so index 7e10f5b..7c3895a 100644 Binary files a/assets/linux_x64/libopenimsdk.so and b/assets/linux_x64/libopenimsdk.so differ diff --git a/assets/mac_arm64/libopenimsdk.dylib b/assets/mac_arm64/libopenimsdk.dylib index 414c44c..f067493 100644 Binary files a/assets/mac_arm64/libopenimsdk.dylib and b/assets/mac_arm64/libopenimsdk.dylib differ diff --git a/assets/mac_x64/libopenimsdk.dylib b/assets/mac_x64/libopenimsdk.dylib index 5551755..f421972 100644 Binary files a/assets/mac_x64/libopenimsdk.dylib and b/assets/mac_x64/libopenimsdk.dylib differ diff --git a/assets/win_ia32/.gitkeep b/assets/win_ia32/.gitkeep deleted file mode 100644 index e69de29..0000000 diff --git a/assets/win_ia32/libopenimsdk.dll b/assets/win_ia32/libopenimsdk.dll new file mode 100644 index 0000000..54ccc6a Binary files /dev/null and b/assets/win_ia32/libopenimsdk.dll differ diff --git a/assets/win_x64/libopenimsdk.dll b/assets/win_x64/libopenimsdk.dll index d3a81cd..a52c228 100644 Binary files a/assets/win_x64/libopenimsdk.dll and b/assets/win_x64/libopenimsdk.dll differ diff --git a/package-lock.json b/package-lock.json index 7b53f59..b3cc6a3 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,21 +1,21 @@ { "name": "@openim/electron-client-sdk", - "version": "1.1.0", + "version": "1.1.1", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "@openim/electron-client-sdk", - "version": "1.1.0", + "version": "1.1.1", "license": "MIT", "dependencies": { - "koffi": "^2.8.0", + "koffi": "2.8.0", "uuid": "^9.0.0" }, "devDependencies": { "@commitlint/cli": "^16.2.4", "@commitlint/config-conventional": "^16.2.4", - "@openim/wasm-client-sdk": "^3.8.2-beta.4", + "@openim/wasm-client-sdk": "^3.8.2-1", "@rollup/plugin-alias": "^5.1.0", "@rollup/plugin-terser": "^0.4.4", "@types/ffi-napi": "^4.0.10", @@ -43,7 +43,7 @@ "node": ">=12.0" }, "peerDependencies": { - "@openim/wasm-client-sdk": "^3.8.2-beta.3", + "@openim/wasm-client-sdk": "^3.8.2-1", "electron": ">=12.0.0" } }, @@ -1882,9 +1882,9 @@ } }, "node_modules/@openim/wasm-client-sdk": { - "version": "3.8.2-beta.4", - "resolved": "https://registry.npmjs.org/@openim/wasm-client-sdk/-/wasm-client-sdk-3.8.2-beta.4.tgz", - "integrity": "sha512-AH1FgOiQFM9bL1R18/z2oZkZwXKVZTy6EpMaBfSV6giM/++fwV4zLS0W/vJ7u8CrZgkcIPaY7h+JR3ICxn/3vg==", + "version": "3.8.2-1", + "resolved": "https://registry.npmjs.org/@openim/wasm-client-sdk/-/wasm-client-sdk-3.8.2-1.tgz", + "integrity": "sha512-ntpmRJrZVzaAM7MbA1BsY1jgeGEJUlyWGH6Yqz5+yjd1qNBL4f7SysiDXYHoizOWNNWCSGzeC8iZPDMRIS0hEw==", "dev": true, "engines": { "node": ">=12.0" diff --git a/package.json b/package.json index c7671c3..e822b99 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@openim/electron-client-sdk", - "version": "1.1.1", + "version": "1.1.2", "description": "open im sdk for node", "source": "src/index.ts", "main": "lib/index.js", @@ -43,7 +43,7 @@ "devDependencies": { "@commitlint/cli": "^16.2.4", "@commitlint/config-conventional": "^16.2.4", - "@openim/wasm-client-sdk": "^3.8.2", + "@openim/wasm-client-sdk": "^3.8.2-1", "@rollup/plugin-alias": "^5.1.0", "@rollup/plugin-terser": "^0.4.4", "@types/ffi-napi": "^4.0.10", @@ -76,11 +76,11 @@ "*.ts": "eslint --cache --cache-location .eslintcache --fix" }, "dependencies": { - "koffi": "^2.8.0", + "koffi": "2.8.0", "uuid": "^9.0.0" }, "peerDependencies": { - "@openim/wasm-client-sdk": "^3.8.2", + "@openim/wasm-client-sdk": "^3.8.2-1", "electron": ">=12.0.0" } } diff --git a/src/constant/callback.ts b/src/constant/callback.ts index 9f44ad9..2f5c06d 100644 --- a/src/constant/callback.ts +++ b/src/constant/callback.ts @@ -130,12 +130,13 @@ export const eventMapping: Record = { [NativeEvent.RECV_MESSAGE_EXTENSIONS_CHANGED]: CbEvents.UnUsedEvent, [NativeEvent.RECV_MESSAGE_EXTENSIONS_DELETED]: CbEvents.UnUsedEvent, [NativeEvent.RECV_MESSAGE_EXTENSIONS_ADDED]: CbEvents.UnUsedEvent, - [NativeEvent.RECV_OFFLINE_NEW_MESSAGE]: CbEvents.UnUsedEvent, + [NativeEvent.RECV_OFFLINE_NEW_MESSAGE]: CbEvents.OnRecvOfflineNewMessage, [NativeEvent.MSG_DELETED]: CbEvents.UnUsedEvent, - [NativeEvent.RECV_OFFLINE_NEW_MESSAGES]: CbEvents.UnUsedEvent, + [NativeEvent.RECV_OFFLINE_NEW_MESSAGES]: CbEvents.OnRecvOfflineNewMessages, [NativeEvent.MESSAGE_KV_INFO_CHANGED]: CbEvents.UnUsedEvent, - [NativeEvent.CONVERSATION_USER_INPUT_STATUS_CHANGED]: CbEvents.UnUsedEvent, - [NativeEvent.RECV_ONLINE_ONLY_MESSAGE]: CbEvents.UnUsedEvent, + [NativeEvent.CONVERSATION_USER_INPUT_STATUS_CHANGED]: + CbEvents.OnConversationUserInputStatusChanged, + [NativeEvent.RECV_ONLINE_ONLY_MESSAGE]: CbEvents.OnRecvOnlineOnlyMessage, [NativeEvent.RECV_NEW_INVITATION]: CbEvents.OnReceiveNewInvitation, [NativeEvent.INVITEE_ACCEPTED]: CbEvents.OnInviteeAccepted, [NativeEvent.INVITEE_ACCEPTED_BY_OTHER_DEVICE]: diff --git a/src/core/index.ts b/src/core/index.ts index 731276e..e8aaada 100644 --- a/src/core/index.ts +++ b/src/core/index.ts @@ -462,6 +462,18 @@ class OpenIMSDK 'void', ['baseCallback *', 'str', 'str', 'str'] ); + this.libOpenIMSDK.change_input_states = this.lib.func( + '__stdcall', + 'change_input_states', + 'void', + ['baseCallback *', 'str', 'str', 'int'] + ); + this.libOpenIMSDK.get_input_states = this.lib.func( + '__stdcall', + 'get_input_states', + 'void', + ['baseCallback *', 'str', 'str', 'str'] + ); this.libOpenIMSDK.hide_all_conversations = this.lib.func( '__stdcall', 'hide_all_conversations', @@ -1127,7 +1139,7 @@ class OpenIMSDK unInitSDK = (opid = uuidV4()) => this.asyncRetunWrap( - opid, + `unInitSDK-${opid}`, this.libOpenIMSDK.un_init_sdk(`unInitSDK-${opid}`) ); @@ -1345,6 +1357,8 @@ class OpenIMSDK deleteConversationAndDeleteAllMsg!: ConversationModuleApi['deleteConversationAndDeleteAllMsg']; setConversationMsgDestructTime!: ConversationModuleApi['setConversationMsgDestructTime']; setConversationIsMsgDestruct!: ConversationModuleApi['setConversationIsMsgDestruct']; + changeInputStates!: ConversationModuleApi['changeInputStates']; + getInputStates!: ConversationModuleApi['getInputStates']; // implements message api createTextMessage!: MessageModuleApi['createTextMessage']; diff --git a/src/core/modules/conversation.ts b/src/core/modules/conversation.ts index 7972151..445ce3c 100644 --- a/src/core/modules/conversation.ts +++ b/src/core/modules/conversation.ts @@ -13,9 +13,11 @@ import { SetConversationMsgDestructTimeParams, SetConversationMsgDestructParams, SetConversationParams, + ChangeInputStatesParams, + GetInputstatesParams, } from '@openim/wasm-client-sdk/lib/types/params'; import { ConversationItem } from '@openim/wasm-client-sdk/lib/types/entity'; -import { GroupAtType } from '@openim/wasm-client-sdk'; +import { GroupAtType, Platform } from '@openim/wasm-client-sdk'; export function setupConversationModule(openIMSDK: OpenIMSDK) { return { @@ -241,6 +243,24 @@ export function setupConversationModule(openIMSDK: OpenIMSDK) { JSON.stringify({ isMsgDestruct: params.isMsgDestruct }) ); }), + changeInputStates: (params: ChangeInputStatesParams, opid = uuidV4()) => + new Promise>((resolve, reject) => { + openIMSDK.libOpenIMSDK.change_input_states( + openIMSDK.baseCallbackWrap(resolve, reject), + opid, + params.conversationID, + params.focus ? 1 : 0 + ); + }), + getInputStates: (params: GetInputstatesParams, opid = uuidV4()) => + new Promise>((resolve, reject) => { + openIMSDK.libOpenIMSDK.get_input_states( + openIMSDK.baseCallbackWrap(resolve, reject), + opid, + params.conversationID, + params.userID + ); + }), }; } @@ -322,4 +342,12 @@ export interface ConversationModuleApi { params: SetConversationMsgDestructParams, opid?: string ) => Promise>; + changeInputStates: ( + params: ChangeInputStatesParams, + opid?: string + ) => Promise>; + getInputStates: ( + params: GetInputstatesParams, + opid?: string + ) => Promise>; } diff --git a/src/render.ts b/src/render.ts index 8b6e4d3..c0c6cc2 100644 --- a/src/render.ts +++ b/src/render.ts @@ -33,6 +33,10 @@ type IMSDKInterface = Omit & { * @access only for electron */ initSDK: (param: InitConfig, opid?: string) => Promise; + /** + * @access only for electron + */ + unInitSDK: (opid?: string) => Promise; /** * @access only for electron */ diff --git a/src/types/libOpenIMSDK.d.ts b/src/types/libOpenIMSDK.d.ts index 53087b4..04205b1 100644 --- a/src/types/libOpenIMSDK.d.ts +++ b/src/types/libOpenIMSDK.d.ts @@ -263,6 +263,18 @@ declare module 'libOpenIMSDK' { clientMsgID: string ): void; hide_all_conversations(cCallback: CB_S_I_S_S, operationID: string): void; + change_input_states( + cCallback: CB_S_I_S_S, + operationID: string, + conversationID: string, + focus: number + ): void; + get_input_states( + cCallback: CB_S_I_S_S, + operationID: string, + conversationID: string, + userID: string + ): void; delete_all_msg_from_local_and_svr( cCallback: CB_S_I_S_S, operationID: string