Move stuff out of if statement for better readability
Signed-off-by: Šimon Brandner <simon.bra.ag@gmail.com>
This commit is contained in:
parent
a18f41ceed
commit
79e4a95b13
1 changed files with 6 additions and 7 deletions
|
@ -481,15 +481,14 @@ export default class CallHandler extends EventEmitter {
|
||||||
const incomingCallPushRule = (
|
const incomingCallPushRule = (
|
||||||
new PushProcessor(MatrixClientPeg.get()).getPushRuleById(RuleId.IncomingCall) as IPushRule
|
new PushProcessor(MatrixClientPeg.get()).getPushRuleById(RuleId.IncomingCall) as IPushRule
|
||||||
);
|
);
|
||||||
|
const pushRuleEnabled = incomingCallPushRule?.enabled;
|
||||||
|
const tweakSetToRing = incomingCallPushRule.actions.some((action: Tweaks) => (
|
||||||
|
action.set_tweak === TweakName.Sound &&
|
||||||
|
action.value === "ring"
|
||||||
|
));
|
||||||
switch (newState) {
|
switch (newState) {
|
||||||
case CallState.Ringing:
|
case CallState.Ringing:
|
||||||
if (
|
if (pushRuleEnabled && tweakSetToRing) {
|
||||||
incomingCallPushRule?.enabled &&
|
|
||||||
incomingCallPushRule.actions.some((a: Tweaks) => (
|
|
||||||
a.set_tweak === TweakName.Sound &&
|
|
||||||
a.value === "ring"
|
|
||||||
))
|
|
||||||
) {
|
|
||||||
this.play(AudioID.Ring);
|
this.play(AudioID.Ring);
|
||||||
} else {
|
} else {
|
||||||
this.silenceCall(call.callId);
|
this.silenceCall(call.callId);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue