import { ConversationStorage } from '../db/storage'; import { UIKitError } from '../error'; import { ChatClient, ChatContact, ChatConversation, ChatConversationType, ChatCursorResult, ChatGroup, ChatMessage, ChatMessageReaction, type ChatMessageStatusCallback, ChatMessageThread, ChatPresence, ChatSearchDirection, ChatUserInfo } from '../rename.chat'; import { ChatServiceListenerImpl } from './chat.listener'; import type { DataProfileProvider } from './DataProfileProvider'; import type { MessageCacheManager } from './messageManager.types'; import type { RequestList } from './requestList.types'; import type { ChatEventType, ChatOptionsType, ChatService, ChatServiceListener, ConversationServices, DataModel, DataModelType, ResultCallback, ResultValue, UserData, UserFrom } from './types'; import { type BlockModel, type ContactModel, type ConversationModel, type GroupModel, type GroupParticipantModel, type StateModel, type UIListener, UIListenerType } from './types.ui'; export declare class ChatServiceImpl extends ChatServiceListenerImpl implements ChatService, ConversationServices { _user?: UserData; _dataFileProvider: DataProfileProvider; _userList: Map; _convStorage?: ConversationStorage; _convList: Map; _contactList: Map; _blockList: Map; _groupList: Map; _groupMemberList: Map>; _request: RequestList; _messageManager: MessageCacheManager; _modelState: Map>; _currentConversation?: ConversationModel; _silentModeList: Map; _pinMessageList: Map; _groupNameOnCreateGroupCallback?: (params: { selected: ContactModel[]; }) => string; constructor(); reset(): void; id(): string; get dataFileProvider(): DataProfileProvider; init(params: { options: ChatOptionsType; result?: (params: { isOk: boolean; error?: UIKitError; }) => void; }): Promise; addListener(listener: ChatServiceListener): void; removeListener(listener: ChatServiceListener): void; clearListener(): void; addUIListener(listener: UIListener): void; removeUIListener(listener: UIListener): void; clearUIListener(): void; sendUIEvent(type: UIListenerType, event: keyof UIListener, data?: DataModel | string, ...args: DataModel[]): void; _fromChatError(error: any): string | undefined; _createUserDir(): Promise; get client(): ChatClient; login(params: { userId: string; userToken: string; userName: string; userAvatarURL?: string | undefined; usePassword?: boolean; result: (params: { isOk: boolean; error?: UIKitError; }) => void; }): Promise; logout(params: { unbindDeviceToken?: boolean; result?: (params: { isOk: boolean; error?: UIKitError; }) => void; }): Promise; autoLogin(params: { userName?: string; userAvatarURL?: string; result: (params: { isOk: boolean; error?: UIKitError; }) => void; }): Promise; loginState(): Promise<'logged' | 'noLogged'>; refreshToken(params: { token: string; result?: (params: { isOk: boolean; error?: UIKitError; }) => void; }): void; checkTokenIsExpired(params: { onResult: (isExpired: boolean) => void; }): void; get userId(): string | undefined; user(userId?: string): UserData | undefined; setUser(params: { users: UserData[]; }): void; sendError(params: { error: UIKitError; from?: string; extra?: any; }): void; sendFinished(params: { event: ChatEventType; extra?: any; }): void; sendBefore(params: { event: ChatEventType; extra?: any; }): void; get requestList(): RequestList; get messageManager(): MessageCacheManager; tryCatch(params: { promise: Promise; event: string; onFinished?: ((value: T) => Promise | void | boolean) | undefined; onError?: ((e: UIKitError) => void | boolean) | undefined; }): void; tryCatchSync(params: { promise: Promise; event: string; }): Promise; tryCatchSyncList(params: { promises: Promise[]; event: string; }): Promise[]>; toUserData(user: ChatUserInfo, from?: { type: UserFrom; groupId?: string; }): UserData; _getAvatarFromCache(id: string): string | undefined; _getNameFromCache(id: string): string | undefined; _getRemarkFromCache(id: string): string | undefined; _getDoNotDisturbFromCache(convId: string): boolean | undefined; toUIConversation(conv: ChatConversation): Promise; toUIContact(contact: ChatContact): ContactModel; toUIGroup(group: ChatGroup): GroupModel; setGroupNameOnCreateGroup(callback: (params: { selected: ContactModel[]; }) => string): void; getCreateGroupCustomNameCallback(): ((params: { selected: ContactModel[]; }) => string) | undefined; updateDataList(params: { dataList: Map; isUpdateNotExisted?: boolean; disableDispatch?: boolean; dispatchHandler?: (data: Map) => boolean; }): void; getDataModel(id: string): DataModel | undefined; getDataFileProvider(): DataProfileProvider; _requestConvData(list: ChatConversation[]): Promise; _requestData(params: { list: string[]; type: DataModelType; disableDispatch?: boolean; requestHasData: boolean; isUpdateNotExisted?: boolean; }): Promise; _updateDataList(params: { dataList: Map; isUpdateNotExisted?: boolean | undefined; disableDispatch?: boolean | undefined; dispatchHandler?: (data: Map) => boolean; }): void; setCurrentConversation(params: { conv?: ConversationModel; }): void; getCurrentConversation(): ConversationModel | undefined; /** * @description Get the current user all conversation list. * @params params * - onResult: The callback function of the result. */ getAllConversations(params: { onResult: ResultCallback; }): Promise; getConversation(params: { convId: string; convType: ChatConversationType; createIfNotExist?: boolean; fromNative?: boolean; isChatThread?: boolean; }): Promise; removeConversationAllMessages(params: { convId: string; convType: ChatConversationType; }): Promise; removeConversation(params: { convId: string; removeMessage?: boolean; }): Promise; clearAllConversations(): Promise; setConversationPin(params: { convId: string; convType: ChatConversationType; isPin: boolean; }): Promise; setConversationSilentMode(params: { convId: string; convType: ChatConversationType; doNotDisturb: boolean; }): Promise; setConversationRead(params: { convId: string; convType: ChatConversationType; }): Promise; setConversationExt(params: { convId: string; convType: ChatConversationType; ext: Record; }): Promise; getConversationMessageCount(convId: string, convType: ChatConversationType): Promise; getConversationLatestMessage(convId: string, convType: ChatConversationType): Promise; getDoNotDisturb(convId: string, convType: ChatConversationType): Promise; isContact(params: { userId: string; }): boolean; getAllContacts(params: { requestServer?: boolean; onResult: ResultCallback; }): void; getContactSync(params: { userId: string; }): Promise>; getContact(params: { userId: string; onResult: ResultCallback; }): void; getAllContacts2(params: { requestServer?: boolean; onResult: ResultCallback; }): void; addNewContact(params: { userId: string; reason?: string; onResult?: ResultCallback; }): void; removeContact(params: { userId: string; onResult?: ResultCallback; }): void; setContactRemark(params: { userId: string; remark: string; onResult?: ResultCallback; }): void; acceptInvitation(params: { userId: string; onResult: ResultCallback; }): void; declineInvitation(params: { userId: string; onResult: ResultCallback; }): void; setModelState(params: { tag: string; id: string; state: StateModel; }): void; getModelState(params: { tag: string; id: string; }): StateModel | undefined; clearModelState(params: { tag: string; }): void; getJoinedGroups(params: { onResult: ResultCallback; }): void; getPageGroups(params: { pageSize: number; pageNum: number; onResult: ResultCallback; }): void; getGroupAllMembers(params: { groupId: string; isReset?: boolean; owner?: GroupParticipantModel; onResult: ResultCallback; }): void; getGroupOwner(params: { groupId: string; }): Promise; getGroupMember(params: { groupId: string; userId: string; }): GroupParticipantModel | undefined; fetchJoinedGroupCount(params: { onResult: ResultCallback; }): void; getGroupInfoFromServer(params: { groupId: string; onResult: ResultCallback; }): void; getGroupInfoSync(params: { groupId: string; }): Promise>; getGroupInfo(params: { groupId: string; onResult: ResultCallback; }): void; createGroup(params: { groupName: string; groupDescription?: string; inviteMembers: string[]; onResult?: ResultCallback; }): void; quitGroup(params: { groupId: string; onResult?: ResultCallback; }): void; destroyGroup(params: { groupId: string; onResult?: ResultCallback; }): void; setGroupName(params: { groupId: string; groupNewName: string; onResult?: ResultCallback; }): void; setGroupDescription(params: { groupId: string; groupDescription: string; onResult?: ResultCallback; }): void; setGroupMyRemark(params: { groupId: string; memberId: string; groupMyRemark: string; ext?: Record; onResult?: ResultCallback; }): void; getGroupMyRemark(params: { groupId: string; memberId: string; onResult: ResultCallback; }): void; addGroupMembers(params: { groupId: string; members: GroupParticipantModel[]; welcomeMessage?: string; onResult: ResultCallback; }): void; removeGroupMembers(params: { groupId: string; members: string[]; onResult: ResultCallback; }): void; changeGroupOwner(params: { groupId: string; newOwnerId: string; onResult?: ResultCallback; }): void; getUserInfoSync(params: { userId: string; }): Promise>; getUserInfo(params: { userId: string; onResult?: ResultCallback; }): void; getUsersInfo(params: { userIds: string[]; onResult: ResultCallback; }): void; updateSelfInfo(params: { self: UserData; onResult: ResultCallback; }): void; getMessage(params: { messageId: string; }): Promise; resendMessage(params: { message: ChatMessage; callback: ChatMessageStatusCallback; }): void; recallMessage(params: { message: ChatMessage; onResult: ResultCallback; }): void; insertMessage(params: { message: ChatMessage; onResult?: ResultCallback; }): void; updateMessage(params: { message: ChatMessage; onResult?: ResultCallback; }): void; removeMessage(params: { message: ChatMessage; onResult?: ResultCallback; }): void; removeMessages(params: { message: ChatMessage[]; }): Promise; editMessage(params: { message: ChatMessage; onResult: ResultCallback; }): void; translateMessage(params: { message: ChatMessage; languages: string[]; onResult: ResultCallback; }): void; getNewRequestList(params: { convId: string; convType: ChatConversationType; timestamp?: number; pageSize?: number; direction?: ChatSearchDirection; onResult: ResultCallback; }): void; sendMessage(params: { message: ChatMessage; callback?: ChatMessageStatusCallback; }): void; downloadMessageAttachment(params: { message: ChatMessage; callback?: ChatMessageStatusCallback; }): void; downloadMessageAttachmentForThread(params: { message: ChatMessage; callback?: ChatMessageStatusCallback; }): void; getHistoryMessage(params: { convId: string; convType: ChatConversationType; startMsgId: string; direction: ChatSearchDirection; loadCount: number; isChatThread?: boolean; }): Promise; fetchHistoryMessages(params: { convId: string; convType: ChatConversationType; startMsgId: string; direction: ChatSearchDirection; pageSize: number; }): Promise>; userInfoFromMessage(msg?: ChatMessage): UserData | undefined; setUserInfoToMessage(params: { msg: ChatMessage; user?: UserData; }): void; setMessageRead(params: { convId: string; convType: ChatConversationType; msgId: string; onResult: ResultCallback; }): void; sendMessageReadAck(params: { message: ChatMessage; onResult: ResultCallback; }): void; reportMessage(params: { messageId: string; tag: string; reason: string; onResult: ResultCallback; }): void; fetchCombineMessageDetail(params: { msg: ChatMessage; }): Promise; getMessagesByKeyword(params: { keyword: string; convId: string; convType: ChatConversationType; direction?: ChatSearchDirection; timestamp?: number; maxCount?: number; onResult: ResultCallback; }): void; pinMessage(params: { msgId: string; onResult?: ResultCallback; }): void; unPinMessage(params: { msgId: string; onResult?: ResultCallback; }): void; fetchPinnedMessages(params: { convId: string; convType: ChatConversationType; forceRequest?: boolean; onResult: ResultCallback; }): void; getPinnedMessages(params: { convId: string; convType: ChatConversationType; onResult: ResultCallback; }): void; addReactionToMessage(params: { msgId: string; reaction: string; onResult?: ResultCallback; }): void; removeReactionFromMessage(params: { msgId: string; reaction: string; onResult?: ResultCallback; }): void; getMessageReactionsList(params: { msgId: string; onResult: ResultCallback; }): void; getMessageReactionsDetail(params: { msgId: string; reaction: string; cursor?: string; pageSize?: number; onResult: ResultCallback>; }): void; subPresence(params: { userIds: string[]; onResult?: ResultCallback; }): void; unSubPresence(params: { userIds: string[]; onResult?: ResultCallback; }): void; publishPresence(params: { status: string; onResult: ResultCallback; }): void; fetchPresence(params: { userIds: string[]; onResult: ResultCallback>; }): void; createThread(params: { name: string; msgId: string; parentId: string; onResult: ResultCallback; }): void; joinThread(params: { threadId: string; onResult?: ResultCallback; }): void; leaveThread(params: { threadId: string; onResult?: ResultCallback; }): void; destroyThread(params: { threadId: string; onResult?: ResultCallback; }): void; updateThreadName(params: { threadId: string; name: string; onResult?: ResultCallback; }): void; removeMemberFromThread(params: { threadId: string; userId: string; onResult: ResultCallback; }): void; fetchMembersFromThread(params: { threadId: string; cursor: string; pageSize: number; onResult: ResultCallback>; }): void; fetchThreadsFromGroup(params: { parentId: string; cursor: string; pageSize: number; onResult: ResultCallback>; }): void; fetchThreadsLastMessage(params: { threadId: string[]; onResult: ResultCallback>; }): void; fetchThreadsLastMessageSync(params: { threadId: string[]; }): Promise>>; fetchThread(params: { threadId: string; onResult: ResultCallback; }): void; getThread(params: { threadId: string; onResult: ResultCallback; }): void; getAllBlockList(params: { isForce?: boolean; onResult: ResultCallback; }): Promise; isBlockUser(params: { userId: string; }): boolean; addUserToBlock(params: { userId: string; onResult?: ResultCallback; }): void; removeUserFromBlock(params: { userId: string; onResult?: ResultCallback; }): void; } //# sourceMappingURL=chat.impl.d.ts.map