mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-12-22 22:25:57 +00:00
Various Improvements
This commit is contained in:
@@ -42,7 +42,7 @@ protocol ReactionItemNode: ASDisplayNode {
|
||||
func updateLayout(size: CGSize, isExpanded: Bool, largeExpanded: Bool, isPreviewing: Bool, transition: ContainedViewLayoutTransition)
|
||||
}
|
||||
|
||||
final class ReactionNode: ASDisplayNode, ReactionItemNode {
|
||||
public final class ReactionNode: ASDisplayNode, ReactionItemNode {
|
||||
let context: AccountContext
|
||||
let item: ReactionItem
|
||||
|
||||
@@ -64,14 +64,16 @@ final class ReactionNode: ASDisplayNode, ReactionItemNode {
|
||||
|
||||
var expandedAnimationDidBegin: (() -> Void)?
|
||||
|
||||
init(context: AccountContext, theme: PresentationTheme, item: ReactionItem) {
|
||||
public init(context: AccountContext, theme: PresentationTheme, item: ReactionItem, hasAppearAnimation: Bool = true) {
|
||||
self.context = context
|
||||
self.item = item
|
||||
|
||||
self.staticAnimationNode = AnimatedStickerNode()
|
||||
self.staticAnimationNode.isHidden = true
|
||||
|
||||
self.animateInAnimationNode = AnimatedStickerNode()
|
||||
|
||||
if hasAppearAnimation {
|
||||
self.staticAnimationNode.isHidden = true
|
||||
self.animateInAnimationNode = AnimatedStickerNode()
|
||||
}
|
||||
|
||||
super.init()
|
||||
|
||||
@@ -111,7 +113,7 @@ final class ReactionNode: ASDisplayNode, ReactionItemNode {
|
||||
}
|
||||
}
|
||||
|
||||
func updateLayout(size: CGSize, isExpanded: Bool, largeExpanded: Bool, isPreviewing: Bool, transition: ContainedViewLayoutTransition) {
|
||||
public func updateLayout(size: CGSize, isExpanded: Bool, largeExpanded: Bool, isPreviewing: Bool, transition: ContainedViewLayoutTransition) {
|
||||
let intrinsicSize = size
|
||||
|
||||
let animationSize = self.item.stillAnimation.dimensions?.cgSize ?? CGSize(width: 512.0, height: 512.0)
|
||||
@@ -300,11 +302,32 @@ final class ReactionNode: ASDisplayNode, ReactionItemNode {
|
||||
final class PremiumReactionsNode: ASDisplayNode, ReactionItemNode {
|
||||
var isExtracted: Bool = false
|
||||
|
||||
let imageNode: ASImageNode
|
||||
|
||||
override init() {
|
||||
self.imageNode = ASImageNode()
|
||||
self.imageNode.contentMode = .center
|
||||
self.imageNode.displaysAsynchronously = false
|
||||
self.imageNode.image = UIImage(bundleImageName: "Premium/ReactionIcon")
|
||||
self.imageNode.isUserInteractionEnabled = false
|
||||
self.imageNode.alpha = 0.5
|
||||
|
||||
super.init()
|
||||
|
||||
self.addSubnode(self.imageNode)
|
||||
}
|
||||
|
||||
override func didLoad() {
|
||||
super.didLoad()
|
||||
|
||||
self.imageNode.layer.compositingFilter = "softLightBlendMode"
|
||||
}
|
||||
|
||||
func appear(animated: Bool) {
|
||||
|
||||
}
|
||||
|
||||
func updateLayout(size: CGSize, isExpanded: Bool, largeExpanded: Bool, isPreviewing: Bool, transition: ContainedViewLayoutTransition) {
|
||||
|
||||
self.imageNode.frame = CGRect(origin: CGPoint(), size: size)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user