fix(recording-tip): show "inserted" only after the text was actually inserted

The tip drew its done state on session-completed, before the async insert
ran and even when auto-insert was off or the text was empty. A failed insert
also left the screen-saver-level tip over the result popup's copy button.
session-completed now says whether an insert follows, VoiceModeService emits
text-inserted on success, and the tip hides first when the insert fails.
This commit is contained in:
Yun Chan 2026-10-21 11:35:14 +09:00
parent 06365651fc
commit e7937c877f
5 changed files with 104 additions and 12 deletions

View file

@ -476,6 +476,7 @@ async function initVoiceMode(): Promise<void> {
voiceMode.on('audio-level', ({ level }) => tip.onAudioLevel(level))
voiceMode.on('partial-transcript', ({ text }) => tip.onPartialTranscript(text))
voiceMode.on('insert-failed', ({ text }) => tip.onInsertFailed(text))
voiceMode.on('text-inserted', () => tip.onTextInserted())
// 수정자 없는 Esc 로 진행 중인 받아쓰기(녹음·처리)를 취소한다. 녹음 팁은 포커스를 받지 않는 창이라
// 전역 keydown 을 직접 듣는다(제안 오버레이의 Esc 와 같은 방식). 세션이 없으면 아무 일도 하지 않는다.
@ -494,8 +495,8 @@ async function initVoiceMode(): Promise<void> {
soundEffect.play('recording-start')
})
voiceMode.on('session-completed', ({ session, finalText, audioPath }) => {
tip.onSessionCompleted()
voiceMode.on('session-completed', ({ session, finalText, audioPath, willInsert }) => {
tip.onSessionCompleted(willInsert)
soundEffect.play('recording-stop')
// 녹음은 완료 이벤트 전에 저장됐다 — 실제 저장 경로(없으면 null)만 히스토리에 남긴다.