Skip to content

Commit a8359bb

Browse files
committed
Display user id
1 parent 5c4ad74 commit a8359bb

File tree

4 files changed

+59
-70
lines changed

4 files changed

+59
-70
lines changed

Mixin/UserInterface/Controllers/Common/Views/PeerInfoView.swift

+21-5
Original file line numberDiff line numberDiff line change
@@ -36,11 +36,13 @@ class PeerInfoView: UIView, XibDesignable {
3636
}
3737

3838
func render(result: SearchResult) {
39+
var identityNumber: String?
3940
var specializedCategory: MessageSearchResult.SpecializedCategory?
4041
switch result {
4142
case let result as UserSearchResult:
4243
let user = result.user
4344
avatarImageView.setImage(with: user.avatarUrl, userId: user.userId, name: user.fullName)
45+
identityNumber = user.identityNumber
4446
case let result as ConversationSearchResult:
4547
let conversation = result.conversation
4648
if conversation.isGroup() {
@@ -62,13 +64,15 @@ class PeerInfoView: UIView, XibDesignable {
6264
case .group(let conversation):
6365
avatarImageView.setGroupImage(with: conversation.iconUrl)
6466
case .user(let user):
67+
identityNumber = user.identityNumber
6568
avatarImageView.setImage(with: user.avatarUrl, userId: user.userId, name: user.fullName)
6669
}
6770
case let result as CircleMemberSearchResult:
6871
let member = result.member
6972
if member.category == ConversationCategory.GROUP.rawValue {
7073
avatarImageView.setGroupImage(with: member.iconUrl)
7174
} else {
75+
identityNumber = member.identityNumber
7276
avatarImageView.setImage(with: member.iconUrl, userId: member.userId ?? "", name: member.name)
7377
}
7478
case let result as PhoneContactSearchResult:
@@ -94,6 +98,9 @@ class PeerInfoView: UIView, XibDesignable {
9498
if let description = result.description {
9599
descriptionLabel.attributedText = description
96100
descriptionLabel.isHidden = false
101+
} else if let identityNumber {
102+
descriptionLabel.isHidden = false
103+
descriptionLabel.text = identityNumber
97104
} else {
98105
descriptionLabel.isHidden = true
99106
}
@@ -106,7 +113,8 @@ class PeerInfoView: UIView, XibDesignable {
106113
badgeImageView.isHidden = badgeImageView.image == nil
107114
superscriptLabel.text = nil
108115
prefixIconImageView.isHidden = true
109-
descriptionLabel.isHidden = true
116+
descriptionLabel.isHidden = false
117+
descriptionLabel.text = user.identityNumber
110118
}
111119

112120
func render(user: User, userBiographyAsSubtitle: Bool) {
@@ -116,43 +124,51 @@ class PeerInfoView: UIView, XibDesignable {
116124
badgeImageView.isHidden = badgeImageView.image == nil
117125
superscriptLabel.text = nil
118126
prefixIconImageView.isHidden = true
127+
descriptionLabel.isHidden = false
119128
if userBiographyAsSubtitle {
120-
descriptionLabel.isHidden = false
121129
descriptionLabel.text = user.biography
122130
} else {
123-
descriptionLabel.isHidden = true
131+
descriptionLabel.text = user.identityNumber
124132
}
125133
}
126134

127135
func render(receiver: MessageReceiver) {
128136
switch receiver.item {
129137
case let .group(conversation):
138+
descriptionLabel.isHidden = true
130139
avatarImageView.setGroupImage(with: conversation.iconUrl)
131140
case let .user(user):
141+
descriptionLabel.isHidden = false
142+
descriptionLabel.text = user.identityNumber
132143
avatarImageView.setImage(with: user.avatarUrl, userId: user.userId, name: user.fullName)
133144
}
134145
titleLabel.text = receiver.name
135146
badgeImageView.image = receiver.badgeImage
136147
badgeImageView.isHidden = badgeImageView.image == nil
137148
superscriptLabel.text = nil
138149
prefixIconImageView.isHidden = true
139-
descriptionLabel.isHidden = true
140150
}
141151

142152
func render(member: CircleMember) {
143153
if member.category == ConversationCategory.GROUP.rawValue {
144154
avatarImageView.setGroupImage(with: member.iconUrl)
155+
descriptionLabel.isHidden = true
145156
} else {
146157
avatarImageView.setImage(with: member.iconUrl,
147158
userId: member.userId ?? "",
148159
name: member.name)
160+
if let identityNumber = member.identityNumber {
161+
descriptionLabel.text = identityNumber
162+
descriptionLabel.isHidden = false
163+
} else {
164+
descriptionLabel.isHidden = true
165+
}
149166
}
150167
titleLabel.text = member.name
151168
badgeImageView.image = member.badgeImage
152169
badgeImageView.isHidden = badgeImageView.image == nil
153170
superscriptLabel.text = nil
154171
prefixIconImageView.isHidden = true
155-
descriptionLabel.isHidden = true
156172
}
157173

158174
func render(phoneContact: PhoneContact) {

Mixin/UserInterface/Controllers/Setting/BlockedUsersViewController.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ extension BlockedUsersViewController: UITableViewDelegate, UITableViewDataSource
5858

5959
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
6060
let cell = tableView.dequeueReusableCell(withIdentifier: cellReuseId) as! BlockUserCell
61-
cell.render(user: users[indexPath.row])
61+
cell.infoView.render(user: users[indexPath.row])
6262
return cell
6363
}
6464

Mixin/UserInterface/Controllers/Setting/Cells/BlockUserCell.swift

+1-7
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,6 @@ import MixinServices
33

44
class BlockUserCell: ModernSelectedBackgroundCell {
55

6-
@IBOutlet weak var avatarImageView: AvatarImageView!
7-
@IBOutlet weak var nameLabel: UILabel!
8-
9-
func render(user: UserItem) {
10-
avatarImageView.setImage(with: user)
11-
nameLabel.text = user.fullName
12-
}
6+
@IBOutlet weak var infoView: PeerInfoView!
137

148
}

0 commit comments

Comments
 (0)