diff --git a/submodules/PremiumUI/Sources/PhoneDemoComponent.swift b/submodules/PremiumUI/Sources/PhoneDemoComponent.swift index 67d014e552..d50d65c23b 100644 --- a/submodules/PremiumUI/Sources/PhoneDemoComponent.swift +++ b/submodules/PremiumUI/Sources/PhoneDemoComponent.swift @@ -141,7 +141,7 @@ private final class PhoneView: UIView { self.frontShimmerView.mask = self.shimmerMaskView self.frontShimmerView.addSubview(self.shimmerEffectView) - self.backShimmerEffectView.update(backgroundColor: .clear, foregroundColor: UIColor.white.withAlphaComponent(0.35), gradientSize: 60.0, globalTimeOffset: true, duration: 4.0, horizontal: true) + self.backShimmerEffectView.update(backgroundColor: .clear, foregroundColor: UIColor.white.withAlphaComponent(0.45), gradientSize: 32.0, globalTimeOffset: true, duration: 4.0, horizontal: true) self.backShimmerEffectView.layer.compositingFilter = "overlayBlendMode" self.shimmerEffectView.update(backgroundColor: .clear, foregroundColor: UIColor.white.withAlphaComponent(0.5), gradientSize: 16.0, globalTimeOffset: true, duration: 4.0, horizontal: true) @@ -280,8 +280,8 @@ private final class PhoneView: UIView { self.shimmerMaskView.frame = phoneBounds self.shimmerBorderView.frame = phoneBounds - self.backShimmerEffectView.updateAbsoluteRect(CGRect(origin: CGPoint(x: phoneBounds.width * 12.0, y: 0.0), size: phoneBounds.size), within: CGSize(width: phoneBounds.width * 25.0, height: phoneBounds.height)) - self.shimmerEffectView.updateAbsoluteRect(CGRect(origin: CGPoint(x: phoneBounds.width * 12.0, y: 0.0), size: phoneBounds.size), within: CGSize(width: phoneBounds.width * 25.0, height: phoneBounds.height)) + self.backShimmerEffectView.updateAbsoluteRect(CGRect(origin: CGPoint(x: phoneBounds.width * 8.0, y: 0.0), size: phoneBounds.size), within: CGSize(width: phoneBounds.width * 17.0, height: phoneBounds.height)) + self.shimmerEffectView.updateAbsoluteRect(CGRect(origin: CGPoint(x: phoneBounds.width * 8.0, y: 0.0), size: phoneBounds.size), within: CGSize(width: phoneBounds.width * 17.0, height: phoneBounds.height)) let notchHeight: CGFloat = 20.0 if let starImage = self.shimmerStarView.image { diff --git a/submodules/TelegramUI/Sources/ChatHistoryNavigationButtonNode.swift b/submodules/TelegramUI/Sources/ChatHistoryNavigationButtonNode.swift index 98ab11bdc2..0c87bc5366 100644 --- a/submodules/TelegramUI/Sources/ChatHistoryNavigationButtonNode.swift +++ b/submodules/TelegramUI/Sources/ChatHistoryNavigationButtonNode.swift @@ -183,7 +183,12 @@ class ChatHistoryNavigationButtonNode: ContextControllerSourceNode { let badgeSize = self.badgeTextNode.updateLayout(size: CGSize(width: 200.0, height: 100.0), animated: true) let backgroundSize = CGSize(width: self.badge.count == 1 ? 18.0 : max(18.0, badgeSize.width + 10.0 + 1.0), height: 18.0) let backgroundFrame = CGRect(origin: CGPoint(x: floor((38.0 - backgroundSize.width) / 2.0), y: -9.0), size: backgroundSize) - self.badgeBackgroundNode.frame = backgroundFrame + if backgroundFrame.width < self.badgeBackgroundNode.frame.width { + self.badgeBackgroundNode.layer.animateFrame(from: self.badgeBackgroundNode.frame, to: backgroundFrame, duration: 0.2) + self.badgeBackgroundNode.frame = backgroundFrame + } else { + self.badgeBackgroundNode.frame = backgroundFrame + } self.badgeTextNode.frame = CGRect(origin: CGPoint(x: floorToScreenPixels((backgroundFrame.width - badgeSize.width) / 2.0), y: 1.0), size: badgeSize) if self.badgeBackgroundNode.alpha < 1.0 { diff --git a/submodules/TelegramUI/Sources/ChatMessageAttachedContentNode.swift b/submodules/TelegramUI/Sources/ChatMessageAttachedContentNode.swift index 38cfd555d9..061db0c346 100644 --- a/submodules/TelegramUI/Sources/ChatMessageAttachedContentNode.swift +++ b/submodules/TelegramUI/Sources/ChatMessageAttachedContentNode.swift @@ -85,7 +85,13 @@ final class ChatMessageAttachedContentButtonNode: HighlightTrackingButtonNode { strongSelf.iconNode.image = strongSelf.highlightedIconImage strongSelf.textNode.isHidden = true strongSelf.highlightedTextNode.isHidden = false + + let scale = (strongSelf.bounds.width - 10.0) / strongSelf.bounds.width + strongSelf.layer.animateScale(from: 1.0, to: scale, duration: 0.15, removeOnCompletion: false) } else { + if let presentationLayer = strongSelf.layer.presentation() { + strongSelf.layer.animateScale(from: CGFloat((presentationLayer.value(forKeyPath: "transform.scale.y") as? NSNumber)?.floatValue ?? 1.0), to: 1.0, duration: 0.25, removeOnCompletion: false) + } UIView.transition(with: strongSelf.view, duration: 0.2, options: [.transitionCrossDissolve], animations: { strongSelf.backgroundNode.image = strongSelf.regularImage strongSelf.iconNode.image = strongSelf.regularIconImage diff --git a/submodules/TelegramUI/Sources/ChatMessageInteractiveMediaNode.swift b/submodules/TelegramUI/Sources/ChatMessageInteractiveMediaNode.swift index 3f0e119192..1d098e317e 100644 --- a/submodules/TelegramUI/Sources/ChatMessageInteractiveMediaNode.swift +++ b/submodules/TelegramUI/Sources/ChatMessageInteractiveMediaNode.swift @@ -362,9 +362,7 @@ final class ChatMessageInteractiveMediaNode: ASDisplayNode, GalleryItemTransitio private var badgeNode: ChatMessageInteractiveMediaBadge? private var extendedMediaOverlayNode: ExtendedMediaOverlayNode? - - //private var tapRecognizer: TapLongTapOrDoubleTapGestureRecognizer? - + private var context: AccountContext? private var message: Message? private var attributes: ChatMessageEntryAttributes? @@ -548,18 +546,7 @@ final class ChatMessageInteractiveMediaNode: ASDisplayNode, GalleryItemTransitio override func didLoad() { super.didLoad() - let recognizer = UITapGestureRecognizer(target: self, action: #selector(self.imageTap(_:))) - /*recognizer.tapActionAtPoint = { [weak self] point in - guard let strongSelf = self else { - return .fail - } - if !strongSelf.imageNode.bounds.contains(point) { - return .fail - } - return .waitForDoubleTap - }*/ - self.imageNode.view.addGestureRecognizer(recognizer) - //self.tapRecognizer = recognizer + self.imageNode.view.addGestureRecognizer(UITapGestureRecognizer(target: self, action: #selector(self.imageTap(_:)))) } private func progressPressed(canActivate: Bool) { @@ -645,35 +632,6 @@ final class ChatMessageInteractiveMediaNode: ASDisplayNode, GalleryItemTransitio } } } - /*if case .ended = recognizer.state { - if let (gesture, point) = recognizer.lastRecognizedGestureAndLocation, let message = self.message { - if case .doubleTap = gesture { - if canAddMessageReactions(message: message) { - self.updateMessageReaction?(message, .default) - } - } else { - if let _ = self.attributes?.updatingMedia { - if let statusNode = self.statusNode, statusNode.frame.contains(point) { - self.progressPressed(canActivate: true) - } - } else if let fetchStatus = self.fetchStatus, case .Local = fetchStatus { - var videoContentMatch = true - if let content = self.videoContent, case let .message(stableId, mediaId) = content.nativeId { - videoContentMatch = self.message?.stableId == stableId && self.media?.id == mediaId - } - self.activateLocalContent((self.automaticPlayback ?? false) && videoContentMatch ? .automaticPlayback : .default) - } else { - if let message = self.message, message.flags.isSending { - if let statusNode = self.statusNode, statusNode.frame.contains(point) { - self.progressPressed(canActivate: true) - } - } else { - self.progressPressed(canActivate: true) - } - } - } - } - }*/ } func asyncLayout() -> (_ context: AccountContext, _ presentationData: ChatPresentationData, _ dateTimeFormat: PresentationDateTimeFormat, _ message: Message, _ associatedData: ChatMessageItemAssociatedData, _ attributes: ChatMessageEntryAttributes, _ media: Media, _ dateAndStatus: ChatMessageDateAndStatus?, _ automaticDownload: InteractiveMediaNodeAutodownloadMode, _ peerType: MediaAutoDownloadPeerType, _ sizeCalculation: InteractiveMediaNodeSizeCalculation, _ layoutConstants: ChatMessageItemLayoutConstants, _ contentMode: InteractiveMediaNodeContentMode, _ presentationContext: ChatPresentationContext) -> (CGSize, CGFloat, (CGSize, Bool, Bool, ImageCorners) -> (CGFloat, (CGFloat) -> (CGSize, (ListViewItemUpdateAnimation, Bool) -> Void))) {