|
@@ -25,7 +25,7 @@ class ContactCell: UITableViewCell {
|
|
private let imgSize: CGFloat = 20
|
|
private let imgSize: CGFloat = 20
|
|
|
|
|
|
lazy var toplineStackView: UIStackView = {
|
|
lazy var toplineStackView: UIStackView = {
|
|
- let stackView = UIStackView(arrangedSubviews: [titleLabel, mutedIndicator, pinnedIndicator, timeLabel, locationStreamingIndicator])
|
|
|
|
|
|
+ let stackView = UIStackView(arrangedSubviews: [titleLabel, verifiedIndicator, spacerView, mutedIndicator, pinnedIndicator, timeLabel, locationStreamingIndicator])
|
|
stackView.axis = .horizontal
|
|
stackView.axis = .horizontal
|
|
stackView.alignment = .firstBaseline
|
|
stackView.alignment = .firstBaseline
|
|
stackView.spacing = 4
|
|
stackView.spacing = 4
|
|
@@ -51,13 +51,32 @@ class ContactCell: UITableViewCell {
|
|
let label = UILabel()
|
|
let label = UILabel()
|
|
label.lineBreakMode = .byTruncatingTail
|
|
label.lineBreakMode = .byTruncatingTail
|
|
label.textColor = DcColors.defaultTextColor
|
|
label.textColor = DcColors.defaultTextColor
|
|
- label.setContentCompressionResistancePriority(UILayoutPriority(rawValue: 1), for: NSLayoutConstraint.Axis.horizontal)
|
|
|
|
label.font = UIFont.preferredFont(for: .body, weight: .medium)
|
|
label.font = UIFont.preferredFont(for: .body, weight: .medium)
|
|
label.adjustsFontForContentSizeCategory = true
|
|
label.adjustsFontForContentSizeCategory = true
|
|
|
|
+ label.setContentCompressionResistancePriority(UILayoutPriority(rawValue: 1), for: .horizontal)
|
|
label.isAccessibilityElement = false
|
|
label.isAccessibilityElement = false
|
|
return label
|
|
return label
|
|
}()
|
|
}()
|
|
|
|
|
|
|
|
+ private lazy var verifiedIndicator: UIImageView = {
|
|
|
|
+ let imgView = UIImageView()
|
|
|
|
+ let img = UIImage(named: "verified")
|
|
|
|
+ imgView.isHidden = true
|
|
|
|
+ imgView.image = img
|
|
|
|
+ imgView.translatesAutoresizingMaskIntoConstraints = false
|
|
|
|
+ imgView.setContentCompressionResistancePriority(.required, for: .horizontal)
|
|
|
|
+ imgView.isAccessibilityElement = false
|
|
|
|
+ return imgView
|
|
|
|
+ }()
|
|
|
|
+
|
|
|
|
+ private lazy var spacerView: UIView = {
|
|
|
|
+ let view = UIView()
|
|
|
|
+ view.translatesAutoresizingMaskIntoConstraints = false
|
|
|
|
+ view.setContentCompressionResistancePriority(UILayoutPriority(rawValue: 1), for: .horizontal)
|
|
|
|
+ view.isAccessibilityElement = false
|
|
|
|
+ return view
|
|
|
|
+ }()
|
|
|
|
+
|
|
lazy var pinnedIndicator: UIImageView = {
|
|
lazy var pinnedIndicator: UIImageView = {
|
|
let view = UIImageView()
|
|
let view = UIImageView()
|
|
view.translatesAutoresizingMaskIntoConstraints = false
|
|
view.translatesAutoresizingMaskIntoConstraints = false
|
|
@@ -216,6 +235,8 @@ class ContactCell: UITableViewCell {
|
|
verticalStackView.axis = .vertical
|
|
verticalStackView.axis = .vertical
|
|
|
|
|
|
toplineStackView.addConstraints([
|
|
toplineStackView.addConstraints([
|
|
|
|
+ verifiedIndicator.constraintHeightTo(titleLabel.font.pointSize * 0.95),
|
|
|
|
+ verifiedIndicator.widthAnchor.constraint(equalTo: verifiedIndicator.heightAnchor),
|
|
pinnedIndicator.constraintHeightTo(titleLabel.font.pointSize * 1.2),
|
|
pinnedIndicator.constraintHeightTo(titleLabel.font.pointSize * 1.2),
|
|
mutedIndicator.constraintHeightTo(titleLabel.font.pointSize * 1.2),
|
|
mutedIndicator.constraintHeightTo(titleLabel.font.pointSize * 1.2),
|
|
locationStreamingIndicator.constraintHeightTo(titleLabel.font.pointSize * 1.2)
|
|
locationStreamingIndicator.constraintHeightTo(titleLabel.font.pointSize * 1.2)
|
|
@@ -252,8 +273,9 @@ class ContactCell: UITableViewCell {
|
|
avatar.setName(name)
|
|
avatar.setName(name)
|
|
}
|
|
}
|
|
|
|
|
|
- func setStatusIndicators(unreadCount: Int, status: Int, visibility: Int32, isLocationStreaming: Bool, isMuted: Bool, isContactRequest: Bool, isArchiveLink: Bool) {
|
|
|
|
|
|
+ func setStatusIndicators(unreadCount: Int, status: Int, visibility: Int32, isLocationStreaming: Bool, isMuted: Bool, isContactRequest: Bool, isArchiveLink: Bool, isVerified: Bool) {
|
|
unreadMessageCounter.backgroundColor = isMuted || isArchiveLink ? DcColors.unreadBadgeMuted : DcColors.unreadBadge
|
|
unreadMessageCounter.backgroundColor = isMuted || isArchiveLink ? DcColors.unreadBadgeMuted : DcColors.unreadBadge
|
|
|
|
+ verifiedIndicator.isHidden = !isVerified
|
|
|
|
|
|
if isLargeText {
|
|
if isLargeText {
|
|
unreadMessageCounter.setCount(unreadCount)
|
|
unreadMessageCounter.setCount(unreadCount)
|
|
@@ -356,7 +378,6 @@ class ContactCell: UITableViewCell {
|
|
} else {
|
|
} else {
|
|
setBackupImage(name: chat.name, color: chat.color)
|
|
setBackupImage(name: chat.name, color: chat.color)
|
|
}
|
|
}
|
|
- setVerified(isVerified: chat.isProtected)
|
|
|
|
let recentlySeen = DcUtils.showRecentlySeen(context: cellViewModel.dcContext, chat: chat)
|
|
let recentlySeen = DcUtils.showRecentlySeen(context: cellViewModel.dcContext, chat: chat)
|
|
avatar.setRecentlySeen(recentlySeen)
|
|
avatar.setRecentlySeen(recentlySeen)
|
|
setTimeLabel(chatData.summary.timestamp)
|
|
setTimeLabel(chatData.summary.timestamp)
|
|
@@ -366,7 +387,8 @@ class ContactCell: UITableViewCell {
|
|
isLocationStreaming: chat.isSendingLocations,
|
|
isLocationStreaming: chat.isSendingLocations,
|
|
isMuted: chat.isMuted,
|
|
isMuted: chat.isMuted,
|
|
isContactRequest: isContactRequest,
|
|
isContactRequest: isContactRequest,
|
|
- isArchiveLink: chatData.chatId == DC_CHAT_ID_ARCHIVED_LINK)
|
|
|
|
|
|
+ isArchiveLink: chatData.chatId == DC_CHAT_ID_ARCHIVED_LINK,
|
|
|
|
+ isVerified: chat.isProtected)
|
|
|
|
|
|
case .contact(let contactData):
|
|
case .contact(let contactData):
|
|
let contact = cellViewModel.dcContext.getContact(id: contactData.contactId)
|
|
let contact = cellViewModel.dcContext.getContact(id: contactData.contactId)
|
|
@@ -377,7 +399,6 @@ class ContactCell: UITableViewCell {
|
|
avatar.setName(cellViewModel.title)
|
|
avatar.setName(cellViewModel.title)
|
|
avatar.setColor(contact.color)
|
|
avatar.setColor(contact.color)
|
|
}
|
|
}
|
|
- setVerified(isVerified: contact.isVerified)
|
|
|
|
avatar.setRecentlySeen(contact.wasSeenRecently)
|
|
avatar.setRecentlySeen(contact.wasSeenRecently)
|
|
setStatusIndicators(unreadCount: 0,
|
|
setStatusIndicators(unreadCount: 0,
|
|
status: 0,
|
|
status: 0,
|
|
@@ -385,7 +406,8 @@ class ContactCell: UITableViewCell {
|
|
isLocationStreaming: false,
|
|
isLocationStreaming: false,
|
|
isMuted: false,
|
|
isMuted: false,
|
|
isContactRequest: false,
|
|
isContactRequest: false,
|
|
- isArchiveLink: false)
|
|
|
|
|
|
+ isArchiveLink: false,
|
|
|
|
+ isVerified: contact.isVerified)
|
|
case .profile:
|
|
case .profile:
|
|
let contact = cellViewModel.dcContext.getContact(id: Int(DC_CONTACT_ID_SELF))
|
|
let contact = cellViewModel.dcContext.getContact(id: Int(DC_CONTACT_ID_SELF))
|
|
titleLabel.text = cellViewModel.title
|
|
titleLabel.text = cellViewModel.title
|
|
@@ -396,7 +418,6 @@ class ContactCell: UITableViewCell {
|
|
avatar.setName(cellViewModel.title)
|
|
avatar.setName(cellViewModel.title)
|
|
avatar.setColor(contact.color)
|
|
avatar.setColor(contact.color)
|
|
}
|
|
}
|
|
- setVerified(isVerified: false)
|
|
|
|
avatar.setRecentlySeen(false)
|
|
avatar.setRecentlySeen(false)
|
|
setStatusIndicators(unreadCount: 0,
|
|
setStatusIndicators(unreadCount: 0,
|
|
status: 0,
|
|
status: 0,
|
|
@@ -404,7 +425,8 @@ class ContactCell: UITableViewCell {
|
|
isLocationStreaming: false,
|
|
isLocationStreaming: false,
|
|
isMuted: false,
|
|
isMuted: false,
|
|
isContactRequest: false,
|
|
isContactRequest: false,
|
|
- isArchiveLink: false)
|
|
|
|
|
|
+ isArchiveLink: false,
|
|
|
|
+ isVerified: false)
|
|
}
|
|
}
|
|
|
|
|
|
accessibilityLabel = (titleLabel.text != nil ? ((titleLabel.text ?? "")+"\n") : "")
|
|
accessibilityLabel = (titleLabel.text != nil ? ((titleLabel.text ?? "")+"\n") : "")
|