@@ -2239,7 +2239,11 @@ private final class GiftViewSheetContent: CombinedComponent {
2239
2239
} else if let convertStars, !upgraded {
2240
2240
if !converted {
2241
2241
if canUpgrade || upgradeStars != nil {
2242
- 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
2242
+ if let upgradeStars, upgradeStars > 0 {
2243
+ descriptionText = strings. Gift_View_UpgradeFreeDescription
2244
+ } else {
2245
+ descriptionText = strings. Gift_View_UpgradeDescription
2246
+ }
2243
2247
} else {
2244
2248
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
2245
2249
}
@@ -3047,6 +3051,17 @@ private final class GiftViewSheetContent: CombinedComponent {
3047
3051
canConvert = false
3048
3052
}
3049
3053
}
3054
+
3055
+ if canConvert, let date = subject. arguments? . date {
3056
+ let configuration = GiftConfiguration . with ( appConfiguration: component. context. currentAppConfiguration. with { $0 } )
3057
+ let starsConvertMaxDate = date + configuration. convertToStarsPeriod
3058
+
3059
+ let currentTime = Int32 ( CFAbsoluteTimeGetCurrent ( ) + kCFAbsoluteTimeIntervalSince1970)
3060
+ if currentTime > starsConvertMaxDate {
3061
+ canConvert = false
3062
+ }
3063
+ }
3064
+
3050
3065
if let convertStars, incoming && !converted && canConvert {
3051
3066
tableItems. append ( . init(
3052
3067
id: " value_convert " ,
@@ -3121,23 +3136,6 @@ private final class GiftViewSheetContent: CombinedComponent {
3121
3136
component: AnyComponent ( MultilineTextComponent ( text: . plain( NSAttributedString ( string: strings. Gift_View_Status_NonUnique, font: tableFont, textColor: tableTextColor) ) ) )
3122
3137
)
3123
3138
)
3124
- if incoming {
3125
- items. append (
3126
- AnyComponentWithIdentity (
3127
- id: AnyHashable ( 1 ) ,
3128
- component: AnyComponent ( Button (
3129
- content: AnyComponent ( ButtonContentComponent (
3130
- context: component. context,
3131
- text: strings. Gift_View_Status_Upgrade,
3132
- color: theme. list. itemAccentColor
3133
- ) ) ,
3134
- action: { [ weak state] in
3135
- state? . requestUpgradePreview ( )
3136
- }
3137
- ) )
3138
- )
3139
- )
3140
- }
3141
3139
tableItems. append ( . init(
3142
3140
id: " status " ,
3143
3141
title: strings. Gift_View_Status,
@@ -3241,15 +3239,11 @@ private final class GiftViewSheetContent: CombinedComponent {
3241
3239
} else if let uniqueGift, let address = uniqueGift. giftAddress, case . address = uniqueGift. owner {
3242
3240
addressToOpen = address
3243
3241
descriptionText = strings. Gift_View_TonGiftAddressInfo
3244
- } else if savedToProfile {
3245
- descriptionText = isChannelGift ? strings. Gift_View_DisplayedInfoHide_Channel : strings. Gift_View_DisplayedInfoHide
3246
- } else if let upgradeStars, upgradeStars > 0 && !upgraded {
3247
- descriptionText = isChannelGift ? strings. Gift_View_HiddenInfoShow_Channel : strings. Gift_View_HiddenInfoShow
3248
3242
} else {
3249
- if let _ = uniqueGift {
3250
- descriptionText = isChannelGift ? strings. Gift_View_UniqueHiddenInfo_Channel : strings. Gift_View_UniqueHiddenInfo
3243
+ if isChannelGift {
3244
+ descriptionText = savedToProfile ? strings. Gift_View_DisplayedInfoChannelNew : strings. Gift_View_HiddenInfoChannelNew
3251
3245
} else {
3252
- descriptionText = isChannelGift ? strings. Gift_View_HiddenInfo_Channel : strings. Gift_View_HiddenInfo
3246
+ descriptionText = savedToProfile ? strings. Gift_View_DisplayedInfoNew : strings. Gift_View_HiddenInfoNew
3253
3247
}
3254
3248
}
3255
3249
@@ -3484,13 +3478,18 @@ private final class GiftViewSheetContent: CombinedComponent {
3484
3478
availableSize: buttonSize,
3485
3479
transition: context. transition
3486
3480
)
3487
- } else if incoming && !converted && !upgraded, let upgradeStars, upgradeStars > 0 {
3488
- let buttonTitle = strings. Gift_View_UpgradeForFree
3481
+ } else if incoming && !converted && !upgraded {
3482
+ let buttonTitle : String
3483
+ if let upgradeStars, upgradeStars > 0 {
3484
+ buttonTitle = strings. Gift_View_UpgradeForFree
3485
+ } else {
3486
+ buttonTitle = strings. Gift_View_Upgrade
3487
+ }
3489
3488
buttonChild = button. update (
3490
3489
component: ButtonComponent (
3491
3490
background: buttonBackground. withIsShimmering ( true ) ,
3492
3491
content: AnyComponentWithIdentity (
3493
- id: AnyHashable ( " freeUpgrade " ) ,
3492
+ id: AnyHashable ( " previewUpgrade " ) ,
3494
3493
component: AnyComponent ( HStack ( [
3495
3494
AnyComponentWithIdentity ( id: 0 , component: AnyComponent (
3496
3495
MultilineTextComponent ( text: . plain( NSAttributedString ( string: buttonTitle, font: Font . semibold ( 17.0 ) , textColor: theme. list. itemCheckColors. foregroundColor, paragraphAlignment: . center) )
0 commit comments