mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-06-16 05:55:20 +00:00
Adjust stars animation
This commit is contained in:
parent
ea476138b1
commit
03ee1379b2
@ -2622,6 +2622,8 @@ public final class ReactionContextNode: ASDisplayNode, ASScrollViewDelegate {
|
||||
}
|
||||
}
|
||||
|
||||
foundItemNode?.animateHideEffects()
|
||||
|
||||
if let customReactionSource = self.customReactionSource {
|
||||
let itemNode = ReactionNode(context: self.context, theme: self.presentationData.theme, item: customReactionSource.item, icon: .none, animationCache: self.animationCache, animationRenderer: self.animationRenderer, loopIdle: false, isLocked: false, useDirectRendering: false)
|
||||
if let contents = customReactionSource.layer.contents {
|
||||
@ -2673,7 +2675,7 @@ public final class ReactionContextNode: ASDisplayNode, ASScrollViewDelegate {
|
||||
if case .builtin = itemNode.item.reaction.rawValue {
|
||||
selfTargetBounds = selfTargetBounds.insetBy(dx: -selfTargetBounds.width * 0.5, dy: -selfTargetBounds.height * 0.5)
|
||||
} else if case .stars = itemNode.item.reaction.rawValue {
|
||||
selfTargetBounds = selfTargetBounds.insetBy(dx: selfTargetBounds.width * 0.0, dy: selfTargetBounds.height * 0.0)
|
||||
selfTargetBounds = selfTargetBounds.insetBy(dx: -selfTargetBounds.width * 0.13, dy: -selfTargetBounds.height * 0.13).offsetBy(dx: -0.5, dy: -0.5)
|
||||
}
|
||||
|
||||
let selfTargetRect = self.view.convert(selfTargetBounds, from: targetView)
|
||||
@ -2905,7 +2907,14 @@ public final class ReactionContextNode: ASDisplayNode, ASScrollViewDelegate {
|
||||
})
|
||||
|
||||
if !switchToInlineImmediately {
|
||||
DispatchQueue.main.asyncAfter(deadline: DispatchTime.now() + min(5.0, 2.0 * UIView.animationDurationFactor()), execute: {
|
||||
let maxDuration: Double
|
||||
if case .stars = value {
|
||||
maxDuration = 3.0
|
||||
} else {
|
||||
maxDuration = 2.0
|
||||
}
|
||||
|
||||
DispatchQueue.main.asyncAfter(deadline: DispatchTime.now() + min(5.0, maxDuration * UIView.animationDurationFactor()), execute: {
|
||||
if self.didTriggerExpandedReaction {
|
||||
self.animateFromItemNodeToReaction(itemNode: itemNode, targetView: targetView, hideNode: hideNode, completion: { [weak self] in
|
||||
if let strongSelf = self, strongSelf.didTriggerExpandedReaction, let addStandaloneReactionAnimation = addStandaloneReactionAnimation {
|
||||
@ -3986,8 +3995,6 @@ public final class StandaloneReactionAnimation: ASDisplayNode {
|
||||
starView.isHidden = true
|
||||
} else {
|
||||
targetView.updateIsAnimationHidden(isAnimationHidden: true, transition: .immediate)
|
||||
//TODO:release
|
||||
//targetView.addSubnode(itemNode)
|
||||
}
|
||||
} else if let targetView = targetView as? UIImageView {
|
||||
starView.isHidden = true
|
||||
|
@ -296,6 +296,12 @@ public final class ReactionNode: ASDisplayNode, ReactionItemNode {
|
||||
self.customContentsNode?.contents = contents
|
||||
}
|
||||
|
||||
public func animateHideEffects() {
|
||||
if let starsEffectLayer = self.starsEffectLayer {
|
||||
starsEffectLayer.animateAlpha(from: 1.0, to: 0.0, duration: 0.2, removeOnCompletion: false)
|
||||
}
|
||||
}
|
||||
|
||||
public func updateLayout(size: CGSize, isExpanded: Bool, largeExpanded: Bool, isPreviewing: Bool, transition: ContainedViewLayoutTransition) {
|
||||
let intrinsicSize = size
|
||||
|
||||
|
@ -1550,7 +1550,6 @@ public class ChatMessageBubbleItemNode: ChatMessageItemView, ChatMessagePreviewI
|
||||
}
|
||||
}
|
||||
|
||||
//TODO:release
|
||||
if let channel = firstMessage.peers[firstMessage.id.peerId] as? TelegramChannel, case let .broadcast(info) = channel.info, firstMessage.author?.id != channel.id {
|
||||
if info.flags.contains(.messagesShouldHaveProfiles) {
|
||||
var allowAuthor = incoming
|
||||
|
@ -127,7 +127,6 @@ public func stringForMessageTimestampStatus(accountPeerId: PeerId, message: Mess
|
||||
if let author = message.author as? TelegramUser {
|
||||
if let peer = message.peers[message.id.peerId] as? TelegramChannel, case .broadcast = peer.info {
|
||||
if let channel = message.peers[message.id.peerId] as? TelegramChannel, case let .broadcast(info) = channel.info, message.author?.id != channel.id, info.flags.contains(.messagesShouldHaveProfiles) {
|
||||
//TODO:release
|
||||
} else {
|
||||
authorTitle = EnginePeer(author).displayTitle(strings: strings, displayOrder: nameDisplayOrder)
|
||||
}
|
||||
@ -137,7 +136,6 @@ public func stringForMessageTimestampStatus(accountPeerId: PeerId, message: Mess
|
||||
} else {
|
||||
if let peer = message.peers[message.id.peerId] as? TelegramChannel, case .broadcast = peer.info {
|
||||
if let channel = message.peers[message.id.peerId] as? TelegramChannel, case let .broadcast(info) = channel.info, message.author?.id != channel.id, info.flags.contains(.messagesShouldHaveProfiles) {
|
||||
//TODO:release
|
||||
} else {
|
||||
for attribute in message.attributes {
|
||||
if let attribute = attribute as? AuthorSignatureMessageAttribute {
|
||||
|
@ -345,7 +345,6 @@ public final class ChatMessageItemImpl: ChatMessageItem, CustomStringConvertible
|
||||
if !isBroadcastChannel {
|
||||
hasAvatar = true
|
||||
} else if let channel = message.peers[message.id.peerId] as? TelegramChannel, case let .broadcast(info) = channel.info, message.author?.id != channel.id {
|
||||
//TODO:release
|
||||
if info.flags.contains(.messagesShouldHaveProfiles) {
|
||||
hasAvatar = true
|
||||
effectiveAuthor = message.author
|
||||
|
Loading…
x
Reference in New Issue
Block a user