From 4cb9136b46886981e7fcc577217cfcab7269c80e Mon Sep 17 00:00:00 2001 From: Ilya Laktyushin Date: Wed, 29 Mar 2023 13:34:23 +0400 Subject: [PATCH] Various fixes --- .../Sources/PremiumIntroScreen.swift | 38 ++++++++++--------- .../Sources/StickerShimmerEffectNode.swift | 2 +- .../ChatMessageDateAndStatusNode.swift | 30 +-------------- 3 files changed, 23 insertions(+), 47 deletions(-) diff --git a/submodules/PremiumUI/Sources/PremiumIntroScreen.swift b/submodules/PremiumUI/Sources/PremiumIntroScreen.swift index 4fbb8215e0..9491031db5 100644 --- a/submodules/PremiumUI/Sources/PremiumIntroScreen.swift +++ b/submodules/PremiumUI/Sources/PremiumIntroScreen.swift @@ -2360,26 +2360,12 @@ private final class PremiumIntroScreenComponent: CombinedComponent { availableSize: context.availableSize, transition: context.transition ) - - let textColor = environment.theme.list.itemPrimaryTextColor - let accentColor: UIColor - if case .emojiStatus = context.component.source { - accentColor = environment.theme.list.itemAccentColor - } else { - accentColor = UIColor(rgb: 0x597cf5) - } - - let textFont = Font.bold(18.0) - let boldTextFont = Font.bold(18.0) - - let markdownAttributes = MarkdownAttributes(body: MarkdownAttributeSet(font: textFont, textColor: textColor), bold: MarkdownAttributeSet(font: boldTextFont, textColor: textColor), link: MarkdownAttributeSet(font: textFont, textColor: accentColor), linkAttribute: { _ in - return nil - }) - + var loadedEmojiPack: LoadedStickerPack? var highlightableLinks = false let secondaryTitleText: String - if let otherPeerName = state.otherPeerName { + var isAnonymous = false + if var otherPeerName = state.otherPeerName { if case let .emojiStatus(_, _, file, maybeEmojiPack) = context.component.source, let emojiPack = maybeEmojiPack, case let .result(info, _, _) = emojiPack { loadedEmojiPack = maybeEmojiPack highlightableLinks = true @@ -2411,6 +2397,10 @@ private final class PremiumIntroScreenComponent: CombinedComponent { secondaryTitleText = "" } } else { + if fromPeerId.namespace == Namespaces.Peer.CloudUser && fromPeerId.id._internalGetInt64Value() == 777000 { + isAnonymous = true + otherPeerName = environment.strings.Premium_GiftedTitle_Someone + } if duration == 12 { secondaryTitleText = environment.strings.Premium_GiftedTitle_12Month(otherPeerName).string } else if duration == 6 { @@ -2428,6 +2418,20 @@ private final class PremiumIntroScreenComponent: CombinedComponent { secondaryTitleText = "" } + let textColor = environment.theme.list.itemPrimaryTextColor + let accentColor: UIColor + if case .emojiStatus = context.component.source { + accentColor = environment.theme.list.itemAccentColor + } else { + accentColor = UIColor(rgb: 0x597cf5) + } + + let textFont = Font.bold(18.0) + let boldTextFont = Font.bold(18.0) + let markdownAttributes = MarkdownAttributes(body: MarkdownAttributeSet(font: textFont, textColor: textColor), bold: MarkdownAttributeSet(font: boldTextFont, textColor: textColor), link: MarkdownAttributeSet(font: textFont, textColor: isAnonymous ? textColor : accentColor), linkAttribute: { _ in + return nil + }) + let secondaryAttributedText = NSMutableAttributedString(attributedString: parseMarkdownIntoAttributedString(secondaryTitleText, attributes: markdownAttributes)) if let emojiFile = state.emojiFile { let range = (secondaryAttributedText.string as NSString).range(of: "#") diff --git a/submodules/ShimmerEffect/Sources/StickerShimmerEffectNode.swift b/submodules/ShimmerEffect/Sources/StickerShimmerEffectNode.swift index aa094d58ea..a9e45c3f70 100644 --- a/submodules/ShimmerEffect/Sources/StickerShimmerEffectNode.swift +++ b/submodules/ShimmerEffect/Sources/StickerShimmerEffectNode.swift @@ -114,7 +114,7 @@ public class StickerShimmerEffectNode: ASDisplayNode { self.currentSize = size self.backgroundNode.backgroundColor = foregroundColor - self.backgroundNode.isHidden = true//!enableEffect + //self.backgroundNode.isHidden = true//!enableEffect if enableEffect { self.effectNode.update(backgroundColor: backgroundColor == nil ? .clear : foregroundColor, foregroundColor: shimmeringColor, horizontal: true, effectSize: nil, globalTimeOffset: true, duration: nil) diff --git a/submodules/TelegramUI/Sources/ChatMessageDateAndStatusNode.swift b/submodules/TelegramUI/Sources/ChatMessageDateAndStatusNode.swift index d89b74c366..45855f26e9 100644 --- a/submodules/TelegramUI/Sources/ChatMessageDateAndStatusNode.swift +++ b/submodules/TelegramUI/Sources/ChatMessageDateAndStatusNode.swift @@ -1366,33 +1366,5 @@ class ChatMessageDateAndStatusNode: ASDisplayNode { } func shouldDisplayInlineDateReactions(message: Message, isPremium: Bool, forceInline: Bool) -> Bool { - if forceInline { - return true - } - - if message.id.peerId.namespace == Namespaces.Peer.CloudUser || message.id.peerId.namespace == Namespaces.Peer.SecretChat { - if let chatPeer = message.peers[message.id.peerId] as? TelegramUser, chatPeer.isPremium { - return false - } - if let author = message.author as? TelegramUser, author.isPremium { - return false - } - if isPremium { - return false - } - - if let effectiveReactions = message.effectiveReactions { - if effectiveReactions.count > 1 { - return false - } - for reaction in effectiveReactions { - if case .custom = reaction.value { - return false - } - } - } - - return true - } - return false + return forceInline }