mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-12-23 06:35:51 +00:00
Pinned messages improvements
This commit is contained in:
@@ -279,7 +279,9 @@ class ChatMessageStickerItemNode: ChatMessageItemView {
|
||||
let isFailed = item.content.firstMessage.effectivelyFailed(timestamp: item.context.account.network.getApproximateRemoteTimestamp())
|
||||
|
||||
var needShareButton = false
|
||||
if isFailed || Namespaces.Message.allScheduled.contains(item.message.id.namespace) {
|
||||
if case .pinnedMessages = item.associatedData.subject {
|
||||
needShareButton = true
|
||||
} else if isFailed || Namespaces.Message.allScheduled.contains(item.message.id.namespace) {
|
||||
needShareButton = false
|
||||
} else if item.message.id.peerId == item.context.account.peerId {
|
||||
for attribute in item.content.firstMessage.attributes {
|
||||
@@ -568,7 +570,7 @@ class ChatMessageStickerItemNode: ChatMessageItemView {
|
||||
strongSelf.addSubnode(updatedShareButtonNode)
|
||||
updatedShareButtonNode.addTarget(strongSelf, action: #selector(strongSelf.shareButtonPressed), forControlEvents: .touchUpInside)
|
||||
}
|
||||
let buttonSize = updatedShareButtonNode.update(presentationData: item.presentationData, chatLocation: item.chatLocation, message: item.message, account: item.context.account)
|
||||
let buttonSize = updatedShareButtonNode.update(presentationData: item.presentationData, chatLocation: item.chatLocation, subject: item.associatedData.subject, message: item.message, account: item.context.account)
|
||||
let shareButtonFrame = CGRect(origin: CGPoint(x: baseShareButtonFrame.minX, y: baseShareButtonFrame.maxY - buttonSize.height), size: buttonSize)
|
||||
transition.updateFrame(node: updatedShareButtonNode, frame: shareButtonFrame)
|
||||
} else if let shareButtonNode = strongSelf.shareButtonNode {
|
||||
@@ -811,6 +813,11 @@ class ChatMessageStickerItemNode: ChatMessageItemView {
|
||||
|
||||
@objc func shareButtonPressed() {
|
||||
if let item = self.item {
|
||||
if case .pinnedMessages = item.associatedData.subject {
|
||||
item.controllerInteraction.navigateToMessageStandalone(item.content.firstMessage.id)
|
||||
return
|
||||
}
|
||||
|
||||
if let channel = item.message.peers[item.message.id.peerId] as? TelegramChannel, case .broadcast = channel.info {
|
||||
for attribute in item.message.attributes {
|
||||
if let _ = attribute as? ReplyThreadMessageAttribute {
|
||||
|
||||
Reference in New Issue
Block a user