added sticker viewing support

This commit is contained in:
unknown 2021-08-18 14:56:23 +05:30
parent 78c4c67a6c
commit 804248d6ad

View file

@ -55,6 +55,7 @@ function isMedia(mE) {
|| mE.getContent()?.msgtype === 'm.image' || mE.getContent()?.msgtype === 'm.image'
|| mE.getContent()?.msgtype === 'm.audio' || mE.getContent()?.msgtype === 'm.audio'
|| mE.getContent()?.msgtype === 'm.video' || mE.getContent()?.msgtype === 'm.video'
|| mE.getType() === 'm.sticker'
); );
} }
@ -71,7 +72,10 @@ function genMediaContent(mE) {
if (typeof mediaMXC === 'undefined' || mediaMXC === '') return <span style={{ color: 'var(--bg-danger)' }}>Malformed event</span>; if (typeof mediaMXC === 'undefined' || mediaMXC === '') return <span style={{ color: 'var(--bg-danger)' }}>Malformed event</span>;
switch (mE.getContent()?.msgtype) { let msgType = mE.getContent()?.msgtype;
if (mE.getType() === 'm.sticker') msgType = 'm.image';
switch (msgType) {
case 'm.file': case 'm.file':
return ( return (
<Media.File <Media.File
@ -457,6 +461,7 @@ function ChannelViewContent({
mEvent.getType() !== 'm.room.message' mEvent.getType() !== 'm.room.message'
&& mEvent.getType() !== 'm.room.encrypted' && mEvent.getType() !== 'm.room.encrypted'
&& mEvent.getType() !== 'm.room.member' && mEvent.getType() !== 'm.room.member'
&& mEvent.getType() !== 'm.sticker'
) return false; ) return false;
if (mEvent.getRelation()?.rel_type === 'm.replace') return false; if (mEvent.getRelation()?.rel_type === 'm.replace') return false;