fix(voice): let a click on the RecordingTip actually cancel the recording

This commit is contained in:
Yun Chan 2026-09-28 00:53:43 +09:00
parent 83cf9133ac
commit c5b3bdedb6
2 changed files with 94 additions and 1 deletions

View file

@ -14,6 +14,11 @@ function safeSendToRenderer(channel: string, data: unknown): void {
}
}
/** 두 IPC 전송 경로(invoke/send)가 공유하는 단일 취소 동작 */
function cancelVoiceSession(): void {
getVoiceModeService().cancelSession()
}
export function registerVoiceHandlers(): void {
// 음성 세션 에러/경고를 메인 윈도우로 브로드캐스트 —
// 모델 미설치/엔진 실패 등의 경고가 recording tip(3초) 외에도
@ -55,11 +60,18 @@ export function registerVoiceHandlers(): void {
}
})
// 취소는 두 경로로 들어온다 — 메인 윈도우는 invoke(handle), RecordingTip 팝업은
// popupAPI.send(= ipcRenderer.send, 단방향)라서 ipcMain.on이 따로 있어야 한다.
// handle()은 send() 메시지를 절대 받지 않는다.
ipcMain.handle(IPC_CHANNELS.VOICE.CANCEL_RECORDING, async (_event, _params: CancelRecordingParams) => {
getVoiceModeService().cancelSession()
cancelVoiceSession()
return ipcSuccess(undefined)
})
ipcMain.on(IPC_CHANNELS.VOICE.CANCEL_RECORDING, () => {
cancelVoiceSession()
})
ipcMain.handle(IPC_CHANNELS.VOICE.GET_STATE, async () => {
return ipcSuccess(getVoiceModeService().getState())
})