mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-08-02 00:17:02 +00:00
Merge branch 'master' of gitlab.com:peter-iakovlev/telegram-ios
This commit is contained in:
commit
3c214cd206
@ -526,6 +526,7 @@ public final class ChatControllerImpl: TelegramBaseController, ChatController, G
|
|||||||
}
|
}
|
||||||
if let messages = strongSelf.chatDisplayNode.historyNode.messageGroupInCurrentHistoryView(message.id) {
|
if let messages = strongSelf.chatDisplayNode.historyNode.messageGroupInCurrentHistoryView(message.id) {
|
||||||
(strongSelf.view.window as? WindowHost)?.cancelInteractiveKeyboardGestures()
|
(strongSelf.view.window as? WindowHost)?.cancelInteractiveKeyboardGestures()
|
||||||
|
strongSelf.chatDisplayNode.cancelInteractiveKeyboardGestures()
|
||||||
var updatedMessages = messages
|
var updatedMessages = messages
|
||||||
for i in 0 ..< updatedMessages.count {
|
for i in 0 ..< updatedMessages.count {
|
||||||
if updatedMessages[i].id == message.id {
|
if updatedMessages[i].id == message.id {
|
||||||
@ -562,7 +563,7 @@ public final class ChatControllerImpl: TelegramBaseController, ChatController, G
|
|||||||
if Namespaces.Message.allScheduled.contains(message.id.namespace) {
|
if Namespaces.Message.allScheduled.contains(message.id.namespace) {
|
||||||
reactionItems = []
|
reactionItems = []
|
||||||
}
|
}
|
||||||
let controller = ContextController(account: strongSelf.context.account, theme: strongSelf.presentationData.theme, strings: strongSelf.presentationData.strings, source: ChatMessageContextControllerContentSource(chatNode: strongSelf.chatDisplayNode, message: message), items: actions, reactionItems: reactionItems, recognizer: recognizer)
|
let controller = ContextController(account: strongSelf.context.account, theme: strongSelf.presentationData.theme, strings: strongSelf.presentationData.strings, source: ChatMessageContextExtractedContentSource(chatNode: strongSelf.chatDisplayNode, message: message), items: actions, reactionItems: reactionItems, recognizer: recognizer)
|
||||||
strongSelf.currentContextController = controller
|
strongSelf.currentContextController = controller
|
||||||
controller.reactionSelected = { [weak controller] value in
|
controller.reactionSelected = { [weak controller] value in
|
||||||
guard let strongSelf = self, let message = updatedMessages.first else {
|
guard let strongSelf = self, let message = updatedMessages.first else {
|
||||||
@ -1391,7 +1392,7 @@ public final class ChatControllerImpl: TelegramBaseController, ChatController, G
|
|||||||
}
|
}
|
||||||
})))
|
})))
|
||||||
|
|
||||||
let controller = ContextController(account: strongSelf.context.account, theme: strongSelf.presentationData.theme, strings: strongSelf.presentationData.strings, source: ChatMessageContextControllerContentSource(chatNode: strongSelf.chatDisplayNode, message: message), items: actions, reactionItems: [], recognizer: nil)
|
let controller = ContextController(account: strongSelf.context.account, theme: strongSelf.presentationData.theme, strings: strongSelf.presentationData.strings, source: ChatMessageContextExtractedContentSource(chatNode: strongSelf.chatDisplayNode, message: message), items: actions, reactionItems: [], recognizer: nil)
|
||||||
strongSelf.currentContextController = controller
|
strongSelf.currentContextController = controller
|
||||||
strongSelf.window?.presentInGlobalOverlay(controller)
|
strongSelf.window?.presentInGlobalOverlay(controller)
|
||||||
})
|
})
|
||||||
@ -1431,7 +1432,7 @@ public final class ChatControllerImpl: TelegramBaseController, ChatController, G
|
|||||||
f(.dismissWithoutContent)
|
f(.dismissWithoutContent)
|
||||||
})))
|
})))
|
||||||
|
|
||||||
let controller = ContextController(account: strongSelf.context.account, theme: strongSelf.presentationData.theme, strings: strongSelf.presentationData.strings, source: ChatMessageContextControllerContentSource(chatNode: strongSelf.chatDisplayNode, message: message), items: actions, reactionItems: [], recognizer: nil)
|
let controller = ContextController(account: strongSelf.context.account, theme: strongSelf.presentationData.theme, strings: strongSelf.presentationData.strings, source: ChatMessageContextExtractedContentSource(chatNode: strongSelf.chatDisplayNode, message: message), items: actions, reactionItems: [], recognizer: nil)
|
||||||
strongSelf.currentContextController = controller
|
strongSelf.currentContextController = controller
|
||||||
strongSelf.window?.presentInGlobalOverlay(controller)
|
strongSelf.window?.presentInGlobalOverlay(controller)
|
||||||
})
|
})
|
||||||
|
@ -190,6 +190,15 @@ class ChatMessageAnimatedStickerItemNode: ChatMessageItemView {
|
|||||||
}
|
}
|
||||||
return .waitForSingleTap
|
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)
|
self.view.addGestureRecognizer(recognizer)
|
||||||
|
|
||||||
let replyRecognizer = ChatSwipeToReplyRecognizer(target: self, action: #selector(self.swipeToReplyGesture(_:)))
|
let replyRecognizer = ChatSwipeToReplyRecognizer(target: self, action: #selector(self.swipeToReplyGesture(_:)))
|
||||||
@ -736,129 +745,135 @@ class ChatMessageAnimatedStickerItemNode: ChatMessageItemView {
|
|||||||
switch recognizer.state {
|
switch recognizer.state {
|
||||||
case .ended:
|
case .ended:
|
||||||
if let (gesture, location) = recognizer.lastRecognizedGestureAndLocation {
|
if let (gesture, location) = recognizer.lastRecognizedGestureAndLocation {
|
||||||
switch gesture {
|
let _ = self.gestureRecognized(gesture: gesture, location: location, recognizer: nil)
|
||||||
case .tap:
|
|
||||||
if let avatarNode = self.accessoryItemNode as? ChatMessageAvatarAccessoryItemNode, avatarNode.frame.contains(location) {
|
|
||||||
if let item = self.item, let author = item.content.firstMessage.author {
|
|
||||||
var openPeerId = item.effectiveAuthorId ?? author.id
|
|
||||||
var navigate: ChatControllerInteractionNavigateToPeer
|
|
||||||
|
|
||||||
if item.content.firstMessage.id.peerId == item.context.account.peerId {
|
|
||||||
navigate = .chat(textInputState: nil, subject: nil)
|
|
||||||
} else {
|
|
||||||
navigate = .info
|
|
||||||
}
|
|
||||||
|
|
||||||
for attribute in item.content.firstMessage.attributes {
|
|
||||||
if let attribute = attribute as? SourceReferenceMessageAttribute {
|
|
||||||
openPeerId = attribute.messageId.peerId
|
|
||||||
navigate = .chat(textInputState: nil, subject: .message(attribute.messageId))
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if item.effectiveAuthorId?.namespace == Namespaces.Peer.Empty {
|
|
||||||
item.controllerInteraction.displayMessageTooltip(item.content.firstMessage.id, item.presentationData.strings.Conversation_ForwardAuthorHiddenTooltip, self, avatarNode.frame)
|
|
||||||
} else {
|
|
||||||
if let channel = item.content.firstMessage.forwardInfo?.author as? TelegramChannel, channel.username == nil {
|
|
||||||
if case .member = channel.participationStatus {
|
|
||||||
} else {
|
|
||||||
item.controllerInteraction.displayMessageTooltip(item.message.id, item.presentationData.strings.Conversation_PrivateChannelTooltip, self, avatarNode.frame)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
}
|
|
||||||
item.controllerInteraction.openPeer(openPeerId, navigate, item.message)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
if let viaBotNode = self.viaBotNode, viaBotNode.frame.contains(location) {
|
|
||||||
if let item = self.item {
|
|
||||||
for attribute in item.message.attributes {
|
|
||||||
if let attribute = attribute as? InlineBotMessageAttribute {
|
|
||||||
var botAddressName: String?
|
|
||||||
if let peerId = attribute.peerId, let botPeer = item.message.peers[peerId], let addressName = botPeer.addressName {
|
|
||||||
botAddressName = addressName
|
|
||||||
} else {
|
|
||||||
botAddressName = attribute.title
|
|
||||||
}
|
|
||||||
|
|
||||||
if let botAddressName = botAddressName {
|
|
||||||
item.controllerInteraction.updateInputState { textInputState in
|
|
||||||
return ChatTextInputState(inputText: NSAttributedString(string: "@" + botAddressName + " "))
|
|
||||||
}
|
|
||||||
item.controllerInteraction.updateInputMode { _ in
|
|
||||||
return .text
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if let replyInfoNode = self.replyInfoNode, replyInfoNode.frame.contains(location) {
|
|
||||||
if let item = self.item {
|
|
||||||
for attribute in item.message.attributes {
|
|
||||||
if let attribute = attribute as? ReplyMessageAttribute {
|
|
||||||
item.controllerInteraction.navigateToMessage(item.message.id, attribute.messageId)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if let item = self.item, self.imageNode.frame.contains(location) {
|
|
||||||
if self.telegramFile != nil {
|
|
||||||
let _ = item.controllerInteraction.openMessage(item.message, .default)
|
|
||||||
} else if let _ = self.emojiFile {
|
|
||||||
var startTime: Signal<Double, NoError>
|
|
||||||
if self.animationNode.playIfNeeded() {
|
|
||||||
startTime = .single(0.0)
|
|
||||||
} else {
|
|
||||||
startTime = self.animationNode.status
|
|
||||||
|> map { $0.timestamp }
|
|
||||||
|> take(1)
|
|
||||||
|> deliverOnMainQueue
|
|
||||||
}
|
|
||||||
|
|
||||||
if let text = self.item?.message.text, let firstScalar = text.unicodeScalars.first, firstScalar.value == 0x2764 {
|
|
||||||
let _ = startTime.start(next: { [weak self] time in
|
|
||||||
guard let strongSelf = self else {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
let heartbeatHaptic: ChatMessageHeartbeatHaptic
|
|
||||||
if let current = strongSelf.heartbeatHaptic {
|
|
||||||
heartbeatHaptic = current
|
|
||||||
} else {
|
|
||||||
heartbeatHaptic = ChatMessageHeartbeatHaptic()
|
|
||||||
heartbeatHaptic.enabled = true
|
|
||||||
strongSelf.heartbeatHaptic = heartbeatHaptic
|
|
||||||
}
|
|
||||||
if !heartbeatHaptic.active {
|
|
||||||
heartbeatHaptic.start(time: time)
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
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)
|
|
||||||
}
|
|
||||||
case .hold:
|
|
||||||
break
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
break
|
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) {
|
||||||
|
if let item = self.item, let author = item.content.firstMessage.author {
|
||||||
|
var openPeerId = item.effectiveAuthorId ?? author.id
|
||||||
|
var navigate: ChatControllerInteractionNavigateToPeer
|
||||||
|
|
||||||
|
if item.content.firstMessage.id.peerId == item.context.account.peerId {
|
||||||
|
navigate = .chat(textInputState: nil, subject: nil)
|
||||||
|
} else {
|
||||||
|
navigate = .info
|
||||||
|
}
|
||||||
|
|
||||||
|
for attribute in item.content.firstMessage.attributes {
|
||||||
|
if let attribute = attribute as? SourceReferenceMessageAttribute {
|
||||||
|
openPeerId = attribute.messageId.peerId
|
||||||
|
navigate = .chat(textInputState: nil, subject: .message(attribute.messageId))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if item.effectiveAuthorId?.namespace == Namespaces.Peer.Empty {
|
||||||
|
item.controllerInteraction.displayMessageTooltip(item.content.firstMessage.id, item.presentationData.strings.Conversation_ForwardAuthorHiddenTooltip, self, avatarNode.frame)
|
||||||
|
} else {
|
||||||
|
if let channel = item.content.firstMessage.forwardInfo?.author as? TelegramChannel, channel.username == nil {
|
||||||
|
if case .member = channel.participationStatus {
|
||||||
|
} else {
|
||||||
|
item.controllerInteraction.displayMessageTooltip(item.message.id, item.presentationData.strings.Conversation_PrivateChannelTooltip, self, avatarNode.frame)
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
item.controllerInteraction.openPeer(openPeerId, navigate, item.message)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
|
if let viaBotNode = self.viaBotNode, viaBotNode.frame.contains(location) {
|
||||||
|
if let item = self.item {
|
||||||
|
for attribute in item.message.attributes {
|
||||||
|
if let attribute = attribute as? InlineBotMessageAttribute {
|
||||||
|
var botAddressName: String?
|
||||||
|
if let peerId = attribute.peerId, let botPeer = item.message.peers[peerId], let addressName = botPeer.addressName {
|
||||||
|
botAddressName = addressName
|
||||||
|
} else {
|
||||||
|
botAddressName = attribute.title
|
||||||
|
}
|
||||||
|
|
||||||
|
if let botAddressName = botAddressName {
|
||||||
|
item.controllerInteraction.updateInputState { textInputState in
|
||||||
|
return ChatTextInputState(inputText: NSAttributedString(string: "@" + botAddressName + " "))
|
||||||
|
}
|
||||||
|
item.controllerInteraction.updateInputMode { _ in
|
||||||
|
return .text
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if let replyInfoNode = self.replyInfoNode, replyInfoNode.frame.contains(location) {
|
||||||
|
if let item = self.item {
|
||||||
|
for attribute in item.message.attributes {
|
||||||
|
if let attribute = attribute as? ReplyMessageAttribute {
|
||||||
|
item.controllerInteraction.navigateToMessage(item.message.id, attribute.messageId)
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if let item = self.item, self.imageNode.frame.contains(location) {
|
||||||
|
if self.telegramFile != nil {
|
||||||
|
let _ = item.controllerInteraction.openMessage(item.message, .default)
|
||||||
|
} else if let _ = self.emojiFile {
|
||||||
|
var startTime: Signal<Double, NoError>
|
||||||
|
if self.animationNode.playIfNeeded() {
|
||||||
|
startTime = .single(0.0)
|
||||||
|
} else {
|
||||||
|
startTime = self.animationNode.status
|
||||||
|
|> map { $0.timestamp }
|
||||||
|
|> take(1)
|
||||||
|
|> deliverOnMainQueue
|
||||||
|
}
|
||||||
|
|
||||||
|
if let text = self.item?.message.text, let firstScalar = text.unicodeScalars.first, firstScalar.value == 0x2764 {
|
||||||
|
let _ = startTime.start(next: { [weak self] time in
|
||||||
|
guard let strongSelf = self else {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
let heartbeatHaptic: ChatMessageHeartbeatHaptic
|
||||||
|
if let current = strongSelf.heartbeatHaptic {
|
||||||
|
heartbeatHaptic = current
|
||||||
|
} else {
|
||||||
|
heartbeatHaptic = ChatMessageHeartbeatHaptic()
|
||||||
|
heartbeatHaptic.enabled = true
|
||||||
|
strongSelf.heartbeatHaptic = heartbeatHaptic
|
||||||
|
}
|
||||||
|
if !heartbeatHaptic.active {
|
||||||
|
heartbeatHaptic.start(time: time)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
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)
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
case .hold:
|
||||||
|
break
|
||||||
|
}
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
@objc func shareButtonPressed() {
|
@objc func shareButtonPressed() {
|
||||||
if let item = self.item {
|
if let item = self.item {
|
||||||
if item.content.firstMessage.id.peerId == item.context.account.peerId {
|
if item.content.firstMessage.id.peerId == item.context.account.peerId {
|
||||||
|
@ -832,7 +832,7 @@ final class ChatMessageInteractiveMediaNode: ASDisplayNode, GalleryItemTransitio
|
|||||||
}
|
}
|
||||||
strongSelf.fetchDisposable.set(visibilityAwareFetchSignal.start())
|
strongSelf.fetchDisposable.set(visibilityAwareFetchSignal.start())
|
||||||
}
|
}
|
||||||
} else if case .prefetch = automaticDownload, message.id.namespace != Namespaces.Message.SecretIncoming {
|
} else if case .prefetch = automaticDownload, message.id.namespace != Namespaces.Message.SecretIncoming && message.id.namespace != Namespaces.Message.Local {
|
||||||
if let file = media as? TelegramMediaFile {
|
if let file = media as? TelegramMediaFile {
|
||||||
let fetchSignal = preloadVideoResource(postbox: context.account.postbox, resourceReference: AnyMediaReference.message(message: MessageReference(message), media: file).resourceReference(file.resource), duration: 4.0)
|
let fetchSignal = preloadVideoResource(postbox: context.account.postbox, resourceReference: AnyMediaReference.message(message: MessageReference(message), media: file).resourceReference(file.resource), duration: 4.0)
|
||||||
let visibilityAwareFetchSignal = strongSelf.visibilityPromise.get()
|
let visibilityAwareFetchSignal = strongSelf.visibilityPromise.get()
|
||||||
|
@ -80,6 +80,15 @@ class ChatMessageStickerItemNode: ChatMessageItemView {
|
|||||||
}
|
}
|
||||||
return .waitForSingleTap
|
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)
|
self.view.addGestureRecognizer(recognizer)
|
||||||
|
|
||||||
let replyRecognizer = ChatSwipeToReplyRecognizer(target: self, action: #selector(self.swipeToReplyGesture(_:)))
|
let replyRecognizer = ChatSwipeToReplyRecognizer(target: self, action: #selector(self.swipeToReplyGesture(_:)))
|
||||||
@ -577,97 +586,104 @@ class ChatMessageStickerItemNode: ChatMessageItemView {
|
|||||||
|
|
||||||
@objc func tapLongTapOrDoubleTapGesture(_ recognizer: TapLongTapOrDoubleTapGestureRecognizer) {
|
@objc func tapLongTapOrDoubleTapGesture(_ recognizer: TapLongTapOrDoubleTapGestureRecognizer) {
|
||||||
switch recognizer.state {
|
switch recognizer.state {
|
||||||
case .ended:
|
case .ended:
|
||||||
if let (gesture, location) = recognizer.lastRecognizedGestureAndLocation {
|
if let (gesture, location) = recognizer.lastRecognizedGestureAndLocation {
|
||||||
switch gesture {
|
let _ = self.gestureRecognized(gesture: gesture, location: location, recognizer: nil)
|
||||||
case .tap:
|
}
|
||||||
if let avatarNode = self.accessoryItemNode as? ChatMessageAvatarAccessoryItemNode, avatarNode.frame.contains(location) {
|
default:
|
||||||
if let item = self.item, let author = item.content.firstMessage.author {
|
break
|
||||||
var openPeerId = item.effectiveAuthorId ?? author.id
|
}
|
||||||
var navigate: ChatControllerInteractionNavigateToPeer
|
}
|
||||||
|
|
||||||
if item.content.firstMessage.id.peerId == item.context.account.peerId {
|
private func gestureRecognized(gesture: TapLongTapOrDoubleTapGesture, location: CGPoint, recognizer: TapLongTapOrDoubleTapGestureRecognizer?) -> Bool {
|
||||||
navigate = .chat(textInputState: nil, subject: nil)
|
switch gesture {
|
||||||
} else {
|
case .tap:
|
||||||
navigate = .info
|
if let avatarNode = self.accessoryItemNode as? ChatMessageAvatarAccessoryItemNode, avatarNode.frame.contains(location) {
|
||||||
}
|
if let item = self.item, let author = item.content.firstMessage.author {
|
||||||
|
var openPeerId = item.effectiveAuthorId ?? author.id
|
||||||
|
var navigate: ChatControllerInteractionNavigateToPeer
|
||||||
|
|
||||||
for attribute in item.content.firstMessage.attributes {
|
if item.content.firstMessage.id.peerId == item.context.account.peerId {
|
||||||
if let attribute = attribute as? SourceReferenceMessageAttribute {
|
navigate = .chat(textInputState: nil, subject: nil)
|
||||||
openPeerId = attribute.messageId.peerId
|
} else {
|
||||||
navigate = .chat(textInputState: nil, subject: .message(attribute.messageId))
|
navigate = .info
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if item.effectiveAuthorId?.namespace == Namespaces.Peer.Empty {
|
for attribute in item.content.firstMessage.attributes {
|
||||||
item.controllerInteraction.displayMessageTooltip(item.content.firstMessage.id, item.presentationData.strings.Conversation_ForwardAuthorHiddenTooltip, self, avatarNode.frame)
|
if let attribute = attribute as? SourceReferenceMessageAttribute {
|
||||||
} else {
|
openPeerId = attribute.messageId.peerId
|
||||||
if let channel = item.content.firstMessage.forwardInfo?.author as? TelegramChannel, channel.username == nil {
|
navigate = .chat(textInputState: nil, subject: .message(attribute.messageId))
|
||||||
if case .member = channel.participationStatus {
|
|
||||||
} else {
|
|
||||||
item.controllerInteraction.displayMessageTooltip(item.message.id, item.presentationData.strings.Conversation_PrivateChannelTooltip, self, avatarNode.frame)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
}
|
|
||||||
item.controllerInteraction.openPeer(openPeerId, navigate, item.message)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if let viaBotNode = self.viaBotNode, viaBotNode.frame.contains(location) {
|
if item.effectiveAuthorId?.namespace == Namespaces.Peer.Empty {
|
||||||
if let item = self.item {
|
item.controllerInteraction.displayMessageTooltip(item.content.firstMessage.id, item.presentationData.strings.Conversation_ForwardAuthorHiddenTooltip, self, avatarNode.frame)
|
||||||
for attribute in item.message.attributes {
|
} else {
|
||||||
if let attribute = attribute as? InlineBotMessageAttribute {
|
if let channel = item.content.firstMessage.forwardInfo?.author as? TelegramChannel, channel.username == nil {
|
||||||
var botAddressName: String?
|
if case .member = channel.participationStatus {
|
||||||
if let peerId = attribute.peerId, let botPeer = item.message.peers[peerId], let addressName = botPeer.addressName {
|
} else {
|
||||||
botAddressName = addressName
|
item.controllerInteraction.displayMessageTooltip(item.message.id, item.presentationData.strings.Conversation_PrivateChannelTooltip, self, avatarNode.frame)
|
||||||
} else {
|
return true
|
||||||
botAddressName = attribute.title
|
|
||||||
}
|
|
||||||
|
|
||||||
if let botAddressName = botAddressName {
|
|
||||||
item.controllerInteraction.updateInputState { textInputState in
|
|
||||||
return ChatTextInputState(inputText: NSAttributedString(string: "@" + botAddressName + " "))
|
|
||||||
}
|
|
||||||
item.controllerInteraction.updateInputMode { _ in
|
|
||||||
return .text
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
item.controllerInteraction.openPeer(openPeerId, navigate, item.message)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
if let replyInfoNode = self.replyInfoNode, replyInfoNode.frame.contains(location) {
|
if let viaBotNode = self.viaBotNode, viaBotNode.frame.contains(location) {
|
||||||
if let item = self.item {
|
if let item = self.item {
|
||||||
for attribute in item.message.attributes {
|
for attribute in item.message.attributes {
|
||||||
if let attribute = attribute as? ReplyMessageAttribute {
|
if let attribute = attribute as? InlineBotMessageAttribute {
|
||||||
item.controllerInteraction.navigateToMessage(item.message.id, attribute.messageId)
|
var botAddressName: String?
|
||||||
return
|
if let peerId = attribute.peerId, let botPeer = item.message.peers[peerId], let addressName = botPeer.addressName {
|
||||||
}
|
botAddressName = addressName
|
||||||
|
} else {
|
||||||
|
botAddressName = attribute.title
|
||||||
|
}
|
||||||
|
|
||||||
|
if let botAddressName = botAddressName {
|
||||||
|
item.controllerInteraction.updateInputState { textInputState in
|
||||||
|
return ChatTextInputState(inputText: NSAttributedString(string: "@" + botAddressName + " "))
|
||||||
|
}
|
||||||
|
item.controllerInteraction.updateInputMode { _ in
|
||||||
|
return .text
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return true
|
||||||
}
|
}
|
||||||
|
}
|
||||||
if let item = self.item, self.imageNode.frame.contains(location) {
|
|
||||||
let _ = item.controllerInteraction.openMessage(item.message, .default)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
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)
|
|
||||||
}
|
|
||||||
case .hold:
|
|
||||||
break
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
default:
|
|
||||||
|
if let replyInfoNode = self.replyInfoNode, replyInfoNode.frame.contains(location) {
|
||||||
|
if let item = self.item {
|
||||||
|
for attribute in item.message.attributes {
|
||||||
|
if let attribute = attribute as? ReplyMessageAttribute {
|
||||||
|
item.controllerInteraction.navigateToMessage(item.message.id, attribute.messageId)
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if let item = self.item, self.imageNode.frame.contains(location) {
|
||||||
|
let _ = item.controllerInteraction.openMessage(item.message, .default)
|
||||||
|
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, recognizer)
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
case .hold:
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
@objc func shareButtonPressed() {
|
@objc func shareButtonPressed() {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user