Skip to content

Commit

Permalink
Fix bug that caused screenview to stay off when screenshare was toggled
Browse files Browse the repository at this point in the history
  • Loading branch information
dylonChime committed Nov 26, 2019
1 parent d24c5d0 commit fedfe4d
Show file tree
Hide file tree
Showing 5 changed files with 39 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -85,9 +85,11 @@ export default class DefaultScreenViewingComponentContext implements ScreenViewi
providers
);
signalingSession.registerObserver({
streamDidStart(_screenMessageDetail: ScreenMessageDetail): void {},
streamDidStart(_screenMessageDetail: ScreenMessageDetail): void {
deltaRenderer.revealViewport();
},
streamDidStop(_screenMessageDetail: ScreenMessageDetail): void {
deltaRenderer.close();
deltaRenderer.hideViewport();
},
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,18 @@ export default class DefaultScreenViewingDeltaRenderer implements ScreenViewingD
}
}

hideViewport(): void {
if (this.viewport) {
this.viewport.style.display = 'none';
}
}

revealViewport(): void {
if (this.viewport) {
this.viewport.style.display = 'block';
}
}

changePresentationPolicy(policy: PresentationPolicy): void {
this.policy = policy;
this.updatePresentation();
Expand Down
4 changes: 4 additions & 0 deletions src/screenviewing/deltarenderer/ScreenViewingDeltaRenderer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,10 @@ export default interface ScreenViewingDeltaRenderer {

setViewport(viewport: HTMLElement): void;

hideViewport(): void;

revealViewport(): void;

changePresentationPolicy(policy: PresentationPolicy): void;

close(): void;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,8 @@ describe('DefaultScreenViewingComponentContext', () => {
{
deltaRendererProvider: () => ({
...Substitute.for(),
close(): void {
hideViewport(): void {},
revealViewport(): void {
done();
},
}),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -434,4 +434,21 @@ describe('DefaultScreenViewingDeltaRenderer', () => {
deltaRenderer.zoomReset();
});
});

describe('hideViewport and revealViewport', () => {
it('hides and reveals the viewport', () => {
const deltaRenderer: ScreenViewingDeltaRenderer = new DefaultScreenViewingDeltaRenderer(
controller,
logger,
Substitute.for(),
Substitute.for(),
Substitute.for()
);
deltaRenderer.hideViewport();
deltaRenderer.revealViewport();
deltaRenderer.setViewport(Substitute.for());
deltaRenderer.hideViewport();
deltaRenderer.revealViewport();
});
});
});

0 comments on commit fedfe4d

Please sign in to comment.