feat: 회의 파일 가져오기와 입력 엔진 배포 보완
This commit is contained in:
parent
5a8c5cd792
commit
b3519e5da7
54 changed files with 1129 additions and 116 deletions
|
|
@ -7,6 +7,7 @@ import { ErrorCode, ipcSuccess, ipcError } from '@d3ro/core/errors'
|
|||
import { getFileTranscriptionService } from '../services/FileTranscriptionService'
|
||||
import { getLogger } from '../services/LoggerService'
|
||||
import type { FileTranscriptionStartParams } from '@d3ro/core/types'
|
||||
import { SUPPORTED_MEDIA_EXTENSIONS } from '../services/file-transcription/media-formats'
|
||||
|
||||
const logger = getLogger('file-transcription-handlers')
|
||||
|
||||
|
|
@ -33,10 +34,7 @@ export function registerFileTranscriptionHandlers(): void {
|
|||
filters: [
|
||||
{
|
||||
name: 'Audio/Video',
|
||||
extensions: [
|
||||
'mp3', 'wav', 'm4a', 'ogg', 'flac', 'wma', 'aac',
|
||||
'mp4', 'mkv', 'webm', 'avi', 'mov',
|
||||
],
|
||||
extensions: [...SUPPORTED_MEDIA_EXTENSIONS],
|
||||
},
|
||||
],
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,11 +1,12 @@
|
|||
// src/main/ipc/meeting-mode-handlers.ts
|
||||
// Phase 14 / 14.5: Meeting Mode IPC 핸들러
|
||||
|
||||
import { ipcMain } from 'electron'
|
||||
import { dialog, ipcMain } from 'electron'
|
||||
import { IPC_CHANNELS } from '@d3ro/core/ipc-channels'
|
||||
import { ErrorCode, ipcSuccess, ipcError, D3ROError } from '@d3ro/core/errors'
|
||||
import { getMeetingModeService } from '../services/MeetingModeService'
|
||||
import { getLogger } from '../services/LoggerService'
|
||||
import { SUPPORTED_MEDIA_EXTENSIONS } from '../services/file-transcription/media-formats'
|
||||
import { LiveSegmentEditor, normalizeSegmentText } from '../services/meeting/live-segment-edits'
|
||||
import {
|
||||
MEETING_CHAT_GET_HISTORY_CHANNEL,
|
||||
|
|
@ -15,6 +16,7 @@ import type { LiveSegmentEditResult } from '../services/meeting/live-segment-edi
|
|||
import type {
|
||||
CaptionSegment,
|
||||
MeetingSessionDetail,
|
||||
MeetingImportParams,
|
||||
MeetingAddMemoParams,
|
||||
MeetingGetSessionsParams,
|
||||
MeetingGetSessionParams,
|
||||
|
|
@ -102,6 +104,34 @@ export function registerMeetingModeHandlers(): void {
|
|||
}
|
||||
})
|
||||
|
||||
ipcMain.handle(ch.IMPORT_RECORDING, async (_event, params: MeetingImportParams) => {
|
||||
try {
|
||||
let filePath = params.filePath
|
||||
if (!filePath) {
|
||||
const { getMainWindow } = await import('../windows/WindowManager')
|
||||
const mainWindow = getMainWindow()
|
||||
const options = {
|
||||
properties: ['openFile'] as ('openFile')[],
|
||||
filters: [{ name: 'Audio/Video', extensions: [...SUPPORTED_MEDIA_EXTENSIONS] }],
|
||||
}
|
||||
const selected = mainWindow
|
||||
? await dialog.showOpenDialog(mainWindow, options)
|
||||
: await dialog.showOpenDialog(options)
|
||||
if (selected.canceled || selected.filePaths.length === 0) {
|
||||
return ipcError(ErrorCode.FileTranscriptionCancelled, 'File selection cancelled')
|
||||
}
|
||||
filePath = selected.filePaths[0]
|
||||
}
|
||||
return ipcSuccess(await getMeetingModeService().importRecording(filePath, params.language))
|
||||
} catch (err) {
|
||||
logger.error(`importRecording 실패: ${err instanceof Error ? err.message : String(err)}`)
|
||||
return ipcError(
|
||||
err instanceof D3ROError ? err.code : ErrorCode.MeetingProcessingFailed,
|
||||
err instanceof Error ? err.message : String(err),
|
||||
)
|
||||
}
|
||||
})
|
||||
|
||||
ipcMain.handle('meetingMode:forceReset', async () => {
|
||||
try {
|
||||
await getMeetingModeService().forceReset()
|
||||
|
|
|
|||
|
|
@ -35,6 +35,7 @@ import type {
|
|||
} from '@d3ro/core/types'
|
||||
|
||||
import { collapseRepeatedSegments, collapseRepeats, isDegenerateTranscript } from './file-transcription/repetition'
|
||||
import { SUPPORTED_MEDIA_EXTENSION_SET } from './file-transcription/media-formats'
|
||||
|
||||
const logger = getLogger('FileTranscriptionService')
|
||||
|
||||
|
|
@ -44,11 +45,6 @@ const CHUNK_DURATION_SEC = 30
|
|||
const MAX_FILE_SIZE_BYTES = 2 * 1024 * 1024 * 1024
|
||||
/** initialPrompt 컨텍스트 윈도우 (자) */
|
||||
const CONTEXT_WINDOW_SIZE = 300
|
||||
/** 지원 확장자 */
|
||||
const SUPPORTED_EXTENSIONS = new Set([
|
||||
'.mp3', '.wav', '.m4a', '.ogg', '.flac', '.wma', '.aac',
|
||||
'.mp4', '.mkv', '.webm', '.avi', '.mov',
|
||||
])
|
||||
|
||||
/** 기본 ffmpeg 위치 포트: 로컬 사본 조회 + 런타임 feed 다운로드 */
|
||||
const defaultFfmpegLocator: FfmpegLocator = {
|
||||
|
|
@ -94,14 +90,18 @@ class FileTranscriptionService extends EventEmitter {
|
|||
}
|
||||
}
|
||||
|
||||
async startTranscription(filePath: string, language?: string): Promise<FileTranscriptionResult> {
|
||||
async startTranscription(
|
||||
filePath: string,
|
||||
language?: string,
|
||||
options: { saveToHistory?: boolean; onConverted?: (wavPath: string) => Promise<void> } = {},
|
||||
): Promise<FileTranscriptionResult> {
|
||||
if (this._state !== 'idle') {
|
||||
throw new D3ROError(ErrorCode.FileTranscriptionChunkFailed, 'Transcription already in progress')
|
||||
}
|
||||
|
||||
// 파일 검증
|
||||
const ext = path.extname(filePath).toLowerCase()
|
||||
if (!SUPPORTED_EXTENSIONS.has(ext)) {
|
||||
if (!SUPPORTED_MEDIA_EXTENSION_SET.has(ext)) {
|
||||
throw new D3ROError(ErrorCode.FileTranscriptionInvalidFormat, `Unsupported format: ${ext}`)
|
||||
}
|
||||
|
||||
|
|
@ -152,6 +152,8 @@ class FileTranscriptionService extends EventEmitter {
|
|||
const wavPath = path.join(job.tempDir, 'audio.wav')
|
||||
await this._convertToWav(job, ffmpegPath, filePath, wavPath)
|
||||
throwIfCancelled()
|
||||
await options.onConverted?.(wavPath)
|
||||
throwIfCancelled()
|
||||
|
||||
// 오디오 길이 확인
|
||||
const totalDurationSec = await this._probeDuration(job, ffmpegPath, wavPath)
|
||||
|
|
@ -234,31 +236,32 @@ class FileTranscriptionService extends EventEmitter {
|
|||
processingTimeMs,
|
||||
}
|
||||
|
||||
// 히스토리에 저장
|
||||
try {
|
||||
const wordCount = fullText.split(/\s+/).filter((w) => w.length > 0).length
|
||||
getHistoryService().create({
|
||||
originalText: fullText,
|
||||
polishedText: null,
|
||||
focusedApp: null,
|
||||
focusedAppName: null,
|
||||
focusedAppWindowTitle: null,
|
||||
mode: 'file-transcription',
|
||||
status: 'completed',
|
||||
errorCode: null,
|
||||
audioLocalPath: filePath,
|
||||
duration: totalDurationSec,
|
||||
detectedLanguage: null,
|
||||
micDevice: null,
|
||||
wordCount,
|
||||
sttModel: configGet('sttModelId') as string | null,
|
||||
llmModel: null,
|
||||
sttLatencyMs: processingTimeMs,
|
||||
llmLatencyMs: null,
|
||||
appVersion: app.getVersion(),
|
||||
})
|
||||
} catch (err) {
|
||||
logger.warn('Failed to save file transcription to history:', err)
|
||||
if (options.saveToHistory !== false) {
|
||||
try {
|
||||
const wordCount = fullText.split(/\s+/).filter((w) => w.length > 0).length
|
||||
getHistoryService().create({
|
||||
originalText: fullText,
|
||||
polishedText: null,
|
||||
focusedApp: null,
|
||||
focusedAppName: null,
|
||||
focusedAppWindowTitle: null,
|
||||
mode: 'file-transcription',
|
||||
status: 'completed',
|
||||
errorCode: null,
|
||||
audioLocalPath: filePath,
|
||||
duration: totalDurationSec,
|
||||
detectedLanguage: null,
|
||||
micDevice: null,
|
||||
wordCount,
|
||||
sttModel: configGet('sttModelId') as string | null,
|
||||
llmModel: null,
|
||||
sttLatencyMs: processingTimeMs,
|
||||
llmLatencyMs: null,
|
||||
appVersion: app.getVersion(),
|
||||
})
|
||||
} catch (err) {
|
||||
logger.warn('Failed to save file transcription to history:', err)
|
||||
}
|
||||
}
|
||||
|
||||
this._setJobState(job, 'completed')
|
||||
|
|
|
|||
|
|
@ -56,6 +56,8 @@ import {
|
|||
parseTranscriptLines,
|
||||
} from '@d3ro/core/meeting-transcript'
|
||||
import { markdownToDocx } from '@d3ro/core/utils/markdown-to-docx'
|
||||
import { getFileTranscriptionService } from './FileTranscriptionService'
|
||||
import { buildImportedMeetingTranscript } from './meeting/imported-recording'
|
||||
import type {
|
||||
MeetingModeState,
|
||||
MeetingMemo,
|
||||
|
|
@ -122,6 +124,8 @@ let isShowingMeetingSaveDialog = false
|
|||
|
||||
class MeetingModeService extends EventEmitter {
|
||||
private _state: MeetingModeState = 'idle'
|
||||
private _importInFlight = false
|
||||
private _accountRevision = 0
|
||||
/**
|
||||
* 진행 중인 녹음. 녹음 한 건의 세그먼트·메모·오디오·구독은 이 객체가 단독으로 소유한다.
|
||||
* 후처리가 끝날 때까지 남아 있어 getStateInfo 가 세션 id 를 계속 보고한다(실시간 편집 반영용).
|
||||
|
|
@ -158,6 +162,7 @@ class MeetingModeService extends EventEmitter {
|
|||
this.on('error', () => { /* default sink */ })
|
||||
// 계정 DB 가 바뀔 때마다(로그인·로그아웃) 그 DB 에 남은 중단된 녹음을 정리한다.
|
||||
this._unsubscribeScope = onAccountScopeChanged(() => {
|
||||
this._accountRevision += 1
|
||||
try {
|
||||
this.recoverInterruptedSessions()
|
||||
} catch (err) {
|
||||
|
|
@ -245,6 +250,69 @@ class MeetingModeService extends EventEmitter {
|
|||
this._sendStateToRenderer()
|
||||
}
|
||||
|
||||
async importRecording(filePath: string, language?: string): Promise<MeetingSessionDetail> {
|
||||
if (this._state !== 'idle' || this._importInFlight) {
|
||||
throw new D3ROError(ErrorCode.MeetingAlreadyRecording, '다른 회의 녹음 또는 파일 가져오기가 진행 중입니다')
|
||||
}
|
||||
this._importInFlight = true
|
||||
const accountRevision = this._accountRevision
|
||||
const assertImportAccount = (): void => {
|
||||
if (accountRevision !== this._accountRevision) {
|
||||
throw new D3ROError(ErrorCode.FileTranscriptionCancelled, 'Account changed during meeting import')
|
||||
}
|
||||
}
|
||||
const sessionId = crypto.randomUUID()
|
||||
const audioPath = meetingAudioFilePathSync(sessionId)
|
||||
let completed = false
|
||||
try {
|
||||
const transcription = await getFileTranscriptionService().startTranscription(
|
||||
filePath,
|
||||
language,
|
||||
{
|
||||
saveToHistory: false,
|
||||
onConverted: async (wavPath) => {
|
||||
assertImportAccount()
|
||||
fs.mkdirSync(pathDirname(audioPath), { recursive: true })
|
||||
await fs.promises.copyFile(wavPath, audioPath)
|
||||
assertImportAccount()
|
||||
},
|
||||
},
|
||||
)
|
||||
assertImportAccount()
|
||||
const imported = buildImportedMeetingTranscript(transcription)
|
||||
if (!imported.rawTranscript) {
|
||||
throw new D3ROError(ErrorCode.MeetingProcessingFailed, '파일에서 인식된 발화가 없습니다')
|
||||
}
|
||||
|
||||
const endedAt = Date.now()
|
||||
const startedAt = Math.max(0, endedAt - imported.durationMs)
|
||||
getDatabase().insert(meetingSessions).values({
|
||||
id: sessionId,
|
||||
title: imported.title,
|
||||
status: 'completed',
|
||||
startedAt,
|
||||
endedAt,
|
||||
durationMs: imported.durationMs,
|
||||
rawTranscript: imported.rawTranscript,
|
||||
sttModel: configGet('sttModelId') as string | undefined,
|
||||
sttLatencyMs: transcription.processingTimeMs,
|
||||
createdAt: endedAt,
|
||||
updatedAt: endedAt,
|
||||
}).run()
|
||||
getCloudSyncService().pushOne('meetings', sessionId)
|
||||
getCloudSyncService().pushOne('meeting_audio', sessionId)
|
||||
completed = true
|
||||
|
||||
const detail = this._loadSessionDetail(sessionId)
|
||||
if (!detail) throw new D3ROError(ErrorCode.MeetingSessionNotFound, '가져온 회의를 다시 읽지 못했습니다')
|
||||
this.emit('session-completed', detail)
|
||||
return detail
|
||||
} finally {
|
||||
this._importInFlight = false
|
||||
if (!completed) await fs.promises.rm(audioPath, { force: true }).catch(() => undefined)
|
||||
}
|
||||
}
|
||||
|
||||
// ── 녹음 시작 ──
|
||||
|
||||
async startRecording(options?: { force?: boolean }): Promise<MeetingStartResult> {
|
||||
|
|
@ -252,7 +320,7 @@ class MeetingModeService extends EventEmitter {
|
|||
await this.forceReset()
|
||||
}
|
||||
|
||||
if (this._state !== 'idle') {
|
||||
if (this._state !== 'idle' || this._importInFlight) {
|
||||
throw new D3ROError(
|
||||
ErrorCode.MeetingAlreadyRecording,
|
||||
`회의 모드가 이미 실행 중입니다 (${this._state}). 이전 회의를 종료하거나 강제 초기화 후 다시 시도해주세요.`,
|
||||
|
|
|
|||
|
|
@ -0,0 +1,8 @@
|
|||
export const SUPPORTED_MEDIA_EXTENSIONS = [
|
||||
'mp3', 'wav', 'm4a', 'ogg', 'flac', 'wma', 'aac',
|
||||
'mp4', 'mkv', 'webm', 'avi', 'mov',
|
||||
] as const
|
||||
|
||||
export const SUPPORTED_MEDIA_EXTENSION_SET: ReadonlySet<string> = new Set(
|
||||
SUPPORTED_MEDIA_EXTENSIONS.map((extension) => `.${extension}`),
|
||||
)
|
||||
28
apps/desktop/src/main/services/meeting/imported-recording.ts
Normal file
28
apps/desktop/src/main/services/meeting/imported-recording.ts
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
import type { FileTranscriptionResult } from '@d3ro/core/types'
|
||||
import { formatTranscriptLines } from '@d3ro/core/meeting-transcript'
|
||||
|
||||
export interface ImportedMeetingTranscript {
|
||||
title: string
|
||||
rawTranscript: string
|
||||
durationMs: number
|
||||
}
|
||||
|
||||
export function buildImportedMeetingTranscript(
|
||||
result: Pick<FileTranscriptionResult, 'fileName' | 'fullText' | 'segments' | 'totalDurationSec'>,
|
||||
): ImportedMeetingTranscript {
|
||||
const title = result.fileName.replace(/\.[^.]+$/, '').trim().slice(0, 160) || result.fileName.slice(0, 160)
|
||||
const lines = result.segments.length > 0
|
||||
? result.segments.map((segment) => ({
|
||||
timestampMs: Math.max(0, Math.round(segment.start * 1000)),
|
||||
timed: true,
|
||||
speaker: null,
|
||||
text: segment.text.trim(),
|
||||
})).filter((segment) => segment.text.length > 0)
|
||||
: [{ timestampMs: 0, timed: false, speaker: null, text: result.fullText.trim() }]
|
||||
|
||||
return {
|
||||
title,
|
||||
rawTranscript: formatTranscriptLines(lines),
|
||||
durationMs: Math.max(0, Math.round(result.totalDurationSec * 1000)),
|
||||
}
|
||||
}
|
||||
|
|
@ -20,12 +20,13 @@ export function isRuntimeComponent(value: unknown): value is RuntimeComponent {
|
|||
}
|
||||
|
||||
/**
|
||||
* 이 앱이 요구하는 런타임 최소 버전. 사이드카 API 가 바뀔 때만 올린다.
|
||||
* 이 앱이 요구하는 런타임 최소 버전. 필수 API 또는 입력 안전성 수정이 있을 때 올린다.
|
||||
* 1.5.0 — UIA 브리지(`/uia/focus`). 1.7.0 — 보조 모델 자리(`/load` slot, `/transcribe` model_id).
|
||||
* 1.16.0 — CPU 스레드 예산과 터미널/xterm UIA 고속 경로.
|
||||
* ffmpeg 는 CLI 가 안정적이라 확인하지 않는다.
|
||||
*/
|
||||
export const RUNTIME_MIN_VERSION: Readonly<Record<RuntimeComponent, string | null>> = {
|
||||
sidecar: '1.7.0',
|
||||
sidecar: '1.16.0',
|
||||
ffmpeg: null,
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -158,6 +158,7 @@ import type {
|
|||
TemplateFieldCompletedEvent,
|
||||
TemplateSessionCompletedEvent,
|
||||
MeetingStartResult,
|
||||
MeetingImportParams,
|
||||
MeetingMemo,
|
||||
MeetingAddMemoParams,
|
||||
MeetingModeStateInfo,
|
||||
|
|
@ -763,6 +764,8 @@ const electronAPI = {
|
|||
meetingMode: {
|
||||
startRecording: (params?: { force?: boolean }) =>
|
||||
invoke<MeetingStartResult>(IPC_CHANNELS.MEETING_MODE.START_RECORDING, params),
|
||||
importRecording: (params: MeetingImportParams) =>
|
||||
invoke<MeetingSessionDetail>(IPC_CHANNELS.MEETING_MODE.IMPORT_RECORDING, params),
|
||||
forceReset: () =>
|
||||
invoke<void>('meetingMode:forceReset'),
|
||||
stopRecording: () =>
|
||||
|
|
|
|||
|
|
@ -11,8 +11,10 @@ import { AudioVisualizerBar, Led, PhysicalButton, TactileBadge } from '@d3ro/ui/
|
|||
import { d3roFontMono, d3roFontSans, d3roPalette, d3roRadius, typoSx } from '@d3ro/ui/theme'
|
||||
import { useI18n } from '@d3ro/i18n'
|
||||
import type { TranslationKey } from '@d3ro/i18n'
|
||||
import { ErrorCode } from '@d3ro/core/errors'
|
||||
import type {
|
||||
CaptionSegment,
|
||||
FileTranscriptionProgress,
|
||||
MeetingMemo,
|
||||
MeetingModeStateInfo,
|
||||
MeetingProcessingProgress,
|
||||
|
|
@ -71,6 +73,8 @@ export function MeetingModePage(): React.ReactElement {
|
|||
|
||||
// 사전 점검 및 기동 상태
|
||||
const [isStarting, setIsStarting] = useState(false)
|
||||
const [isImporting, setIsImporting] = useState(false)
|
||||
const [importProgress, setImportProgress] = useState<FileTranscriptionProgress | null>(null)
|
||||
const [errorInfo, setErrorInfo] = useState<MeetingErrorInfo | null>(null)
|
||||
/** 조회한 값만 보인다 — 조회 전이면 null */
|
||||
const [sttProvider, setSttProvider] = useState<string | null>(null)
|
||||
|
|
@ -234,6 +238,40 @@ export function MeetingModePage(): React.ReactElement {
|
|||
}, [view])
|
||||
|
||||
// ── 핸들러 ──
|
||||
useEffect(
|
||||
() => window.electronAPI.fileTranscription.onProgress((value) => {
|
||||
if (isImporting) setImportProgress(value)
|
||||
}),
|
||||
[isImporting],
|
||||
)
|
||||
|
||||
const handleImportRecording = useCallback(async () => {
|
||||
if (isImporting || isStarting) return
|
||||
setIsImporting(true)
|
||||
setImportProgress(null)
|
||||
try {
|
||||
const resp = await window.electronAPI.meetingMode.importRecording({})
|
||||
if (resp.success) {
|
||||
setDetail(resp.data)
|
||||
setView('detail')
|
||||
} else if (resp.error.code !== ErrorCode.FileTranscriptionCancelled) {
|
||||
notify({ message: t('meetings.importFailed', { message: resp.error.message }), severity: 'error' })
|
||||
}
|
||||
} catch (err) {
|
||||
notify({
|
||||
message: t('meetings.importFailed', { message: err instanceof Error ? err.message : String(err) }),
|
||||
severity: 'error',
|
||||
})
|
||||
} finally {
|
||||
setIsImporting(false)
|
||||
setImportProgress(null)
|
||||
}
|
||||
}, [isImporting, isStarting, notify, setView, t])
|
||||
|
||||
const handleCancelImport = useCallback(() => {
|
||||
void window.electronAPI.fileTranscription.cancel()
|
||||
}, [])
|
||||
|
||||
const handleStartRecording = useCallback(async (force = false) => {
|
||||
setIsStarting(true)
|
||||
setErrorInfo(null)
|
||||
|
|
@ -419,6 +457,10 @@ export function MeetingModePage(): React.ReactElement {
|
|||
onQueryChange={setListQuery}
|
||||
isStarting={isStarting}
|
||||
onStartMeeting={() => void handleStartRecording(false)}
|
||||
isImporting={isImporting}
|
||||
importProgress={importProgress}
|
||||
onImportMeeting={() => void handleImportRecording()}
|
||||
onCancelImport={handleCancelImport}
|
||||
onOpen={(id) => void handleViewDetail(id)}
|
||||
progress={progress}
|
||||
micLabel={micDeviceName === null ? null : micDeviceName || t('meetings.defaultMic')}
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@ import { MoreHorizontal, Pencil, Plus, Trash2, Users } from 'lucide-react'
|
|||
import { PhysicalButton, TactileBadge } from '@d3ro/ui/components/ds'
|
||||
import { d3roFocusRing, d3roPalette, d3roRadius, d3roShadow, d3roTransition, typoSx } from '@d3ro/ui/theme'
|
||||
import { useI18n } from '@d3ro/i18n'
|
||||
import type { MeetingProcessingProgress, MeetingSessionSummary } from '@d3ro/core/types'
|
||||
import type { FileTranscriptionProgress, MeetingProcessingProgress, MeetingSessionSummary } from '@d3ro/core/types'
|
||||
import { ConfirmDialog, EmptyStateCard, PageHeader, SearchInput, useNotify } from '../../components/shared'
|
||||
import { clearNotepad, defaultNotepadStorage } from '../../components/meeting/meeting-notepad-storage'
|
||||
import { meetingStatusLabelKey, meetingStatusTone, shouldShowStatusBadge } from '../../components/meeting/meeting-format'
|
||||
|
|
@ -39,6 +39,10 @@ interface MeetingListViewProps {
|
|||
onQueryChange: (query: string) => void
|
||||
isStarting: boolean
|
||||
onStartMeeting: () => void
|
||||
isImporting: boolean
|
||||
importProgress: FileTranscriptionProgress | null
|
||||
onImportMeeting: () => void
|
||||
onCancelImport: () => void
|
||||
onOpen: (sessionId: string) => void
|
||||
/** 후처리 진행률(저장 중인 회의 줄에 막대로) */
|
||||
progress: MeetingProcessingProgress | null
|
||||
|
|
@ -56,6 +60,10 @@ export function MeetingListView({
|
|||
onQueryChange,
|
||||
isStarting,
|
||||
onStartMeeting,
|
||||
isImporting,
|
||||
importProgress,
|
||||
onImportMeeting,
|
||||
onCancelImport,
|
||||
onOpen,
|
||||
progress,
|
||||
micLabel,
|
||||
|
|
@ -199,15 +207,20 @@ export function MeetingListView({
|
|||
}
|
||||
|
||||
// ── 렌더 ──
|
||||
const startButton = (
|
||||
<PhysicalButton
|
||||
tone="accent"
|
||||
onClick={onStartMeeting}
|
||||
disabled={isStarting}
|
||||
startIcon={isStarting ? <CircularProgress size={14} sx={{ color: 'inherit' }} /> : <Plus size={15} aria-hidden />}
|
||||
>
|
||||
{isStarting ? t('meetings.starting') : t('meeting.newMeeting')}
|
||||
</PhysicalButton>
|
||||
const actions = (
|
||||
<Box sx={{ display: 'flex', gap: 1, flexWrap: 'wrap' }}>
|
||||
<PhysicalButton tone="glass" onClick={onImportMeeting} disabled={isStarting || isImporting}>
|
||||
{isImporting ? t('meetings.importing') : t('meetings.import')}
|
||||
</PhysicalButton>
|
||||
<PhysicalButton
|
||||
tone="accent"
|
||||
onClick={onStartMeeting}
|
||||
disabled={isStarting || isImporting}
|
||||
startIcon={isStarting ? <CircularProgress size={14} sx={{ color: 'inherit' }} /> : <Plus size={15} aria-hidden />}
|
||||
>
|
||||
{isStarting ? t('meetings.starting') : t('meeting.newMeeting')}
|
||||
</PhysicalButton>
|
||||
</Box>
|
||||
)
|
||||
|
||||
const isEmpty = loadState === 'ready' && total === 0 && sessions.length === 0
|
||||
|
|
@ -224,9 +237,22 @@ export function MeetingListView({
|
|||
title={t('nav.meeting')}
|
||||
count={total > 0 ? t('meeting.sessions', { count: total }) : undefined}
|
||||
description={description || undefined}
|
||||
action={loadState === 'ready' && !isEmpty ? startButton : undefined}
|
||||
action={loadState === 'ready' && !isEmpty ? actions : undefined}
|
||||
/>
|
||||
|
||||
{isImporting && (
|
||||
<Box sx={{ mb: 2 }} role="status">
|
||||
<LinearProgress variant={importProgress ? 'determinate' : 'indeterminate'} value={importProgress?.percent ?? 0} />
|
||||
<Typography sx={{ ...typoSx('small'), color: d3roPalette.text.secondary, mt: 0.75 }}>
|
||||
{t('meetings.importing')}
|
||||
{importProgress ? ` ${importProgress.currentChunk}/${importProgress.totalChunks} · ${importProgress.percent}%` : ''}
|
||||
</Typography>
|
||||
<PhysicalButton tone="glass" onClick={onCancelImport} sx={{ mt: 1 }}>
|
||||
{t('common.cancel')}
|
||||
</PhysicalButton>
|
||||
</Box>
|
||||
)}
|
||||
|
||||
{loadState === 'loading' ? (
|
||||
<Box sx={{ py: 6, textAlign: 'center' }} role="status">
|
||||
<CircularProgress size={20} aria-label={t('common.loading')} />
|
||||
|
|
@ -246,7 +272,7 @@ export function MeetingListView({
|
|||
message={t('meetings.empty.title')}
|
||||
description={t('meetings.empty.description')}
|
||||
icon={<Users />}
|
||||
action={startButton}
|
||||
action={actions}
|
||||
/>
|
||||
) : (
|
||||
<>
|
||||
|
|
|
|||
47
apps/desktop/tests/integration/meeting-import-media.test.ts
Normal file
47
apps/desktop/tests/integration/meeting-import-media.test.ts
Normal file
|
|
@ -0,0 +1,47 @@
|
|||
import { execFile } from 'child_process'
|
||||
import fs from 'fs'
|
||||
import os from 'os'
|
||||
import path from 'path'
|
||||
import { promisify } from 'util'
|
||||
import { afterEach, describe, expect, it, vi } from 'vitest'
|
||||
import { getMeetingModeService } from '../../src/main/services/MeetingModeService'
|
||||
import { getSTTManager } from '../../src/main/services/stt/STTManager'
|
||||
import { getLicenseService } from '../../src/main/services/LicenseService'
|
||||
import { getFfmpegPath } from '../../src/main/utils/paths'
|
||||
import { localAudioPath } from '../../src/main/services/sync/audio-sync'
|
||||
import { useRedHarness } from '../red/harness'
|
||||
|
||||
const execFileAsync = promisify(execFile)
|
||||
useRedHarness()
|
||||
|
||||
const sources = new Set<string>()
|
||||
afterEach(() => {
|
||||
for (const source of sources) fs.rmSync(source, { force: true })
|
||||
sources.clear()
|
||||
})
|
||||
|
||||
describe.each(['mp3', 'm4a'])('실제 %s 녹음 파일 가져오기', (extension) => {
|
||||
it('ffmpeg 변환 후 회의와 재생용 WAV를 만든다', async () => {
|
||||
const source = path.join(os.tmpdir(), `d3ro-meeting-media-${process.pid}-${Date.now()}.${extension}`)
|
||||
sources.add(source)
|
||||
await execFileAsync(getFfmpegPath(), [
|
||||
'-f', 'lavfi', '-i', 'sine=frequency=440:duration=1', '-y', source,
|
||||
])
|
||||
vi.spyOn(getLicenseService(), 'canUse').mockReturnValue({ allowed: true, reason: 'ok' })
|
||||
vi.spyOn(getSTTManager(), 'transcribe').mockResolvedValue({
|
||||
text: `${extension} 회의 발언`,
|
||||
segments: [{ text: `${extension} 회의 발언`, start: 0, end: 1, confidence: 1 }],
|
||||
})
|
||||
|
||||
const detail = await getMeetingModeService().importRecording(source, 'ko')
|
||||
|
||||
expect(detail.rawTranscript).toBe(`[00:00] ${extension} 회의 발언`)
|
||||
expect(detail.durationMs).toBeGreaterThan(0)
|
||||
const audioPath = localAudioPath('meeting', detail.id)
|
||||
expect(audioPath).not.toBeNull()
|
||||
const wav = fs.readFileSync(audioPath!)
|
||||
expect(wav.subarray(0, 4).toString('ascii')).toBe('RIFF')
|
||||
expect(wav.subarray(8, 12).toString('ascii')).toBe('WAVE')
|
||||
getMeetingModeService().deleteSession(detail.id)
|
||||
}, 30_000)
|
||||
})
|
||||
|
|
@ -338,12 +338,12 @@ describe('RuntimeProvisioner', () => {
|
|||
const markerPath = (): string => join(workDir, 'runtime', 'sidecar', '.runtime-version')
|
||||
|
||||
it('설치 후 마커를 쓰고, 다음 ensure 는 내려받지 않는다', async () => {
|
||||
const feed = feedFor(sidecarTar('1.9.0'), '1.9.0')
|
||||
const feed = feedFor(sidecarTar('1.16.0'), '1.16.0')
|
||||
const p = provisioner(feed.fetchImpl)
|
||||
|
||||
const path = await p.ensure('sidecar')
|
||||
expect(path).toBe(p.binaryPath('sidecar'))
|
||||
expect(readFileSync(markerPath(), 'utf8')).toBe('1.9.0')
|
||||
expect(readFileSync(markerPath(), 'utf8')).toBe('1.16.0')
|
||||
|
||||
feed.calls.length = 0
|
||||
await p.ensure('sidecar')
|
||||
|
|
@ -351,7 +351,7 @@ describe('RuntimeProvisioner', () => {
|
|||
})
|
||||
|
||||
it('force 면 설치돼 있어도 다시 받아 손상된 트리를 복구한다', async () => {
|
||||
const feed = feedFor(sidecarTar('1.9.0'), '1.9.0')
|
||||
const feed = feedFor(sidecarTar('1.16.0'), '1.16.0')
|
||||
const p = provisioner(feed.fetchImpl)
|
||||
await p.ensure('sidecar')
|
||||
|
||||
|
|
@ -365,7 +365,7 @@ describe('RuntimeProvisioner', () => {
|
|||
})
|
||||
|
||||
it('추출 중 항목 오류가 나면 실패하고 버전 마커를 남기지 않는다', async () => {
|
||||
const feed = feedFor(brokenSidecarTar(), '1.9.0')
|
||||
const feed = feedFor(brokenSidecarTar(), '1.16.0')
|
||||
const p = provisioner(feed.fetchImpl)
|
||||
|
||||
await expect(p.ensure('sidecar')).rejects.toThrow()
|
||||
|
|
@ -382,7 +382,7 @@ describe('RuntimeProvisioner', () => {
|
|||
})
|
||||
|
||||
it('다운로드가 끝나면 임시 폴더를 남기지 않는다', async () => {
|
||||
const feed = feedFor(sidecarTar('1.9.0'), '1.9.0')
|
||||
const feed = feedFor(sidecarTar('1.16.0'), '1.16.0')
|
||||
await provisioner(feed.fetchImpl).ensure('sidecar')
|
||||
expect(existsSync(join(workDir, 'runtime', '.download-sidecar'))).toBe(false)
|
||||
expect(existsSync(join(workDir, 'runtime', 'sidecar.staging'))).toBe(false)
|
||||
|
|
|
|||
100
apps/desktop/tests/red/meeting-import.usecase.test.ts
Normal file
100
apps/desktop/tests/red/meeting-import.usecase.test.ts
Normal file
|
|
@ -0,0 +1,100 @@
|
|||
import fs from 'fs'
|
||||
import os from 'os'
|
||||
import path from 'path'
|
||||
import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'
|
||||
import type { FileTranscriptionResult } from '@d3ro/core/types'
|
||||
import { ErrorCode } from '@d3ro/core/errors'
|
||||
import { getMeetingModeService } from '../../src/main/services/MeetingModeService'
|
||||
import { getFileTranscriptionService } from '../../src/main/services/FileTranscriptionService'
|
||||
import { getHistoryService } from '../../src/main/services/HistoryService'
|
||||
import { localAudioPath } from '../../src/main/services/sync/audio-sync'
|
||||
import { emitAccountScopeChanged, LOCAL_SCOPE_ID } from '../../src/main/services/account-scope'
|
||||
import { useRedHarness } from './harness'
|
||||
|
||||
useRedHarness()
|
||||
|
||||
function transcription(filePath: string, fullText = '가져온 회의 전사'): FileTranscriptionResult {
|
||||
return {
|
||||
jobId: 'job-1',
|
||||
filePath,
|
||||
fileName: path.basename(filePath),
|
||||
fullText,
|
||||
segments: [{ text: fullText, start: 0, end: 3, confidence: 1 }],
|
||||
totalDurationSec: 3,
|
||||
processingTimeMs: 25,
|
||||
}
|
||||
}
|
||||
|
||||
describe('기존 녹음 파일을 회의로 가져오기', () => {
|
||||
let sourcePath: string
|
||||
|
||||
beforeEach(() => {
|
||||
sourcePath = path.join(os.tmpdir(), `d3ro-meeting-import-${Date.now()}.mp3`)
|
||||
fs.writeFileSync(sourcePath, 'normalized-audio')
|
||||
})
|
||||
|
||||
afterEach(() => {
|
||||
emitAccountScopeChanged(LOCAL_SCOPE_ID)
|
||||
fs.rmSync(sourcePath, { force: true })
|
||||
})
|
||||
|
||||
it('일반 기록 중복 없이 회의·타임스탬프 전사·재생용 WAV를 저장한다', async () => {
|
||||
const historyCreate = vi.spyOn(getHistoryService(), 'create')
|
||||
const transcribe = vi.spyOn(getFileTranscriptionService(), 'startTranscription')
|
||||
.mockImplementation(async (filePath, _language, options) => {
|
||||
await options?.onConverted?.(filePath)
|
||||
return transcription(filePath)
|
||||
})
|
||||
|
||||
const detail = await getMeetingModeService().importRecording(sourcePath, 'ko')
|
||||
|
||||
expect(detail.title).toBe(path.basename(sourcePath, '.mp3'))
|
||||
expect(detail.status).toBe('completed')
|
||||
expect(detail.rawTranscript).toBe('[00:00] 가져온 회의 전사')
|
||||
expect(detail.durationMs).toBe(3_000)
|
||||
expect(transcribe).toHaveBeenCalledWith(sourcePath, 'ko', {
|
||||
saveToHistory: false,
|
||||
onConverted: expect.any(Function),
|
||||
})
|
||||
expect(historyCreate).not.toHaveBeenCalled()
|
||||
const storedAudio = localAudioPath('meeting', detail.id)
|
||||
expect(storedAudio).not.toBeNull()
|
||||
expect(fs.readFileSync(storedAudio!, 'utf8')).toBe('normalized-audio')
|
||||
expect(getMeetingModeService().getSessions(1, 20).total).toBe(1)
|
||||
})
|
||||
|
||||
it('빈 전사는 완료된 회의나 오디오로 남기지 않는다', async () => {
|
||||
vi.spyOn(getFileTranscriptionService(), 'startTranscription')
|
||||
.mockImplementation(async (filePath, _language, options) => {
|
||||
await options?.onConverted?.(filePath)
|
||||
return transcription(filePath, '')
|
||||
})
|
||||
|
||||
await expect(getMeetingModeService().importRecording(sourcePath)).rejects.toThrow('발화가 없습니다')
|
||||
expect(getMeetingModeService().getSessions(1, 20).total).toBe(0)
|
||||
})
|
||||
|
||||
it.each(['before-copy', 'after-copy', 'round-trip'] as const)(
|
||||
'가져오기 중 계정이 바뀌면 저장하지 않고 임시 오디오를 정리한다 (%s)',
|
||||
async (timing) => {
|
||||
const copy = vi.spyOn(fs.promises, 'copyFile')
|
||||
vi.spyOn(getFileTranscriptionService(), 'startTranscription')
|
||||
.mockImplementation(async (filePath, _language, options) => {
|
||||
if (timing === 'before-copy') emitAccountScopeChanged('other-account')
|
||||
await options?.onConverted?.(filePath)
|
||||
if (timing !== 'before-copy') emitAccountScopeChanged('other-account')
|
||||
if (timing === 'round-trip') emitAccountScopeChanged(LOCAL_SCOPE_ID)
|
||||
return transcription(filePath)
|
||||
})
|
||||
|
||||
await expect(getMeetingModeService().importRecording(sourcePath)).rejects.toMatchObject({
|
||||
code: ErrorCode.FileTranscriptionCancelled,
|
||||
})
|
||||
expect(getMeetingModeService().getSessions(1, 20).total).toBe(0)
|
||||
for (const [, destination] of copy.mock.calls) {
|
||||
expect(fs.existsSync(destination)).toBe(false)
|
||||
}
|
||||
if (timing === 'before-copy') expect(copy).not.toHaveBeenCalled()
|
||||
},
|
||||
)
|
||||
})
|
||||
31
apps/desktop/tests/unit/meeting-imported-recording.test.ts
Normal file
31
apps/desktop/tests/unit/meeting-imported-recording.test.ts
Normal file
|
|
@ -0,0 +1,31 @@
|
|||
import { describe, expect, it } from 'vitest'
|
||||
import { buildImportedMeetingTranscript } from '../../src/main/services/meeting/imported-recording'
|
||||
|
||||
describe('가져온 녹음의 회의 전사 변환', () => {
|
||||
it('파일 이름을 회의 제목으로 쓰고 STT 구간을 상대 시각 전사로 바꾼다', () => {
|
||||
expect(buildImportedMeetingTranscript({
|
||||
fileName: '주간 제품 회의.mp4',
|
||||
fullText: '첫 발언 두 번째 발언',
|
||||
totalDurationSec: 65.4,
|
||||
segments: [
|
||||
{ text: ' 첫 발언 ', start: 1.25, end: 4, confidence: 0.9 },
|
||||
{ text: '두 번째 발언', start: 61, end: 65, confidence: 0.8 },
|
||||
],
|
||||
})).toEqual({
|
||||
title: '주간 제품 회의',
|
||||
rawTranscript: '[00:01] 첫 발언\n[01:01] 두 번째 발언',
|
||||
durationMs: 65_400,
|
||||
})
|
||||
})
|
||||
|
||||
it('구간 정보가 없으면 원문을 보존한다', () => {
|
||||
const result = buildImportedMeetingTranscript({
|
||||
fileName: 'memo.wav',
|
||||
fullText: ' 전사 원문 ',
|
||||
totalDurationSec: 3,
|
||||
segments: [],
|
||||
})
|
||||
expect(result.rawTranscript).toBe('전사 원문')
|
||||
expect(result.durationMs).toBe(3_000)
|
||||
})
|
||||
})
|
||||
|
|
@ -18,6 +18,9 @@ export default defineConfig(({ mode }) => ({
|
|||
exclude: ['tests/e2e/**'],
|
||||
setupFiles: ['tests/setup.ts'],
|
||||
testTimeout: 10000,
|
||||
// Keep the local desktop usable and avoid import-hook starvation on busy, high-core PCs.
|
||||
maxWorkers: 4,
|
||||
minWorkers: 1,
|
||||
coverage: {
|
||||
provider: 'v8',
|
||||
include: ['src/main/services/**'],
|
||||
|
|
|
|||
|
|
@ -354,4 +354,41 @@ describe('meeting metadata creation screen', () => {
|
|||
expect(mockLoadTemplateLibrary).toHaveBeenCalledTimes(1)
|
||||
await act(() => renderer!.unmount())
|
||||
})
|
||||
|
||||
test('creates a meeting and routes an existing recording into the shared import pipeline', async () => {
|
||||
const navigation = {
|
||||
getParent: () => null,
|
||||
navigate: mockNavigate,
|
||||
}
|
||||
let renderer: ReactTestRenderer
|
||||
await act(async () => {
|
||||
renderer = create(<MeetingsScreen navigation={navigation as never} />)
|
||||
})
|
||||
await flush()
|
||||
|
||||
await act(async () => {
|
||||
renderer!.root.findByProps({ testID: 'meetings-import' }).props.onPress()
|
||||
})
|
||||
await flush()
|
||||
await act(async () => {
|
||||
renderer!.root.findByProps({ testID: 'meeting-title-input' }).props.onChangeText('Imported meeting')
|
||||
})
|
||||
await act(async () => {
|
||||
renderer!.root.findByProps({ testID: 'meeting-editor-save' }).props.onPress()
|
||||
await Promise.resolve()
|
||||
})
|
||||
await flush()
|
||||
|
||||
expect(mockNavigate).toHaveBeenCalledWith('Main', {
|
||||
screen: 'Record',
|
||||
params: {
|
||||
meetingId: CREATED_MEETING_ID,
|
||||
meetingTitle: 'Launch review',
|
||||
meetingLanguage: 'en',
|
||||
importRequest: expect.any(Number),
|
||||
},
|
||||
})
|
||||
expect(mockNavigate).not.toHaveBeenCalledWith('MeetingDetail', expect.anything())
|
||||
await act(() => renderer!.unmount())
|
||||
})
|
||||
})
|
||||
|
|
|
|||
78
apps/mobile-rn/__tests__/onboarding-fresh-route.test.tsx
Normal file
78
apps/mobile-rn/__tests__/onboarding-fresh-route.test.tsx
Normal file
|
|
@ -0,0 +1,78 @@
|
|||
import React from 'react'
|
||||
import { act, create, type ReactTestRenderer } from 'react-test-renderer'
|
||||
|
||||
const mockCompleteOnboarding = jest.fn()
|
||||
const mockUpdatePreferences = jest.fn()
|
||||
|
||||
jest.mock('react-native-safe-area-context', () => ({
|
||||
useSafeAreaInsets: () => ({ top: 0, bottom: 0, left: 0, right: 0 }),
|
||||
}))
|
||||
jest.mock('@d3ro/i18n', () => ({
|
||||
useI18n: () => ({
|
||||
locale: 'en',
|
||||
setLocale: jest.fn(),
|
||||
t: (key: string) => key,
|
||||
}),
|
||||
}))
|
||||
jest.mock('../src/lib/auth-context', () => ({
|
||||
useAuth: () => ({ user: null }),
|
||||
}))
|
||||
jest.mock('../src/lib/preferences-context', () => {
|
||||
const { getMobileThemePalette } = jest.requireActual<typeof import('../src/theme/mobile-theme')>(
|
||||
'../src/theme/mobile-theme',
|
||||
)
|
||||
return {
|
||||
useMobilePreferences: () => ({
|
||||
preferences: { themeMode: 'dark' },
|
||||
palette: getMobileThemePalette('dark'),
|
||||
syncStatus: 'local',
|
||||
errorCode: null,
|
||||
updatePreferences: mockUpdatePreferences,
|
||||
completeOnboarding: mockCompleteOnboarding,
|
||||
}),
|
||||
}
|
||||
})
|
||||
|
||||
import OnboardingScreen from '../src/screens/OnboardingScreen'
|
||||
|
||||
async function press(renderer: ReactTestRenderer, testID: string): Promise<void> {
|
||||
await act(async () => {
|
||||
renderer.root.findByProps({ testID }).props.onPress()
|
||||
await Promise.resolve()
|
||||
})
|
||||
}
|
||||
|
||||
describe('fresh onboarding auth route preparation', () => {
|
||||
beforeEach(() => {
|
||||
jest.clearAllMocks()
|
||||
mockUpdatePreferences.mockResolvedValue({ localSaved: true, serverSynced: false })
|
||||
mockCompleteOnboarding.mockResolvedValue({ localSaved: true, serverSynced: false })
|
||||
})
|
||||
|
||||
test('prepares the new-account route before persistence starts', async () => {
|
||||
const events: string[] = []
|
||||
mockCompleteOnboarding.mockImplementation(async () => {
|
||||
events.push('persist')
|
||||
return { localSaved: true, serverSynced: false }
|
||||
})
|
||||
let renderer: ReactTestRenderer | undefined
|
||||
await act(async () => {
|
||||
renderer = create(
|
||||
<OnboardingScreen
|
||||
navigation={{ canGoBack: () => false, goBack: jest.fn() } as never}
|
||||
route={{ params: undefined } as never}
|
||||
onFreshFinish={(audience) => events.push(`route:${audience}`)}
|
||||
/>,
|
||||
)
|
||||
})
|
||||
if (renderer === undefined) throw new Error('Onboarding did not render')
|
||||
|
||||
await press(renderer, 'onboarding-audience-new')
|
||||
for (let step = 0; step < 4; step += 1) {
|
||||
await press(renderer, 'onboarding-next')
|
||||
}
|
||||
await press(renderer, 'onboarding-complete')
|
||||
|
||||
expect(events).toEqual(['route:new', 'persist'])
|
||||
})
|
||||
})
|
||||
|
|
@ -284,4 +284,31 @@ describe('RecordScreen meeting durability (redteam r2-27)', () => {
|
|||
|
||||
expect(mockPickAudioFile).toHaveBeenCalledTimes(1)
|
||||
})
|
||||
|
||||
test('routes a meeting import request through the durable meeting pipeline', async () => {
|
||||
mockPickAudioFile.mockResolvedValue(validInput())
|
||||
mockEnqueueAudioProcessing.mockResolvedValue({ id: 'item' })
|
||||
mockProcessQueuedAudioNow.mockResolvedValue(meetingResult())
|
||||
const renderer = await render({
|
||||
meetingId: MEETING_ID,
|
||||
meetingLanguage: 'ko',
|
||||
importRequest: 1700000000000,
|
||||
}, jest.fn())
|
||||
|
||||
await act(async () => {
|
||||
await Promise.resolve()
|
||||
await Promise.resolve()
|
||||
await Promise.resolve()
|
||||
})
|
||||
|
||||
expect(mockPickAudioFile).toHaveBeenCalledTimes(1)
|
||||
expect(mockEnqueueAudioProcessing).toHaveBeenCalledWith(expect.objectContaining({
|
||||
fileName: 'capture.wav',
|
||||
}), {
|
||||
userId: USER_ID,
|
||||
languageCode: 'ko',
|
||||
meetingId: MEETING_ID,
|
||||
})
|
||||
expect(has(renderer, 'record-view-meeting')).toBe(true)
|
||||
})
|
||||
})
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
module.exports = {
|
||||
preset: '@react-native/jest-preset',
|
||||
// Bound parallel transforms on busy developer PCs; preserve the default test timeout.
|
||||
maxWorkers: 4,
|
||||
transformIgnorePatterns: [
|
||||
'node_modules/(?!((jest-)?react-native(-.*)?|@react-native(-community)?|@react-native-documents|@react-navigation)/)',
|
||||
],
|
||||
|
|
|
|||
|
|
@ -39,6 +39,7 @@ interface MeetingsScreenProps {
|
|||
|
||||
type EditorMode =
|
||||
| { kind: 'create' }
|
||||
| { kind: 'import' }
|
||||
| { kind: 'edit'; meeting: Meeting }
|
||||
| null
|
||||
|
||||
|
|
@ -205,8 +206,8 @@ export default function MeetingsScreen({
|
|||
}
|
||||
}
|
||||
|
||||
const openCreate = (): void => {
|
||||
setEditor({ kind: 'create' })
|
||||
const openCreate = (kind: 'create' | 'import' = 'create'): void => {
|
||||
setEditor({ kind })
|
||||
setEditorTitle('')
|
||||
setEditorAttendees('')
|
||||
setEditorLanguage('ko')
|
||||
|
|
@ -222,7 +223,7 @@ export default function MeetingsScreen({
|
|||
void loadCreationTemplates()
|
||||
}
|
||||
|
||||
openCreateRef.current = openCreate
|
||||
openCreateRef.current = () => openCreate('create')
|
||||
|
||||
useEffect(() => {
|
||||
const request = route?.params?.createRequest
|
||||
|
|
@ -252,11 +253,12 @@ export default function MeetingsScreen({
|
|||
|
||||
const saveEditor = async (): Promise<void> => {
|
||||
if (user === null || editor === null || editorBusyRef.current) return
|
||||
const mode = editor
|
||||
editorBusyRef.current = true
|
||||
setEditorBusy(true)
|
||||
setEditorError(null)
|
||||
try {
|
||||
if (editor.kind === 'create') {
|
||||
if (mode.kind === 'create' || mode.kind === 'import') {
|
||||
if (editorCreationKey === null) {
|
||||
throw new MeetingServiceError('validation', 'Meeting creation key is unavailable')
|
||||
}
|
||||
|
|
@ -274,9 +276,22 @@ export default function MeetingsScreen({
|
|||
setMeetings((current) => mergeMeetings([created], current))
|
||||
setTotal((current) => current + 1)
|
||||
setEditor(null)
|
||||
openDetail(created)
|
||||
if (mode.kind === 'import') {
|
||||
const target = navigation.getParent() ?? navigation
|
||||
target.navigate('Main', {
|
||||
screen: 'Record',
|
||||
params: {
|
||||
meetingId: created.id,
|
||||
meetingTitle: created.title ?? undefined,
|
||||
meetingLanguage: created.language ?? undefined,
|
||||
importRequest: Date.now(),
|
||||
},
|
||||
})
|
||||
} else {
|
||||
openDetail(created)
|
||||
}
|
||||
} else {
|
||||
const updated = await updateMeetingTitleRevisionSafe(editor.meeting, editorTitle)
|
||||
const updated = await updateMeetingTitleRevisionSafe(mode.meeting, editorTitle)
|
||||
setMeetings((current) => current.map((meeting) => (
|
||||
meeting.id === updated.id ? updated : meeting
|
||||
)))
|
||||
|
|
@ -330,11 +345,19 @@ export default function MeetingsScreen({
|
|||
subtitle={t('mobile.meetings.count', { count: total })}
|
||||
showBack={false}
|
||||
rightContent={(
|
||||
<ThemeButton
|
||||
label={t('mobile.meetings.create')}
|
||||
onPress={openCreate}
|
||||
testID="meetings-create"
|
||||
/>
|
||||
<View style={styles.headerActions}>
|
||||
<ThemeButton
|
||||
label={t('mobile.meetings.import')}
|
||||
variant="secondary"
|
||||
onPress={() => openCreate('import')}
|
||||
testID="meetings-import"
|
||||
/>
|
||||
<ThemeButton
|
||||
label={t('mobile.meetings.create')}
|
||||
onPress={() => openCreate('create')}
|
||||
testID="meetings-create"
|
||||
/>
|
||||
</View>
|
||||
)}
|
||||
testID="meetings-header"
|
||||
/>
|
||||
|
|
@ -481,7 +504,9 @@ export default function MeetingsScreen({
|
|||
<ThemeText variant="title" accessibilityRole="header">
|
||||
{editor?.kind === 'create'
|
||||
? t('mobile.meetings.createTitle')
|
||||
: t('mobile.meetings.editTitle')}
|
||||
: editor?.kind === 'import'
|
||||
? t('mobile.meetings.importTitle')
|
||||
: t('mobile.meetings.editTitle')}
|
||||
</ThemeText>
|
||||
<TextInput
|
||||
accessibilityLabel={t('mobile.meetings.titleLabel')}
|
||||
|
|
@ -496,7 +521,7 @@ export default function MeetingsScreen({
|
|||
style={styles.editorInput}
|
||||
testID="meeting-title-input"
|
||||
/>
|
||||
{editor?.kind === 'create' && (
|
||||
{(editor?.kind === 'create' || editor?.kind === 'import') && (
|
||||
<View style={styles.creationFields}>
|
||||
<View style={styles.fieldGroup}>
|
||||
<ThemeText variant="label" color="muted">
|
||||
|
|
@ -619,7 +644,9 @@ export default function MeetingsScreen({
|
|||
)}
|
||||
</View>
|
||||
<ThemeText variant="small" color="muted">
|
||||
{t('mobile.meetings.createNotice')}
|
||||
{editor.kind === 'import'
|
||||
? t('mobile.meetings.importNotice')
|
||||
: t('mobile.meetings.createNotice')}
|
||||
</ThemeText>
|
||||
</View>
|
||||
)}
|
||||
|
|
@ -649,7 +676,7 @@ export default function MeetingsScreen({
|
|||
disabled={
|
||||
editorBusy
|
||||
|| editorTitle.trim().length === 0
|
||||
|| (editor?.kind === 'create' && (
|
||||
|| ((editor?.kind === 'create' || editor?.kind === 'import') && (
|
||||
editorTemplatesLoading
|
||||
|| editorCreationKey === null
|
||||
))
|
||||
|
|
@ -740,6 +767,7 @@ function createStyles(palette: Palette): ReturnType<typeof StyleSheet.create> {
|
|||
gap: 14,
|
||||
},
|
||||
headerCopy: { flex: 1, gap: 4 },
|
||||
headerActions: { flexDirection: 'row', gap: 8, flexShrink: 0 },
|
||||
searchWrap: { paddingHorizontal: 20, paddingBottom: 12 },
|
||||
searchInput: {
|
||||
minHeight: 48,
|
||||
|
|
|
|||
|
|
@ -146,6 +146,7 @@ export default function OnboardingScreen({
|
|||
async function finish(outcome: 'completed' | 'skipped'): Promise<void> {
|
||||
if (saving) return
|
||||
const selectedAudience = audience ?? 'existing'
|
||||
onFreshFinish?.(selectedAudience)
|
||||
setSaving(true)
|
||||
setLocalSaveFailed(false)
|
||||
const result = await completeOnboarding(outcome)
|
||||
|
|
@ -154,7 +155,6 @@ export default function OnboardingScreen({
|
|||
setSaving(false)
|
||||
return
|
||||
}
|
||||
onFreshFinish?.(selectedAudience)
|
||||
const exit = resolveOnboardingExit(true, user !== null, isReplay, navigation.canGoBack())
|
||||
// Authenticated fresh completion changes the root navigator branch. The
|
||||
// parent observes needsOnboarding true -> false and resets to Main after
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue