Content reporting

This commit is contained in:
Ilya Laktyushin
2024-09-24 17:26:51 +04:00
parent 762eb19cc1
commit 1a3f7dc42d
28 changed files with 1417 additions and 288 deletions

View File

@@ -25,6 +25,7 @@ import GalleryUI
import StarsAvatarComponent
import MiniAppListScreen
import PremiumStarComponent
import GiftAnimationComponent
private final class StarsTransactionSheetContent: CombinedComponent {
typealias EnvironmentType = ViewControllerComponentContainer.Environment
@@ -145,6 +146,7 @@ private final class StarsTransactionSheetContent: CombinedComponent {
let title = Child(MultilineTextComponent.self)
let star = Child(StarsImageComponent.self)
let activeStar = Child(PremiumStarComponent.self)
let gift = Child(GiftAnimationComponent.self)
let amountBackground = Child(RoundedRectangle.self)
let amount = Child(BalancedTextComponent.self)
let amountStar = Child(BundleIconComponent.self)
@@ -225,6 +227,7 @@ private final class StarsTransactionSheetContent: CombinedComponent {
var isReaction = false
var giveawayMessageId: MessageId?
var isBoost = false
var giftAnimation: TelegramMediaFile?
var delayedCloseOnOpenPeer = true
switch subject {
@@ -322,7 +325,18 @@ private final class StarsTransactionSheetContent: CombinedComponent {
}
}
case let .transaction(transaction, parentPeer):
if let giveawayMessageIdValue = transaction.giveawayMessageId {
if let starGift = transaction.starGift {
titleText = "Gift"
descriptionText = ""
count = transaction.count
transactionId = transaction.id
date = transaction.date
if case let .peer(peer) = transaction.peer {
toPeer = peer
}
transactionPeer = transaction.peer
giftAnimation = starGift.file
} else if let giveawayMessageIdValue = transaction.giveawayMessageId {
titleText = strings.Stars_Transaction_Giveaway_Title
descriptionText = ""
count = transaction.count
@@ -572,7 +586,17 @@ private final class StarsTransactionSheetContent: CombinedComponent {
imageIcon = nil
}
var starChild: _UpdatedChildComponent
if isBoost {
if let giftAnimation {
starChild = gift.update(
component: GiftAnimationComponent(
context: component.context,
theme: theme,
file: giftAnimation
),
availableSize: CGSize(width: 128.0, height: 128.0),
transition: .immediate
)
} else if isBoost {
starChild = activeStar.update(
component: PremiumStarComponent(
theme: theme,
@@ -877,7 +901,7 @@ private final class StarsTransactionSheetContent: CombinedComponent {
)
context.add(starChild
.position(CGPoint(x: context.availableSize.width / 2.0, y: starChild.size.height / 2.0 - 19.0))
.position(CGPoint(x: context.availableSize.width / 2.0, y: 200.0 / 2.0 - 19.0))
)
context.add(title
@@ -885,7 +909,7 @@ private final class StarsTransactionSheetContent: CombinedComponent {
)
var originY: CGFloat = 0.0
originY += starChild.size.height - 23.0
originY += 200.0 - 23.0
var descriptionSize: CGSize = .zero
if !descriptionText.isEmpty {