Skip to content

Commit

Permalink
fix group alias issue
Browse files Browse the repository at this point in the history
  • Loading branch information
imndx committed Nov 13, 2019
1 parent 1640ab7 commit 39f7336
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -385,11 +385,8 @@ public GroupMember getGroupMember(String groupId, String memberId) {
return ChatManager.Instance().getGroupMember(groupId, memberId);
}

// 优先级如下:
// 1. 群备注 2. 好友备注 3. 用户displayName 4. <uid>
public String getGroupMemberDisplayName(String groupId, String memberId) {
UserInfo userInfo = ChatManager.Instance().getUserInfo(memberId, groupId, false);
return userInfo == null ? "<" + memberId + ">" : userInfo.displayName;
return ChatManager.Instance().getGroupMemberDisplayName(groupId, memberId);
}

public MutableLiveData<OperateResult<List<GroupInfo>>> getMyGroups() {
Expand Down
12 changes: 11 additions & 1 deletion client/src/main/java/cn/wildfirechat/remote/ChatManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -1949,12 +1949,21 @@ public List<String> getMyFriendList(boolean refresh) {
}
}

// 优先级如下:
// 1. 群备注 2. 好友备注 3. 用户displayName 4. <uid>
public String getGroupMemberDisplayName(String groupId, String memberId) {
UserInfo userInfo = getUserInfo(memberId, groupId, false);
if (userInfo == null) {
return "<" + memberId + ">";
}
return userInfo.displayName;
if (!TextUtils.isEmpty(userInfo.groupAlias)) {
return userInfo.groupAlias;
} else if (!TextUtils.isEmpty(userInfo.friendAlias)) {
return userInfo.friendAlias;
} else if (!TextUtils.isEmpty(userInfo.displayName)) {
return userInfo.displayName;
}
return "<" + memberId + ">";
}

public String getUserDisplayName(UserInfo userInfo) {
Expand Down Expand Up @@ -3396,6 +3405,7 @@ public void commitTransaction() {
e.printStackTrace();
}
}

/**
* IM服务进程是否bind成功
*
Expand Down

0 comments on commit 39f7336

Please sign in to comment.