diff --git a/ts/RemoteConfig.ts b/ts/RemoteConfig.ts index 5a6ce4b83..f2d28d920 100644 --- a/ts/RemoteConfig.ts +++ b/ts/RemoteConfig.ts @@ -8,7 +8,6 @@ import * as log from './logging/log'; export type ConfigKeyType = | 'desktop.announcementGroup' - | 'desktop.calling.useWindowsAdm2' | 'desktop.canResizeLeftPane.beta' | 'desktop.canResizeLeftPane.production' | 'desktop.clientExpiration' diff --git a/ts/calling/audioDeviceModule.ts b/ts/calling/audioDeviceModule.ts index d88beeb9d..ec977cf31 100644 --- a/ts/calling/audioDeviceModule.ts +++ b/ts/calling/audioDeviceModule.ts @@ -2,8 +2,6 @@ // SPDX-License-Identifier: AGPL-3.0-only import { makeEnumParser } from '../util/enum'; -import { isEnabled } from '../RemoteConfig'; -import { isAlpha, isBeta } from '../util/version'; import * as OS from '../OS'; export enum AudioDeviceModule { @@ -16,19 +14,5 @@ export const parseAudioDeviceModule = makeEnumParser( AudioDeviceModule.Default ); -export function getAudioDeviceModule(): AudioDeviceModule { - if (!OS.isWindows()) { - return AudioDeviceModule.Default; - } - - const appVersion = window.getVersion(); - if ( - isEnabled('desktop.calling.useWindowsAdm2') || - isBeta(appVersion) || - isAlpha(appVersion) - ) { - return AudioDeviceModule.WindowsAdm2; - } - - return AudioDeviceModule.Default; -} +export const getAudioDeviceModule = (): AudioDeviceModule => + OS.isWindows() ? AudioDeviceModule.WindowsAdm2 : AudioDeviceModule.Default; diff --git a/ts/test-both/calling/audioDeviceModule_test.ts b/ts/test-both/calling/audioDeviceModule_test.ts new file mode 100644 index 000000000..a14e83466 --- /dev/null +++ b/ts/test-both/calling/audioDeviceModule_test.ts @@ -0,0 +1,39 @@ +// Copyright 2021 Signal Messenger, LLC +// SPDX-License-Identifier: AGPL-3.0-only + +import { assert } from 'chai'; +import * as sinon from 'sinon'; + +import { + AudioDeviceModule, + getAudioDeviceModule, +} from '../../calling/audioDeviceModule'; + +describe('audio device module', () => { + describe('getAudioDeviceModule', () => { + let sandbox: sinon.SinonSandbox; + + beforeEach(() => { + sandbox = sinon.createSandbox(); + }); + + afterEach(() => { + sandbox.restore(); + }); + + it('returns ADM2 on Windows', () => { + sandbox.stub(process, 'platform').get(() => 'win32'); + assert.strictEqual(getAudioDeviceModule(), AudioDeviceModule.WindowsAdm2); + }); + + it('returns the default module on macOS', () => { + sandbox.stub(process, 'platform').get(() => 'darwin'); + assert.strictEqual(getAudioDeviceModule(), AudioDeviceModule.Default); + }); + + it('returns the default module on Linux', () => { + sandbox.stub(process, 'platform').get(() => 'linux'); + assert.strictEqual(getAudioDeviceModule(), AudioDeviceModule.Default); + }); + }); +});