diff --git a/index.d.ts b/index.d.ts index 4fe4cd21..f8133789 100644 --- a/index.d.ts +++ b/index.d.ts @@ -1,191 +1,139 @@ -export type Events = - 'didReceiveStartCallAction' | - 'answerCall' | - 'endCall' | - 'didActivateAudioSession' | - 'didDeactivateAudioSession' | - 'didDisplayIncomingCall' | - 'didToggleHoldCallAction' | - 'didPerformDTMFAction' | - 'didResetProvider' | - 'checkReachability' | - 'didPerformSetMutedCallAction' | - 'didLoadWithEvents'; - -type HandleType = 'generic' | 'number' | 'email'; - -interface IOptions { - ios: { - appName: string, - imageName?: string, - supportsVideo?: boolean, - maximumCallGroups?: string, - maximumCallsPerCallGroup?: string, - ringtoneSound?: string, - }, - android: { - alertTitle: string, - alertDescription: string, - cancelButton: string, - okButton: string, - imageName?: string, - additionalPermissions: string[], - }, -} - -export type DidReceiveStartCallActionPayload = { handle: string }; -export type AnswerCallPayload = { callUUID: string }; -export type EndCallPayload = AnswerCallPayload; -export type DidDisplayIncomingCallPayload = string | undefined; -export type DidPerformSetMutedCallActionPayload = boolean; - -export default class RNCallKeep { - static addEventListener(type: Events, handler: (args: any) => void) { - - } - - static removeEventListener(type: Events) { - - } - - static async setup(options: IOptions): Promise { - - } - - static hasDefaultPhoneAccount(): boolean { - - } - - static answerIncomingCall(uuid: string) { - - } - - static registerPhoneAccount(): void { - - } - - static registerAndroidEvents(): void { - - } - - static displayIncomingCall( - uuid: string, - handle: string, - localizedCallerName?: string, - handleType?: HandleType, - hasVideo?: boolean, - ) { - - } - - static startCall( - uuid: string, - handle: string, - contactIdentifier?: string, - handleType?: HandleType, - hasVideo?: boolean, - ) { - - } - static updateDisplay( - uuid: string, - displayName: string, - handle: string, - ) { - - } - - /** +declare module 'react-native-callkeep' { + export type Events = + 'didReceiveStartCallAction' | + 'answerCall' | + 'endCall' | + 'didActivateAudioSession' | + 'didDeactivateAudioSession' | + 'didDisplayIncomingCall' | + 'didToggleHoldCallAction' | + 'didPerformDTMFAction' | + 'didResetProvider' | + 'checkReachability' | + 'didPerformSetMutedCallAction' | + 'didLoadWithEvents'; + + type HandleType = 'generic' | 'number' | 'email'; + + interface IOptions { + ios: { + appName: string, + imageName?: string, + supportsVideo?: boolean, + maximumCallGroups?: string, + maximumCallsPerCallGroup?: string, + ringtoneSound?: string, + }, + android: { + alertTitle: string, + alertDescription: string, + cancelButton: string, + okButton: string, + imageName?: string, + additionalPermissions: string[], + }, + } + + export type DidReceiveStartCallActionPayload = { handle: string }; + export type AnswerCallPayload = { callUUID: string }; + export type EndCallPayload = AnswerCallPayload; + export type DidDisplayIncomingCallPayload = string | undefined; + export type DidPerformSetMutedCallActionPayload = boolean; + + export default class RNCallKeep { + static addEventListener(type: Events, handler: (args: any) => void): void + + static removeEventListener(type: Events): void + + static setup(options: IOptions): Promise + + static hasDefaultPhoneAccount(): boolean + + static answerIncomingCall(uuid: string): void + + static registerPhoneAccount(): void + + static registerAndroidEvents(): void + + static displayIncomingCall( + uuid: string, + handle: string, + localizedCallerName?: string, + handleType?: HandleType, + hasVideo?: boolean, + ): void + + static startCall( + uuid: string, + handle: string, + contactIdentifier?: string, + handleType?: HandleType, + hasVideo?: boolean, + ): void + + static updateDisplay( + uuid: string, + displayName: string, + handle: string, + ): void + + /** * @description reportConnectedOutgoingCallWithUUID method is available only on iOS. - */ - static reportConnectedOutgoingCallWithUUID(uuid: string) { - - } + */ + static reportConnectedOutgoingCallWithUUID(uuid: string): void - /** + /** * @description reportConnectedOutgoingCallWithUUID method is available only on iOS. - */ - static reportConnectingOutgoingCallWithUUID(uuid: string): void { + */ + static reportConnectingOutgoingCallWithUUID(uuid: string): void - } - static reportEndCallWithUUID(uuid: string, reason: number): void { + static reportEndCallWithUUID(uuid: string, reason: number): void - } + static rejectCall(uuid: string): void - static rejectCall(uuid: string) { - - } + static endCall(uuid: string): void - static endCall(uuid: string) { + static endAllCalls(): void - } - - static endAllCalls() { - - } + static setReachable(): void - static setReachable() { + static isCallActive(uuid: string): Promise - } - static isCallActive(uuid: string): Promise { - - } - /** + /** * @description supportConnectionService method is available only on Android. - */ - static supportConnectionService(): boolean { - - } + */ + static supportConnectionService(): boolean - /** + /** * @description hasPhoneAccount method is available only on Android. - */ - static async hasPhoneAccount(): Promise { - - } + */ + static hasPhoneAccount(): Promise - static async hasOutgoingCall(): Promise { + static hasOutgoingCall(): Promise - } - - /** + /** * @description setMutedCall method is available only on iOS. - */ - static setMutedCall(uuid: string, muted: boolean) { - - } - - static setOnHold(uuid: string, held: boolean) { + */ + static setMutedCall(uuid: string, muted: boolean): void - } + static setOnHold(uuid: string, held: boolean): void - /** + /** * @descriptions sendDTMF is used to send DTMF tones to the PBX. - */ - static sendDTMF(uuid: string, key: string) { - - } - - static checkIfBusy(): Promise { + */ + static sendDTMF(uuid: string, key: string): void - } - - static checkSpeaker(): Promise { + static checkIfBusy(): Promise - } + static checkSpeaker(): Promise - /** + /** * @description setAvailable method is available only on Android. - */ - static setAvailable(active: boolean) { - - } - - static setCurrentCallActive(callUUID: string) { - - } + */ + static setAvailable(active: boolean): void - static backToForeground() { + static setCurrentCallActive(callUUID: string): void + static backToForeground(): void } }