mirror of
https://gitlab.opencode.de/bwi/bundesmessenger/clients/bundesmessenger-ios.git
synced 2026-04-29 20:56:57 +02:00
Consider displaying names in typing notifications
This commit is contained in:
@@ -32,10 +32,17 @@ class RoomTypingBubbleCell: UITableViewCell {
|
||||
// MARK: - members
|
||||
|
||||
private var userPictureViews: Array<MXKImageView> = Array()
|
||||
private var typingUsers: Array<MXRoomMember> = Array()
|
||||
|
||||
// MARK: - Lifecycle
|
||||
|
||||
override func awakeFromNib() {
|
||||
super.awakeFromNib()
|
||||
|
||||
additionalUsersLabel?.textColor = ThemeService.shared().theme.textSecondaryColor
|
||||
dotsView?.highlightedDotColor = ThemeService.shared().theme.textTertiaryColor
|
||||
dotsView?.dotColor = ThemeService.shared().theme.textSecondaryColor
|
||||
}
|
||||
|
||||
override func prepareForReuse() {
|
||||
super.prepareForReuse()
|
||||
|
||||
@@ -97,7 +104,22 @@ class RoomTypingBubbleCell: UITableViewCell {
|
||||
self.contentView.addSubview(pictureView)
|
||||
}
|
||||
|
||||
additionalUsersLabel?.text = typingUsers.count <= 4 ? nil : "+\(typingUsers.count - 4)"
|
||||
switch typingUsers.count {
|
||||
case 0:
|
||||
additionalUsersLabel?.text = nil
|
||||
case 1:
|
||||
additionalUsersLabel?.text = firstUserNameFor(typingUsers)
|
||||
default:
|
||||
additionalUsersLabel?.text = VectorL10n.roomMultipleTypingNotification(firstUserNameFor(typingUsers) ?? "")
|
||||
}
|
||||
self.setNeedsLayout()
|
||||
}
|
||||
|
||||
private func firstUserNameFor(_ typingUsers: Array<MXRoomMember>) -> String? {
|
||||
guard let firstUser = typingUsers.first else {
|
||||
return nil
|
||||
}
|
||||
|
||||
return firstUser.displayname.isEmptyOrNil ? firstUser.userId : firstUser.displayname
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user