mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-11-30 03:44:18 +00:00
Various improvements
This commit is contained in:
parent
ef3512668c
commit
b9e5a3f3de
@ -15011,3 +15011,5 @@ Sorry for the inconvenience.";
|
||||
"Gift.Options.Gift.Filter.Collectibles" = "Collectibles";
|
||||
|
||||
"Gift.Options.Collectibles.Text" = "Collectible gifts are unique digital items you can exchange or sell.";
|
||||
|
||||
"Gift.Upgrade.UpgradeFor" = "Upgrade for %@";
|
||||
|
||||
@ -1268,8 +1268,8 @@ func _internal_upgradeStarGift(account: Account, formId: Int64?, reference: Star
|
||||
|
||||
public struct StarGiftUpgradePreview: Equatable {
|
||||
public struct Price: Equatable {
|
||||
let stars: Int64
|
||||
let date: Int32
|
||||
public let stars: Int64
|
||||
public let date: Int32
|
||||
}
|
||||
public let attributes: [StarGift.UniqueGift.Attribute]
|
||||
public let prices: [Price]
|
||||
|
||||
@ -4099,10 +4099,12 @@ private final class GiftViewSheetContent: CombinedComponent {
|
||||
var upgradeString = strings.Gift_Upgrade_Upgrade
|
||||
if !incoming {
|
||||
if let gift = state.starGiftsMap[giftId], let upgradeStars = gift.upgradeStars {
|
||||
upgradeString = strings.Gift_Upgrade_GiftUpgrade(" # \(upgradeStars)").string
|
||||
let priceString = presentationStringsFormattedNumber(Int32(clamping: upgradeStars), environment.dateTimeFormat.groupingSeparator)
|
||||
upgradeString = strings.Gift_Upgrade_GiftUpgrade(" # \(priceString)").string
|
||||
}
|
||||
} else if let upgradeForm = state.upgradeForm, let price = upgradeForm.invoice.prices.first?.amount {
|
||||
upgradeString += " # \(presentationStringsFormattedNumber(Int32(price), environment.dateTimeFormat.groupingSeparator))"
|
||||
let priceString = presentationStringsFormattedNumber(Int32(clamping: price), environment.dateTimeFormat.groupingSeparator)
|
||||
upgradeString = strings.Gift_Upgrade_UpgradeFor(" # \(priceString)").string
|
||||
}
|
||||
let buttonTitle = subject.arguments?.upgradeStars != nil ? strings.Gift_Upgrade_Confirm : upgradeString
|
||||
let buttonAttributedString = NSMutableAttributedString(string: buttonTitle, font: Font.semibold(17.0), textColor: theme.list.itemCheckColors.foregroundColor, paragraphAlignment: .center)
|
||||
|
||||
@ -259,9 +259,7 @@ public final class PeerInfoGiftsCoverComponent: Component {
|
||||
seed: self.seed
|
||||
)
|
||||
|
||||
let start = CACurrentMediaTime()
|
||||
self.iconPositions = positionGenerator.generatePositions(count: 12, itemSize: iconSize)
|
||||
print("generated icon positions in \( CACurrentMediaTime() - start )s")
|
||||
}
|
||||
self.appliedGiftIds = giftIds
|
||||
|
||||
|
||||
@ -1893,20 +1893,14 @@ final class PeerInfoHeaderNode: ASDisplayNode {
|
||||
apparentAvatarListFrame = apparentAvatarFrame
|
||||
controlsClippingFrame = apparentAvatarFrame
|
||||
}
|
||||
|
||||
let avatarClipOffset: CGFloat = !self.isAvatarExpanded && deviceMetrics.hasDynamicIsland && statusBarHeight > 0.0 && self.avatarClippingNode.clipsToBounds && !isLandscape ? 47.0 : 0.0
|
||||
let clippingNodeTransition = ContainedViewLayoutTransition.immediate
|
||||
clippingNodeTransition.updateFrame(layer: self.avatarClippingNode.layer, frame: CGRect(origin: CGPoint(x: 0.0, y: avatarClipOffset), size: CGSize(width: width, height: 1000.0)))
|
||||
clippingNodeTransition.updateSublayerTransformOffset(layer: self.avatarClippingNode.layer, offset: CGPoint(x: 0.0, y: -avatarClipOffset))
|
||||
let clippingNodeRadiusTransition = ContainedViewLayoutTransition.animated(duration: 0.15, curve: .easeInOut)
|
||||
clippingNodeRadiusTransition.updateCornerRadius(node: self.avatarClippingNode, cornerRadius: avatarClipOffset > 0.0 ? width / 2.5 : 0.0)
|
||||
|
||||
|
||||
let _ = apparentAvatarListFrame
|
||||
transition.updateFrameAdditive(node: self.avatarListNode, frame: CGRect(origin: apparentAvatarFrame.center, size: CGSize()))
|
||||
transition.updateFrameAdditive(node: self.avatarOverlayNode, frame: CGRect(origin: apparentAvatarFrame.center, size: CGSize()))
|
||||
|
||||
var avatarListContainerFrame: CGRect
|
||||
let avatarListContainerScale: CGFloat
|
||||
var avatarListVerticalOffset: CGFloat = 0.0
|
||||
if self.isAvatarExpanded {
|
||||
if let transitionSourceAvatarFrame = transitionSourceAvatarFrame {
|
||||
let neutralAvatarListContainerSize = expandedAvatarListSize
|
||||
@ -1923,13 +1917,21 @@ final class PeerInfoHeaderNode: ASDisplayNode {
|
||||
}
|
||||
avatarListContainerScale = 1.0 + max(0.0, -contentOffset / avatarListContainerFrame.width)
|
||||
let heightDelta = avatarListContainerFrame.height * avatarListContainerScale - avatarListContainerFrame.height
|
||||
avatarListContainerFrame.origin.y -= heightDelta / 4.0
|
||||
avatarListVerticalOffset = -heightDelta / 4.0
|
||||
} else {
|
||||
let expandHeightFraction = expandedAvatarListSize.height / expandedAvatarListSize.width
|
||||
avatarListContainerFrame = CGRect(origin: CGPoint(x: -apparentAvatarFrame.width / 2.0, y: -apparentAvatarFrame.width / 2.0 + expandHeightFraction * 0.0 * apparentAvatarFrame.width), size: apparentAvatarFrame.size)
|
||||
avatarListContainerScale = avatarScale
|
||||
}
|
||||
transition.updateFrame(node: self.avatarListNode.listContainerNode, frame: avatarListContainerFrame)
|
||||
|
||||
let avatarClipOffset: CGFloat = !self.isAvatarExpanded && deviceMetrics.hasDynamicIsland && statusBarHeight > 0.0 && self.avatarClippingNode.clipsToBounds && !isLandscape ? 47.0 : 0.0
|
||||
let clippingNodeTransition = ContainedViewLayoutTransition.immediate
|
||||
clippingNodeTransition.updateFrame(layer: self.avatarClippingNode.layer, frame: CGRect(origin: CGPoint(x: 0.0, y: avatarClipOffset + avatarListVerticalOffset), size: CGSize(width: width, height: 1000.0)))
|
||||
clippingNodeTransition.updateSublayerTransformOffset(layer: self.avatarClippingNode.layer, offset: CGPoint(x: 0.0, y: -avatarClipOffset))
|
||||
let clippingNodeRadiusTransition = ContainedViewLayoutTransition.animated(duration: 0.15, curve: .easeInOut)
|
||||
clippingNodeRadiusTransition.updateCornerRadius(node: self.avatarClippingNode, cornerRadius: avatarClipOffset > 0.0 ? width / 2.5 : 0.0)
|
||||
|
||||
let innerScale = avatarListContainerFrame.width / expandedAvatarListSize.width
|
||||
let innerDeltaX = (avatarListContainerFrame.width - expandedAvatarListSize.width) / 2.0
|
||||
var innerDeltaY = (avatarListContainerFrame.height - expandedAvatarListSize.height) / 2.0
|
||||
@ -2717,7 +2719,7 @@ final class PeerInfoHeaderNode: ASDisplayNode {
|
||||
if let _ = self.navigationTransition {
|
||||
transition.updateAlpha(layer: musicView.layer, alpha: 1.0 - transitionFraction)
|
||||
} else {
|
||||
musicTransition.updateAlpha(layer: musicView.layer, alpha: backgroundBannerAlpha)
|
||||
ContainedViewLayoutTransition.animated(duration: 0.2, curve: .easeInOut).updateAlpha(layer: musicView.layer, alpha: backgroundBannerAlpha)
|
||||
}
|
||||
}
|
||||
} else {
|
||||
|
||||
@ -448,16 +448,7 @@ private final class ProfileLevelInfoScreenComponent: Component {
|
||||
transition.setFrame(view: self.navigationBackgroundView, frame: navigationBackgroundFrame)
|
||||
self.navigationBackgroundView.update(size: navigationBackgroundFrame.size, cornerRadius: 10.0, maskedCorners: [.layerMinXMinYCorner, .layerMaxXMinYCorner], transition: transition.containedViewLayoutTransition)
|
||||
transition.setFrame(layer: self.navigationBarSeparator, frame: CGRect(origin: CGPoint(x: 0.0, y: 54.0), size: CGSize(width: availableSize.width, height: UIScreenPixel)))
|
||||
|
||||
let gradientColors: [UIColor]
|
||||
gradientColors = [
|
||||
environment.theme.list.itemCheckColors.fillColor,
|
||||
environment.theme.list.itemCheckColors.fillColor,
|
||||
environment.theme.list.itemCheckColors.fillColor,
|
||||
environment.theme.list.itemCheckColors.fillColor
|
||||
]
|
||||
let _ = gradientColors
|
||||
|
||||
|
||||
var levelFraction: CGFloat
|
||||
|
||||
let badgeText: String
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user