Add state for when the remote doesn't pick up

Signed-off-by: Šimon Brandner <simon.bra.ag@gmail.com>
This commit is contained in:
Šimon Brandner 2021-07-25 08:57:29 +02:00
parent aedd535c92
commit 4784ddc175
No known key found for this signature in database
GPG key ID: 55C211A1226CB17D

View file

@ -116,6 +116,19 @@ export default class CallEvent extends React.Component<IProps, IState> {
{ _t("This call has ended") } { _t("This call has ended") }
</div> </div>
); );
} else if (hangupReason === CallErrorCode.InviteTimeout) {
return (
<div className="mx_CallEvent_content">
{ _t("The remote side didn't pick up") }
<AccessibleButton
className="mx_CallEvent_content_button mx_CallEvent_content_button_callBack"
onClick={this.props.callEventGrouper.callBack}
kind="primary"
>
<span> { _t("Call again") } </span>
</AccessibleButton>
</div>
);
} }
let reason; let reason;
@ -133,8 +146,6 @@ export default class CallEvent extends React.Component<IProps, IState> {
// (as opposed to an error code they gave but we don't know about, // (as opposed to an error code they gave but we don't know about,
// in which case we show the error code) // in which case we show the error code)
reason = _t("An unknown error occurred"); reason = _t("An unknown error occurred");
} else if (hangupReason === CallErrorCode.InviteTimeout) {
reason = _t("No answer");
} else if (hangupReason === CallErrorCode.UserBusy) { } else if (hangupReason === CallErrorCode.UserBusy) {
reason = _t("The user you called is busy."); reason = _t("The user you called is busy.");
} else { } else {
@ -186,12 +197,17 @@ export default class CallEvent extends React.Component<IProps, IState> {
const sender = event.sender ? event.sender.name : event.getSender(); const sender = event.sender ? event.sender.name : event.getSender();
const isVoice = this.props.callEventGrouper.isVoice; const isVoice = this.props.callEventGrouper.isVoice;
const callType = isVoice ? _t("Voice call") : _t("Video call"); const callType = isVoice ? _t("Voice call") : _t("Video call");
const content = this.renderContent(this.state.callState); const callState = this.state.callState;
const hangupReason = this.props.callEventGrouper.hangupReason;
const content = this.renderContent(callState);
const className = classNames({ const className = classNames({
mx_CallEvent: true, mx_CallEvent: true,
mx_CallEvent_voice: isVoice, mx_CallEvent_voice: isVoice,
mx_CallEvent_video: !isVoice, mx_CallEvent_video: !isVoice,
mx_CallEvent_missed: this.state.callState === CustomCallState.Missed, mx_CallEvent_missed: (
callState === CustomCallState.Missed ||
(callState === CallState.Ended && hangupReason === CallErrorCode.InviteTimeout)
),
}); });
return ( return (