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