Merge commit '74cdd1816f360eb3a70bdc85432e390e329f2343'

This commit is contained in:
Isaac 2025-07-29 11:59:11 +02:00
commit c7bc6dc223
10 changed files with 74 additions and 25 deletions

View File

@ -14773,3 +14773,17 @@ Sorry for the inconvenience.";
"Gift.View.UpgradeDescription" = "Upgrade this gift to turn it to a unique collectible.";
"Gift.View.UpgradeFreeDescription" = "Upgrade this gift for free to turn it to a unique collectible.";
"Gift.View.EqualsTo" = "Equals to %@";
"Gift.Buy.AcceptsTonOnly" = "The seller only accepts\nTON as payment.";
"Gift.Buy.PayInStars" = "Pay in Stars";
"Gift.Buy.PayInTon" = "Pay in TON";
"Gift.Buy.PayInTon.Tooltip" = "Pay with TON to skip the 21-day wait before transferring the gift again.";
"Premium.PremiumGift.Title" = "Premium Gift";
"Premium.PremiumGift.Description" = "Subscribe to **Telegram Premium** to send up to **5** of these gifts and unlock access to multiple additional features.";
"Stars.SellGift.TonAmountTitle" = "PRICE IN TON";
"Stars.SellGift.OnlyTon" = "Only Accept TON";
"Stars.SellGift.OnlyTonInfo" = "If the buyer pays you in TON, there's no risk of refunds, unlike with Stars payments.";

View File

