import { NativeModules } from 'react-native'; import type { Errors, ZoomVideoSDKChatPrivilegeType } from '../native/ZoomVideoSdk'; const { RNZoomVideoSdkChatHelper } = NativeModules; /** * A class to operate the instant message in session. */ export type ZoomVideoSdkChatHelperType = { /** * Call this method to send a chat message to a specific user. */ sendChatToUser: (userId: string, message: string) => Promise; /** * Call this method to send a chat message to all users. */ sendChatToAll: (message: string) => Promise; /** * Call this method to delete a specific chat message from the Zoom server. */ deleteChatMessage: (msgId: string) => Promise; /** * Determine if a specific message can be deleted. */ canChatMessageBeDeleted: (msgId: string) => Promise; /** * Change the privilege of the user's ability to send messages. */ changeChatPrivilege: (privilege: ZoomVideoSDKChatPrivilegeType) => Promise }; export class ZoomVideoSdkChatHelper implements ZoomVideoSdkChatHelperType { isChatDisabled = RNZoomVideoSdkChatHelper.isChatDisabled; isPrivateChatDisabled = RNZoomVideoSdkChatHelper.isPrivateChatDisabled; async sendChatToUser(userId: string, message: string) { return await RNZoomVideoSdkChatHelper.sendChatToUser(userId, message); } async sendChatToAll(message: string) { return await RNZoomVideoSdkChatHelper.sendChatToAll(message); } async deleteChatMessage(msgId: string) { if (msgId == null) { return; } return await RNZoomVideoSdkChatHelper.deleteChatMessage(msgId); } async canChatMessageBeDeleted(msgId: string) { if (msgId == null) { return; } return await RNZoomVideoSdkChatHelper.canChatMessageBeDeleted(msgId); } async changeChatPrivilege(privilege: ZoomVideoSDKChatPrivilegeType) { if (privilege == null) { return; } return await RNZoomVideoSdkChatHelper.changeChatPrivilege(privilege.toString()); } }