mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-12-03 21:16:35 +00:00
Fix context menu
This commit is contained in:
parent
8691bfd95e
commit
747ccfa12d
@ -80,6 +80,15 @@ class ChatMessageStickerItemNode: ChatMessageItemView {
|
||||
}
|
||||
return .waitForSingleTap
|
||||
}
|
||||
recognizer.longTap = { [weak self] point, recognizer in
|
||||
guard let strongSelf = self else {
|
||||
return
|
||||
}
|
||||
//strongSelf.reactionRecognizer?.cancel()
|
||||
if strongSelf.gestureRecognized(gesture: .longTap, location: point, recognizer: recognizer) {
|
||||
recognizer.cancel()
|
||||
}
|
||||
}
|
||||
self.view.addGestureRecognizer(recognizer)
|
||||
|
||||
let replyRecognizer = ChatSwipeToReplyRecognizer(target: self, action: #selector(self.swipeToReplyGesture(_:)))
|
||||
@ -579,6 +588,14 @@ class ChatMessageStickerItemNode: ChatMessageItemView {
|
||||
switch recognizer.state {
|
||||
case .ended:
|
||||
if let (gesture, location) = recognizer.lastRecognizedGestureAndLocation {
|
||||
let _ = self.gestureRecognized(gesture: gesture, location: location, recognizer: nil)
|
||||
}
|
||||
default:
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
private func gestureRecognized(gesture: TapLongTapOrDoubleTapGesture, location: CGPoint, recognizer: TapLongTapOrDoubleTapGestureRecognizer?) -> Bool {
|
||||
switch gesture {
|
||||
case .tap:
|
||||
if let avatarNode = self.accessoryItemNode as? ChatMessageAvatarAccessoryItemNode, avatarNode.frame.contains(location) {
|
||||
@ -606,13 +623,13 @@ class ChatMessageStickerItemNode: ChatMessageItemView {
|
||||
if case .member = channel.participationStatus {
|
||||
} else {
|
||||
item.controllerInteraction.displayMessageTooltip(item.message.id, item.presentationData.strings.Conversation_PrivateChannelTooltip, self, avatarNode.frame)
|
||||
return
|
||||
return true
|
||||
}
|
||||
}
|
||||
item.controllerInteraction.openPeer(openPeerId, navigate, item.message)
|
||||
}
|
||||
}
|
||||
return
|
||||
return true
|
||||
}
|
||||
|
||||
if let viaBotNode = self.viaBotNode, viaBotNode.frame.contains(location) {
|
||||
@ -634,7 +651,7 @@ class ChatMessageStickerItemNode: ChatMessageItemView {
|
||||
return .text
|
||||
}
|
||||
}
|
||||
return
|
||||
return true
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -645,7 +662,7 @@ class ChatMessageStickerItemNode: ChatMessageItemView {
|
||||
for attribute in item.message.attributes {
|
||||
if let attribute = attribute as? ReplyMessageAttribute {
|
||||
item.controllerInteraction.navigateToMessage(item.message.id, attribute.messageId)
|
||||
return
|
||||
return true
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -653,21 +670,20 @@ class ChatMessageStickerItemNode: ChatMessageItemView {
|
||||
|
||||
if let item = self.item, self.imageNode.frame.contains(location) {
|
||||
let _ = item.controllerInteraction.openMessage(item.message, .default)
|
||||
return
|
||||
return true
|
||||
}
|
||||
|
||||
self.item?.controllerInteraction.clickThroughMessage()
|
||||
case .longTap, .doubleTap:
|
||||
if let item = self.item, self.imageNode.frame.contains(location) {
|
||||
item.controllerInteraction.openMessageContextMenu(item.message, false, self, self.imageNode.frame, nil)
|
||||
item.controllerInteraction.openMessageContextMenu(item.message, false, self, self.imageNode.frame, recognizer)
|
||||
return false
|
||||
}
|
||||
case .hold:
|
||||
break
|
||||
}
|
||||
}
|
||||
default:
|
||||
break
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
@objc func shareButtonPressed() {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user