feat: implement Paarrot API for Electron integration with navigation and IPC handlers

This commit is contained in:
2026-02-21 21:40:38 +11:00
parent 6a31ea64ed
commit ef55d1583f
5 changed files with 903 additions and 53 deletions

View File

@@ -19,6 +19,28 @@ interface CallContextValue {
const CallContext = createContext<CallContextValue | null>(null);
/**
* Global reference to CallService for use outside React components
* (e.g., from Electron IPC handlers)
*/
let globalCallServiceInstance: CallService | null = null;
/**
* Get the global CallService instance
* @returns The CallService instance or null if not initialized
*/
export function getCallService(): CallService | null {
return globalCallServiceInstance;
}
/**
* Set the global CallService instance
* @param service - The CallService instance
*/
function setGlobalCallService(service: CallService | null): void {
globalCallServiceInstance = service;
}
/**
* Hook to access the call context
* @returns The call context value
@@ -103,6 +125,7 @@ export function useCallService(options?: UseCallServiceOptions): CallContextValu
);
setCallService(service);
setGlobalCallService(service); // Make available globally for Paarrot API
setCallSupported(true);
setCallSupportLoading(false);
// eslint-disable-next-line no-console
@@ -146,6 +169,7 @@ export function useCallService(options?: UseCallServiceOptions): CallContextValu
return () => {
unsubscribe?.();
service?.dispose();
setGlobalCallService(null); // Clear global reference
};
}, [mx, configuredLivekitUrl]);