Signal-Desktop/ts/util/requestMicrophonePermission...

17 lines
458 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> {
const microphonePermission = await window.getMediaPermissions();
if (!microphonePermission) {
2021-11-05 08:47:32 +00:00
await window.showPermissionsPopup(forCalling, false);
// Check the setting again (from the source of truth).
return window.getMediaPermissions();
}
return true;
}