You've already forked matrix-react-sdk
mirror of
https://github.com/matrix-org/matrix-react-sdk.git
synced 2025-11-05 23:10:41 +03:00
refactoring roomView / slashCommands / SendMessageComposer with the new effects configurations and fix confetti animation timeout
This commit is contained in:
@@ -73,7 +73,8 @@ import {XOR} from "../../@types/common";
|
||||
import { IThreepidInvite } from "../../stores/ThreepidInviteStore";
|
||||
import { CallState, CallType, MatrixCall } from "matrix-js-sdk/lib/webrtc/call";
|
||||
import EffectsOverlay from "../views/elements/effects/EffectsOverlay";
|
||||
import { isConfettiEmoji } from '../views/elements/effects/confetti';
|
||||
import {containsEmoji} from '../views/elements/effects/effectUtilities';
|
||||
import effects from '../views/elements/effects'
|
||||
|
||||
const DEBUG = false;
|
||||
let debuglog = function(msg: string) {};
|
||||
@@ -800,10 +801,9 @@ export default class RoomView extends React.Component<IProps, IState> {
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
private onEventDecrypted = (ev) => {
|
||||
if (ev.isBeingDecrypted() || ev.isDecryptionFailure() ||
|
||||
this.state.room.getUnreadNotificationCount() === 0) return;
|
||||
if (ev.isDecryptionFailure()) return;
|
||||
this.handleConfetti(ev);
|
||||
};
|
||||
|
||||
@@ -813,11 +813,13 @@ export default class RoomView extends React.Component<IProps, IState> {
|
||||
};
|
||||
|
||||
private handleConfetti = (ev) => {
|
||||
if (this.state.room.getUnreadNotificationCount() === 0) return;
|
||||
if (this.state.matrixClientIsReady) {
|
||||
const messageBody = 'sends confetti';
|
||||
if (isConfettiEmoji(ev.getContent()) || ev.getContent().body === messageBody) {
|
||||
dis.dispatch({action: 'effects.confetti'});
|
||||
}
|
||||
effects.map(effect => {
|
||||
if (containsEmoji(ev.getContent(), effect.emojis) || ev.getContent().msgtype === effect.msgType) {
|
||||
dis.dispatch({action: `effects.${effect.command}`});
|
||||
}
|
||||
})
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user