fix(electron): use askForMeetingPermission for asking microphone permission (#11792)

This commit is contained in:
pengx17
2025-04-21 07:37:43 +00:00
parent f87a6e17bd
commit 2bd9cfe20a
4 changed files with 24 additions and 1 deletions

View File

@@ -780,6 +780,13 @@ export const checkMeetingPermissions = () => {
) as Record<(typeof mediaTypes)[number], boolean>;
};
export const askForMeetingPermission = async (type: 'microphone') => {
if (!isMacOS()) {
return false;
}
return systemPreferences.askForMediaAccess(type);
};
export const checkCanRecordMeeting = () => {
const features = checkMeetingPermissions();
return (

View File

@@ -9,6 +9,7 @@ import { shell } from 'electron';
import { isMacOS } from '../../shared/utils';
import type { NamespaceHandlers } from '../type';
import {
askForMeetingPermission,
checkMeetingPermissions,
checkRecordingAvailable,
disableRecordingFeature,
@@ -76,6 +77,9 @@ export const recordingHandlers = {
checkMeetingPermissions: async () => {
return checkMeetingPermissions();
},
askForMeetingPermission: async (_, type: 'microphone') => {
return askForMeetingPermission(type);
},
showRecordingPermissionSetting: async (_, type: 'screen' | 'microphone') => {
const urlMap = {
screen: 'Privacy_ScreenCapture',