diff --git a/ts/components/CompositionArea.stories.tsx b/ts/components/CompositionArea.stories.tsx index 39d6df176..bff2499c6 100644 --- a/ts/components/CompositionArea.stories.tsx +++ b/ts/components/CompositionArea.stories.tsx @@ -16,7 +16,7 @@ import { StorybookThemeContext } from '../../.storybook/StorybookThemeContext'; import { fakeDraftAttachment } from '../test-both/helpers/fakeAttachment'; import { landscapeGreenUrl } from '../storybook/Fixtures'; -import { RecordingState } from '../state/ducks/audioRecorder'; +import { RecordingState } from '../types/AudioRecorder'; import { ConversationColors } from '../types/Colors'; import { getDefaultConversation } from '../test-both/helpers/getDefaultConversation'; import { PaymentEventKind } from '../types/Payment'; diff --git a/ts/components/CompositionArea.tsx b/ts/components/CompositionArea.tsx index 0d232f059..eee0da8ae 100644 --- a/ts/components/CompositionArea.tsx +++ b/ts/components/CompositionArea.tsx @@ -9,8 +9,8 @@ import type { LocalizerType, ThemeType, } from '../types/Util'; -import type { ErrorDialogAudioRecorderType } from '../state/ducks/audioRecorder'; -import { RecordingState } from '../state/ducks/audioRecorder'; +import type { ErrorDialogAudioRecorderType } from '../types/AudioRecorder'; +import { RecordingState } from '../types/AudioRecorder'; import type { imageToBlurHash } from '../util/imageToBlurHash'; import { Spinner } from './Spinner'; import type { diff --git a/ts/components/conversation/AudioCapture.stories.tsx b/ts/components/conversation/AudioCapture.stories.tsx index 0d51714d3..6eaaa1b8a 100644 --- a/ts/components/conversation/AudioCapture.stories.tsx +++ b/ts/components/conversation/AudioCapture.stories.tsx @@ -9,7 +9,7 @@ import { select } from '@storybook/addon-knobs'; import { ErrorDialogAudioRecorderType, RecordingState, -} from '../../state/ducks/audioRecorder'; +} from '../../types/AudioRecorder'; import type { PropsType } from './AudioCapture'; import { AudioCapture } from './AudioCapture'; import { setupI18n } from '../../util/setupI18n'; diff --git a/ts/components/conversation/AudioCapture.tsx b/ts/components/conversation/AudioCapture.tsx index cfae45a3e..5ba24412d 100644 --- a/ts/components/conversation/AudioCapture.tsx +++ b/ts/components/conversation/AudioCapture.tsx @@ -11,10 +11,6 @@ import type { } from '../../types/Attachment'; import { ConfirmationDialog } from '../ConfirmationDialog'; import type { LocalizerType } from '../../types/Util'; -import { - ErrorDialogAudioRecorderType, - RecordingState, -} from '../../state/ducks/audioRecorder'; import { ToastVoiceNoteLimit } from '../ToastVoiceNoteLimit'; import { ToastVoiceNoteMustBeOnlyAttachment } from '../ToastVoiceNoteMustBeOnlyAttachment'; import { useEscapeHandling } from '../../hooks/useEscapeHandling'; @@ -22,6 +18,10 @@ import { useStartRecordingShortcut, useKeyboardShortcuts, } from '../../hooks/useKeyboardShortcuts'; +import { + ErrorDialogAudioRecorderType, + RecordingState, +} from '../../types/AudioRecorder'; type OnSendAudioRecordingType = (rec: InMemoryAttachmentDraftType) => unknown; diff --git a/ts/state/ducks/audioRecorder.ts b/ts/state/ducks/audioRecorder.ts index 6b66e3eef..8939a5324 100644 --- a/ts/state/ducks/audioRecorder.ts +++ b/ts/state/ducks/audioRecorder.ts @@ -14,21 +14,13 @@ import { stringToMIMEType } from '../../types/MIME'; import type { BoundActionCreatorsMapObject } from '../../hooks/useBoundActions'; import { useBoundActions } from '../../hooks/useBoundActions'; import { getComposerStateForConversation } from './composer'; - -export enum ErrorDialogAudioRecorderType { - Blur, - ErrorRecording, - Timeout, -} +import { + ErrorDialogAudioRecorderType, + RecordingState, +} from '../../types/AudioRecorder'; // State -export enum RecordingState { - Recording = 'recording', - Initializing = 'initializing', - Idle = 'idle', -} - export type AudioPlayerStateType = ReadonlyDeep<{ recordingState: RecordingState; errorDialogAudioRecorderType?: ErrorDialogAudioRecorderType; diff --git a/ts/state/ducks/composer.ts b/ts/state/ducks/composer.ts index 0f76a2384..e22586184 100644 --- a/ts/state/ducks/composer.ts +++ b/ts/state/ducks/composer.ts @@ -34,7 +34,7 @@ import { REMOVE_PREVIEW as REMOVE_LINK_PREVIEW, } from './linkPreviews'; import { LinkPreviewSourceType } from '../../types/LinkPreview'; -import { RecordingState } from './audioRecorder'; +import { RecordingState } from '../../types/AudioRecorder'; import { SHOW_TOAST } from './toast'; import { ToastType } from '../../types/Toast'; import { SafetyNumberChangeSource } from '../../components/SafetyNumberChangeDialog'; diff --git a/ts/types/AudioRecorder.ts b/ts/types/AudioRecorder.ts new file mode 100644 index 000000000..5ec12d198 --- /dev/null +++ b/ts/types/AudioRecorder.ts @@ -0,0 +1,14 @@ +// Copyright 2023 Signal Messenger, LLC +// SPDX-License-Identifier: AGPL-3.0-only + +export enum ErrorDialogAudioRecorderType { + Blur, + ErrorRecording, + Timeout, +} + +export enum RecordingState { + Recording = 'recording', + Initializing = 'initializing', + Idle = 'idle', +}