Skip to content

Commit

Permalink
更新修改群昵称提示
Browse files Browse the repository at this point in the history
  • Loading branch information
imndx committed Dec 16, 2020
1 parent 74ea2e3 commit c1560a6
Showing 1 changed file with 23 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
import cn.wildfirechat.message.core.ContentTag;
import cn.wildfirechat.message.core.MessagePayload;
import cn.wildfirechat.message.core.PersistFlag;
import cn.wildfirechat.model.UserInfo;
import cn.wildfirechat.remote.ChatManager;

import static cn.wildfirechat.message.core.MessageContentType.ContentType_MODIFY_GROUP_ALIAS;
Expand All @@ -35,16 +36,32 @@ public ModifyGroupAliasNotificationContent() {
public String formatNotification(Message message) {
StringBuilder sb = new StringBuilder();
if (fromSelf) {
sb.append("");
sb.append("");
} else {
sb.append(ChatManager.Instance().getUserDisplayName(operateUser));
UserInfo userInfo = ChatManager.Instance().getUserInfo(operateUser, groupId, false);
if (!TextUtils.isEmpty(memberId) && !TextUtils.isEmpty(userInfo.groupAlias)) {
sb.append(userInfo.groupAlias);
} else if (!TextUtils.isEmpty(userInfo.friendAlias)) {
sb.append(userInfo.friendAlias);
} else if (!TextUtils.isEmpty(userInfo.displayName)) {
sb.append(userInfo.displayName);
} else {
sb.append(operateUser);
}
}
sb.append("修改");
if(!TextUtils.isEmpty(memberId) && !memberId.equals(operateUser)) {
sb.append(ChatManager.Instance().getUserDisplayName(memberId));
if (!TextUtils.isEmpty(memberId)) {
UserInfo userInfo = ChatManager.Instance().getUserInfo(memberId, false);
if (!TextUtils.isEmpty(userInfo.friendAlias)) {
sb.append(userInfo.friendAlias);
} else if (!TextUtils.isEmpty(userInfo.displayName)) {
sb.append(userInfo.displayName);
} else {
sb.append(memberId);
}
sb.append("的");
}
sb.append("群名片为");
sb.append("群昵称为");
sb.append(alias);

return sb.toString();
Expand All @@ -59,7 +76,7 @@ public MessagePayload encode() {
objWrite.put("g", groupId);
objWrite.put("o", operateUser);
objWrite.put("n", alias);
if(!TextUtils.isEmpty(memberId)) {
if (!TextUtils.isEmpty(memberId)) {
objWrite.put("m", memberId);
}

Expand Down

0 comments on commit c1560a6

Please sign in to comment.