fix(settings): stop auto-requesting devices, warn when none (#2398)

This commit is contained in:
Hampus authored and GitHub committed 2026-09-02 17:36:49 +02:00
1 parent f98a74170a
commit d8e0c2ec20
37 files changed
+622 -332

No files matched your search

@@ -99,7 +99,7 @@ interface VideoTabProps {
}
export const VideoTab: React.FC<VideoTabProps> = observer(
({voiceSettings, hasPremium: _hasPremium, autoRequestPermission = true}) => {
({voiceSettings, hasPremium: _hasPremium, autoRequestPermission = false}) => {
const {i18n} = useLingui();
const {videoDeviceId, cameraResolution, mirrorCamera, screenshareResolution, videoFrameRate} = voiceSettings;
const hasHigherQuality = isLimitToggleEnabled(
@@ -205,7 +205,7 @@ export const VideoTab: React.FC<VideoTabProps> = observer(
}, []);
return (
<div className={styles.content} data-flx="user.video-tab.content">
{devices.length === 0 && permissionStatus !== 'loading' && permissionStatus !== 'granted' ? (
{devices.length === 0 && permissionStatus !== 'loading' ? (
<div className={styles.deviceNotice} data-flx="user.video-tab.device-notice">
<div className={styles.deviceNoticeText} data-flx="user.video-tab.device-notice-text">
<div className={styles.deviceNoticeTitle} data-flx="user.video-tab.device-notice-title">
@@ -217,21 +217,25 @@ export const VideoTab: React.FC<VideoTabProps> = observer(
Allow {PRODUCT_NAME} to access your camera in {MACOS_SYSTEM_SETTINGS_NAME} →{' '}
{MACOS_PRIVACY_AND_SECURITY_SETTINGS_NAME} → {MACOS_CAMERA_PERMISSION_NAME}.
</Trans>
) : permissionStatus === 'granted' ? (
<Trans>Connect a camera and try again.</Trans>
) : (
i18n._(PRODUCT_NEEDS_CAMERA_ACCESS_DESCRIPTOR, {productName: PRODUCT_NAME})
)}
</p>
</div>
<Button
variant="secondary"
small={true}
onClick={() => {
void requestPermission();
}}
data-flx="user.video-tab.button"
>
<Trans>Allow camera</Trans>
</Button>
{permissionStatus !== 'granted' ? (
<Button
variant="secondary"
small={true}
onClick={() => {
void requestPermission();
}}
data-flx="user.video-tab.button"
>
<Trans>Allow camera</Trans>
</Button>
) : null}
</div>
) : null}
<div className={styles.controlGroup} data-flx="user.video-tab.camera-settings-group">
@@ -202,7 +202,7 @@ function resolveNoiseSuppressionMethod(deepFilterEnabled: boolean, browserNsEnab
return 'none';
}
export const VoiceTab: React.FC<VoiceTabProps> = observer(({voiceSettings, autoRequestPermission = true}) => {
export const VoiceTab: React.FC<VoiceTabProps> = observer(({voiceSettings, autoRequestPermission = false}) => {
const {i18n} = useLingui();
const {
inputDeviceId,
@@ -517,7 +517,7 @@ export const VoiceTab: React.FC<VoiceTabProps> = observer(({voiceSettings, autoR
return (
<>
<SettingsTabSection title={i18n._(INPUT_AND_OUTPUT_DESCRIPTOR)} data-flx="user.voice-tab.devices-section">
{devices.length === 0 && permissionStatus !== 'loading' && permissionStatus !== 'granted' ? (
{inputDevices.length === 0 && permissionStatus !== 'loading' ? (
<div className={styles.deviceNotice} data-flx="user.voice-tab.device-notice">
<div className={styles.deviceNoticeText} data-flx="user.voice-tab.device-notice-text">
<div className={styles.deviceNoticeTitle} data-flx="user.voice-tab.device-notice-title">
@@ -535,21 +535,25 @@ export const VoiceTab: React.FC<VoiceTabProps> = observer(({voiceSettings, autoR
Allow {PRODUCT_NAME} to access your microphone. Check your browser's address bar or settings.
</Trans>
)
) : permissionStatus === 'granted' ? (
<Trans>Connect a microphone and try again.</Trans>
) : (
i18n._(PRODUCT_NEEDS_MICROPHONE_ACCESS_DESCRIPTOR, {productName: PRODUCT_NAME})
)}
</p>
</div>
<Button
variant="secondary"
small={true}
onClick={() => {
void requestPermission();
}}
data-flx="user.voice-tab.button"
>
<Trans>Allow microphone</Trans>
</Button>
{permissionStatus !== 'granted' ? (
<Button
variant="secondary"
small={true}
onClick={() => {
void requestPermission();
}}
data-flx="user.voice-tab.button"
>
<Trans>Allow microphone</Trans>
</Button>
) : null}
</div>
) : null}
<CompactComboboxRow
@@ -25,10 +25,20 @@ const VoiceVideoTab: React.FC = observer(() => {
<SettingsTabContainer data-flx="user.voice-video-tab.settings-tab-container">
<SettingsTabContent data-flx="user.voice-video-tab.settings-tab-content">
<SettingsSection id="audio" title={i18n._(AUDIO_DESCRIPTOR)} data-flx="user.voice-video-tab.audio">
<VoiceTab voiceSettings={voiceSettings} hasPremium={hasPremium} data-flx="user.voice-video-tab.voice-tab" />
<VoiceTab
voiceSettings={voiceSettings}
hasPremium={hasPremium}
autoRequestPermission={false}
data-flx="user.voice-video-tab.voice-tab"
/>
</SettingsSection>
<SettingsSection id="video" title={i18n._(VIDEO_DESCRIPTOR)} data-flx="user.voice-video-tab.video">
<VideoTab voiceSettings={voiceSettings} hasPremium={hasPremium} data-flx="user.voice-video-tab.video-tab" />
<VideoTab
voiceSettings={voiceSettings}
hasPremium={hasPremium}
autoRequestPermission={false}
data-flx="user.voice-video-tab.video-tab"
/>
</SettingsSection>
</SettingsTabContent>
</SettingsTabContainer>