From 17d3a1eb5385fedf1b1651557c1fa8837bd7aca8 Mon Sep 17 00:00:00 2001 From: Ali <> Date: Fri, 17 Apr 2020 22:22:59 +0400 Subject: [PATCH] Improve stickers --- .../Sources/StickerPaneSearchStickerItem.swift | 2 +- submodules/TooltipUI/Sources/TooltipScreen.swift | 15 ++++++++++++++- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/submodules/TelegramUI/Sources/StickerPaneSearchStickerItem.swift b/submodules/TelegramUI/Sources/StickerPaneSearchStickerItem.swift index abcd308ed2..3d729acda4 100644 --- a/submodules/TelegramUI/Sources/StickerPaneSearchStickerItem.swift +++ b/submodules/TelegramUI/Sources/StickerPaneSearchStickerItem.swift @@ -162,7 +162,7 @@ final class StickerPaneSearchStickerItemNode: GridItemNode { let animationNode = AnimatedStickerNode() animationNode.view.addGestureRecognizer(UITapGestureRecognizer(target: self, action: #selector(self.imageNodeTap(_:)))) self.animationNode = animationNode - self.addSubnode(animationNode) + self.insertSubnode(animationNode, belowSubnode: self.textNode) } let dimensions = stickerItem.file.dimensions ?? PixelDimensions(width: 512, height: 512) let fittedDimensions = dimensions.cgSize.aspectFitted(CGSize(width: 160.0, height: 160.0)) diff --git a/submodules/TooltipUI/Sources/TooltipScreen.swift b/submodules/TooltipUI/Sources/TooltipScreen.swift index 2321ded3c7..0a8a517d9d 100644 --- a/submodules/TooltipUI/Sources/TooltipScreen.swift +++ b/submodules/TooltipUI/Sources/TooltipScreen.swift @@ -32,6 +32,7 @@ private final class TooltipScreenNode: ViewControllerTracingNode { private let scrollingContainer: ASDisplayNode private let containerNode: ASDisplayNode private let backgroundNode: ASImageNode + private var effectView: UIView? private let arrowNode: ASImageNode private let arrowContainer: ASDisplayNode private let animatedStickerNode: AnimatedStickerNode @@ -55,6 +56,11 @@ private final class TooltipScreenNode: ViewControllerTracingNode { self.backgroundNode = ASImageNode() self.backgroundNode.image = generateAdjustedStretchableFilledCircleImage(diameter: 15.0, color: fillColor) + if case .top = location { + self.effectView = UIVisualEffectView(effect: UIBlurEffect(style: .dark)) + self.containerNode.clipsToBounds = true + self.containerNode.cornerRadius = 9.0 + } self.arrowNode = ASImageNode() let arrowSize = CGSize(width: 29.0, height: 10.0) @@ -94,7 +100,11 @@ private final class TooltipScreenNode: ViewControllerTracingNode { self.arrowContainer.addSubnode(self.arrowNode) self.backgroundNode.addSubnode(self.arrowContainer) - self.containerNode.addSubnode(self.backgroundNode) + if let effectView = self.effectView { + self.containerNode.view.addSubview(effectView) + } else { + self.containerNode.addSubnode(self.backgroundNode) + } self.containerNode.addSubnode(self.textNode) self.containerNode.addSubnode(self.animatedStickerNode) self.scrollingContainer.addSubnode(self.containerNode) @@ -211,6 +221,9 @@ private final class TooltipScreenNode: ViewControllerTracingNode { transition.updateFrame(node: self.containerNode, frame: backgroundFrame) transition.updateFrame(node: self.backgroundNode, frame: CGRect(origin: CGPoint(), size: backgroundFrame.size)) + if let effectView = self.effectView { + transition.updateFrame(view: effectView, frame: CGRect(origin: CGPoint(), size: backgroundFrame.size)) + } if let image = self.arrowNode.image, case let .point(rect) = self.location { let arrowSize = image.size let arrowCenterX = rect.midX