mirror of
https://github.com/finos/SymphonyElectron.git
synced 2025-02-25 18:55:29 -06:00
sda-1826 Add new check-media-permission
This commit is contained in:
parent
e29e76f558
commit
5d01f37ea1
@ -36,6 +36,7 @@ export enum apiCmds {
|
|||||||
getConfigUrl = 'get-config-url',
|
getConfigUrl = 'get-config-url',
|
||||||
registerRestartFloater = 'register-restart-floater',
|
registerRestartFloater = 'register-restart-floater',
|
||||||
setCloudConfig = 'set-cloud-config',
|
setCloudConfig = 'set-cloud-config',
|
||||||
|
checkMediaPermission = 'check-media-permission',
|
||||||
}
|
}
|
||||||
|
|
||||||
export enum apiName {
|
export enum apiName {
|
||||||
@ -144,6 +145,12 @@ export interface IVersionInfo {
|
|||||||
searchApiVer: string;
|
searchApiVer: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export interface IMediaPermission {
|
||||||
|
camera: string;
|
||||||
|
microphone: string;
|
||||||
|
screen: string;
|
||||||
|
}
|
||||||
|
|
||||||
export interface ILogMsg {
|
export interface ILogMsg {
|
||||||
level: LogLevel;
|
level: LogLevel;
|
||||||
details: any;
|
details: any;
|
||||||
|
@ -143,6 +143,22 @@
|
|||||||
<button id='bring-to-front'>bring window to front</button>
|
<button id='bring-to-front'>bring window to front</button>
|
||||||
<button id='bring-to-front-without-focus'>bring to front without focus</button>
|
<button id='bring-to-front-without-focus'>bring to front without focus</button>
|
||||||
|
|
||||||
|
<hr>
|
||||||
|
<p>Check Media Permission:</p>
|
||||||
|
<button id='check-media-permission'>Check media permission</button>
|
||||||
|
<br>
|
||||||
|
<table >
|
||||||
|
<tr>
|
||||||
|
<th>Camera permission</th>
|
||||||
|
<th>Microphone permission</th>
|
||||||
|
<th>Screen permission</th>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td id="camera-permission"></td>
|
||||||
|
<td id="microphone-permission"></td>
|
||||||
|
<td id="screen-permission"></td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
<hr>
|
<hr>
|
||||||
<p>Get Media Sources:</p>
|
<p>Get Media Sources:</p>
|
||||||
<button id='get-sources'>Open screen picker & screensharing indicator</button>
|
<button id='get-sources'>Open screen picker & screensharing indicator</button>
|
||||||
@ -210,6 +226,7 @@
|
|||||||
notification: 'notification',
|
notification: 'notification',
|
||||||
closeNotification: 'close-notification',
|
closeNotification: 'close-notification',
|
||||||
registerRestartFloater: 'register-restart-floater',
|
registerRestartFloater: 'register-restart-floater',
|
||||||
|
checkMediaPermission: 'check-media-permission',
|
||||||
};
|
};
|
||||||
let requestId = 0;
|
let requestId = 0;
|
||||||
|
|
||||||
@ -504,6 +521,10 @@
|
|||||||
case 'restart-floater-callback':
|
case 'restart-floater-callback':
|
||||||
onRestartFloater(data);
|
onRestartFloater(data);
|
||||||
break;
|
break;
|
||||||
|
case 'check-media-permission-callback':
|
||||||
|
handleResponse(data);
|
||||||
|
console.log(event.data);
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
console.log(event.data);
|
console.log(event.data);
|
||||||
}
|
}
|
||||||
@ -603,6 +624,40 @@
|
|||||||
activityTimer = startActivityInterval();
|
activityTimer = startActivityInterval();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Check media permission
|
||||||
|
*/
|
||||||
|
const mediaPermission = document.getElementById('check-media-permission');
|
||||||
|
mediaPermission.addEventListener('click', () => {
|
||||||
|
let cameraPermission = document.getElementById('camera-permission');
|
||||||
|
let microphonePermission = document.getElementById('microphone-permission');
|
||||||
|
let screenPermission = document.getElementById('screen-permission');
|
||||||
|
if (navigator.appVersion.indexOf("Mac") != -1) {
|
||||||
|
if (window.ssf) {
|
||||||
|
ssf.checkMediaPermission().then((mediaPermission) => {
|
||||||
|
console.log('check-media-permission, mediaPermission: ' + JSON.stringify(mediaPermission));
|
||||||
|
cameraPermission.innerText = mediaPermission.camera;
|
||||||
|
microphonePermission.innerText = mediaPermission.microphone;
|
||||||
|
screenPermission.innerText = mediaPermission.screen;
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
postRequest(apiCmds.checkMediaPermission, null, {
|
||||||
|
successCallback: (mediaPermission) => {
|
||||||
|
console.log('check-media-permission, mediaPermission: ' + JSON.stringify(mediaPermission));
|
||||||
|
cameraPermission.innerText = mediaPermission.camera;
|
||||||
|
microphonePermission.innerText = mediaPermission.microphone;
|
||||||
|
screenPermission.innerText = mediaPermission.screen;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
const notImplementedText = 'Not implemented for windows';
|
||||||
|
cameraPermission.innerText = notImplementedText;
|
||||||
|
microphonePermission.innerText = notImplementedText;
|
||||||
|
screenPermission.innerText = notImplementedText;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Desktop capture
|
* Desktop capture
|
||||||
*/
|
*/
|
||||||
|
@ -174,6 +174,13 @@ export class AppBridge {
|
|||||||
ssInstance.handleMessageEvents(data);
|
ssInstance.handleMessageEvents(data);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
case apiCmds.checkMediaPermission:
|
||||||
|
const mediaPermission = await ssf.checkMediaPermission();
|
||||||
|
this.broadcastMessage('check-media-permission-callback', {
|
||||||
|
requestId: data.requestId,
|
||||||
|
response: mediaPermission,
|
||||||
|
});
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -9,6 +9,7 @@ import {
|
|||||||
IBadgeCount,
|
IBadgeCount,
|
||||||
IBoundsChange,
|
IBoundsChange,
|
||||||
ILogMsg,
|
ILogMsg,
|
||||||
|
IMediaPermission,
|
||||||
IRestartFloaterData,
|
IRestartFloaterData,
|
||||||
IScreenSharingIndicator,
|
IScreenSharingIndicator,
|
||||||
IScreenSharingIndicatorOptions,
|
IScreenSharingIndicatorOptions,
|
||||||
@ -486,6 +487,17 @@ export class SSFApi {
|
|||||||
throttledSetCloudConfig(data);
|
throttledSetCloudConfig(data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Check media permission
|
||||||
|
*/
|
||||||
|
public async checkMediaPermission(): Promise<IMediaPermission> {
|
||||||
|
return Promise.resolve({
|
||||||
|
camera: remote.systemPreferences.getMediaAccessStatus('camera'),
|
||||||
|
microphone: remote.systemPreferences.getMediaAccessStatus('microphone'),
|
||||||
|
screen: remote.systemPreferences.getMediaAccessStatus('screen'),
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
Reference in New Issue
Block a user