diff --git a/Telegram/Telegram-iOS/en.lproj/Localizable.strings b/Telegram/Telegram-iOS/en.lproj/Localizable.strings index d9578e9b5f..8b8efcda09 100644 --- a/Telegram/Telegram-iOS/en.lproj/Localizable.strings +++ b/Telegram/Telegram-iOS/en.lproj/Localizable.strings @@ -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."; diff --git a/submodules/PremiumUI/Sources/PremiumIntroScreen.swift b/submodules/PremiumUI/Sources/PremiumIntroScreen.swift index e0961e864b..c8a4210d2b 100644 --- a/submodules/PremiumUI/Sources/PremiumIntroScreen.swift +++ b/submodules/PremiumUI/Sources/PremiumIntroScreen.swift @@ -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 { diff --git a/submodules/TelegramUI/Components/Gifts/GiftItemComponent/Sources/GiftItemComponent.swift b/submodules/TelegramUI/Components/Gifts/GiftItemComponent/Sources/GiftItemComponent.swift index 18b5cbff89..6af3bfcb3f 100644 --- a/submodules/TelegramUI/Components/Gifts/GiftItemComponent/Sources/GiftItemComponent.swift +++ b/submodules/TelegramUI/Components/Gifts/GiftItemComponent/Sources/GiftItemComponent.swift @@ -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: {}, diff --git a/submodules/TelegramUI/Components/Gifts/GiftViewScreen/Sources/GiftPurchaseAlertController.swift b/submodules/TelegramUI/Components/Gifts/GiftViewScreen/Sources/GiftPurchaseAlertController.swift index f7a10e0c95..04c429990f 100644 --- a/submodules/TelegramUI/Components/Gifts/GiftViewScreen/Sources/GiftPurchaseAlertController.swift +++ b/submodules/TelegramUI/Components/Gifts/GiftViewScreen/Sources/GiftPurchaseAlertController.swift @@ -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)) diff --git a/submodules/TelegramUI/Components/Gifts/GiftViewScreen/Sources/GiftViewScreen.swift b/submodules/TelegramUI/Components/Gifts/GiftViewScreen/Sources/GiftViewScreen.swift index 18ff93aa9e..05827b0c89 100644 --- a/submodules/TelegramUI/Components/Gifts/GiftViewScreen/Sources/GiftViewScreen.swift +++ b/submodules/TelegramUI/Components/Gifts/GiftViewScreen/Sources/GiftViewScreen.swift @@ -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)" diff --git a/submodules/TelegramUI/Components/Stars/StarsWithdrawalScreen/Sources/StarsWithdrawalScreen.swift b/submodules/TelegramUI/Components/Stars/StarsWithdrawalScreen/Sources/StarsWithdrawalScreen.swift index 4b1c4a94be..d21a0a07a9 100644 --- a/submodules/TelegramUI/Components/Stars/StarsWithdrawalScreen/Sources/StarsWithdrawalScreen.swift +++ b/submodules/TelegramUI/Components/Stars/StarsWithdrawalScreen/Sources/StarsWithdrawalScreen.swift @@ -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 )), diff --git a/submodules/TelegramUI/Images.xcassets/Premium/Collectible/Hidden.imageset/Contents.json b/submodules/TelegramUI/Images.xcassets/Premium/Collectible/Hidden.imageset/Contents.json new file mode 100644 index 0000000000..7732d87263 --- /dev/null +++ b/submodules/TelegramUI/Images.xcassets/Premium/Collectible/Hidden.imageset/Contents.json @@ -0,0 +1,12 @@ +{ + "images" : [ + { + "filename" : "hidded_18.pdf", + "idiom" : "universal" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/submodules/TelegramUI/Images.xcassets/Premium/Collectible/Hidden.imageset/hidded_18.pdf b/submodules/TelegramUI/Images.xcassets/Premium/Collectible/Hidden.imageset/hidded_18.pdf new file mode 100644 index 0000000000..e7924d3eb0 Binary files /dev/null and b/submodules/TelegramUI/Images.xcassets/Premium/Collectible/Hidden.imageset/hidded_18.pdf differ diff --git a/submodules/TelegramUI/Images.xcassets/Premium/TonGift.imageset/Contents.json b/submodules/TelegramUI/Images.xcassets/Premium/TonGift.imageset/Contents.json new file mode 100644 index 0000000000..03bebe5dd1 --- /dev/null +++ b/submodules/TelegramUI/Images.xcassets/Premium/TonGift.imageset/Contents.json @@ -0,0 +1,12 @@ +{ + "images" : [ + { + "filename" : "giftton.pdf", + "idiom" : "universal" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/submodules/TelegramUI/Images.xcassets/Premium/TonGift.imageset/giftton.pdf b/submodules/TelegramUI/Images.xcassets/Premium/TonGift.imageset/giftton.pdf new file mode 100644 index 0000000000..227fcf496b Binary files /dev/null and b/submodules/TelegramUI/Images.xcassets/Premium/TonGift.imageset/giftton.pdf differ