From 3624b6022d3f179b958a93de66e6e840459734fa Mon Sep 17 00:00:00 2001 From: talksik Date: Sun, 29 May 2022 08:50:25 -0500 Subject: [PATCH] more logic for recording --- packages/desktop/src/components/Terminal.tsx | 8 +++++--- packages/desktop/src/index.ts | 1 + 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/packages/desktop/src/components/Terminal.tsx b/packages/desktop/src/components/Terminal.tsx index 9f57a57..0b978d1 100644 --- a/packages/desktop/src/components/Terminal.tsx +++ b/packages/desktop/src/components/Terminal.tsx @@ -267,10 +267,12 @@ export function TerminalProvider({ children }: { children?: React.ReactNode }) { }, [setIsUserSpeaking, userAudioStream, handleAskForMicrophonePermissions]); const handleStopBroadcast = useCallback(() => { - setIsUserSpeaking(false); + if (isUserSpeaking) { + setIsUserSpeaking(false); - enqueueSnackbar('stopped...', { variant: 'info' }); - }, [setIsUserSpeaking]); + enqueueSnackbar('stopped...', { variant: 'info' }); + } + }, [setIsUserSpeaking, isUserSpeaking]); useKeyPressEvent('`', handleBroadcast, handleStopBroadcast); diff --git a/packages/desktop/src/index.ts b/packages/desktop/src/index.ts index 853993f..66b937a 100644 --- a/packages/desktop/src/index.ts +++ b/packages/desktop/src/index.ts @@ -66,6 +66,7 @@ app }); ipcMain.on(Channels.ASK_MICROPHONE_PERMISSIONS, async () => { + console.log('asking for user microphone'); systemPreferences.askForMediaAccess('microphone'); }); })