diff --git a/ts/components/CallManager.tsx b/ts/components/CallManager.tsx index b890ad35a..02450defb 100644 --- a/ts/components/CallManager.tsx +++ b/ts/components/CallManager.tsx @@ -3,6 +3,7 @@ import React, { useCallback, useEffect } from 'react'; import { noop } from 'lodash'; +import type { VideoFrameSource } from 'ringrtc'; import { CallNeedPermissionScreen } from './CallNeedPermissionScreen'; import { CallScreen } from './CallScreen'; import { CallingLobby } from './CallingLobby'; @@ -23,7 +24,6 @@ import { GroupCallJoinState, GroupCallVideoRequest, PresentedSource, - VideoFrameSource, } from '../types/Calling'; import { ConversationType } from '../state/ducks/conversations'; import { diff --git a/ts/components/CallScreen.tsx b/ts/components/CallScreen.tsx index 4e4d9e619..3cf5cd163 100644 --- a/ts/components/CallScreen.tsx +++ b/ts/components/CallScreen.tsx @@ -10,6 +10,7 @@ import React, { } from 'react'; import { noop } from 'lodash'; import classNames from 'classnames'; +import type { VideoFrameSource } from 'ringrtc'; import { HangUpType, SetLocalAudioType, @@ -30,7 +31,6 @@ import { GroupCallJoinState, GroupCallVideoRequest, PresentedSource, - VideoFrameSource, } from '../types/Calling'; import { AvatarColors, AvatarColorType } from '../types/Colors'; import type { ConversationType } from '../state/ducks/conversations'; diff --git a/ts/components/CallingDeviceSelection.tsx b/ts/components/CallingDeviceSelection.tsx index d2442d706..5ec887ee0 100644 --- a/ts/components/CallingDeviceSelection.tsx +++ b/ts/components/CallingDeviceSelection.tsx @@ -1,12 +1,12 @@ -// Copyright 2020 Signal Messenger, LLC +// Copyright 2020-2021 Signal Messenger, LLC // SPDX-License-Identifier: AGPL-3.0-only import * as React from 'react'; +import type { AudioDevice } from 'ringrtc'; import { Modal } from './Modal'; import { LocalizerType } from '../types/Util'; import { - AudioDevice, CallingDeviceType, ChangeIODevicePayloadType, MediaDeviceSettings, diff --git a/ts/components/CallingPip.tsx b/ts/components/CallingPip.tsx index e8b54e0b2..6d40c5eb3 100644 --- a/ts/components/CallingPip.tsx +++ b/ts/components/CallingPip.tsx @@ -3,13 +3,10 @@ import React from 'react'; import { minBy, debounce, noop } from 'lodash'; +import type { VideoFrameSource } from 'ringrtc'; import { CallingPipRemoteVideo } from './CallingPipRemoteVideo'; import { LocalizerType } from '../types/Util'; -import { - ActiveCallType, - GroupCallVideoRequest, - VideoFrameSource, -} from '../types/Calling'; +import type { ActiveCallType, GroupCallVideoRequest } from '../types/Calling'; import { HangUpType, SetLocalPreviewType, diff --git a/ts/components/CallingPipRemoteVideo.tsx b/ts/components/CallingPipRemoteVideo.tsx index 7e136a550..7469af49b 100644 --- a/ts/components/CallingPipRemoteVideo.tsx +++ b/ts/components/CallingPipRemoteVideo.tsx @@ -3,6 +3,7 @@ import React, { useMemo, useEffect } from 'react'; import { maxBy } from 'lodash'; +import type { VideoFrameSource } from 'ringrtc'; import { Avatar } from './Avatar'; import { CallBackgroundBlur } from './CallBackgroundBlur'; import { DirectCallRemoteParticipant } from './DirectCallRemoteParticipant'; @@ -13,7 +14,6 @@ import { CallMode, GroupCallRemoteParticipantType, GroupCallVideoRequest, - VideoFrameSource, } from '../types/Calling'; import { AvatarColors } from '../types/Colors'; import { SetRendererCanvasType } from '../state/ducks/calling'; diff --git a/ts/components/GroupCallOverflowArea.tsx b/ts/components/GroupCallOverflowArea.tsx index 39cac8e83..a11cb5243 100644 --- a/ts/components/GroupCallOverflowArea.tsx +++ b/ts/components/GroupCallOverflowArea.tsx @@ -3,11 +3,9 @@ import React, { useRef, useState, useEffect, FC, ReactElement } from 'react'; import classNames from 'classnames'; +import type { VideoFrameSource } from 'ringrtc'; import { LocalizerType } from '../types/Util'; -import { - GroupCallRemoteParticipantType, - VideoFrameSource, -} from '../types/Calling'; +import type { GroupCallRemoteParticipantType } from '../types/Calling'; import { GroupCallRemoteParticipant } from './GroupCallRemoteParticipant'; const OVERFLOW_SCROLLED_TO_EDGE_THRESHOLD = 20; diff --git a/ts/components/GroupCallRemoteParticipant.tsx b/ts/components/GroupCallRemoteParticipant.tsx index 4d955a2ee..7eaec314d 100644 --- a/ts/components/GroupCallRemoteParticipant.tsx +++ b/ts/components/GroupCallRemoteParticipant.tsx @@ -11,10 +11,8 @@ import React, { } from 'react'; import classNames from 'classnames'; import { noop } from 'lodash'; -import { - GroupCallRemoteParticipantType, - VideoFrameSource, -} from '../types/Calling'; +import type { VideoFrameSource } from 'ringrtc'; +import type { GroupCallRemoteParticipantType } from '../types/Calling'; import { LocalizerType } from '../types/Util'; import { AvatarColors } from '../types/Colors'; import { CallBackgroundBlur } from './CallBackgroundBlur'; diff --git a/ts/components/GroupCallRemoteParticipants.tsx b/ts/components/GroupCallRemoteParticipants.tsx index 76683d5ba..8a90f1086 100644 --- a/ts/components/GroupCallRemoteParticipants.tsx +++ b/ts/components/GroupCallRemoteParticipants.tsx @@ -4,6 +4,7 @@ import React, { useState, useMemo, useEffect } from 'react'; import Measure from 'react-measure'; import { takeWhile, chunk, maxBy, flatten } from 'lodash'; +import type { VideoFrameSource } from 'ringrtc'; import { GroupCallRemoteParticipant } from './GroupCallRemoteParticipant'; import { GroupCallOverflowArea, @@ -12,7 +13,6 @@ import { import { GroupCallRemoteParticipantType, GroupCallVideoRequest, - VideoFrameSource, } from '../types/Calling'; import { useGetCallingFrameBuffer } from '../calling/useGetCallingFrameBuffer'; import { LocalizerType } from '../types/Util'; diff --git a/ts/components/Preferences.tsx b/ts/components/Preferences.tsx index b333e3988..3e6265400 100644 --- a/ts/components/Preferences.tsx +++ b/ts/components/Preferences.tsx @@ -4,8 +4,9 @@ import React, { ReactNode, useEffect, useState, useCallback } from 'react'; import { noop } from 'lodash'; import classNames from 'classnames'; +import type { AudioDevice } from 'ringrtc'; -import { AudioDevice, MediaDeviceSettings } from '../types/Calling'; +import type { MediaDeviceSettings } from '../types/Calling'; import { ZoomFactorType, ThemeSettingType, diff --git a/ts/services/calling.ts b/ts/services/calling.ts index 4fccf05ea..17b712ed6 100644 --- a/ts/services/calling.ts +++ b/ts/services/calling.ts @@ -5,6 +5,7 @@ import { desktopCapturer, ipcRenderer } from 'electron'; import { + AudioDevice, Call, CallEndedReason, CallId, @@ -43,7 +44,6 @@ import { getConversationCallMode } from '../state/ducks/conversations'; import { isConversationTooBigToRing } from '../conversations/isConversationTooBigToRing'; import { isMe } from '../util/whatTypeOfConversation'; import { - AudioDevice, AvailableIODevicesType, CallMode, GroupCallConnectionState, diff --git a/ts/test-both/helpers/fakeGetGroupCallVideoFrameSource.ts b/ts/test-both/helpers/fakeGetGroupCallVideoFrameSource.ts index 8f6dad6be..af7468a9b 100644 --- a/ts/test-both/helpers/fakeGetGroupCallVideoFrameSource.ts +++ b/ts/test-both/helpers/fakeGetGroupCallVideoFrameSource.ts @@ -1,6 +1,7 @@ // Copyright 2021 Signal Messenger, LLC // SPDX-License-Identifier: AGPL-3.0-only -import { VideoFrameSource } from '../../types/Calling'; + +import type { VideoFrameSource } from 'ringrtc'; const COLORS: Array<[number, number, number]> = [ [0xff, 0x00, 0x00], diff --git a/ts/types/Calling.ts b/ts/types/Calling.ts index 04abd1e0d..2baa6c85a 100644 --- a/ts/types/Calling.ts +++ b/ts/types/Calling.ts @@ -1,7 +1,8 @@ // Copyright 2020-2021 Signal Messenger, LLC // SPDX-License-Identifier: AGPL-3.0-only -import { ConversationType } from '../state/ducks/conversations'; +import type { AudioDevice } from 'ringrtc'; +import type { ConversationType } from '../state/ducks/conversations'; // These are strings (1) for the database (2) for Storybook. export enum CallMode { @@ -134,23 +135,6 @@ export type GroupCallVideoRequest = { height: number; }; -// Should match RingRTC's VideoFrameSource -export type VideoFrameSource = { - receiveVideoFrame(buffer: Buffer): [number, number] | undefined; -}; - -// Must be kept in sync with RingRTC.AudioDevice -export type AudioDevice = { - // Device name. - name: string; - // Index of this device, starting from 0. - index: number; - // A unique and somewhat stable identifier of this device. - uniqueId: string; - // If present, the identifier of a localized string to substitute for the device name. - i18nKey?: string; -}; - export enum CallingDeviceType { CAMERA, MICROPHONE, diff --git a/ts/types/Storage.d.ts b/ts/types/Storage.d.ts index 37d876a72..c33327b2a 100644 --- a/ts/types/Storage.d.ts +++ b/ts/types/Storage.d.ts @@ -1,11 +1,11 @@ // Copyright 2020-2021 Signal Messenger, LLC // SPDX-License-Identifier: AGPL-3.0-only +import type { AudioDevice } from 'ringrtc'; import type { CustomColorsItemType, DefaultConversationColorType, } from './Colors'; -import type { AudioDevice } from './Calling'; import type { PhoneNumberDiscoverability } from '../util/phoneNumberDiscoverability'; import type { PhoneNumberSharingMode } from '../util/phoneNumberSharingMode'; import type { RetryItemType } from '../util/retryPlaceholders'; diff --git a/ts/util/createIPCEvents.ts b/ts/util/createIPCEvents.ts index ca220dfe3..875078583 100644 --- a/ts/util/createIPCEvents.ts +++ b/ts/util/createIPCEvents.ts @@ -2,8 +2,8 @@ // SPDX-License-Identifier: AGPL-3.0-only import { webFrame } from 'electron'; +import type { AudioDevice } from 'ringrtc'; -import { AudioDevice } from '../types/Calling'; import { ZoomFactorType } from '../types/Storage.d'; import { DEFAULT_CONVERSATION_COLOR,