diff --git a/src/main/bootstrap.ts b/src/main/bootstrap.ts index 46b9257..7f1c4d1 100644 --- a/src/main/bootstrap.ts +++ b/src/main/bootstrap.ts @@ -12,6 +12,7 @@ import { getTextInsertService } from './services/TextInsertService' import { getCustomInstructionService } from './services/CustomInstructionService' import { getSoundEffectService } from './services/SoundEffectService' import { getAutoLaunchService } from './services/AutoLaunchService' +import { getAudioCaptureService } from './services/AudioCaptureService' import { initDatabase } from './db' import { createMainWindow, @@ -118,6 +119,9 @@ async function initPopupWindows(): Promise { preloadPopupWindows() setupHistoryPopupIPC() + // 오디오 디바이스 미리 캐싱 (Settings 열 때 즉시 반환) + getAudioCaptureService().getDevices().catch(() => { /* 실패해도 무시 */ }) + // Ctrl+Shift+V → 히스토리 팝업 토글 globalShortcut.register('Ctrl+Shift+V', () => { if (isHistoryPopupVisible()) { diff --git a/src/renderer/components/SettingsModal.tsx b/src/renderer/components/SettingsModal.tsx index 94bf087..ca98b1f 100644 --- a/src/renderer/components/SettingsModal.tsx +++ b/src/renderer/components/SettingsModal.tsx @@ -199,15 +199,14 @@ export function SettingsModal({ open, onClose }: SettingsModalProps): React.Reac if (!open) return setLoading(true) + // 빠른 로드: 설정+핫키 먼저 (즉시 표시) Promise.all([ window.electronAPI.config.getAll(), window.electronAPI.hotkey.getDictationShortcut(), window.electronAPI.hotkey.getHandsFreeShortcut(), window.electronAPI.hotkey.isEnabled(), - window.electronAPI.audio.getDevices(), - window.electronAPI.audio.getSelectedDevice(), ]) - .then(([configResult, dictResult, hfResult, enabledResult, devicesResult, selectedResult]) => { + .then(([configResult, dictResult, hfResult, enabledResult]) => { if (configResult.success) setConfig(configResult.data) if (dictResult.success && dictResult.data) setDictationBinding(dictResult.data) if (hfResult.success && hfResult.data) setHandsFreeBinding(hfResult.data) @@ -215,10 +214,17 @@ export function SettingsModal({ open, onClose }: SettingsModalProps): React.Reac setHotkeyGlobalEnabled(enabledResult.data) setDictationEnabled(enabledResult.data) } - if (devicesResult.success) setAudioDevices(devicesResult.data) - if (selectedResult.success && selectedResult.data) setSelectedDeviceId(selectedResult.data) }) .finally(() => setLoading(false)) + + // 느린 로드: 오디오 디바이스 (백그라운드, UI 블로킹 안 함) + Promise.all([ + window.electronAPI.audio.getDevices(), + window.electronAPI.audio.getSelectedDevice(), + ]).then(([devicesResult, selectedResult]) => { + if (devicesResult.success) setAudioDevices(devicesResult.data) + if (selectedResult.success && selectedResult.data) setSelectedDeviceId(selectedResult.data) + }) }, [open]) const updateConfig = useCallback((key: keyof AppConfig, value: AppConfig[keyof AppConfig]) => {