Skip to content

Commit 8e4879e

Browse files
committed
修正:
消息标题(群聊时的群名,单聊时对方ID)中的表情无法正确显示
1 parent bdec36a commit 8e4879e

File tree

3 files changed

+25
-7
lines changed

3 files changed

+25
-7
lines changed

src/main/java/com/oasisfeng/nevo/decorators/wechat/EmojiMap.java

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,32 +13,47 @@ public class EmojiMap {
1313
// Pull Request is welcome. (columns are split by "tab" for visual alignment)
1414
// Proper emoji is needed for commented lines.
1515
static final String[][] MAP = new String[][] {
16+
{ "表情", null, "㊙️" },
17+
{ "链接", null, "🔗" },
1618
{ "OK", "OK", "👌" },
1719
{ "耶", "Yeah!", "✌" },
1820
{ "嘘", "Silent", "🤫" },
1921
{ "晕", "Dizzy", "😲" },
2022
{ "衰", "BadLuck", "😳" },
23+
{ "脸红", null, "😳" },
2124
{ "色", "Drool", "😍" },
2225
{ "囧", "Tension", "☺" },
23-
{ "鸡", "Chick", "🐥" },
26+
{ "热情", null, "☺" },
27+
{ "鸡", "Chick", "🐥" }, // missing
2428
{ "强", "Thumbs Up", "👍" },
2529
{ "弱", "Weak", "👎" },
26-
{ "睡", "Sleep", "😴" },
30+
{ "睡", "Sleep", "😴" }, // missing
2731
{ "吐", "Puke", "🤢" },
2832
{ "困", "Drowsy", "😪" },
33+
{ "睡觉", null, "😪" },
2934
{ "發", "Rich", "🀅" },
3035
{ "微笑", "Smile", "😃" },
36+
{ "大笑", null, "😃" }, // iOS 7.0.4
37+
{ "开心", null, "😃" }, // Android 7.0.4
3138
{ "撇嘴", "Grimace", "😖" },
39+
{ "呸", null, "😖" },
3240
{ "发呆", "Scowl", "😳" },
33-
{ "得意", "CoolGuy", "😎" },
41+
{ "脸红", null, "😳" },
42+
{ "得意", "CoolGuy", "😎" }, // missing
3443
{ "流泪", "Sob", "😭" },
44+
{ "哭", null, "😭" },
3545
{ "害羞", "Shy", "☺" },
36-
{ "闭嘴", "Shutup", "🤐" },
46+
{ "闭嘴", "Shutup", "🤐" }, // missing
3747
{ "大哭", "Cry", "😣" },
48+
{ "悔恨", null, "😣" },
3849
{ "尴尬", "Awkward", "😰" },
50+
{ "担心", null, "😰" },
3951
{ "发怒", "Angry", "😡" },
52+
{ "生气", null, "😡" },
4053
{ "调皮", "Tongue", "😜" },
54+
{ "戏弄", null, "😜" },
4155
{ "呲牙", "Grin", "😁" },
56+
{ "露齿笑", null, "😁" },
4257
{ "惊讶", "Surprise", "😱" },
4358
{ "难过", "Frown", "🙁" },
4459
{ "抓狂", "Scream", "😫" },
@@ -99,6 +114,7 @@ public class EmojiMap {
99114
// { "机智", "Smart", "" },
100115
// { "抠鼻", "DigNose", "" },
101116
// { "可怜", "Whimper", "" },
117+
{ "皇冠", null, "👑" },
102118
{ "快哭了", "Puling", "😔" },
103119
// { "左哼哼", "Bah!L", "" },
104120
// { "右哼哼", "Bah!R", "" },

src/main/java/com/oasisfeng/nevo/decorators/wechat/EmojiTranslator.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,10 @@ public class EmojiTranslator {
1717
private static final Map<String, String> ENGLISH_MAP = new HashMap<>(EmojiMap.MAP.length);
1818
static {
1919
for (final String[] entry : EmojiMap.MAP) {
20-
CHINESE_MAP.put(entry[0], entry[2]);
21-
ENGLISH_MAP.put(entry[1], entry[2]);
20+
if (entry[0] != null)
21+
CHINESE_MAP.put(entry[0], entry[2]);
22+
if (entry[1] != null)
23+
ENGLISH_MAP.put(entry[1], entry[2]);
2224
}
2325
}
2426

src/main/java/com/oasisfeng/nevo/decorators/wechat/MessagingBuilder.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ class MessagingBuilder {
9696
final Notification notification = each.getNotification();
9797
tickerArray.put(notification.when, notification.tickerText);
9898
final Bundle its_extras = notification.extras;
99-
final CharSequence its_title = its_extras.getCharSequence(Notification.EXTRA_TITLE);
99+
final CharSequence its_title = EmojiTranslator.translate(its_extras.getCharSequence(Notification.EXTRA_TITLE));
100100
if (! title.equals(its_title)) {
101101
Log.d(TAG, "Skip other conversation with the same key in archive: " + its_title); // ID reset by WeChat due to notification removal in previous evolving
102102
continue;

0 commit comments

Comments
 (0)