Skip to content

Commit 6db5077

Browse files
committed
Various fixes
1 parent 2cb0c7f commit 6db5077

File tree

3 files changed

+40
-85
lines changed

3 files changed

+40
-85
lines changed

Telegram/Telegram-iOS/en.lproj/Localizable.strings

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15570,7 +15570,7 @@ Error: %8$@";
1557015570
"Gift.Variants.CollectionInfo.Symbol_1" = "**%@** unique symbol";
1557115571
"Gift.Variants.CollectionInfo.Symbol_any" = "**%@** unique symbols";
1557215572

15573-
"Gift.Auction.GiftAuction" = "Upcoming Auction";
15573+
"Gift.Auction.GiftAuction" = "Gift Auction";
1557415574
"Gift.Auction.UpcomingAuction" = "Upcoming Auction";
1557515575
"Gift.Auction.LearnMore" = "Learn more about Telegram Gifts >";
1557615576

submodules/TelegramUI/Components/Chat/ChatMessageForwardInfoNode/Sources/ChatMessageForwardInfoNode.swift

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -514,14 +514,16 @@ public class ChatMessageForwardInfoNode: ASDisplayNode {
514514
}
515515
titleNode.frame = CGRect(origin: CGPoint(x: leftOffset, y: 0.0), size: titleLayout.size)
516516

