import type { NativeModule, TurboModule } from 'react-native'; import { BridgedQuery } from '../libs/BridgedQuery'; import type { CallOptions, CustomItemUpdateResult, DirectCallLog, DirectCallProperties, SendbirdCallListener } from './Call'; import type { AudioDevice, VideoDevice } from './Media'; import { SoundType } from './Media'; import { DirectCallLogQueryParams, NativeQueryCreator, NativeQueryKey, NativeQueryResult, NativeQueryType, RoomListQueryParams } from './Query'; import type { EnterParams, RoomParams, RoomProperties } from './Room'; import type { AuthenticateParams, User } from './User'; import type { AsJSInterface, AsJSMediaDeviceControl } from './index'; type NativeModuleInterface = NativeModule & TurboModule; export type NativeConstants = { NATIVE_SDK_VERSION: string; }; export interface NativeCommonModule { applicationId: string; currentUser: User | null; setLoggerLevel(level: 'none' | 'error' | 'warning' | 'info'): void; addDirectCallSound(type: SoundType, fileName: string): void; removeDirectCallSound(type: SoundType): void; setDirectCallDialingSoundOnWhenSilentOrVibrateMode(enabled: boolean): void; getCurrentUser(): Promise; getOngoingCalls(): Promise; getDirectCall(callId: string): Promise; initialize(appId: string): boolean; authenticate(authParams: AuthenticateParams): Promise; deauthenticate(): Promise; registerPushToken(token: string, unique?: boolean): Promise; unregisterPushToken(token: string): Promise; dial(calleeUserId: string, isVideoCall: boolean, options: CallOptions): Promise; createRoom(roomParams: RoomParams): Promise; fetchRoomById(roomId: string): Promise; getCachedRoomById(roomId: string): Promise; updateCustomItems(callId: string, customItems: Record): Promise; deleteCustomItems(callId: string, customItemKeys: string[]): Promise; deleteAllCustomItems(callId: string): Promise; /** @platform Android **/ handleFirebaseMessageData(data: Record): void; /** @platform iOS **/ registerVoIPPushToken(token: string, unique?: boolean): Promise; /** @platform iOS **/ unregisterVoIPPushToken(token: string): Promise; /** @platform iOS **/ routePickerView(): void; } type CommonModule_AndroidSpecificKeys = 'handleFirebaseMessageData'; type CommonModule_IOSSpecificKeys = 'registerVoIPPushToken' | 'unregisterVoIPPushToken' | 'routePickerView'; export declare enum ControllableModuleType { DIRECT_CALL = "DIRECT_CALL", GROUP_CALL = "GROUP_CALL" } export type JSMediaDeviceControl = AsJSMediaDeviceControl; export interface NativeMediaDeviceControl { muteMicrophone(type: ControllableModuleType, identifier: string): void; unmuteMicrophone(type: ControllableModuleType, identifier: string): void; stopVideo(type: ControllableModuleType, identifier: string): void; startVideo(type: ControllableModuleType, identifier: string): void; switchCamera(type: ControllableModuleType, identifier: string): Promise; selectVideoDevice(type: ControllableModuleType, identifier: string, device: VideoDevice): Promise; /** @platform Android **/ selectAudioDevice(type: ControllableModuleType, identifier: string, device: AudioDevice): Promise; /** @platform Android **/ resumeVideoCapturer(type: ControllableModuleType, identifier: string): void; /** @platform Android **/ resumeAudioTrack(type: ControllableModuleType, identifier: string): void; } export interface NativeDirectCallModule { accept(callId: string, options: CallOptions, holdActiveCall: boolean): Promise; end(callId: string): Promise; updateLocalVideoView(callId: string, videoViewId: number): void; updateRemoteVideoView(callId: string, videoViewId: number): void; directCallUpdateCustomItems(callId: string, customItems: Record): Promise; directCallDeleteCustomItems(callId: string, customItemKeys: string[]): Promise; directCallDeleteAllCustomItems(callId: string): Promise; startScreenShare(callId: string): Promise; stopScreenShare(callId: string): Promise; } export interface NativeGroupCallModule { enter(roomId: string, options: EnterParams): Promise; exit(roomId: string): void; groupCallUpdateCustomItems(roomId: string, customItems: Record): Promise; groupCallDeleteCustomItems(roomId: string, customItemKeys: string[]): Promise; groupCallDeleteAllCustomItems(roomId: string): Promise; } export interface NativeQueries { createDirectCallLogListQuery: NativeQueryCreator; createRoomListQuery: NativeQueryCreator; queryNext(key: NativeQueryKey, type: T): NativeQueryResult; queryRelease(key: NativeQueryKey): void; } export interface SendbirdCallsNativeSpec extends NativeModuleInterface, NativeQueries, NativeCommonModule, NativeDirectCallModule, NativeGroupCallModule, NativeMediaDeviceControl { } type PlatformSpecificInterface = AsJSInterface, 'android', CommonModule_AndroidSpecificKeys>; export interface SendbirdCallsJavascriptSpec extends PlatformSpecificInterface { /** Listeners **/ setListener(listener: SendbirdCallListener): void; /** Queries **/ createDirectCallLogListQuery(params: DirectCallLogQueryParams): Promise>; createRoomListQuery(params: RoomListQueryParams): Promise>; } export {};