mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-08-02 00:17:02 +00:00
Merge commit '651c57a010aef801472587b6ee19f6f5bee4f4a6'
This commit is contained in:
commit
8fd23a13da
@ -40,6 +40,40 @@ public struct Font {
|
||||
public static let monospacedNumbers = Traits(rawValue: 1 << 1)
|
||||
}
|
||||
|
||||
public enum Width {
|
||||
case standard
|
||||
case condensed
|
||||
case compressed
|
||||
case expanded
|
||||
|
||||
@available(iOS 16.0, *)
|
||||
var width: UIFont.Width {
|
||||
switch self {
|
||||
case .standard:
|
||||
return .standard
|
||||
case .condensed:
|
||||
return .condensed
|
||||
case .compressed:
|
||||
return .compressed
|
||||
case .expanded:
|
||||
return .expanded
|
||||
}
|
||||
}
|
||||
|
||||
var key: String {
|
||||
switch self {
|
||||
case .standard:
|
||||
return "standard"
|
||||
case .condensed:
|
||||
return "condensed"
|
||||
case .compressed:
|
||||
return "compressed"
|
||||
case .expanded:
|
||||
return "expanded"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public enum Weight {
|
||||
case regular
|
||||
case thin
|
||||
@ -124,8 +158,8 @@ public struct Font {
|
||||
|
||||
private static let cache = Cache()
|
||||
|
||||
public static func with(size: CGFloat, design: Design = .regular, weight: Weight = .regular, traits: Traits = []) -> UIFont {
|
||||
let key = "\(size)_\(design.key)_\(weight.key)_\(traits.rawValue)"
|
||||
public static func with(size: CGFloat, design: Design = .regular, weight: Weight = .regular, width: Width = .standard, traits: Traits = []) -> UIFont {
|
||||
let key = "\(size)_\(design.key)_\(weight.key)_\(width.key)_\(traits.rawValue)"
|
||||
|
||||
if let cachedFont = self.cache.get(key) {
|
||||
return cachedFont
|
||||
@ -169,7 +203,14 @@ public struct Font {
|
||||
])
|
||||
}
|
||||
}
|
||||
|
||||
if #available(iOS 16.0, *) {
|
||||
if width != .standard {
|
||||
updatedDescriptor = updatedDescriptor?.addingAttributes([
|
||||
UIFontDescriptor.AttributeName.traits: [UIFontDescriptor.TraitKey.width: width.width]
|
||||
])
|
||||
}
|
||||
}
|
||||
|
||||
let font: UIFont
|
||||
if let updatedDescriptor = updatedDescriptor {
|
||||
font = UIFont(descriptor: updatedDescriptor, size: size)
|
||||
|
@ -980,8 +980,9 @@ private enum StatsEntry: ItemListNodeEntry {
|
||||
arguments.openMonetizationInfo()
|
||||
})
|
||||
case let .adsTransaction(_, theme, transaction):
|
||||
let font = Font.regular(presentationData.fontSize.itemListBaseFontSize)
|
||||
let smallLabelFont = Font.regular(floor(presentationData.fontSize.itemListBaseFontSize / 17.0 * 13.0))
|
||||
let font = Font.with(size: floor(presentationData.fontSize.itemListBaseFontSize))
|
||||
let smallLabelFont = Font.with(size: floor(presentationData.fontSize.itemListBaseFontSize / 17.0 * 13.0))
|
||||
|
||||
var labelColor = theme.list.itemDisclosureActions.constructive.fillColor
|
||||
|
||||
let title: NSAttributedString
|
||||
@ -1016,7 +1017,11 @@ private enum StatsEntry: ItemListNodeEntry {
|
||||
}
|
||||
|
||||
let label = amountAttributedString(formatBalanceText(transaction.amount, decimalSeparator: presentationData.dateTimeFormat.decimalSeparator, showPlus: true), integralFont: font, fractionalFont: smallLabelFont, color: labelColor).mutableCopy() as! NSMutableAttributedString
|
||||
label.append(NSAttributedString(string: " TON", font: smallLabelFont, textColor: labelColor))
|
||||
|
||||
label.append(NSAttributedString(string: " $ ", font: smallLabelFont, textColor: labelColor))
|
||||
if let range = label.string.range(of: "$"), let icon = generateTintedImage(image: UIImage(bundleImageName: "Ads/Ton"), color: labelColor) {
|
||||
label.addAttribute(.attachment, value: icon, range: NSRange(range, in: label.string))
|
||||
}
|
||||
|
||||
return ItemListDisclosureItem(presentationData: presentationData, title: "", attributedTitle: title, label: "", attributedLabel: label, labelStyle: .coloredText(labelColor), additionalDetailLabel: detailText, additionalDetailLabelColor: detailColor, sectionId: self.section, style: .blocks, disclosureStyle: .none, action: {
|
||||
arguments.openTransaction(transaction)
|
||||
|
@ -44,10 +44,13 @@ private func renderIcon(name: String, backgroundColors: [UIColor]? = nil) -> UII
|
||||
context.drawLinearGradient(gradient, start: CGPoint(x: size.width, y: size.height), end: CGPoint(x: 0.0, y: 0.0), options: CGGradientDrawingOptions())
|
||||
|
||||
context.resetClip()
|
||||
}
|
||||
|
||||
if let image = UIImage(bundleImageName: name)?.cgImage {
|
||||
context.draw(image, in: bounds)
|
||||
if let image = generateTintedImage(image: UIImage(bundleImageName: name), color: .white)?.cgImage {
|
||||
context.draw(image, in: bounds)
|
||||
}
|
||||
} else {
|
||||
if let image = UIImage(bundleImageName: name)?.cgImage {
|
||||
context.draw(image, in: bounds)
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
|
12
submodules/TelegramUI/Images.xcassets/Ads/Ton.imageset/Contents.json
vendored
Normal file
12
submodules/TelegramUI/Images.xcassets/Ads/Ton.imageset/Contents.json
vendored
Normal file
@ -0,0 +1,12 @@
|
||||
{
|
||||
"images" : [
|
||||
{
|
||||
"filename" : "ton.pdf",
|
||||
"idiom" : "universal"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"author" : "xcode",
|
||||
"version" : 1
|
||||
}
|
||||
}
|
125
submodules/TelegramUI/Images.xcassets/Ads/Ton.imageset/ton.pdf
vendored
Normal file
125
submodules/TelegramUI/Images.xcassets/Ads/Ton.imageset/ton.pdf
vendored
Normal file
@ -0,0 +1,125 @@
|
||||
%PDF-1.7
|
||||
|
||||
1 0 obj
|
||||
<< >>
|
||||
endobj
|
||||
|
||||
2 0 obj
|
||||
<< /Length 3 0 R >>
|
||||
stream
|
||||
/DeviceRGB CS
|
||||
/DeviceRGB cs
|
||||
q
|
||||
1.000000 0.000000 -0.000000 1.000000 0.590820 1.075073 cm
|
||||
0.000000 0.000000 0.000000 scn
|
||||
9.009681 8.994765 m
|
||||
9.534775 8.723749 l
|
||||
9.009681 8.994765 l
|
||||
h
|
||||
4.202179 1.714967 m
|
||||
4.727273 1.985982 l
|
||||
4.202179 1.714967 l
|
||||
h
|
||||
5.252367 1.714968 m
|
||||
4.727273 1.985984 l
|
||||
5.252367 1.714968 l
|
||||
h
|
||||
-0.080229 8.723748 m
|
||||
3.677085 1.443950 l
|
||||
4.727273 1.985982 l
|
||||
0.969959 9.265780 l
|
||||
-0.080229 8.723748 l
|
||||
h
|
||||
5.777461 1.443952 m
|
||||
9.534775 8.723749 l
|
||||
8.484587 9.265781 l
|
||||
4.727273 1.985984 l
|
||||
5.777461 1.443952 l
|
||||
h
|
||||
8.484587 10.447598 m
|
||||
0.969957 10.447598 l
|
||||
0.969957 9.265780 l
|
||||
8.484587 9.265780 l
|
||||
8.484587 10.447598 l
|
||||
h
|
||||
9.534775 8.723749 m
|
||||
9.940755 9.510336 9.369759 10.447598 8.484587 10.447598 c
|
||||
8.484587 9.265780 l
|
||||
8.484587 9.265781 l
|
||||
9.534775 8.723749 l
|
||||
h
|
||||
3.677085 1.443950 m
|
||||
4.117369 0.590899 5.337180 0.590907 5.777461 1.443952 c
|
||||
4.727273 1.985984 l
|
||||
4.727273 1.985982 l
|
||||
3.677085 1.443950 l
|
||||
h
|
||||
0.969959 9.265780 m
|
||||
0.969957 9.265780 l
|
||||
0.969957 10.447598 l
|
||||
0.084779 10.447598 -0.486207 9.510329 -0.080229 8.723748 c
|
||||
0.969959 9.265780 l
|
||||
h
|
||||
f
|
||||
n
|
||||
Q
|
||||
q
|
||||
1.000000 0.000000 -0.000000 1.000000 5.318359 2.954590 cm
|
||||
0.000000 0.000000 0.000000 scn
|
||||
-0.590909 8.272705 m
|
||||
-0.590909 -0.000022 l
|
||||
0.590909 -0.000022 l
|
||||
0.590909 8.272705 l
|
||||
-0.590909 8.272705 l
|
||||
h
|
||||
f
|
||||
n
|
||||
Q
|
||||
|
||||
endstream
|
||||
endobj
|
||||
|
||||
3 0 obj
|
||||
1246
|
||||
endobj
|
||||
|
||||
4 0 obj
|
||||
<< /Annots []
|
||||
/Type /Page
|
||||
/MediaBox [ 0.000000 0.000000 10.636230 13.000000 ]
|
||||
/Resources 1 0 R
|
||||
/Contents 2 0 R
|
||||
/Parent 5 0 R
|
||||
>>
|
||||
endobj
|
||||
|
||||
5 0 obj
|
||||
<< /Kids [ 4 0 R ]
|
||||
/Count 1
|
||||
/Type /Pages
|
||||
>>
|
||||
endobj
|
||||
|
||||
6 0 obj
|
||||
<< /Pages 5 0 R
|
||||
/Type /Catalog
|
||||
>>
|
||||
endobj
|
||||
|
||||
xref
|
||||
0 7
|
||||
0000000000 65535 f
|
||||
0000000010 00000 n
|
||||
0000000034 00000 n
|
||||
0000001336 00000 n
|
||||
0000001359 00000 n
|
||||
0000001532 00000 n
|
||||
0000001606 00000 n
|
||||
trailer
|
||||
<< /ID [ (some) (id) ]
|
||||
/Root 6 0 R
|
||||
/Size 7
|
||||
>>
|
||||
startxref
|
||||
1665
|
||||
%%EOF
|
@ -14,57 +14,64 @@ stream
|
||||
/DeviceRGB CS
|
||||
/DeviceRGB cs
|
||||
q
|
||||
1.000000 0.000000 -0.000000 1.000000 4.110840 5.913086 cm
|
||||
1.000000 1.000000 1.000000 scn
|
||||
4.498568 19.173828 m
|
||||
3.994308 19.173828 3.585524 18.765045 3.585524 18.260784 c
|
||||
3.585524 17.756525 3.994307 17.347740 4.498567 17.347740 c
|
||||
17.281176 17.347740 l
|
||||
17.785437 17.347740 18.194220 17.756525 18.194220 18.260784 c
|
||||
18.194220 18.765045 17.785437 19.173828 17.281176 19.173828 c
|
||||
4.498568 19.173828 l
|
||||
1.000000 0.000000 -0.000000 1.000000 4.071167 5.495728 cm
|
||||
0.000000 0.000000 0.000000 scn
|
||||
4.550891 19.004272 m
|
||||
3.550644 19.004272 2.629929 18.459051 2.149061 17.581976 c
|
||||
0.197911 14.023188 l
|
||||
0.050381 13.754102 -0.041267 13.449200 0.018514 13.148203 c
|
||||
0.224622 12.110457 1.107036 11.330434 2.164348 11.330434 c
|
||||
3.374572 11.330434 4.355652 12.352392 4.355652 13.613043 c
|
||||
4.355652 12.352392 5.336732 11.330434 6.546957 11.330434 c
|
||||
7.757180 11.330434 8.738261 12.352392 8.738261 13.613043 c
|
||||
8.738261 12.352392 9.719341 11.330434 10.929565 11.330434 c
|
||||
12.139789 11.330434 13.120870 12.352392 13.120870 13.613043 c
|
||||
13.120870 12.352392 14.101950 11.330434 15.312175 11.330434 c
|
||||
16.522400 11.330434 17.503479 12.352392 17.503479 13.613043 c
|
||||
17.503479 12.352392 18.484558 11.330434 19.694782 11.330434 c
|
||||
20.752028 11.330434 21.634399 12.110360 21.840578 13.148008 c
|
||||
21.900410 13.449123 21.808687 13.754148 21.661041 14.023315 c
|
||||
19.708754 17.582464 l
|
||||
19.227804 18.459267 18.307240 19.004272 17.307192 19.004272 c
|
||||
4.550891 19.004272 l
|
||||
h
|
||||
3.730381 16.434698 m
|
||||
2.984531 16.434698 2.270933 16.130550 1.754408 15.592503 c
|
||||
0.442120 14.225536 l
|
||||
0.115654 13.885468 -0.098236 13.421288 0.045616 12.972363 c
|
||||
0.335989 12.066183 1.157089 11.412958 2.124654 11.412958 c
|
||||
3.334878 11.412958 4.315958 12.434917 4.315958 13.695567 c
|
||||
4.315958 12.434917 5.297039 11.412958 6.507263 11.412958 c
|
||||
7.717486 11.412958 8.698567 12.434917 8.698567 13.695567 c
|
||||
8.698567 12.434917 9.679648 11.412958 10.889872 11.412958 c
|
||||
12.100096 11.412958 13.081176 12.434917 13.081176 13.695567 c
|
||||
13.081176 12.434917 14.062256 11.412958 15.272481 11.412958 c
|
||||
16.482704 11.412958 17.463785 12.434917 17.463785 13.695567 c
|
||||
17.463785 12.434917 18.444864 11.412958 19.655088 11.412958 c
|
||||
20.622656 11.412958 21.443754 12.066183 21.734129 12.972363 c
|
||||
21.877979 13.421288 21.664089 13.885468 21.337624 14.225537 c
|
||||
20.025335 15.592504 l
|
||||
19.508810 16.130550 18.795212 16.434698 18.049362 16.434698 c
|
||||
3.730381 16.434698 l
|
||||
1.928854 9.772764 m
|
||||
1.928854 9.900281 2.036825 10.000550 2.164342 10.000550 c
|
||||
2.855239 10.000550 3.489849 10.200651 4.024321 10.542957 c
|
||||
4.224969 10.671464 4.486324 10.671464 4.686972 10.542957 c
|
||||
5.221445 10.200650 5.856054 10.000550 6.546951 10.000550 c
|
||||
7.237848 10.000550 7.872454 10.200651 8.406925 10.542958 c
|
||||
8.607574 10.671466 8.868930 10.671466 9.069578 10.542959 c
|
||||
9.604051 10.200651 10.238662 10.000550 10.929560 10.000550 c
|
||||
11.620458 10.000550 12.255063 10.200651 12.789535 10.542958 c
|
||||
12.990183 10.671465 13.251539 10.671465 13.452188 10.542958 c
|
||||
13.986660 10.200651 14.621270 10.000550 15.312168 10.000550 c
|
||||
16.003067 10.000550 16.637672 10.200651 17.172144 10.542958 c
|
||||
17.372791 10.671465 17.634148 10.671465 17.834795 10.542958 c
|
||||
18.369268 10.200651 19.003880 10.000550 19.694777 10.000550 c
|
||||
19.821545 10.000550 19.928854 9.900851 19.928854 9.774083 c
|
||||
19.928854 3.004311 l
|
||||
19.928854 1.347456 18.585709 0.004311 16.928854 0.004311 c
|
||||
10.428854 0.004311 l
|
||||
10.152712 0.004311 9.928854 0.228168 9.928854 0.504311 c
|
||||
9.928854 7.004311 l
|
||||
9.928854 7.556595 9.481138 8.004311 8.928854 8.004311 c
|
||||
5.928854 8.004311 l
|
||||
5.376569 8.004311 4.928854 7.556595 4.928854 7.004311 c
|
||||
4.928854 0.504311 l
|
||||
4.928854 0.228168 4.703317 -0.000057 4.430948 0.045439 c
|
||||
3.011061 0.282616 1.928854 1.517080 1.928854 3.004311 c
|
||||
1.928854 9.772764 l
|
||||
h
|
||||
3.585524 10.043394 m
|
||||
4.089784 10.043394 4.498567 9.634610 4.498567 9.130350 c
|
||||
4.498567 6.370851 l
|
||||
4.509398 5.875998 4.913934 5.478176 5.411387 5.478176 c
|
||||
16.367910 5.478176 l
|
||||
16.872171 5.478176 17.280952 5.886958 17.280952 6.391218 c
|
||||
17.280952 8.217306 l
|
||||
17.281176 8.237696 l
|
||||
17.281176 9.130350 l
|
||||
17.281176 9.634610 17.689960 10.043394 18.194220 10.043394 c
|
||||
18.698479 10.043394 19.107264 9.634610 19.107264 9.130350 c
|
||||
19.107264 6.391220 l
|
||||
19.107264 1.826002 l
|
||||
19.107264 0.817484 18.289698 -0.000084 17.281178 -0.000084 c
|
||||
4.498567 -0.000084 l
|
||||
3.490047 -0.000084 2.672480 0.817484 2.672480 1.826004 c
|
||||
2.672480 6.355908 l
|
||||
2.672257 6.391218 l
|
||||
2.672257 8.217306 l
|
||||
2.672480 8.237684 l
|
||||
2.672480 9.130350 l
|
||||
2.672480 9.634610 3.081264 10.043394 3.585524 10.043394 c
|
||||
11.928854 7.004272 m
|
||||
11.928854 7.556557 12.376569 8.004272 12.928854 8.004272 c
|
||||
15.928854 8.004272 l
|
||||
16.481138 8.004272 16.928854 7.556557 16.928854 7.004272 c
|
||||
16.928854 4.004272 l
|
||||
16.928854 3.451987 16.481138 3.004272 15.928854 3.004272 c
|
||||
12.928854 3.004272 l
|
||||
12.376569 3.004272 11.928854 3.451987 11.928854 4.004272 c
|
||||
11.928854 7.004272 l
|
||||
h
|
||||
f*
|
||||
n
|
||||
@ -74,7 +81,7 @@ endstream
|
||||
endobj
|
||||
|
||||
2 0 obj
|
||||
2129
|
||||
2736
|
||||
endobj
|
||||
|
||||
3 0 obj
|
||||
@ -177,20 +184,20 @@ xref
|
||||
0 11
|
||||
0000000000 65535 f
|
||||
0000000010 00000 n
|
||||
0000002387 00000 n
|
||||
0000002410 00000 n
|
||||
0000003602 00000 n
|
||||
0000003624 00000 n
|
||||
0000003922 00000 n
|
||||
0000004024 00000 n
|
||||
0000004045 00000 n
|
||||
0000004218 00000 n
|
||||
0000004292 00000 n
|
||||
0000002994 00000 n
|
||||
0000003017 00000 n
|
||||
0000004209 00000 n
|
||||
0000004231 00000 n
|
||||
0000004529 00000 n
|
||||
0000004631 00000 n
|
||||
0000004652 00000 n
|
||||
0000004825 00000 n
|
||||
0000004899 00000 n
|
||||
trailer
|
||||
<< /ID [ (some) (id) ]
|
||||
/Root 10 0 R
|
||||
/Size 11
|
||||
>>
|
||||
startxref
|
||||
4352
|
||||
4959
|
||||
%%EOF
|
Loading…
x
Reference in New Issue
Block a user