mirror of
https://github.com/pavlobu/deskreen.git
synced 2025-05-28 05:10:09 -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 */
|
||||
import { clipboard, remote, ipcRenderer } from 'electron';
|
||||
import { clipboard, ipcRenderer } from 'electron';
|
||||
import React, { useContext, useEffect, useState } from 'react';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import {
|
||||
@ -15,15 +15,11 @@ import { makeStyles, createStyles } from '@material-ui/core';
|
||||
import { Row, Col } from 'react-flexbox-grid';
|
||||
import { SettingsContext } from '../../containers/SettingsProvider';
|
||||
import isProduction from '../../utils/isProduction';
|
||||
import SharingSessionService from '../../features/SharingSessionService';
|
||||
import config from '../../api/config';
|
||||
import { IpcEvents } from '../../main/IpcEvents.enum';
|
||||
|
||||
const { port } = config;
|
||||
|
||||
const sharingSessionService = remote.getGlobal(
|
||||
'sharingSessionService'
|
||||
) as SharingSessionService;
|
||||
|
||||
// TODO: change port to user defined port, if it is really defined
|
||||
const CLIENT_VIEWER_PORT = isProduction() ? port : '3000';
|
||||
|
||||
@ -43,8 +39,6 @@ const useStyles = makeStyles(() =>
|
||||
dialogQRWrapper: {
|
||||
backgroundColor: 'white',
|
||||
padding: '20px',
|
||||
// width: '95%',
|
||||
// hieght: '95%',
|
||||
borderRadius: '10px',
|
||||
},
|
||||
bigQRCodeDialogRoot: {
|
||||
@ -65,12 +59,13 @@ const ScanQRStep: React.FC = () => {
|
||||
const [LOCAL_LAN_IP, setLocalLanIP] = useState('');
|
||||
|
||||
useEffect(() => {
|
||||
const thisInterval = setInterval(() => {
|
||||
if (sharingSessionService.waitingForConnectionSharingSession !== null) {
|
||||
setRoomID(
|
||||
sharingSessionService.waitingForConnectionSharingSession.roomID
|
||||
);
|
||||
clearInterval(thisInterval);
|
||||
const getRoomIdInterval = setInterval(async () => {
|
||||
const roomId = await ipcRenderer.invoke(
|
||||
IpcEvents.GetWaitingForConnectionSharingSessionRoomId
|
||||
);
|
||||
if (roomId) {
|
||||
setRoomID(roomId);
|
||||
clearInterval(getRoomIdInterval);
|
||||
}
|
||||
}, 1000);
|
||||
|
||||
@ -82,7 +77,7 @@ const ScanQRStep: React.FC = () => {
|
||||
}, 1000);
|
||||
|
||||
return () => {
|
||||
clearInterval(thisInterval);
|
||||
clearInterval(getRoomIdInterval);
|
||||
clearInterval(ipInterval);
|
||||
};
|
||||
}, []);
|
||||
|
@ -17,4 +17,5 @@ export enum IpcEvents {
|
||||
GetWaitingForConnectionSharingSessionSourceId = 'get-waiting-for-connection-sharing-session-source-id',
|
||||
StartSharingOnWaitingForConnectionSharingSession = 'start-sharing-on-waiting-for-connection-sharing-session',
|
||||
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, () => {
|
||||
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