Various fixes

This commit is contained in:
Ilya Laktyushin 2023-01-11 20:02:09 +04:00
parent 09980ea42b
commit 80866b9871
4 changed files with 17 additions and 48 deletions

View File

@ -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 {

View File

@ -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 {

View File

@ -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

View File

@ -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))) {