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

@ -84,7 +84,15 @@ export interface VoiceModeEvents {
}) => void
'transcription-update': (payload: { text: string; isFinal: boolean }) => void
/** audioPath: 저장된 녹음 WAV 경로(완료 이벤트 전에 저장됨). 오디오가 없거나 저장 실패면 null */
'session-completed': (payload: { session: VoiceSession; finalText: string; audioPath: string | null }) => void
/** willInsert: 이어서 자동 입력을 시도하는지(자동 입력 꺼짐·빈 글이면 false) */
'session-completed': (payload: {
session: VoiceSession
finalText: string
audioPath: string | null
willInsert: boolean
}) => void
/** 완료된 세션의 글을 자동 입력했다 */
'text-inserted': (payload: { sessionId: string }) => void
'session-cancelled': (payload: {
session: VoiceSession
reason: 'user' | 'timeout' | 'too-short'
@ -1122,7 +1130,8 @@ class VoiceModeService extends EventEmitter {
// Speakly 패턴: 먼저 IDLE 복귀 (다음 핫키 즉시 사용 가능). 표시 계층이 완료 이벤트로 팁을 숨긴다.
this._setRecognitionState(RecognitionState.COMPLETED)
this._setAudioState(AudioState.STOPPED)
this.emit('session-completed', { session, finalText, audioPath })
const willInsert = Boolean(configGet('autoInsert')) && finalText.length > 0
this.emit('session-completed', { session, finalText, audioPath, willInsert })
this._endRun(run)
// 텍스트 삽입은 세션과 무관하게 비동기 실행 (세션 블로킹 방지)
@ -1140,6 +1149,7 @@ class VoiceModeService extends EventEmitter {
if (selectionCapture) await selectionCapture
const insertMethod = configGet('insertMethod')
await getTextInsertService().insertText(finalText, insertMethod)
this.emit('text-inserted', { sessionId })
} catch (error) {
logger.warn(`Text insert failed: ${describe(error)}`)
// 삽입 실패 시 표시 계층이 ResultPopup에 텍스트를 보여 준다