Merge commit 'e3ed629d8f3a081a0861d1359b5b26575aa911a5'

This commit is contained in:
Isaac 2025-07-28 18:00:27 +02:00
commit 83f60686c8
4 changed files with 45 additions and 30 deletions

View File

@ -14762,3 +14762,14 @@ Sorry for the inconvenience.";
"FaceScan.Instruction.Rotate" = "Move your head slowly to\ncomplete the circle"; "FaceScan.Instruction.Rotate" = "Move your head slowly to\ncomplete the circle";
"Gift.Buy.Confirm.BuyForTon" = "Buy for %@ TON"; "Gift.Buy.Confirm.BuyForTon" = "Buy for %@ TON";
"Gift.View.DisplayedInfoNew" = "This gift is visible. [Hide from Profile >]()";
"Gift.View.HiddenInfoNew" = "This gift is hidden. [Show on Profile >]()";
"Gift.View.DisplayedInfoChannelNew" = "This gift is visible. [Hide from Profile >]()";
"Gift.View.HiddenInfoChannelNew" = "This gift is hidden. [Show on Profile >]()";
"Gift.View.Upgrade" = "Upgrade";
"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.";

View File

@ -2239,7 +2239,11 @@ private final class GiftViewSheetContent: CombinedComponent {
} else if let convertStars, !upgraded { } else if let convertStars, !upgraded {
if !converted { if !converted {
if canUpgrade || upgradeStars != nil { if canUpgrade || upgradeStars != nil {
descriptionText = isChannelGift ? strings.Gift_View_KeepUpgradeOrConvertDescription_Channel(strings.Gift_View_KeepOrConvertDescription_Stars(Int32(convertStars))).string : strings.Gift_View_KeepUpgradeOrConvertDescription(strings.Gift_View_KeepOrConvertDescription_Stars(Int32(convertStars))).string if let upgradeStars, upgradeStars > 0 {
descriptionText = strings.Gift_View_UpgradeFreeDescription
} else {
descriptionText = strings.Gift_View_UpgradeDescription
}
} else { } else {
descriptionText = isChannelGift ? strings.Gift_View_KeepOrConvertDescription_Channel(strings.Gift_View_KeepOrConvertDescription_Stars(Int32(convertStars))).string : strings.Gift_View_KeepOrConvertDescription(strings.Gift_View_KeepOrConvertDescription_Stars(Int32(convertStars))).string descriptionText = isChannelGift ? strings.Gift_View_KeepOrConvertDescription_Channel(strings.Gift_View_KeepOrConvertDescription_Stars(Int32(convertStars))).string : strings.Gift_View_KeepOrConvertDescription(strings.Gift_View_KeepOrConvertDescription_Stars(Int32(convertStars))).string
} }
@ -3047,6 +3051,17 @@ private final class GiftViewSheetContent: CombinedComponent {
canConvert = false canConvert = false
} }
} }
if canConvert, let date = subject.arguments?.date {
let configuration = GiftConfiguration.with(appConfiguration: component.context.currentAppConfiguration.with { $0 })
let starsConvertMaxDate = date + configuration.convertToStarsPeriod
let currentTime = Int32(CFAbsoluteTimeGetCurrent() + kCFAbsoluteTimeIntervalSince1970)
if currentTime > starsConvertMaxDate {
canConvert = false
}
}
if let convertStars, incoming && !converted && canConvert { if let convertStars, incoming && !converted && canConvert {
tableItems.append(.init( tableItems.append(.init(
id: "value_convert", id: "value_convert",
@ -3121,23 +3136,6 @@ private final class GiftViewSheetContent: CombinedComponent {
component: AnyComponent(MultilineTextComponent(text: .plain(NSAttributedString(string: strings.Gift_View_Status_NonUnique, font: tableFont, textColor: tableTextColor)))) component: AnyComponent(MultilineTextComponent(text: .plain(NSAttributedString(string: strings.Gift_View_Status_NonUnique, font: tableFont, textColor: tableTextColor))))
) )
) )
if incoming {
items.append(
AnyComponentWithIdentity(
id: AnyHashable(1),
component: AnyComponent(Button(
content: AnyComponent(ButtonContentComponent(
context: component.context,
text: strings.Gift_View_Status_Upgrade,
color: theme.list.itemAccentColor
)),
action: { [weak state] in
state?.requestUpgradePreview()
}
))
)
)
}
tableItems.append(.init( tableItems.append(.init(
id: "status", id: "status",
title: strings.Gift_View_Status, title: strings.Gift_View_Status,
@ -3241,15 +3239,11 @@ private final class GiftViewSheetContent: CombinedComponent {
} else if let uniqueGift, let address = uniqueGift.giftAddress, case .address = uniqueGift.owner { } else if let uniqueGift, let address = uniqueGift.giftAddress, case .address = uniqueGift.owner {
addressToOpen = address addressToOpen = address
descriptionText = strings.Gift_View_TonGiftAddressInfo descriptionText = strings.Gift_View_TonGiftAddressInfo
} else if savedToProfile {
descriptionText = isChannelGift ? strings.Gift_View_DisplayedInfoHide_Channel : strings.Gift_View_DisplayedInfoHide
} else if let upgradeStars, upgradeStars > 0 && !upgraded {
descriptionText = isChannelGift ? strings.Gift_View_HiddenInfoShow_Channel : strings.Gift_View_HiddenInfoShow
} else { } else {
if let _ = uniqueGift { if isChannelGift {
descriptionText = isChannelGift ? strings.Gift_View_UniqueHiddenInfo_Channel : strings.Gift_View_UniqueHiddenInfo descriptionText = savedToProfile ? strings.Gift_View_DisplayedInfoChannelNew : strings.Gift_View_HiddenInfoChannelNew
} else { } else {
descriptionText = isChannelGift ? strings.Gift_View_HiddenInfo_Channel : strings.Gift_View_HiddenInfo descriptionText = savedToProfile ? strings.Gift_View_DisplayedInfoNew : strings.Gift_View_HiddenInfoNew
} }
} }
@ -3484,13 +3478,18 @@ private final class GiftViewSheetContent: CombinedComponent {
availableSize: buttonSize, availableSize: buttonSize,
transition: context.transition transition: context.transition
) )
} else if incoming && !converted && !upgraded, let upgradeStars, upgradeStars > 0 { } else if incoming && !converted && !upgraded {
let buttonTitle = strings.Gift_View_UpgradeForFree let buttonTitle: String
if let upgradeStars, upgradeStars > 0 {
buttonTitle = strings.Gift_View_UpgradeForFree
} else {
buttonTitle = strings.Gift_View_Upgrade
}
buttonChild = button.update( buttonChild = button.update(
component: ButtonComponent( component: ButtonComponent(
background: buttonBackground.withIsShimmering(true), background: buttonBackground.withIsShimmering(true),
content: AnyComponentWithIdentity( content: AnyComponentWithIdentity(
id: AnyHashable("freeUpgrade"), id: AnyHashable("previewUpgrade"),
component: AnyComponent(HStack([ component: AnyComponent(HStack([
AnyComponentWithIdentity(id: 0, component: AnyComponent( AnyComponentWithIdentity(id: 0, component: AnyComponent(
MultilineTextComponent(text: .plain(NSAttributedString(string: buttonTitle, font: Font.semibold(17.0), textColor: theme.list.itemCheckColors.foregroundColor, paragraphAlignment: .center)) MultilineTextComponent(text: .plain(NSAttributedString(string: buttonTitle, font: Font.semibold(17.0), textColor: theme.list.itemCheckColors.foregroundColor, paragraphAlignment: .center))

View File

@ -618,7 +618,7 @@ public final class PeerInfoGiftsPaneNode: ASDisplayNode, PeerInfoPaneNode, UIScr
context: self.context, context: self.context,
colors: TabSelectorComponent.Colors( colors: TabSelectorComponent.Colors(
foreground: params.presentationData.theme.list.itemSecondaryTextColor, foreground: params.presentationData.theme.list.itemSecondaryTextColor,
selection: params.presentationData.theme.list.itemPrimaryTextColor.withMultipliedAlpha(0.05), selection: params.presentationData.theme.list.itemSecondaryTextColor.withMultipliedAlpha(0.15),
simple: true simple: true
), ),
theme: params.presentationData.theme, theme: params.presentationData.theme,

View File

@ -927,8 +927,13 @@ private final class StarsTransactionSheetContent: CombinedComponent {
title = count.amount < StarsAmount.zero || countIsGeneric ? strings.Stars_Transaction_To : strings.Stars_Transaction_From title = count.amount < StarsAmount.zero || countIsGeneric ? strings.Stars_Transaction_To : strings.Stars_Transaction_From
} }
var isGiftResale = false
if count.amount < StarsAmount.zero, case let .transaction(transaction, _) = subject, transaction.flags.contains(.isStarGiftResale) {
isGiftResale = true
}
let toComponent: AnyComponent<Empty> let toComponent: AnyComponent<Empty>
if let _ = giftAnimationSubject, !toPeer.isDeleted && !isGiftUpgrade { if let _ = giftAnimationSubject, !toPeer.isDeleted && !isGiftUpgrade && !isGiftResale {
toComponent = AnyComponent( toComponent = AnyComponent(
HStack([ HStack([
AnyComponentWithIdentity( AnyComponentWithIdentity(