mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-06-16 05:55:20 +00:00
Display author info
This commit is contained in:
parent
d080951f11
commit
7ec1611c08
@ -1926,6 +1926,7 @@ class ChatListItemNode: ItemListRevealOptionsItemNode {
|
||||
|
||||
var displayForwardedIcon = false
|
||||
var displayStoryReplyIcon = false
|
||||
var ignoreForwardedIcon = false
|
||||
|
||||
switch contentData {
|
||||
case let .chat(itemPeer, _, _, _, text, spoilers, customEmojiRanges):
|
||||
@ -1957,6 +1958,29 @@ class ChatListItemNode: ItemListRevealOptionsItemNode {
|
||||
}
|
||||
}
|
||||
|
||||
if case .chatList = item.chatListLocation, itemPeer.peerId == item.context.account.peerId, let message = messages.first {
|
||||
var effectiveAuthor: Peer? = message.author?._asPeer()
|
||||
if let forwardInfo = message.forwardInfo {
|
||||
effectiveAuthor = forwardInfo.author
|
||||
if effectiveAuthor == nil, let authorSignature = forwardInfo.authorSignature {
|
||||
effectiveAuthor = TelegramUser(id: PeerId(namespace: Namespaces.Peer.Empty, id: PeerId.Id._internalFromInt64Value(Int64(authorSignature.persistentHashValue % 32))), accessHash: nil, firstName: authorSignature, lastName: nil, username: nil, phone: nil, photo: [], botInfo: nil, restrictionInfo: nil, flags: [], emojiStatus: nil, usernames: [], storiesHidden: nil, nameColor: nil, backgroundEmojiId: nil, profileColor: nil, profileBackgroundEmojiId: nil)
|
||||
}
|
||||
}
|
||||
if let sourceAuthorInfo = message._asMessage().sourceAuthorInfo {
|
||||
if let originalAuthor = sourceAuthorInfo.originalAuthor, let peer = message.peers[originalAuthor] {
|
||||
effectiveAuthor = peer
|
||||
} else if let authorSignature = sourceAuthorInfo.originalAuthorName {
|
||||
effectiveAuthor = TelegramUser(id: PeerId(namespace: Namespaces.Peer.Empty, id: PeerId.Id._internalFromInt64Value(Int64(authorSignature.persistentHashValue % 32))), accessHash: nil, firstName: authorSignature, lastName: nil, username: nil, phone: nil, photo: [], botInfo: nil, restrictionInfo: nil, flags: [], emojiStatus: nil, usernames: [], storiesHidden: nil, nameColor: nil, backgroundEmojiId: nil, profileColor: nil, profileBackgroundEmojiId: nil)
|
||||
}
|
||||
}
|
||||
|
||||
if let effectiveAuthor, effectiveAuthor.id != itemPeer.chatMainPeer?.id {
|
||||
authorIsCurrentChat = false
|
||||
peerText = EnginePeer(effectiveAuthor).displayTitle(strings: item.presentationData.strings, displayOrder: item.presentationData.nameDisplayOrder)
|
||||
ignoreForwardedIcon = true
|
||||
}
|
||||
}
|
||||
|
||||
if let _ = peerText, case let .channel(channel) = itemPeer.chatMainPeer, channel.flags.contains(.isForum), threadInfo == nil {
|
||||
if let forumTopicData = forumTopicData {
|
||||
forumThread = (forumTopicData.id, forumTopicData.title, forumTopicData.iconFileId, forumTopicData.iconColor, forumTopicData.isUnread)
|
||||
@ -2166,12 +2190,14 @@ class ChatListItemNode: ItemListRevealOptionsItemNode {
|
||||
|
||||
attributedText = composedString
|
||||
|
||||
if case .savedMessagesChats = item.chatListLocation {
|
||||
displayForwardedIcon = false
|
||||
} else if let forwardInfo = message.forwardInfo, !forwardInfo.flags.contains(.isImported) {
|
||||
displayForwardedIcon = true
|
||||
} else if let _ = message.attributes.first(where: { $0 is ReplyStoryAttribute }) {
|
||||
displayStoryReplyIcon = true
|
||||
if !ignoreForwardedIcon {
|
||||
if case .savedMessagesChats = item.chatListLocation {
|
||||
displayForwardedIcon = false
|
||||
} else if let forwardInfo = message.forwardInfo, !forwardInfo.flags.contains(.isImported) {
|
||||
displayForwardedIcon = true
|
||||
} else if let _ = message.attributes.first(where: { $0 is ReplyStoryAttribute }) {
|
||||
displayStoryReplyIcon = true
|
||||
}
|
||||
}
|
||||
|
||||
var displayMediaPreviews = true
|
||||
|
Loading…
x
Reference in New Issue
Block a user