@ -1831,8 +1831,7 @@ private final class PremiumIntroScreenContentComponent: CombinedComponent {
var link = ""
let textString: String
if case .premiumGift = context.component.source {
//TODO:localize
textString = "Subscribe to **Telegram Premium** to send up to **5** of these gifts and unlock access to multiple additional features."
textString = strings.Premium_PremiumGift_Description
} else if case .emojiStatus = context.component.source {
textString = strings.Premium_EmojiStatusText.replacingOccurrences(of: "#", with: "# ")
} else if case .giftTerms = context.component.source {
@ -3459,8 +3458,7 @@ private final class PremiumIntroScreenComponent: CombinedComponent {
let titleString: String
if case .premiumGift = context.component.source {
//TODO:localize
titleString = "Premium Gift"
titleString = environment.strings.Premium_PremiumGift_Title
} else if case .business = context.component.mode {
titleString = environment.strings.Business_Title
} else if case .emojiStatus = context.component.source {

View File

@ -644,7 +644,7 @@ public final class GiftItemComponent: Component {
component: AnyComponent(
ZStack([
AnyComponentWithIdentity(id: "background", component: AnyComponent(RoundedRectangle(color: buttonColor, cornerRadius: 12.0))),
AnyComponentWithIdentity(id: "icon", component: AnyComponent(BundleIconComponent(name: "Ads/TonMedium", tintColor: .white, maxSize: CGSize(width: 13.0, height: 13.0))))
AnyComponentWithIdentity(id: "icon", component: AnyComponent(BundleIconComponent(name: "Premium/TonGift", tintColor: .white)))
])
),
environment: {},

View File

@ -161,12 +161,11 @@ private final class GiftPurchaseAlertContentNode: AlertContentNode {
}
if self.gift.resellForTonOnly {
//TODO:localize
let headerSize = self.header.update(
transition: .immediate,
component: AnyComponent(
MultilineTextComponent(
text: .plain(NSAttributedString(string: "The seller only accepts\nTON as payment.", font: Font.regular(13.0), textColor: self.presentationTheme.actionSheet.secondaryTextColor)),
text: .plain(NSAttributedString(string: self.strings.Gift_Buy_AcceptsTonOnly, font: Font.regular(13.0), textColor: self.presentationTheme.actionSheet.secondaryTextColor)),
horizontalAlignment: .center,
maximumNumberOfLines: 2
)
@ -184,7 +183,7 @@ private final class GiftPurchaseAlertContentNode: AlertContentNode {
origin.y += headerSize.height + 17.0
} else {
origin.y -= 4.0
//TODO:localize
let headerSize = self.header.update(
transition: ComponentTransition(transition),
component: AnyComponent(TabSelectorComponent(
@ -201,11 +200,11 @@ private final class GiftPurchaseAlertContentNode: AlertContentNode {
items: [
TabSelectorComponent.Item(
id: AnyHashable(0),
content: .text("Pay in Stars")
content: .text(self.strings.Gift_Buy_PayInStars)
),
TabSelectorComponent.Item(
id: AnyHashable(1),
content: .text("Pay in TON")
content: .text(self.strings.Gift_Buy_PayInTon)
)
],
selectedId: self.currency == .ton ? AnyHashable(1) : AnyHashable(0),
@ -499,8 +498,7 @@ public func giftPurchaseAlertController(
if let headerView = contentNode?.header.view {
let absoluteFrame = headerView.convert(headerView.bounds, to: nil)
let location = CGRect(origin: CGPoint(x: absoluteFrame.minX + floor(absoluteFrame.width * 0.75), y: absoluteFrame.minY - 8.0), size: CGSize())
//TODO:localize
let tooltipController = TooltipScreen(account: context.account, sharedContext: context.sharedContext, text: .plain(text: "Pay with TON to skip the 21-day wait before transferring the gift again."), style: .wide, location: .point(location, .bottom), displayDuration: .default, inset: 16.0, shouldDismissOnTouch: { _, _ in
let tooltipController = TooltipScreen(account: context.account, sharedContext: context.sharedContext, text: .plain(text: presentationData.strings.Gift_Buy_PayInTon_Tooltip), style: .wide, location: .point(location, .bottom), displayDuration: .default, inset: 16.0, shouldDismissOnTouch: { _, _ in
return .dismiss(consume: false)
})
controller.present(tooltipController, in: .window(.root))

View File

@ -98,6 +98,7 @@ private final class GiftViewSheetContent: CombinedComponent {
var cachedChevronImage: (UIImage, PresentationTheme)?
var cachedSmallChevronImage: (UIImage, PresentationTheme)?
var cachedHiddenImage: (UIImage, PresentationTheme)?
var inProgress = false
@ -3222,10 +3223,17 @@ private final class GiftViewSheetContent: CombinedComponent {
}
if ((incoming && !converted && !upgraded) || exported || selling) && (!showUpgradePreview && !showWearPreview) {
let textFont = Font.regular(13.0)
let textColor = theme.list.itemSecondaryTextColor
let linkColor = theme.actionSheet.controlAccentColor
if state.cachedSmallChevronImage == nil || state.cachedSmallChevronImage?.1 !== environment.theme {
state.cachedSmallChevronImage = (generateTintedImage(image: UIImage(bundleImageName: "Item List/InlineTextRightArrow"), color: linkColor)!, theme)
}
if state.cachedHiddenImage == nil || state.cachedHiddenImage?.1 !== environment.theme {
state.cachedHiddenImage = (generateTintedImage(image: UIImage(bundleImageName: "Premium/Collectible/Hidden"), color: textColor)!, theme)
}
var addressToOpen: String?
var descriptionText: String
if let uniqueGift, selling {
@ -3240,15 +3248,20 @@ private final class GiftViewSheetContent: CombinedComponent {
addressToOpen = address
descriptionText = strings.Gift_View_TonGiftAddressInfo
} else {
if isChannelGift {
descriptionText = savedToProfile ? strings.Gift_View_DisplayedInfoChannelNew : strings.Gift_View_HiddenInfoChannelNew
if canUpgrade || savedToProfile {
if isChannelGift {
descriptionText = savedToProfile ? strings.Gift_View_DisplayedInfoChannelNew : strings.Gift_View_HiddenInfoChannelNew
} else {
descriptionText = savedToProfile ? strings.Gift_View_DisplayedInfoNew : strings.Gift_View_HiddenInfoNew
}
} else {
descriptionText = savedToProfile ? strings.Gift_View_DisplayedInfoNew : strings.Gift_View_HiddenInfoNew
descriptionText = isChannelGift ? strings.Gift_View_UniqueHiddenInfo_Channel : strings.Gift_View_UniqueHiddenInfo
}
if !savedToProfile {
descriptionText = "# \(descriptionText)"
}
}
let textFont = Font.regular(13.0)
let textColor = theme.list.itemSecondaryTextColor
let markdownAttributes = MarkdownAttributes(body: MarkdownAttributeSet(font: textFont, textColor: textColor), bold: MarkdownAttributeSet(font: textFont, textColor: textColor), link: MarkdownAttributeSet(font: textFont, textColor: linkColor), linkAttribute: { contents in
return (TelegramTextAttributes.URL, contents)
})
@ -3258,6 +3271,10 @@ private final class GiftViewSheetContent: CombinedComponent {
if let range = attributedString.string.range(of: ">"), let chevronImage = state.cachedSmallChevronImage?.0 {
attributedString.addAttribute(.attachment, value: chevronImage, range: NSRange(range, in: attributedString.string))
}
if let range = attributedString.string.range(of: "#"), let hiddenImage = state.cachedHiddenImage?.0 {
attributedString.addAttribute(.attachment, value: hiddenImage, range: NSRange(range, in: attributedString.string))
attributedString.addAttribute(.baselineOffset, value: 1.5, range: NSRange(range, in: attributedString.string))
}
originY -= 5.0
let additionalText = additionalText.update(
@ -3266,6 +3283,7 @@ private final class GiftViewSheetContent: CombinedComponent {
horizontalAlignment: .center,
maximumNumberOfLines: 5,
lineSpacing: 0.2,
insets: UIEdgeInsets(top: 0.0, left: 2.0, bottom: 0.0, right: 2.0),
highlightColor: linkColor.withAlphaComponent(0.1),
highlightInset: UIEdgeInsets(top: 0.0, left: 0.0, bottom: 0.0, right: -8.0),
highlightAction: { attributes in
@ -3478,7 +3496,7 @@ private final class GiftViewSheetContent: CombinedComponent {
availableSize: buttonSize,
transition: context.transition
)
} else if incoming && !converted && !upgraded {
} else if incoming && !converted && !upgraded && canUpgrade {
let buttonTitle: String
if let upgradeStars, upgradeStars > 0 {
buttonTitle = strings.Gift_View_UpgradeForFree
@ -3555,8 +3573,7 @@ private final class GiftViewSheetContent: CombinedComponent {
currencyAmount = formatTonAmountText(resellAmount.amount.value, dateTimeFormat: environment.dateTimeFormat, maxDecimalPositions: nil)
if let starsAmount = uniqueGift?.resellAmounts?.first(where: { $0.currency == .stars }) {
//TODO:localize
buttonAttributedSubtitleString = NSMutableAttributedString(string: "Equals to # \(formatStarsAmountText(starsAmount.amount, dateTimeFormat: environment.dateTimeFormat))", font: Font.medium(11.0), textColor: theme.list.itemCheckColors.foregroundColor.withAlphaComponent(0.7), paragraphAlignment: .center)
buttonAttributedSubtitleString = NSMutableAttributedString(string: strings.Gift_View_EqualsTo(" # \(formatStarsAmountText(starsAmount.amount, dateTimeFormat: environment.dateTimeFormat))").string, font: Font.medium(11.0), textColor: theme.list.itemCheckColors.foregroundColor.withAlphaComponent(0.7), paragraphAlignment: .center)
}
}
buyString += " \(currencySymbol) \(currencyAmount)"

View File

@ -208,8 +208,7 @@ private final class SheetContent: CombinedComponent {
minAmount = StarsAmount(value: resaleConfiguration.starGiftResaleMinStarsAmount, nanos: 0)
maxAmount = StarsAmount(value: resaleConfiguration.starGiftResaleMaxStarsAmount, nanos: 0)
case .ton:
//TODO:localize
amountTitle = "PRICE IN TON"
amountTitle = environment.strings.Stars_SellGift_TonAmountTitle
minAmount = StarsAmount(value: resaleConfiguration.starGiftResaleMinTonAmount, nanos: 0)
maxAmount = StarsAmount(value: resaleConfiguration.starGiftResaleMaxTonAmount, nanos: 0)
}
@ -597,8 +596,7 @@ private final class SheetContent: CombinedComponent {
if case .starGiftResell = component.mode {
contentSize.height += 24.0
//TODO:localize
let onlyTonFooterString = NSAttributedString(attributedString: parseMarkdownIntoAttributedString("If the buyer pays you in TON, there's no risk of refunds, unlike with Stars payments.", attributes: amountMarkdownAttributes, textAlignment: .natural))
let onlyTonFooterString = NSAttributedString(attributedString: parseMarkdownIntoAttributedString(environment.strings.Stars_SellGift_OnlyTonInfo, attributes: amountMarkdownAttributes, textAlignment: .natural))
let onlyTonFooter = AnyComponent(MultilineTextComponent(
text: .plain(onlyTonFooterString),
maximumNumberOfLines: 0
@ -616,7 +614,7 @@ private final class SheetContent: CombinedComponent {
title: AnyComponent(VStack([
AnyComponentWithIdentity(id: AnyHashable(0), component: AnyComponent(MultilineTextComponent(
text: .plain(NSAttributedString(
string: "Only Accept TON",
string: environment.strings.Stars_SellGift_OnlyTon,
font: Font.regular(presentationData.listsFontSize.baseDisplaySize),
textColor: theme.list.itemPrimaryTextColor
)),

View File

@ -0,0 +1,12 @@
{
"images" : [
{
"filename" : "hidded_18.pdf",
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}

View File

@ -0,0 +1,12 @@
{
"images" : [
{
"filename" : "giftton.pdf",
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}