|
@@ -780,12 +780,12 @@ extension ChatViewController: MessagesDataSource {
|
|
|
|
|
|
var timestampAttributes: [NSAttributedString.Key: Any] = [
|
|
var timestampAttributes: [NSAttributedString.Key: Any] = [
|
|
.font: UIFont.systemFont(ofSize: 12),
|
|
.font: UIFont.systemFont(ofSize: 12),
|
|
- .foregroundColor: UIColor.lightGray,
|
|
|
|
|
|
+ .foregroundColor: DcColors.grayDateColor,
|
|
.paragraphStyle: NSParagraphStyle()
|
|
.paragraphStyle: NSParagraphStyle()
|
|
]
|
|
]
|
|
|
|
|
|
|
|
+ let text = NSMutableAttributedString()
|
|
if isFromCurrentSender(message: message) {
|
|
if isFromCurrentSender(message: message) {
|
|
- let text = NSMutableAttributedString()
|
|
|
|
if let style = NSMutableParagraphStyle.default.mutableCopy() as? NSMutableParagraphStyle {
|
|
if let style = NSMutableParagraphStyle.default.mutableCopy() as? NSMutableParagraphStyle {
|
|
style.alignment = .right
|
|
style.alignment = .right
|
|
timestampAttributes[.paragraphStyle] = style
|
|
timestampAttributes[.paragraphStyle] = style
|
|
@@ -793,6 +793,10 @@ extension ChatViewController: MessagesDataSource {
|
|
|
|
|
|
text.append(NSAttributedString(string: m.formattedSentDate(), attributes: timestampAttributes))
|
|
text.append(NSAttributedString(string: m.formattedSentDate(), attributes: timestampAttributes))
|
|
|
|
|
|
|
|
+ if m.showPadlock() {
|
|
|
|
+ attachPadlock(to: text)
|
|
|
|
+ }
|
|
|
|
+
|
|
// TODO: this should be replaced by the respective icons,
|
|
// TODO: this should be replaced by the respective icons,
|
|
// for accessibility, the a11y strings should be added
|
|
// for accessibility, the a11y strings should be added
|
|
var stateDescription: String
|
|
var stateDescription: String
|
|
@@ -827,7 +831,21 @@ extension ChatViewController: MessagesDataSource {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
- return NSAttributedString(string: m.formattedSentDate(), attributes: timestampAttributes)
|
|
|
|
|
|
+ text.append(NSAttributedString(string: m.formattedSentDate(), attributes: timestampAttributes))
|
|
|
|
+ if m.showPadlock() {
|
|
|
|
+ attachPadlock(to: text)
|
|
|
|
+ }
|
|
|
|
+ return text
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ private func attachPadlock(to text: NSMutableAttributedString) {
|
|
|
|
+ let imageAttachment = NSTextAttachment()
|
|
|
|
+ imageAttachment.image = UIImage(named: "ic_lock")
|
|
|
|
+ imageAttachment.image?.accessibilityIdentifier = String.localized("encrypted_message")
|
|
|
|
+ let imageString = NSMutableAttributedString(attachment: imageAttachment)
|
|
|
|
+ imageString.addAttributes([NSAttributedString.Key.baselineOffset: -1], range: NSRange(location: 0, length: 1))
|
|
|
|
+ text.append(NSAttributedString(string: " "))
|
|
|
|
+ text.append(imageString)
|
|
}
|
|
}
|
|
|
|
|
|
func updateMessage(_ messageId: Int) {
|
|
func updateMessage(_ messageId: Int) {
|