Merge commit 'b6f8cce7ea8477e1ed97b8af6db90b84c7809cd4'

This commit is contained in:
Isaac
2025-01-14 11:52:37 +08:00
141 changed files with 4465 additions and 1606 deletions

View File

@@ -191,6 +191,14 @@ class ChatListSearchEmptyFooterItemNode: ListViewItemNode {
self.contentNode.frame = contentFrame
}
override func hitTest(_ point: CGPoint, with event: UIEvent?) -> UIView? {
let result = super.hitTest(point, with: event)
if let contentResult = self.contentNode.view.hitTest(self.view.convert(point, to: self.contentNode.view), with: event), contentResult === self.searchAllMessagesButton.view {
return contentResult
}
return result
}
func asyncLayout() -> (_ item: ChatListSearchEmptyFooterItem, _ params: ListViewItemLayoutParams) -> (ListViewItemNodeLayout, () -> Void) {
let makeTitleNodeLayout = TextNode.asyncLayout(self.titleNode)
let makeTextNodeLayout = TextNode.asyncLayout(self.textNode)

View File

@@ -2145,6 +2145,7 @@ public class ChatListItemNode: ItemListRevealOptionsItemNode {
var currentCredibilityIconContent: EmojiStatusComponent.Content?
var currentVerifiedIconContent: EmojiStatusComponent.Content?
var currentStatusIconContent: EmojiStatusComponent.Content?
var currentStatusIconParticleColor: UIColor?
var currentSecretIconImage: UIImage?
var currentForwardedIcon: UIImage?
var currentStoryIcon: UIImage?
@@ -3102,6 +3103,9 @@ public class ChatListItemNode: ItemListRevealOptionsItemNode {
currentCredibilityIconContent = .text(color: item.presentationData.theme.chat.message.incoming.scamColor, string: item.presentationData.strings.Message_FakeAccount.uppercased())
} else if let emojiStatus = peer.emojiStatus, !premiumConfiguration.isPremiumDisabled {
currentStatusIconContent = .animation(content: .customEmoji(fileId: emojiStatus.fileId), size: CGSize(width: 32.0, height: 32.0), placeholderColor: item.presentationData.theme.list.mediaPlaceholderColor, themeColor: item.presentationData.theme.list.itemAccentColor, loopMode: .count(2))
if case let .starGift(_, _, _, _, _, innerColor, _, _, _) = emojiStatus.content {
currentStatusIconParticleColor = UIColor(rgb: UInt32(bitPattern: innerColor))
}
} else if peer.isPremium && !premiumConfiguration.isPremiumDisabled {
currentCredibilityIconContent = .premium(color: item.presentationData.theme.list.itemAccentColor)
}
@@ -3130,6 +3134,9 @@ public class ChatListItemNode: ItemListRevealOptionsItemNode {
currentCredibilityIconContent = .text(color: item.presentationData.theme.chat.message.incoming.scamColor, string: item.presentationData.strings.Message_FakeAccount.uppercased())
} else if let emojiStatus = peer.emojiStatus, !premiumConfiguration.isPremiumDisabled {
currentStatusIconContent = .animation(content: .customEmoji(fileId: emojiStatus.fileId), size: CGSize(width: 32.0, height: 32.0), placeholderColor: item.presentationData.theme.list.mediaPlaceholderColor, themeColor: item.presentationData.theme.list.itemAccentColor, loopMode: .count(2))
if case let .starGift(_, _, _, _, _, innerColor, _, _, _) = emojiStatus.content {
currentStatusIconParticleColor = UIColor(rgb: UInt32(bitPattern: innerColor))
}
} else if peer.isPremium && !premiumConfiguration.isPremiumDisabled {
currentCredibilityIconContent = .premium(color: item.presentationData.theme.list.itemAccentColor)
}
@@ -3149,7 +3156,7 @@ public class ChatListItemNode: ItemListRevealOptionsItemNode {
var titleLeftOffset: CGFloat = 0.0
if let currentVerifiedIconContent {
if titleLeftOffset.isZero, case .animation = currentVerifiedIconContent {
titleLeftOffset += 20.0
titleLeftOffset += 19.0
}
if titleIconsWidth.isZero {
@@ -4548,12 +4555,13 @@ public class ChatListItemNode: ItemListRevealOptionsItemNode {
strongSelf.statusIconView = statusIconView
strongSelf.mainContentContainerNode.view.addSubview(statusIconView)
}
let statusIconComponent = EmojiStatusComponent(
context: item.context,
animationCache: item.interaction.animationCache,
animationRenderer: item.interaction.animationRenderer,
content: currentStatusIconContent,
particleColor: currentStatusIconParticleColor,
isVisibleForAnimations: strongSelf.visibilityStatus && item.context.sharedContext.energyUsageSettings.loopEmoji,
action: nil
)
@@ -4595,7 +4603,12 @@ public class ChatListItemNode: ItemListRevealOptionsItemNode {
strongSelf.credibilityIconComponent = credibilityIconComponent
let iconOrigin: CGFloat = nextTitleIconOrigin
let containerSize = CGSize(width: 20.0, height: 20.0)
let containerSize: CGSize
if case .verified = currentCredibilityIconContent {
containerSize = CGSize(width: 16.0, height: 16.0)
} else {
containerSize = CGSize(width: 20.0, height: 20.0)
}
let iconSize = credibilityIconView.update(
transition: .immediate,
component: AnyComponent(credibilityIconComponent),

View File

@@ -289,9 +289,8 @@ final class ChatListNoticeItemNode: ItemListRevealOptionsItemNode {
titleString = attributedTitle
textString = NSAttributedString(string: text, font: smallTextFont, textColor: item.theme.rootController.navigationBar.secondaryTextColor)
case let .setupPhoto(accountPeer):
//TODO:localize
titleString = NSAttributedString(string: "Add your photo! 📸", font: titleFont, textColor: item.theme.rootController.navigationBar.primaryTextColor)
textString = NSAttributedString(string: "Help your friends spot you easily.", font: smallTextFont, textColor: item.theme.rootController.navigationBar.secondaryTextColor)
titleString = NSAttributedString(string: item.strings.ChatList_AddPhoto_Title, font: titleFont, textColor: item.theme.rootController.navigationBar.primaryTextColor)
textString = NSAttributedString(string: item.strings.ChatList_AddPhoto_Text, font: smallTextFont, textColor: item.theme.rootController.navigationBar.secondaryTextColor)
avatarPeer = accountPeer
}
@@ -383,17 +382,12 @@ final class ChatListNoticeItemNode: ItemListRevealOptionsItemNode {
strongSelf.arrowNode.frame = CGRect(origin: CGPoint(x: layout.size.width - sideInset - image.size.width + 8.0, y: floor((layout.size.height - image.size.height) / 2.0)), size: image.size)
}
var hasCloseButton = false
if case .xmasPremiumGift = item.notice {
hasCloseButton = true
} else if case .setupBirthday = item.notice {
hasCloseButton = true
} else if case .birthdayPremiumGift = item.notice {
hasCloseButton = true
} else if case .premiumGrace = item.notice {
hasCloseButton = true
} else if case .starsSubscriptionLowBalance = item.notice {
let hasCloseButton: Bool
switch item.notice {
case .xmasPremiumGift, .setupBirthday, .birthdayPremiumGift, .premiumGrace, .starsSubscriptionLowBalance, .setupPhoto:
hasCloseButton = true
default:
hasCloseButton = false
}
if let okButtonLayout, let cancelButtonLayout {