@@ -9,6 +9,7 @@ import AccountContext
99import HierarchyTrackingLayer
1010import LokiRng
1111import SwiftSignalKit
12+ import TelegramPresentationData
1213
1314private let gradientColors : [ NSArray ] = [
1415 [ UIColor ( rgb: 0xff516a ) . cgColor, UIColor ( rgb: 0xff885e ) . cgColor] ,
@@ -93,15 +94,17 @@ private func avatarViewLettersImage(size: CGSize, peerId: EnginePeer.Id, letters
9394}
9495
9596private func makePeerBadgeImage( engine: TelegramEngine , peer: EnginePeer , count: Int ) async -> UIImage {
97+ let count = 123
98+
9699 let avatarSize : CGFloat = 16.0
97100 let avatarInset : CGFloat = 2.0
98101 let avatarIconSpacing : CGFloat = 2.0
99102 let iconTextSpacing : CGFloat = 1.0
100103 let iconSize : CGFloat = 10.0
101- let rightInset : CGFloat = 2 .0
104+ let rightInset : CGFloat = 5 .0
102105
103- let text = NSAttributedString ( string: " \( count) " , font: Font . semibold ( 10.0 ) , textColor: . white)
104- var textSize = text. boundingRect ( with: CGSize ( width: 100 .0, height: 100.0 ) , options: . usesLineFragmentOrigin, context: nil ) . size
106+ let text = NSAttributedString ( string: countString ( Int64 ( count) ) , font: Font . semibold ( 10.0 ) , textColor: . white)
107+ var textSize = text. boundingRect ( with: CGSize ( width: 200 .0, height: 100.0 ) , options: . usesLineFragmentOrigin, context: nil ) . size
105108 textSize. width = ceil ( textSize. width)
106109 textSize. height = ceil ( textSize. height)
107110
@@ -127,7 +130,7 @@ private func makePeerBadgeImage(engine: TelegramEngine, peer: EnginePeer, count:
127130 disposable. dispose ( )
128131 }
129132
130- let size = CGSize ( width: avatarInset + avatarSize + avatarIconSpacing + iconSize + iconTextSpacing + textSize. height + rightInset, height: avatarSize + avatarInset * 2.0 )
133+ let size = CGSize ( width: avatarInset + avatarSize + avatarIconSpacing + iconSize + iconTextSpacing + textSize. width + rightInset, height: avatarSize + avatarInset * 2.0 )
131134 return generateImage ( size, rotatedContext: { size, context in
132135 UIGraphicsPushContext ( context)
133136 defer {
0 commit comments