mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-08-30 17:31:58 +00:00
Merge commit '17c87be8fc5a6c9d9e201056fa7531e519887417'
This commit is contained in:
commit
c952208cc8
@ -1169,7 +1169,7 @@ public final class ChatController: TelegramController, KeyShortcutResponder, Gal
|
|||||||
if let strongSelf = self {
|
if let strongSelf = self {
|
||||||
strongSelf.context.sharedContext.applicationBindings.openAppStorePage()
|
strongSelf.context.sharedContext.applicationBindings.openAppStorePage()
|
||||||
}
|
}
|
||||||
}, displayMessageTooltip: { [weak self] messageId, text, sourceNode in
|
}, displayMessageTooltip: { [weak self] messageId, text, sourceNode, sourceFrame in
|
||||||
if let strongSelf = self {
|
if let strongSelf = self {
|
||||||
if let sourceNode = sourceNode {
|
if let sourceNode = sourceNode {
|
||||||
strongSelf.messageTooltipController?.dismiss()
|
strongSelf.messageTooltipController?.dismiss()
|
||||||
@ -1182,7 +1182,10 @@ public final class ChatController: TelegramController, KeyShortcutResponder, Gal
|
|||||||
}
|
}
|
||||||
strongSelf.present(tooltipController, in: .window(.root), with: TooltipControllerPresentationArguments(sourceNodeAndRect: {
|
strongSelf.present(tooltipController, in: .window(.root), with: TooltipControllerPresentationArguments(sourceNodeAndRect: {
|
||||||
if let strongSelf = self {
|
if let strongSelf = self {
|
||||||
let rect = sourceNode.view.convert(sourceNode.view.bounds, to: strongSelf.chatDisplayNode.view)
|
var rect = sourceNode.view.convert(sourceNode.view.bounds, to: strongSelf.chatDisplayNode.view)
|
||||||
|
if let sourceFrame = sourceFrame {
|
||||||
|
rect = CGRect(x: rect.minX + sourceFrame.minX, y: rect.minY + sourceFrame.minY, width: sourceFrame.width, height: sourceFrame.height)
|
||||||
|
}
|
||||||
return (strongSelf.chatDisplayNode, rect)
|
return (strongSelf.chatDisplayNode, rect)
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
|
@ -86,7 +86,7 @@ public final class ChatControllerInteraction {
|
|||||||
let rateCall: (Message, CallId) -> Void
|
let rateCall: (Message, CallId) -> Void
|
||||||
let requestSelectMessagePollOption: (MessageId, Data) -> Void
|
let requestSelectMessagePollOption: (MessageId, Data) -> Void
|
||||||
let openAppStorePage: () -> Void
|
let openAppStorePage: () -> Void
|
||||||
let displayMessageTooltip: (MessageId, String, ASDisplayNode?) -> Void
|
let displayMessageTooltip: (MessageId, String, ASDisplayNode?, CGRect?) -> Void
|
||||||
|
|
||||||
let requestMessageUpdate: (MessageId) -> Void
|
let requestMessageUpdate: (MessageId) -> Void
|
||||||
let cancelInteractiveKeyboardGestures: () -> Void
|
let cancelInteractiveKeyboardGestures: () -> Void
|
||||||
@ -99,7 +99,7 @@ public final class ChatControllerInteraction {
|
|||||||
var pollActionState: ChatInterfacePollActionState
|
var pollActionState: ChatInterfacePollActionState
|
||||||
var searchTextHighightState: String?
|
var searchTextHighightState: String?
|
||||||
|
|
||||||
init(openMessage: @escaping (Message, ChatControllerInteractionOpenMessageMode) -> Bool, openPeer: @escaping (PeerId?, ChatControllerInteractionNavigateToPeer, Message?) -> Void, openPeerMention: @escaping (String) -> Void, openMessageContextMenu: @escaping (Message, Bool, ASDisplayNode, CGRect) -> Void, navigateToMessage: @escaping (MessageId, MessageId) -> Void, clickThroughMessage: @escaping () -> Void, toggleMessagesSelection: @escaping ([MessageId], Bool) -> Void, sendMessage: @escaping (String) -> Void, sendSticker: @escaping (FileMediaReference, Bool) -> Void, sendGif: @escaping (FileMediaReference) -> Void, requestMessageActionCallback: @escaping (MessageId, MemoryBuffer?, Bool) -> Void, activateSwitchInline: @escaping (PeerId?, String) -> Void, openUrl: @escaping (String, Bool, Bool?) -> Void, shareCurrentLocation: @escaping () -> Void, shareAccountContact: @escaping () -> Void, sendBotCommand: @escaping (MessageId?, String) -> Void, openInstantPage: @escaping (Message, ChatMessageItemAssociatedData?) -> Void, openWallpaper: @escaping (Message) -> Void, openHashtag: @escaping (String?, String) -> Void, updateInputState: @escaping ((ChatTextInputState) -> ChatTextInputState) -> Void, updateInputMode: @escaping ((ChatInputMode) -> ChatInputMode) -> Void, openMessageShareMenu: @escaping (MessageId) -> Void, presentController: @escaping (ViewController, Any?) -> Void, navigationController: @escaping () -> NavigationController?, presentGlobalOverlayController: @escaping (ViewController, Any?) -> Void, callPeer: @escaping (PeerId) -> Void, longTap: @escaping (ChatControllerInteractionLongTapAction) -> Void, openCheckoutOrReceipt: @escaping (MessageId) -> Void, openSearch: @escaping () -> Void, setupReply: @escaping (MessageId) -> Void, canSetupReply: @escaping (Message) -> Bool, navigateToFirstDateMessage: @escaping(Int32) ->Void, requestRedeliveryOfFailedMessages: @escaping (MessageId) -> Void, addContact: @escaping (String) -> Void, rateCall: @escaping (Message, CallId) -> Void, requestSelectMessagePollOption: @escaping (MessageId, Data) -> Void, openAppStorePage: @escaping () -> Void, displayMessageTooltip: @escaping (MessageId, String, ASDisplayNode?) -> Void, requestMessageUpdate: @escaping (MessageId) -> Void, cancelInteractiveKeyboardGestures: @escaping () -> Void, automaticMediaDownloadSettings: MediaAutoDownloadSettings, pollActionState: ChatInterfacePollActionState) {
|
init(openMessage: @escaping (Message, ChatControllerInteractionOpenMessageMode) -> Bool, openPeer: @escaping (PeerId?, ChatControllerInteractionNavigateToPeer, Message?) -> Void, openPeerMention: @escaping (String) -> Void, openMessageContextMenu: @escaping (Message, Bool, ASDisplayNode, CGRect) -> Void, navigateToMessage: @escaping (MessageId, MessageId) -> Void, clickThroughMessage: @escaping () -> Void, toggleMessagesSelection: @escaping ([MessageId], Bool) -> Void, sendMessage: @escaping (String) -> Void, sendSticker: @escaping (FileMediaReference, Bool) -> Void, sendGif: @escaping (FileMediaReference) -> Void, requestMessageActionCallback: @escaping (MessageId, MemoryBuffer?, Bool) -> Void, activateSwitchInline: @escaping (PeerId?, String) -> Void, openUrl: @escaping (String, Bool, Bool?) -> Void, shareCurrentLocation: @escaping () -> Void, shareAccountContact: @escaping () -> Void, sendBotCommand: @escaping (MessageId?, String) -> Void, openInstantPage: @escaping (Message, ChatMessageItemAssociatedData?) -> Void, openWallpaper: @escaping (Message) -> Void, openHashtag: @escaping (String?, String) -> Void, updateInputState: @escaping ((ChatTextInputState) -> ChatTextInputState) -> Void, updateInputMode: @escaping ((ChatInputMode) -> ChatInputMode) -> Void, openMessageShareMenu: @escaping (MessageId) -> Void, presentController: @escaping (ViewController, Any?) -> Void, navigationController: @escaping () -> NavigationController?, presentGlobalOverlayController: @escaping (ViewController, Any?) -> Void, callPeer: @escaping (PeerId) -> Void, longTap: @escaping (ChatControllerInteractionLongTapAction) -> Void, openCheckoutOrReceipt: @escaping (MessageId) -> Void, openSearch: @escaping () -> Void, setupReply: @escaping (MessageId) -> Void, canSetupReply: @escaping (Message) -> Bool, navigateToFirstDateMessage: @escaping(Int32) ->Void, requestRedeliveryOfFailedMessages: @escaping (MessageId) -> Void, addContact: @escaping (String) -> Void, rateCall: @escaping (Message, CallId) -> Void, requestSelectMessagePollOption: @escaping (MessageId, Data) -> Void, openAppStorePage: @escaping () -> Void, displayMessageTooltip: @escaping (MessageId, String, ASDisplayNode?, CGRect?) -> Void, requestMessageUpdate: @escaping (MessageId) -> Void, cancelInteractiveKeyboardGestures: @escaping () -> Void, automaticMediaDownloadSettings: MediaAutoDownloadSettings, pollActionState: ChatInterfacePollActionState) {
|
||||||
self.openMessage = openMessage
|
self.openMessage = openMessage
|
||||||
self.openPeer = openPeer
|
self.openPeer = openPeer
|
||||||
self.openPeerMention = openPeerMention
|
self.openPeerMention = openPeerMention
|
||||||
@ -161,7 +161,7 @@ public final class ChatControllerInteraction {
|
|||||||
}, rateCall: { _, _ in
|
}, rateCall: { _, _ in
|
||||||
}, requestSelectMessagePollOption: { _, _ in
|
}, requestSelectMessagePollOption: { _, _ in
|
||||||
}, openAppStorePage: {
|
}, openAppStorePage: {
|
||||||
}, displayMessageTooltip: { _, _, _ in
|
}, displayMessageTooltip: { _, _, _, _ in
|
||||||
}, requestMessageUpdate: { _ in
|
}, requestMessageUpdate: { _ in
|
||||||
}, cancelInteractiveKeyboardGestures: {
|
}, cancelInteractiveKeyboardGestures: {
|
||||||
}, automaticMediaDownloadSettings: MediaAutoDownloadSettings.defaultSettings,
|
}, automaticMediaDownloadSettings: MediaAutoDownloadSettings.defaultSettings,
|
||||||
|
@ -427,8 +427,13 @@ class ChatMessageAnimatedStickerItemNode: ChatMessageItemView {
|
|||||||
} else {
|
} else {
|
||||||
navigate = .info
|
navigate = .info
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if item.effectiveAuthorId?.namespace == Namespaces.Peer.Empty {
|
||||||
|
item.controllerInteraction.displayMessageTooltip(item.content.firstMessage.id, item.presentationData.strings.Conversation_ForwardAuthorHiddenTooltip, self, avatarNode.frame)
|
||||||
|
} else {
|
||||||
item.controllerInteraction.openPeer(item.effectiveAuthorId ?? author.id, navigate, item.message)
|
item.controllerInteraction.openPeer(item.effectiveAuthorId ?? author.id, navigate, item.message)
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1619,8 +1619,13 @@ class ChatMessageBubbleItemNode: ChatMessageItemView {
|
|||||||
} else {
|
} else {
|
||||||
navigate = .info
|
navigate = .info
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if item.effectiveAuthorId?.namespace == Namespaces.Peer.Empty {
|
||||||
|
item.controllerInteraction.displayMessageTooltip(item.content.firstMessage.id, item.presentationData.strings.Conversation_ForwardAuthorHiddenTooltip, self, avatarNode.frame)
|
||||||
|
} else {
|
||||||
item.controllerInteraction.openPeer(item.effectiveAuthorId ?? author.id, navigate, item.message)
|
item.controllerInteraction.openPeer(item.effectiveAuthorId ?? author.id, navigate, item.message)
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1664,7 +1669,7 @@ class ChatMessageBubbleItemNode: ChatMessageItemView {
|
|||||||
} else if let id = forwardInfo.source?.id ?? forwardInfo.author?.id {
|
} else if let id = forwardInfo.source?.id ?? forwardInfo.author?.id {
|
||||||
item.controllerInteraction.openPeer(id, .info, nil)
|
item.controllerInteraction.openPeer(id, .info, nil)
|
||||||
} else if let _ = forwardInfo.authorSignature {
|
} else if let _ = forwardInfo.authorSignature {
|
||||||
item.controllerInteraction.displayMessageTooltip(item.message.id, item.presentationData.strings.Conversation_ForwardAuthorHiddenTooltip, forwardInfoNode)
|
item.controllerInteraction.displayMessageTooltip(item.message.id, item.presentationData.strings.Conversation_ForwardAuthorHiddenTooltip, forwardInfoNode, nil)
|
||||||
}
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -493,8 +493,13 @@ class ChatMessageInstantVideoItemNode: ChatMessageItemView {
|
|||||||
} else {
|
} else {
|
||||||
navigate = .info
|
navigate = .info
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if item.effectiveAuthorId?.namespace == Namespaces.Peer.Empty {
|
||||||
|
item.controllerInteraction.displayMessageTooltip(item.content.firstMessage.id, item.presentationData.strings.Conversation_ForwardAuthorHiddenTooltip, self, avatarNode.frame)
|
||||||
|
} else {
|
||||||
item.controllerInteraction.openPeer(item.effectiveAuthorId ?? author.id, navigate, item.message)
|
item.controllerInteraction.openPeer(item.effectiveAuthorId ?? author.id, navigate, item.message)
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -516,7 +521,7 @@ class ChatMessageInstantVideoItemNode: ChatMessageItemView {
|
|||||||
} else if let id = forwardInfo.source?.id ?? forwardInfo.author?.id {
|
} else if let id = forwardInfo.source?.id ?? forwardInfo.author?.id {
|
||||||
item.controllerInteraction.openPeer(id, .chat(textInputState: nil, messageId: nil), nil)
|
item.controllerInteraction.openPeer(id, .chat(textInputState: nil, messageId: nil), nil)
|
||||||
} else if let _ = forwardInfo.authorSignature {
|
} else if let _ = forwardInfo.authorSignature {
|
||||||
item.controllerInteraction.displayMessageTooltip(item.message.id, item.presentationData.strings.Conversation_ForwardAuthorHiddenTooltip, forwardInfoNode)
|
item.controllerInteraction.displayMessageTooltip(item.message.id, item.presentationData.strings.Conversation_ForwardAuthorHiddenTooltip, forwardInfoNode, nil)
|
||||||
}
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -270,13 +270,8 @@ public final class ChatMessageItem: ListViewItem, CustomStringConvertible {
|
|||||||
if peerId == context.account.peerId {
|
if peerId == context.account.peerId {
|
||||||
if let forwardInfo = content.firstMessage.forwardInfo {
|
if let forwardInfo = content.firstMessage.forwardInfo {
|
||||||
effectiveAuthor = forwardInfo.author
|
effectiveAuthor = forwardInfo.author
|
||||||
}
|
if effectiveAuthor == nil, let authorSignature = forwardInfo.authorSignature {
|
||||||
if effectiveAuthor == nil {
|
effectiveAuthor = TelegramUser(id: PeerId(namespace: Namespaces.Peer.Empty, id: Int32(clamping: authorSignature.persistentHashValue)), accessHash: nil, firstName: authorSignature, lastName: nil, username: nil, phone: nil, photo: [], botInfo: nil, restrictionInfo: nil, flags: UserInfoFlags())
|
||||||
for attribute in content.firstMessage.attributes {
|
|
||||||
if let attribute = attribute as? SourceReferenceMessageAttribute, let sourcePeer = content.firstMessage.peers[attribute.messageId.peerId] {
|
|
||||||
effectiveAuthor = sourcePeer
|
|
||||||
break
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
displayAuthorInfo = incoming && effectiveAuthor != nil
|
displayAuthorInfo = incoming && effectiveAuthor != nil
|
||||||
|
@ -508,8 +508,13 @@ class ChatMessageStickerItemNode: ChatMessageItemView {
|
|||||||
} else {
|
} else {
|
||||||
navigate = .info
|
navigate = .info
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if item.effectiveAuthorId?.namespace == Namespaces.Peer.Empty {
|
||||||
|
item.controllerInteraction.displayMessageTooltip(item.content.firstMessage.id, item.presentationData.strings.Conversation_ForwardAuthorHiddenTooltip, self, avatarNode.frame)
|
||||||
|
} else {
|
||||||
item.controllerInteraction.openPeer(item.effectiveAuthorId ?? author.id, navigate, item.message)
|
item.controllerInteraction.openPeer(item.effectiveAuthorId ?? author.id, navigate, item.message)
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -363,7 +363,7 @@ final class ChatRecentActionsControllerNode: ViewControllerTracingNode {
|
|||||||
if let strongSelf = self {
|
if let strongSelf = self {
|
||||||
strongSelf.context.sharedContext.applicationBindings.openAppStorePage()
|
strongSelf.context.sharedContext.applicationBindings.openAppStorePage()
|
||||||
}
|
}
|
||||||
}, displayMessageTooltip: { _, _, _ in
|
}, displayMessageTooltip: { _, _, _, _ in
|
||||||
}, requestMessageUpdate: { _ in
|
}, requestMessageUpdate: { _ in
|
||||||
}, cancelInteractiveKeyboardGestures: {
|
}, cancelInteractiveKeyboardGestures: {
|
||||||
}, automaticMediaDownloadSettings: self.automaticMediaDownloadSettings,
|
}, automaticMediaDownloadSettings: self.automaticMediaDownloadSettings,
|
||||||
|
@ -329,7 +329,7 @@ class ItemListStickerPackItemNode: ItemListRevealOptionsItemNode {
|
|||||||
resourceReference = MediaResourceReference.standalone(resource: thumbnail.resource)
|
resourceReference = MediaResourceReference.standalone(resource: thumbnail.resource)
|
||||||
} else if let item = item.topItem, let dimensions = item.file.dimensions, let resource = chatMessageStickerResource(file: item.file, small: true) as? TelegramMediaResource {
|
} else if let item = item.topItem, let dimensions = item.file.dimensions, let resource = chatMessageStickerResource(file: item.file, small: true) as? TelegramMediaResource {
|
||||||
thumbnailItem = TelegramMediaImageRepresentation(dimensions: dimensions, resource: resource)
|
thumbnailItem = TelegramMediaImageRepresentation(dimensions: dimensions, resource: resource)
|
||||||
resourceReference = MediaResourceReference.standalone(resource: resource)
|
resourceReference = MediaResourceReference.media(media: .standalone(media: item.file), resource: resource)
|
||||||
}
|
}
|
||||||
|
|
||||||
let fileUpdated = thumbnailItem != previousThumbnailItem
|
let fileUpdated = thumbnailItem != previousThumbnailItem
|
||||||
|
@ -72,7 +72,7 @@ final class OverlayPlayerControllerNode: ViewControllerTracingNode, UIGestureRec
|
|||||||
}, rateCall: { _, _ in
|
}, rateCall: { _, _ in
|
||||||
}, requestSelectMessagePollOption: { _, _ in
|
}, requestSelectMessagePollOption: { _, _ in
|
||||||
}, openAppStorePage: {
|
}, openAppStorePage: {
|
||||||
}, displayMessageTooltip: { _, _, _ in
|
}, displayMessageTooltip: { _, _, _, _ in
|
||||||
}, requestMessageUpdate: { _ in
|
}, requestMessageUpdate: { _ in
|
||||||
}, cancelInteractiveKeyboardGestures: {
|
}, cancelInteractiveKeyboardGestures: {
|
||||||
}, automaticMediaDownloadSettings: MediaAutoDownloadSettings.defaultSettings,
|
}, automaticMediaDownloadSettings: MediaAutoDownloadSettings.defaultSettings,
|
||||||
|
@ -253,7 +253,7 @@ public class PeerMediaCollectionController: TelegramController {
|
|||||||
}, rateCall: { _, _ in
|
}, rateCall: { _, _ in
|
||||||
}, requestSelectMessagePollOption: { _, _ in
|
}, requestSelectMessagePollOption: { _, _ in
|
||||||
}, openAppStorePage: {
|
}, openAppStorePage: {
|
||||||
}, displayMessageTooltip: { _, _, _ in
|
}, displayMessageTooltip: { _, _, _, _ in
|
||||||
}, requestMessageUpdate: { _ in
|
}, requestMessageUpdate: { _ in
|
||||||
}, cancelInteractiveKeyboardGestures: {
|
}, cancelInteractiveKeyboardGestures: {
|
||||||
}, automaticMediaDownloadSettings: MediaAutoDownloadSettings.defaultSettings,
|
}, automaticMediaDownloadSettings: MediaAutoDownloadSettings.defaultSettings,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user