mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-06-16 05:55:20 +00:00
Merge commit 'e8a68ab883a8ed7a14e3e8d93e61ea8e3bfe5bb4'
This commit is contained in:
commit
60a0fc4f59
@ -154,9 +154,12 @@ public final class SlotMachineAnimationNode: ASDisplayNode {
|
||||
private var diceState: ManagedSlotMachineAnimationState? = nil
|
||||
private let disposables = DisposableSet()
|
||||
|
||||
private let animationSize = CGSize(width: 184.0, height: 184.0)
|
||||
private let animationSize: CGSize
|
||||
|
||||
public override init() {
|
||||
public var success: ((Bool) -> Void)?
|
||||
|
||||
public init(size: CGSize = CGSize(width: 184.0, height: 184.0)) {
|
||||
self.animationSize = size
|
||||
self.backNode = ManagedAnimationNode(size: self.animationSize)
|
||||
self.leftReelNode = ManagedAnimationNode(size: self.animationSize)
|
||||
self.centerReelNode = ManagedAnimationNode(size: self.animationSize)
|
||||
@ -197,8 +200,9 @@ public final class SlotMachineAnimationNode: ASDisplayNode {
|
||||
case let .value(value, _):
|
||||
let slotValue = SlotMachineValue(rawValue: value)
|
||||
if slotValue.isThreeOfSame {
|
||||
Queue.mainQueue().after(1.5) {
|
||||
Queue.mainQueue().after(1.2) {
|
||||
self.backNode.trackTo(item: ManagedAnimationItem(source: .local("Slot_Back_Win"), loop: false))
|
||||
self.success?(!slotValue.is777)
|
||||
}
|
||||
} else {
|
||||
self.backNode.trackTo(item: ManagedAnimationItem(source: .local("Slot_Back_Win"), frames: .still(.start), loop: false))
|
||||
|
@ -2159,7 +2159,7 @@ public final class ChatControllerImpl: TelegramBaseController, ChatController, G
|
||||
self?.displayPsa(type: type, sourceNode: sourceNode, isAutomatic: false)
|
||||
}, displayDiceTooltip: { [weak self] dice in
|
||||
self?.displayDiceTooltip(dice: dice)
|
||||
}, animateDiceSuccess: { [weak self] in
|
||||
}, animateDiceSuccess: { [weak self] onlyHaptic in
|
||||
guard let strongSelf = self else {
|
||||
return
|
||||
}
|
||||
@ -2167,7 +2167,9 @@ public final class ChatControllerImpl: TelegramBaseController, ChatController, G
|
||||
strongSelf.selectPollOptionFeedback = HapticFeedback()
|
||||
}
|
||||
strongSelf.selectPollOptionFeedback?.success()
|
||||
strongSelf.chatDisplayNode.animateQuizCorrectOptionSelected()
|
||||
if !onlyHaptic {
|
||||
strongSelf.chatDisplayNode.animateQuizCorrectOptionSelected()
|
||||
}
|
||||
}, greetingStickerNode: { [weak self] in
|
||||
return self?.chatDisplayNode.greetingStickerNode
|
||||
}, openPeerContextMenu: { [weak self] peer, node, rect, gesture in
|
||||
|
@ -110,7 +110,7 @@ public final class ChatControllerInteraction {
|
||||
let displayPollSolution: (TelegramMediaPollResults.Solution, ASDisplayNode) -> Void
|
||||
let displayPsa: (String, ASDisplayNode) -> Void
|
||||
let displayDiceTooltip: (TelegramMediaDice) -> Void
|
||||
let animateDiceSuccess: () -> Void
|
||||
let animateDiceSuccess: (Bool) -> Void
|
||||
let greetingStickerNode: () -> (ASDisplayNode, ASDisplayNode, ASDisplayNode, () -> Void)?
|
||||
let openPeerContextMenu: (Peer, ASDisplayNode, CGRect, ContextGesture?) -> Void
|
||||
let openMessageReplies: (MessageId, Bool, Bool) -> Void
|
||||
@ -197,7 +197,7 @@ public final class ChatControllerInteraction {
|
||||
displayPollSolution: @escaping (TelegramMediaPollResults.Solution, ASDisplayNode) -> Void,
|
||||
displayPsa: @escaping (String, ASDisplayNode) -> Void,
|
||||
displayDiceTooltip: @escaping (TelegramMediaDice) -> Void,
|
||||
animateDiceSuccess: @escaping () -> Void,
|
||||
animateDiceSuccess: @escaping (Bool) -> Void,
|
||||
greetingStickerNode: @escaping () -> (ASDisplayNode, ASDisplayNode, ASDisplayNode, () -> Void)?,
|
||||
openPeerContextMenu: @escaping (Peer, ASDisplayNode, CGRect, ContextGesture?) -> Void,
|
||||
openMessageReplies: @escaping (MessageId, Bool, Bool) -> Void,
|
||||
@ -321,7 +321,7 @@ public final class ChatControllerInteraction {
|
||||
}, displayPollSolution: { _, _ in
|
||||
}, displayPsa: { _, _ in
|
||||
}, displayDiceTooltip: { _ in
|
||||
}, animateDiceSuccess: {
|
||||
}, animateDiceSuccess: { _ in
|
||||
}, greetingStickerNode: {
|
||||
return nil
|
||||
}, openPeerContextMenu: { _, _, _, _ in
|
||||
|
@ -584,15 +584,14 @@ class ChatControllerNode: ASDisplayNode, UIScrollViewDelegate {
|
||||
|
||||
self.addSubnode(self.backgroundNode)
|
||||
self.addSubnode(self.historyNodeContainer)
|
||||
self.addSubnode(self.navigateButtons)
|
||||
self.addSubnode(self.titleAccessoryPanelContainer)
|
||||
|
||||
self.addSubnode(self.inputPanelBackgroundNode)
|
||||
self.addSubnode(self.inputPanelBackgroundSeparatorNode)
|
||||
|
||||
self.addSubnode(self.inputContextPanelContainer)
|
||||
|
||||
self.addSubnode(self.navigateButtons)
|
||||
|
||||
|
||||
self.addSubnode(self.navigationBarBackroundNode)
|
||||
self.addSubnode(self.navigationBarSeparatorNode)
|
||||
if !self.context.sharedContext.immediateExperimentalUISettings.playerEmbedding {
|
||||
|
@ -334,13 +334,20 @@ class ChatMessageAnimatedStickerItemNode: ChatMessageItemView {
|
||||
if let telegramDice = self.telegramDice {
|
||||
if telegramDice.emoji == "🎰" {
|
||||
let animationNode = SlotMachineAnimationNode()
|
||||
if !item.message.effectivelyIncoming(item.context.account.peerId) {
|
||||
animationNode.success = { [weak self] onlyHaptic in
|
||||
if let strongSelf = self, let item = strongSelf.item {
|
||||
item.controllerInteraction.animateDiceSuccess(onlyHaptic)
|
||||
}
|
||||
}
|
||||
}
|
||||
self.animationNode = animationNode
|
||||
} else {
|
||||
let animationNode = ManagedDiceAnimationNode(context: item.context, emoji: telegramDice.emoji.strippedEmoji)
|
||||
if !item.message.effectivelyIncoming(item.context.account.peerId) {
|
||||
animationNode.success = { [weak self] in
|
||||
if let strongSelf = self, let item = strongSelf.item {
|
||||
item.controllerInteraction.animateDiceSuccess()
|
||||
item.controllerInteraction.animateDiceSuccess(false)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -424,7 +424,7 @@ final class ChatMessageAttachedContentNode: ASDisplayNode {
|
||||
refineContentImageLayout = refineLayout
|
||||
} else if file.isInstantVideo {
|
||||
let automaticDownload = shouldDownloadMediaAutomatically(settings: automaticDownloadSettings, peerType: associatedData.automaticDownloadPeerType, networkType: associatedData.automaticDownloadNetworkType, authorPeerId: message.author?.id, contactsPeerIds: associatedData.contactsPeerIds, media: file)
|
||||
let (videoLayout, apply) = contentInstantVideoLayout(ChatMessageBubbleContentItem(context: context, controllerInteraction: controllerInteraction, message: message, read: messageRead, chatLocation: chatLocation, presentationData: presentationData, associatedData: associatedData, attributes: attributes, isItemPinned: message.tags.contains(.pinned)), constrainedSize.width - horizontalInsets.left - horizontalInsets.right, CGSize(width: 212.0, height: 212.0), .bubble, automaticDownload)
|
||||
let (videoLayout, apply) = contentInstantVideoLayout(ChatMessageBubbleContentItem(context: context, controllerInteraction: controllerInteraction, message: message, read: messageRead, chatLocation: chatLocation, presentationData: presentationData, associatedData: associatedData, attributes: attributes, isItemPinned: message.tags.contains(.pinned), isItemEdited: false), constrainedSize.width - horizontalInsets.left - horizontalInsets.right, CGSize(width: 212.0, height: 212.0), .bubble, automaticDownload)
|
||||
initialWidth = videoLayout.contentSize.width + videoLayout.overflowLeft + videoLayout.overflowRight
|
||||
contentInstantVideoSizeAndApply = (videoLayout, apply)
|
||||
} else if file.isVideo {
|
||||
@ -474,7 +474,7 @@ final class ChatMessageAttachedContentNode: ASDisplayNode {
|
||||
}
|
||||
}
|
||||
|
||||
let (_, refineLayout) = contentFileLayout(context, presentationData, message, associatedData, chatLocation, attributes, message.tags.contains(.pinned) && !associatedData.isInPinnedListMode, file, automaticDownload, message.effectivelyIncoming(context.account.peerId), false, associatedData.forcedResourceStatus, statusType, nil, CGSize(width: constrainedSize.width - horizontalInsets.left - horizontalInsets.right, height: constrainedSize.height))
|
||||
let (_, refineLayout) = contentFileLayout(context, presentationData, message, associatedData, chatLocation, attributes, message.tags.contains(.pinned) && !associatedData.isInPinnedListMode, false, file, automaticDownload, message.effectivelyIncoming(context.account.peerId), false, associatedData.forcedResourceStatus, statusType, nil, CGSize(width: constrainedSize.width - horizontalInsets.left - horizontalInsets.right, height: constrainedSize.height))
|
||||
refineContentFileLayout = refineLayout
|
||||
}
|
||||
} else if let image = media as? TelegramMediaImage {
|
||||
|
@ -109,8 +109,9 @@ final class ChatMessageBubbleContentItem {
|
||||
let associatedData: ChatMessageItemAssociatedData
|
||||
let attributes: ChatMessageEntryAttributes
|
||||
let isItemPinned: Bool
|
||||
let isItemEdited: Bool
|
||||
|
||||
init(context: AccountContext, controllerInteraction: ChatControllerInteraction, message: Message, read: Bool, chatLocation: ChatLocation, presentationData: ChatPresentationData, associatedData: ChatMessageItemAssociatedData, attributes: ChatMessageEntryAttributes, isItemPinned: Bool) {
|
||||
init(context: AccountContext, controllerInteraction: ChatControllerInteraction, message: Message, read: Bool, chatLocation: ChatLocation, presentationData: ChatPresentationData, associatedData: ChatMessageItemAssociatedData, attributes: ChatMessageEntryAttributes, isItemPinned: Bool, isItemEdited: Bool) {
|
||||
self.context = context
|
||||
self.controllerInteraction = controllerInteraction
|
||||
self.message = message
|
||||
@ -120,6 +121,7 @@ final class ChatMessageBubbleContentItem {
|
||||
self.associatedData = associatedData
|
||||
self.attributes = attributes
|
||||
self.isItemPinned = isItemPinned
|
||||
self.isItemEdited = isItemEdited
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -64,7 +64,7 @@ private func contentNodeMessagesAndClassesForItem(_ item: ChatMessageItem) -> ([
|
||||
} else {
|
||||
var neighborSpacing: ChatMessageBubbleRelativePosition.NeighbourSpacing = .default
|
||||
if previousItemIsFile {
|
||||
neighborSpacing = .overlap(file.isMusic ? 14.0 : 5.0)
|
||||
neighborSpacing = .overlap(file.isMusic ? 14.0 : 4.0)
|
||||
}
|
||||
isFile = true
|
||||
hasFiles = true
|
||||
@ -217,7 +217,7 @@ class ChatMessageBubbleItemNode: ChatMessageItemView, ChatMessagePreviewItemNode
|
||||
var backgroundNode: ChatMessageBackground?
|
||||
var selectionBackgroundNode: ASDisplayNode?
|
||||
|
||||
var currentParams: (size: CGSize, contentOrigin: CGPoint, presentationData: ChatPresentationData, graphics: PrincipalThemeEssentialGraphics, backgroundType: ChatMessageBackgroundType, Bool?)?
|
||||
var currentParams: (size: CGSize, contentOrigin: CGPoint, presentationData: ChatPresentationData, graphics: PrincipalThemeEssentialGraphics, backgroundType: ChatMessageBackgroundType, Bool?, selectionInsets: UIEdgeInsets)?
|
||||
|
||||
init(contentMessageStableId: UInt32) {
|
||||
self.contentMessageStableId = contentMessageStableId
|
||||
@ -268,8 +268,8 @@ class ChatMessageBubbleItemNode: ChatMessageItemView, ChatMessagePreviewItemNode
|
||||
func isExtractedToContextPreviewUpdated(_ isExtractedToContextPreview: Bool) {
|
||||
}
|
||||
|
||||
func update(size: CGSize, contentOrigin: CGPoint, index: Int, presentationData: ChatPresentationData, graphics: PrincipalThemeEssentialGraphics, backgroundType: ChatMessageBackgroundType, messageSelection: Bool?) {
|
||||
self.currentParams = (size, contentOrigin, presentationData, graphics, backgroundType, messageSelection)
|
||||
func update(size: CGSize, contentOrigin: CGPoint, selectionInsets: UIEdgeInsets, index: Int, presentationData: ChatPresentationData, graphics: PrincipalThemeEssentialGraphics, backgroundType: ChatMessageBackgroundType, messageSelection: Bool?) {
|
||||
self.currentParams = (size, contentOrigin, presentationData, graphics, backgroundType, messageSelection, selectionInsets)
|
||||
let bounds = CGRect(origin: CGPoint(), size: size)
|
||||
|
||||
var incoming: Bool = false
|
||||
@ -292,6 +292,7 @@ class ChatMessageBubbleItemNode: ChatMessageItemView, ChatMessagePreviewItemNode
|
||||
selectionBackgroundFrame.origin.y -= contentOrigin.y
|
||||
selectionBackgroundFrame.size.height += contentOrigin.y
|
||||
}
|
||||
selectionBackgroundFrame = selectionBackgroundFrame.inset(by: selectionInsets)
|
||||
|
||||
let bubbleColor = graphics.hasWallpaper ? messageTheme.bubble.withWallpaper.fill : messageTheme.bubble.withoutWallpaper.fill
|
||||
let selectionColor = bubbleColor.withAlphaComponent(1.0).mixedWith(messageTheme.accentTextColor.withAlphaComponent(1.0), alpha: 0.08)
|
||||
@ -1209,6 +1210,7 @@ class ChatMessageBubbleItemNode: ChatMessageItemView, ChatMessagePreviewItemNode
|
||||
|
||||
let read: Bool
|
||||
var isItemPinned = false
|
||||
var isItemEdited = false
|
||||
|
||||
switch item.content {
|
||||
case let .message(message, value, _, _):
|
||||
@ -1220,6 +1222,12 @@ class ChatMessageBubbleItemNode: ChatMessageItemView, ChatMessagePreviewItemNode
|
||||
if message.0.tags.contains(.pinned) {
|
||||
isItemPinned = true
|
||||
}
|
||||
for attribute in message.0.attributes {
|
||||
if let attribute = attribute as? EditedMessageAttribute {
|
||||
isItemEdited = !attribute.isHidden
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -1275,7 +1283,7 @@ class ChatMessageBubbleItemNode: ChatMessageItemView, ChatMessagePreviewItemNode
|
||||
prepareContentPosition = .linear(top: topPosition, bottom: refinedBottomPosition)
|
||||
}
|
||||
|
||||
let contentItem = ChatMessageBubbleContentItem(context: item.context, controllerInteraction: item.controllerInteraction, message: message, read: read, chatLocation: item.chatLocation, presentationData: item.presentationData, associatedData: item.associatedData, attributes: attributes, isItemPinned: isItemPinned)
|
||||
let contentItem = ChatMessageBubbleContentItem(context: item.context, controllerInteraction: item.controllerInteraction, message: message, read: read, chatLocation: item.chatLocation, presentationData: item.presentationData, associatedData: item.associatedData, attributes: attributes, isItemPinned: isItemPinned, isItemEdited: isItemEdited)
|
||||
|
||||
var itemSelection: Bool?
|
||||
switch content {
|
||||
@ -1789,13 +1797,12 @@ class ChatMessageBubbleItemNode: ChatMessageItemView, ChatMessagePreviewItemNode
|
||||
|
||||
var contentSize = CGSize(width: maxContentWidth, height: 0.0)
|
||||
var contentNodeFramesPropertiesAndApply: [(CGRect, ChatMessageBubbleContentProperties, Bool, (ListViewItemUpdateAnimation, Bool) -> Void)] = []
|
||||
var contentContainerNodeFrames: [(UInt32, CGRect, Bool?)] = []
|
||||
var contentContainerNodeFrames: [(UInt32, CGRect, Bool?, CGFloat)] = []
|
||||
var currentContainerGroupId: UInt32?
|
||||
var currentItemSelection: Bool?
|
||||
|
||||
var contentNodesHeight: CGFloat = 0.0
|
||||
var totalContentNodesHeight: CGFloat = 0.0
|
||||
|
||||
var currentContainerGroupOverlap: CGFloat = 0.0
|
||||
|
||||
var mosaicStatusOrigin: CGPoint?
|
||||
@ -1823,7 +1830,7 @@ class ChatMessageBubbleItemNode: ChatMessageItemView, ChatMessagePreviewItemNode
|
||||
|
||||
let (_, apply) = finalize(maxContentWidth)
|
||||
let contentNodeFrame = framesAndPositions[mosaicIndex].0.offsetBy(dx: 0.0, dy: contentNodesHeight)
|
||||
contentNodeFramesPropertiesAndApply.append((contentNodeFrame, properties, false, apply))
|
||||
contentNodeFramesPropertiesAndApply.append((contentNodeFrame, properties, true, apply))
|
||||
|
||||
if mosaicIndex == mosaicRange.upperBound - 1 {
|
||||
contentNodesHeight += size.height
|
||||
@ -1845,7 +1852,7 @@ class ChatMessageBubbleItemNode: ChatMessageItemView, ChatMessagePreviewItemNode
|
||||
if !contentContainerNodeFrames.isEmpty {
|
||||
overlapOffset = currentContainerGroupOverlap
|
||||
}
|
||||
contentContainerNodeFrames.append((containerGroupId, CGRect(x: 0.0, y: headerSize.height + totalContentNodesHeight - contentNodesHeight - overlapOffset, width: maxContentWidth, height: contentNodesHeight), currentItemSelection))
|
||||
contentContainerNodeFrames.append((containerGroupId, CGRect(x: 0.0, y: headerSize.height + totalContentNodesHeight - contentNodesHeight - overlapOffset, width: maxContentWidth, height: contentNodesHeight), currentItemSelection, currentContainerGroupOverlap))
|
||||
if !overlapOffset.isZero {
|
||||
totalContentNodesHeight -= currentContainerGroupOverlap
|
||||
}
|
||||
@ -1871,7 +1878,7 @@ class ChatMessageBubbleItemNode: ChatMessageItemView, ChatMessagePreviewItemNode
|
||||
if !contentContainerNodeFrames.isEmpty {
|
||||
overlapOffset = currentContainerGroupOverlap
|
||||
}
|
||||
contentContainerNodeFrames.append((containerGroupId, CGRect(x: 0.0, y: headerSize.height + totalContentNodesHeight - contentNodesHeight - overlapOffset, width: maxContentWidth, height: contentNodesHeight), currentItemSelection))
|
||||
contentContainerNodeFrames.append((containerGroupId, CGRect(x: 0.0, y: headerSize.height + totalContentNodesHeight - contentNodesHeight - overlapOffset, width: maxContentWidth, height: contentNodesHeight), currentItemSelection, currentContainerGroupOverlap))
|
||||
if !overlapOffset.isZero {
|
||||
totalContentNodesHeight -= currentContainerGroupOverlap
|
||||
}
|
||||
@ -2047,7 +2054,7 @@ class ChatMessageBubbleItemNode: ChatMessageItemView, ChatMessagePreviewItemNode
|
||||
addedContentNodes: [(Message, Bool, ChatMessageBubbleContentNode)]?,
|
||||
contentNodeMessagesAndClasses: [(Message, AnyClass, ChatMessageEntryAttributes, BubbleItemAttributes)],
|
||||
contentNodeFramesPropertiesAndApply: [(CGRect, ChatMessageBubbleContentProperties, Bool, (ListViewItemUpdateAnimation, Bool) -> Void)],
|
||||
contentContainerNodeFrames: [(UInt32, CGRect, Bool?)],
|
||||
contentContainerNodeFrames: [(UInt32, CGRect, Bool?, CGFloat)],
|
||||
mosaicStatusOrigin: CGPoint?,
|
||||
mosaicStatusSizeAndApply: (CGSize, (Bool) -> ChatMessageDateAndStatusNode)?,
|
||||
updatedShareButtonNode: HighlightableButtonNode?,
|
||||
@ -2231,7 +2238,7 @@ class ChatMessageBubbleItemNode: ChatMessageItemView, ChatMessagePreviewItemNode
|
||||
|
||||
var index = 0
|
||||
var hasSelection = false
|
||||
for (stableId, relativeFrame, itemSelection) in contentContainerNodeFrames {
|
||||
for (stableId, relativeFrame, itemSelection, groupOverlap) in contentContainerNodeFrames {
|
||||
if let itemSelection = itemSelection, itemSelection {
|
||||
hasSelection = true
|
||||
}
|
||||
@ -2354,7 +2361,17 @@ class ChatMessageBubbleItemNode: ChatMessageItemView, ChatMessagePreviewItemNode
|
||||
contentContainer?.sourceNode.layoutUpdated?(relativeFrame.size)
|
||||
}
|
||||
|
||||
contentContainer?.update(size: relativeFrame.size, contentOrigin: contentOrigin, index: index, presentationData: item.presentationData, graphics: graphics, backgroundType: backgroundType, messageSelection: itemSelection)
|
||||
var selectionInsets = UIEdgeInsets()
|
||||
if index == 0 {
|
||||
selectionInsets.bottom = groupOverlap / 2.0
|
||||
} else if index == contentContainerNodeFrames.count - 1 {
|
||||
selectionInsets.top = groupOverlap / 2.0
|
||||
} else {
|
||||
selectionInsets.top = groupOverlap / 2.0
|
||||
selectionInsets.bottom = groupOverlap / 2.0
|
||||
}
|
||||
|
||||
contentContainer?.update(size: relativeFrame.size, contentOrigin: contentOrigin, selectionInsets: selectionInsets, index: index, presentationData: item.presentationData, graphics: graphics, backgroundType: backgroundType, messageSelection: itemSelection)
|
||||
|
||||
index += 1
|
||||
}
|
||||
|
@ -89,7 +89,7 @@ class ChatMessageFileBubbleContentNode: ChatMessageBubbleContentNode {
|
||||
|
||||
let automaticDownload = shouldDownloadMediaAutomatically(settings: item.controllerInteraction.automaticMediaDownloadSettings, peerType: item.associatedData.automaticDownloadPeerType, networkType: item.associatedData.automaticDownloadNetworkType, authorPeerId: item.message.author?.id, contactsPeerIds: item.associatedData.contactsPeerIds, media: selectedFile!)
|
||||
|
||||
let (initialWidth, refineLayout) = interactiveFileLayout(item.context, item.presentationData, item.message, item.associatedData, item.chatLocation, item.attributes, item.isItemPinned, selectedFile!, automaticDownload, item.message.effectivelyIncoming(item.context.account.peerId), item.associatedData.isRecentActions, item.associatedData.forcedResourceStatus, statusType, item.message.groupingKey != nil ? selection : nil, CGSize(width: constrainedSize.width - layoutConstants.file.bubbleInsets.left - layoutConstants.file.bubbleInsets.right, height: constrainedSize.height))
|
||||
let (initialWidth, refineLayout) = interactiveFileLayout(item.context, item.presentationData, item.message, item.associatedData, item.chatLocation, item.attributes, item.isItemPinned, item.isItemEdited, selectedFile!, automaticDownload, item.message.effectivelyIncoming(item.context.account.peerId), item.associatedData.isRecentActions, item.associatedData.forcedResourceStatus, statusType, item.message.groupingKey != nil ? selection : nil, CGSize(width: constrainedSize.width - layoutConstants.file.bubbleInsets.left - layoutConstants.file.bubbleInsets.right, height: constrainedSize.height))
|
||||
|
||||
let contentProperties = ChatMessageBubbleContentProperties(hidesSimpleAuthorHeader: false, headerSpacing: 0.0, hidesBackground: .never, forceFullCorners: false, forceAlignment: .none)
|
||||
|
||||
|
@ -276,7 +276,7 @@ class ChatMessageInstantVideoItemNode: ChatMessageItemView {
|
||||
}
|
||||
}
|
||||
|
||||
let (videoLayout, videoApply) = makeVideoLayout(ChatMessageBubbleContentItem(context: item.context, controllerInteraction: item.controllerInteraction, message: item.message, read: item.read, chatLocation: item.chatLocation, presentationData: item.presentationData, associatedData: item.associatedData, attributes: item.content.firstMessageAttributes, isItemPinned: item.message.tags.contains(.pinned)), params.width - params.leftInset - params.rightInset - avatarInset, displaySize, .free, automaticDownload)
|
||||
let (videoLayout, videoApply) = makeVideoLayout(ChatMessageBubbleContentItem(context: item.context, controllerInteraction: item.controllerInteraction, message: item.message, read: item.read, chatLocation: item.chatLocation, presentationData: item.presentationData, associatedData: item.associatedData, attributes: item.content.firstMessageAttributes, isItemPinned: item.message.tags.contains(.pinned), isItemEdited: false), params.width - params.leftInset - params.rightInset - avatarInset, displaySize, .free, automaticDownload)
|
||||
|
||||
let videoFrame = CGRect(origin: CGPoint(x: (incoming ? (params.leftInset + layoutConstants.bubble.edgeInset + avatarInset + layoutConstants.bubble.contentInsets.left) : (params.width - params.rightInset - videoLayout.contentSize.width - layoutConstants.bubble.edgeInset - layoutConstants.bubble.contentInsets.left - deliveryFailedInset)), y: 0.0), size: videoLayout.contentSize)
|
||||
|
||||
|
@ -208,7 +208,7 @@ final class ChatMessageInteractiveFileNode: ASDisplayNode {
|
||||
}
|
||||
}
|
||||
|
||||
func asyncLayout() -> (_ context: AccountContext, _ presentationData: ChatPresentationData, _ message: Message, _ associatedData: ChatMessageItemAssociatedData, _ chatLocation: ChatLocation, _ attributes: ChatMessageEntryAttributes, _ isPinned: Bool, _ file: TelegramMediaFile, _ automaticDownload: Bool, _ incoming: Bool, _ isRecentActions: Bool, _ forcedResourceStatus: FileMediaResourceStatus?, _ dateAndStatusType: ChatMessageDateAndStatusType?, _ messageSelection: Bool?, _ constrainedSize: CGSize) -> (CGFloat, (CGSize) -> (CGFloat, (CGFloat) -> (CGSize, (Bool) -> Void))) {
|
||||
func asyncLayout() -> (_ context: AccountContext, _ presentationData: ChatPresentationData, _ message: Message, _ associatedData: ChatMessageItemAssociatedData, _ chatLocation: ChatLocation, _ attributes: ChatMessageEntryAttributes, _ isPinned: Bool, _ forcedIsEdited: Bool, _ file: TelegramMediaFile, _ automaticDownload: Bool, _ incoming: Bool, _ isRecentActions: Bool, _ forcedResourceStatus: FileMediaResourceStatus?, _ dateAndStatusType: ChatMessageDateAndStatusType?, _ messageSelection: Bool?, _ constrainedSize: CGSize) -> (CGFloat, (CGSize) -> (CGFloat, (CGFloat) -> (CGSize, (Bool) -> Void))) {
|
||||
let currentFile = self.file
|
||||
|
||||
let titleAsyncLayout = TextNode.asyncLayout(self.titleNode)
|
||||
@ -218,7 +218,7 @@ final class ChatMessageInteractiveFileNode: ASDisplayNode {
|
||||
|
||||
let currentMessage = self.message
|
||||
|
||||
return { context, presentationData, message, associatedData, chatLocation, attributes, isPinned, file, automaticDownload, incoming, isRecentActions, forcedResourceStatus, dateAndStatusType, messageSelection, constrainedSize in
|
||||
return { context, presentationData, message, associatedData, chatLocation, attributes, isPinned, forcedIsEdited, file, automaticDownload, incoming, isRecentActions, forcedResourceStatus, dateAndStatusType, messageSelection, constrainedSize in
|
||||
return (CGFloat.greatestFiniteMagnitude, { constrainedSize in
|
||||
let titleFont = Font.regular(floor(presentationData.fontSize.baseDisplaySize * 16.0 / 17.0))
|
||||
let descriptionFont = Font.regular(floor(presentationData.fontSize.baseDisplaySize * 13.0 / 17.0))
|
||||
@ -311,6 +311,9 @@ final class ChatMessageInteractiveFileNode: ASDisplayNode {
|
||||
}
|
||||
}
|
||||
}
|
||||
if forcedIsEdited {
|
||||
edited = true
|
||||
}
|
||||
|
||||
var dateReactions: [MessageReaction] = []
|
||||
var dateReactionCount = 0
|
||||
@ -1032,12 +1035,12 @@ final class ChatMessageInteractiveFileNode: ASDisplayNode {
|
||||
self.fetchingCompactTextNode.frame = CGRect(origin: self.descriptionNode.frame.origin, size: fetchingCompactSize)
|
||||
}
|
||||
|
||||
static func asyncLayout(_ node: ChatMessageInteractiveFileNode?) -> (_ context: AccountContext, _ presentationData: ChatPresentationData, _ message: Message, _ associatedData: ChatMessageItemAssociatedData, _ chatLocation: ChatLocation, _ attributes: ChatMessageEntryAttributes, _ isPinned: Bool, _ file: TelegramMediaFile, _ automaticDownload: Bool, _ incoming: Bool, _ isRecentActions: Bool, _ forcedResourceStatus: FileMediaResourceStatus?, _ dateAndStatusType: ChatMessageDateAndStatusType?, _ messageSelection: Bool?, _ constrainedSize: CGSize) -> (CGFloat, (CGSize) -> (CGFloat, (CGFloat) -> (CGSize, (Bool) -> ChatMessageInteractiveFileNode))) {
|
||||
static func asyncLayout(_ node: ChatMessageInteractiveFileNode?) -> (_ context: AccountContext, _ presentationData: ChatPresentationData, _ message: Message, _ associatedData: ChatMessageItemAssociatedData, _ chatLocation: ChatLocation, _ attributes: ChatMessageEntryAttributes, _ isPinned: Bool, _ forcedIsEdited: Bool, _ file: TelegramMediaFile, _ automaticDownload: Bool, _ incoming: Bool, _ isRecentActions: Bool, _ forcedResourceStatus: FileMediaResourceStatus?, _ dateAndStatusType: ChatMessageDateAndStatusType?, _ messageSelection: Bool?, _ constrainedSize: CGSize) -> (CGFloat, (CGSize) -> (CGFloat, (CGFloat) -> (CGSize, (Bool) -> ChatMessageInteractiveFileNode))) {
|
||||
let currentAsyncLayout = node?.asyncLayout()
|
||||
|
||||
return { context, presentationData, message, associatedData, chatLocation, attributes, isPinned, file, automaticDownload, incoming, isRecentActions, forcedResourceStatus, dateAndStatusType, messageSelection, constrainedSize in
|
||||
return { context, presentationData, message, associatedData, chatLocation, attributes, isPinned, forcedIsEdited, file, automaticDownload, incoming, isRecentActions, forcedResourceStatus, dateAndStatusType, messageSelection, constrainedSize in
|
||||
var fileNode: ChatMessageInteractiveFileNode
|
||||
var fileLayout: (_ context: AccountContext, _ presentationData: ChatPresentationData, _ message: Message, _ associatedData: ChatMessageItemAssociatedData, _ chatLocation: ChatLocation, _ attributes: ChatMessageEntryAttributes, _ isPinned: Bool, _ file: TelegramMediaFile, _ automaticDownload: Bool, _ incoming: Bool, _ isRecentActions: Bool, _ forcedResourceStatus: FileMediaResourceStatus?, _ dateAndStatusType: ChatMessageDateAndStatusType?, _ messageSelection: Bool?, _ constrainedSize: CGSize) -> (CGFloat, (CGSize) -> (CGFloat, (CGFloat) -> (CGSize, (Bool) -> Void)))
|
||||
var fileLayout: (_ context: AccountContext, _ presentationData: ChatPresentationData, _ message: Message, _ associatedData: ChatMessageItemAssociatedData, _ chatLocation: ChatLocation, _ attributes: ChatMessageEntryAttributes, _ isPinned: Bool, _ forcedIsEdited: Bool, _ file: TelegramMediaFile, _ automaticDownload: Bool, _ incoming: Bool, _ isRecentActions: Bool, _ forcedResourceStatus: FileMediaResourceStatus?, _ dateAndStatusType: ChatMessageDateAndStatusType?, _ messageSelection: Bool?, _ constrainedSize: CGSize) -> (CGFloat, (CGSize) -> (CGFloat, (CGFloat) -> (CGSize, (Bool) -> Void)))
|
||||
|
||||
if let node = node, let currentAsyncLayout = currentAsyncLayout {
|
||||
fileNode = node
|
||||
@ -1047,7 +1050,7 @@ final class ChatMessageInteractiveFileNode: ASDisplayNode {
|
||||
fileLayout = fileNode.asyncLayout()
|
||||
}
|
||||
|
||||
let (initialWidth, continueLayout) = fileLayout(context, presentationData, message, associatedData, chatLocation, attributes, isPinned, file, automaticDownload, incoming, isRecentActions, forcedResourceStatus, dateAndStatusType, messageSelection, constrainedSize)
|
||||
let (initialWidth, continueLayout) = fileLayout(context, presentationData, message, associatedData, chatLocation, attributes, isPinned, forcedIsEdited, file, automaticDownload, incoming, isRecentActions, forcedResourceStatus, dateAndStatusType, messageSelection, constrainedSize)
|
||||
|
||||
return (initialWidth, { constrainedSize in
|
||||
let (finalWidth, finalLayout) = continueLayout(constrainedSize)
|
||||
|
@ -448,7 +448,7 @@ final class ChatRecentActionsControllerNode: ViewControllerTracingNode {
|
||||
}, displayPollSolution: { _, _ in
|
||||
}, displayPsa: { _, _ in
|
||||
}, displayDiceTooltip: { _ in
|
||||
}, animateDiceSuccess: {
|
||||
}, animateDiceSuccess: { _ in
|
||||
}, greetingStickerNode: {
|
||||
return nil
|
||||
}, openPeerContextMenu: { _, _, _, _ in
|
||||
|
@ -141,7 +141,7 @@ private final class DrawingStickersScreenNode: ViewControllerTracingNode {
|
||||
}, displayPollSolution: { _, _ in
|
||||
}, displayPsa: { _, _ in
|
||||
}, displayDiceTooltip: { _ in
|
||||
}, animateDiceSuccess: {
|
||||
}, animateDiceSuccess: { _ in
|
||||
}, greetingStickerNode: {
|
||||
return nil
|
||||
}, openPeerContextMenu: { _, _, _, _ in
|
||||
|
@ -131,7 +131,7 @@ final class OverlayAudioPlayerControllerNode: ViewControllerTracingNode, UIGestu
|
||||
}, displayPollSolution: { _, _ in
|
||||
}, displayPsa: { _, _ in
|
||||
}, displayDiceTooltip: { _ in
|
||||
}, animateDiceSuccess: {
|
||||
}, animateDiceSuccess: { _ in
|
||||
}, greetingStickerNode: {
|
||||
return nil
|
||||
}, openPeerContextMenu: { _, _, _, _ in
|
||||
|
@ -1961,7 +1961,7 @@ private final class PeerInfoScreenNode: ViewControllerTracingNode, UIScrollViewD
|
||||
}, displayPollSolution: { _, _ in
|
||||
}, displayPsa: { _, _ in
|
||||
}, displayDiceTooltip: { _ in
|
||||
}, animateDiceSuccess: {
|
||||
}, animateDiceSuccess: { _ in
|
||||
}, greetingStickerNode: {
|
||||
return nil
|
||||
}, openPeerContextMenu: { _, _, _, _ in
|
||||
|
@ -1231,7 +1231,7 @@ public final class SharedAccountContextImpl: SharedAccountContext {
|
||||
}, displayPollSolution: { _, _ in
|
||||
}, displayPsa: { _, _ in
|
||||
}, displayDiceTooltip: { _ in
|
||||
}, animateDiceSuccess: {
|
||||
}, animateDiceSuccess: { _ in
|
||||
}, greetingStickerNode: {
|
||||
return nil
|
||||
}, openPeerContextMenu: { _, _, _, _ in
|
||||
|
@ -362,11 +362,13 @@ final class UndoOverlayControllerNode: ViewControllerTracingNode {
|
||||
}
|
||||
|
||||
if dice.emoji == "🎰" {
|
||||
let slotMachineNode = SlotMachineAnimationNode()
|
||||
let slotMachineNode = SlotMachineAnimationNode(size: CGSize(width: 42.0, height: 42.0))
|
||||
self.slotMachineNode = slotMachineNode
|
||||
|
||||
// slotMachineNode.setState(.rolling)
|
||||
// slotMachineNode.setState(.value(value, true))
|
||||
slotMachineNode.setState(.rolling)
|
||||
if let value = dice.value {
|
||||
slotMachineNode.setState(.value(value, true))
|
||||
}
|
||||
} else {
|
||||
let animatedStickerNode = AnimatedStickerNode()
|
||||
self.animatedStickerNode = animatedStickerNode
|
||||
@ -628,6 +630,8 @@ final class UndoOverlayControllerNode: ViewControllerTracingNode {
|
||||
if let animatedStickerNode = self.animatedStickerNode {
|
||||
animatedStickerNode.updateLayout(size: iconFrame.size)
|
||||
transition.updateFrame(node: animatedStickerNode, frame: iconFrame)
|
||||
} else if let slotMachineNode = self.slotMachineNode {
|
||||
transition.updateFrame(node: slotMachineNode, frame: iconFrame)
|
||||
}
|
||||
} else if let animatedStickerNode = self.animatedStickerNode {
|
||||
let iconSize = CGSize(width: 32.0, height: 32.0)
|
||||
|
Loading…
x
Reference in New Issue
Block a user