From ac36f81827651ee38562ad7345a303d6f0b3ffaa Mon Sep 17 00:00:00 2001 From: Ilya Laktyushin Date: Mon, 25 Jul 2022 06:03:58 +0300 Subject: [PATCH] Various fixes --- .../Sources/StickerPackPreviewGridItem.swift | 9 +++++---- .../ChatTextInputMediaRecordingButton.swift | 14 ++++++++++---- 2 files changed, 15 insertions(+), 8 deletions(-) diff --git a/submodules/StickerPackPreviewUI/Sources/StickerPackPreviewGridItem.swift b/submodules/StickerPackPreviewUI/Sources/StickerPackPreviewGridItem.swift index 9c5f66cdef..e9805d04c4 100644 --- a/submodules/StickerPackPreviewUI/Sources/StickerPackPreviewGridItem.swift +++ b/submodules/StickerPackPreviewUI/Sources/StickerPackPreviewGridItem.swift @@ -192,7 +192,7 @@ final class StickerPackPreviewGridItemNode: GridItemNode { lockBackground.isUserInteractionEnabled = false lockIconNode = ASImageNode() lockIconNode.displaysAsynchronously = false - lockIconNode.image = generateTintedImage(image: UIImage(bundleImageName: "Chat/Stickers/Lock"), color: .white) + lockIconNode.image = generateTintedImage(image: UIImage(bundleImageName: "Chat List/PeerPremiumIcon"), color: .white) let lockTintView = UIView() lockTintView.backgroundColor = UIColor(rgb: 0x000000, alpha: 0.15) @@ -321,8 +321,8 @@ final class StickerPackPreviewGridItemNode: GridItemNode { } if let lockBackground = self.lockBackground, let lockTintView = self.lockTintView, let lockIconNode = self.lockIconNode { - let lockSize = CGSize(width: 30.0, height: 30.0) - let lockBackgroundFrame = CGRect(origin: CGPoint(x: floorToScreenPixels((bounds.width - lockSize.width) / 2.0), y: bounds.height - lockSize.height - 6.0), size: lockSize) + let lockSize = CGSize(width: 16.0, height: 16.0) + let lockBackgroundFrame = CGRect(origin: CGPoint(x: bounds.width - lockSize.width, y: bounds.height - lockSize.height), size: lockSize) lockBackground.frame = lockBackgroundFrame lockBackground.layer.cornerRadius = lockSize.width / 2.0 if #available(iOS 13.0, *) { @@ -330,7 +330,8 @@ final class StickerPackPreviewGridItemNode: GridItemNode { } lockTintView.frame = CGRect(origin: CGPoint(), size: lockBackgroundFrame.size) if let icon = lockIconNode.image { - lockIconNode.frame = CGRect(origin: CGPoint(x: lockBackgroundFrame.minX + floorToScreenPixels((lockBackgroundFrame.width - icon.size.width) / 2.0), y: lockBackgroundFrame.minY + floorToScreenPixels((lockBackgroundFrame.height - icon.size.height) / 2.0)), size: icon.size) + let iconSize = CGSize(width: icon.size.width - 4.0, height: icon.size.height - 4.0) + lockIconNode.frame = CGRect(origin: CGPoint(x: lockBackgroundFrame.minX + floorToScreenPixels((lockBackgroundFrame.width - iconSize.width) / 2.0), y: lockBackgroundFrame.minY + floorToScreenPixels((lockBackgroundFrame.height - iconSize.height) / 2.0)), size: iconSize) } } } diff --git a/submodules/TelegramUI/Sources/ChatTextInputMediaRecordingButton.swift b/submodules/TelegramUI/Sources/ChatTextInputMediaRecordingButton.swift index 1f82a3b5c3..62327618b4 100644 --- a/submodules/TelegramUI/Sources/ChatTextInputMediaRecordingButton.swift +++ b/submodules/TelegramUI/Sources/ChatTextInputMediaRecordingButton.swift @@ -497,8 +497,11 @@ final class ChatTextInputMediaRecordingButton: TGModernConversationInputMicButto micDecoration.isHidden = false micDecoration.startAnimating() - self.animationView.view?.layer.animateAlpha(from: 1.0, to: 0.0, duration: 0.15, removeOnCompletion: false) - self.animationView.view?.layer.animateScale(from: 1.0, to: 0.3, duration: 0.15, removeOnCompletion: false) + let transition = ContainedViewLayoutTransition.animated(duration: 0.15, curve: .easeInOut) + if let layer = self.animationView.view?.layer { + transition.updateAlpha(layer: layer, alpha: 0.0) + transition.updateTransformScale(layer: layer, scale: 0.3) + } } override func animateOut(_ toSmallSize: Bool) { @@ -510,8 +513,11 @@ final class ChatTextInputMediaRecordingButton: TGModernConversationInputMicButto micDecoration.layer.animateAlpha(from: 1.0, to: 0.0, duration: 0.03, delay: 0.15, removeOnCompletion: false) } else { micDecoration.layer.animateAlpha(from: 1.0, to: 0.0, duration: 0.18, removeOnCompletion: false) - self.animationView.view?.layer.animateAlpha(from: 0.0, to: 1.0, duration: 0.15, removeOnCompletion: false) - self.animationView.view?.layer.animateScale(from: 0.3, to: 1.0, duration: 0.15, removeOnCompletion: false) + let transition = ContainedViewLayoutTransition.animated(duration: 0.15, curve: .easeInOut) + if let layer = self.animationView.view?.layer { + transition.updateAlpha(layer: layer, alpha: 1.0) + transition.updateTransformScale(layer: layer, scale: 1.0) + } } }