import { NativeModules } from 'react-native'; import type { Errors } from './ZoomVideoSdk'; const { RNZoomVideoSdkSubSession } = NativeModules; /** * Sub-session kit parameters. */ export type SubSessionKit = { subSessionName: string; subSessionID: string; subSessionUserList: SubSessionUser[]; }; /** * Sub-session user parameters. */ export type SubSessionUser = { userName: string; userGUID: string; }; /** * User help request result. */ export enum UserHelpRequestResult { Idle = 'Idle', Busy = 'Busy', Ignore = 'Ignore', HostAlreadyInSubSession = 'HostAlreadyInSubSession', } /** * Sub-session status. */ export enum SubSessionStatus { None = 'None', Committed = 'Committed', Withdrawn = 'Withdrawn', Started = 'Started', Stopping = 'Stopping', CommitFailed = 'CommitFailed', WithdrawFailed = 'WithdrawFailed', StartFailed = 'StartFailed', StopFailed = 'StopFailed', } /** * A class to operate the sub-session actions. */ export type ZoomVideoSdkSubSessionType = { /** * Join a sub-session by sub-session ID. */ joinSubSession: (subSessionID: string) => Promise; /** * Start a sub-session. */ startSubSession: () => Promise; /** * Stop a sub-session, after calling stopSubSession, there will be a buffer period for the * participants in the sub-session to exit. Once the buffer period ends, the sub-session will be * closed. */ stopSubSession: () => Promise; /** * Check if sub-session is started. */ isSubSessionStarted: () => Promise; /** * Broadcast message to all sub-sessions. * Only host and manger can call this function. */ broadcastMessage: (message: string) => Promise; /** * Return to main session from sub-session. */ returnToMainSession: () => Promise; /** * Request for help from sub-session. * Only attendee can call this function. */ requestForHelp: () => Promise; /** * Get request user name. */ getRequestUserName: () => Promise; /** * Get request sub-session name. * When attendee request for help from sub-session, the manager can call this function to get * request sub-session name. */ getRequestSubSessionName: () => Promise; /** * Ignore help request. * When attendee request for help from sub-session, the manager can call this function to ignore * the request, the attendee will receive notification. */ ignore: () => Promise; /** * Join sub-session by user request. * When attendee request for help from sub-session, the manager can call this function to join * the sub-session. */ joinSubSessionByUserRequest: () => Promise; /** * Create sub-session list. */ commitSubSessionList: (subSessionNameList: string[]) => Promise; /** * Withdraw sub-session list. */ withdrawSubSessionList: () => Promise; /** * Get committed sub-session list. */ getCommittedSubSessionList: () => Promise; }; export class ZoomVideoSdkSubSession implements ZoomVideoSdkSubSessionType { async joinSubSession(subSessionID: string) { return await RNZoomVideoSdkSubSession.joinSubSession(subSessionID); } async startSubSession() { return await RNZoomVideoSdkSubSession.startSubSession(); } async stopSubSession() { return await RNZoomVideoSdkSubSession.stopSubSession(); } async isSubSessionStarted() { return await RNZoomVideoSdkSubSession.isSubSessionStarted(); } async broadcastMessage(message: string) { return await RNZoomVideoSdkSubSession.broadcastMessage(message); } async returnToMainSession() { return await RNZoomVideoSdkSubSession.returnToMainSession(); } async requestForHelp() { return await RNZoomVideoSdkSubSession.requestForHelp(); } async getRequestUserName() { return await RNZoomVideoSdkSubSession.getRequestUserName(); } async getRequestSubSessionName() { return await RNZoomVideoSdkSubSession.getRequestSubSessionName(); } async ignore() { return await RNZoomVideoSdkSubSession.ignore(); } async joinSubSessionByUserRequest() { return await RNZoomVideoSdkSubSession.joinSubSessionByUserRequest(); } async commitSubSessionList(subSessionNameList: string[]) { return await RNZoomVideoSdkSubSession.commitSubSessionList(subSessionNameList); } async withdrawSubSessionList() { return await RNZoomVideoSdkSubSession.withdrawSubSessionList(); } async getCommittedSubSessionList() { return await RNZoomVideoSdkSubSession.getCommittedSubSessionList(); } }