TP-89230 | universal call sdk

This commit is contained in:
varnit goyal
2024-11-03 12:06:19 +05:30
parent 100ba8cca6
commit 51b232d28d
2 changed files with 10 additions and 4 deletions

View File

@@ -1,7 +1,9 @@
import GenericObject from "../types/GenericObject.ts";
class IAdapter {
registerOnCallIncoming(callback: ()=>void) {callback()}
registerOnCallConnected(callback: ()=>void) {callback()}
registerOnCallDisconnected(callback: ()=>void) {callback()}
registerOnCallIncoming(callback: (callState: GenericObject)=>void) {callback({})}
registerOnCallConnected(callback: (callState: GenericObject)=>void) {callback({})}
registerOnCallDisconnected(callback: (callState: GenericObject)=>void) {callback({})}
acceptCall() {}
rejectCall() {}
muteCall() {}

View File

@@ -1,5 +1,6 @@
import { useReducer} from 'react';
import {GenericObject, StateType} from "./types.ts";
import IAdapter from "@universal-call-sdk/common/lib/Interfaces/IAdapter.ts";
@@ -72,10 +73,13 @@ const initialState : StateType = {
}
function UseCallSdk(adapter : any) {
function UseCallSdk(adapter : IAdapter) {
// @ts-expect-error sdfsf
const [callState] = useReducer<any>(reducer, initialState,()=> initialState);
console.log('adapter in universal call sdk', adapter)
function registerOnCallIncoming(callback : (callState: GenericObject)=>void) {
//dispatch({type: actionTypes.CALL_INCOMING, payload: {}})
adapter.registerOnCallIncoming(callback);