Various fixes

This commit is contained in:
Ilya Laktyushin 2023-03-29 13:34:23 +04:00
parent 1b8b4562ba
commit 4cb9136b46
3 changed files with 23 additions and 47 deletions

View File

@ -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: "#")

View File

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

View File

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