mirror of
https://github.com/pavlobu/deskreen.git
synced 2025-05-17 16:00:16 -07:00
remove remote from confirm step
This commit is contained in:
parent
a33fc14686
commit
35d6fd825c
@ -1,16 +1,11 @@
|
|||||||
import React, { useEffect, useState } from 'react';
|
import React, { useEffect, useState } from 'react';
|
||||||
import { remote } from 'electron';
|
import { ipcRenderer } from 'electron';
|
||||||
import { Text } from '@blueprintjs/core';
|
import { Text } from '@blueprintjs/core';
|
||||||
import { Row, Col } from 'react-flexbox-grid';
|
import { Row, Col } from 'react-flexbox-grid';
|
||||||
import { useTranslation } from 'react-i18next';
|
import { useTranslation } from 'react-i18next';
|
||||||
import SharingSourcePreviewCard from '../SharingSourcePreviewCard';
|
import SharingSourcePreviewCard from '../SharingSourcePreviewCard';
|
||||||
import SharingSessionService from '../../features/SharingSessionService';
|
|
||||||
import DeviceInfoCallout from '../DeviceInfoCallout';
|
import DeviceInfoCallout from '../DeviceInfoCallout';
|
||||||
import SharingSession from '../../features/SharingSessionService/SharingSession';
|
import { IpcEvents } from '../../main/IpcEvents.enum';
|
||||||
|
|
||||||
const sharingSessionService = remote.getGlobal(
|
|
||||||
'sharingSessionService'
|
|
||||||
) as SharingSessionService;
|
|
||||||
|
|
||||||
interface ConfirmStepProps {
|
interface ConfirmStepProps {
|
||||||
device: Device | null;
|
device: Device | null;
|
||||||
@ -19,23 +14,25 @@ interface ConfirmStepProps {
|
|||||||
export default function ConfirmStep(props: ConfirmStepProps) {
|
export default function ConfirmStep(props: ConfirmStepProps) {
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
const { device } = props;
|
const { device } = props;
|
||||||
const [sharingSession, setSharingSession] = useState<
|
const [
|
||||||
SharingSession | undefined
|
waitingForConnectionSharingSessionSourceId,
|
||||||
>();
|
setWaitingForConnectionSharingSessionSourceId,
|
||||||
|
] = useState<string | undefined>();
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (sharingSessionService.waitingForConnectionSharingSession !== null) {
|
ipcRenderer
|
||||||
setSharingSession(
|
.invoke(IpcEvents.GetWaitingForConnectionSharingSessionSourceId)
|
||||||
sharingSessionService.waitingForConnectionSharingSession
|
// eslint-disable-next-line promise/always-return
|
||||||
);
|
.then((id) => {
|
||||||
}
|
setWaitingForConnectionSharingSessionSourceId(id);
|
||||||
|
})
|
||||||
|
.catch((e) => console.error(e));
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div style={{ width: '80%', marginTop: '50px' }}>
|
<div style={{ width: '80%', marginTop: '50px' }}>
|
||||||
<Row style={{ marginBottom: '10px' }}>
|
<Row style={{ marginBottom: '10px' }}>
|
||||||
<Col xs={12} style={{ textAlign: 'center' }}>
|
<Col xs={12} style={{ textAlign: 'center' }}>
|
||||||
{/* eslint-disable-next-line react/no-unescaped-entities */}
|
|
||||||
<Text>{t('Check if all is OK and click Confirm')}</Text>
|
<Text>{t('Check if all is OK and click Confirm')}</Text>
|
||||||
</Col>
|
</Col>
|
||||||
</Row>
|
</Row>
|
||||||
@ -51,7 +48,7 @@ export default function ConfirmStep(props: ConfirmStepProps) {
|
|||||||
</Col>
|
</Col>
|
||||||
<Col xs={5}>
|
<Col xs={5}>
|
||||||
<SharingSourcePreviewCard
|
<SharingSourcePreviewCard
|
||||||
sharingSourceID={sharingSession?.desktopCapturerSourceID}
|
sharingSourceID={waitingForConnectionSharingSessionSourceId}
|
||||||
/>
|
/>
|
||||||
</Col>
|
</Col>
|
||||||
</Row>
|
</Row>
|
||||||
|
@ -14,4 +14,5 @@ export enum IpcEvents {
|
|||||||
DisconnectAllDevices = 'disconnect-all-devices',
|
DisconnectAllDevices = 'disconnect-all-devices',
|
||||||
AppLanguageChanged = 'app-language-changed',
|
AppLanguageChanged = 'app-language-changed',
|
||||||
GetDesktopCapturerServiceSourcesMap = 'get-desktop-capturer-service-sources-map',
|
GetDesktopCapturerServiceSourcesMap = 'get-desktop-capturer-service-sources-map',
|
||||||
|
GetWaitingForConnectionSharingSessionSourceId = 'get-waiting-for-connection-sharing-session-source-id',
|
||||||
}
|
}
|
||||||
|
@ -206,4 +206,12 @@ export default function initIpcMainHandlers(
|
|||||||
}
|
}
|
||||||
return res;
|
return res;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
ipcMain.handle(
|
||||||
|
IpcEvents.GetWaitingForConnectionSharingSessionSourceId,
|
||||||
|
() => {
|
||||||
|
return getDeskreenGlobal().sharingSessionService
|
||||||
|
.waitingForConnectionSharingSession?.desktopCapturerSourceID;
|
||||||
|
}
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user