From e3516a9085d128c4604330210a6730824b5de9d1 Mon Sep 17 00:00:00 2001 From: Alex Lee Date: Mon, 13 Sep 2021 16:10:36 +0800 Subject: [PATCH 1/6] =?UTF-8?q?lib/js=20=E4=B8=8Agit=EF=BC=8C=E6=96=B9?= =?UTF-8?q?=E4=BE=BF=E4=BB=A5=20git=20=E5=8C=85=E5=BD=A2=E5=BC=8F=E5=BC=95?= =?UTF-8?q?=E5=85=A5=E9=A1=B9=E7=9B=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitignore | 1 - lib/js/index.d.ts | 791 +++++++++++++++++++++++++++++ lib/js/index.js | 1230 +++++++++++++++++++++++++++++++++++++++++++++ lib/js/types.d.ts | 908 +++++++++++++++++++++++++++++++++ lib/js/types.js | 398 +++++++++++++++ 5 files changed, 3327 insertions(+), 1 deletion(-) create mode 100644 lib/js/index.d.ts create mode 100644 lib/js/index.js create mode 100644 lib/js/types.d.ts create mode 100644 lib/js/types.js diff --git a/.gitignore b/.gitignore index 697a1c1..4f9bd10 100644 --- a/.gitignore +++ b/.gitignore @@ -3,7 +3,6 @@ .gradle/ .settings/ build/ -lib/js/ node_modules/ xcuserdata/ *.xcworkspace/ diff --git a/lib/js/index.d.ts b/lib/js/index.d.ts new file mode 100644 index 0000000..8dd0679 --- /dev/null +++ b/lib/js/index.d.ts @@ -0,0 +1,791 @@ +import { ConnectionStatus, ConversationType, ErrorCode, Message, ObjectName, PublicServiceType, RecallNotificationMessage, ReceiptRequest, ReceiveMessage, SentMessage, TypingStatus, ConnectErrorCode, Conversation, MessageContent, PublicServiceProfile, ReceiptResponse, SearchType, SentStatus, SearchConversationResult, TimestampOrder, ChatRoomMemberOrder, ChatRoomInfo, Discussion, RealTimeLocationStatus, CSConfig, CSMode, CSGroupItem, CSInfo, CSResolveStatus, CSLeaveMessageItem, PushLanguage, PushNotificationMessage } from "./types"; +export * from "./types"; +/** + * 初始化 SDK,只需要调用一次 + * + * @param appKey 从融云开发者平台创建应用后获取到的 App Key + */ +export declare function init(appKey: string): void; +/** + * 添加日志信息监听函数 + * + * @param listener + */ +export declare function addLogInfoListener(listener: (logInfo: string) => void): any; +/** + * 添加消息撤回监听函数 + * + * @param listener + */ +export declare function addRecallMessageListener(listener: (messageId: string) => void): any; +/** + * 同步会话阅读状态 + * + * @param conversationType 会话类型 + * @param targetId 目标 ID + * @param timestamp 该会话中已读的最后一条消息的发送时间戳 + */ +export declare function syncConversationReadStatus(conversationType: ConversationType, targetId: string, timestamp: number): Promise; +/** + * 设置 deviceToken,用于远程推送 + * + * @param deviceToken 从系统获取到的设备号 deviceToken(需要去掉空格和尖括号) + * + * deviceToken是系统提供的,从苹果服务器获取的,用于APNs远程推送必须使用的设备唯一值。 + * 您需要将 `-application:didRegisterForRemoteNotificationsWithDeviceToken:` + * 获取到的deviceToken,转为NSString类型,并去掉其中的空格和尖括号,作为参数传入此方法。 + */ +export declare function setDeviceToken(deviceToken: string): void; +/** + * 设置导航服务器和上传文件服务器信息,要在 [[init]] 前使用 + * + * @param naviServer 导航服务器地址 + * @param fileServer 文件服务器地址 + */ +export declare function setServerInfo(naviServer: string, fileServer: string): void; +/** + * 设置统计服务地址 + * + * 配置数据上传地址 (非必须) 通过配置该地址,SDK + * 会在初始化时把设备相关信息上传到私有云节点。 + * 影响到的功能是开发者后台的广播推送功能,如果私有云客户没有配置该地址,那从后台发推送时,客户端是收不到的。 + * 普通的 IM 推送不受影响。设置数据上传服务器地址。 + * 可以支持设置 http://cn.xxx.com 或者 https://cn.xxx.com 或者 cn.xxx.com + * 如果设置成 cn.xxx.com,sdk 会组装成并仅支持 http:// 协议格式。 + * + * @param server 服务地址 + */ +export declare function setStatisticServer(server: string): void; +/** + * 连接融云服务器,只需要调用一次 + * + * 在 App 整个生命周期,您只需要调用一次此方法与融云服务器建立连接。 + * 之后无论是网络出现异常或者App有前后台的切换等,SDK都会负责自动重连。 + * 除非您已经手动将连接断开,否则您不需要自己再手动重连。 + * + * @param token 从服务端获取的用户身份令牌(Token) + * @param success 成功回调函数 + * @param error 失败回调函数 + * @param tokenIncorrect token 错误或过期回调函数 + */ +export declare function connect(token: string, success?: (userId: string) => void, error?: (errorCode: ConnectErrorCode) => void, tokenIncorrect?: () => void): void; +/** + * 断开与融云服务器的连接 + * + * @param isReceivePush 是否还接收推送 + */ +export declare function disconnect(isReceivePush?: boolean): void; +/** + * 获取当前连接状态 + */ +export declare function getConnectionStatus(): Promise; +/** + * 添加消息监听函数 + */ +export declare function addReceiveMessageListener(listener: (message: ReceiveMessage) => void): any; +/** + * 发送消息回调 + */ +export interface SentMessageCallback { + success?: (messageId: number) => void; + progress?: (progress: number, messageId: number) => void; + cancel?: () => void; + error?: (errorCode: ErrorCode, messageId: number, errorMessage?: string) => void; +} +/** + * 发送消息 + * + * @param message 消息 + * @param callback 回调 + */ +export declare function sendMessage(message: SentMessage, callback?: SentMessageCallback): void; +/** + * 发送媒体消息 + * + * @param message 消息 + * @param callback 回调 + */ +export declare function sendMediaMessage(message: SentMessage, callback?: SentMessageCallback): void; +/** + * 发送定向消息 + * + * @param message 消息 + * @param userIdList 用户 ID 列表 + * @param callback 回调 + */ +export declare function sendDirectionalMessage(message: SentMessage, userIdList: string[], callback: SentMessageCallback): void; +/** + * 消息撤回 + * + * @param messageId 消息 ID + * @param pushContent 推送内容 + */ +export declare function recallMessage(messageId: number, pushContent?: string): Promise; +/** + * 发送输入状态 + * + * @param conversationType 会话类型 + * @param targetId 目标 ID + * @param typingContentType 输入内容类型 + */ +export declare function sendTypingStatus(conversationType: ConversationType, targetId: string, typingContentType: string): void; +/** + * 添加输入状态监听函数 + */ +export declare function addTypingStatusListener(listener: (status: TypingStatus) => void): any; +/** + * 设置消息发送状态 + * + * @param messageId 消息 ID + * @param status 状态 + */ +export declare function setMessageSentStatus(messageId: number, status: SentStatus): Promise; +/** + * 设置消息接收状态 + * + * @param messageId 消息 ID + * @param status 状态 + */ +export declare function setMessageReceivedStatus(messageId: number, status: number): Promise; +/** + * 获取屏蔽消息提醒的会话列表 + * + * @param conversationTypeList 消息类型列表 + */ +export declare function getBlockedConversationList(conversationTypeList: ConversationType[]): Promise; +/** + * 发送阅读回执 + * + * @param conversationType 会话类型 + * @param targetId 目标 ID + * @param timestamp 该会话中已阅读点最后一条消息的发送时间戳 + */ +export declare function sendReadReceiptMessage(conversationType: ConversationType, targetId: string, timestamp: number): void; +/** + * 发起群组消息回执请求 + * + * @param messageId 消息 ID + */ +export declare function sendReadReceiptRequest(messageId: number): Promise; +/** + * 发起群组消息回执响应 + * + * @param conversationType 会话类型 + * @param targetId 目标 ID + * @param messages 回执的消息列表 + */ +export declare function sendReadReceiptResponse(conversationType: ConversationType, targetId: string, messages: Message[]): Promise; +/** + * 添加私聊阅读回执监听函数 + */ +export declare function addReadReceiptReceivedListener(listener: (message: Message) => void): any; +/** + * 添加收到消息已读回执请求监听函数 + * + * 收到此请求后,如果用户阅读了对应的消息,需要调用 + * sendMessageReadReceiptResponse 接口发送已读响应 + */ +export declare function addReceiptRequestListener(listener: (data: ReceiptRequest) => void): any; +/** + * 添加消息回执响应监听函数 + * + * @param listener + */ +export declare function addReceiptResponseListener(listener: (data: ReceiptResponse) => void): any; +/** + * 取消发送中的媒体消息 + * + * @param messageId 消息 ID + */ +export declare function cancelSendMediaMessage(messageId: number): Promise; +/** + * 取消下载中的媒体消息 + * + * @param messageId 消息 ID + */ +export declare function cancelDownloadMediaMessage(messageId: number): Promise; +export interface MediaMessageCallback { + progress?: (progress: number) => void; + success?: (path: string) => void; + error?: (errorCode: number) => void; + cancel?: () => void; +} +/** + * 下载媒体消息 + * + * @param messageId 消息 ID + * @param callback 回调 + */ +export declare function downloadMediaMessage(messageId: number, callback?: MediaMessageCallback): void; +/** + * 添加连接状态监听函数 + */ +export declare function addConnectionStatusListener(listener: (status: ConnectionStatus) => void): any; +/** + * 设置断线重连时是否踢出重连设备 + * + * 用户没有开通多设备登录功能的前提下,同一个账号在一台新设备上登录的时候,会把这个账号在之前登录的设备上踢出。 + * 由于 SDK 有断线重连功能,存在下面情况。 用户在 A 设备登录,A + * 设备网络不稳定,没有连接成功,SDK 启动重连机制。 用户此时又在 B 设备登录,B + * 设备连接成功。 A 设备网络稳定之后,用户在 A 设备连接成功,B 设备被踢出。 + * 这个接口就是为这种情况加的。 设置 enable 为 true 时,SDK + * 重连的时候发现此时已有别的设备连接成功,不再强行踢出已有设备,而是踢出重连设备。 + * + * @param enabled 是否踢出重连设备 + */ +export declare function setReconnectKickEnable(enabled: boolean): void; +/** + * 获取历史消息 + * + * 此方法会获取该会话中,timestamp 之前或之后的、指定数量、指定消息类型(多个)的消息实体列表,返回的消息实体按照时间从新到旧排列。 + * 返回的消息中不包含 timestamp 对应的那条消息,如果会话中的消息数量小于参数 count 的值,会将该会话中的所有消息返回。 + * + * @param conversationType 会话类型 + * @param targetId 目标 ID + * @param objectNames 对象名称数组,仅当该参数为数组时调用该方法 + * @param timestamp 当前的消息时间戳 + * @param count 数量 + * @param isForward 是否向前获取 + */ +export declare function getHistoryMessages(conversationType: ConversationType, targetId: string, objectNames: ObjectName[], timestamp: number, count: number, isForward: boolean): Promise; +/** + * 获取历史消息 + * + * 此方法会获取该会话中,baseMessageId 之前或之后的、指定数量、消息类型和查询方向的最新消息实体,返回的消息实体按照时间从新到旧排列。 + * 返回的消息中不包含 baseMessageId 对应的那条消息,如果会话中的消息数量小于参数 count 的值,会将该会话中的所有消息返回。 + * + * @param conversationType 会话类型 + * @param targetId 目标 ID + * @param objectName 消息对象名称,可以用 MessageObjectNames 获取消息类型对应的对象名称 + * @param baseMessageId 最近一条消息的 ID + * @param count 数量 + * @param isForward 是否向前获取 + */ +export declare function getHistoryMessages(conversationType: ConversationType, targetId: string, objectName: string, baseMessageId: number, count: number, isForward: boolean): Promise; +/** + * 向本地会话插入一条发送消息 + * + * @param conversationType + * @param targetId + * @param sentStatus + * @param messageContent + * @param sentTime + */ +export declare function insertOutgoingMessage(conversationType: ConversationType, targetId: string, sentStatus: SentStatus, messageContent: MessageContent, sentTime?: number): Promise; +/** + * 向本地会话插入一条接收消息 + * + * @param conversationType + * @param targetId + * @param senderUserId + * @param receivedStatus + * @param messageContent + * @param sentTime + */ +export declare function insertIncomingMessage(conversationType: ConversationType, targetId: string, senderUserId: string, receivedStatus: number, messageContent: MessageContent, sentTime?: number): Promise; +/** + * 清空某一会话的所有消息 + * + * @param conversationType + * @param targetId + */ +export declare function clearMessages(conversationType: ConversationType, targetId: string): Promise; +/** + * 删除某一会话的所有消息,同时清理数据库空间 + * + * @param conversationType + * @param targetId + */ +export declare function deleteMessages(conversationType: ConversationType, targetId: string): Promise; +/** + * 根据消息 ID 删除消息 + * + * @param ids 消息 ID 列表 + */ +export declare function deleteMessages(ids: number[]): Promise; +/** + * 根据关键字搜索会话 + * + * @param keyword 关键字 + * @param conversationTypes 会话类型数组 + * @param objectNames 对象名称数组 + */ +export declare function searchConversations(keyword: string, conversationTypes: ConversationType[], objectNames: ObjectName[]): Promise; +/** + * 搜索消息 + * + * @param conversationType 会话类型 + * @param targetId 目标 ID + * @param keyword 关键字 + * @param count 获取数量 + * @param startTime 开始时间 + */ +export declare function searchMessages(conversationType: ConversationType, targetId: string, keyword: string, count: number, startTime?: number): Promise; +/** + * 获取消息 + * + * @param messageId 消息 ID + */ +export declare function getMessage(messageId: number): Promise; +/** + * 根据消息 UID 获取消息 + * + * @param messageUId 消息 UID + */ +export declare function getMessageByUId(messageUId: string): Promise; +/** + * 设置消息的附加信息 + * + * @param messageId 消息 ID + * @param extra 附加信息 + */ +export declare function setMessageExtra(messageId: number, extra: string): Promise; +/** + * 获取消息发送时间 + * + * @param messageId 消息 ID + */ +export declare function getMessageSendTime(messageId: number): Promise; +/** + * 获取会话中的消息数量 + * + * @param conversationType 会话类型 + * @param targetId 目标 ID + */ +export declare function getMessageCount(conversationType: ConversationType, targetId: string): Promise; +/** + * 获取会话里第一条未读消息 + * + * @param conversationType 会话类型 + * @param targetId 目标 ID + */ +export declare function getFirstUnreadMessage(conversationType: ConversationType, targetId: string): Promise; +/** + * 获取会话中 @ 提醒自己的消息 + * + * @param conversationType 会话类型 + * @param targetId 目标 ID + */ +export declare function getUnreadMentionedMessages(conversationType: ConversationType, targetId: string): Promise; +/** + * 获取服务端历史消息 + * + * @param conversationType 会话类型 + * @param targetId 目标 ID + * @param sentTime 清除消息截止时间戳,为 0 则清除会话所有服务端历史消息 + * @param count 删除数量 + */ +export declare function getRemoteHistoryMessages(conversationType: ConversationType, targetId: string, sentTime: number, count: number): Promise; +/** + * 清除服务端历史消息 + * + * @param conversationType 会话类型 + * @param targetId 目标 ID + * @param recordTime 清除消息截止时间戳,为 0 则清除会话所有服务端历史消息 + */ +export declare function cleanRemoteHistoryMessages(conversationType: ConversationType, targetId: string, recordTime: number): Promise; +/** + * 清除服务端历史消息 + * + * @param conversationType 会话类型 + * @param targetId 目标 ID + * @param recordTime 清除消息截止时间戳,为 0 则清除会话所有服务端历史消息 + * @param clearRemote 是否同时删除服务端消息 + */ +export declare function cleanHistoryMessages(conversationType: ConversationType, targetId: string, recordTime: number, clearRemote: boolean): Promise; +/** + * 清除服务端历史消息 + * + * @param conversationType 会话类型 + * @param targetId 目标 ID + * @param messages 要删除的消息数组,数组大小不能超过 100 条 + */ +export declare function deleteRemoteMessages(conversationType: ConversationType, targetId: string, messages: Message[]): Promise; +/** + * 获取会话 + * + * @param conversationType 会话类型 + * @param targetId 目标 ID + */ +export declare function getConversation(conversationType: ConversationType, targetId: string): Promise; +/** + * 获取会话列表 + * + * @param conversationTypes 会话类型列表 + * @param count 获取的数量 + * @param timestamp 会话的时间戳(获取这个时间戳之前的会话列表,0 + * 表示从最新开始获取) + */ +export declare function getConversationList(conversationTypes?: ConversationType[], count?: number, timestamp?: number): Promise; +/** + * 从会话列表中移除某一会话,但是不删除会话内的消息 + * + * @param conversationType 会话类型 + * @param targetId 目标 ID + */ +export declare function removeConversation(conversationType: ConversationType, targetId: string): Promise; +/** + * 设置会话消息提醒状态 + * + * @param conversationType 会话类型 + * @param targetId 目标 ID + * @param isBlock 是否屏蔽 + */ +export declare function setConversationNotificationStatus(conversationType: ConversationType, targetId: string, isBlock: boolean): Promise; +/** + * 获取会话消息提醒状态 + * + * @param conversationType 会话类型 + * @param targetId 目标 ID + */ +export declare function getConversationNotificationStatus(conversationType: ConversationType, targetId: string): Promise; +/** + * 设置是否置顶会话 + * + * @param conversationType 会话类型 + * @param targetId 目标 ID + * @param isTop 是否置顶 + */ +export declare function setConversationToTop(conversationType: ConversationType, targetId: string, isTop: boolean): any; +/** + * 获取置顶会话列表 + * + * @param conversationTypes 会话类型列表 + */ +export declare function getTopConversationList(conversationTypes?: ConversationType[]): Promise; +/** + * 保存某一会话的文本消息草稿 + * + * @param conversationType 会话类型 + * @param targetId 目标 ID + * @param content 草稿内容 + */ +export declare function saveTextMessageDraft(conversationType: ConversationType, targetId: string, content: string): Promise; +/** + * 获取某一会话的文本消息草稿 + * + * @param conversationType 会话类型 + * @param targetId 目标 ID + */ +export declare function getTextMessageDraft(conversationType: ConversationType, targetId: string): Promise; +/** + * 清除某一会话的文本消息草稿 + * + * @param conversationType 会话类型 + * @param targetId 目标 ID + */ +export declare function clearTextMessageDraft(conversationType: ConversationType, targetId: string): Promise; +/** + * 获取所有未读消息数 + */ +export declare function getTotalUnreadCount(): Promise; +/** + * 获取指定会话的未读消息数 + * + * @param conversationTypes 会话类型列表 + */ +export declare function getUnreadCount(conversationTypes: ConversationType[]): Promise; +/** + * 获取指定会话的未读消息数 + * + * @param conversationType 会话类型 + * @param targetId 目标 ID + */ +export declare function getUnreadCount(conversationType: ConversationType, targetId: string): Promise; +/** + * 清除某个会话中的未读消息数 + * + * @param conversationType 会话类型 + * @param targetId 目标 ID + * @param time 该会话已阅读的最后一条消息的发送时间戳 + */ +export declare function clearMessagesUnreadStatus(conversationType: ConversationType, targetId: string, time?: number): Promise; +/** + * 把用户加入黑名单 + * + * @param userId 用户 ID + */ +export declare function addToBlacklist(userId: string): Promise; +/** + * 把用户从黑名单种移除 + * + * @param userId 用户 ID + */ +export declare function removeFromBlacklist(userId: string): Promise; +/** + * 获取某用户是否在黑名单中 + * + * @param userId 用户 ID + * @return 是否在黑名单中 + */ +export declare function getBlacklistStatus(userId: string): Promise; +/** + * 获取黑名单列表 + * + * @return 黑名单列表 + */ +export declare function getBlacklist(): Promise; +/** + * 加入聊天室,如果已存在,直接加入,否则创建并加入 + * + * @param targetId 聊天室 ID + * @param messageCount 默认获取的消息数量,最多 50 + */ +export declare function joinChatRoom(targetId: string, messageCount?: number): Promise; +/** + * 加入已存在的聊天室,如果不存在则加入失败 + * + * @param targetId 聊天室 ID + * @param messageCount 默认获取的消息数量,最多 50 + */ +export declare function joinExistChatRoom(targetId: string, messageCount?: number): Promise; +/** + * 退出聊天室 + * + * @param targetId 聊天室 ID + */ +export declare function quitChatRoom(targetId: string): Promise; +/** + * 从服务器端获取聊天室的历史消息 + * + * @param targetId 目标 ID + * @param recordTime 起始的消息发送时间戳,单位毫秒 + * @param count 要获取的消息数量 + * @param order 拉取顺序 + */ +export declare function getRemoteChatRoomHistoryMessages(targetId: string, recordTime: number, count: number, order: TimestampOrder): Promise<{ + messages: Message[]; + syncTime: number; +}>; +/** + * 获取聊天室信息 + * + * @param targetId 聊天室 ID + * @param memberCount 聊天室成员数量,最多获取 20 个 + * @param order 返回的聊天室成员排序方式 + */ +export declare function getChatRoomInfo(targetId: string, memberCount?: number, order?: ChatRoomMemberOrder): Promise; +/** + * 创建讨论组 + * + * @param name 讨论组名称 + * @param userList 用户 ID 列表 + */ +export declare function createDiscussion(name: string, userList: string[]): Promise; +/** + * 获取讨论组信息 + * + * @param targetId 讨论组 ID + */ +export declare function getDiscussion(targetId: string): Promise; +/** + * 退出讨论组 + * + * @param targetId 讨论组 ID + */ +export declare function quitDiscussion(targetId: string): Promise; +/** + * 把用户加入讨论组 + * + * @param targetId 讨论组 ID + * @param userList 用户 ID 列表 + */ +export declare function addMemberToDiscussion(targetId: string, userList: string[]): Promise; +/** + * 把用户从讨论组移出 + * + * @param targetId 讨论组 ID + * @param user 用户 ID + */ +export declare function removeMemberFromDiscussion(targetId: string, user: string): Promise; +/** + * 设置讨论组名称 + * + * @param targetId 讨论组 ID + * @param name 讨论组名称 + */ +export declare function setDiscussionName(targetId: string, name: string): Promise; +/** + * 设置讨论组拉人权限 + * + * @param targetId 讨论组 ID + * @param isOpen 是否开放拉人权限 + */ +export declare function setDiscussionInviteStatus(targetId: string, isOpen: boolean): Promise; +/** + * 搜索公众服务 + * + * @param keyword 关键字 + * @param searchType 搜索类型 + * @param publicServiceType 公众服务类型 + */ +export declare function searchPublicService(keyword: string, searchType?: SearchType, publicServiceType?: PublicServiceType): Promise; +/** + * 订阅公共服务 + * + * @param publicServiceType 公共服务类型 + * @param publicServiceId 公共服务 ID + */ +export declare function subscribePublicService(publicServiceType: PublicServiceType, publicServiceId: string): Promise; +/** + * 取消关注公共服务 + * + * @param publicServiceType 公共服务类型 + * @param publicServiceId 公共服务 ID + */ +export declare function unsubscribePublicService(publicServiceType: PublicServiceType, publicServiceId: string): Promise; +/** + * 获取已订阅的公众服务列表 + */ +export declare function getPublicServiceList(): Promise; +/** + * 获取单个公众服务信息 + * + * @param publicServiceType 公共服务类型 + * @param publicServiceId 公共服务 ID + */ +export declare function getPublicServiceProfile(publicServiceType: PublicServiceType, publicServiceId: string): Promise; +/** + * 发起实时位置共享 + * + * @param conversationType 会话类型 + * @param targetId 目标 ID + */ +export declare function startRealTimeLocation(conversationType: ConversationType, targetId: string): any; +/** + * 加入实时位置共享 + * + * @param conversationType 会话类型 + * @param targetId 目标 ID + */ +export declare function joinRealTimeLocation(conversationType: ConversationType, targetId: string): any; +/** + * 退出实时位置共享 + * + * @param conversationType 会话类型 + * @param targetId 目标 ID + */ +export declare function quitRealTimeLocation(conversationType: ConversationType, targetId: string): any; +/** + * 获取实时位置共享状态 + * + * @param conversationType 会话类型 + * @param targetId 目标 ID + */ +export declare function getRealTimeLocationStatus(conversationType: ConversationType, targetId: string): Promise; +/** + * 获取参与实时位置共享的所有成员 + * + * @param conversationType 会话类型 + * @param targetId 目标 ID + */ +export declare function getRealTimeLocationParticipants(conversationType: ConversationType, targetId: string): Promise; +/** + * 全局屏蔽某个时间段的消息提醒 + * + * @param startTime 开始屏蔽消息提醒的时间,格式为HH:MM:SS + * @param spanMinutes 需要屏蔽消息提醒的分钟数,0 < spanMinutes < 1440 + */ +export declare function setNotificationQuietHours(startTime: string, spanMinutes: number): Promise; +/** + * 查询已设置的全局时间段消息提醒屏蔽 + */ +export declare function getNotificationQuietHours(): Promise<{ + startTime: string; + spanMinutes: number; +}>; +/** + * 删除已设置的全局时间段消息提醒屏蔽 + */ +export declare function removeNotificationQuietHours(): Promise; +/** + * 获取离线消息在服务端的存储时间(以天为单位) + */ +export declare function getOfflineMessageDuration(): Promise; +/** + * 设置离线消息在服务端的存储时间(以天为单位) + */ +export declare function setOfflineMessageDuration(duration: number): Promise; +/** + * 发起客服聊天回调 + */ +export interface CSCallback { + success?: (config: CSConfig) => void; + error?: (code: number, message: string) => void; + modeChanged?: (mode: CSMode) => void; + pullEvaluation?: (dialogId: string) => void; + quit?: (message: string) => void; + selectGroup?: (groups: CSGroupItem[]) => void; +} +/** + * 发起客服聊天 + * + * @param kefuId 客服 ID + * @param csInfo 客服信息 + * @param callback 回调 + */ +export declare function startCustomerService(kefuId: string, csInfo: CSInfo, callback?: CSCallback): void; +/** + * 切换至人工客服 + * + * @param kefuId 客服 ID + */ +export declare function switchToHumanMode(kefuId: string): void; +/** + * 选择客服分组模式 + * + * @param kefuId 客服 ID + * @param groupId 分组 ID + */ +export declare function selectCustomerServiceGroup(kefuId: string, groupId: string): void; +/** + * 评价客服 + * + * @param kefuId 客服 ID + * @param dialogId 会话 Id,客服后台主动拉评价的时候(onPullEvaluation)这个参数有效,其余情况传空字符串即可 + * @param value 评价分数,取值范围 1 - 5 + * @param suggest 客户建议 + * @param resolveStatus 解决状态 + * @param tagText 标签 + * @param extra 用于扩展的额外信息 + */ +export declare function evaluateCustomerService(kefuId: string, dialogId: string, value: string, suggest: string, resolveStatus: CSResolveStatus, tagText?: any, extra?: any): void; +/** + * 选择客服分组模式 + * + * @param kefuId 客服 ID + * @param message 客服留言信息 + */ +export declare function leaveMessageCustomerService(kefuId: string, message: CSLeaveMessageItem): Promise; +/** + * 结束客服聊天 + * + * @param kefuId 客服 ID + */ +export declare function stopCustomerService(kefuId: string): void; +/** + * 获取当前用户 ID + */ +export declare function getCurrentUserId(): Promise; +/** + * 设置推送语言 + * + * @param language 推送语言 + */ +export declare function setPushLanguage(language: PushLanguage): Promise; +/** + * 设置是否显示内容详情 + * + * @param isShowPushContent 是否显示内容详情 + */ +export declare function setPushContentShowStatus(isShowPushContent: boolean): Promise; +/** + * 查询是否显示内容详情 + */ +export declare function getPushContentShowStatus(): Promise; +/** + * 添加推送消息到达监听函数 + * + * @param listener + */ +export declare function addPushArrivedListener(listener: (message: PushNotificationMessage) => void): any; diff --git a/lib/js/index.js b/lib/js/index.js new file mode 100644 index 0000000..ed27d25 --- /dev/null +++ b/lib/js/index.js @@ -0,0 +1,1230 @@ +"use strict"; +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __exportStar = (this && this.__exportStar) || function(m, exports) { + for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); +}; +var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { + function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } + return new (P || (P = Promise))(function (resolve, reject) { + function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } + function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } + function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); +}; +var __generator = (this && this.__generator) || function (thisArg, body) { + var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g; + return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g; + function verb(n) { return function (v) { return step([n, v]); }; } + function step(op) { + if (f) throw new TypeError("Generator is already executing."); + while (_) try { + if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t; + if (y = 0, t) op = [op[0] & 2, t.value]; + switch (op[0]) { + case 0: case 1: t = op; break; + case 4: _.label++; return { value: op[1], done: false }; + case 5: _.label++; y = op[1]; op = [0]; continue; + case 7: op = _.ops.pop(); _.trys.pop(); continue; + default: + if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; } + if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; } + if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; } + if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; } + if (t[2]) _.ops.pop(); + _.trys.pop(); continue; + } + op = body.call(thisArg, _); + } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; } + if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true }; + } +}; +exports.__esModule = true; +exports.getConversation = exports.deleteRemoteMessages = exports.cleanHistoryMessages = exports.cleanRemoteHistoryMessages = exports.getRemoteHistoryMessages = exports.getUnreadMentionedMessages = exports.getFirstUnreadMessage = exports.getMessageCount = exports.getMessageSendTime = exports.setMessageExtra = exports.getMessageByUId = exports.getMessage = exports.searchMessages = exports.searchConversations = exports.deleteMessages = exports.clearMessages = exports.insertIncomingMessage = exports.insertOutgoingMessage = exports.getHistoryMessages = exports.setReconnectKickEnable = exports.addConnectionStatusListener = exports.downloadMediaMessage = exports.cancelDownloadMediaMessage = exports.cancelSendMediaMessage = exports.addReceiptResponseListener = exports.addReceiptRequestListener = exports.addReadReceiptReceivedListener = exports.sendReadReceiptResponse = exports.sendReadReceiptRequest = exports.sendReadReceiptMessage = exports.getBlockedConversationList = exports.setMessageReceivedStatus = exports.setMessageSentStatus = exports.addTypingStatusListener = exports.sendTypingStatus = exports.recallMessage = exports.sendDirectionalMessage = exports.sendMediaMessage = exports.sendMessage = exports.addReceiveMessageListener = exports.getConnectionStatus = exports.disconnect = exports.connect = exports.setStatisticServer = exports.setServerInfo = exports.setDeviceToken = exports.syncConversationReadStatus = exports.addRecallMessageListener = exports.addLogInfoListener = exports.init = void 0; +exports.getCurrentUserId = exports.stopCustomerService = exports.leaveMessageCustomerService = exports.evaluateCustomerService = exports.selectCustomerServiceGroup = exports.switchToHumanMode = exports.startCustomerService = exports.setOfflineMessageDuration = exports.getOfflineMessageDuration = exports.removeNotificationQuietHours = exports.getNotificationQuietHours = exports.setNotificationQuietHours = exports.getRealTimeLocationParticipants = exports.getRealTimeLocationStatus = exports.quitRealTimeLocation = exports.joinRealTimeLocation = exports.startRealTimeLocation = exports.getPublicServiceProfile = exports.getPublicServiceList = exports.unsubscribePublicService = exports.subscribePublicService = exports.searchPublicService = exports.setDiscussionInviteStatus = exports.setDiscussionName = exports.removeMemberFromDiscussion = exports.addMemberToDiscussion = exports.quitDiscussion = exports.getDiscussion = exports.createDiscussion = exports.getChatRoomInfo = exports.getRemoteChatRoomHistoryMessages = exports.quitChatRoom = exports.joinExistChatRoom = exports.joinChatRoom = exports.getBlacklist = exports.getBlacklistStatus = exports.removeFromBlacklist = exports.addToBlacklist = exports.clearMessagesUnreadStatus = exports.getUnreadCount = exports.getTotalUnreadCount = exports.clearTextMessageDraft = exports.getTextMessageDraft = exports.saveTextMessageDraft = exports.getTopConversationList = exports.setConversationToTop = exports.getConversationNotificationStatus = exports.setConversationNotificationStatus = exports.removeConversation = exports.getConversationList = void 0; +exports.addPushArrivedListener = exports.getPushContentShowStatus = exports.setPushContentShowStatus = exports.setPushLanguage = void 0; +var react_native_1 = require("react-native"); +var types_1 = require("./types"); +__exportStar(require("./types"), exports); +var RCIMClient = react_native_1.NativeModules.RCIMClient; +var eventEmitter = new react_native_1.NativeEventEmitter(RCIMClient); +/** + * 初始化 SDK,只需要调用一次 + * + * @param appKey 从融云开发者平台创建应用后获取到的 App Key + */ +function init(appKey) { + RCIMClient.init(appKey); +} +exports.init = init; +/** + * 添加日志信息监听函数 + * + * @param listener + */ +function addLogInfoListener(listener) { + return eventEmitter.addListener("rcimlib-log", listener); +} +exports.addLogInfoListener = addLogInfoListener; +/** + * 添加消息撤回监听函数 + * + * @param listener + */ +function addRecallMessageListener(listener) { + return eventEmitter.addListener("rcimlib-recall", listener); +} +exports.addRecallMessageListener = addRecallMessageListener; +/** + * 同步会话阅读状态 + * + * @param conversationType 会话类型 + * @param targetId 目标 ID + * @param timestamp 该会话中已读的最后一条消息的发送时间戳 + */ +function syncConversationReadStatus(conversationType, targetId, timestamp) { + return RCIMClient.syncConversationReadStatus(conversationType, targetId, timestamp); +} +exports.syncConversationReadStatus = syncConversationReadStatus; +/** + * 设置 deviceToken,用于远程推送 + * + * @param deviceToken 从系统获取到的设备号 deviceToken(需要去掉空格和尖括号) + * + * deviceToken是系统提供的,从苹果服务器获取的,用于APNs远程推送必须使用的设备唯一值。 + * 您需要将 `-application:didRegisterForRemoteNotificationsWithDeviceToken:` + * 获取到的deviceToken,转为NSString类型,并去掉其中的空格和尖括号,作为参数传入此方法。 + */ +function setDeviceToken(deviceToken) { + RCIMClient.setDeviceToken(deviceToken); +} +exports.setDeviceToken = setDeviceToken; +/** + * 设置导航服务器和上传文件服务器信息,要在 [[init]] 前使用 + * + * @param naviServer 导航服务器地址 + * @param fileServer 文件服务器地址 + */ +function setServerInfo(naviServer, fileServer) { + RCIMClient.setServerInfo(naviServer, fileServer); +} +exports.setServerInfo = setServerInfo; +/** + * 设置统计服务地址 + * + * 配置数据上传地址 (非必须) 通过配置该地址,SDK + * 会在初始化时把设备相关信息上传到私有云节点。 + * 影响到的功能是开发者后台的广播推送功能,如果私有云客户没有配置该地址,那从后台发推送时,客户端是收不到的。 + * 普通的 IM 推送不受影响。设置数据上传服务器地址。 + * 可以支持设置 http://cn.xxx.com 或者 https://cn.xxx.com 或者 cn.xxx.com + * 如果设置成 cn.xxx.com,sdk 会组装成并仅支持 http:// 协议格式。 + * + * @param server 服务地址 + */ +function setStatisticServer(server) { + RCIMClient.setStatisticServer(server); +} +exports.setStatisticServer = setStatisticServer; +/** + * 连接融云服务器,只需要调用一次 + * + * 在 App 整个生命周期,您只需要调用一次此方法与融云服务器建立连接。 + * 之后无论是网络出现异常或者App有前后台的切换等,SDK都会负责自动重连。 + * 除非您已经手动将连接断开,否则您不需要自己再手动重连。 + * + * @param token 从服务端获取的用户身份令牌(Token) + * @param success 成功回调函数 + * @param error 失败回调函数 + * @param tokenIncorrect token 错误或过期回调函数 + */ +function connect(token, success, error, tokenIncorrect) { + if (success === void 0) { success = null; } + if (error === void 0) { error = null; } + if (tokenIncorrect === void 0) { tokenIncorrect = null; } + var eventId = Math.random().toString(); + var listener = eventEmitter.addListener("rcimlib-connect", function (data) { + if (data.eventId === eventId) { + if (data.type === "success") { + success && success(data.userId); + } + else if (data.type === "error") { + error && error(data.errorCode); + } + else if (data.type === "tokenIncorrect") { + tokenIncorrect && tokenIncorrect(); + } + listener.remove(); + } + }); + RCIMClient.connect(token, eventId); +} +exports.connect = connect; +/** + * 断开与融云服务器的连接 + * + * @param isReceivePush 是否还接收推送 + */ +function disconnect(isReceivePush) { + if (isReceivePush === void 0) { isReceivePush = true; } + RCIMClient.disconnect(isReceivePush); +} +exports.disconnect = disconnect; +/** + * 获取当前连接状态 + */ +function getConnectionStatus() { + return RCIMClient.getConnectionStatus(); +} +exports.getConnectionStatus = getConnectionStatus; +/** + * 添加消息监听函数 + */ +function addReceiveMessageListener(listener) { + return eventEmitter.addListener("rcimlib-receive-message", listener); +} +exports.addReceiveMessageListener = addReceiveMessageListener; +function handleSendMessageCallback(callback) { + var eventId = Math.random().toString(); + if (callback) { + var listener_1 = eventEmitter.addListener("rcimlib-send-message", function (data) { + if (data.eventId === eventId) { + var success = callback.success, error = callback.error, cancel = callback.cancel, progress = callback.progress; + if (data.type === "success") { + success && success(data.messageId); + listener_1.remove(); + } + else if (data.type === "error") { + error && error(data.errorCode, data.messageId, data.errorMessage); + listener_1.remove(); + } + else if (data.type === "cancel") { + cancel && cancel(); + listener_1.remove(); + } + else if (data.type === "progress") { + progress && progress(data.progress, data.messageId); + } + } + }); + } + return eventId; +} +/** + * 发送消息 + * + * @param message 消息 + * @param callback 回调 + */ +function sendMessage(message, callback) { + if (callback === void 0) { callback = {}; } + message.content = handleMessageContent(message.content); + RCIMClient.sendMessage(message, handleSendMessageCallback(callback)); +} +exports.sendMessage = sendMessage; +/** + * 发送媒体消息 + * + * @param message 消息 + * @param callback 回调 + */ +function sendMediaMessage(message, callback) { + if (callback === void 0) { callback = {}; } + message.content = handleMessageContent(message.content); + RCIMClient.sendMediaMessage(message, handleSendMessageCallback(callback)); +} +exports.sendMediaMessage = sendMediaMessage; +/** + * 发送定向消息 + * + * @param message 消息 + * @param userIdList 用户 ID 列表 + * @param callback 回调 + */ +function sendDirectionalMessage(message, userIdList, callback) { + message.content = handleMessageContent(message.content); + RCIMClient.sendDirectionalMessage(message, handleSendMessageCallback(callback)); +} +exports.sendDirectionalMessage = sendDirectionalMessage; +/** + * 消息撤回 + * + * @param messageId 消息 ID + * @param pushContent 推送内容 + */ +function recallMessage(messageId, pushContent) { + if (pushContent === void 0) { pushContent = ""; } + return RCIMClient.recallMessage(messageId, pushContent); +} +exports.recallMessage = recallMessage; +/** + * 发送输入状态 + * + * @param conversationType 会话类型 + * @param targetId 目标 ID + * @param typingContentType 输入内容类型 + */ +function sendTypingStatus(conversationType, targetId, typingContentType) { + RCIMClient.sendTypingStatus(conversationType, targetId, typingContentType); +} +exports.sendTypingStatus = sendTypingStatus; +/** + * 添加输入状态监听函数 + */ +function addTypingStatusListener(listener) { + return eventEmitter.addListener("rcimlib-typing-status", listener); +} +exports.addTypingStatusListener = addTypingStatusListener; +/** + * 设置消息发送状态 + * + * @param messageId 消息 ID + * @param status 状态 + */ +function setMessageSentStatus(messageId, status) { + return RCIMClient.setMessageSentStatus(messageId, status); +} +exports.setMessageSentStatus = setMessageSentStatus; +/** + * 设置消息接收状态 + * + * @param messageId 消息 ID + * @param status 状态 + */ +function setMessageReceivedStatus(messageId, status) { + return RCIMClient.setMessageReceivedStatus(messageId, status); +} +exports.setMessageReceivedStatus = setMessageReceivedStatus; +/** + * 获取屏蔽消息提醒的会话列表 + * + * @param conversationTypeList 消息类型列表 + */ +function getBlockedConversationList(conversationTypeList) { + return RCIMClient.getBlockedConversationList(conversationTypeList); +} +exports.getBlockedConversationList = getBlockedConversationList; +/** + * 发送阅读回执 + * + * @param conversationType 会话类型 + * @param targetId 目标 ID + * @param timestamp 该会话中已阅读点最后一条消息的发送时间戳 + */ +function sendReadReceiptMessage(conversationType, targetId, timestamp) { + RCIMClient.sendReadReceiptMessage(conversationType, targetId, timestamp); +} +exports.sendReadReceiptMessage = sendReadReceiptMessage; +/** + * 发起群组消息回执请求 + * + * @param messageId 消息 ID + */ +function sendReadReceiptRequest(messageId) { + return RCIMClient.sendReadReceiptRequest(messageId); +} +exports.sendReadReceiptRequest = sendReadReceiptRequest; +/** + * 发起群组消息回执响应 + * + * @param conversationType 会话类型 + * @param targetId 目标 ID + * @param messages 回执的消息列表 + */ +function sendReadReceiptResponse(conversationType, targetId, messages) { + return RCIMClient.sendReadReceiptResponse(conversationType, targetId, messages); +} +exports.sendReadReceiptResponse = sendReadReceiptResponse; +/** + * 添加私聊阅读回执监听函数 + */ +function addReadReceiptReceivedListener(listener) { + return eventEmitter.addListener("rcimlib-read-receipt-received", listener); +} +exports.addReadReceiptReceivedListener = addReadReceiptReceivedListener; +/** + * 添加收到消息已读回执请求监听函数 + * + * 收到此请求后,如果用户阅读了对应的消息,需要调用 + * sendMessageReadReceiptResponse 接口发送已读响应 + */ +function addReceiptRequestListener(listener) { + return eventEmitter.addListener("rcimlib-receipt-request", listener); +} +exports.addReceiptRequestListener = addReceiptRequestListener; +/** + * 添加消息回执响应监听函数 + * + * @param listener + */ +function addReceiptResponseListener(listener) { + return eventEmitter.addListener("rcimlib-receipt-response", listener); +} +exports.addReceiptResponseListener = addReceiptResponseListener; +/** + * 取消发送中的媒体消息 + * + * @param messageId 消息 ID + */ +function cancelSendMediaMessage(messageId) { + return RCIMClient.cancelSendMediaMessage(messageId); +} +exports.cancelSendMediaMessage = cancelSendMediaMessage; +/** + * 取消下载中的媒体消息 + * + * @param messageId 消息 ID + */ +function cancelDownloadMediaMessage(messageId) { + return RCIMClient.cancelDownloadMediaMessage(messageId); +} +exports.cancelDownloadMediaMessage = cancelDownloadMediaMessage; +/** + * 下载媒体消息 + * + * @param messageId 消息 ID + * @param callback 回调 + */ +function downloadMediaMessage(messageId, callback) { + if (callback === void 0) { callback = {}; } + var eventId = Math.random().toString(); + var listener = eventEmitter.addListener("rcimlib-download-media-message", function (data) { + if (callback) { + if (data.eventId === eventId) { + var success = callback.success, error = callback.error, progress = callback.progress, cancel = callback.cancel; + if (data.type === "success") { + success && success(data.path); + listener.remove(); + } + else if (data.type === "error") { + error && error(data.errorCode); + listener.remove(); + } + else if (data.type === "progress") { + progress && progress(data.progress); + } + else if (data.type === "cancel") { + cancel && cancel(); + } + } + } + }); + RCIMClient.downloadMediaMessage(messageId, eventId); +} +exports.downloadMediaMessage = downloadMediaMessage; +/** + * 添加连接状态监听函数 + */ +function addConnectionStatusListener(listener) { + return eventEmitter.addListener("rcimlib-connection-status", listener); +} +exports.addConnectionStatusListener = addConnectionStatusListener; +/** + * 设置断线重连时是否踢出重连设备 + * + * 用户没有开通多设备登录功能的前提下,同一个账号在一台新设备上登录的时候,会把这个账号在之前登录的设备上踢出。 + * 由于 SDK 有断线重连功能,存在下面情况。 用户在 A 设备登录,A + * 设备网络不稳定,没有连接成功,SDK 启动重连机制。 用户此时又在 B 设备登录,B + * 设备连接成功。 A 设备网络稳定之后,用户在 A 设备连接成功,B 设备被踢出。 + * 这个接口就是为这种情况加的。 设置 enable 为 true 时,SDK + * 重连的时候发现此时已有别的设备连接成功,不再强行踢出已有设备,而是踢出重连设备。 + * + * @param enabled 是否踢出重连设备 + */ +function setReconnectKickEnable(enabled) { + RCIMClient.setReconnectKickEnable(enabled); +} +exports.setReconnectKickEnable = setReconnectKickEnable; +function getHistoryMessages(conversationType, targetId, objectName, baseMessageId, count, isForward) { + if (objectName === void 0) { objectName = null; } + if (baseMessageId === void 0) { baseMessageId = -1; } + if (count === void 0) { count = 10; } + if (isForward === void 0) { isForward = true; } + if (Array.isArray(objectName)) { + return RCIMClient.getHistoryMessagesByTimestamp(conversationType, targetId, objectName, baseMessageId, count, isForward); + } + else { + return RCIMClient.getHistoryMessages(conversationType, targetId, objectName, baseMessageId, count, isForward); + } +} +exports.getHistoryMessages = getHistoryMessages; +/** + * 消息内容兼容性处理 + */ +function handleMessageContent(content) { + if (!content.objectName) { + // @ts-ignore + content.objectName = types_1.MessageObjectNames[content.type]; + } + return content; +} +/** + * 向本地会话插入一条发送消息 + * + * @param conversationType + * @param targetId + * @param sentStatus + * @param messageContent + * @param sentTime + */ +function insertOutgoingMessage(conversationType, targetId, sentStatus, messageContent, sentTime) { + if (sentTime === void 0) { sentTime = 0; } + return RCIMClient.insertOutgoingMessage(conversationType, targetId, sentStatus, handleMessageContent(messageContent), sentTime); +} +exports.insertOutgoingMessage = insertOutgoingMessage; +/** + * 向本地会话插入一条接收消息 + * + * @param conversationType + * @param targetId + * @param senderUserId + * @param receivedStatus + * @param messageContent + * @param sentTime + */ +function insertIncomingMessage(conversationType, targetId, senderUserId, receivedStatus, messageContent, sentTime) { + if (sentTime === void 0) { sentTime = 0; } + return RCIMClient.insertIncomingMessage(conversationType, targetId, senderUserId, receivedStatus, handleMessageContent(messageContent), sentTime); +} +exports.insertIncomingMessage = insertIncomingMessage; +/** + * 清空某一会话的所有消息 + * + * @param conversationType + * @param targetId + */ +function clearMessages(conversationType, targetId) { + return RCIMClient.clearMessages(conversationType, targetId); +} +exports.clearMessages = clearMessages; +function deleteMessages(typeOrIds, targetId) { + if (targetId === void 0) { targetId = ""; } + if (Array.isArray(typeOrIds)) { + return RCIMClient.deleteMessagesByIds(typeOrIds); + } + return RCIMClient.deleteMessages(typeOrIds, targetId); +} +exports.deleteMessages = deleteMessages; +/** + * 根据关键字搜索会话 + * + * @param keyword 关键字 + * @param conversationTypes 会话类型数组 + * @param objectNames 对象名称数组 + */ +function searchConversations(keyword, conversationTypes, objectNames) { + return RCIMClient.searchConversations(keyword, conversationTypes, objectNames); +} +exports.searchConversations = searchConversations; +/** + * 搜索消息 + * + * @param conversationType 会话类型 + * @param targetId 目标 ID + * @param keyword 关键字 + * @param count 获取数量 + * @param startTime 开始时间 + */ +function searchMessages(conversationType, targetId, keyword, count, startTime) { + if (startTime === void 0) { startTime = 0; } + return RCIMClient.searchMessages(conversationType, targetId, keyword, count, startTime); +} +exports.searchMessages = searchMessages; +/** + * 获取消息 + * + * @param messageId 消息 ID + */ +function getMessage(messageId) { + return RCIMClient.getMessage(messageId); +} +exports.getMessage = getMessage; +/** + * 根据消息 UID 获取消息 + * + * @param messageUId 消息 UID + */ +function getMessageByUId(messageUId) { + return RCIMClient.getMessageByUId(messageUId); +} +exports.getMessageByUId = getMessageByUId; +/** + * 设置消息的附加信息 + * + * @param messageId 消息 ID + * @param extra 附加信息 + */ +function setMessageExtra(messageId, extra) { + return RCIMClient.setMessageExtra(messageId, extra); +} +exports.setMessageExtra = setMessageExtra; +/** + * 获取消息发送时间 + * + * @param messageId 消息 ID + */ +function getMessageSendTime(messageId) { + return RCIMClient.getMessageSendTime(messageId); +} +exports.getMessageSendTime = getMessageSendTime; +/** + * 获取会话中的消息数量 + * + * @param conversationType 会话类型 + * @param targetId 目标 ID + */ +function getMessageCount(conversationType, targetId) { + return RCIMClient.getMessageCount(conversationType, targetId); +} +exports.getMessageCount = getMessageCount; +/** + * 获取会话里第一条未读消息 + * + * @param conversationType 会话类型 + * @param targetId 目标 ID + */ +function getFirstUnreadMessage(conversationType, targetId) { + return RCIMClient.getFirstUnreadMessage(conversationType, targetId); +} +exports.getFirstUnreadMessage = getFirstUnreadMessage; +/** + * 获取会话中 @ 提醒自己的消息 + * + * @param conversationType 会话类型 + * @param targetId 目标 ID + */ +function getUnreadMentionedMessages(conversationType, targetId) { + return RCIMClient.getUnreadMentionedMessages(conversationType, targetId); +} +exports.getUnreadMentionedMessages = getUnreadMentionedMessages; +/** + * 获取服务端历史消息 + * + * @param conversationType 会话类型 + * @param targetId 目标 ID + * @param sentTime 清除消息截止时间戳,为 0 则清除会话所有服务端历史消息 + * @param count 删除数量 + */ +function getRemoteHistoryMessages(conversationType, targetId, sentTime, count) { + return RCIMClient.getRemoteHistoryMessages(conversationType, targetId, sentTime, count); +} +exports.getRemoteHistoryMessages = getRemoteHistoryMessages; +/** + * 清除服务端历史消息 + * + * @param conversationType 会话类型 + * @param targetId 目标 ID + * @param recordTime 清除消息截止时间戳,为 0 则清除会话所有服务端历史消息 + */ +function cleanRemoteHistoryMessages(conversationType, targetId, recordTime) { + return RCIMClient.cleanRemoteHistoryMessages(conversationType, targetId, recordTime); +} +exports.cleanRemoteHistoryMessages = cleanRemoteHistoryMessages; +/** + * 清除服务端历史消息 + * + * @param conversationType 会话类型 + * @param targetId 目标 ID + * @param recordTime 清除消息截止时间戳,为 0 则清除会话所有服务端历史消息 + * @param clearRemote 是否同时删除服务端消息 + */ +function cleanHistoryMessages(conversationType, targetId, recordTime, clearRemote) { + return RCIMClient.cleanHistoryMessages(conversationType, targetId, recordTime, clearRemote); +} +exports.cleanHistoryMessages = cleanHistoryMessages; +/** + * 清除服务端历史消息 + * + * @param conversationType 会话类型 + * @param targetId 目标 ID + * @param messages 要删除的消息数组,数组大小不能超过 100 条 + */ +function deleteRemoteMessages(conversationType, targetId, messages) { + return RCIMClient.deleteRemoteMessages(conversationType, targetId, messages); +} +exports.deleteRemoteMessages = deleteRemoteMessages; +/** + * 获取会话 + * + * @param conversationType 会话类型 + * @param targetId 目标 ID + */ +function getConversation(conversationType, targetId) { + return RCIMClient.getConversation(conversationType, targetId); +} +exports.getConversation = getConversation; +/** + * 获取会话列表 + * + * @param conversationTypes 会话类型列表 + * @param count 获取的数量 + * @param timestamp 会话的时间戳(获取这个时间戳之前的会话列表,0 + * 表示从最新开始获取) + */ +function getConversationList(conversationTypes, count, timestamp) { + if (conversationTypes === void 0) { conversationTypes = []; } + if (count === void 0) { count = 0; } + if (timestamp === void 0) { timestamp = 0; } + return RCIMClient.getConversationList(conversationTypes, count, timestamp); +} +exports.getConversationList = getConversationList; +/** + * 从会话列表中移除某一会话,但是不删除会话内的消息 + * + * @param conversationType 会话类型 + * @param targetId 目标 ID + */ +function removeConversation(conversationType, targetId) { + return RCIMClient.removeConversation(conversationType, targetId); +} +exports.removeConversation = removeConversation; +/** + * 设置会话消息提醒状态 + * + * @param conversationType 会话类型 + * @param targetId 目标 ID + * @param isBlock 是否屏蔽 + */ +function setConversationNotificationStatus(conversationType, targetId, isBlock) { + return RCIMClient.setConversationNotificationStatus(conversationType, targetId, isBlock); +} +exports.setConversationNotificationStatus = setConversationNotificationStatus; +/** + * 获取会话消息提醒状态 + * + * @param conversationType 会话类型 + * @param targetId 目标 ID + */ +function getConversationNotificationStatus(conversationType, targetId) { + return RCIMClient.getConversationNotificationStatus(conversationType, targetId); +} +exports.getConversationNotificationStatus = getConversationNotificationStatus; +/** + * 设置是否置顶会话 + * + * @param conversationType 会话类型 + * @param targetId 目标 ID + * @param isTop 是否置顶 + */ +function setConversationToTop(conversationType, targetId, isTop) { + return RCIMClient.setConversationToTop(conversationType, targetId, isTop); +} +exports.setConversationToTop = setConversationToTop; +/** + * 获取置顶会话列表 + * + * @param conversationTypes 会话类型列表 + */ +function getTopConversationList(conversationTypes) { + if (conversationTypes === void 0) { conversationTypes = []; } + return RCIMClient.getTopConversationList(conversationTypes); +} +exports.getTopConversationList = getTopConversationList; +/** + * 保存某一会话的文本消息草稿 + * + * @param conversationType 会话类型 + * @param targetId 目标 ID + * @param content 草稿内容 + */ +function saveTextMessageDraft(conversationType, targetId, content) { + return RCIMClient.saveTextMessageDraft(conversationType, targetId, content); +} +exports.saveTextMessageDraft = saveTextMessageDraft; +/** + * 获取某一会话的文本消息草稿 + * + * @param conversationType 会话类型 + * @param targetId 目标 ID + */ +function getTextMessageDraft(conversationType, targetId) { + return RCIMClient.getTextMessageDraft(conversationType, targetId); +} +exports.getTextMessageDraft = getTextMessageDraft; +/** + * 清除某一会话的文本消息草稿 + * + * @param conversationType 会话类型 + * @param targetId 目标 ID + */ +function clearTextMessageDraft(conversationType, targetId) { + return RCIMClient.clearTextMessageDraft(conversationType, targetId); +} +exports.clearTextMessageDraft = clearTextMessageDraft; +/** + * 获取所有未读消息数 + */ +function getTotalUnreadCount() { + return RCIMClient.getTotalUnreadCount(); +} +exports.getTotalUnreadCount = getTotalUnreadCount; +function getUnreadCount(conversationType, targetId) { + if (targetId === void 0) { targetId = ""; } + if (Array.isArray(conversationType)) { + return RCIMClient.getUnreadCount(0, "", conversationType); + } + return RCIMClient.getUnreadCount(conversationType, targetId, []); +} +exports.getUnreadCount = getUnreadCount; +/** + * 清除某个会话中的未读消息数 + * + * @param conversationType 会话类型 + * @param targetId 目标 ID + * @param time 该会话已阅读的最后一条消息的发送时间戳 + */ +function clearMessagesUnreadStatus(conversationType, targetId, time) { + if (time === void 0) { time = 0; } + return RCIMClient.clearMessagesUnreadStatus(conversationType, targetId, time); +} +exports.clearMessagesUnreadStatus = clearMessagesUnreadStatus; +/** + * 把用户加入黑名单 + * + * @param userId 用户 ID + */ +function addToBlacklist(userId) { + return RCIMClient.addToBlacklist(userId); +} +exports.addToBlacklist = addToBlacklist; +/** + * 把用户从黑名单种移除 + * + * @param userId 用户 ID + */ +function removeFromBlacklist(userId) { + return RCIMClient.removeFromBlacklist(userId); +} +exports.removeFromBlacklist = removeFromBlacklist; +/** + * 获取某用户是否在黑名单中 + * + * @param userId 用户 ID + * @return 是否在黑名单中 + */ +function getBlacklistStatus(userId) { + return RCIMClient.getBlacklistStatus(userId); +} +exports.getBlacklistStatus = getBlacklistStatus; +/** + * 获取黑名单列表 + * + * @return 黑名单列表 + */ +function getBlacklist() { + return RCIMClient.getBlacklist(); +} +exports.getBlacklist = getBlacklist; +/** + * 加入聊天室,如果已存在,直接加入,否则创建并加入 + * + * @param targetId 聊天室 ID + * @param messageCount 默认获取的消息数量,最多 50 + */ +function joinChatRoom(targetId, messageCount) { + if (messageCount === void 0) { messageCount = 10; } + return RCIMClient.joinChatRoom(targetId, messageCount); +} +exports.joinChatRoom = joinChatRoom; +/** + * 加入已存在的聊天室,如果不存在则加入失败 + * + * @param targetId 聊天室 ID + * @param messageCount 默认获取的消息数量,最多 50 + */ +function joinExistChatRoom(targetId, messageCount) { + if (messageCount === void 0) { messageCount = 10; } + return RCIMClient.joinExistChatRoom(targetId, messageCount); +} +exports.joinExistChatRoom = joinExistChatRoom; +/** + * 退出聊天室 + * + * @param targetId 聊天室 ID + */ +function quitChatRoom(targetId) { + return RCIMClient.quitChatRoom(targetId); +} +exports.quitChatRoom = quitChatRoom; +/** + * 从服务器端获取聊天室的历史消息 + * + * @param targetId 目标 ID + * @param recordTime 起始的消息发送时间戳,单位毫秒 + * @param count 要获取的消息数量 + * @param order 拉取顺序 + */ +function getRemoteChatRoomHistoryMessages(targetId, recordTime, count, order) { + return RCIMClient.getRemoteChatRoomHistoryMessages(targetId, recordTime, count, order); +} +exports.getRemoteChatRoomHistoryMessages = getRemoteChatRoomHistoryMessages; +/** + * 获取聊天室信息 + * + * @param targetId 聊天室 ID + * @param memberCount 聊天室成员数量,最多获取 20 个 + * @param order 返回的聊天室成员排序方式 + */ +function getChatRoomInfo(targetId, memberCount, order) { + if (memberCount === void 0) { memberCount = 20; } + if (order === void 0) { order = types_1.ChatRoomMemberOrder.ASC; } + return RCIMClient.getChatRoomInfo(targetId, memberCount, order); +} +exports.getChatRoomInfo = getChatRoomInfo; +/** + * 创建讨论组 + * + * @param name 讨论组名称 + * @param userList 用户 ID 列表 + */ +function createDiscussion(name, userList) { + return RCIMClient.createDiscussion(name, userList); +} +exports.createDiscussion = createDiscussion; +/** + * 获取讨论组信息 + * + * @param targetId 讨论组 ID + */ +function getDiscussion(targetId) { + return RCIMClient.getDiscussion(targetId); +} +exports.getDiscussion = getDiscussion; +/** + * 退出讨论组 + * + * @param targetId 讨论组 ID + */ +function quitDiscussion(targetId) { + return RCIMClient.quitDiscussion(targetId); +} +exports.quitDiscussion = quitDiscussion; +/** + * 把用户加入讨论组 + * + * @param targetId 讨论组 ID + * @param userList 用户 ID 列表 + */ +function addMemberToDiscussion(targetId, userList) { + return RCIMClient.addMemberToDiscussion(targetId, userList); +} +exports.addMemberToDiscussion = addMemberToDiscussion; +/** + * 把用户从讨论组移出 + * + * @param targetId 讨论组 ID + * @param user 用户 ID + */ +function removeMemberFromDiscussion(targetId, user) { + return RCIMClient.removeMemberFromDiscussion(targetId, user); +} +exports.removeMemberFromDiscussion = removeMemberFromDiscussion; +/** + * 设置讨论组名称 + * + * @param targetId 讨论组 ID + * @param name 讨论组名称 + */ +function setDiscussionName(targetId, name) { + return RCIMClient.setDiscussionName(targetId, name); +} +exports.setDiscussionName = setDiscussionName; +/** + * 设置讨论组拉人权限 + * + * @param targetId 讨论组 ID + * @param isOpen 是否开放拉人权限 + */ +function setDiscussionInviteStatus(targetId, isOpen) { + return RCIMClient.setDiscussionInviteStatus(targetId, isOpen); +} +exports.setDiscussionInviteStatus = setDiscussionInviteStatus; +/** + * 搜索公众服务 + * + * @param keyword 关键字 + * @param searchType 搜索类型 + * @param publicServiceType 公众服务类型 + */ +function searchPublicService(keyword, searchType, publicServiceType) { + if (searchType === void 0) { searchType = types_1.SearchType.FUZZY; } + if (publicServiceType === void 0) { publicServiceType = 0; } + return RCIMClient.searchPublicService(keyword, searchType, publicServiceType); +} +exports.searchPublicService = searchPublicService; +/** + * 订阅公共服务 + * + * @param publicServiceType 公共服务类型 + * @param publicServiceId 公共服务 ID + */ +function subscribePublicService(publicServiceType, publicServiceId) { + return RCIMClient.subscribePublicService(publicServiceType, publicServiceId); +} +exports.subscribePublicService = subscribePublicService; +/** + * 取消关注公共服务 + * + * @param publicServiceType 公共服务类型 + * @param publicServiceId 公共服务 ID + */ +function unsubscribePublicService(publicServiceType, publicServiceId) { + return RCIMClient.unsubscribePublicService(publicServiceType, publicServiceId); +} +exports.unsubscribePublicService = unsubscribePublicService; +/** + * 获取已订阅的公众服务列表 + */ +function getPublicServiceList() { + return RCIMClient.getPublicServiceList(); +} +exports.getPublicServiceList = getPublicServiceList; +/** + * 获取单个公众服务信息 + * + * @param publicServiceType 公共服务类型 + * @param publicServiceId 公共服务 ID + */ +function getPublicServiceProfile(publicServiceType, publicServiceId) { + return RCIMClient.getPublicServiceProfile(publicServiceType, publicServiceId); +} +exports.getPublicServiceProfile = getPublicServiceProfile; +/** + * 发起实时位置共享 + * + * @param conversationType 会话类型 + * @param targetId 目标 ID + */ +function startRealTimeLocation(conversationType, targetId) { + return RCIMClient.startRealTimeLocation(conversationType, targetId); +} +exports.startRealTimeLocation = startRealTimeLocation; +/** + * 加入实时位置共享 + * + * @param conversationType 会话类型 + * @param targetId 目标 ID + */ +function joinRealTimeLocation(conversationType, targetId) { + return RCIMClient.joinRealTimeLocation(conversationType, targetId); +} +exports.joinRealTimeLocation = joinRealTimeLocation; +/** + * 退出实时位置共享 + * + * @param conversationType 会话类型 + * @param targetId 目标 ID + */ +function quitRealTimeLocation(conversationType, targetId) { + return RCIMClient.quitRealTimeLocation(conversationType, targetId); +} +exports.quitRealTimeLocation = quitRealTimeLocation; +/** + * 获取实时位置共享状态 + * + * @param conversationType 会话类型 + * @param targetId 目标 ID + */ +function getRealTimeLocationStatus(conversationType, targetId) { + return RCIMClient.getRealTimeLocationStatus(conversationType, targetId); +} +exports.getRealTimeLocationStatus = getRealTimeLocationStatus; +/** + * 获取参与实时位置共享的所有成员 + * + * @param conversationType 会话类型 + * @param targetId 目标 ID + */ +function getRealTimeLocationParticipants(conversationType, targetId) { + return RCIMClient.getRealTimeLocationParticipants(conversationType, targetId); +} +exports.getRealTimeLocationParticipants = getRealTimeLocationParticipants; +/** + * 全局屏蔽某个时间段的消息提醒 + * + * @param startTime 开始屏蔽消息提醒的时间,格式为HH:MM:SS + * @param spanMinutes 需要屏蔽消息提醒的分钟数,0 < spanMinutes < 1440 + */ +function setNotificationQuietHours(startTime, spanMinutes) { + return RCIMClient.setNotificationQuietHours(startTime, spanMinutes); +} +exports.setNotificationQuietHours = setNotificationQuietHours; +/** + * 查询已设置的全局时间段消息提醒屏蔽 + */ +function getNotificationQuietHours() { + return RCIMClient.getNotificationQuietHours(); +} +exports.getNotificationQuietHours = getNotificationQuietHours; +/** + * 删除已设置的全局时间段消息提醒屏蔽 + */ +function removeNotificationQuietHours() { + return RCIMClient.removeNotificationQuietHours(); +} +exports.removeNotificationQuietHours = removeNotificationQuietHours; +/** + * 获取离线消息在服务端的存储时间(以天为单位) + */ +function getOfflineMessageDuration() { + return RCIMClient.getOfflineMessageDuration(); +} +exports.getOfflineMessageDuration = getOfflineMessageDuration; +/** + * 设置离线消息在服务端的存储时间(以天为单位) + */ +function setOfflineMessageDuration(duration) { + return __awaiter(this, void 0, void 0, function () { + var _a; + return __generator(this, function (_b) { + switch (_b.label) { + case 0: + _a = parseInt; + return [4 /*yield*/, RCIMClient.setOfflineMessageDuration(duration)]; + case 1: return [2 /*return*/, _a.apply(void 0, [_b.sent()])]; + } + }); + }); +} +exports.setOfflineMessageDuration = setOfflineMessageDuration; +/** + * 发起客服聊天 + * + * @param kefuId 客服 ID + * @param csInfo 客服信息 + * @param callback 回调 + */ +function startCustomerService(kefuId, csInfo, callback) { + if (callback === void 0) { callback = null; } + var eventId = Math.random().toString(); + if (callback) { + var success_1 = callback.success, error_1 = callback.error, modeChanged_1 = callback.modeChanged, selectGroup_1 = callback.selectGroup, pullEvaluation_1 = callback.pullEvaluation, quit_1 = callback.quit; + var listener_2 = eventEmitter.addListener("rcimlib-customer-service", function (data) { + if (data.eventId === eventId) { + if (data.type === "success") { + success_1 && success_1(data.config); + } + else if (data.type === "error") { + error_1 && error_1(data.errorCode, data.errorMessage); + listener_2.remove(); + } + else if (data.type === "mode-changed") { + modeChanged_1 && modeChanged_1(data.mode); + } + else if (data.type === "pull-evaluation") { + pullEvaluation_1 && pullEvaluation_1(data.dialogId); + } + else if (data.type === "select-group") { + selectGroup_1 && selectGroup_1(data.groups); + } + else if (data.type === "quit") { + quit_1 && quit_1(data.message); + listener_2.remove(); + } + } + }); + } + RCIMClient.startCustomerService(kefuId, csInfo, eventId); +} +exports.startCustomerService = startCustomerService; +/** + * 切换至人工客服 + * + * @param kefuId 客服 ID + */ +function switchToHumanMode(kefuId) { + RCIMClient.switchToHumanMode(kefuId); +} +exports.switchToHumanMode = switchToHumanMode; +/** + * 选择客服分组模式 + * + * @param kefuId 客服 ID + * @param groupId 分组 ID + */ +function selectCustomerServiceGroup(kefuId, groupId) { + RCIMClient.selectCustomServiceGroup(kefuId, groupId); +} +exports.selectCustomerServiceGroup = selectCustomerServiceGroup; +/** + * 评价客服 + * + * @param kefuId 客服 ID + * @param dialogId 会话 Id,客服后台主动拉评价的时候(onPullEvaluation)这个参数有效,其余情况传空字符串即可 + * @param value 评价分数,取值范围 1 - 5 + * @param suggest 客户建议 + * @param resolveStatus 解决状态 + * @param tagText 标签 + * @param extra 用于扩展的额外信息 + */ +function evaluateCustomerService(kefuId, dialogId, value, suggest, resolveStatus, tagText, extra) { + if (tagText === void 0) { tagText = null; } + if (extra === void 0) { extra = null; } + RCIMClient.evaluateCustomerService(kefuId, dialogId, value, suggest, resolveStatus, tagText, extra); +} +exports.evaluateCustomerService = evaluateCustomerService; +/** + * 选择客服分组模式 + * + * @param kefuId 客服 ID + * @param message 客服留言信息 + */ +function leaveMessageCustomerService(kefuId, message) { + return RCIMClient.leaveMessageCustomerService(kefuId, message); +} +exports.leaveMessageCustomerService = leaveMessageCustomerService; +/** + * 结束客服聊天 + * + * @param kefuId 客服 ID + */ +function stopCustomerService(kefuId) { + RCIMClient.stopCustomerService(kefuId); +} +exports.stopCustomerService = stopCustomerService; +/** + * 获取当前用户 ID + */ +function getCurrentUserId() { + return RCIMClient.getCurrentUserId(); +} +exports.getCurrentUserId = getCurrentUserId; +/** + * 设置推送语言 + * + * @param language 推送语言 + */ +function setPushLanguage(language) { + return RCIMClient.setPushLanguage(language); +} +exports.setPushLanguage = setPushLanguage; +/** + * 设置是否显示内容详情 + * + * @param isShowPushContent 是否显示内容详情 + */ +function setPushContentShowStatus(isShowPushContent) { + return RCIMClient.setPushContentShowStatus(isShowPushContent); +} +exports.setPushContentShowStatus = setPushContentShowStatus; +/** + * 查询是否显示内容详情 + */ +function getPushContentShowStatus() { + return RCIMClient.getPushContentShowStatus(); +} +exports.getPushContentShowStatus = getPushContentShowStatus; +/** + * 添加推送消息到达监听函数 + * + * @param listener + */ +function addPushArrivedListener(listener) { + return eventEmitter.addListener("rcimlib-push-arrived", listener); +} +exports.addPushArrivedListener = addPushArrivedListener; diff --git a/lib/js/types.d.ts b/lib/js/types.d.ts new file mode 100644 index 0000000..e27f62b --- /dev/null +++ b/lib/js/types.d.ts @@ -0,0 +1,908 @@ +/** + * 消息方向 + */ +export declare enum MessageDirection { + SEND = 1, + RECEIVE = 2 +} +/** + * 会话类型 + */ +export declare enum ConversationType { + PRIVATE = 1, + DISCUSSION = 2, + GROUP = 3, + CHATROOM = 4, + CUSTOMER_SERVICE = 5, + SYSTEM = 6, + APP_SERVICE = 7, + PUBLIC_SERVICE = 8, + PUSH_SERVICE = 9 +} +/** + * 发送状态 + */ +export declare enum SentStatus { + SENDING = 10, + FAILED = 20, + SENT = 30, + RECEIVED = 40, + READ = 50, + DESTROYED = 60, + CANCELED = 70 +} +/** + * 用户信息 + */ +export interface UserInfo { + userId: string; + name: string; + portraitUrl: string; +} +/** + * 消息提醒类型 + */ +export declare enum MentionedType { + /** + * 提醒所有 + */ + ALL = 1, + /** + * 部分提醒 + */ + PART = 2 +} +/** + * 提醒信息 + */ +export interface MentionedInfo { + type: MentionedType; + userIdList: string[]; + mentionedContent: string; +} +/** + * 消息内容 + */ +export interface MessageContent { + objectName?: ObjectName; + userInfo?: UserInfo; + mentionedInfo?: MentionedInfo; +} +/** + * 消息对象名称 + */ +export declare enum ObjectName { + /** + * 文本消息 + */ + Text = "RC:TxtMsg", + /** + * 文件消息 + */ + File = "RC:FileMsg", + /** + * 图片消息 + */ + Image = "RC:ImgMsg", + /** + * GIF 图片消息 + */ + GIF = "RC:GIFMsg", + /** + * 位置信息 + */ + Location = "RC:LBSMsg", + /** + * 语音消息 + */ + Voice = "RC:VcMsg", + /** + * 高质量语音消息 + */ + HQVoice = "RC:HQVCMsg", + /** + * 小视频消息 + */ + Sight = "RC:SightMsg", + /** + * 命令消息 + */ + Command = "RC:CmdMsg", + /** + * 公众服务单图文消息 + */ + PublicServiceRich = "RC:PSImgTxtMsg", + /** + * 公众服务多图文消息 + */ + PublicServiceMultiRich = "RC:PSMultiImgTxtMsg", + /** + * 好友通知消息 + */ + ContactNotification = "RC:ContactNtf", + /** + * 资料通知消息 + */ + ProfileNotification = "RC:ProfileNtf", + /** + * 通用命令通知消息 + */ + CommandNotification = "RC:CmdNtf", + /** + * 提示条通知消息 + */ + InformationNotification = "RC:InfoNtf", + /** + * 群组通知消息 + */ + GroupNotification = "RC:GrpNtf", + /** + * 已读通知消息 + */ + ReadReceipt = "RC:ReadNtf", + /** + * 公众服务命令消息 + */ + PublicServiceCommand = "RC:PSCmd", + /** + * 对方正在输入状态消息 + */ + TypingStatus = "RC:TypSts", + /** + * 群消息已读状态回执 + */ + ReadReceiptResponse = "RC:RRRspMsg" +} +/** + * 消息对象名称枚举 + */ +export declare enum MessageObjectNames { + text = "RC:TxtMsg", + image = "RC:ImgMsg", + file = "RC:FileMsg", + location = "RC:LocMsg", + voice = "RC:VcMsg" +} +/** + * 文本消息 + */ +export interface TextMessage extends MessageContent { + objectName: ObjectName.Text; + content: string; + extra?: string; +} +/** + * 图片消息 + */ +export interface ImageMessage extends MessageContent { + objectName: ObjectName.Image; + local: string; + remote?: string; + thumbnail?: string; + isFull?: string; + extra?: string; +} +/** + * GIF 图片消息 + */ +export interface GIFMessage extends MessageContent { + objectName: ObjectName.GIF; + local: string; + remote?: string; + width: number; + height: number; + gifDataSize: number; + extra?: string; +} +/** + * 文件消息 + */ +export interface FileMessage extends MessageContent { + objectName: ObjectName.File; + local: string; + remote?: string; + name?: string; + size?: number; + fileType?: string; + extra?: string; +} +/** + * 位置消息 + */ +export interface LocationMessage extends MessageContent { + objectName: ObjectName.Location; + name: string; + latitude: number; + longitude: number; + thumbnail?: string; + extra?: string; +} +/** + * 语音消息 + */ +export interface VoiceMessage extends MessageContent { + objectName: ObjectName.Voice; + data: string; + local: string; + duration: number; +} +/** + * 高质量语音消息 + */ +export interface HQVoiceMessage extends MessageContent { + objectName: ObjectName.HQVoice; + local: string; + remote?: string; + duration: number; +} +/** + * 命令消息 + */ +export interface CommandMessage extends MessageContent { + objectName: ObjectName.Command; + name: string; + data: string; +} +/** + * 命令通知消息 + */ +export interface CommandNotificationMessage extends MessageContent { + objectName: ObjectName.CommandNotification; + name: string; + data: string; +} +/** + * 好友通知消息 + */ +export interface ContactNotificationMessage extends MessageContent { + objectName: ObjectName.ContactNotification; + sourceUserId: string; + targetUserId: string; + message: string; + operation: string; + extra: string; +} +/** + * 资料通知消息 + */ +export interface ProfileNotificationMessage extends MessageContent { + objectName: ObjectName.ProfileNotification; + data: string; + operation: string; + extra: string; +} +/** + * 提示条通知消息 + */ +export interface InfomationNotificationMessage extends MessageContent { + objectName: ObjectName.InformationNotification; + message: string; + extra: string; +} +/** + * 群组通知消息 + */ +export interface GroupNotificationMessage extends MessageContent { + objectName: ObjectName.GroupNotification; + /** + * 群组通知的操作名称 + */ + operation: string; + /** + * 操作者 ID + */ + operatorUserId: string; + /** + * 操作数据 + */ + data: string; + /** + * 消息内容 + */ + message: string; + /** + * 额外数据 + */ + extra: string; +} +/** + * 已读通知消息 + */ +export interface ReadReceiptMessage extends MessageContent { + objectName: ObjectName.ReadReceipt; + type: number; + messageUId: string; + lastMessageSendTime: number; +} +/** + * 已读通知消息 + */ +export interface PublicServiceCommandMessage extends MessageContent { + objectName: ObjectName.PublicServiceCommand; + extra: string; +} +/** + * 撤回通知消息 + */ +export interface RecallNotificationMessage extends MessageContent { + /** + * 撤回消息的用户 ID + */ + operatorId: string; + /** + * 撤回时间 + */ + recallTime: number; + /** + * 原消息对象名称 + */ + originalObjectName: string; + /** + * 是否管理员操作 + */ + isAdmin: string; +} +/** + * 输入状态消息 + */ +export interface TypingStatusMessage extends MessageContent { + objectName: ObjectName.TypingStatus; + data: string; + typingContentType: string; +} +/** + * 消息 + */ +export interface Message { + /** + * 会话类型 + */ + conversationType: ConversationType; + /** + * 消息对象名称 + */ + objectName: string; + /** + * 消息 ID + */ + messageId: number; + /** + * 消息 UID + */ + messageUId: string; + /** + * 消息方向 + */ + messageDirection: MessageDirection; + /** + * 发送者 ID + */ + senderUserId: string; + /** + * 发送时间 + */ + sentTime: number; + /** + * 目标 ID + */ + targetId: string; + /** + * 消息接收时间 + */ + receivedTime: number; + /** + * 消息内容 + */ + content: MessageContent; + /** + * 附加信息 + */ + extra?: string; +} +/** + * 收到的消息 + */ +export interface ReceiveMessage { + /** + * 消息数据 + */ + message: Message; + /** + * 剩余未接收的消息数量 + */ + left: number; +} +/** + * 连接错误代码 + */ +export declare enum ConnectErrorCode { + RC_NET_CHANNEL_INVALID = 30001, + RC_NET_UNAVAILABLE = 30002, + RC_NAVI_REQUEST_FAIL = 30004, + RC_NAVI_RESPONSE_ERROR = 30007, + RC_NODE_NOT_FOUND = 30008, + RC_SOCKET_NOT_CONNECTED = 30010, + RC_SOCKET_DISCONNECTED = 30011, + RC_PING_SEND_FAIL = 30012, + RC_PONG_RECV_FAIL = 30013, + RC_MSG_SEND_FAIL = 30014, + RC_CONN_OVERFREQUENCY = 30015, + RC_CONN_ACK_TIMEOUT = 31000, + RC_CONN_PROTO_VERSION_ERROR = 31001, + RC_CONN_ID_REJECT = 31002, + RC_CONN_SERVER_UNAVAILABLE = 31003, + RC_CONN_TOKEN_INCORRECT = 31004, + RC_CONN_NOT_AUTHRORIZED = 31005, + RC_CONN_REDIRECTED = 31006, + RC_CONN_PACKAGE_NAME_INVALID = 31007, + RC_CONN_APP_BLOCKED_OR_DELETED = 31008, + RC_CONN_USER_BLOCKED = 31009, + RC_DISCONN_KICK = 31010, + RC_CONN_OTHER_DEVICE_LOGIN = 31023, + RC_CONN_REFUSED = 32061, + RC_CLIENT_NOT_INIT = 33001, + RC_INVALID_PARAMETER = 33003, + RC_CONNECTION_EXIST = 34001, + RC_BACKGROUND_CONNECT = 34002, + RC_INVALID_ARGUMENT = -1000 +} +/** + * 错误代码 + */ +export declare enum ErrorCode { + PARAMETER_ERROR = -3, + ERRORCODE_UNKNOWN = -1, + REJECTED_BY_BLACKLIST = 405, + ERRORCODE_TIMEOUT = 5004, + SEND_MSG_FREQUENCY_OVERRUN = 20604, + NOT_IN_DISCUSSION = 21406, + NOT_IN_GROUP = 22406, + FORBIDDEN_IN_GROUP = 22408, + NOT_IN_CHATROOM = 23406, + FORBIDDEN_IN_CHATROOM = 23408, + KICKED_FROM_CHATROOM = 23409, + CHATROOM_NOT_EXIST = 23410, + CHATROOM_IS_FULL = 23411, + PARAMETER_INVALID_CHATROOM = 23412, + ROAMING_SERVICE_UNAVAILABLE_CHATROOM = 23414, + CHANNEL_INVALID = 30001, + NETWORK_UNAVAILABLE = 30002, + MSG_RESPONSE_TIMEOUT = 30003, + CLIENT_NOT_INIT = 33001, + DATABASE_ERROR = 33002, + INVALID_PARAMETER = 33003, + MSG_ROAMING_SERVICE_UNAVAILABLE = 33007, + INVALID_PUBLIC_NUMBER = 29201, + MSG_SIZE_OUT_OF_LIMIT = 30016, + RECALLMESSAGE_PARAMETER_INVALID = 25101, + PUSHSETTING_PARAMETER_INVALID = 26001, + OPERATION_BLOCKED = 20605, + OPERATION_NOT_SUPPORT = 20606, + MSG_BLOCKED_SENSITIVE_WORD = 21501, + MSG_REPLACED_SENSITIVE_WORD = 21502, + SIGHT_MSG_DURATION_LIMIT_EXCEED = 34002 +} +/** + * iOS 连接状态 + */ +export declare enum ConnectionStatusIOS { + UNKNOWN = -1, + Connected = 0, + NETWORK_UNAVAILABLE = 1, + AIRPLANE_MODE = 2, + Cellular_2G = 3, + Cellular_3G_4G = 4, + WIFI = 5, + KICKED_OFFLINE_BY_OTHER_CLIENT = 6, + LOGIN_ON_WEB = 7, + SERVER_INVALID = 8, + VALIDATE_INVALID = 9, + Connecting = 10, + Unconnected = 11, + SignUp = 12, + TOKEN_INCORRECT = 31004, + DISCONN_EXCEPTION = 31011 +} +/** + * Android 连接状态 + */ +export declare enum ConnectionStatusAndroid { + NETWORK_UNAVAILABLE = -1, + CONNECTED = 0, + CONNECTING = 1, + DISCONNECTED = 2, + KICKED_OFFLINE_BY_OTHER_CLIENT = 3, + TOKEN_INCORRECT = 4, + SERVER_INVALID = 5 +} +/** + * 连接状态 + */ +export declare type ConnectionStatus = ConnectionStatusIOS | ConnectionStatusAndroid; +/** + * 要发送的消息 + */ +export interface SentMessage { + /** + * 会话类型 + */ + conversationType: ConversationType; + /** + * 目标 ID + */ + targetId: string; + /** + * 消息内容 + */ + content: MessageContent; + /** + * 推送内容,用于显示 + */ + pushContent: string; + /** + * 推送数据,不显示 + */ + pushData: string; +} +/** + * 会话信息 + */ +export interface Conversation { + conversationType: ConversationType; + conversationTitle: string; + isTop: boolean; + unreadMessageCount: number; + draft: string; + targetId: string; + objectName: string; + latestMessageId: number; + latestMessage: MessageContent; + receivedStatus: number; + receivedTime: number; + sentStatus: SentStatus; + senderUserId: string; + hasUnreadMentioned: boolean; + mentionedCount: number; +} +/** + * 搜索类型 + */ +export declare enum SearchType { + /** + * 精准 + */ + EXACT = 0, + /** + * 模糊 + */ + FUZZY = 1 +} +/** + * 公共服务类型 + */ +export declare enum PublicServiceType { + /** + * 应用公众服务 + */ + APP_PUBLIC_SERVICE = 7, + /** + * 公共服务号 + */ + PUBLIC_SERVICE = 8 +} +/** + * 公众服务菜单类型 + */ +export declare enum PublicServiceMenuItemType { + /** + * 作为分组包含子菜单的菜单 + */ + GROUP = 0, + /** + * 查看事件菜单 + */ + VIEW = 1, + /** + * 点击事件菜单 + */ + CLICK = 2 +} +/** + * 公众服务菜单项 + */ +export interface PublicServiceMenuItem { + /** + * 菜单项 ID + */ + id: string; + /** + * 菜单项名称 + */ + name: string; + /** + * 菜单项 URL + */ + url: string; + /** + * 菜单项类型 + */ + type: PublicServiceMenuItemType; +} +/** + * 公众服务描述 + */ +export interface PublicServiceProfile { + id: string; + /** + * 服务名称 + */ + name: string; + /** + * 服务描述 + */ + introduction: string; + /** + * 头像连接 + */ + portraitUrl: string; + /** + * 是否设置为所有用户均关注 + */ + isGlobal: boolean; + /** + * 用户是否已关注 + */ + followed: boolean; + /** + * 类型 + */ + type: PublicServiceType | ConversationType; + /** + * 菜单 + */ + menu: PublicServiceMenuItem[]; +} +/** + * 输入状态 + */ +export interface TypingStatus { + conversationType: ConversationType; + targetId: string; + userId: string; + sentTime: number; + typingContentType: string; +} +/** + * 消息回执请求信息 + */ +export interface ReceiptRequest { + conversationType: ConversationType; + targetId: string; + messageUId: string; +} +/** + * 消息回执响应信息 + */ +export interface ReceiptResponse { + conversationType: ConversationType; + targetId: string; + messageUId: string; + users: { + [key: string]: number; + }; +} +/** + * 搜索会话结果 + */ +export interface SearchConversationResult { + conversation: Conversation; + matchCount: number; +} +/** + * 时间戳排序方式 + */ +export declare enum TimestampOrder { + /** + * 按时间戳倒序排序 + */ + DESC = 0, + /** + * 按时间戳顺序排序 + */ + ASC = 1 +} +/** + * 聊天室成员排序,按加入时间 + */ +export declare enum ChatRoomMemberOrder { + /** + * 生序 + */ + ASC = 1, + /** + * 降序 + */ + DESC = 2 +} +/** + * 聊天室成员信息 + */ +export interface MemberInfo { + userId: string; + joinTime: number; +} +/** + * 聊天室信息 + */ +export interface ChatRoomInfo { + targetId: string; + memberOrder: ChatRoomMemberOrder; + totalMemberCount: number; + members: MemberInfo[]; +} +/** + * 讨论组 + */ +export interface Discussion { + id: string; + name: string; + creatorId: string; + memberIdList: string[]; + isOpen: boolean; +} +/** + * 实时位置共享状态 + */ +export declare enum RealTimeLocationStatus { + /** + * 初始状态 + */ + IDLE = 0, + /** + * 接收状态 + */ + INCOMING = 1, + /** + * 发起状态 + */ + OUTGOING = 2, + /** + * 已连接,正在共享的状态 + */ + CONNECTED = 3 +} +/** + * 客服信息 + */ +export interface CSInfo { + userId?: string; + nickName?: string; + loginName?: string; + name?: string; + grade?: string; + age?: string; + profession?: string; + portraitUrl?: string; + province?: string; + city?: string; + memo?: string; + mobileNo?: string; + email?: string; + address?: string; + QQ?: string; + weibo?: string; + weixin?: string; + page?: string; + referrer?: string; + enterUrl?: string; + skillId?: string; + listUrl?: string; + define?: string; + productId?: string; +} +/** + * 客服配置 + */ +export interface CSConfig { + isBlack: boolean; + companyName: string; + companyUrl: string; + companyIcon: string; + announceClickUrl: string; + announceMsg: string; + leaveMessageNativeInfo: CSLeaveMessageItem[]; + leaveMessageType: LeaveMessageType; + userTipTime: number; + userTipWord: string; + adminTipTime: number; + adminTipWord: string; + evaEntryPoint: CSEvaEntryPoint; + evaType: number; + robotSessionNoEva: boolean; + humanEvaluateItems: { + value: number; + description: string; + }[]; + isReportResolveStatus: boolean; + isDisableLocation: boolean; +} +/** + * 留言消息类型 + */ +export declare enum LeaveMessageType { + NATIVE = 0, + WEB = 1 +} +/** + * 客服问题解决状态 + */ +export declare enum CSResolveStatus { + UNRESOLVED = 0, + RESOLVED = 1, + RESOLVING = 2 +} +/** + * 客服评价时机 + */ +export declare enum CSEvaEntryPoint { + LEAVE = 0, + EXTENSION = 1, + NONE = 2, + END = 3 +} +/** + * 客服服务模式 + */ +export declare enum CSMode { + NO_SERVICE = 0, + ROBOT_ONLY = 1, + HUMAN_ONLY = 2, + ROBOT_FIRST = 3 +} +/** + * 客服留言 + */ +export interface CSLeaveMessageItem { + name?: string; + title?: string; + type?: string; + defaultText?: string; + required?: boolean; + message?: string; + verification?: string; + max?: number; +} +/** + * 客服分组信息 + */ +export interface CSGroupItem { + id: string; + name: string; + isOnline: boolean; +} +/** + * 推送语言 + */ +export declare enum PushLanguage { + EN_US = 1, + ZH_CN = 2 +} +/** + * 推送提醒消息 + */ +export interface PushNotificationMessage { + pushType: string; + pushId: string; + pushTitle: string; + pushFlag: string; + pushContent: string; + pushData: string; + objectName: string; + senderId: string; + senderName: string; + senderPortraitUrl: string; + targetId: string; + targetUserName: string; + conversationType: ConversationType; + extra: string; +} diff --git a/lib/js/types.js b/lib/js/types.js new file mode 100644 index 0000000..a2a09cb --- /dev/null +++ b/lib/js/types.js @@ -0,0 +1,398 @@ +"use strict"; +exports.__esModule = true; +exports.PushLanguage = exports.CSMode = exports.CSEvaEntryPoint = exports.CSResolveStatus = exports.LeaveMessageType = exports.RealTimeLocationStatus = exports.ChatRoomMemberOrder = exports.TimestampOrder = exports.PublicServiceMenuItemType = exports.PublicServiceType = exports.SearchType = exports.ConnectionStatusAndroid = exports.ConnectionStatusIOS = exports.ErrorCode = exports.ConnectErrorCode = exports.MessageObjectNames = exports.ObjectName = exports.MentionedType = exports.SentStatus = exports.ConversationType = exports.MessageDirection = void 0; +/** + * 消息方向 + */ +var MessageDirection; +(function (MessageDirection) { + MessageDirection[MessageDirection["SEND"] = 1] = "SEND"; + MessageDirection[MessageDirection["RECEIVE"] = 2] = "RECEIVE"; +})(MessageDirection = exports.MessageDirection || (exports.MessageDirection = {})); +/** + * 会话类型 + */ +var ConversationType; +(function (ConversationType) { + ConversationType[ConversationType["PRIVATE"] = 1] = "PRIVATE"; + ConversationType[ConversationType["DISCUSSION"] = 2] = "DISCUSSION"; + ConversationType[ConversationType["GROUP"] = 3] = "GROUP"; + ConversationType[ConversationType["CHATROOM"] = 4] = "CHATROOM"; + ConversationType[ConversationType["CUSTOMER_SERVICE"] = 5] = "CUSTOMER_SERVICE"; + ConversationType[ConversationType["SYSTEM"] = 6] = "SYSTEM"; + ConversationType[ConversationType["APP_SERVICE"] = 7] = "APP_SERVICE"; + ConversationType[ConversationType["PUBLIC_SERVICE"] = 8] = "PUBLIC_SERVICE"; + ConversationType[ConversationType["PUSH_SERVICE"] = 9] = "PUSH_SERVICE"; +})(ConversationType = exports.ConversationType || (exports.ConversationType = {})); +/** + * 发送状态 + */ +var SentStatus; +(function (SentStatus) { + SentStatus[SentStatus["SENDING"] = 10] = "SENDING"; + SentStatus[SentStatus["FAILED"] = 20] = "FAILED"; + SentStatus[SentStatus["SENT"] = 30] = "SENT"; + SentStatus[SentStatus["RECEIVED"] = 40] = "RECEIVED"; + SentStatus[SentStatus["READ"] = 50] = "READ"; + SentStatus[SentStatus["DESTROYED"] = 60] = "DESTROYED"; + SentStatus[SentStatus["CANCELED"] = 70] = "CANCELED"; +})(SentStatus = exports.SentStatus || (exports.SentStatus = {})); +/** + * 消息提醒类型 + */ +var MentionedType; +(function (MentionedType) { + /** + * 提醒所有 + */ + MentionedType[MentionedType["ALL"] = 1] = "ALL"; + /** + * 部分提醒 + */ + MentionedType[MentionedType["PART"] = 2] = "PART"; +})(MentionedType = exports.MentionedType || (exports.MentionedType = {})); +/** + * 消息对象名称 + */ +var ObjectName; +(function (ObjectName) { + /** + * 文本消息 + */ + ObjectName["Text"] = "RC:TxtMsg"; + /** + * 文件消息 + */ + ObjectName["File"] = "RC:FileMsg"; + /** + * 图片消息 + */ + ObjectName["Image"] = "RC:ImgMsg"; + /** + * GIF 图片消息 + */ + ObjectName["GIF"] = "RC:GIFMsg"; + /** + * 位置信息 + */ + ObjectName["Location"] = "RC:LBSMsg"; + /** + * 语音消息 + */ + ObjectName["Voice"] = "RC:VcMsg"; + /** + * 高质量语音消息 + */ + ObjectName["HQVoice"] = "RC:HQVCMsg"; + /** + * 小视频消息 + */ + ObjectName["Sight"] = "RC:SightMsg"; + /** + * 命令消息 + */ + ObjectName["Command"] = "RC:CmdMsg"; + /** + * 公众服务单图文消息 + */ + ObjectName["PublicServiceRich"] = "RC:PSImgTxtMsg"; + /** + * 公众服务多图文消息 + */ + ObjectName["PublicServiceMultiRich"] = "RC:PSMultiImgTxtMsg"; + /** + * 好友通知消息 + */ + ObjectName["ContactNotification"] = "RC:ContactNtf"; + /** + * 资料通知消息 + */ + ObjectName["ProfileNotification"] = "RC:ProfileNtf"; + /** + * 通用命令通知消息 + */ + ObjectName["CommandNotification"] = "RC:CmdNtf"; + /** + * 提示条通知消息 + */ + ObjectName["InformationNotification"] = "RC:InfoNtf"; + /** + * 群组通知消息 + */ + ObjectName["GroupNotification"] = "RC:GrpNtf"; + /** + * 已读通知消息 + */ + ObjectName["ReadReceipt"] = "RC:ReadNtf"; + /** + * 公众服务命令消息 + */ + ObjectName["PublicServiceCommand"] = "RC:PSCmd"; + /** + * 对方正在输入状态消息 + */ + ObjectName["TypingStatus"] = "RC:TypSts"; + /** + * 群消息已读状态回执 + */ + ObjectName["ReadReceiptResponse"] = "RC:RRRspMsg"; +})(ObjectName = exports.ObjectName || (exports.ObjectName = {})); +/** + * 消息对象名称枚举 + */ +var MessageObjectNames; +(function (MessageObjectNames) { + MessageObjectNames["text"] = "RC:TxtMsg"; + MessageObjectNames["image"] = "RC:ImgMsg"; + MessageObjectNames["file"] = "RC:FileMsg"; + MessageObjectNames["location"] = "RC:LocMsg"; + MessageObjectNames["voice"] = "RC:VcMsg"; +})(MessageObjectNames = exports.MessageObjectNames || (exports.MessageObjectNames = {})); +/** + * 连接错误代码 + */ +var ConnectErrorCode; +(function (ConnectErrorCode) { + ConnectErrorCode[ConnectErrorCode["RC_NET_CHANNEL_INVALID"] = 30001] = "RC_NET_CHANNEL_INVALID"; + ConnectErrorCode[ConnectErrorCode["RC_NET_UNAVAILABLE"] = 30002] = "RC_NET_UNAVAILABLE"; + ConnectErrorCode[ConnectErrorCode["RC_NAVI_REQUEST_FAIL"] = 30004] = "RC_NAVI_REQUEST_FAIL"; + ConnectErrorCode[ConnectErrorCode["RC_NAVI_RESPONSE_ERROR"] = 30007] = "RC_NAVI_RESPONSE_ERROR"; + ConnectErrorCode[ConnectErrorCode["RC_NODE_NOT_FOUND"] = 30008] = "RC_NODE_NOT_FOUND"; + ConnectErrorCode[ConnectErrorCode["RC_SOCKET_NOT_CONNECTED"] = 30010] = "RC_SOCKET_NOT_CONNECTED"; + ConnectErrorCode[ConnectErrorCode["RC_SOCKET_DISCONNECTED"] = 30011] = "RC_SOCKET_DISCONNECTED"; + ConnectErrorCode[ConnectErrorCode["RC_PING_SEND_FAIL"] = 30012] = "RC_PING_SEND_FAIL"; + ConnectErrorCode[ConnectErrorCode["RC_PONG_RECV_FAIL"] = 30013] = "RC_PONG_RECV_FAIL"; + ConnectErrorCode[ConnectErrorCode["RC_MSG_SEND_FAIL"] = 30014] = "RC_MSG_SEND_FAIL"; + ConnectErrorCode[ConnectErrorCode["RC_CONN_OVERFREQUENCY"] = 30015] = "RC_CONN_OVERFREQUENCY"; + ConnectErrorCode[ConnectErrorCode["RC_CONN_ACK_TIMEOUT"] = 31000] = "RC_CONN_ACK_TIMEOUT"; + ConnectErrorCode[ConnectErrorCode["RC_CONN_PROTO_VERSION_ERROR"] = 31001] = "RC_CONN_PROTO_VERSION_ERROR"; + ConnectErrorCode[ConnectErrorCode["RC_CONN_ID_REJECT"] = 31002] = "RC_CONN_ID_REJECT"; + ConnectErrorCode[ConnectErrorCode["RC_CONN_SERVER_UNAVAILABLE"] = 31003] = "RC_CONN_SERVER_UNAVAILABLE"; + ConnectErrorCode[ConnectErrorCode["RC_CONN_TOKEN_INCORRECT"] = 31004] = "RC_CONN_TOKEN_INCORRECT"; + ConnectErrorCode[ConnectErrorCode["RC_CONN_NOT_AUTHRORIZED"] = 31005] = "RC_CONN_NOT_AUTHRORIZED"; + ConnectErrorCode[ConnectErrorCode["RC_CONN_REDIRECTED"] = 31006] = "RC_CONN_REDIRECTED"; + ConnectErrorCode[ConnectErrorCode["RC_CONN_PACKAGE_NAME_INVALID"] = 31007] = "RC_CONN_PACKAGE_NAME_INVALID"; + ConnectErrorCode[ConnectErrorCode["RC_CONN_APP_BLOCKED_OR_DELETED"] = 31008] = "RC_CONN_APP_BLOCKED_OR_DELETED"; + ConnectErrorCode[ConnectErrorCode["RC_CONN_USER_BLOCKED"] = 31009] = "RC_CONN_USER_BLOCKED"; + ConnectErrorCode[ConnectErrorCode["RC_DISCONN_KICK"] = 31010] = "RC_DISCONN_KICK"; + ConnectErrorCode[ConnectErrorCode["RC_CONN_OTHER_DEVICE_LOGIN"] = 31023] = "RC_CONN_OTHER_DEVICE_LOGIN"; + ConnectErrorCode[ConnectErrorCode["RC_CONN_REFUSED"] = 32061] = "RC_CONN_REFUSED"; + ConnectErrorCode[ConnectErrorCode["RC_CLIENT_NOT_INIT"] = 33001] = "RC_CLIENT_NOT_INIT"; + ConnectErrorCode[ConnectErrorCode["RC_INVALID_PARAMETER"] = 33003] = "RC_INVALID_PARAMETER"; + ConnectErrorCode[ConnectErrorCode["RC_CONNECTION_EXIST"] = 34001] = "RC_CONNECTION_EXIST"; + ConnectErrorCode[ConnectErrorCode["RC_BACKGROUND_CONNECT"] = 34002] = "RC_BACKGROUND_CONNECT"; + ConnectErrorCode[ConnectErrorCode["RC_INVALID_ARGUMENT"] = -1000] = "RC_INVALID_ARGUMENT"; +})(ConnectErrorCode = exports.ConnectErrorCode || (exports.ConnectErrorCode = {})); +/** + * 错误代码 + */ +var ErrorCode; +(function (ErrorCode) { + ErrorCode[ErrorCode["PARAMETER_ERROR"] = -3] = "PARAMETER_ERROR"; + ErrorCode[ErrorCode["ERRORCODE_UNKNOWN"] = -1] = "ERRORCODE_UNKNOWN"; + ErrorCode[ErrorCode["REJECTED_BY_BLACKLIST"] = 405] = "REJECTED_BY_BLACKLIST"; + ErrorCode[ErrorCode["ERRORCODE_TIMEOUT"] = 5004] = "ERRORCODE_TIMEOUT"; + ErrorCode[ErrorCode["SEND_MSG_FREQUENCY_OVERRUN"] = 20604] = "SEND_MSG_FREQUENCY_OVERRUN"; + ErrorCode[ErrorCode["NOT_IN_DISCUSSION"] = 21406] = "NOT_IN_DISCUSSION"; + ErrorCode[ErrorCode["NOT_IN_GROUP"] = 22406] = "NOT_IN_GROUP"; + ErrorCode[ErrorCode["FORBIDDEN_IN_GROUP"] = 22408] = "FORBIDDEN_IN_GROUP"; + ErrorCode[ErrorCode["NOT_IN_CHATROOM"] = 23406] = "NOT_IN_CHATROOM"; + ErrorCode[ErrorCode["FORBIDDEN_IN_CHATROOM"] = 23408] = "FORBIDDEN_IN_CHATROOM"; + ErrorCode[ErrorCode["KICKED_FROM_CHATROOM"] = 23409] = "KICKED_FROM_CHATROOM"; + ErrorCode[ErrorCode["CHATROOM_NOT_EXIST"] = 23410] = "CHATROOM_NOT_EXIST"; + ErrorCode[ErrorCode["CHATROOM_IS_FULL"] = 23411] = "CHATROOM_IS_FULL"; + ErrorCode[ErrorCode["PARAMETER_INVALID_CHATROOM"] = 23412] = "PARAMETER_INVALID_CHATROOM"; + ErrorCode[ErrorCode["ROAMING_SERVICE_UNAVAILABLE_CHATROOM"] = 23414] = "ROAMING_SERVICE_UNAVAILABLE_CHATROOM"; + ErrorCode[ErrorCode["CHANNEL_INVALID"] = 30001] = "CHANNEL_INVALID"; + ErrorCode[ErrorCode["NETWORK_UNAVAILABLE"] = 30002] = "NETWORK_UNAVAILABLE"; + ErrorCode[ErrorCode["MSG_RESPONSE_TIMEOUT"] = 30003] = "MSG_RESPONSE_TIMEOUT"; + ErrorCode[ErrorCode["CLIENT_NOT_INIT"] = 33001] = "CLIENT_NOT_INIT"; + ErrorCode[ErrorCode["DATABASE_ERROR"] = 33002] = "DATABASE_ERROR"; + ErrorCode[ErrorCode["INVALID_PARAMETER"] = 33003] = "INVALID_PARAMETER"; + ErrorCode[ErrorCode["MSG_ROAMING_SERVICE_UNAVAILABLE"] = 33007] = "MSG_ROAMING_SERVICE_UNAVAILABLE"; + ErrorCode[ErrorCode["INVALID_PUBLIC_NUMBER"] = 29201] = "INVALID_PUBLIC_NUMBER"; + ErrorCode[ErrorCode["MSG_SIZE_OUT_OF_LIMIT"] = 30016] = "MSG_SIZE_OUT_OF_LIMIT"; + ErrorCode[ErrorCode["RECALLMESSAGE_PARAMETER_INVALID"] = 25101] = "RECALLMESSAGE_PARAMETER_INVALID"; + ErrorCode[ErrorCode["PUSHSETTING_PARAMETER_INVALID"] = 26001] = "PUSHSETTING_PARAMETER_INVALID"; + ErrorCode[ErrorCode["OPERATION_BLOCKED"] = 20605] = "OPERATION_BLOCKED"; + ErrorCode[ErrorCode["OPERATION_NOT_SUPPORT"] = 20606] = "OPERATION_NOT_SUPPORT"; + ErrorCode[ErrorCode["MSG_BLOCKED_SENSITIVE_WORD"] = 21501] = "MSG_BLOCKED_SENSITIVE_WORD"; + ErrorCode[ErrorCode["MSG_REPLACED_SENSITIVE_WORD"] = 21502] = "MSG_REPLACED_SENSITIVE_WORD"; + ErrorCode[ErrorCode["SIGHT_MSG_DURATION_LIMIT_EXCEED"] = 34002] = "SIGHT_MSG_DURATION_LIMIT_EXCEED"; +})(ErrorCode = exports.ErrorCode || (exports.ErrorCode = {})); +/** + * iOS 连接状态 + */ +var ConnectionStatusIOS; +(function (ConnectionStatusIOS) { + ConnectionStatusIOS[ConnectionStatusIOS["UNKNOWN"] = -1] = "UNKNOWN"; + ConnectionStatusIOS[ConnectionStatusIOS["Connected"] = 0] = "Connected"; + ConnectionStatusIOS[ConnectionStatusIOS["NETWORK_UNAVAILABLE"] = 1] = "NETWORK_UNAVAILABLE"; + ConnectionStatusIOS[ConnectionStatusIOS["AIRPLANE_MODE"] = 2] = "AIRPLANE_MODE"; + ConnectionStatusIOS[ConnectionStatusIOS["Cellular_2G"] = 3] = "Cellular_2G"; + ConnectionStatusIOS[ConnectionStatusIOS["Cellular_3G_4G"] = 4] = "Cellular_3G_4G"; + ConnectionStatusIOS[ConnectionStatusIOS["WIFI"] = 5] = "WIFI"; + ConnectionStatusIOS[ConnectionStatusIOS["KICKED_OFFLINE_BY_OTHER_CLIENT"] = 6] = "KICKED_OFFLINE_BY_OTHER_CLIENT"; + ConnectionStatusIOS[ConnectionStatusIOS["LOGIN_ON_WEB"] = 7] = "LOGIN_ON_WEB"; + ConnectionStatusIOS[ConnectionStatusIOS["SERVER_INVALID"] = 8] = "SERVER_INVALID"; + ConnectionStatusIOS[ConnectionStatusIOS["VALIDATE_INVALID"] = 9] = "VALIDATE_INVALID"; + ConnectionStatusIOS[ConnectionStatusIOS["Connecting"] = 10] = "Connecting"; + ConnectionStatusIOS[ConnectionStatusIOS["Unconnected"] = 11] = "Unconnected"; + ConnectionStatusIOS[ConnectionStatusIOS["SignUp"] = 12] = "SignUp"; + ConnectionStatusIOS[ConnectionStatusIOS["TOKEN_INCORRECT"] = 31004] = "TOKEN_INCORRECT"; + ConnectionStatusIOS[ConnectionStatusIOS["DISCONN_EXCEPTION"] = 31011] = "DISCONN_EXCEPTION"; +})(ConnectionStatusIOS = exports.ConnectionStatusIOS || (exports.ConnectionStatusIOS = {})); +/** + * Android 连接状态 + */ +var ConnectionStatusAndroid; +(function (ConnectionStatusAndroid) { + ConnectionStatusAndroid[ConnectionStatusAndroid["NETWORK_UNAVAILABLE"] = -1] = "NETWORK_UNAVAILABLE"; + ConnectionStatusAndroid[ConnectionStatusAndroid["CONNECTED"] = 0] = "CONNECTED"; + ConnectionStatusAndroid[ConnectionStatusAndroid["CONNECTING"] = 1] = "CONNECTING"; + ConnectionStatusAndroid[ConnectionStatusAndroid["DISCONNECTED"] = 2] = "DISCONNECTED"; + ConnectionStatusAndroid[ConnectionStatusAndroid["KICKED_OFFLINE_BY_OTHER_CLIENT"] = 3] = "KICKED_OFFLINE_BY_OTHER_CLIENT"; + ConnectionStatusAndroid[ConnectionStatusAndroid["TOKEN_INCORRECT"] = 4] = "TOKEN_INCORRECT"; + ConnectionStatusAndroid[ConnectionStatusAndroid["SERVER_INVALID"] = 5] = "SERVER_INVALID"; +})(ConnectionStatusAndroid = exports.ConnectionStatusAndroid || (exports.ConnectionStatusAndroid = {})); +/** + * 搜索类型 + */ +var SearchType; +(function (SearchType) { + /** + * 精准 + */ + SearchType[SearchType["EXACT"] = 0] = "EXACT"; + /** + * 模糊 + */ + SearchType[SearchType["FUZZY"] = 1] = "FUZZY"; +})(SearchType = exports.SearchType || (exports.SearchType = {})); +/** + * 公共服务类型 + */ +var PublicServiceType; +(function (PublicServiceType) { + /** + * 应用公众服务 + */ + PublicServiceType[PublicServiceType["APP_PUBLIC_SERVICE"] = 7] = "APP_PUBLIC_SERVICE"; + /** + * 公共服务号 + */ + PublicServiceType[PublicServiceType["PUBLIC_SERVICE"] = 8] = "PUBLIC_SERVICE"; +})(PublicServiceType = exports.PublicServiceType || (exports.PublicServiceType = {})); +/** + * 公众服务菜单类型 + */ +var PublicServiceMenuItemType; +(function (PublicServiceMenuItemType) { + /** + * 作为分组包含子菜单的菜单 + */ + PublicServiceMenuItemType[PublicServiceMenuItemType["GROUP"] = 0] = "GROUP"; + /** + * 查看事件菜单 + */ + PublicServiceMenuItemType[PublicServiceMenuItemType["VIEW"] = 1] = "VIEW"; + /** + * 点击事件菜单 + */ + PublicServiceMenuItemType[PublicServiceMenuItemType["CLICK"] = 2] = "CLICK"; +})(PublicServiceMenuItemType = exports.PublicServiceMenuItemType || (exports.PublicServiceMenuItemType = {})); +/** + * 时间戳排序方式 + */ +var TimestampOrder; +(function (TimestampOrder) { + /** + * 按时间戳倒序排序 + */ + TimestampOrder[TimestampOrder["DESC"] = 0] = "DESC"; + /** + * 按时间戳顺序排序 + */ + TimestampOrder[TimestampOrder["ASC"] = 1] = "ASC"; +})(TimestampOrder = exports.TimestampOrder || (exports.TimestampOrder = {})); +/** + * 聊天室成员排序,按加入时间 + */ +var ChatRoomMemberOrder; +(function (ChatRoomMemberOrder) { + /** + * 生序 + */ + ChatRoomMemberOrder[ChatRoomMemberOrder["ASC"] = 1] = "ASC"; + /** + * 降序 + */ + ChatRoomMemberOrder[ChatRoomMemberOrder["DESC"] = 2] = "DESC"; +})(ChatRoomMemberOrder = exports.ChatRoomMemberOrder || (exports.ChatRoomMemberOrder = {})); +/** + * 实时位置共享状态 + */ +var RealTimeLocationStatus; +(function (RealTimeLocationStatus) { + /** + * 初始状态 + */ + RealTimeLocationStatus[RealTimeLocationStatus["IDLE"] = 0] = "IDLE"; + /** + * 接收状态 + */ + RealTimeLocationStatus[RealTimeLocationStatus["INCOMING"] = 1] = "INCOMING"; + /** + * 发起状态 + */ + RealTimeLocationStatus[RealTimeLocationStatus["OUTGOING"] = 2] = "OUTGOING"; + /** + * 已连接,正在共享的状态 + */ + RealTimeLocationStatus[RealTimeLocationStatus["CONNECTED"] = 3] = "CONNECTED"; +})(RealTimeLocationStatus = exports.RealTimeLocationStatus || (exports.RealTimeLocationStatus = {})); +/** + * 留言消息类型 + */ +var LeaveMessageType; +(function (LeaveMessageType) { + LeaveMessageType[LeaveMessageType["NATIVE"] = 0] = "NATIVE"; + LeaveMessageType[LeaveMessageType["WEB"] = 1] = "WEB"; +})(LeaveMessageType = exports.LeaveMessageType || (exports.LeaveMessageType = {})); +/** + * 客服问题解决状态 + */ +var CSResolveStatus; +(function (CSResolveStatus) { + CSResolveStatus[CSResolveStatus["UNRESOLVED"] = 0] = "UNRESOLVED"; + CSResolveStatus[CSResolveStatus["RESOLVED"] = 1] = "RESOLVED"; + CSResolveStatus[CSResolveStatus["RESOLVING"] = 2] = "RESOLVING"; +})(CSResolveStatus = exports.CSResolveStatus || (exports.CSResolveStatus = {})); +/** + * 客服评价时机 + */ +var CSEvaEntryPoint; +(function (CSEvaEntryPoint) { + CSEvaEntryPoint[CSEvaEntryPoint["LEAVE"] = 0] = "LEAVE"; + CSEvaEntryPoint[CSEvaEntryPoint["EXTENSION"] = 1] = "EXTENSION"; + CSEvaEntryPoint[CSEvaEntryPoint["NONE"] = 2] = "NONE"; + CSEvaEntryPoint[CSEvaEntryPoint["END"] = 3] = "END"; +})(CSEvaEntryPoint = exports.CSEvaEntryPoint || (exports.CSEvaEntryPoint = {})); +/** + * 客服服务模式 + */ +var CSMode; +(function (CSMode) { + CSMode[CSMode["NO_SERVICE"] = 0] = "NO_SERVICE"; + CSMode[CSMode["ROBOT_ONLY"] = 1] = "ROBOT_ONLY"; + CSMode[CSMode["HUMAN_ONLY"] = 2] = "HUMAN_ONLY"; + CSMode[CSMode["ROBOT_FIRST"] = 3] = "ROBOT_FIRST"; +})(CSMode = exports.CSMode || (exports.CSMode = {})); +/** + * 推送语言 + */ +var PushLanguage; +(function (PushLanguage) { + PushLanguage[PushLanguage["EN_US"] = 1] = "EN_US"; + PushLanguage[PushLanguage["ZH_CN"] = 2] = "ZH_CN"; +})(PushLanguage = exports.PushLanguage || (exports.PushLanguage = {})); From b69dfeaa982057fdbe0237f888fafa48fccd9f47 Mon Sep 17 00:00:00 2001 From: Alex Lee Date: Mon, 13 Sep 2021 17:55:47 +0800 Subject: [PATCH 2/6] fix #66 --- lib/android/src/main/AndroidManifest.xml | 2 +- package.json | 3 ++- react-native.config.js | 8 +++++++- 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/lib/android/src/main/AndroidManifest.xml b/lib/android/src/main/AndroidManifest.xml index 7704afb..aa78ea6 100644 --- a/lib/android/src/main/AndroidManifest.xml +++ b/lib/android/src/main/AndroidManifest.xml @@ -1,6 +1,6 @@ + package="cn.rongcloud.imlib.react"> diff --git a/package.json b/package.json index 3919f8b..931d8a0 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "rongcloud-react-native-imlib", "description": "React Native RongCloud IMLib", - "version": "0.3.12", + "version": "0.3.13", "license": "MIT", "main": "lib/js", "author": { @@ -15,6 +15,7 @@ "lib/android/src", "lib/android/libs", "lib/android/build.gradle", + "react-native.config.js", "rongcloud-react-native-imlib.podspec" ], "repository": { diff --git a/react-native.config.js b/react-native.config.js index e7d777d..1629645 100644 --- a/react-native.config.js +++ b/react-native.config.js @@ -1 +1,7 @@ -module.exports = { project: { android: { sourceDir: "lib/android" } } }; +module.exports = { + dependency: { + platforms: { + android: { sourceDir: "lib/android" }, + }, + }, +}; From a983a39f41533aba09c388990e7200160e17d0d5 Mon Sep 17 00:00:00 2001 From: Alex Lee Date: Tue, 14 Sep 2021 10:19:03 +0800 Subject: [PATCH 3/6] fix NullPointerException crush --- .../java/cn/rongcloud/imlib/react/RCIMClientModule.java | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/lib/android/src/main/java/cn/rongcloud/imlib/react/RCIMClientModule.java b/lib/android/src/main/java/cn/rongcloud/imlib/react/RCIMClientModule.java index e09dde6..1bac2fb 100644 --- a/lib/android/src/main/java/cn/rongcloud/imlib/react/RCIMClientModule.java +++ b/lib/android/src/main/java/cn/rongcloud/imlib/react/RCIMClientModule.java @@ -58,7 +58,9 @@ public boolean onReceived(Message message, int left) { RongIMClient.setConnectionStatusListener(new ConnectionStatusListener() { @Override public void onChanged(ConnectionStatus status) { - eventEmitter.emit("rcimlib-connection-status", status.getValue()); + if (status != null) { + eventEmitter.emit("rcimlib-connection-status", status.getValue()); + } } }); @@ -117,7 +119,9 @@ public void onMessageReceiptResponse(ConversationType conversationType, String t RongIMClient.setRCLogInfoListener(new RCLogInfoListener() { @Override public void onRCLogInfoOccurred(String log) { - eventEmitter.emit("rcimlib-log", log); + if (log != null) { + eventEmitter.emit("rcimlib-log", log); + } } }); From 992b5c52aea18f231995de880796db22ab93b862 Mon Sep 17 00:00:00 2001 From: Alex Lee Date: Tue, 14 Sep 2021 11:25:31 +0800 Subject: [PATCH 4/6] fix NullPointerException crush --- .../rongcloud/imlib/react/RCIMClientModule.java | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/lib/android/src/main/java/cn/rongcloud/imlib/react/RCIMClientModule.java b/lib/android/src/main/java/cn/rongcloud/imlib/react/RCIMClientModule.java index 1bac2fb..f2c59fd 100644 --- a/lib/android/src/main/java/cn/rongcloud/imlib/react/RCIMClientModule.java +++ b/lib/android/src/main/java/cn/rongcloud/imlib/react/RCIMClientModule.java @@ -116,14 +116,14 @@ public void onMessageReceiptResponse(ConversationType conversationType, String t } }); - RongIMClient.setRCLogInfoListener(new RCLogInfoListener() { - @Override - public void onRCLogInfoOccurred(String log) { - if (log != null) { - eventEmitter.emit("rcimlib-log", log); - } - } - }); + // RongIMClient.setRCLogInfoListener(new RCLogInfoListener() { + // @Override + // public void onRCLogInfoOccurred(String log) { + // if (log != null) { + // eventEmitter.emit("rcimlib-log", log); + // } + // } + // }); RongIMClient.setOnRecallMessageListener(new OnRecallMessageListener() { @Override From 22766d8527e1f04021bfdecacdd77447a1b1ce4f Mon Sep 17 00:00:00 2001 From: Alex Lee Date: Thu, 2 Dec 2021 11:52:31 +0800 Subject: [PATCH 5/6] =?UTF-8?q?=E5=AE=89=E5=8D=93=20SDK=20=E5=8D=87?= =?UTF-8?q?=E7=BA=A7=E5=88=B0=20v5.1.3.6=EF=BC=8C=E8=A7=A3=E5=86=B3?= =?UTF-8?q?=E5=AE=89=E5=8D=93=E9=94=99=E8=AF=AF=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 您的应用中存在不安全的加密模式:io.rongimlib.httpdns.Ronghttpdnsutil->encode --- lib/android/build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/android/build.gradle b/lib/android/build.gradle index 0023ce9..14872d1 100644 --- a/lib/android/build.gradle +++ b/lib/android/build.gradle @@ -60,5 +60,5 @@ dependencies { implementation 'com.facebook.react:react-native:+' //api fileTree(dir: 'libs', include: ['*.jar','*.aar']) implementation 'com.google.code.gson:gson:2.8.1' - api 'cn.rongcloud.sdk:im_lib:5.1.3' + api 'cn.rongcloud.sdk:im_lib:5.1.3.6' } From 96292d37c5dbc75506185a76874a439276aae338 Mon Sep 17 00:00:00 2001 From: Alex Lee Date: Mon, 28 Feb 2022 17:03:02 +0800 Subject: [PATCH 6/6] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=20im=5Flib=20sdk=205.1.3?= =?UTF-8?q?.6=20=E4=B8=8B=E8=BD=BD=E4=B8=8D=E4=BA=86=E7=9A=84=E9=97=AE?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/android/build.gradle | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/android/build.gradle b/lib/android/build.gradle index 14872d1..3788260 100644 --- a/lib/android/build.gradle +++ b/lib/android/build.gradle @@ -51,6 +51,7 @@ android { google() jcenter() maven { url 'https://jitpack.io' } + maven { url "http://maven.rongcloud.cn/repository/maven-releases/" } } } @@ -60,5 +61,5 @@ dependencies { implementation 'com.facebook.react:react-native:+' //api fileTree(dir: 'libs', include: ['*.jar','*.aar']) implementation 'com.google.code.gson:gson:2.8.1' - api 'cn.rongcloud.sdk:im_lib:5.1.3.6' + api 'cn.rongcloud.sdk:im_lib:5.1.3' }