@@ -1266,6 +1266,8 @@ public class ChatListItemNode: ItemListRevealOptionsItemNode {
1266
1266
var verifiedIconComponent : EmojiStatusComponent ?
1267
1267
var credibilityIconView : ComponentHostView < Empty > ?
1268
1268
var credibilityIconComponent : EmojiStatusComponent ?
1269
+ var statusIconView : ComponentHostView < Empty > ?
1270
+ var statusIconComponent : EmojiStatusComponent ?
1269
1271
let mutedIconNode : ASImageNode
1270
1272
var itemTagList : ComponentView < Empty > ?
1271
1273
var actionButtonTitleNode : TextNode ?
@@ -2142,6 +2144,7 @@ public class ChatListItemNode: ItemListRevealOptionsItemNode {
2142
2144
var currentMutedIconImage : UIImage ?
2143
2145
var currentCredibilityIconContent : EmojiStatusComponent . Content ?
2144
2146
var currentVerifiedIconContent : EmojiStatusComponent . Content ?
2147
+ var currentStatusIconContent : EmojiStatusComponent . Content ?
2145
2148
var currentSecretIconImage : UIImage ?
2146
2149
var currentForwardedIcon : UIImage ?
2147
2150
var currentStoryIcon : UIImage ?
@@ -3098,7 +3101,7 @@ public class ChatListItemNode: ItemListRevealOptionsItemNode {
3098
3101
} else if peer. isFake {
3099
3102
currentCredibilityIconContent = . text( color: item. presentationData. theme. chat. message. incoming. scamColor, string: item. presentationData. strings. Message_FakeAccount. uppercased ( ) )
3100
3103
} 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 ) )
3102
3105
} else if peer. isPremium && !premiumConfiguration. isPremiumDisabled {
3103
3106
currentCredibilityIconContent = . premium( color: item. presentationData. theme. list. itemAccentColor)
3104
3107
}
@@ -3126,7 +3129,7 @@ public class ChatListItemNode: ItemListRevealOptionsItemNode {
3126
3129
} else if peer. isFake {
3127
3130
currentCredibilityIconContent = . text( color: item. presentationData. theme. chat. message. incoming. scamColor, string: item. presentationData. strings. Message_FakeAccount. uppercased ( ) )
3128
3131
} 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 ) )
3130
3133
} else if peer. isPremium && !premiumConfiguration. isPremiumDisabled {
3131
3134
currentCredibilityIconContent = . premium( color: item. presentationData. theme. list. itemAccentColor)
3132
3135
}
@@ -3180,6 +3183,22 @@ public class ChatListItemNode: ItemListRevealOptionsItemNode {
3180
3183
}
3181
3184
}
3182
3185
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
+
3183
3202
let layoutOffset : CGFloat = 0.0
3184
3203
3185
3204
let rawContentWidth = params. width - leftInset - params. rightInset - 10.0 - editingOffset
@@ -4514,6 +4533,41 @@ public class ChatListItemNode: ItemListRevealOptionsItemNode {
4514
4533
} else {
4515
4534
lastLineRect = CGRect ( origin: CGPoint ( ) , size: titleLayout. size)
4516
4535
}
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
+ }
4517
4571
4518
4572
if let currentCredibilityIconContent {
4519
4573
let credibilityIconView : ComponentHostView < Empty >
0 commit comments