mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-11-06 17:00:13 +00:00
Various improvements
This commit is contained in:
parent
200b86a384
commit
e3ed629d8f
@ -14762,3 +14762,14 @@ Sorry for the inconvenience.";
|
||||
"FaceScan.Instruction.Rotate" = "Move your head slowly to\ncomplete the circle";
|
||||
|
||||
"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.";
|
||||
|
||||
@ -2239,7 +2239,11 @@ private final class GiftViewSheetContent: CombinedComponent {
|
||||
} else if let convertStars, !upgraded {
|
||||
if !converted {
|
||||
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 {
|
||||
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
|
||||
}
|
||||
}
|
||||
|
||||
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 {
|
||||
tableItems.append(.init(
|
||||
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))))
|
||||
)
|
||||
)
|
||||
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(
|
||||
id: "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 {
|
||||
addressToOpen = address
|
||||
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 {
|
||||
if let _ = uniqueGift {
|
||||
descriptionText = isChannelGift ? strings.Gift_View_UniqueHiddenInfo_Channel : strings.Gift_View_UniqueHiddenInfo
|
||||
if isChannelGift {
|
||||
descriptionText = savedToProfile ? strings.Gift_View_DisplayedInfoChannelNew : strings.Gift_View_HiddenInfoChannelNew
|
||||
} 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,
|
||||
transition: context.transition
|
||||
)
|
||||
} else if incoming && !converted && !upgraded, let upgradeStars, upgradeStars > 0 {
|
||||
let buttonTitle = strings.Gift_View_UpgradeForFree
|
||||
} else if incoming && !converted && !upgraded {
|
||||
let buttonTitle: String
|
||||
if let upgradeStars, upgradeStars > 0 {
|
||||
buttonTitle = strings.Gift_View_UpgradeForFree
|
||||
} else {
|
||||
buttonTitle = strings.Gift_View_Upgrade
|
||||
}
|
||||
buttonChild = button.update(
|
||||
component: ButtonComponent(
|
||||
background: buttonBackground.withIsShimmering(true),
|
||||
content: AnyComponentWithIdentity(
|
||||
id: AnyHashable("freeUpgrade"),
|
||||
id: AnyHashable("previewUpgrade"),
|
||||
component: AnyComponent(HStack([
|
||||
AnyComponentWithIdentity(id: 0, component: AnyComponent(
|
||||
MultilineTextComponent(text: .plain(NSAttributedString(string: buttonTitle, font: Font.semibold(17.0), textColor: theme.list.itemCheckColors.foregroundColor, paragraphAlignment: .center))
|
||||
|
||||
@ -618,7 +618,7 @@ public final class PeerInfoGiftsPaneNode: ASDisplayNode, PeerInfoPaneNode, UIScr
|
||||
context: self.context,
|
||||
colors: TabSelectorComponent.Colors(
|
||||
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
|
||||
),
|
||||
theme: params.presentationData.theme,
|
||||
|
||||
@ -927,8 +927,13 @@ private final class StarsTransactionSheetContent: CombinedComponent {
|
||||
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>
|
||||
if let _ = giftAnimationSubject, !toPeer.isDeleted && !isGiftUpgrade {
|
||||
if let _ = giftAnimationSubject, !toPeer.isDeleted && !isGiftUpgrade && !isGiftResale {
|
||||
toComponent = AnyComponent(
|
||||
HStack([
|
||||
AnyComponentWithIdentity(
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user