diff --git a/app/components/StepsOfStepper/IntermediateStep.spec.tsx b/app/components/StepsOfStepper/IntermediateStep.spec.tsx
index 15d39e9..05f2d53 100644
--- a/app/components/StepsOfStepper/IntermediateStep.spec.tsx
+++ b/app/components/StepsOfStepper/IntermediateStep.spec.tsx
@@ -25,7 +25,6 @@ jest.mock('electron', () => {
waitingForConnectionSharingSession: {
callPeer: jest.fn(),
},
- changeSharingSessionStatusToSharing: jest.fn(),
};
}
return {};
diff --git a/app/components/StepsOfStepper/IntermediateStep.tsx b/app/components/StepsOfStepper/IntermediateStep.tsx
index 7daaac8..2c947c2 100644
--- a/app/components/StepsOfStepper/IntermediateStep.tsx
+++ b/app/components/StepsOfStepper/IntermediateStep.tsx
@@ -1,5 +1,5 @@
import React from 'react';
-import { remote } from 'electron';
+import { ipcRenderer, remote } from 'electron';
import { Button, Text } from '@blueprintjs/core';
import { useTranslation } from 'react-i18next';
import { TFunction } from 'i18next';
@@ -9,11 +9,8 @@ import ScanQRStep from './ScanQRStep';
import ChooseAppOrScreeenStep from './ChooseAppOrScreeenStep';
import ConfirmStep from './ConfirmStep';
import ConnectedDevicesService from '../../features/ConnectedDevicesService';
-import SharingSessionService from '../../features/SharingSessionService';
+import { IpcEvents } from '../../main/IpcEvents.enum';
-const sharingSessionService = remote.getGlobal(
- 'sharingSessionService'
-) as SharingSessionService;
const connectedDevicesService = remote.getGlobal(
'connectedDevicesService'
) as ConnectedDevicesService;
@@ -126,73 +123,43 @@ export default function IntermediateStep(props: IntermediateStepProps) {
) : (
<>>
)
- // activeStep === 0 ? (
- //
- // ) : (
- // <>>
- // )
}
- {
- /**/
- activeStep !== 0 ? (
-
-
-
+
+
+ ) : (
+ <>>
+ )}
{
});
});
- describe('when changeSharingSessionStatusToSharing is called', () => {
- it('should change passed sharingSession status to SHARING', () => {
- const testSharingSession = ({
- status: 'dummystatus',
- } as unknown) as SharingSession;
-
- sharingSessionService.changeSharingSessionStatusToSharing(
- testSharingSession
- );
-
- expect(testSharingSession.status).toBe(SharingSessionStatusEnum.SHARING);
- });
- });
-
describe('when waitWhileUserIsNotCreated is called', () => {
it('should wait until user is created then call clearInterval', () => {
const testUser = {
diff --git a/app/features/SharingSessionService/index.ts b/app/features/SharingSessionService/index.ts
index 2d485a6..b77cd7b 100644
--- a/app/features/SharingSessionService/index.ts
+++ b/app/features/SharingSessionService/index.ts
@@ -86,11 +86,6 @@ export default class SharingSessionService {
return sharingSession;
}
- // eslint-disable-next-line class-methods-use-this
- changeSharingSessionStatusToSharing(sharingSession: SharingSession) {
- sharingSession.status = SharingSessionStatusEnum.SHARING;
- }
-
pollForInactiveSessions(): void {
[...this.sharingSessions.keys()].forEach((key) => {
// @ts-ignore
diff --git a/app/main/IpcEvents.enum.ts b/app/main/IpcEvents.enum.ts
index 44be3e5..8800c03 100644
--- a/app/main/IpcEvents.enum.ts
+++ b/app/main/IpcEvents.enum.ts
@@ -15,4 +15,5 @@ export enum IpcEvents {
AppLanguageChanged = 'app-language-changed',
GetDesktopCapturerServiceSourcesMap = 'get-desktop-capturer-service-sources-map',
GetWaitingForConnectionSharingSessionSourceId = 'get-waiting-for-connection-sharing-session-source-id',
+ StartSharingOnWaitingForConnectionSharingSession = 'start-sharing-on-waiting-for-connection-sharing-session',
}
diff --git a/app/main/ipcMainHandlers.ts b/app/main/ipcMainHandlers.ts
index c09bef9..cab09e4 100644
--- a/app/main/ipcMainHandlers.ts
+++ b/app/main/ipcMainHandlers.ts
@@ -201,6 +201,7 @@ export default function initIpcMainHandlers(
source: {
thumbnail: source?.source.thumbnail?.toDataURL(),
appIcon: source?.source.appIcon?.toDataURL(),
+ name: source?.source.name,
},
};
}
@@ -214,4 +215,20 @@ export default function initIpcMainHandlers(
.waitingForConnectionSharingSession?.desktopCapturerSourceID;
}
);
+
+ ipcMain.handle(
+ IpcEvents.StartSharingOnWaitingForConnectionSharingSession,
+ () => {
+ const sharingSession = getDeskreenGlobal().sharingSessionService
+ .waitingForConnectionSharingSession;
+ if (sharingSession !== null) {
+ sharingSession.callPeer();
+ sharingSession.status = SharingSessionStatusEnum.SHARING;
+ }
+ getDeskreenGlobal().connectedDevicesService.addDevice(
+ getDeskreenGlobal().connectedDevicesService.pendingConnectionDevice
+ );
+ getDeskreenGlobal().connectedDevicesService.resetPendingConnectionDevice();
+ }
+ );
}