Skip to content

Commit

Permalink
add animated emoji
Browse files Browse the repository at this point in the history
  • Loading branch information
trazyn committed Oct 30, 2017
1 parent bbb5ed7 commit 814faeb
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 4 deletions.
3 changes: 2 additions & 1 deletion src/js/pages/Home/ChatContent/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,7 @@ export default class ChatContent extends Component {
</div>
`;
case 47:
case 49 + 8:
// External emoji
let emoji = message.emoji;

Expand Down Expand Up @@ -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,
Expand Down
21 changes: 18 additions & 3 deletions src/js/stores/chat.js
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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'})。`;
Expand Down
1 change: 1 addition & 0 deletions src/js/utils/helper.js
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,7 @@ const helper = {
return '[Video]';

case 47:
case 49 + 8:
// Emoji
return '[Emoji]';

Expand Down

0 comments on commit 814faeb

Please sign in to comment.