a workaround to make ocnfetti work on recipient side.

changed the implementation of on.Event.decrypted function
This commit is contained in:
nurjinn jafar 2020-08-25 16:39:57 +02:00
parent 4527755f7e
commit 5753c96431
2 changed files with 13 additions and 13 deletions

View file

@ -511,7 +511,6 @@ export default createReactClass({
this.context.removeListener("deviceVerificationChanged", this.onDeviceVerificationChanged);
this.context.removeListener("userTrustStatusChanged", this.onUserVerificationChanged);
this.context.removeListener("crossSigning.keysChanged", this.onCrossSigningKeysChanged);
this.context.removeListener("Event.decrypted", this.onEventDecrypted);
}
window.removeEventListener('beforeunload', this.onPageUnload);
@ -753,16 +752,16 @@ export default createReactClass({
}
}
if (!SettingsStore.getValue('dontShowChatEffects')) {
this.context.on('Event.decrypted', this.onEventDecrypted);
this.context.on("Event.decrypted", (ev) => {
if (ev.isBeingDecrypted() || ev.isDecryptionFailure()) return;
this.handleConfetti(ev);
});
}
},
onEventDecrypted(ev) {
if (ev.isBeingDecrypted() || ev.isDecryptionFailure()) return;
this.handleConfetti(ev);
},
handleConfetti(ev) {
if (this.context.isInitialSyncComplete()) {
if (isConfettiEmoji(ev.getContent())) {
const messageBody = _t('sends confetti');
if (isConfettiEmoji(ev.getContent()) || ev.getContent().body === messageBody) {
dis.dispatch({action: 'confetti'});
}
}