mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-07-23 19:50:47 +00:00
Merge branch 'master' of gitlab.com:peter-iakovlev/telegram-ios
This commit is contained in:
commit
03a92bcba1
@ -553,9 +553,11 @@ class ChatListItemNode: ItemListRevealOptionsItemNode {
|
||||
if let topic = topic {
|
||||
remainingWidth -= 22.0 + 2.0
|
||||
|
||||
arrowIconImage = PresentationResourcesChatList.topicArrowIcon(theme)
|
||||
if let arrowIconImage = arrowIconImage {
|
||||
remainingWidth -= arrowIconImage.size.width + 6.0 * 2.0
|
||||
if authorTitle != nil {
|
||||
arrowIconImage = PresentationResourcesChatList.topicArrowIcon(theme)
|
||||
if let arrowIconImage = arrowIconImage {
|
||||
remainingWidth -= arrowIconImage.size.width + 6.0 * 2.0
|
||||
}
|
||||
}
|
||||
|
||||
topicTitleArguments = TextNodeLayoutArguments(attributedString: topic.title, backgroundColor: nil, maximumNumberOfLines: 1, truncationType: .end, constrainedSize: CGSize(width: remainingWidth, height: CGFloat.greatestFiniteMagnitude), alignment: .natural, cutout: nil, insets: UIEdgeInsets(top: 2.0, left: 1.0, bottom: 2.0, right: 1.0))
|
||||
@ -565,6 +567,7 @@ class ChatListItemNode: ItemListRevealOptionsItemNode {
|
||||
|
||||
var size = authorTitleLayout.0.size
|
||||
if let topicTitleLayout = topicTitleLayout {
|
||||
size.height = max(size.height, topicTitleLayout.0.size.height)
|
||||
size.width += 10.0 + topicTitleLayout.0.size.width
|
||||
}
|
||||
|
||||
@ -578,7 +581,11 @@ class ChatListItemNode: ItemListRevealOptionsItemNode {
|
||||
self.authorNode.frame = authorFrame
|
||||
|
||||
var nextX = authorFrame.maxX - 1.0
|
||||
if let arrowIconImage = arrowIconImage, let topic = topic {
|
||||
if authorTitle == nil {
|
||||
nextX = 0.0
|
||||
}
|
||||
|
||||
if let arrowIconImage = arrowIconImage {
|
||||
let titleTopicArrowNode: ASImageNode
|
||||
if let current = self.titleTopicArrowNode {
|
||||
titleTopicArrowNode = current
|
||||
@ -591,7 +598,14 @@ class ChatListItemNode: ItemListRevealOptionsItemNode {
|
||||
nextX += 6.0
|
||||
titleTopicArrowNode.frame = CGRect(origin: CGPoint(x: nextX, y: 5.0), size: arrowIconImage.size)
|
||||
nextX += arrowIconImage.size.width + 6.0
|
||||
|
||||
} else {
|
||||
if let titleTopicArrowNode = self.titleTopicArrowNode {
|
||||
self.titleTopicArrowNode = nil
|
||||
titleTopicArrowNode.removeFromSupernode()
|
||||
}
|
||||
}
|
||||
|
||||
if let topic {
|
||||
let titleTopicIconView: ComponentHostView<Empty>
|
||||
if let current = self.titleTopicIconView {
|
||||
titleTopicIconView = current
|
||||
@ -627,10 +641,6 @@ class ChatListItemNode: ItemListRevealOptionsItemNode {
|
||||
titleTopicIconView.frame = CGRect(origin: CGPoint(x: nextX, y: UIScreenPixel), size: iconSize)
|
||||
nextX += iconSize.width + 2.0
|
||||
} else {
|
||||
if let titleTopicArrowNode = self.titleTopicArrowNode {
|
||||
self.titleTopicArrowNode = nil
|
||||
titleTopicArrowNode.removeFromSupernode()
|
||||
}
|
||||
if let titleTopicIconView = self.titleTopicIconView {
|
||||
self.titleTopicIconView = nil
|
||||
titleTopicIconView.removeFromSuperview()
|
||||
@ -1315,6 +1325,7 @@ class ChatListItemNode: ItemListRevealOptionsItemNode {
|
||||
}
|
||||
|
||||
var authorAttributedString: NSAttributedString?
|
||||
var authorIsCurrentChat: Bool = false
|
||||
var textAttributedString: NSAttributedString?
|
||||
var textLeftCutout: CGFloat = 0.0
|
||||
var dateAttributedString: NSAttributedString?
|
||||
@ -1452,6 +1463,7 @@ class ChatListItemNode: ItemListRevealOptionsItemNode {
|
||||
peerText = authorSignature
|
||||
} else {
|
||||
peerText = author.id == account.peerId ? item.presentationData.strings.DialogList_You : EnginePeer(author).displayTitle(strings: item.presentationData.strings, displayOrder: item.presentationData.nameDisplayOrder)
|
||||
authorIsCurrentChat = author.id == peer.id
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1919,14 +1931,16 @@ class ChatListItemNode: ItemListRevealOptionsItemNode {
|
||||
}
|
||||
badgeSize = max(badgeSize, reorderInset)
|
||||
|
||||
let authorTitle = (hideAuthor && !hasDraft) ? nil : authorAttributedString
|
||||
var effectiveAuthorTitle = (hideAuthor && !hasDraft) ? nil : authorAttributedString
|
||||
|
||||
var forumThreadTitle: (title: NSAttributedString, iconId: Int64?, iconColor: Int32)?
|
||||
if let _ = authorTitle, let forumThread {
|
||||
if let _ = effectiveAuthorTitle, let forumThread {
|
||||
if authorIsCurrentChat {
|
||||
effectiveAuthorTitle = nil
|
||||
}
|
||||
forumThreadTitle = (NSAttributedString(string: forumThread.title, font: textFont, textColor: theme.authorNameColor), forumThread.iconId, forumThread.iconColor)
|
||||
}
|
||||
|
||||
let (authorLayout, authorApply) = authorLayout(item.context, rawContentWidth - badgeSize, item.presentationData.theme, authorTitle, forumThreadTitle)
|
||||
let (authorLayout, authorApply) = authorLayout(item.context, rawContentWidth - badgeSize, item.presentationData.theme, effectiveAuthorTitle, forumThreadTitle)
|
||||
|
||||
var textCutout: TextNodeCutout?
|
||||
if !textLeftCutout.isZero {
|
||||
|
@ -1394,7 +1394,9 @@ public func messagesForNotification(transaction: Transaction, id: MessageId, alw
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if threadData == nil, let threadId = message.threadId {
|
||||
threadData = transaction.getMessageHistoryThreadInfo(peerId: message.id.peerId, threadId: threadId)?.data.get(MessageHistoryThreadData.self)
|
||||
}
|
||||
|
||||
for media in message.media {
|
||||
if let action = media as? TelegramMediaAction {
|
||||
|
@ -47,7 +47,7 @@ final class ChatAvatarNavigationNode: ASDisplayNode {
|
||||
}
|
||||
|
||||
var contextAction: ((ASDisplayNode, ContextGesture?) -> Void)?
|
||||
var contextActionIsEnabled: Bool = true {
|
||||
var contextActionIsEnabled: Bool = false {
|
||||
didSet {
|
||||
if self.contextActionIsEnabled != oldValue {
|
||||
self.containerNode.isGestureEnabled = self.contextActionIsEnabled
|
||||
@ -57,6 +57,7 @@ final class ChatAvatarNavigationNode: ASDisplayNode {
|
||||
|
||||
override init() {
|
||||
self.containerNode = ContextControllerSourceNode()
|
||||
self.containerNode.isGestureEnabled = false
|
||||
self.avatarNode = AvatarNode(font: normalFont)
|
||||
self.statusView = ComponentView()
|
||||
|
||||
|
@ -4420,7 +4420,7 @@ public final class ChatControllerImpl: TelegramBaseController, ChatController, G
|
||||
imageOverride = nil
|
||||
}
|
||||
(strongSelf.chatInfoNavigationButton?.buttonItem.customDisplayNode as? ChatAvatarNavigationNode)?.setPeer(context: strongSelf.context, theme: strongSelf.presentationData.theme, peer: EnginePeer(peer), overrideImage: imageOverride)
|
||||
(strongSelf.chatInfoNavigationButton?.buttonItem.customDisplayNode as? ChatAvatarNavigationNode)?.contextActionIsEnabled = peer.restrictionText(platform: "ios", contentSettings: strongSelf.context.currentContentSettings.with { $0 }) == nil
|
||||
(strongSelf.chatInfoNavigationButton?.buttonItem.customDisplayNode as? ChatAvatarNavigationNode)?.contextActionIsEnabled = strongSelf.chatLocation.threadId == nil && peer.restrictionText(platform: "ios", contentSettings: strongSelf.context.currentContentSettings.with { $0 }) == nil
|
||||
strongSelf.chatInfoNavigationButton?.buttonItem.accessibilityLabel = presentationInterfaceState.strings.Conversation_ContextMenuOpenProfile
|
||||
}
|
||||
}
|
||||
|
@ -155,6 +155,10 @@ final class ChatMessageNotificationItemNode: NotificationItemNode {
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
if let titleValue = title, let threadData = item.threadData {
|
||||
title = "\(threadData.info.title) (\(titleValue))"
|
||||
}
|
||||
}
|
||||
} else {
|
||||
title = peer.displayTitle(strings: item.strings, displayOrder: item.nameDisplayOrder)
|
||||
|
Loading…
x
Reference in New Issue
Block a user