You've already forked matrix-react-sdk
mirror of
https://github.com/matrix-org/matrix-react-sdk.git
synced 2025-12-10 05:42:29 +03:00
Device manager - silence call ringers when local notifications are silenced (#9420)
* silence call ringers when local notifications are silenced * more coverage for silencing * explain disabled silence button * lint * increase wait for modal Co-authored-by: Michael Telatynski <7t3chguy@gmail.com>
This commit is contained in:
@@ -62,6 +62,7 @@ import { KIND_CALL_TRANSFER } from "./components/views/dialogs/InviteDialogTypes
|
||||
import { OpenInviteDialogPayload } from "./dispatcher/payloads/OpenInviteDialogPayload";
|
||||
import { findDMForUser } from './utils/dm/findDMForUser';
|
||||
import { getJoinedNonFunctionalMembers } from './utils/room/getJoinedNonFunctionalMembers';
|
||||
import { localNotificationsAreSilenced } from './utils/notifications';
|
||||
|
||||
export const PROTOCOL_PSTN = 'm.protocol.pstn';
|
||||
export const PROTOCOL_PSTN_PREFIXED = 'im.vector.protocol.pstn';
|
||||
@@ -184,6 +185,11 @@ export default class LegacyCallHandler extends EventEmitter {
|
||||
}
|
||||
}
|
||||
|
||||
public isForcedSilent(): boolean {
|
||||
const cli = MatrixClientPeg.get();
|
||||
return localNotificationsAreSilenced(cli);
|
||||
}
|
||||
|
||||
public silenceCall(callId: string): void {
|
||||
this.silencedCalls.add(callId);
|
||||
this.emit(LegacyCallHandlerEvent.SilencedCallsChanged, this.silencedCalls);
|
||||
@@ -194,13 +200,14 @@ export default class LegacyCallHandler extends EventEmitter {
|
||||
}
|
||||
|
||||
public unSilenceCall(callId: string): void {
|
||||
if (this.isForcedSilent) return;
|
||||
this.silencedCalls.delete(callId);
|
||||
this.emit(LegacyCallHandlerEvent.SilencedCallsChanged, this.silencedCalls);
|
||||
this.play(AudioID.Ring);
|
||||
}
|
||||
|
||||
public isCallSilenced(callId: string): boolean {
|
||||
return this.silencedCalls.has(callId);
|
||||
return this.isForcedSilent() || this.silencedCalls.has(callId);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -582,7 +589,7 @@ export default class LegacyCallHandler extends EventEmitter {
|
||||
action.value === "ring"
|
||||
));
|
||||
|
||||
if (pushRuleEnabled && tweakSetToRing) {
|
||||
if (pushRuleEnabled && tweakSetToRing && !this.isForcedSilent()) {
|
||||
this.play(AudioID.Ring);
|
||||
} else {
|
||||
this.silenceCall(call.callId);
|
||||
|
||||
Reference in New Issue
Block a user