fix(electron): use askForMeetingPermission for asking microphone permission (#11792)
This commit is contained in:
@@ -780,6 +780,13 @@ export const checkMeetingPermissions = () => {
|
|||||||
) as Record<(typeof mediaTypes)[number], boolean>;
|
) as Record<(typeof mediaTypes)[number], boolean>;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
export const askForMeetingPermission = async (type: 'microphone') => {
|
||||||
|
if (!isMacOS()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return systemPreferences.askForMediaAccess(type);
|
||||||
|
};
|
||||||
|
|
||||||
export const checkCanRecordMeeting = () => {
|
export const checkCanRecordMeeting = () => {
|
||||||
const features = checkMeetingPermissions();
|
const features = checkMeetingPermissions();
|
||||||
return (
|
return (
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ import { shell } from 'electron';
|
|||||||
import { isMacOS } from '../../shared/utils';
|
import { isMacOS } from '../../shared/utils';
|
||||||
import type { NamespaceHandlers } from '../type';
|
import type { NamespaceHandlers } from '../type';
|
||||||
import {
|
import {
|
||||||
|
askForMeetingPermission,
|
||||||
checkMeetingPermissions,
|
checkMeetingPermissions,
|
||||||
checkRecordingAvailable,
|
checkRecordingAvailable,
|
||||||
disableRecordingFeature,
|
disableRecordingFeature,
|
||||||
@@ -76,6 +77,9 @@ export const recordingHandlers = {
|
|||||||
checkMeetingPermissions: async () => {
|
checkMeetingPermissions: async () => {
|
||||||
return checkMeetingPermissions();
|
return checkMeetingPermissions();
|
||||||
},
|
},
|
||||||
|
askForMeetingPermission: async (_, type: 'microphone') => {
|
||||||
|
return askForMeetingPermission(type);
|
||||||
|
},
|
||||||
showRecordingPermissionSetting: async (_, type: 'screen' | 'microphone') => {
|
showRecordingPermissionSetting: async (_, type: 'screen' | 'microphone') => {
|
||||||
const urlMap = {
|
const urlMap = {
|
||||||
screen: 'Privacy_ScreenCapture',
|
screen: 'Privacy_ScreenCapture',
|
||||||
|
|||||||
@@ -210,7 +210,13 @@ export const MeetingsSettings = () => {
|
|||||||
|
|
||||||
const handleOpenMicrophoneRecordingPermissionSetting =
|
const handleOpenMicrophoneRecordingPermissionSetting =
|
||||||
useAsyncCallback(async () => {
|
useAsyncCallback(async () => {
|
||||||
await meetingSettingsService.showRecordingPermissionSetting('microphone');
|
const result =
|
||||||
|
await meetingSettingsService.askForMeetingPermission('microphone');
|
||||||
|
if (!result) {
|
||||||
|
await meetingSettingsService.showRecordingPermissionSetting(
|
||||||
|
'microphone'
|
||||||
|
);
|
||||||
|
}
|
||||||
}, [meetingSettingsService]);
|
}, [meetingSettingsService]);
|
||||||
|
|
||||||
const handleOpenSavedRecordings = useAsyncCallback(async () => {
|
const handleOpenSavedRecordings = useAsyncCallback(async () => {
|
||||||
|
|||||||
@@ -114,6 +114,12 @@ export class MeetingSettingsService extends Service {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async askForMeetingPermission(type: 'microphone') {
|
||||||
|
return this.desktopApiService?.handler.recording.askForMeetingPermission(
|
||||||
|
type
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
setRecordingMode = (mode: MeetingSettingsSchema['recordingMode']) => {
|
setRecordingMode = (mode: MeetingSettingsSchema['recordingMode']) => {
|
||||||
const currentMode = this.settings.recordingMode;
|
const currentMode = this.settings.recordingMode;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user