Set silenced state as soon as we get the call

Signed-off-by: Šimon Brandner <simon.bra.ag@gmail.com>
This commit is contained in:
Šimon Brandner 2021-08-03 14:58:50 +02:00
parent 37f51c7536
commit e787d14cde
No known key found for this signature in database
GPG Key ID: CC823428E9B582FB

View File

@ -63,16 +63,12 @@ export default class IncomingCallBox extends React.Component<IProps, IState> {
private onAction = (payload: ActionPayload) => {
switch (payload.action) {
case 'call_state': {
const call = CallHandler.sharedInstance().getCallForRoom(payload.room_id);
if (call && call.state === CallState.Ringing) {
this.setState({
incomingCall: call,
silenced: false, // Reset silenced state for new call
});
const incomingCall = CallHandler.sharedInstance().getCallForRoom(payload.room_id);
const silenced = CallHandler.sharedInstance().isCallSilenced(incomingCall.callId);
if (incomingCall && incomingCall.state === CallState.Ringing) {
this.setState({ incomingCall, silenced });
} else {
this.setState({
incomingCall: null,
});
this.setState({ incomingCall: null });
}
}
}