Gifts improvements

This commit is contained in:
Ilya Laktyushin
2024-09-23 22:44:29 +04:00
parent 04d7a791c9
commit 2c56786809
30 changed files with 1564 additions and 259 deletions

View File

@@ -237,6 +237,8 @@ private final class StarsPurchaseScreenContentComponent: CombinedComponent {
textString = renew ? strings.Stars_Purchase_SubscriptionRenewInfo(component.peers.first?.value.compactDisplayTitle ?? "").string : strings.Stars_Purchase_SubscriptionInfo(component.peers.first?.value.compactDisplayTitle ?? "").string
case .unlockMedia:
textString = strings.Stars_Purchase_StarsNeededUnlockInfo
case .starGift:
textString = strings.Stars_Purchase_StarGiftInfo(component.peers.first?.value.compactDisplayTitle ?? "").string
}
let markdownAttributes = MarkdownAttributes(body: MarkdownAttributeSet(font: textFont, textColor: textColor), bold: MarkdownAttributeSet(font: boldTextFont, textColor: textColor), link: MarkdownAttributeSet(font: textFont, textColor: accentColor), linkAttribute: { contents in
@@ -815,11 +817,9 @@ private final class StarsPurchaseScreenComponent: CombinedComponent {
switch context.component.purpose {
case .generic:
titleText = strings.Stars_Purchase_GetStars
case let .topUp(requiredStars, _):
titleText = strings.Stars_Purchase_StarsNeeded(Int32(requiredStars))
case .gift:
titleText = strings.Stars_Purchase_GiftStars
case let .transfer(_, requiredStars), let .reactions(_, requiredStars), let .subscription(_, requiredStars, _), let .unlockMedia(requiredStars):
case let .topUp(requiredStars, _), let .transfer(_, requiredStars), let .reactions(_, requiredStars), let .subscription(_, requiredStars, _), let .unlockMedia(requiredStars), let .starGift(_, requiredStars):
titleText = strings.Stars_Purchase_StarsNeeded(Int32(requiredStars))
}
@@ -1239,6 +1239,8 @@ private extension StarsPurchasePurpose {
return [peerId]
case let .subscription(peerId, _, _):
return [peerId]
case let .starGift(peerId, _):
return [peerId]
default:
return []
}
@@ -1256,6 +1258,8 @@ private extension StarsPurchasePurpose {
return requiredStars
case let .unlockMedia(requiredStars):
return requiredStars
case let .starGift(_, requiredStars):
return requiredStars
default:
return nil
}