Fix microphone permission checking for audio recording
See [#5580][0]. [0]: https://github.com/signalapp/Signal-Desktop/pull/5580
This commit is contained in:
parent
1dc353f089
commit
79b3b6408e
8 changed files with 69 additions and 43 deletions
14
ts/util/requestMicrophonePermissions.ts
Normal file
14
ts/util/requestMicrophonePermissions.ts
Normal 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;
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue