From 814faeb2a89c4258ccd1f876ad82983db211605b Mon Sep 17 00:00:00 2001 From: trazyn Date: Mon, 30 Oct 2017 20:48:52 +0800 Subject: [PATCH] add animated emoji --- src/js/pages/Home/ChatContent/index.js | 3 ++- src/js/stores/chat.js | 21 ++++++++++++++++++--- src/js/utils/helper.js | 1 + 3 files changed, 21 insertions(+), 4 deletions(-) diff --git a/src/js/pages/Home/ChatContent/index.js b/src/js/pages/Home/ChatContent/index.js index f9fff8d..db38a5f 100644 --- a/src/js/pages/Home/ChatContent/index.js +++ b/src/js/pages/Home/ChatContent/index.js @@ -138,6 +138,7 @@ export default class ChatContent extends Component { `; case 47: + case 49 + 8: // External emoji let emoji = message.emoji; @@ -288,7 +289,7 @@ export default class ChatContent extends Component { [classes.isText]: type === 1 && !message.location, [classes.isLocation]: type === 1 && message.location, [classes.isImage]: type === 3, - [classes.isEmoji]: type === 47, + [classes.isEmoji]: type === 47 || type === 49 + 8, [classes.isVoice]: type === 34, [classes.isContact]: type === 42, [classes.isVideo]: type === 43, diff --git a/src/js/stores/chat.js b/src/js/stores/chat.js index 3f100df..59b831a 100644 --- a/src/js/stores/chat.js +++ b/src/js/stores/chat.js @@ -48,10 +48,12 @@ async function resolveMessage(message) { // External emoji if (!content) break; - let emoji = helper.parseKV(content); + { + let emoji = helper.parseKV(content); - emoji.src = `${axios.defaults.baseURL}cgi-bin/mmwebwx-bin/webwxgetmsgimg?&msgid=${message.MsgId}&skey=${auth.skey}`; - message.emoji = emoji; + emoji.src = `${axios.defaults.baseURL}cgi-bin/mmwebwx-bin/webwxgetmsgimg?&msgid=${message.MsgId}&skey=${auth.skey}`; + message.emoji = emoji; + } break; case 42: @@ -112,6 +114,19 @@ async function resolveMessage(message) { }; break; + case 8: + // Animated emoji + if (!content) break; + + { + let emoji = helper.parseKV(content) || {}; + + emoji.src = `${axios.defaults.baseURL}cgi-bin/mmwebwx-bin/webwxgetmsgimg?&msgid=${message.MsgId}&skey=${auth.skey}&type=big`; + message.MsgType += 8; + message.emoji = emoji; + } + break; + default: console.error('Unknow app message: %o', Object.assign({}, message)); message.Content = `收到一条暂不支持的消息类型,请在手机上查看(${message.FileName || 'No Title'})。`; diff --git a/src/js/utils/helper.js b/src/js/utils/helper.js index 384d4e9..3087a11 100644 --- a/src/js/utils/helper.js +++ b/src/js/utils/helper.js @@ -128,6 +128,7 @@ const helper = { return '[Video]'; case 47: + case 49 + 8: // Emoji return '[Emoji]';