Signed-off-by: Šimon Brandner <simon.bra.ag@gmail.com>
This commit is contained in:
Šimon Brandner 2021-07-02 13:20:02 +02:00
parent 85399e8edf
commit 9383ecc46f
No known key found for this signature in database
GPG key ID: 9760693FDD98A790
2 changed files with 12 additions and 12 deletions

View file

@ -87,16 +87,16 @@ export default class CallEventGrouper extends EventEmitter {
private onSilencedCallsChanged = () => { private onSilencedCallsChanged = () => {
const newState = CallHandler.sharedInstance().isCallSilenced(this.callId); const newState = CallHandler.sharedInstance().isCallSilenced(this.callId);
this.emit(CallEventGrouperEvent.SilencedChanged, newState) this.emit(CallEventGrouperEvent.SilencedChanged, newState);
} };
public answerCall = () => { public answerCall = () => {
this.call?.answer(); this.call?.answer();
} };
public rejectCall = () => { public rejectCall = () => {
this.call?.reject(); this.call?.reject();
} };
public callBack = () => { public callBack = () => {
defaultDispatcher.dispatch({ defaultDispatcher.dispatch({
@ -104,14 +104,14 @@ export default class CallEventGrouper extends EventEmitter {
type: this.isVoice ? CallType.Voice : CallType.Video, type: this.isVoice ? CallType.Voice : CallType.Video,
room_id: [...this.events][0]?.getRoomId(), room_id: [...this.events][0]?.getRoomId(),
}); });
} };
public toggleSilenced = () => { public toggleSilenced = () => {
const silenced = CallHandler.sharedInstance().isCallSilenced(this.callId); const silenced = CallHandler.sharedInstance().isCallSilenced(this.callId);
silenced ? silenced ?
CallHandler.sharedInstance().unSilenceCall(this.callId) : CallHandler.sharedInstance().unSilenceCall(this.callId) :
CallHandler.sharedInstance().silenceCall(this.callId); CallHandler.sharedInstance().silenceCall(this.callId);
} };
private setCallListeners() { private setCallListeners() {
if (!this.call) return; if (!this.call) return;
@ -128,7 +128,7 @@ export default class CallEventGrouper extends EventEmitter {
else if (this.invite && this.call) this.state = CallState.Connecting; else if (this.invite && this.call) this.state = CallState.Connecting;
} }
this.emit(CallEventGrouperEvent.StateChanged, this.state); this.emit(CallEventGrouperEvent.StateChanged, this.state);
} };
private setCall = () => { private setCall = () => {
if (this.call) return; if (this.call) return;
@ -136,7 +136,7 @@ export default class CallEventGrouper extends EventEmitter {
this.call = CallHandler.sharedInstance().getCallById(this.callId); this.call = CallHandler.sharedInstance().getCallById(this.callId);
this.setCallListeners(); this.setCallListeners();
this.setState(); this.setState();
} };
public add(event: MatrixEvent) { public add(event: MatrixEvent) {
this.events.add(event); this.events.add(event);

View file

@ -48,7 +48,7 @@ export default class CallEvent extends React.Component<IProps, IState> {
this.state = { this.state = {
callState: this.props.callEventGrouper.state, callState: this.props.callEventGrouper.state,
silenced: false, silenced: false,
} };
} }
componentDidMount() { componentDidMount() {
@ -66,7 +66,7 @@ export default class CallEvent extends React.Component<IProps, IState> {
}; };
private onStateChanged = (newState: CallState) => { private onStateChanged = (newState: CallState) => {
this.setState({callState: newState}); this.setState({ callState: newState });
}; };
private renderContent(state: CallState | CustomCallState): JSX.Element { private renderContent(state: CallState | CustomCallState): JSX.Element {
@ -138,7 +138,7 @@ export default class CallEvent extends React.Component<IProps, IState> {
} 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 {
reason = _t('Unknown failure: %(reason)s)', {reason: hangupReason}); reason = _t('Unknown failure: %(reason)s)', { reason: hangupReason });
} }
return ( return (
@ -191,7 +191,7 @@ export default class CallEvent extends React.Component<IProps, IState> {
mx_CallEvent_type_icon: true, mx_CallEvent_type_icon: true,
mx_CallEvent_type_icon_voice: isVoice, mx_CallEvent_type_icon_voice: isVoice,
mx_CallEvent_type_icon_video: !isVoice, mx_CallEvent_type_icon_video: !isVoice,
}) });
return ( return (
<div className="mx_CallEvent"> <div className="mx_CallEvent">