[MM-46980] Improve screensharing permissions flow (#2556)
* Little improvements and simplification * Improve MacOS screen permissions handling flow * Add missing error event * Propagate calls client errors (#2557)
This commit is contained in:
@@ -5,6 +5,11 @@
|
||||
import path from 'path';
|
||||
import fs from 'fs';
|
||||
|
||||
import {exec as execOriginal} from 'child_process';
|
||||
|
||||
import {promisify} from 'util';
|
||||
const exec = promisify(execOriginal);
|
||||
|
||||
import {app, BrowserWindow} from 'electron';
|
||||
|
||||
import {Args} from 'types/args';
|
||||
@@ -136,3 +141,19 @@ export function shouldIncrementFilename(filepath: string, increment = 0): string
|
||||
}
|
||||
return filename;
|
||||
}
|
||||
|
||||
export function resetScreensharePermissionsMacOS() {
|
||||
if (process.platform !== 'darwin') {
|
||||
return Promise.resolve();
|
||||
}
|
||||
return exec('tccutil reset ScreenCapture Mattermost.Desktop',
|
||||
{timeout: 1000});
|
||||
}
|
||||
|
||||
export function openScreensharePermissionsSettingsMacOS() {
|
||||
if (process.platform !== 'darwin') {
|
||||
return Promise.resolve();
|
||||
}
|
||||
return exec('open "x-apple.systempreferences:com.apple.preference.security?Privacy_ScreenCapture"',
|
||||
{timeout: 1000});
|
||||
}
|
||||
|
Reference in New Issue
Block a user