Fix microphone permission checking for audio recording

See [#5580][0].

[0]: https://github.com/signalapp/Signal-Desktop/pull/5580
This commit is contained in:
David Sanders 2021-10-27 11:16:09 -05:00 committed by Evan Hahn
parent 1dc353f089
commit 79b3b6408e
8 changed files with 69 additions and 43 deletions

View file

@ -0,0 +1,14 @@
// Copyright 2021 Signal Messenger, LLC
// SPDX-License-Identifier: AGPL-3.0-only
export async function requestMicrophonePermissions(): Promise<boolean> {
const microphonePermission = await window.getMediaPermissions();
if (!microphonePermission) {
await window.showCallingPermissionsPopup(false);
// Check the setting again (from the source of truth).
return window.getMediaPermissions();
}
return true;
}