517+
var nameFrame = CGRect()
517518
if let (nameLayout, nameApply) = nameLayoutAndApply {
518519
let nameNode = nameApply()
519520
if node.nameNode == nil {
520521
nameNode.isUserInteractionEnabled = false
521522
node.nameNode = nameNode
522523
node.addSubnode(nameNode)
523524
}
524-
nameNode.frame = CGRect(origin: CGPoint(x: leftOffset + authorAvatarInset, y: titleLayout.size.height + titleAuthorSpacing), size: nameLayout.size)
525+
nameFrame = CGRect(origin: CGPoint(x: leftOffset + authorAvatarInset, y: titleLayout.size.height + titleAuthorSpacing), size: nameLayout.size)
526+
nameNode.frame = nameFrame
525527

526528
if authorAvatarInset != 0.0 {
527529
let avatarNode: AvatarNode
@@ -599,7 +601,7 @@ public class ChatMessageForwardInfoNode: ASDisplayNode {
599601
node.credibilityIconNode = credibilityIconNode
600602
node.addSubnode(credibilityIconNode)
601603
}
602-
credibilityIconNode.frame = CGRect(origin: CGPoint(x: titleLayout.size.width + 4.0, y: 16.0), size: credibilityIconImage.size)
604+
credibilityIconNode.frame = CGRect(origin: CGPoint(x: nameFrame.maxX + 4.0, y: 17.0), size: credibilityIconImage.size)
603605
credibilityIconNode.image = credibilityIconImage
604606
} else {
605607
node.credibilityIconNode?.removeFromSupernode()

submodules/TelegramUI/Components/Stars/StarsWithdrawalScreen/Sources/StarsWithdrawalScreen.swift

Lines changed: 35 additions & 82 deletions
Original file line numberDiff line numberDiff line change
@@ -66,9 +66,6 @@ private final class SheetContent: CombinedComponent {
6666
let timestampSection = Child(ListSectionComponent.self)
6767
let onlyTonSection = Child(ListSectionComponent.self)
6868
let button = Child(ButtonComponent.self)
69-
let balanceTitle = Child(MultilineTextComponent.self)
70-
let balanceValue = Child(MultilineTextComponent.self)
71-
let balanceIcon = Child(BundleIconComponent.self)
7269
let durationPicker = Child(MenuComponent.self)
7370

7471
let body: (CombinedComponentContext<SheetContent>) -> CGSize = { (context: CombinedComponentContext<SheetContent>) -> CGSize in
@@ -88,37 +85,7 @@ private final class SheetContent: CombinedComponent {
8885
var contentSize = CGSize(width: context.availableSize.width, height: 18.0)
8986

9087
let constrainedTitleWidth = context.availableSize.width - 16.0 * 2.0
91-
92-
if case let .suggestedPost(mode, _, _, _) = component.mode {
93-
var displayBalance = false
94-
switch mode {
95-
case let .sender(_, isFromAdmin):
96-
displayBalance = !isFromAdmin
97-
case .admin:
98-
break
99-
}
100-
101-
if displayBalance {
102-
let balance = balance.update(
103-
component: BalanceComponent(
104-
context: component.context,
105-
theme: environment.theme,
106-
strings: environment.strings,
107-
currency: state.currency,
108-
balance: state.currency == .stars ? state.starsBalance : state.tonBalance,
109-
alignment: .right
110-
),
111-
availableSize: CGSize(width: 200.0, height: 200.0),
112-
transition: .immediate
113-
)
114-
let balanceFrame = CGRect(origin: CGPoint(x: context.availableSize.width - balance.size.width - 15.0, y: floor((56.0 - balance.size.height) * 0.5)), size: balance.size)
115-
context.add(balance
116-
.anchorPoint(CGPoint(x: 1.0, y: 0.0))
117-
.position(CGPoint(x: balanceFrame.maxX, y: balanceFrame.minY))
118-
)
119-
}
120-
}
121-
88+
12289
let closeButton = closeButton.update(
12390
component: GlassBarButtonComponent(
12491
size: CGSize(width: 40.0, height: 40.0),
@@ -276,60 +243,45 @@ private final class SheetContent: CombinedComponent {
276243
contentSize.height += title.size.height
277244
contentSize.height += 56.0
278245

279-
let balance: StarsAmount?
280-
if case .accountWithdraw = component.mode {
281-
balance = state.starsBalance
282-
} else if case .reaction = component.mode {
283-
balance = state.starsBalance
284-
} else if case let .withdraw(starsState, _) = component.mode {
285-
balance = starsState.balances.availableBalance.amount
286-
} else {
287-
balance = nil
246+
var displayBalance = false
247+
var currentBalance = state.currency == .stars ? state.starsBalance : state.tonBalance
248+
switch component.mode {
249+
case .accountWithdraw, .reaction:
250+
displayBalance = true
251+
case let .suggestedPost(mode, _, _, _):
252+
switch mode {
253+
case let .sender(_, isFromAdmin):
254+
displayBalance = !isFromAdmin
255+
case .admin:
256+
break
257+
}
258+
case let .withdraw(starsState, _):
259+
currentBalance = starsState.balances.availableBalance.amount
260+
displayBalance = true
261+
default:
262+
break
288263
}
289-
290-
if let balance {
291-
let balanceTitle = balanceTitle.update(
292-
component: MultilineTextComponent(
293-
text: .plain(NSAttributedString(
294-
string: environment.strings.Stars_Transfer_Balance,
295-
font: Font.regular(14.0),
296-
textColor: theme.list.itemPrimaryTextColor
297-
)),
298-
maximumNumberOfLines: 1
264+
265+
if displayBalance {
266+
let balance = balance.update(
267+
component: BalanceComponent(
268+
context: component.context,
269+
theme: environment.theme,
270+
strings: environment.strings,
271+
currency: state.currency,
272+
balance: currentBalance,
273+
alignment: .right
299274
),
300-
availableSize: context.availableSize,
275+
availableSize: CGSize(width: 200.0, height: 200.0),
301276
transition: .immediate
302277
)
303-
let balanceValue = balanceValue.update(
304-
component: MultilineTextComponent(
305-
text: .plain(NSAttributedString(
306-
string: presentationStringsFormattedNumber(balance, environment.dateTimeFormat.groupingSeparator),
307-
font: Font.semibold(16.0),
308-
textColor: theme.list.itemPrimaryTextColor
309-
)),
310-
maximumNumberOfLines: 1
311-
),
312-
availableSize: context.availableSize,
313-
transition: .immediate
314-
)
315-
let balanceIcon = balanceIcon.update(
316-
component: BundleIconComponent(name: "Premium/Stars/StarSmall", tintColor: nil),
317-
availableSize: context.availableSize,
318-
transition: .immediate
319-
)
320-
321-
let topBalanceOriginY = 11.0
322-
context.add(balanceTitle
323-
.position(CGPoint(x: 16.0 + environment.safeInsets.left + balanceTitle.size.width / 2.0, y: topBalanceOriginY + balanceTitle.size.height / 2.0))
324-
)
325-
context.add(balanceIcon
326-
.position(CGPoint(x: 16.0 + environment.safeInsets.left + balanceIcon.size.width / 2.0, y: topBalanceOriginY + balanceTitle.size.height + balanceValue.size.height / 2.0 + 1.0 + UIScreenPixel))
327-
)
328-
context.add(balanceValue
329-
.position(CGPoint(x: 16.0 + environment.safeInsets.left + balanceIcon.size.width + 3.0 + balanceValue.size.width / 2.0, y: topBalanceOriginY + balanceTitle.size.height + balanceValue.size.height / 2.0 + 2.0 - UIScreenPixel))
278+
let balanceFrame = CGRect(origin: CGPoint(x: context.availableSize.width - balance.size.width - 20.0, y: floor((66.0 - balance.size.height) * 0.5)), size: balance.size)
279+
context.add(balance
280+
.anchorPoint(CGPoint(x: 1.0, y: 0.0))
281+
.position(CGPoint(x: balanceFrame.maxX, y: balanceFrame.minY))
330282
)
331283
}
332-
284+
333285
var tonBalanceValue: StarsAmount = .zero
334286
if let tonBalance = state.tonBalance {
335287
tonBalanceValue = tonBalance
@@ -1836,6 +1788,7 @@ public final class AmountFieldComponent: Component {
18361788
text = "\(formatTonAmountText(value, dateTimeFormat: PresentationDateTimeFormat(timeFormat: component.dateTimeFormat.timeFormat, dateFormat: component.dateTimeFormat.dateFormat, dateSeparator: "", dateSuffix: "", requiresFullYear: false, decimalSeparator: ".", groupingSeparator: ""), maxDecimalPositions: nil))"
18371789
}
18381790
self.textField.text = text
1791+
self.placeholderView.view?.isHidden = text.isEmpty
18391792
} else {
18401793
self.textField.text = ""
18411794
}

0 commit comments

Comments
 (0)