diff --git a/src/ipc/channels.ts b/src/ipc/channels.ts
index 1eaef32f2d..4cee7f7f31 100644
--- a/src/ipc/channels.ts
+++ b/src/ipc/channels.ts
@@ -27,6 +27,7 @@ type ChannelToArgsMap = {
'video-call-window/web-contents-id': (webContentsId: number) => void;
'video-call-window/open-screen-picker': () => void;
'video-call-window/screen-sharing-source-responded': (source: string) => void;
+ 'video-call-window/screen-recording-is-permission-granted': () => boolean;
'jitsi-desktop-capturer-get-sources': (
options: Electron.SourcesOptions
) => Electron.DesktopCapturerSource[];
diff --git a/src/public/video-call-window.html b/src/public/video-call-window.html
index e0226bbbd9..48c8016d4e 100644
--- a/src/public/video-call-window.html
+++ b/src/public/video-call-window.html
@@ -1,22 +1,25 @@
+
Rocket.Chat
+
-
+
-
+
+
\ No newline at end of file
diff --git a/src/videoCallWindow/ipc.ts b/src/videoCallWindow/ipc.ts
index 7a20031cb4..808b37f092 100644
--- a/src/videoCallWindow/ipc.ts
+++ b/src/videoCallWindow/ipc.ts
@@ -7,6 +7,7 @@ import {
ipcMain,
WebContents,
screen,
+ systemPreferences,
} from 'electron';
import { handle } from '../ipc/main';
@@ -19,6 +20,14 @@ export const handleDesktopCapturerGetSources = () => {
};
export const startVideoCallWindowHandler = (): void => {
+ handle(
+ 'video-call-window/screen-recording-is-permission-granted',
+ async () => {
+ const permission = systemPreferences.getMediaAccessStatus('screen');
+ return permission === 'granted';
+ }
+ );
+
handle('video-call-window/open-window', async (_event, url) => {
console.log('[Rocket.Chat Desktop] open-internal-video-chat-window', url);
const validUrl = new URL(url);
diff --git a/src/videoCallWindow/screenSharePicker.tsx b/src/videoCallWindow/screenSharePicker.tsx
index 96e4a53cc6..cddaf8fc0d 100644
--- a/src/videoCallWindow/screenSharePicker.tsx
+++ b/src/videoCallWindow/screenSharePicker.tsx
@@ -1,4 +1,10 @@
-import { Box, Margins } from '@rocket.chat/fuselage';
+import {
+ Box,
+ Button,
+ Callout,
+ Margins,
+ Scrollable,
+} from '@rocket.chat/fuselage';
import {
DesktopCapturer,
DesktopCapturerSource,
@@ -18,14 +24,32 @@ const desktopCapturer: DesktopCapturer = {
export function ScreenSharePicker() {
const [visible, setVisible] = useState(false);
const [sources, setSources] = useState([]);
+ const [
+ isScreenRecordingPermissionGranted,
+ setIsScreenRecordingPermissionGranted,
+ ] = useState(false);
const fetchSources = async (): Promise => {
const sources = await desktopCapturer.getSources({
types: ['window', 'screen'],
});
- setSources(sources);
+ const filteredSources = sources.filter(
+ (source) => source.thumbnail.isEmpty() === false
+ );
+ setSources(filteredSources);
};
+ useEffect(() => {
+ const checkScreenRecordingPermission = async () => {
+ const result = await ipcRenderer.invoke(
+ 'video-call-window/screen-recording-is-permission-granted'
+ );
+ setIsScreenRecordingPermissionGranted(result);
+ };
+
+ checkScreenRecordingPermission().catch(console.error);
+ }, [visible]);
+
useEffect(() => {
fetchSources();
}, []);
@@ -62,40 +86,72 @@ export function ScreenSharePicker() {
return (
);