Skip to content
This repository was archived by the owner on Sep 11, 2024. It is now read-only.

Commit 771dda0

Browse files
authored
Merge pull request #6472 from SimonBrandner/fix/call-view/18221
2 parents 2a55778 + 6f77d3b commit 771dda0

File tree

2 files changed

+43
-42
lines changed

2 files changed

+43
-42
lines changed

res/css/views/voip/_CallView.scss

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -279,7 +279,7 @@ limitations under the License.
279279
max-width: 240px;
280280
}
281281

282-
.mx_CallView_header_phoneIcon {
282+
.mx_CallView_header_callTypeIcon {
283283
display: inline-block;
284284
margin-right: 6px;
285285
height: 16px;
@@ -293,20 +293,26 @@ limitations under the License.
293293

294294
height: 16px;
295295
width: 16px;
296-
background-color: $warning-color;
296+
background-color: $secondary-fg-color;
297297
mask-repeat: no-repeat;
298298
mask-size: contain;
299299
mask-position: center;
300+
}
301+
302+
&.mx_CallView_header_callTypeIcon_voice::before {
300303
mask-image: url('$(res)/img/element-icons/call/voice-call.svg');
301304
}
305+
306+
&.mx_CallView_header_callTypeIcon_video::before {
307+
mask-image: url('$(res)/img/element-icons/call/video-call.svg');
308+
}
302309
}
303310

