Skip to content

Commit ada413f

Browse files
committed
refactor(webapp): update calls to onSessionEvent
Update calls to onSessionEvent from @devolutions/iron-remote-desktop, as the interface changed after RxJS was removed from latter's dependencies.
1 parent 58536db commit ada413f

4 files changed

Lines changed: 40 additions & 73 deletions

File tree

webapp/package-lock.json

Lines changed: 1 addition & 19 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

webapp/src/client/app/modules/web-client/ard/web-client-ard.component.ts

Lines changed: 13 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -372,20 +372,19 @@ export class WebClientArdComponent extends WebClientBaseComponent implements OnI
372372
}
373373

374374
private initSessionEventHandler(): void {
375-
this.remoteClient.onSessionEvent({
376-
next: (event: SessionEvent): void => {
377-
switch (event.type) {
378-
case SessionEventType.STARTED:
379-
this.handleSessionStarted(event);
380-
break;
381-
case SessionEventType.TERMINATED:
382-
case SessionEventType.ERROR:
383-
this.handleSessionEndedOrError(event);
384-
break;
385-
}
386-
},
387-
error: (err) => this.handleSubscriptionError(err),
388-
});
375+
const handler = (event: SessionEvent): void => {
376+
switch (event.type) {
377+
case SessionEventType.STARTED:
378+
this.handleSessionStarted(event);
379+
break;
380+
case SessionEventType.TERMINATED:
381+
case SessionEventType.ERROR:
382+
this.handleSessionEndedOrError(event);
383+
break;
384+
}
385+
};
386+
387+
this.remoteClient.onSessionEvent(handler);
389388
}
390389

391390
private handleSessionStarted(event: SessionEvent): void {
@@ -423,10 +422,6 @@ export class WebClientArdComponent extends WebClientBaseComponent implements OnI
423422
void this.webSessionService.updateWebSessionIcon(this.webSessionId, icon);
424423
}
425424

426-
private handleSubscriptionError(error): void {
427-
console.error('Error in session event subscription', error);
428-
}
429-
430425
private handleIronRDPError(error: IronError | string): void {
431426
this.notifyUserAboutError(error);
432427
this.disableComponentStatus();

webapp/src/client/app/modules/web-client/rdp/web-client-rdp.component.ts

Lines changed: 13 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -420,20 +420,19 @@ export class WebClientRdpComponent extends WebClientBaseComponent implements OnI
420420
}
421421

422422
private initSessionEventHandler(): void {
423-
this.remoteClient.onSessionEvent({
424-
next: (event: SessionEvent): void => {
425-
switch (event.type) {
426-
case SessionEventType.STARTED:
427-
this.handleSessionStarted(event);
428-
break;
429-
case SessionEventType.TERMINATED:
430-
case SessionEventType.ERROR:
431-
this.handleSessionEndedOrError(event);
432-
break;
433-
}
434-
},
435-
error: (err) => this.handleSubscriptionError(err),
436-
});
423+
const handler = (event: SessionEvent): void => {
424+
switch (event.type) {
425+
case SessionEventType.STARTED:
426+
this.handleSessionStarted(event);
427+
break;
428+
case SessionEventType.TERMINATED:
429+
case SessionEventType.ERROR:
430+
this.handleSessionEndedOrError(event);
431+
break;
432+
}
433+
};
434+
435+
this.remoteClient.onSessionEvent(handler);
437436
}
438437

439438
private handleSessionStarted(event: SessionEvent): void {
@@ -471,10 +470,6 @@ export class WebClientRdpComponent extends WebClientBaseComponent implements OnI
471470
void this.webSessionService.updateWebSessionIcon(this.webSessionId, icon);
472471
}
473472

474-
private handleSubscriptionError(error): void {
475-
console.error('Error in session event subscription', error);
476-
}
477-
478473
private handleIronRDPError(error: IronError | string): void {
479474
this.notifyUserAboutError(error);
480475
this.disableComponentStatus();

webapp/src/client/app/modules/web-client/vnc/web-client-vnc.component.ts

Lines changed: 13 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -437,20 +437,19 @@ export class WebClientVncComponent extends WebClientBaseComponent implements OnI
437437
}
438438

439439
private initSessionEventHandler(): void {
440-
this.remoteClient.onSessionEvent({
441-
next: (event: SessionEvent): void => {
442-
switch (event.type) {
443-
case SessionEventType.STARTED:
444-
this.handleSessionStarted(event);
445-
break;
446-
case SessionEventType.TERMINATED:
447-
case SessionEventType.ERROR:
448-
this.handleSessionEndedOrError(event);
449-
break;
450-
}
451-
},
452-
error: (err) => this.handleSubscriptionError(err),
453-
});
440+
const handler = (event: SessionEvent): void => {
441+
switch (event.type) {
442+
case SessionEventType.STARTED:
443+
this.handleSessionStarted(event);
444+
break;
445+
case SessionEventType.TERMINATED:
446+
case SessionEventType.ERROR:
447+
this.handleSessionEndedOrError(event);
448+
break;
449+
}
450+
};
451+
452+
this.remoteClient.onSessionEvent(handler);
454453
}
455454

456455
private handleSessionStarted(event: SessionEvent): void {
@@ -488,10 +487,6 @@ export class WebClientVncComponent extends WebClientBaseComponent implements OnI
488487
void this.webSessionService.updateWebSessionIcon(this.webSessionId, icon);
489488
}
490489

491-
private handleSubscriptionError(error): void {
492-
console.error('Error in session event subscription', error);
493-
}
494-
495490
private handleIronRDPError(error: IronError | string): void {
496491
this.notifyUserAboutError(error);
497492
this.disableComponentStatus();

0 commit comments

Comments
 (0)