Skip to content

Commit 14ee4b5

Browse files
committed
Various improvements
1 parent 1da6943 commit 14ee4b5

File tree

10 files changed

+66
-21
lines changed

10 files changed

+66
-21
lines changed

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

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14773,3 +14773,17 @@ Sorry for the inconvenience.";
1477314773

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

submodules/PremiumUI/Sources/PremiumIntroScreen.swift

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1831,8 +1831,7 @@ private final class PremiumIntroScreenContentComponent: CombinedComponent {
18311831
var link = ""
18321832
let textString: String
18331833
if case .premiumGift = context.component.source {
1834-
//TODO:localize
1835-
textString = "Subscribe to **Telegram Premium** to send up to **5** of these gifts and unlock access to multiple additional features."
1834+
textString = strings.Premium_PremiumGift_Description
18361835
} else if case .emojiStatus = context.component.source {
18371836
textString = strings.Premium_EmojiStatusText.replacingOccurrences(of: "#", with: "# ")
18381837
} else if case .giftTerms = context.component.source {
@@ -3459,8 +3458,7 @@ private final class PremiumIntroScreenComponent: CombinedComponent {
34593458

34603459
let titleString: String
34613460
if case .premiumGift = context.component.source {
3462-
//TODO:localize
3463-
titleString = "Premium Gift"
3461+
titleString = environment.strings.Premium_PremiumGift_Title
34643462
} else if case .business = context.component.mode {
34653463
titleString = environment.strings.Business_Title
34663464
} else if case .emojiStatus = context.component.source {

submodules/TelegramUI/Components/Gifts/GiftItemComponent/Sources/GiftItemComponent.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -644,7 +644,7 @@ public final class GiftItemComponent: Component {
644644
component: AnyComponent(
645645
ZStack([
646646
AnyComponentWithIdentity(id: "background", component: AnyComponent(RoundedRectangle(color: buttonColor, cornerRadius: 12.0))),
647-
AnyComponentWithIdentity(id: "icon", component: AnyComponent(BundleIconComponent(name: "Ads/TonMedium", tintColor: .white, maxSize: CGSize(width: 13.0, height: 13.0))))
647+
AnyComponentWithIdentity(id: "icon", component: AnyComponent(BundleIconComponent(name: "Premium/TonGift", tintColor: .white)))
648648
])
649649
),
650650
environment: {},

submodules/TelegramUI/Components/Gifts/GiftViewScreen/Sources/GiftPurchaseAlertController.swift

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -161,12 +161,11 @@ private final class GiftPurchaseAlertContentNode: AlertContentNode {
161161
}
162162

163163
if self.gift.resellForTonOnly {
164-
//TODO:localize
165164
let headerSize = self.header.update(
166165
transition: .immediate,
167166
component: AnyComponent(
168167
MultilineTextComponent(
169-
text: .plain(NSAttributedString(string: "The seller only accepts\nTON as payment.", font: Font.regular(13.0), textColor: self.presentationTheme.actionSheet.secondaryTextColor)),
168+
text: .plain(NSAttributedString(string: self.strings.Gift_Buy_AcceptsTonOnly, font: Font.regular(13.0), textColor: self.presentationTheme.actionSheet.secondaryTextColor)),
170169
horizontalAlignment: .center,
171170
maximumNumberOfLines: 2
172171
)
@@ -184,7 +183,7 @@ private final class GiftPurchaseAlertContentNode: AlertContentNode {
184183
origin.y += headerSize.height + 17.0
185184
} else {
186185
origin.y -= 4.0
187-
//TODO:localize
186+
188187
let headerSize = self.header.update(
189188
transition: ComponentTransition(transition),
190189
component: AnyComponent(TabSelectorComponent(
@@ -201,11 +200,11 @@ private final class GiftPurchaseAlertContentNode: AlertContentNode {
201200
items: [
202201
TabSelectorComponent.Item(
203202
id: AnyHashable(0),
204-
content: .text("Pay in Stars")
203+
content: .text(self.strings.Gift_Buy_PayInStars)
205204
),
206205
TabSelectorComponent.Item(
207206
id: AnyHashable(1),
208-
content: .text("Pay in TON")
207+
content: .text(self.strings.Gift_Buy_PayInTon)
209208
)
210209
],
211210
selectedId: self.currency == .ton ? AnyHashable(1) : AnyHashable(0),
@@ -499,8 +498,7 @@ public func giftPurchaseAlertController(
499498
if let headerView = contentNode?.header.view {
500499
let absoluteFrame = headerView.convert(headerView.bounds, to: nil)
501500
let location = CGRect(origin: CGPoint(x: absoluteFrame.minX + floor(absoluteFrame.width * 0.75), y: absoluteFrame.minY - 8.0), size: CGSize())
502-
//TODO:localize
503-
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
501+
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
504502
return .dismiss(consume: false)
505503
})
506504
controller.present(tooltipController, in: .window(.root))

submodules/TelegramUI/Components/Gifts/GiftViewScreen/Sources/GiftViewScreen.swift

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,7 @@ private final class GiftViewSheetContent: CombinedComponent {
9898

9999
var cachedChevronImage: (UIImage, PresentationTheme)?
100100
var cachedSmallChevronImage: (UIImage, PresentationTheme)?
101+
var cachedHiddenImage: (UIImage, PresentationTheme)?
101102

102103
var inProgress = false
103104

@@ -3222,10 +3223,17 @@ private final class GiftViewSheetContent: CombinedComponent {
32223223
}
32233224

32243225
if ((incoming && !converted && !upgraded) || exported || selling) && (!showUpgradePreview && !showWearPreview) {
3226+
let textFont = Font.regular(13.0)
3227+
let textColor = theme.list.itemSecondaryTextColor
32253228
let linkColor = theme.actionSheet.controlAccentColor
3229+
32263230
if state.cachedSmallChevronImage == nil || state.cachedSmallChevronImage?.1 !== environment.theme {
32273231
state.cachedSmallChevronImage = (generateTintedImage(image: UIImage(bundleImageName: "Item List/InlineTextRightArrow"), color: linkColor)!, theme)
32283232
}
3233+
if state.cachedHiddenImage == nil || state.cachedHiddenImage?.1 !== environment.theme {
3234+
state.cachedHiddenImage = (generateTintedImage(image: UIImage(bundleImageName: "Premium/Collectible/Hidden"), color: textColor)!, theme)
3235+
}
3236+
32293237
var addressToOpen: String?
32303238
var descriptionText: String
32313239
if let uniqueGift, selling {
@@ -3245,10 +3253,11 @@ private final class GiftViewSheetContent: CombinedComponent {
32453253
} else {
32463254
descriptionText = savedToProfile ? strings.Gift_View_DisplayedInfoNew : strings.Gift_View_HiddenInfoNew
32473255
}
3256+
if !savedToProfile {
3257+
descriptionText = "# \(descriptionText)"
3258+
}
32483259
}
32493260

3250-
let textFont = Font.regular(13.0)
3251-
let textColor = theme.list.itemSecondaryTextColor
32523261
let markdownAttributes = MarkdownAttributes(body: MarkdownAttributeSet(font: textFont, textColor: textColor), bold: MarkdownAttributeSet(font: textFont, textColor: textColor), link: MarkdownAttributeSet(font: textFont, textColor: linkColor), linkAttribute: { contents in
32533262
return (TelegramTextAttributes.URL, contents)
32543263
})
@@ -3258,6 +3267,10 @@ private final class GiftViewSheetContent: CombinedComponent {
32583267
if let range = attributedString.string.range(of: ">"), let chevronImage = state.cachedSmallChevronImage?.0 {
32593268
attributedString.addAttribute(.attachment, value: chevronImage, range: NSRange(range, in: attributedString.string))
32603269
}
3270+
if let range = attributedString.string.range(of: "#"), let hiddenImage = state.cachedHiddenImage?.0 {
3271+
attributedString.addAttribute(.attachment, value: hiddenImage, range: NSRange(range, in: attributedString.string))
3272+
attributedString.addAttribute(.baselineOffset, value: 1.5, range: NSRange(range, in: attributedString.string))
3273+
}
32613274

32623275
originY -= 5.0
32633276
let additionalText = additionalText.update(
@@ -3266,6 +3279,7 @@ private final class GiftViewSheetContent: CombinedComponent {
32663279
horizontalAlignment: .center,
32673280
maximumNumberOfLines: 5,
32683281
lineSpacing: 0.2,
3282+
insets: UIEdgeInsets(top: 0.0, left: 2.0, bottom: 0.0, right: 2.0),
32693283
highlightColor: linkColor.withAlphaComponent(0.1),
32703284
highlightInset: UIEdgeInsets(top: 0.0, left: 0.0, bottom: 0.0, right: -8.0),
32713285
highlightAction: { attributes in
@@ -3555,8 +3569,7 @@ private final class GiftViewSheetContent: CombinedComponent {
35553569
currencyAmount = formatTonAmountText(resellAmount.amount.value, dateTimeFormat: environment.dateTimeFormat, maxDecimalPositions: nil)
35563570

35573571
if let starsAmount = uniqueGift?.resellAmounts?.first(where: { $0.currency == .stars }) {
3558-
//TODO:localize
3559-
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)
3572+
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)
35603573
}
35613574
}
35623575
buyString += " \(currencySymbol) \(currencyAmount)"

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

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -208,8 +208,7 @@ private final class SheetContent: CombinedComponent {
208208
minAmount = StarsAmount(value: resaleConfiguration.starGiftResaleMinStarsAmount, nanos: 0)
209209
maxAmount = StarsAmount(value: resaleConfiguration.starGiftResaleMaxStarsAmount, nanos: 0)
210210
case .ton:
211-
//TODO:localize
212-
amountTitle = "PRICE IN TON"
211+
amountTitle = environment.strings.Stars_SellGift_TonAmountTitle
213212
minAmount = StarsAmount(value: resaleConfiguration.starGiftResaleMinTonAmount, nanos: 0)
214213
maxAmount = StarsAmount(value: resaleConfiguration.starGiftResaleMaxTonAmount, nanos: 0)
215214
}
@@ -597,8 +596,7 @@ private final class SheetContent: CombinedComponent {
597596
if case .starGiftResell = component.mode {
598597
contentSize.height += 24.0
599598

600-
//TODO:localize
601-
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))
599+
let onlyTonFooterString = NSAttributedString(attributedString: parseMarkdownIntoAttributedString(environment.strings.Stars_SellGift_OnlyTonInfo, attributes: amountMarkdownAttributes, textAlignment: .natural))
602600
let onlyTonFooter = AnyComponent(MultilineTextComponent(
603601
text: .plain(onlyTonFooterString),
604602
maximumNumberOfLines: 0
@@ -616,7 +614,7 @@ private final class SheetContent: CombinedComponent {
616614
title: AnyComponent(VStack([
617615
AnyComponentWithIdentity(id: AnyHashable(0), component: AnyComponent(MultilineTextComponent(
618616
text: .plain(NSAttributedString(
619-
string: "Only Accept TON",
617+
string: environment.strings.Stars_SellGift_OnlyTon,
620618
font: Font.regular(presentationData.listsFontSize.baseDisplaySize),
621619
textColor: theme.list.itemPrimaryTextColor
622620
)),
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
{
2+
"images" : [
3+
{
4+
"filename" : "hidded_18.pdf",
5+
"idiom" : "universal"
6+
}
7+
],
8+
"info" : {
9+
"author" : "xcode",
10+
"version" : 1
11+
}
12+
}
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
{
2+
"images" : [
3+
{
4+
"filename" : "giftton.pdf",
5+
"idiom" : "universal"
6+
}
7+
],
8+
"info" : {
9+
"author" : "xcode",
10+
"version" : 1
11+
}
12+
}
Binary file not shown.

0 commit comments

Comments
 (0)