diff --git a/packages/common/lib/Interfaces/IAdapter.ts b/packages/common/lib/Interfaces/IAdapter.ts index 490eb41..6f6b890 100644 --- a/packages/common/lib/Interfaces/IAdapter.ts +++ b/packages/common/lib/Interfaces/IAdapter.ts @@ -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() {} diff --git a/packages/core/lib/useCallSdk.ts b/packages/core/lib/useCallSdk.ts index b9e70e3..9234bbf 100644 --- a/packages/core/lib/useCallSdk.ts +++ b/packages/core/lib/useCallSdk.ts @@ -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(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);