This commit is contained in:
Mirco Wittrien 2019-01-02 11:17:05 +01:00
parent 6d7f4e70e2
commit 430ac26541
2 changed files with 4 additions and 18 deletions

File diff suppressed because one or more lines are too long

View File

@ -90,8 +90,6 @@ class NotificationSounds {
this.choices = []; this.choices = [];
this.firedEvents = {}; this.firedEvents = {};
this.callingModules = {};
} }
getName () {return "NotificationSounds";} getName () {return "NotificationSounds";}
@ -245,13 +243,6 @@ class NotificationSounds {
stop () { stop () {
if (typeof BDFDB === "object") { if (typeof BDFDB === "object") {
for (let instancetype in this.callingModules) {
if (this.callingModules[instancetype] && this.callingModules[instancetype].instance) {
this.callingModules[instancetype].instance.startRinging = this.callingModules[instancetype].startRinging;
this.callingModules[instancetype].instance.stopRinging = this.callingModules[instancetype].stopRinging;
}
}
BDFDB.unloadMessage(this); BDFDB.unloadMessage(this);
} }
} }
@ -456,11 +447,6 @@ class NotificationSounds {
} }
patchCallingSound (instance, instancetype, type) { patchCallingSound (instance, instancetype, type) {
this.callingModules[instancetype] = {
instance: instance,
startRinging: instance.startRinging,
stopRinging: instance.stopRinging,
};
let audio = new Audio(); let audio = new Audio();
let play = () => { let play = () => {
if (!audio.paused || this.dontPlayAudio(type)) return; if (!audio.paused || this.dontPlayAudio(type)) return;
@ -471,8 +457,8 @@ class NotificationSounds {
}; };
let stop = () => {audio.pause();} let stop = () => {audio.pause();}
instance.stopRinging(); instance.stopRinging();
instance.startRinging = play; BDFDB.WebModules.patch(instance, "startRinging", this, {instead: play});
instance.stopRinging = stop; BDFDB.WebModules.patch(instance, "stopRinging", this, {instead: stop});
BDFDB.WebModules.patch(instance._reactInternalFiber.type.prototype, "startRinging", this, {instead: play}); BDFDB.WebModules.patch(instance._reactInternalFiber.type.prototype, "startRinging", this, {instead: play});
BDFDB.WebModules.patch(instance._reactInternalFiber.type.prototype, "stopRinging", this, {instead: stop}); BDFDB.WebModules.patch(instance._reactInternalFiber.type.prototype, "stopRinging", this, {instead: stop});
BDFDB.WebModules.unpatch(instance._reactInternalFiber.type.prototype, this.patchModules[instancetype], this); BDFDB.WebModules.unpatch(instance._reactInternalFiber.type.prototype, this.patchModules[instancetype], this);
@ -481,7 +467,7 @@ class NotificationSounds {
processIncomingCalls (instance, wrapper) { processIncomingCalls (instance, wrapper) {
this.patchCallingSound(instance, "IncomingCalls", "call_ringing"); this.patchCallingSound(instance, "IncomingCalls", "call_ringing");
} }
processPrivateChannelCall (instance, wrapper) { processPrivateChannelCall (instance, wrapper) {
this.patchCallingSound(instance, "PrivateChannelCall", "call_calling"); this.patchCallingSound(instance, "PrivateChannelCall", "call_calling");
} }