mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-12-25 23:47:58 +00:00
no message
This commit is contained in:
29
TelegramUI/StringForMessageTimestampStatus.swift
Normal file
29
TelegramUI/StringForMessageTimestampStatus.swift
Normal file
@@ -0,0 +1,29 @@
|
||||
import Foundation
|
||||
import Postbox
|
||||
import TelegramCore
|
||||
|
||||
func stringForMessageTimestampStatus(message: Message, timeFormat: PresentationTimeFormat, strings: PresentationStrings) -> String {
|
||||
var dateText = stringForMessageTimestamp(timestamp: message.timestamp, timeFormat: timeFormat)
|
||||
|
||||
var authorTitle: String?
|
||||
if let author = message.author as? TelegramUser {
|
||||
if let peer = message.peers[message.id.peerId] as? TelegramChannel, case .broadcast = peer.info {
|
||||
authorTitle = author.displayTitle
|
||||
}
|
||||
} else {
|
||||
if let peer = message.peers[message.id.peerId] as? TelegramChannel, case .broadcast = peer.info {
|
||||
for attribute in message.attributes {
|
||||
if let attribute = attribute as? AuthorSignatureMessageAttribute {
|
||||
authorTitle = attribute.signature
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if let authorTitle = authorTitle, !authorTitle.isEmpty {
|
||||
dateText = "\(authorTitle), \(dateText)"
|
||||
}
|
||||
|
||||
return dateText
|
||||
}
|
||||
Reference in New Issue
Block a user