diff --git a/package.json b/package.json index f3e2eac..3c5b915 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@openim/wasm-client-sdk", - "version": "3.8.2", + "version": "3.8.2-1", "description": "open im sdk for web", "source": "src/index.ts", "main": "lib/index.js", diff --git a/src/constant/index.ts b/src/constant/index.ts index d535ab5..f79b74f 100644 --- a/src/constant/index.ts +++ b/src/constant/index.ts @@ -16,7 +16,9 @@ export enum CbEvents { OnProgress = 'OnProgress', OnRecvNewMessage = 'OnRecvNewMessage', OnRecvNewMessages = 'OnRecvNewMessages', + OnRecvOnlineOnlyMessage = 'OnRecvOnlineOnlyMessage', OnRecvOfflineNewMessage = 'onRecvOfflineNewMessage', + OnRecvOnlineOnlyMessages = 'OnRecvOnlineOnlyMessages', OnRecvOfflineNewMessages = 'onRecvOfflineNewMessages', OnRecvMessageRevoked = 'OnRecvMessageRevoked', OnNewRecvMessageRevoked = 'OnNewRecvMessageRevoked', @@ -24,6 +26,7 @@ export enum CbEvents { OnRecvGroupReadReceipt = 'OnRecvGroupReadReceipt', OnConversationChanged = 'OnConversationChanged', OnNewConversation = 'OnNewConversation', + OnConversationUserInputStatusChanged = 'OnConversationUserInputStatusChanged', OnSyncServerFailed = 'OnSyncServerFailed', OnSyncServerFinish = 'OnSyncServerFinish', OnSyncServerProgress = 'OnSyncServerProgress', diff --git a/src/sdk/index.ts b/src/sdk/index.ts index 5bf3844..6231aa4 100644 --- a/src/sdk/index.ts +++ b/src/sdk/index.ts @@ -72,6 +72,8 @@ import { UpdateFriendsParams, SetConversationParams, GetSpecifiedFriendsParams, + ChangeInputStatesParams, + GetInputstatesParams, } from '../types/params'; import { @@ -97,7 +99,12 @@ import { WSEvent, WsResponse, } from '../types/entity'; -import { GroupAtType, LoginStatus, MessageReceiveOptType } from '@/types/enum'; +import { + GroupAtType, + LoginStatus, + MessageReceiveOptType, + Platform, +} from '@/types/enum'; import { logBoxStyleValue } from '@/utils'; class SDK extends Emitter { private wasmInitializedPromise: Promise; @@ -891,6 +898,9 @@ class SDK extends Emitter { [operationID, JSON.stringify(data.message), data.groupID, data.sendID] ); }; + /** + * @deprecated Use changeInputStates instead. + */ typingStatusUpdate = ( data: TypingUpdateParams, operationID = uuidv4() @@ -901,6 +911,23 @@ class SDK extends Emitter { data.msgTip, ]); }; + changeInputStates = ( + data: ChangeInputStatesParams, + operationID = uuidv4() + ) => { + return this._invoker('changeInputStates ', window.changeInputStates, [ + operationID, + data.conversationID, + data.focus, + ]); + }; + getInputstates = (data: GetInputstatesParams, operationID = uuidv4()) => { + return this._invoker('getInputstates ', window.getInputstates, [ + operationID, + data.conversationID, + data.userID, + ]); + }; clearConversationAndDeleteAllMsg = ( data: string, operationID = uuidv4() diff --git a/src/types/entity.ts b/src/types/entity.ts index cb0c8eb..620aeae 100644 --- a/src/types/entity.ts +++ b/src/types/entity.ts @@ -442,6 +442,12 @@ export type UserOnlineState = { userID: string; }; +export type ConversationInputStatus = { + conversationID: string; + userID: string; + platformIDs: Platform[]; +}; + export type GroupMessageReceiptInfo = { conversationID: string; groupMessageReadInfo: GroupMessageReadInfo[]; diff --git a/src/types/eventData.ts b/src/types/eventData.ts index 7ac67cc..589e83f 100644 --- a/src/types/eventData.ts +++ b/src/types/eventData.ts @@ -1,6 +1,7 @@ import { CbEvents } from '..'; import { BlackUserItem, + ConversationInputStatus, ConversationItem, FriendApplicationItem, FriendUserItem, @@ -36,13 +37,16 @@ export type EventDataMap = { [CbEvents.OnJoinedGroupAdded]: GroupItem; [CbEvents.OnJoinedGroupDeleted]: GroupItem; [CbEvents.OnNewConversation]: ConversationItem[]; + [CbEvents.OnConversationUserInputStatusChanged]: ConversationInputStatus; [CbEvents.OnNewRecvMessageRevoked]: RevokedInfo; [CbEvents.OnRecvC2CReadReceipt]: ReceiptInfo[]; [CbEvents.OnRecvGroupReadReceipt]: GroupMessageReceiptInfo; [CbEvents.OnRecvNewMessage]: MessageItem; [CbEvents.OnRecvNewMessages]: MessageItem[]; [CbEvents.OnRecvOfflineNewMessage]: MessageItem; + [CbEvents.OnRecvOnlineOnlyMessage]: MessageItem; [CbEvents.OnRecvOfflineNewMessages]: MessageItem[]; + [CbEvents.OnRecvOnlineOnlyMessages]: MessageItem[]; [CbEvents.OnSelfInfoUpdated]: SelfUserInfo; [CbEvents.OnSyncServerFailed]: void; [CbEvents.OnSyncServerStart]: boolean; diff --git a/src/types/index.d.ts b/src/types/index.d.ts index ba1c888..e8cd3e6 100644 --- a/src/types/index.d.ts +++ b/src/types/index.d.ts @@ -1,3 +1,4 @@ +import { Platform } from './enum'; import { CreateGroupParams } from './params'; type DatabaseApi = (...args: any[]) => Promise; @@ -512,6 +513,16 @@ declare global { recvID: string, msgTip: string ) => Promise; + changeInputStates: ( + operationID: string, + conversationID: string, + focus: boolean + ) => Promise; + getInputstates: ( + operationID: string, + conversationID: string, + userID: string + ) => Promise; markNotifyMessageHasRead: ( operationID: string, conversationID: string diff --git a/src/types/params.ts b/src/types/params.ts index ac88631..52b4c0e 100644 --- a/src/types/params.ts +++ b/src/types/params.ts @@ -263,6 +263,14 @@ export type TypingUpdateParams = { recvID: string; msgTip: string; }; +export type ChangeInputStatesParams = { + conversationID: string; + focus: boolean; +}; +export type GetInputstatesParams = { + conversationID: string; + userID: string; +}; export type SetConversationExParams = { conversationID: string; ex: string;