304311
.mx_CallView_callControls {
305312
position: absolute;
306313
display: flex;
307314
justify-content: center;
308315
bottom: 5px;
309-
width: 100%;
310316
opacity: 1;
311317
transition: opacity 0.5s;
312318
z-index: 200; // To be above _all_ feeds

src/components/views/voip/CallView.tsx

Lines changed: 34 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@ interface IState {
6767
screensharing: boolean;
6868
callState: CallState;
6969
controlsVisible: boolean;
70+
hoveringControls: boolean;
7071
showMoreMenu: boolean;
7172
showDialpad: boolean;
7273
primaryFeed: CallFeed;
@@ -102,7 +103,7 @@ function exitFullscreen() {
102103
if (exitMethod) exitMethod.call(document);
103104
}
104105

105-
const CONTROLS_HIDE_DELAY = 1000;
106+
const CONTROLS_HIDE_DELAY = 2000;
106107
// Height of the header duplicated from CSS because we need to subtract it from our max
107108
// height to get the max height of the video
108109
const CONTEXT_MENU_VPADDING = 8; // How far the context menu sits above the button (px)
@@ -128,6 +129,7 @@ export default class CallView extends React.Component<IProps, IState> {
128129
screensharing: this.props.call.isScreensharing(),
129130
callState: this.props.call.state,
130131
controlsVisible: true,
132+
hoveringControls: false,
131133
showMoreMenu: false,
132134
showDialpad: false,
133135
primaryFeed: primary,
@@ -244,6 +246,7 @@ export default class CallView extends React.Component<IProps, IState> {
244246
};
245247

246248
private onControlsHideTimer = () => {
249+
if (this.state.hoveringControls || this.state.showDialpad || this.state.showMoreMenu) return;
247250
this.controlsHideTimer = null;
248251
this.setState({
249252
controlsVisible: false,
@@ -293,24 +296,10 @@ export default class CallView extends React.Component<IProps, IState> {
293296

294297
private onDialpadClick = (): void => {
295298
if (!this.state.showDialpad) {
296-
if (this.controlsHideTimer) {
297-
clearTimeout(this.controlsHideTimer);
298-
this.controlsHideTimer = null;
299-
}
300-
301-
this.setState({
302-
showDialpad: true,
303-
controlsVisible: true,
304-
});
299+
this.setState({ showDialpad: true });
300+
this.showControls();
305301
} else {
306-
if (this.controlsHideTimer !== null) {
307-
clearTimeout(this.controlsHideTimer);
308-
}
309-
this.controlsHideTimer = window.setTimeout(this.onControlsHideTimer, CONTROLS_HIDE_DELAY);
310-
311-
this.setState({
312-
showDialpad: false,
313-
});
302+
this.setState({ showDialpad: false });
314303
}
315304
};
316305

@@ -345,29 +334,16 @@ export default class CallView extends React.Component<IProps, IState> {
345334
};
346335

347336
private onMoreClick = (): void => {
348-
if (this.controlsHideTimer) {
349-
clearTimeout(this.controlsHideTimer);
350-
this.controlsHideTimer = null;
351-
}
352-
353-
this.setState({
354-
showMoreMenu: true,
355-
controlsVisible: true,
356-
});
337+
this.setState({ showMoreMenu: true });
338+
this.showControls();
357339
};
358340

359341
private closeDialpad = (): void => {
360-
this.setState({
361-
showDialpad: false,
362-
});
363-
this.controlsHideTimer = window.setTimeout(this.onControlsHideTimer, CONTROLS_HIDE_DELAY);
342+
this.setState({ showDialpad: false });
364343
};
365344

366345
private closeContextMenu = (): void => {
367-
this.setState({
368-
showMoreMenu: false,
369-
});
370-
this.controlsHideTimer = window.setTimeout(this.onControlsHideTimer, CONTROLS_HIDE_DELAY);
346+
this.setState({ showMoreMenu: false });
371347
};
372348

373349
// we register global shortcuts here, they *must not conflict* with local shortcuts elsewhere or both will fire
@@ -403,6 +379,15 @@ export default class CallView extends React.Component<IProps, IState> {
403379
}
404380
};
405381

382+
private onCallControlsMouseEnter = (): void => {
383+
this.setState({ hoveringControls: true });
384+
this.showControls();
385+
};
386+
387+
private onCallControlsMouseLeave = (): void => {
388+
this.setState({ hoveringControls: false });
389+
};
390+
406391
private onRoomAvatarClick = (): void => {
407392
const userFacingRoomId = CallHandler.sharedInstance().roomIdForCall(this.props.call);
408393
dis.dispatch({
@@ -537,8 +522,6 @@ export default class CallView extends React.Component<IProps, IState> {
537522
}
538523

539524
// The dial pad & 'more' button actions are only relevant in a connected call
540-
// When not connected, we have to put something there to make the flexbox alignment correct
541-
let dialpadButton;
542525
let contextMenuButton;
543526
if (this.state.callState === CallState.Connected) {
544527
contextMenuButton = (
@@ -549,6 +532,9 @@ export default class CallView extends React.Component<IProps, IState> {
549532
isExpanded={this.state.showMoreMenu}
550533
/>
551534
);
535+
}
536+
let dialpadButton;
537+
if (this.state.callState === CallState.Connected && this.props.call.opponentSupportsDTMF()) {
552538
dialpadButton = (
553539
<ContextMenuButton
554540
className="mx_CallView_callControls_button mx_CallView_callControls_dialpad"
@@ -560,7 +546,11 @@ export default class CallView extends React.Component<IProps, IState> {
560546
}
561547

562548
return (
563-
<div className={callControlsClasses}>
549+
<div
550+
className={callControlsClasses}
551+
onMouseEnter={this.onCallControlsMouseEnter}
552+
onMouseLeave={this.onCallControlsMouseLeave}
553+
>
564554
{ dialpadButton }
565555
<AccessibleButton
566556
className={micClasses}
@@ -821,10 +811,15 @@ export default class CallView extends React.Component<IProps, IState> {
821811
{ expandButton }
822812
</div>;
823813

814+
const callTypeIconClassName = classNames("mx_CallView_header_callTypeIcon", {
815+
"mx_CallView_header_callTypeIcon_voice": !isVideoCall,
816+
"mx_CallView_header_callTypeIcon_video": isVideoCall,
817+
});
818+
824819
let header: React.ReactNode;
825820
if (!this.props.pipMode) {
826821
header = <div className="mx_CallView_header">
827-
<div className="mx_CallView_header_phoneIcon" />
822+
<div className={callTypeIconClassName} />
828823
<span className="mx_CallView_header_callType">{ callTypeText }</span>
829824
{ headerControls }
830825
</div>;

0 commit comments

Comments
 (0)