add permission requests to macOS builds
This commit is contained in:
parent
94ba59afb5
commit
c38eb161eb
3 changed files with 18 additions and 2 deletions
2
.gitignore
vendored
2
.gitignore
vendored
|
@ -1,3 +1,5 @@
|
|||
dist
|
||||
node_modules
|
||||
.env
|
||||
.DS_Store
|
||||
.idea/
|
||||
|
|
|
@ -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",
|
||||
|
|
|
@ -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();
|
||||
|
|
Reference in a new issue