import { TEST_TYPE } from '@ringcentral-integration/commons/modules/VolumeInspector'; import { isFirefox } from '@ringcentral-integration/commons/modules/Webphone/webphoneHelper'; import { isSafari } from '@ringcentral-integration/utils'; import { RcSwitch, RcTypography } from '@ringcentral/juno'; import clsx from 'clsx'; import React, { useEffect } from 'react'; import type { FC } from 'react'; import { PageHeader, PageHeaderBack, PageHeaderRemain, PageHeaderTitle, } from '../BackHeader/PageHeader'; import { RingtoneSelection } from '../RingtoneSelection'; import type { AudioSettingsPanelProps } from './AudioSettingsPanel.interface'; import { VolumeTester, AudioDeviceSelect, Section, VolumeSlider, } from './components'; import { t } from './i18n'; import styles from './styles.scss'; export const AudioSettingsPanel: FC = ({ availableInputDevices, availableOutputDevices, availableRingtoneDevices, callVolume, showDangerAlert, className = null, inputDeviceDisabled = false, inputDeviceId, onBackButtonClick, onSave, outputDeviceDisabled = false, ringtoneSelectDisabled = false, outputDeviceId, ringtoneVolume, isAGCEnabled, showAGCEnabled, hasUserMedia, ringtoneDeviceId, handleTestMicroClick, handleTestSpeakerClick, checkAudioAvailable, volumeTestData, fullRingtoneList, selectedRingtoneId, isUploadRingtoneDisabled, enableCustomRingtone, uploadCustomRingtone, updateCurrentRingtone, removeCustomRingtone, }) => { useEffect(() => { checkAudioAvailable(); }, []); const enableTestVolumeAndSource = !(isSafari() || isFirefox()); return (
{t('title')}
{ onSave({ inputDeviceId: deviceId, }); }} /> { handleTestMicroClick(volumeTestData.testState); }} /> {showAGCEnabled && ( {t('autoAdjustMicLevel')} } checked={isAGCEnabled} onChange={(_, checked) => { onSave({ isAGCEnabled: checked, }); }} /> )}
{enableTestVolumeAndSource && ( { onSave({ outputDeviceId: deviceId, }); }} label={t('speakerSource')} /> )} {enableTestVolumeAndSource && ( { handleTestSpeakerClick(volumeTestData.testState); }} /> )} { onSave({ callVolume: volume, }); }} /> {enableTestVolumeAndSource && ( { onSave({ ringtoneDeviceId: deviceId, }); }} label={t('ringtoneSource')} /> )} { onSave({ ringtoneVolume: volume, }); }} />
); };