mirror of
https://github.com/pavlobu/deskreen.git
synced 2025-06-01 15:20:10 -07:00
remove .remote from ScanQRStep
This commit is contained in:
parent
b47c31c33a
commit
e3db220e32
@ -1,5 +1,5 @@
|
|||||||
/* eslint-disable @typescript-eslint/ban-ts-comment */
|
/* eslint-disable @typescript-eslint/ban-ts-comment */
|
||||||
import { clipboard, remote, ipcRenderer } from 'electron';
|
import { clipboard, ipcRenderer } from 'electron';
|
||||||
import React, { useContext, useEffect, useState } from 'react';
|
import React, { useContext, useEffect, useState } from 'react';
|
||||||
import { useTranslation } from 'react-i18next';
|
import { useTranslation } from 'react-i18next';
|
||||||
import {
|
import {
|
||||||
@ -15,15 +15,11 @@ import { makeStyles, createStyles } from '@material-ui/core';
|
|||||||
import { Row, Col } from 'react-flexbox-grid';
|
import { Row, Col } from 'react-flexbox-grid';
|
||||||
import { SettingsContext } from '../../containers/SettingsProvider';
|
import { SettingsContext } from '../../containers/SettingsProvider';
|
||||||
import isProduction from '../../utils/isProduction';
|
import isProduction from '../../utils/isProduction';
|
||||||
import SharingSessionService from '../../features/SharingSessionService';
|
|
||||||
import config from '../../api/config';
|
import config from '../../api/config';
|
||||||
|
import { IpcEvents } from '../../main/IpcEvents.enum';
|
||||||
|
|
||||||
const { port } = config;
|
const { port } = config;
|
||||||
|
|
||||||
const sharingSessionService = remote.getGlobal(
|
|
||||||
'sharingSessionService'
|
|
||||||
) as SharingSessionService;
|
|
||||||
|
|
||||||
// TODO: change port to user defined port, if it is really defined
|
// TODO: change port to user defined port, if it is really defined
|
||||||
const CLIENT_VIEWER_PORT = isProduction() ? port : '3000';
|
const CLIENT_VIEWER_PORT = isProduction() ? port : '3000';
|
||||||
|
|
||||||
@ -43,8 +39,6 @@ const useStyles = makeStyles(() =>
|
|||||||
dialogQRWrapper: {
|
dialogQRWrapper: {
|
||||||
backgroundColor: 'white',
|
backgroundColor: 'white',
|
||||||
padding: '20px',
|
padding: '20px',
|
||||||
// width: '95%',
|
|
||||||
// hieght: '95%',
|
|
||||||
borderRadius: '10px',
|
borderRadius: '10px',
|
||||||
},
|
},
|
||||||
bigQRCodeDialogRoot: {
|
bigQRCodeDialogRoot: {
|
||||||
@ -65,12 +59,13 @@ const ScanQRStep: React.FC = () => {
|
|||||||
const [LOCAL_LAN_IP, setLocalLanIP] = useState('');
|
const [LOCAL_LAN_IP, setLocalLanIP] = useState('');
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const thisInterval = setInterval(() => {
|
const getRoomIdInterval = setInterval(async () => {
|
||||||
if (sharingSessionService.waitingForConnectionSharingSession !== null) {
|
const roomId = await ipcRenderer.invoke(
|
||||||
setRoomID(
|
IpcEvents.GetWaitingForConnectionSharingSessionRoomId
|
||||||
sharingSessionService.waitingForConnectionSharingSession.roomID
|
);
|
||||||
);
|
if (roomId) {
|
||||||
clearInterval(thisInterval);
|
setRoomID(roomId);
|
||||||
|
clearInterval(getRoomIdInterval);
|
||||||
}
|
}
|
||||||
}, 1000);
|
}, 1000);
|
||||||
|
|
||||||
@ -82,7 +77,7 @@ const ScanQRStep: React.FC = () => {
|
|||||||
}, 1000);
|
}, 1000);
|
||||||
|
|
||||||
return () => {
|
return () => {
|
||||||
clearInterval(thisInterval);
|
clearInterval(getRoomIdInterval);
|
||||||
clearInterval(ipInterval);
|
clearInterval(ipInterval);
|
||||||
};
|
};
|
||||||
}, []);
|
}, []);
|
||||||
|
@ -17,4 +17,5 @@ export enum IpcEvents {
|
|||||||
GetWaitingForConnectionSharingSessionSourceId = 'get-waiting-for-connection-sharing-session-source-id',
|
GetWaitingForConnectionSharingSessionSourceId = 'get-waiting-for-connection-sharing-session-source-id',
|
||||||
StartSharingOnWaitingForConnectionSharingSession = 'start-sharing-on-waiting-for-connection-sharing-session',
|
StartSharingOnWaitingForConnectionSharingSession = 'start-sharing-on-waiting-for-connection-sharing-session',
|
||||||
GetPendingConnectionDevice = 'get-pending-connection-device',
|
GetPendingConnectionDevice = 'get-pending-connection-device',
|
||||||
|
GetWaitingForConnectionSharingSessionRoomId = 'get-waiting-for-connection-sharing-session-room-id',
|
||||||
}
|
}
|
||||||
|
@ -235,4 +235,15 @@ export default function initIpcMainHandlers(
|
|||||||
ipcMain.handle(IpcEvents.GetPendingConnectionDevice, () => {
|
ipcMain.handle(IpcEvents.GetPendingConnectionDevice, () => {
|
||||||
return getDeskreenGlobal().connectedDevicesService.pendingConnectionDevice;
|
return getDeskreenGlobal().connectedDevicesService.pendingConnectionDevice;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
ipcMain.handle(IpcEvents.GetWaitingForConnectionSharingSessionRoomId, () => {
|
||||||
|
if (
|
||||||
|
getDeskreenGlobal().sharingSessionService
|
||||||
|
.waitingForConnectionSharingSession === null
|
||||||
|
) {
|
||||||
|
return undefined;
|
||||||
|
}
|
||||||
|
return getDeskreenGlobal().sharingSessionService
|
||||||
|
.waitingForConnectionSharingSession?.roomID;
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user