signal-desktop/ts/util/requestMicrophonePermissions.ts

17 lines
470 B
TypeScript
Raw Normal View History

// Copyright 2021 Signal Messenger, LLC
// SPDX-License-Identifier: AGPL-3.0-only
2021-11-05 08:47:32 +00:00
export async function requestMicrophonePermissions(
forCalling: boolean
): Promise<boolean> {
2023-01-13 00:24:59 +00:00
const microphonePermission = await window.IPC.getMediaPermissions();
if (!microphonePermission) {
2023-01-13 00:24:59 +00:00
await window.IPC.showPermissionsPopup(forCalling, false);
// Check the setting again (from the source of truth).
2023-01-13 00:24:59 +00:00
return window.IPC.getMediaPermissions();
}
return true;
}