mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-06-16 05:55:20 +00:00
Various Fixes
This commit is contained in:
parent
8f5ba80cd3
commit
ccd30832cc
@ -159,6 +159,7 @@ private final class ContextControllerNode: ViewControllerTracingNode, UIScrollVi
|
||||
|
||||
private let hapticFeedback = HapticFeedback()
|
||||
|
||||
private var animatedIn = false
|
||||
private var isAnimatingOut = false
|
||||
|
||||
private let itemsDisposable = MetaDisposable()
|
||||
@ -479,6 +480,9 @@ private final class ContextControllerNode: ViewControllerTracingNode, UIScrollVi
|
||||
}
|
||||
|
||||
@objc private func dimNodeTapped() {
|
||||
guard self.animatedIn else {
|
||||
return
|
||||
}
|
||||
self.dismissedForCancel?()
|
||||
self.beginDismiss(.default)
|
||||
}
|
||||
@ -652,7 +656,9 @@ private final class ContextControllerNode: ViewControllerTracingNode, UIScrollVi
|
||||
|
||||
self.actionsContainerNode.layer.animateSpring(from: NSValue(cgPoint: CGPoint(x: localSourceFrame.center.x - self.actionsContainerNode.position.x, y: localSourceFrame.center.y - self.actionsContainerNode.position.y)), to: NSValue(cgPoint: CGPoint()), keyPath: "position", duration: springDuration, initialVelocity: 0.0, damping: springDamping, additive: true)
|
||||
let contentContainerOffset = CGPoint(x: localContentSourceFrame.center.x - self.contentContainerNode.frame.center.x, y: localContentSourceFrame.center.y - self.contentContainerNode.frame.center.y)
|
||||
self.contentContainerNode.layer.animateSpring(from: NSValue(cgPoint: contentContainerOffset), to: NSValue(cgPoint: CGPoint()), keyPath: "position", duration: springDuration, initialVelocity: 0.0, damping: springDamping, additive: true)
|
||||
self.contentContainerNode.layer.animateSpring(from: NSValue(cgPoint: contentContainerOffset), to: NSValue(cgPoint: CGPoint()), keyPath: "position", duration: springDuration, initialVelocity: 0.0, damping: springDamping, additive: true, completion: { [weak self] _ in
|
||||
self?.animatedIn = true
|
||||
})
|
||||
}
|
||||
case let .extracted(extracted, keepInPlace):
|
||||
let springDuration: Double = 0.42 * animationDurationFactor
|
||||
@ -692,6 +698,7 @@ private final class ContextControllerNode: ViewControllerTracingNode, UIScrollVi
|
||||
let contentContainerOffset = CGPoint(x: localContentSourceFrame.center.x - self.contentContainerNode.frame.center.x - contentParentNode.contentRect.minX, y: localContentSourceFrame.center.y - self.contentContainerNode.frame.center.y - contentParentNode.contentRect.minY)
|
||||
self.contentContainerNode.layer.animateSpring(from: NSValue(cgPoint: contentContainerOffset), to: NSValue(cgPoint: CGPoint()), keyPath: "position", duration: contentDuration, initialVelocity: 0.0, damping: springDamping, additive: true, completion: { [weak self] _ in
|
||||
self?.clippingNode.view.mask = nil
|
||||
self?.animatedIn = true
|
||||
})
|
||||
contentParentNode.applyAbsoluteOffsetSpring?(-contentContainerOffset.y, springDuration, springDamping)
|
||||
}
|
||||
@ -735,7 +742,9 @@ private final class ContextControllerNode: ViewControllerTracingNode, UIScrollVi
|
||||
}
|
||||
}
|
||||
self.actionsContainerNode.layer.animateSpring(from: NSValue(cgPoint: CGPoint(x: localSourceFrame.center.x - self.actionsContainerNode.position.x, y: localSourceFrame.center.y - self.actionsContainerNode.position.y)), to: NSValue(cgPoint: CGPoint()), keyPath: "position", duration: springDuration, initialVelocity: 0.0, damping: springDamping, additive: true)
|
||||
self.contentContainerNode.layer.animateSpring(from: NSValue(cgPoint: contentContainerOffset), to: NSValue(cgPoint: CGPoint()), keyPath: "position", duration: springDuration, initialVelocity: 0.0, damping: springDamping, additive: true)
|
||||
self.contentContainerNode.layer.animateSpring(from: NSValue(cgPoint: contentContainerOffset), to: NSValue(cgPoint: CGPoint()), keyPath: "position", duration: springDuration, initialVelocity: 0.0, damping: springDamping, additive: true, completion: { [weak self] _ in
|
||||
self?.animatedIn = true
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -5638,7 +5638,7 @@ public final class ChatControllerImpl: TelegramBaseController, ChatController, G
|
||||
}
|
||||
|
||||
let contextController = ContextController(account: strongSelf.context.account, presentationData: strongSelf.presentationData, source: .controller(ContextControllerContentSourceImpl(controller: chatController, sourceNode: sourceNode, passthroughTouches: true)), items: items, reactionItems: [])
|
||||
contextController.dismissedForCancel = { [weak self, weak chatController] in
|
||||
contextController.dismissedForCancel = { [weak chatController] in
|
||||
if let selectedMessageIds = (chatController as? ChatControllerImpl)?.selectedMessageIds {
|
||||
var forwardMessageIds = strongSelf.presentationInterfaceState.interfaceState.forwardMessageIds ?? []
|
||||
forwardMessageIds = forwardMessageIds.filter { selectedMessageIds.contains($0) }
|
||||
|
@ -726,7 +726,7 @@ public final class ChatHistoryListNode: ListView, ChatHistoryNode {
|
||||
scrollPosition = nil
|
||||
}
|
||||
|
||||
return (ChatHistoryViewUpdate.HistoryView(view: MessageHistoryView(tagMask: nil, namespaces: .all, entries: messages.reversed().map { MessageHistoryEntry(message: $0, isRead: false, location: nil, monthLocation: nil, attributes: MutableMessageHistoryEntryAttributes(authorIsContact: false)) }, holeEarlier: hasMore, holeLater: false, isLoading: false), type: .Generic(type: ViewUpdateType.Initial), scrollPosition: scrollPosition, flashIndicators: false, originalScrollPosition: nil, initialData: ChatHistoryCombinedInitialData(initialData: nil, buttonKeyboardMessage: nil, cachedData: nil, cachedDataMessages: nil, readStateData: nil), id: 0), version, nil)
|
||||
return (ChatHistoryViewUpdate.HistoryView(view: MessageHistoryView(tagMask: nil, namespaces: .all, entries: messages.reversed().map { MessageHistoryEntry(message: $0, isRead: false, location: nil, monthLocation: nil, attributes: MutableMessageHistoryEntryAttributes(authorIsContact: false)) }, holeEarlier: hasMore, holeLater: false, isLoading: false), type: .Generic(type: version > 0 ? ViewUpdateType.Generic : ViewUpdateType.Initial), scrollPosition: scrollPosition, flashIndicators: false, originalScrollPosition: nil, initialData: ChatHistoryCombinedInitialData(initialData: nil, buttonKeyboardMessage: nil, cachedData: nil, cachedDataMessages: nil, readStateData: nil), id: 0), version, nil)
|
||||
}
|
||||
} else {
|
||||
historyViewUpdate = self.chatHistoryLocationPromise.get()
|
||||
|
@ -1166,6 +1166,16 @@ class ChatMessageAnimatedStickerItemNode: ChatMessageItemView {
|
||||
strongSelf.forwardBackgroundNode = forwardBackgroundNode
|
||||
strongSelf.contextSourceNode.contentNode.addSubnode(forwardBackgroundNode)
|
||||
}
|
||||
} else if let forwardBackgroundNode = strongSelf.forwardBackgroundNode {
|
||||
if animation.isAnimated {
|
||||
strongSelf.forwardBackgroundNode = nil
|
||||
forwardBackgroundNode.layer.animateAlpha(from: 1.0, to: 0.0, duration: 0.1, removeOnCompletion: false, completion: { [weak forwardBackgroundNode] _ in
|
||||
forwardBackgroundNode?.removeFromSupernode()
|
||||
})
|
||||
} else {
|
||||
forwardBackgroundNode.removeFromSupernode()
|
||||
strongSelf.forwardBackgroundNode = nil
|
||||
}
|
||||
}
|
||||
|
||||
if let (forwardInfoSize, forwardInfoApply) = forwardInfoSizeApply {
|
||||
@ -1181,8 +1191,17 @@ class ChatMessageAnimatedStickerItemNode: ChatMessageItemView {
|
||||
forwardBackgroundNode.update(size: forwardBackgroundNode.bounds.size, cornerRadius: 8.0, transition: .immediate)
|
||||
}
|
||||
} else if let forwardInfoNode = strongSelf.forwardInfoNode {
|
||||
forwardInfoNode.removeFromSupernode()
|
||||
strongSelf.forwardInfoNode = nil
|
||||
if animation.isAnimated {
|
||||
if let forwardInfoNode = strongSelf.forwardInfoNode {
|
||||
strongSelf.forwardInfoNode = nil
|
||||
forwardInfoNode.layer.animateAlpha(from: 1.0, to: 0.0, duration: 0.1, removeOnCompletion: false, completion: { [weak forwardInfoNode] _ in
|
||||
forwardInfoNode?.removeFromSupernode()
|
||||
})
|
||||
}
|
||||
} else {
|
||||
forwardInfoNode.removeFromSupernode()
|
||||
strongSelf.forwardInfoNode = nil
|
||||
}
|
||||
}
|
||||
|
||||
if let actionButtonsSizeAndApply = actionButtonsSizeAndApply {
|
||||
|
@ -696,8 +696,15 @@ class ChatMessageInstantVideoItemNode: ChatMessageItemView, UIGestureRecognizerD
|
||||
strongSelf.contextSourceNode.contentNode.addSubnode(updatedForwardBackgroundNode)
|
||||
}
|
||||
} else if let forwardBackgroundNode = strongSelf.forwardBackgroundNode {
|
||||
forwardBackgroundNode.removeFromSupernode()
|
||||
strongSelf.forwardBackgroundNode = nil
|
||||
if animation.isAnimated {
|
||||
strongSelf.forwardBackgroundNode = nil
|
||||
forwardBackgroundNode.layer.animateAlpha(from: 1.0, to: 0.0, duration: 0.1, removeOnCompletion: false, completion: { [weak forwardBackgroundNode] _ in
|
||||
forwardBackgroundNode?.removeFromSupernode()
|
||||
})
|
||||
} else {
|
||||
forwardBackgroundNode.removeFromSupernode()
|
||||
strongSelf.forwardBackgroundNode = nil
|
||||
}
|
||||
}
|
||||
|
||||
if let (forwardInfoSize, forwardInfoApply) = forwardInfoSizeApply {
|
||||
@ -718,8 +725,17 @@ class ChatMessageInstantVideoItemNode: ChatMessageItemView, UIGestureRecognizerD
|
||||
strongSelf.forwardBackgroundNode?.frame = forwardBackgroundFrame
|
||||
strongSelf.forwardBackgroundNode?.update(size: forwardBackgroundFrame.size, cornerRadius: 8.0, transition: .immediate)
|
||||
} else if let forwardInfoNode = strongSelf.forwardInfoNode {
|
||||
forwardInfoNode.removeFromSupernode()
|
||||
strongSelf.forwardInfoNode = nil
|
||||
if animation.isAnimated {
|
||||
if let forwardInfoNode = strongSelf.forwardInfoNode {
|
||||
strongSelf.forwardInfoNode = nil
|
||||
forwardInfoNode.layer.animateAlpha(from: 1.0, to: 0.0, duration: 0.1, removeOnCompletion: false, completion: { [weak forwardInfoNode] _ in
|
||||
forwardInfoNode?.removeFromSupernode()
|
||||
})
|
||||
}
|
||||
} else {
|
||||
forwardInfoNode.removeFromSupernode()
|
||||
strongSelf.forwardInfoNode = nil
|
||||
}
|
||||
}
|
||||
|
||||
if let actionButtonsSizeAndApply = actionButtonsSizeAndApply {
|
||||
|
@ -854,6 +854,16 @@ class ChatMessageStickerItemNode: ChatMessageItemView {
|
||||
strongSelf.forwardBackgroundNode = forwardBackgroundNode
|
||||
strongSelf.contextSourceNode.contentNode.addSubnode(forwardBackgroundNode)
|
||||
}
|
||||
} else if let forwardBackgroundNode = strongSelf.forwardBackgroundNode {
|
||||
if animation.isAnimated {
|
||||
strongSelf.forwardBackgroundNode = nil
|
||||
forwardBackgroundNode.layer.animateAlpha(from: 1.0, to: 0.0, duration: 0.1, removeOnCompletion: false, completion: { [weak forwardBackgroundNode] _ in
|
||||
forwardBackgroundNode?.removeFromSupernode()
|
||||
})
|
||||
} else {
|
||||
forwardBackgroundNode.removeFromSupernode()
|
||||
strongSelf.forwardBackgroundNode = nil
|
||||
}
|
||||
}
|
||||
|
||||
if let (forwardInfoSize, forwardInfoApply) = forwardInfoSizeApply {
|
||||
@ -869,8 +879,17 @@ class ChatMessageStickerItemNode: ChatMessageItemView {
|
||||
forwardBackgroundNode.update(size: forwardBackgroundNode.bounds.size, cornerRadius: 8.0, transition: .immediate)
|
||||
}
|
||||
} else if let forwardInfoNode = strongSelf.forwardInfoNode {
|
||||
forwardInfoNode.removeFromSupernode()
|
||||
strongSelf.forwardInfoNode = nil
|
||||
if animation.isAnimated {
|
||||
if let forwardInfoNode = strongSelf.forwardInfoNode {
|
||||
strongSelf.forwardInfoNode = nil
|
||||
forwardInfoNode.layer.animateAlpha(from: 1.0, to: 0.0, duration: 0.1, removeOnCompletion: false, completion: { [weak forwardInfoNode] _ in
|
||||
forwardInfoNode?.removeFromSupernode()
|
||||
})
|
||||
}
|
||||
} else {
|
||||
forwardInfoNode.removeFromSupernode()
|
||||
strongSelf.forwardInfoNode = nil
|
||||
}
|
||||
}
|
||||
|
||||
if let actionButtonsSizeAndApply = actionButtonsSizeAndApply {
|
||||
|
@ -348,8 +348,14 @@ final class ForwardAccessoryPanelNode: AccessoryPanelNode {
|
||||
self.interfaceInteraction?.presentController(alertController, nil)
|
||||
}
|
||||
|
||||
private var previousTapTimestamp: Double?
|
||||
@objc func tapGesture(_ recognizer: UITapGestureRecognizer) {
|
||||
if case .ended = recognizer.state {
|
||||
let timestamp = CFAbsoluteTimeGetCurrent()
|
||||
if let previousTapTimestamp = self.previousTapTimestamp, previousTapTimestamp + 1.0 > timestamp {
|
||||
return
|
||||
}
|
||||
self.previousTapTimestamp = CFAbsoluteTimeGetCurrent()
|
||||
self.interfaceInteraction?.presentForwardOptions(self)
|
||||
Queue.mainQueue().after(1.5) {
|
||||
self.updateThemeAndStrings(theme: self.theme, strings: self.strings, forwardOptionsState: self.forwardOptionsState, force: true)
|
||||
|
@ -92,21 +92,22 @@ final class TrendingTopItemNode: ASDisplayNode {
|
||||
self.theme = theme
|
||||
self.listAppearance = listAppearance
|
||||
|
||||
let backgroundColor: UIColor
|
||||
let backgroundColor: UIColor?
|
||||
let foregroundColor: UIColor
|
||||
let shimmeringColor: UIColor
|
||||
if listAppearance {
|
||||
backgroundColor = theme.list.plainBackgroundColor
|
||||
foregroundColor = theme.list.itemPlainSeparatorColor.blitOver(backgroundColor, alpha: 0.3)
|
||||
backgroundColor = nil
|
||||
foregroundColor = theme.list.itemPlainSeparatorColor.blitOver(theme.list.plainBackgroundColor, alpha: 0.3)
|
||||
shimmeringColor = theme.list.itemBlocksBackgroundColor.withAlphaComponent(0.4)
|
||||
} else {
|
||||
backgroundColor = theme.chat.inputMediaPanel.stickersBackgroundColor.withAlphaComponent(1.0)
|
||||
foregroundColor = theme.chat.inputMediaPanel.stickersSectionTextColor.blitOver(backgroundColor, alpha: 0.15)
|
||||
let color = theme.chat.inputMediaPanel.stickersBackgroundColor.withAlphaComponent(1.0)
|
||||
backgroundColor = color
|
||||
foregroundColor = theme.chat.inputMediaPanel.stickersSectionTextColor.blitOver(color, alpha: 0.15)
|
||||
shimmeringColor = theme.list.itemBlocksBackgroundColor.withAlphaComponent(0.3)
|
||||
}
|
||||
|
||||
if let placeholderNode = self.placeholderNode, let file = self.file {
|
||||
placeholderNode.update(backgroundColor: backgroundColor, foregroundColor: foregroundColor, shimmeringColor: shimmeringColor, data: file.immediateThumbnailData, size: placeholderNode.frame.size)
|
||||
placeholderNode.update(backgroundColor: backgroundColor, foregroundColor: foregroundColor, shimmeringColor: shimmeringColor, data: file.immediateThumbnailData, size: self.itemSize ?? CGSize(width: 75.0, height: 75.0))
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user