mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-12-24 07:05:35 +00:00
Various fixes
This commit is contained in:
@@ -15570,7 +15570,7 @@ Error: %8$@";
|
||||
"Gift.Variants.CollectionInfo.Symbol_1" = "**%@** unique symbol";
|
||||
"Gift.Variants.CollectionInfo.Symbol_any" = "**%@** unique symbols";
|
||||
|
||||
"Gift.Auction.GiftAuction" = "Upcoming Auction";
|
||||
"Gift.Auction.GiftAuction" = "Gift Auction";
|
||||
"Gift.Auction.UpcomingAuction" = "Upcoming Auction";
|
||||
"Gift.Auction.LearnMore" = "Learn more about Telegram Gifts >";
|
||||
|
||||
|
||||
@@ -514,6 +514,7 @@ public class ChatMessageForwardInfoNode: ASDisplayNode {
|
||||
}
|
||||
titleNode.frame = CGRect(origin: CGPoint(x: leftOffset, y: 0.0), size: titleLayout.size)
|
||||
|
||||
var nameFrame = CGRect()
|
||||
if let (nameLayout, nameApply) = nameLayoutAndApply {
|
||||
let nameNode = nameApply()
|
||||
if node.nameNode == nil {
|
||||
@@ -521,7 +522,8 @@ public class ChatMessageForwardInfoNode: ASDisplayNode {
|
||||
node.nameNode = nameNode
|
||||
node.addSubnode(nameNode)
|
||||
}
|
||||
nameNode.frame = CGRect(origin: CGPoint(x: leftOffset + authorAvatarInset, y: titleLayout.size.height + titleAuthorSpacing), size: nameLayout.size)
|
||||
nameFrame = CGRect(origin: CGPoint(x: leftOffset + authorAvatarInset, y: titleLayout.size.height + titleAuthorSpacing), size: nameLayout.size)
|
||||
nameNode.frame = nameFrame
|
||||
|
||||
if authorAvatarInset != 0.0 {
|
||||
let avatarNode: AvatarNode
|
||||
@@ -599,7 +601,7 @@ public class ChatMessageForwardInfoNode: ASDisplayNode {
|
||||
node.credibilityIconNode = credibilityIconNode
|
||||
node.addSubnode(credibilityIconNode)
|
||||
}
|
||||
credibilityIconNode.frame = CGRect(origin: CGPoint(x: titleLayout.size.width + 4.0, y: 16.0), size: credibilityIconImage.size)
|
||||
credibilityIconNode.frame = CGRect(origin: CGPoint(x: nameFrame.maxX + 4.0, y: 17.0), size: credibilityIconImage.size)
|
||||
credibilityIconNode.image = credibilityIconImage
|
||||
} else {
|
||||
node.credibilityIconNode?.removeFromSupernode()
|
||||
|
||||
@@ -66,9 +66,6 @@ private final class SheetContent: CombinedComponent {
|
||||
let timestampSection = Child(ListSectionComponent.self)
|
||||
let onlyTonSection = Child(ListSectionComponent.self)
|
||||
let button = Child(ButtonComponent.self)
|
||||
let balanceTitle = Child(MultilineTextComponent.self)
|
||||
let balanceValue = Child(MultilineTextComponent.self)
|
||||
let balanceIcon = Child(BundleIconComponent.self)
|
||||
let durationPicker = Child(MenuComponent.self)
|
||||
|
||||
let body: (CombinedComponentContext<SheetContent>) -> CGSize = { (context: CombinedComponentContext<SheetContent>) -> CGSize in
|
||||
@@ -88,37 +85,7 @@ private final class SheetContent: CombinedComponent {
|
||||
var contentSize = CGSize(width: context.availableSize.width, height: 18.0)
|
||||
|
||||
let constrainedTitleWidth = context.availableSize.width - 16.0 * 2.0
|
||||
|
||||
if case let .suggestedPost(mode, _, _, _) = component.mode {
|
||||
var displayBalance = false
|
||||
switch mode {
|
||||
case let .sender(_, isFromAdmin):
|
||||
displayBalance = !isFromAdmin
|
||||
case .admin:
|
||||
break
|
||||
}
|
||||
|
||||
if displayBalance {
|
||||
let balance = balance.update(
|
||||
component: BalanceComponent(
|
||||
context: component.context,
|
||||
theme: environment.theme,
|
||||
strings: environment.strings,
|
||||
currency: state.currency,
|
||||
balance: state.currency == .stars ? state.starsBalance : state.tonBalance,
|
||||
alignment: .right
|
||||
),
|
||||
availableSize: CGSize(width: 200.0, height: 200.0),
|
||||
transition: .immediate
|
||||
)
|
||||
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)
|
||||
context.add(balance
|
||||
.anchorPoint(CGPoint(x: 1.0, y: 0.0))
|
||||
.position(CGPoint(x: balanceFrame.maxX, y: balanceFrame.minY))
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
let closeButton = closeButton.update(
|
||||
component: GlassBarButtonComponent(
|
||||
size: CGSize(width: 40.0, height: 40.0),
|
||||
@@ -276,60 +243,45 @@ private final class SheetContent: CombinedComponent {
|
||||
contentSize.height += title.size.height
|
||||
contentSize.height += 56.0
|
||||
|
||||
let balance: StarsAmount?
|
||||
if case .accountWithdraw = component.mode {
|
||||
balance = state.starsBalance
|
||||
} else if case .reaction = component.mode {
|
||||
balance = state.starsBalance
|
||||
} else if case let .withdraw(starsState, _) = component.mode {
|
||||
balance = starsState.balances.availableBalance.amount
|
||||
} else {
|
||||
balance = nil
|
||||
var displayBalance = false
|
||||
var currentBalance = state.currency == .stars ? state.starsBalance : state.tonBalance
|
||||
switch component.mode {
|
||||
case .accountWithdraw, .reaction:
|
||||
displayBalance = true
|
||||
case let .suggestedPost(mode, _, _, _):
|
||||
switch mode {
|
||||
case let .sender(_, isFromAdmin):
|
||||
displayBalance = !isFromAdmin
|
||||
case .admin:
|
||||
break
|
||||
}
|
||||
case let .withdraw(starsState, _):
|
||||
currentBalance = starsState.balances.availableBalance.amount
|
||||
displayBalance = true
|
||||
default:
|
||||
break
|
||||
}
|
||||
|
||||
if let balance {
|
||||
let balanceTitle = balanceTitle.update(
|
||||
component: MultilineTextComponent(
|
||||
text: .plain(NSAttributedString(
|
||||
string: environment.strings.Stars_Transfer_Balance,
|
||||
font: Font.regular(14.0),
|
||||
textColor: theme.list.itemPrimaryTextColor
|
||||
)),
|
||||
maximumNumberOfLines: 1
|
||||
|
||||
if displayBalance {
|
||||
let balance = balance.update(
|
||||
component: BalanceComponent(
|
||||
context: component.context,
|
||||
theme: environment.theme,
|
||||
strings: environment.strings,
|
||||
currency: state.currency,
|
||||
balance: currentBalance,
|
||||
alignment: .right
|
||||
),
|
||||
availableSize: context.availableSize,
|
||||
availableSize: CGSize(width: 200.0, height: 200.0),
|
||||
transition: .immediate
|
||||
)
|
||||
let balanceValue = balanceValue.update(
|
||||
component: MultilineTextComponent(
|
||||
text: .plain(NSAttributedString(
|
||||
string: presentationStringsFormattedNumber(balance, environment.dateTimeFormat.groupingSeparator),
|
||||
font: Font.semibold(16.0),
|
||||
textColor: theme.list.itemPrimaryTextColor
|
||||
)),
|
||||
maximumNumberOfLines: 1
|
||||
),
|
||||
availableSize: context.availableSize,
|
||||
transition: .immediate
|
||||
)
|
||||
let balanceIcon = balanceIcon.update(
|
||||
component: BundleIconComponent(name: "Premium/Stars/StarSmall", tintColor: nil),
|
||||
availableSize: context.availableSize,
|
||||
transition: .immediate
|
||||
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)
|
||||
context.add(balance
|
||||
.anchorPoint(CGPoint(x: 1.0, y: 0.0))
|
||||
.position(CGPoint(x: balanceFrame.maxX, y: balanceFrame.minY))
|
||||
)
|
||||
}
|
||||
|
||||
let topBalanceOriginY = 11.0
|
||||
context.add(balanceTitle
|
||||
.position(CGPoint(x: 16.0 + environment.safeInsets.left + balanceTitle.size.width / 2.0, y: topBalanceOriginY + balanceTitle.size.height / 2.0))
|
||||
)
|
||||
context.add(balanceIcon
|
||||
.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))
|
||||
)
|
||||
context.add(balanceValue
|
||||
.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))
|
||||
)
|
||||
}
|
||||
|
||||
var tonBalanceValue: StarsAmount = .zero
|
||||
if let tonBalance = state.tonBalance {
|
||||
tonBalanceValue = tonBalance
|
||||
@@ -1836,6 +1788,7 @@ public final class AmountFieldComponent: Component {
|
||||
text = "\(formatTonAmountText(value, dateTimeFormat: PresentationDateTimeFormat(timeFormat: component.dateTimeFormat.timeFormat, dateFormat: component.dateTimeFormat.dateFormat, dateSeparator: "", dateSuffix: "", requiresFullYear: false, decimalSeparator: ".", groupingSeparator: ""), maxDecimalPositions: nil))"
|
||||
}
|
||||
self.textField.text = text
|
||||
self.placeholderView.view?.isHidden = text.isEmpty
|
||||
} else {
|
||||
self.textField.text = ""
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user