@@ -1266,6 +1266,8 @@ public class ChatListItemNode: ItemListRevealOptionsItemNode {
12661266 var verifiedIconComponent : EmojiStatusComponent ?
12671267 var credibilityIconView : ComponentHostView < Empty > ?
12681268 var credibilityIconComponent : EmojiStatusComponent ?
1269+ var statusIconView : ComponentHostView < Empty > ?
1270+ var statusIconComponent : EmojiStatusComponent ?
12691271 let mutedIconNode : ASImageNode
12701272 var itemTagList : ComponentView < Empty > ?
12711273 var actionButtonTitleNode : TextNode ?
@@ -2142,6 +2144,7 @@ public class ChatListItemNode: ItemListRevealOptionsItemNode {
21422144 var currentMutedIconImage : UIImage ?
21432145 var currentCredibilityIconContent : EmojiStatusComponent . Content ?
21442146 var currentVerifiedIconContent : EmojiStatusComponent . Content ?
2147+ var currentStatusIconContent : EmojiStatusComponent . Content ?
21452148 var currentSecretIconImage : UIImage ?
21462149 var currentForwardedIcon : UIImage ?
21472150 var currentStoryIcon : UIImage ?
@@ -3098,7 +3101,7 @@ public class ChatListItemNode: ItemListRevealOptionsItemNode {
30983101 } else if peer. isFake {
30993102 currentCredibilityIconContent = . text( color: item. presentationData. theme. chat. message. incoming. scamColor, string: item. presentationData. strings. Message_FakeAccount. uppercased ( ) )
31003103 } else if let emojiStatus = peer. emojiStatus, !premiumConfiguration. isPremiumDisabled {
3101- currentCredibilityIconContent = . 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 ) )
3104+ 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 ) )
31023105 } else if peer. isPremium && !premiumConfiguration. isPremiumDisabled {
31033106 currentCredibilityIconContent = . premium( color: item. presentationData. theme. list. itemAccentColor)
31043107 }
@@ -3126,7 +3129,7 @@ public class ChatListItemNode: ItemListRevealOptionsItemNode {
31263129 } else if peer. isFake {
31273130 currentCredibilityIconContent = . text( color: item. presentationData. theme. chat. message. incoming. scamColor, string: item. presentationData. strings. Message_FakeAccount. uppercased ( ) )
31283131 } else if let emojiStatus = peer. emojiStatus, !premiumConfiguration. isPremiumDisabled {
3129- currentCredibilityIconContent = . 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 ) )
3132+ 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 ) )
31303133 } else if peer. isPremium && !premiumConfiguration. isPremiumDisabled {
31313134 currentCredibilityIconContent = . premium( color: item. presentationData. theme. list. itemAccentColor)
31323135 }
@@ -3180,6 +3183,22 @@ public class ChatListItemNode: ItemListRevealOptionsItemNode {
31803183 }
31813184 }
31823185
3186+ if let currentStatusIconContent {
3187+ if titleIconsWidth. isZero {
3188+ titleIconsWidth += 4.0
3189+ } else {
3190+ titleIconsWidth += 2.0
3191+ }
3192+ switch currentStatusIconContent {
3193+ case let . text( _, string) :
3194+ let textString = NSAttributedString ( string: string, font: Font . bold ( 10.0 ) , textColor: . black, paragraphAlignment: . center)
3195+ let stringRect = textString. boundingRect ( with: CGSize ( width: 100.0 , height: 16.0 ) , options: . usesLineFragmentOrigin, context: nil )
3196+ titleIconsWidth += floor ( stringRect. width) + 11.0
3197+ default :
3198+ titleIconsWidth += 8.0
3199+ }
3200+ }
3201+
31833202 let layoutOffset : CGFloat = 0.0
31843203
31853204 let rawContentWidth = params. width - leftInset - params. rightInset - 10.0 - editingOffset
@@ -4514,6 +4533,41 @@ public class ChatListItemNode: ItemListRevealOptionsItemNode {
45144533 } else {
45154534 lastLineRect = CGRect ( origin: CGPoint ( ) , size: titleLayout. size)
45164535 }
4536+
4537+ if let currentStatusIconContent {
4538+ let statusIconView : ComponentHostView < Empty >
4539+ if let current = strongSelf. statusIconView {
4540+ statusIconView = current
4541+ } else {
4542+ statusIconView = ComponentHostView < Empty > ( )
4543+ strongSelf. statusIconView = statusIconView
4544+ strongSelf. mainContentContainerNode. view. addSubview ( statusIconView)
4545+ }
4546+
4547+ let statusIconComponent = EmojiStatusComponent (
4548+ context: item. context,
4549+ animationCache: item. interaction. animationCache,
4550+ animationRenderer: item. interaction. animationRenderer,
4551+ content: currentStatusIconContent,
4552+ isVisibleForAnimations: strongSelf. visibilityStatus && item. context. sharedContext. energyUsageSettings. loopEmoji,
4553+ action: nil
4554+ )
4555+ strongSelf. statusIconComponent = statusIconComponent
4556+
4557+ let iconOrigin : CGFloat = nextTitleIconOrigin
4558+ let containerSize = CGSize ( width: 20.0 , height: 20.0 )
4559+ let iconSize = statusIconView. update (
4560+ transition: . immediate,
4561+ component: AnyComponent ( statusIconComponent) ,
4562+ environment: { } ,
4563+ containerSize: containerSize
4564+ )
4565+ transition. updateFrame ( view: statusIconView, frame: CGRect ( origin: CGPoint ( x: iconOrigin, y: floorToScreenPixels ( titleFrame. maxY - lastLineRect. height * 0.5 - iconSize. height / 2.0 ) - UIScreenPixel) , size: iconSize) )
4566+ nextTitleIconOrigin += statusIconView. bounds. width + 4.0
4567+ } else if let statusIconView = strongSelf. statusIconView {
4568+ strongSelf. statusIconView = nil
4569+ statusIconView. removeFromSuperview ( )
4570+ }
45174571
45184572 if let currentCredibilityIconContent {
45194573 let credibilityIconView : ComponentHostView < Empty >
0 commit comments