Simplify permissions popup IPC

This commit is contained in:
David Sanders 2021-11-05 01:47:32 -07:00
parent c822c45310
commit 50dc534164
7 changed files with 18 additions and 25 deletions

View file

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