diff --git a/.gitignore b/.gitignore index 6ee3e11..94c1776 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,5 @@ dist node_modules .env +.DS_Store +.idea/ diff --git a/package.json b/package.json index 1d3c109..284f1c3 100644 --- a/package.json +++ b/package.json @@ -93,7 +93,13 @@ ] } ], - "category": "Network" + "category": "Network", + "extendInfo": { + "NSMicrophoneUsageDescription": "Vencord Desktop needs access to your microphone in order to transmit data in a voice chat", + "NSCameraUsageDescription": "Vencord Desktop needs access to your camera in order to transmit data in a video call", + "com.apple.security.device.audio-input": true, + "com.apple.security.device.camera": true + } }, "nsis": { "include": "build/installer.nsh", diff --git a/src/main/index.ts b/src/main/index.ts index 10552f2..47c71b0 100644 --- a/src/main/index.ts +++ b/src/main/index.ts @@ -6,7 +6,7 @@ import "./ipc"; -import { app, BrowserWindow } from "electron"; +import {app, BrowserWindow, systemPreferences} from "electron"; import { checkUpdates } from "updater/main"; import { DATA_DIR } from "./constants"; @@ -50,6 +50,14 @@ function init() { registerScreenShareHandler(); bootstrap(); + + //TODO we should only ask these permissions when the user joins a voice chat/video call for the first time + //TODO we should also handle the granted result respectively. How does this official client handle permissions? + systemPreferences.askForMediaAccess('microphone') + .then((granted) => console.log(`microphone permission granted: ${granted}`)); + systemPreferences.askForMediaAccess('camera') + .then((granted) => console.log(`camera permission granted: ${granted}`)); //TODO we should only ask this permission when the user joins a video call for the first time + app.on("activate", () => { if (BrowserWindow.getAllWindows().length === 0) createWindows();