mirror of
https://github.com/TelegramMessenger/Telegram-iOS.git
synced 2026-07-06 03:33:41 +02:00
Refactor constructor use sites for types 300-319 to struct pattern
Migrated star gift and stars-related constructors including: - starGift, starGiftUnique (pattern matches) - starGiftAttribute*, starGiftAuction* constructors - starsAmount, starsTonAmount, starsGiftOption - starsGiveawayOption, starsGiveawayWinnersOption - starsRevenueStatus, starRefProgram, starsRating - starGiftCollection, starGiftUpgradePrice, starGiftBackground Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
parent
5712f3061f
commit
859f5acea5
10 changed files with 554 additions and 77 deletions
|
|
@ -219,8 +219,104 @@ public extension Api {
|
|||
}
|
||||
public extension Api {
|
||||
enum StarGift: TypeConstructorDescription {
|
||||
case starGift(flags: Int32, id: Int64, sticker: Api.Document, stars: Int64, availabilityRemains: Int32?, availabilityTotal: Int32?, availabilityResale: Int64?, convertStars: Int64, firstSaleDate: Int32?, lastSaleDate: Int32?, upgradeStars: Int64?, resellMinStars: Int64?, title: String?, releasedBy: Api.Peer?, perUserTotal: Int32?, perUserRemains: Int32?, lockedUntilDate: Int32?, auctionSlug: String?, giftsPerRound: Int32?, auctionStartDate: Int32?, upgradeVariants: Int32?, background: Api.StarGiftBackground?)
|
||||
case starGiftUnique(flags: Int32, id: Int64, giftId: Int64, title: String, slug: String, num: Int32, ownerId: Api.Peer?, ownerName: String?, ownerAddress: String?, attributes: [Api.StarGiftAttribute], availabilityIssued: Int32, availabilityTotal: Int32, giftAddress: String?, resellAmount: [Api.StarsAmount]?, releasedBy: Api.Peer?, valueAmount: Int64?, valueCurrency: String?, valueUsdAmount: Int64?, themePeer: Api.Peer?, peerColor: Api.PeerColor?, hostId: Api.Peer?, offerMinStars: Int32?)
|
||||
public class Cons_starGift {
|
||||
public var flags: Int32
|
||||
public var id: Int64
|
||||
public var sticker: Api.Document
|
||||
public var stars: Int64
|
||||
public var availabilityRemains: Int32?
|
||||
public var availabilityTotal: Int32?
|
||||
public var availabilityResale: Int64?
|
||||
public var convertStars: Int64
|
||||
public var firstSaleDate: Int32?
|
||||
public var lastSaleDate: Int32?
|
||||
public var upgradeStars: Int64?
|
||||
public var resellMinStars: Int64?
|
||||
public var title: String?
|
||||
public var releasedBy: Api.Peer?
|
||||
public var perUserTotal: Int32?
|
||||
public var perUserRemains: Int32?
|
||||
public var lockedUntilDate: Int32?
|
||||
public var auctionSlug: String?
|
||||
public var giftsPerRound: Int32?
|
||||
public var auctionStartDate: Int32?
|
||||
public var upgradeVariants: Int32?
|
||||
public var background: Api.StarGiftBackground?
|
||||
public init(flags: Int32, id: Int64, sticker: Api.Document, stars: Int64, availabilityRemains: Int32?, availabilityTotal: Int32?, availabilityResale: Int64?, convertStars: Int64, firstSaleDate: Int32?, lastSaleDate: Int32?, upgradeStars: Int64?, resellMinStars: Int64?, title: String?, releasedBy: Api.Peer?, perUserTotal: Int32?, perUserRemains: Int32?, lockedUntilDate: Int32?, auctionSlug: String?, giftsPerRound: Int32?, auctionStartDate: Int32?, upgradeVariants: Int32?, background: Api.StarGiftBackground?) {
|
||||
self.flags = flags
|
||||
self.id = id
|
||||
self.sticker = sticker
|
||||
self.stars = stars
|
||||
self.availabilityRemains = availabilityRemains
|
||||
self.availabilityTotal = availabilityTotal
|
||||
self.availabilityResale = availabilityResale
|
||||
self.convertStars = convertStars
|
||||
self.firstSaleDate = firstSaleDate
|
||||
self.lastSaleDate = lastSaleDate
|
||||
self.upgradeStars = upgradeStars
|
||||
self.resellMinStars = resellMinStars
|
||||
self.title = title
|
||||
self.releasedBy = releasedBy
|
||||
self.perUserTotal = perUserTotal
|
||||
self.perUserRemains = perUserRemains
|
||||
self.lockedUntilDate = lockedUntilDate
|
||||
self.auctionSlug = auctionSlug
|
||||
self.giftsPerRound = giftsPerRound
|
||||
self.auctionStartDate = auctionStartDate
|
||||
self.upgradeVariants = upgradeVariants
|
||||
self.background = background
|
||||
}
|
||||
}
|
||||
public class Cons_starGiftUnique {
|
||||
public var flags: Int32
|
||||
public var id: Int64
|
||||
public var giftId: Int64
|
||||
public var title: String
|
||||
public var slug: String
|
||||
public var num: Int32
|
||||
public var ownerId: Api.Peer?
|
||||
public var ownerName: String?
|
||||
public var ownerAddress: String?
|
||||
public var attributes: [Api.StarGiftAttribute]
|
||||
public var availabilityIssued: Int32
|
||||
public var availabilityTotal: Int32
|
||||
public var giftAddress: String?
|
||||
public var resellAmount: [Api.StarsAmount]?
|
||||
public var releasedBy: Api.Peer?
|
||||
public var valueAmount: Int64?
|
||||
public var valueCurrency: String?
|
||||
public var valueUsdAmount: Int64?
|
||||
public var themePeer: Api.Peer?
|
||||
public var peerColor: Api.PeerColor?
|
||||
public var hostId: Api.Peer?
|
||||
public var offerMinStars: Int32?
|
||||
public init(flags: Int32, id: Int64, giftId: Int64, title: String, slug: String, num: Int32, ownerId: Api.Peer?, ownerName: String?, ownerAddress: String?, attributes: [Api.StarGiftAttribute], availabilityIssued: Int32, availabilityTotal: Int32, giftAddress: String?, resellAmount: [Api.StarsAmount]?, releasedBy: Api.Peer?, valueAmount: Int64?, valueCurrency: String?, valueUsdAmount: Int64?, themePeer: Api.Peer?, peerColor: Api.PeerColor?, hostId: Api.Peer?, offerMinStars: Int32?) {
|
||||
self.flags = flags
|
||||
self.id = id
|
||||
self.giftId = giftId
|
||||
self.title = title
|
||||
self.slug = slug
|
||||
self.num = num
|
||||
self.ownerId = ownerId
|
||||
self.ownerName = ownerName
|
||||
self.ownerAddress = ownerAddress
|
||||
self.attributes = attributes
|
||||
self.availabilityIssued = availabilityIssued
|
||||
self.availabilityTotal = availabilityTotal
|
||||
self.giftAddress = giftAddress
|
||||
self.resellAmount = resellAmount
|
||||
self.releasedBy = releasedBy
|
||||
self.valueAmount = valueAmount
|
||||
self.valueCurrency = valueCurrency
|
||||
self.valueUsdAmount = valueUsdAmount
|
||||
self.themePeer = themePeer
|
||||
self.peerColor = peerColor
|
||||
self.hostId = hostId
|
||||
self.offerMinStars = offerMinStars
|
||||
}
|
||||
}
|
||||
case starGift(Cons_starGift)
|
||||
case starGiftUnique(Cons_starGiftUnique)
|
||||
|
||||
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
||||
#if DEBUG
|
||||
|
|
@ -256,7 +352,17 @@ public extension Api {
|
|||
}
|
||||
public extension Api {
|
||||
enum StarGiftActiveAuctionState: TypeConstructorDescription {
|
||||
case starGiftActiveAuctionState(gift: Api.StarGift, state: Api.StarGiftAuctionState, userState: Api.StarGiftAuctionUserState)
|
||||
public class Cons_starGiftActiveAuctionState {
|
||||
public var gift: Api.StarGift
|
||||
public var state: Api.StarGiftAuctionState
|
||||
public var userState: Api.StarGiftAuctionUserState
|
||||
public init(gift: Api.StarGift, state: Api.StarGiftAuctionState, userState: Api.StarGiftAuctionUserState) {
|
||||
self.gift = gift
|
||||
self.state = state
|
||||
self.userState = userState
|
||||
}
|
||||
}
|
||||
case starGiftActiveAuctionState(Cons_starGiftActiveAuctionState)
|
||||
|
||||
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
||||
#if DEBUG
|
||||
|
|
@ -285,10 +391,64 @@ public extension Api {
|
|||
}
|
||||
public extension Api {
|
||||
enum StarGiftAttribute: TypeConstructorDescription {
|
||||
case starGiftAttributeBackdrop(name: String, backdropId: Int32, centerColor: Int32, edgeColor: Int32, patternColor: Int32, textColor: Int32, rarity: Api.StarGiftAttributeRarity)
|
||||
case starGiftAttributeModel(flags: Int32, name: String, document: Api.Document, rarity: Api.StarGiftAttributeRarity)
|
||||
case starGiftAttributeOriginalDetails(flags: Int32, senderId: Api.Peer?, recipientId: Api.Peer, date: Int32, message: Api.TextWithEntities?)
|
||||
case starGiftAttributePattern(name: String, document: Api.Document, rarity: Api.StarGiftAttributeRarity)
|
||||
public class Cons_starGiftAttributeBackdrop {
|
||||
public var name: String
|
||||
public var backdropId: Int32
|
||||
public var centerColor: Int32
|
||||
public var edgeColor: Int32
|
||||
public var patternColor: Int32
|
||||
public var textColor: Int32
|
||||
public var rarity: Api.StarGiftAttributeRarity
|
||||
public init(name: String, backdropId: Int32, centerColor: Int32, edgeColor: Int32, patternColor: Int32, textColor: Int32, rarity: Api.StarGiftAttributeRarity) {
|
||||
self.name = name
|
||||
self.backdropId = backdropId
|
||||
self.centerColor = centerColor
|
||||
self.edgeColor = edgeColor
|
||||
self.patternColor = patternColor
|
||||
self.textColor = textColor
|
||||
self.rarity = rarity
|
||||
}
|
||||
}
|
||||
public class Cons_starGiftAttributeModel {
|
||||
public var flags: Int32
|
||||
public var name: String
|
||||
public var document: Api.Document
|
||||
public var rarity: Api.StarGiftAttributeRarity
|
||||
public init(flags: Int32, name: String, document: Api.Document, rarity: Api.StarGiftAttributeRarity) {
|
||||
self.flags = flags
|
||||
self.name = name
|
||||
self.document = document
|
||||
self.rarity = rarity
|
||||
}
|
||||
}
|
||||
public class Cons_starGiftAttributeOriginalDetails {
|
||||
public var flags: Int32
|
||||
public var senderId: Api.Peer?
|
||||
public var recipientId: Api.Peer
|
||||
public var date: Int32
|
||||
public var message: Api.TextWithEntities?
|
||||
public init(flags: Int32, senderId: Api.Peer?, recipientId: Api.Peer, date: Int32, message: Api.TextWithEntities?) {
|
||||
self.flags = flags
|
||||
self.senderId = senderId
|
||||
self.recipientId = recipientId
|
||||
self.date = date
|
||||
self.message = message
|
||||
}
|
||||
}
|
||||
public class Cons_starGiftAttributePattern {
|
||||
public var name: String
|
||||
public var document: Api.Document
|
||||
public var rarity: Api.StarGiftAttributeRarity
|
||||
public init(name: String, document: Api.Document, rarity: Api.StarGiftAttributeRarity) {
|
||||
self.name = name
|
||||
self.document = document
|
||||
self.rarity = rarity
|
||||
}
|
||||
}
|
||||
case starGiftAttributeBackdrop(Cons_starGiftAttributeBackdrop)
|
||||
case starGiftAttributeModel(Cons_starGiftAttributeModel)
|
||||
case starGiftAttributeOriginalDetails(Cons_starGiftAttributeOriginalDetails)
|
||||
case starGiftAttributePattern(Cons_starGiftAttributePattern)
|
||||
|
||||
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
||||
#if DEBUG
|
||||
|
|
@ -338,7 +498,15 @@ public extension Api {
|
|||
}
|
||||
public extension Api {
|
||||
enum StarGiftAttributeCounter: TypeConstructorDescription {
|
||||
case starGiftAttributeCounter(attribute: Api.StarGiftAttributeId, count: Int32)
|
||||
public class Cons_starGiftAttributeCounter {
|
||||
public var attribute: Api.StarGiftAttributeId
|
||||
public var count: Int32
|
||||
public init(attribute: Api.StarGiftAttributeId, count: Int32) {
|
||||
self.attribute = attribute
|
||||
self.count = count
|
||||
}
|
||||
}
|
||||
case starGiftAttributeCounter(Cons_starGiftAttributeCounter)
|
||||
|
||||
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
||||
#if DEBUG
|
||||
|
|
@ -367,9 +535,27 @@ public extension Api {
|
|||
}
|
||||
public extension Api {
|
||||
enum StarGiftAttributeId: TypeConstructorDescription {
|
||||
case starGiftAttributeIdBackdrop(backdropId: Int32)
|
||||
case starGiftAttributeIdModel(documentId: Int64)
|
||||
case starGiftAttributeIdPattern(documentId: Int64)
|
||||
public class Cons_starGiftAttributeIdBackdrop {
|
||||
public var backdropId: Int32
|
||||
public init(backdropId: Int32) {
|
||||
self.backdropId = backdropId
|
||||
}
|
||||
}
|
||||
public class Cons_starGiftAttributeIdModel {
|
||||
public var documentId: Int64
|
||||
public init(documentId: Int64) {
|
||||
self.documentId = documentId
|
||||
}
|
||||
}
|
||||
public class Cons_starGiftAttributeIdPattern {
|
||||
public var documentId: Int64
|
||||
public init(documentId: Int64) {
|
||||
self.documentId = documentId
|
||||
}
|
||||
}
|
||||
case starGiftAttributeIdBackdrop(Cons_starGiftAttributeIdBackdrop)
|
||||
case starGiftAttributeIdModel(Cons_starGiftAttributeIdModel)
|
||||
case starGiftAttributeIdPattern(Cons_starGiftAttributeIdPattern)
|
||||
|
||||
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
||||
#if DEBUG
|
||||
|
|
@ -412,7 +598,13 @@ public extension Api {
|
|||
}
|
||||
public extension Api {
|
||||
enum StarGiftAttributeRarity: TypeConstructorDescription {
|
||||
case starGiftAttributeRarity(permille: Int32)
|
||||
public class Cons_starGiftAttributeRarity {
|
||||
public var permille: Int32
|
||||
public init(permille: Int32) {
|
||||
self.permille = permille
|
||||
}
|
||||
}
|
||||
case starGiftAttributeRarity(Cons_starGiftAttributeRarity)
|
||||
case starGiftAttributeRarityEpic
|
||||
case starGiftAttributeRarityLegendary
|
||||
case starGiftAttributeRarityMythic
|
||||
|
|
@ -473,7 +665,27 @@ public extension Api {
|
|||
}
|
||||
public extension Api {
|
||||
enum StarGiftAuctionAcquiredGift: TypeConstructorDescription {
|
||||
case starGiftAuctionAcquiredGift(flags: Int32, peer: Api.Peer, date: Int32, bidAmount: Int64, round: Int32, pos: Int32, message: Api.TextWithEntities?, giftNum: Int32?)
|
||||
public class Cons_starGiftAuctionAcquiredGift {
|
||||
public var flags: Int32
|
||||
public var peer: Api.Peer
|
||||
public var date: Int32
|
||||
public var bidAmount: Int64
|
||||
public var round: Int32
|
||||
public var pos: Int32
|
||||
public var message: Api.TextWithEntities?
|
||||
public var giftNum: Int32?
|
||||
public init(flags: Int32, peer: Api.Peer, date: Int32, bidAmount: Int64, round: Int32, pos: Int32, message: Api.TextWithEntities?, giftNum: Int32?) {
|
||||
self.flags = flags
|
||||
self.peer = peer
|
||||
self.date = date
|
||||
self.bidAmount = bidAmount
|
||||
self.round = round
|
||||
self.pos = pos
|
||||
self.message = message
|
||||
self.giftNum = giftNum
|
||||
}
|
||||
}
|
||||
case starGiftAuctionAcquiredGift(Cons_starGiftAuctionAcquiredGift)
|
||||
|
||||
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
||||
#if DEBUG
|
||||
|
|
@ -502,8 +714,28 @@ public extension Api {
|
|||
}
|
||||
public extension Api {
|
||||
enum StarGiftAuctionRound: TypeConstructorDescription {
|
||||
case starGiftAuctionRound(num: Int32, duration: Int32)
|
||||
case starGiftAuctionRoundExtendable(num: Int32, duration: Int32, extendTop: Int32, extendWindow: Int32)
|
||||
public class Cons_starGiftAuctionRound {
|
||||
public var num: Int32
|
||||
public var duration: Int32
|
||||
public init(num: Int32, duration: Int32) {
|
||||
self.num = num
|
||||
self.duration = duration
|
||||
}
|
||||
}
|
||||
public class Cons_starGiftAuctionRoundExtendable {
|
||||
public var num: Int32
|
||||
public var duration: Int32
|
||||
public var extendTop: Int32
|
||||
public var extendWindow: Int32
|
||||
public init(num: Int32, duration: Int32, extendTop: Int32, extendWindow: Int32) {
|
||||
self.num = num
|
||||
self.duration = duration
|
||||
self.extendTop = extendTop
|
||||
self.extendWindow = extendWindow
|
||||
}
|
||||
}
|
||||
case starGiftAuctionRound(Cons_starGiftAuctionRound)
|
||||
case starGiftAuctionRoundExtendable(Cons_starGiftAuctionRoundExtendable)
|
||||
|
||||
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
||||
#if DEBUG
|
||||
|
|
@ -539,8 +771,54 @@ public extension Api {
|
|||
}
|
||||
public extension Api {
|
||||
enum StarGiftAuctionState: TypeConstructorDescription {
|
||||
case starGiftAuctionState(version: Int32, startDate: Int32, endDate: Int32, minBidAmount: Int64, bidLevels: [Api.AuctionBidLevel], topBidders: [Int64], nextRoundAt: Int32, lastGiftNum: Int32, giftsLeft: Int32, currentRound: Int32, totalRounds: Int32, rounds: [Api.StarGiftAuctionRound])
|
||||
case starGiftAuctionStateFinished(flags: Int32, startDate: Int32, endDate: Int32, averagePrice: Int64, listedCount: Int32?, fragmentListedCount: Int32?, fragmentListedUrl: String?)
|
||||
public class Cons_starGiftAuctionState {
|
||||
public var version: Int32
|
||||
public var startDate: Int32
|
||||
public var endDate: Int32
|
||||
public var minBidAmount: Int64
|
||||
public var bidLevels: [Api.AuctionBidLevel]
|
||||
public var topBidders: [Int64]
|
||||
public var nextRoundAt: Int32
|
||||
public var lastGiftNum: Int32
|
||||
public var giftsLeft: Int32
|
||||
public var currentRound: Int32
|
||||
public var totalRounds: Int32
|
||||
public var rounds: [Api.StarGiftAuctionRound]
|
||||
public init(version: Int32, startDate: Int32, endDate: Int32, minBidAmount: Int64, bidLevels: [Api.AuctionBidLevel], topBidders: [Int64], nextRoundAt: Int32, lastGiftNum: Int32, giftsLeft: Int32, currentRound: Int32, totalRounds: Int32, rounds: [Api.StarGiftAuctionRound]) {
|
||||
self.version = version
|
||||
self.startDate = startDate
|
||||
self.endDate = endDate
|
||||
self.minBidAmount = minBidAmount
|
||||
self.bidLevels = bidLevels
|
||||
self.topBidders = topBidders
|
||||
self.nextRoundAt = nextRoundAt
|
||||
self.lastGiftNum = lastGiftNum
|
||||
self.giftsLeft = giftsLeft
|
||||
self.currentRound = currentRound
|
||||
self.totalRounds = totalRounds
|
||||
self.rounds = rounds
|
||||
}
|
||||
}
|
||||
public class Cons_starGiftAuctionStateFinished {
|
||||
public var flags: Int32
|
||||
public var startDate: Int32
|
||||
public var endDate: Int32
|
||||
public var averagePrice: Int64
|
||||
public var listedCount: Int32?
|
||||
public var fragmentListedCount: Int32?
|
||||
public var fragmentListedUrl: String?
|
||||
public init(flags: Int32, startDate: Int32, endDate: Int32, averagePrice: Int64, listedCount: Int32?, fragmentListedCount: Int32?, fragmentListedUrl: String?) {
|
||||
self.flags = flags
|
||||
self.startDate = startDate
|
||||
self.endDate = endDate
|
||||
self.averagePrice = averagePrice
|
||||
self.listedCount = listedCount
|
||||
self.fragmentListedCount = fragmentListedCount
|
||||
self.fragmentListedUrl = fragmentListedUrl
|
||||
}
|
||||
}
|
||||
case starGiftAuctionState(Cons_starGiftAuctionState)
|
||||
case starGiftAuctionStateFinished(Cons_starGiftAuctionStateFinished)
|
||||
case starGiftAuctionStateNotModified
|
||||
|
||||
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
||||
|
|
@ -584,7 +862,23 @@ public extension Api {
|
|||
}
|
||||
public extension Api {
|
||||
enum StarGiftAuctionUserState: TypeConstructorDescription {
|
||||
case starGiftAuctionUserState(flags: Int32, bidAmount: Int64?, bidDate: Int32?, minBidAmount: Int64?, bidPeer: Api.Peer?, acquiredCount: Int32)
|
||||
public class Cons_starGiftAuctionUserState {
|
||||
public var flags: Int32
|
||||
public var bidAmount: Int64?
|
||||
public var bidDate: Int32?
|
||||
public var minBidAmount: Int64?
|
||||
public var bidPeer: Api.Peer?
|
||||
public var acquiredCount: Int32
|
||||
public init(flags: Int32, bidAmount: Int64?, bidDate: Int32?, minBidAmount: Int64?, bidPeer: Api.Peer?, acquiredCount: Int32) {
|
||||
self.flags = flags
|
||||
self.bidAmount = bidAmount
|
||||
self.bidDate = bidDate
|
||||
self.minBidAmount = minBidAmount
|
||||
self.bidPeer = bidPeer
|
||||
self.acquiredCount = acquiredCount
|
||||
}
|
||||
}
|
||||
case starGiftAuctionUserState(Cons_starGiftAuctionUserState)
|
||||
|
||||
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
||||
#if DEBUG
|
||||
|
|
@ -613,7 +907,17 @@ public extension Api {
|
|||
}
|
||||
public extension Api {
|
||||
enum StarGiftBackground: TypeConstructorDescription {
|
||||
case starGiftBackground(centerColor: Int32, edgeColor: Int32, textColor: Int32)
|
||||
public class Cons_starGiftBackground {
|
||||
public var centerColor: Int32
|
||||
public var edgeColor: Int32
|
||||
public var textColor: Int32
|
||||
public init(centerColor: Int32, edgeColor: Int32, textColor: Int32) {
|
||||
self.centerColor = centerColor
|
||||
self.edgeColor = edgeColor
|
||||
self.textColor = textColor
|
||||
}
|
||||
}
|
||||
case starGiftBackground(Cons_starGiftBackground)
|
||||
|
||||
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
||||
#if DEBUG
|
||||
|
|
@ -642,7 +946,23 @@ public extension Api {
|
|||
}
|
||||
public extension Api {
|
||||
enum StarGiftCollection: TypeConstructorDescription {
|
||||
case starGiftCollection(flags: Int32, collectionId: Int32, title: String, icon: Api.Document?, giftsCount: Int32, hash: Int64)
|
||||
public class Cons_starGiftCollection {
|
||||
public var flags: Int32
|
||||
public var collectionId: Int32
|
||||
public var title: String
|
||||
public var icon: Api.Document?
|
||||
public var giftsCount: Int32
|
||||
public var hash: Int64
|
||||
public init(flags: Int32, collectionId: Int32, title: String, icon: Api.Document?, giftsCount: Int32, hash: Int64) {
|
||||
self.flags = flags
|
||||
self.collectionId = collectionId
|
||||
self.title = title
|
||||
self.icon = icon
|
||||
self.giftsCount = giftsCount
|
||||
self.hash = hash
|
||||
}
|
||||
}
|
||||
case starGiftCollection(Cons_starGiftCollection)
|
||||
|
||||
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
||||
#if DEBUG
|
||||
|
|
@ -671,7 +991,15 @@ public extension Api {
|
|||
}
|
||||
public extension Api {
|
||||
enum StarGiftUpgradePrice: TypeConstructorDescription {
|
||||
case starGiftUpgradePrice(date: Int32, upgradeStars: Int64)
|
||||
public class Cons_starGiftUpgradePrice {
|
||||
public var date: Int32
|
||||
public var upgradeStars: Int64
|
||||
public init(date: Int32, upgradeStars: Int64) {
|
||||
self.date = date
|
||||
self.upgradeStars = upgradeStars
|
||||
}
|
||||
}
|
||||
case starGiftUpgradePrice(Cons_starGiftUpgradePrice)
|
||||
|
||||
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
||||
#if DEBUG
|
||||
|
|
@ -700,7 +1028,23 @@ public extension Api {
|
|||
}
|
||||
public extension Api {
|
||||
enum StarRefProgram: TypeConstructorDescription {
|
||||
case starRefProgram(flags: Int32, botId: Int64, commissionPermille: Int32, durationMonths: Int32?, endDate: Int32?, dailyRevenuePerUser: Api.StarsAmount?)
|
||||
public class Cons_starRefProgram {
|
||||
public var flags: Int32
|
||||
public var botId: Int64
|
||||
public var commissionPermille: Int32
|
||||
public var durationMonths: Int32?
|
||||
public var endDate: Int32?
|
||||
public var dailyRevenuePerUser: Api.StarsAmount?
|
||||
public init(flags: Int32, botId: Int64, commissionPermille: Int32, durationMonths: Int32?, endDate: Int32?, dailyRevenuePerUser: Api.StarsAmount?) {
|
||||
self.flags = flags
|
||||
self.botId = botId
|
||||
self.commissionPermille = commissionPermille
|
||||
self.durationMonths = durationMonths
|
||||
self.endDate = endDate
|
||||
self.dailyRevenuePerUser = dailyRevenuePerUser
|
||||
}
|
||||
}
|
||||
case starRefProgram(Cons_starRefProgram)
|
||||
|
||||
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
||||
#if DEBUG
|
||||
|
|
|
|||
|
|
@ -1,7 +1,21 @@
|
|||
public extension Api {
|
||||
enum StarsAmount: TypeConstructorDescription {
|
||||
case starsAmount(amount: Int64, nanos: Int32)
|
||||
case starsTonAmount(amount: Int64)
|
||||
public class Cons_starsAmount {
|
||||
public var amount: Int64
|
||||
public var nanos: Int32
|
||||
public init(amount: Int64, nanos: Int32) {
|
||||
self.amount = amount
|
||||
self.nanos = nanos
|
||||
}
|
||||
}
|
||||
public class Cons_starsTonAmount {
|
||||
public var amount: Int64
|
||||
public init(amount: Int64) {
|
||||
self.amount = amount
|
||||
}
|
||||
}
|
||||
case starsAmount(Cons_starsAmount)
|
||||
case starsTonAmount(Cons_starsTonAmount)
|
||||
|
||||
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
||||
#if DEBUG
|
||||
|
|
@ -37,7 +51,21 @@ public extension Api {
|
|||
}
|
||||
public extension Api {
|
||||
enum StarsGiftOption: TypeConstructorDescription {
|
||||
case starsGiftOption(flags: Int32, stars: Int64, storeProduct: String?, currency: String, amount: Int64)
|
||||
public class Cons_starsGiftOption {
|
||||
public var flags: Int32
|
||||
public var stars: Int64
|
||||
public var storeProduct: String?
|
||||
public var currency: String
|
||||
public var amount: Int64
|
||||
public init(flags: Int32, stars: Int64, storeProduct: String?, currency: String, amount: Int64) {
|
||||
self.flags = flags
|
||||
self.stars = stars
|
||||
self.storeProduct = storeProduct
|
||||
self.currency = currency
|
||||
self.amount = amount
|
||||
}
|
||||
}
|
||||
case starsGiftOption(Cons_starsGiftOption)
|
||||
|
||||
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
||||
#if DEBUG
|
||||
|
|
@ -66,7 +94,25 @@ public extension Api {
|
|||
}
|
||||
public extension Api {
|
||||
enum StarsGiveawayOption: TypeConstructorDescription {
|
||||
case starsGiveawayOption(flags: Int32, stars: Int64, yearlyBoosts: Int32, storeProduct: String?, currency: String, amount: Int64, winners: [Api.StarsGiveawayWinnersOption])
|
||||
public class Cons_starsGiveawayOption {
|
||||
public var flags: Int32
|
||||
public var stars: Int64
|
||||
public var yearlyBoosts: Int32
|
||||
public var storeProduct: String?
|
||||
public var currency: String
|
||||
public var amount: Int64
|
||||
public var winners: [Api.StarsGiveawayWinnersOption]
|
||||
public init(flags: Int32, stars: Int64, yearlyBoosts: Int32, storeProduct: String?, currency: String, amount: Int64, winners: [Api.StarsGiveawayWinnersOption]) {
|
||||
self.flags = flags
|
||||
self.stars = stars
|
||||
self.yearlyBoosts = yearlyBoosts
|
||||
self.storeProduct = storeProduct
|
||||
self.currency = currency
|
||||
self.amount = amount
|
||||
self.winners = winners
|
||||
}
|
||||
}
|
||||
case starsGiveawayOption(Cons_starsGiveawayOption)
|
||||
|
||||
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
||||
#if DEBUG
|
||||
|
|
@ -95,7 +141,17 @@ public extension Api {
|
|||
}
|
||||
public extension Api {
|
||||
enum StarsGiveawayWinnersOption: TypeConstructorDescription {
|
||||
case starsGiveawayWinnersOption(flags: Int32, users: Int32, perUserStars: Int64)
|
||||
public class Cons_starsGiveawayWinnersOption {
|
||||
public var flags: Int32
|
||||
public var users: Int32
|
||||
public var perUserStars: Int64
|
||||
public init(flags: Int32, users: Int32, perUserStars: Int64) {
|
||||
self.flags = flags
|
||||
self.users = users
|
||||
self.perUserStars = perUserStars
|
||||
}
|
||||
}
|
||||
case starsGiveawayWinnersOption(Cons_starsGiveawayWinnersOption)
|
||||
|
||||
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
||||
#if DEBUG
|
||||
|
|
@ -124,7 +180,21 @@ public extension Api {
|
|||
}
|
||||
public extension Api {
|
||||
enum StarsRating: TypeConstructorDescription {
|
||||
case starsRating(flags: Int32, level: Int32, currentLevelStars: Int64, stars: Int64, nextLevelStars: Int64?)
|
||||
public class Cons_starsRating {
|
||||
public var flags: Int32
|
||||
public var level: Int32
|
||||
public var currentLevelStars: Int64
|
||||
public var stars: Int64
|
||||
public var nextLevelStars: Int64?
|
||||
public init(flags: Int32, level: Int32, currentLevelStars: Int64, stars: Int64, nextLevelStars: Int64?) {
|
||||
self.flags = flags
|
||||
self.level = level
|
||||
self.currentLevelStars = currentLevelStars
|
||||
self.stars = stars
|
||||
self.nextLevelStars = nextLevelStars
|
||||
}
|
||||
}
|
||||
case starsRating(Cons_starsRating)
|
||||
|
||||
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
||||
#if DEBUG
|
||||
|
|
@ -153,7 +223,21 @@ public extension Api {
|
|||
}
|
||||
public extension Api {
|
||||
enum StarsRevenueStatus: TypeConstructorDescription {
|
||||
case starsRevenueStatus(flags: Int32, currentBalance: Api.StarsAmount, availableBalance: Api.StarsAmount, overallRevenue: Api.StarsAmount, nextWithdrawalAt: Int32?)
|
||||
public class Cons_starsRevenueStatus {
|
||||
public var flags: Int32
|
||||
public var currentBalance: Api.StarsAmount
|
||||
public var availableBalance: Api.StarsAmount
|
||||
public var overallRevenue: Api.StarsAmount
|
||||
public var nextWithdrawalAt: Int32?
|
||||
public init(flags: Int32, currentBalance: Api.StarsAmount, availableBalance: Api.StarsAmount, overallRevenue: Api.StarsAmount, nextWithdrawalAt: Int32?) {
|
||||
self.flags = flags
|
||||
self.currentBalance = currentBalance
|
||||
self.availableBalance = availableBalance
|
||||
self.overallRevenue = overallRevenue
|
||||
self.nextWithdrawalAt = nextWithdrawalAt
|
||||
}
|
||||
}
|
||||
case starsRevenueStatus(Cons_starsRevenueStatus)
|
||||
|
||||
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
||||
#if DEBUG
|
||||
|
|
|
|||
|
|
@ -293,9 +293,11 @@ func telegramMediaActionFromApiAction(_ action: Api.MessageAction) -> TelegramMe
|
|||
switch starsAmount {
|
||||
case .none:
|
||||
balanceNeeded = CurrencyAmount(amount: .zero, currency: .stars)
|
||||
case let .starsAmount(amount, nanos):
|
||||
case let .starsAmount(starsAmountData):
|
||||
let (amount, nanos) = (starsAmountData.amount, starsAmountData.nanos)
|
||||
balanceNeeded = CurrencyAmount(amount: StarsAmount(value: amount, nanos: nanos), currency: .stars)
|
||||
case let .starsTonAmount(amount):
|
||||
case let .starsTonAmount(starsTonAmountData):
|
||||
let amount = starsTonAmountData.amount
|
||||
balanceNeeded = CurrencyAmount(amount: StarsAmount(value: amount, nanos: 0), currency: .ton)
|
||||
}
|
||||
reason = .lowBalance(balanceNeeded: balanceNeeded)
|
||||
|
|
@ -308,9 +310,11 @@ func telegramMediaActionFromApiAction(_ action: Api.MessageAction) -> TelegramMe
|
|||
switch starsAmount {
|
||||
case .none:
|
||||
amountValue = CurrencyAmount(amount: .zero, currency: .stars)
|
||||
case let .starsAmount(amount, nanos):
|
||||
case let .starsAmount(starsAmountData):
|
||||
let (amount, nanos) = (starsAmountData.amount, starsAmountData.nanos)
|
||||
amountValue = CurrencyAmount(amount: StarsAmount(value: amount, nanos: nanos), currency: .stars)
|
||||
case let .starsTonAmount(amount):
|
||||
case let .starsTonAmount(starsTonAmountData):
|
||||
let amount = starsTonAmountData.amount
|
||||
amountValue = CurrencyAmount(amount: StarsAmount(value: amount, nanos: 0), currency: .ton)
|
||||
}
|
||||
status = .rejected(reason: .lowBalance(balanceNeeded: amountValue), comment: nil)
|
||||
|
|
|
|||
|
|
@ -233,7 +233,7 @@ private func synchronizeChatInputState(transaction: Transaction, postbox: Postbo
|
|||
if suggestedPost.timestamp != nil {
|
||||
flags |= 1 << 0
|
||||
}
|
||||
return .suggestedPost(flags: flags, price: suggestedPost.price?.apiAmount ?? .starsAmount(amount: 0, nanos: 0), scheduleDate: suggestedPost.timestamp)
|
||||
return .suggestedPost(flags: flags, price: suggestedPost.price?.apiAmount ?? .starsAmount(.init(amount: 0, nanos: 0)), scheduleDate: suggestedPost.timestamp)
|
||||
}
|
||||
if suggestedPost != nil {
|
||||
flags |= 1 << 8
|
||||
|
|
|
|||
|
|
@ -155,7 +155,12 @@ extension StarsRevenueStats {
|
|||
extension StarsRevenueStats.Balances {
|
||||
init(apiStarsRevenueStatus: Api.StarsRevenueStatus) {
|
||||
switch apiStarsRevenueStatus {
|
||||
case let .starsRevenueStatus(flags, currentBalance, availableBalance, overallRevenue, nextWithdrawalAt):
|
||||
case let .starsRevenueStatus(starsRevenueStatusData):
|
||||
let flags = starsRevenueStatusData.flags
|
||||
let currentBalance = starsRevenueStatusData.currentBalance
|
||||
let availableBalance = starsRevenueStatusData.availableBalance
|
||||
let overallRevenue = starsRevenueStatusData.overallRevenue
|
||||
let nextWithdrawalAt = starsRevenueStatusData.nextWithdrawalAt
|
||||
self.init(currentBalance: CurrencyAmount(apiAmount: currentBalance), availableBalance: CurrencyAmount(apiAmount: availableBalance), overallRevenue: CurrencyAmount(apiAmount: overallRevenue), withdrawEnabled: ((flags & (1 << 0)) != 0), nextWithdrawalTimestamp: nextWithdrawalAt)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -996,7 +996,8 @@ public final class TelegramStarRefProgram: Codable, Equatable {
|
|||
extension TelegramStarRefProgram {
|
||||
convenience init(apiStarRefProgram: Api.StarRefProgram) {
|
||||
switch apiStarRefProgram {
|
||||
case let .starRefProgram(_, botId, commissionPermille, durationMonths, endDate, dailyRevenuePerUser):
|
||||
case let .starRefProgram(starRefProgramData):
|
||||
let (botId, commissionPermille, durationMonths, endDate, dailyRevenuePerUser) = (starRefProgramData.botId, starRefProgramData.commissionPermille, starRefProgramData.durationMonths, starRefProgramData.endDate, starRefProgramData.dailyRevenuePerUser)
|
||||
self.init(botId: PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt64Value(botId)), commissionPermille: commissionPermille, durationMonths: durationMonths, endDate: endDate, dailyRevenuePerUser: dailyRevenuePerUser.flatMap(StarsAmount.init(apiAmount:)))
|
||||
}
|
||||
}
|
||||
|
|
@ -1110,7 +1111,8 @@ extension TelegramProfileTab {
|
|||
extension TelegramStarRating {
|
||||
convenience init(apiRating: Api.StarsRating) {
|
||||
switch apiRating {
|
||||
case let .starsRating(_, level, currentLevelStars, stars, nextLevelStars):
|
||||
case let .starsRating(starsRatingData):
|
||||
let (level, currentLevelStars, stars, nextLevelStars) = (starsRatingData.level, starsRatingData.currentLevelStars, starsRatingData.stars, starsRatingData.nextLevelStars)
|
||||
self.init(
|
||||
level: level,
|
||||
currentLevelStars: currentLevelStars,
|
||||
|
|
|
|||
|
|
@ -1186,7 +1186,8 @@ public extension StarGift {
|
|||
extension StarGift {
|
||||
init?(apiStarGift: Api.StarGift) {
|
||||
switch apiStarGift {
|
||||
case let .starGift(apiFlags, id, sticker, stars, availabilityRemains, availabilityTotal, availabilityResale, convertStars, firstSale, lastSale, upgradeStars, minResaleStars, title, releasedBy, perUserTotal, perUserRemains, lockedUntilDate, auctionSlug, giftsPerRound, auctionStartDate, upgradeVariantsCount, apiBackground):
|
||||
case let .starGift(starGiftData):
|
||||
let (apiFlags, id, sticker, stars, availabilityRemains, availabilityTotal, availabilityResale, convertStars, firstSale, lastSale, upgradeStars, minResaleStars, title, releasedBy, perUserTotal, perUserRemains, lockedUntilDate, auctionSlug, giftsPerRound, auctionStartDate, upgradeVariantsCount, apiBackground) = (starGiftData.flags, starGiftData.id, starGiftData.sticker, starGiftData.stars, starGiftData.availabilityRemains, starGiftData.availabilityTotal, starGiftData.availabilityResale, starGiftData.convertStars, starGiftData.firstSaleDate, starGiftData.lastSaleDate, starGiftData.upgradeStars, starGiftData.resellMinStars, starGiftData.title, starGiftData.releasedBy, starGiftData.perUserTotal, starGiftData.perUserRemains, starGiftData.lockedUntilDate, starGiftData.auctionSlug, starGiftData.giftsPerRound, starGiftData.auctionStartDate, starGiftData.upgradeVariants, starGiftData.background)
|
||||
var flags = StarGift.Gift.Flags()
|
||||
if (apiFlags & (1 << 2)) != 0 {
|
||||
flags.insert(.isBirthdayGift)
|
||||
|
|
@ -1220,7 +1221,8 @@ extension StarGift {
|
|||
}
|
||||
var background: StarGift.Gift.Background?
|
||||
switch apiBackground {
|
||||
case let .starGiftBackground(centerColor, edgeColor, textColor):
|
||||
case let .starGiftBackground(starGiftBackgroundData):
|
||||
let (centerColor, edgeColor, textColor) = (starGiftBackgroundData.centerColor, starGiftBackgroundData.edgeColor, starGiftBackgroundData.textColor)
|
||||
background = StarGift.Gift.Background(centerColor: centerColor, edgeColor: edgeColor, textColor: textColor)
|
||||
default:
|
||||
break
|
||||
|
|
@ -1247,7 +1249,8 @@ extension StarGift {
|
|||
upgradeVariantsCount: upgradeVariantsCount,
|
||||
background: background
|
||||
))
|
||||
case let .starGiftUnique(apiFlags, id, giftId, title, slug, num, ownerPeerId, ownerName, ownerAddress, attributes, availabilityIssued, availabilityTotal, giftAddress, resellAmounts, releasedBy, valueAmount, valueCurrency, valueUsdAmount, themePeer, peerColor, hostPeerId, minOfferStars):
|
||||
case let .starGiftUnique(starGiftUniqueData):
|
||||
let (apiFlags, id, giftId, title, slug, num, ownerPeerId, ownerName, ownerAddress, attributes, availabilityIssued, availabilityTotal, giftAddress, apiResellAmount, releasedBy, valueAmount, valueCurrency, valueUsdAmount, themePeer, peerColor, hostPeerId, minOfferStars) = (starGiftUniqueData.flags, starGiftUniqueData.id, starGiftUniqueData.giftId, starGiftUniqueData.title, starGiftUniqueData.slug, starGiftUniqueData.num, starGiftUniqueData.ownerId, starGiftUniqueData.ownerName, starGiftUniqueData.ownerAddress, starGiftUniqueData.attributes, starGiftUniqueData.availabilityIssued, starGiftUniqueData.availabilityTotal, starGiftUniqueData.giftAddress, starGiftUniqueData.resellAmount, starGiftUniqueData.releasedBy, starGiftUniqueData.valueAmount, starGiftUniqueData.valueCurrency, starGiftUniqueData.valueUsdAmount, starGiftUniqueData.themePeer, starGiftUniqueData.peerColor, starGiftUniqueData.hostId, starGiftUniqueData.offerMinStars)
|
||||
let owner: StarGift.UniqueGift.Owner
|
||||
if let ownerAddress {
|
||||
owner = .address(ownerAddress)
|
||||
|
|
@ -1258,7 +1261,7 @@ extension StarGift {
|
|||
} else {
|
||||
return nil
|
||||
}
|
||||
let resellAmounts = resellAmounts?.compactMap { CurrencyAmount(apiAmount: $0) }
|
||||
let resellAmounts = apiResellAmount?.compactMap { CurrencyAmount(apiAmount: $0) }
|
||||
var flags = StarGift.UniqueGift.Flags()
|
||||
if (apiFlags & (1 << 9)) != 0 {
|
||||
flags.insert(.isThemeAvailable)
|
||||
|
|
@ -1725,13 +1728,15 @@ func _internal_starGiftUpgradePreview(account: Account, giftId: Int64) -> Signal
|
|||
var nextPrices: [StarGiftUpgradePreview.Price] = []
|
||||
for price in apiPrices {
|
||||
switch price {
|
||||
case let .starGiftUpgradePrice(date, upgradeStars):
|
||||
case let .starGiftUpgradePrice(starGiftUpgradePriceData):
|
||||
let (date, upgradeStars) = (starGiftUpgradePriceData.date, starGiftUpgradePriceData.upgradeStars)
|
||||
prices.append(StarGiftUpgradePreview.Price(stars: upgradeStars, date: date))
|
||||
}
|
||||
}
|
||||
for price in apiNextPrices {
|
||||
switch price {
|
||||
case let .starGiftUpgradePrice(date, upgradeStars):
|
||||
case let .starGiftUpgradePrice(starGiftUpgradePriceData):
|
||||
let (date, upgradeStars) = (starGiftUpgradePriceData.date, starGiftUpgradePriceData.upgradeStars)
|
||||
nextPrices.append(StarGiftUpgradePreview.Price(stars: upgradeStars, date: date))
|
||||
}
|
||||
}
|
||||
|
|
@ -3489,7 +3494,8 @@ extension StarGift.UniqueGift.Attribute {
|
|||
init?(apiAttribute: Api.StarGiftAttribute) {
|
||||
func parseRarity(_ apiRarity: Api.StarGiftAttributeRarity) -> Rarity {
|
||||
switch apiRarity {
|
||||
case let .starGiftAttributeRarity(permille):
|
||||
case let .starGiftAttributeRarity(starGiftAttributeRarityData):
|
||||
let permille = starGiftAttributeRarityData.permille
|
||||
return .permille(permille)
|
||||
case .starGiftAttributeRarityRare:
|
||||
return .rare
|
||||
|
|
@ -3503,20 +3509,24 @@ extension StarGift.UniqueGift.Attribute {
|
|||
}
|
||||
|
||||
switch apiAttribute {
|
||||
case let .starGiftAttributeModel(flags, name, document, rarity):
|
||||
case let .starGiftAttributeModel(starGiftAttributeModelData):
|
||||
let (flags, name, document, rarity) = (starGiftAttributeModelData.flags, starGiftAttributeModelData.name, starGiftAttributeModelData.document, starGiftAttributeModelData.rarity)
|
||||
guard let file = telegramMediaFileFromApiDocument(document, altDocuments: nil) else {
|
||||
return nil
|
||||
}
|
||||
let crafted = (flags & (1 << 0)) != 0
|
||||
self = .model(name: name, file: file, rarity: parseRarity(rarity), crafted: crafted)
|
||||
case let .starGiftAttributePattern(name, document, rarity):
|
||||
case let .starGiftAttributePattern(starGiftAttributePatternData):
|
||||
let (name, document, rarity) = (starGiftAttributePatternData.name, starGiftAttributePatternData.document, starGiftAttributePatternData.rarity)
|
||||
guard let file = telegramMediaFileFromApiDocument(document, altDocuments: nil) else {
|
||||
return nil
|
||||
}
|
||||
self = .pattern(name: name, file: file, rarity: parseRarity(rarity))
|
||||
case let .starGiftAttributeBackdrop(name, id, centerColor, edgeColor, patternColor, textColor, rarity):
|
||||
case let .starGiftAttributeBackdrop(starGiftAttributeBackdropData):
|
||||
let (name, id, centerColor, edgeColor, patternColor, textColor, rarity) = (starGiftAttributeBackdropData.name, starGiftAttributeBackdropData.backdropId, starGiftAttributeBackdropData.centerColor, starGiftAttributeBackdropData.edgeColor, starGiftAttributeBackdropData.patternColor, starGiftAttributeBackdropData.textColor, starGiftAttributeBackdropData.rarity)
|
||||
self = .backdrop(name: name, id: id, innerColor: centerColor, outerColor: edgeColor, patternColor: patternColor, textColor: textColor, rarity: parseRarity(rarity))
|
||||
case let .starGiftAttributeOriginalDetails(_, sender, recipient, date, message):
|
||||
case let .starGiftAttributeOriginalDetails(starGiftAttributeOriginalDetailsData):
|
||||
let (_, sender, recipient, date, message) = (starGiftAttributeOriginalDetailsData.flags, starGiftAttributeOriginalDetailsData.senderId, starGiftAttributeOriginalDetailsData.recipientId, starGiftAttributeOriginalDetailsData.date, starGiftAttributeOriginalDetailsData.message)
|
||||
var text: String?
|
||||
var entities: [MessageTextEntity]?
|
||||
if case let .textWithEntities(textValue, entitiesValue) = message {
|
||||
|
|
@ -3903,11 +3913,11 @@ private final class ResaleGiftsContextImpl {
|
|||
apiAttributes = filterAttributes.map {
|
||||
switch $0 {
|
||||
case let .model(id):
|
||||
return .starGiftAttributeIdModel(documentId: id)
|
||||
return .starGiftAttributeIdModel(.init(documentId: id))
|
||||
case let .pattern(id):
|
||||
return .starGiftAttributeIdPattern(documentId: id)
|
||||
return .starGiftAttributeIdPattern(.init(documentId: id))
|
||||
case let .backdrop(id):
|
||||
return .starGiftAttributeIdBackdrop(backdropId: id)
|
||||
return .starGiftAttributeIdBackdrop(.init(backdropId: id))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -3939,13 +3949,17 @@ private final class ResaleGiftsContextImpl {
|
|||
var attributeCountValue: [ResaleGiftsContext.Attribute: Int32] = [:]
|
||||
for counter in counters {
|
||||
switch counter {
|
||||
case let .starGiftAttributeCounter(attribute, count):
|
||||
case let .starGiftAttributeCounter(starGiftAttributeCounterData):
|
||||
let (attribute, count) = (starGiftAttributeCounterData.attribute, starGiftAttributeCounterData.count)
|
||||
switch attribute {
|
||||
case let .starGiftAttributeIdModel(documentId):
|
||||
case let .starGiftAttributeIdModel(starGiftAttributeIdModelData):
|
||||
let documentId = starGiftAttributeIdModelData.documentId
|
||||
attributeCountValue[.model(documentId)] = count
|
||||
case let .starGiftAttributeIdPattern(documentId):
|
||||
case let .starGiftAttributeIdPattern(starGiftAttributeIdPatternData):
|
||||
let documentId = starGiftAttributeIdPatternData.documentId
|
||||
attributeCountValue[.pattern(documentId)] = count
|
||||
case let .starGiftAttributeIdBackdrop(backdropId):
|
||||
case let .starGiftAttributeIdBackdrop(starGiftAttributeIdBackdropData):
|
||||
let backdropId = starGiftAttributeIdBackdropData.backdropId
|
||||
attributeCountValue[.backdrop(backdropId)] = count
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -254,7 +254,8 @@ extension GiftAuctionContext.State.BidLevel {
|
|||
extension GiftAuctionContext.State.AuctionState {
|
||||
init?(apiAuctionState: Api.StarGiftAuctionState, peers: [PeerId: Peer]) {
|
||||
switch apiAuctionState {
|
||||
case let .starGiftAuctionState(version, startDate, endDate, minBidAmount, bidLevels, topBiddersPeerIds, nextRoundAt, lastGiftNumber, giftsLeft, currentRound, totalRounds, apiRounds):
|
||||
case let .starGiftAuctionState(starGiftAuctionStateData):
|
||||
let (version, startDate, endDate, minBidAmount, bidLevels, topBiddersPeerIds, nextRoundAt, lastGiftNumber, giftsLeft, currentRound, totalRounds, apiRounds) = (starGiftAuctionStateData.version, starGiftAuctionStateData.startDate, starGiftAuctionStateData.endDate, starGiftAuctionStateData.minBidAmount, starGiftAuctionStateData.bidLevels, starGiftAuctionStateData.topBidders, starGiftAuctionStateData.nextRoundAt, starGiftAuctionStateData.lastGiftNum, starGiftAuctionStateData.giftsLeft, starGiftAuctionStateData.currentRound, starGiftAuctionStateData.totalRounds, starGiftAuctionStateData.rounds)
|
||||
var topBidders: [EnginePeer] = []
|
||||
for peerId in topBiddersPeerIds {
|
||||
if let peer = peers[PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt64Value(peerId))] {
|
||||
|
|
@ -264,9 +265,11 @@ extension GiftAuctionContext.State.AuctionState {
|
|||
var rounds: [GiftAuctionContext.State.Round] = []
|
||||
for apiRound in apiRounds {
|
||||
switch apiRound {
|
||||
case let .starGiftAuctionRound(num, duration):
|
||||
case let .starGiftAuctionRound(starGiftAuctionRoundData):
|
||||
let (num, duration) = (starGiftAuctionRoundData.num, starGiftAuctionRoundData.duration)
|
||||
rounds.append(.generic(num: num, duration: duration))
|
||||
case let .starGiftAuctionRoundExtendable(num, duration, extendTop, extendWindow):
|
||||
case let .starGiftAuctionRoundExtendable(starGiftAuctionRoundExtendableData):
|
||||
let (num, duration, extendTop, extendWindow) = (starGiftAuctionRoundExtendableData.num, starGiftAuctionRoundExtendableData.duration, starGiftAuctionRoundExtendableData.extendTop, starGiftAuctionRoundExtendableData.extendWindow)
|
||||
rounds.append(.extendable(num: num, duration: duration, extendTop: extendTop, extendWindow: extendWindow))
|
||||
}
|
||||
}
|
||||
|
|
@ -284,7 +287,8 @@ extension GiftAuctionContext.State.AuctionState {
|
|||
rounds: rounds,
|
||||
lastGiftNumber: lastGiftNumber
|
||||
)
|
||||
case let .starGiftAuctionStateFinished(_, startDate, endDate, averagePrice, listedCount, fragmentListedCount, fragmentListedUrl):
|
||||
case let .starGiftAuctionStateFinished(starGiftAuctionStateFinishedData):
|
||||
let (startDate, endDate, averagePrice, listedCount, fragmentListedCount, fragmentListedUrl) = (starGiftAuctionStateFinishedData.startDate, starGiftAuctionStateFinishedData.endDate, starGiftAuctionStateFinishedData.averagePrice, starGiftAuctionStateFinishedData.listedCount, starGiftAuctionStateFinishedData.fragmentListedCount, starGiftAuctionStateFinishedData.fragmentListedUrl)
|
||||
self = .finished(
|
||||
startDate: startDate,
|
||||
endDate: endDate,
|
||||
|
|
@ -297,10 +301,11 @@ extension GiftAuctionContext.State.AuctionState {
|
|||
return nil
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
init?(apiAuctionState: Api.StarGiftAuctionState, transaction: Transaction) {
|
||||
switch apiAuctionState {
|
||||
case let .starGiftAuctionState(version, startDate, endDate, minBidAmount, bidLevels, topBiddersPeerIds, nextRoundAt, lastGiftNumber, giftsLeft, currentRound, totalRounds, apiRounds):
|
||||
case let .starGiftAuctionState(starGiftAuctionStateData):
|
||||
let (version, startDate, endDate, minBidAmount, bidLevels, topBiddersPeerIds, nextRoundAt, lastGiftNumber, giftsLeft, currentRound, totalRounds, apiRounds) = (starGiftAuctionStateData.version, starGiftAuctionStateData.startDate, starGiftAuctionStateData.endDate, starGiftAuctionStateData.minBidAmount, starGiftAuctionStateData.bidLevels, starGiftAuctionStateData.topBidders, starGiftAuctionStateData.nextRoundAt, starGiftAuctionStateData.lastGiftNum, starGiftAuctionStateData.giftsLeft, starGiftAuctionStateData.currentRound, starGiftAuctionStateData.totalRounds, starGiftAuctionStateData.rounds)
|
||||
var topBidders: [EnginePeer] = []
|
||||
for peerId in topBiddersPeerIds {
|
||||
if let peer = transaction.getPeer(PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt64Value(peerId))) {
|
||||
|
|
@ -310,9 +315,11 @@ extension GiftAuctionContext.State.AuctionState {
|
|||
var rounds: [GiftAuctionContext.State.Round] = []
|
||||
for apiRound in apiRounds {
|
||||
switch apiRound {
|
||||
case let .starGiftAuctionRound(num, duration):
|
||||
case let .starGiftAuctionRound(starGiftAuctionRoundData):
|
||||
let (num, duration) = (starGiftAuctionRoundData.num, starGiftAuctionRoundData.duration)
|
||||
rounds.append(.generic(num: num, duration: duration))
|
||||
case let .starGiftAuctionRoundExtendable(num, duration, extendTop, extendWindow):
|
||||
case let .starGiftAuctionRoundExtendable(starGiftAuctionRoundExtendableData):
|
||||
let (num, duration, extendTop, extendWindow) = (starGiftAuctionRoundExtendableData.num, starGiftAuctionRoundExtendableData.duration, starGiftAuctionRoundExtendableData.extendTop, starGiftAuctionRoundExtendableData.extendWindow)
|
||||
rounds.append(.extendable(num: num, duration: duration, extendTop: extendTop, extendWindow: extendWindow))
|
||||
}
|
||||
}
|
||||
|
|
@ -330,7 +337,8 @@ extension GiftAuctionContext.State.AuctionState {
|
|||
rounds: rounds,
|
||||
lastGiftNumber: lastGiftNumber
|
||||
)
|
||||
case let .starGiftAuctionStateFinished(_, startDate, endDate, averagePrice, listedCount, fragmentListedCount, fragmentListedUrl):
|
||||
case let .starGiftAuctionStateFinished(starGiftAuctionStateFinishedData):
|
||||
let (startDate, endDate, averagePrice, listedCount, fragmentListedCount, fragmentListedUrl) = (starGiftAuctionStateFinishedData.startDate, starGiftAuctionStateFinishedData.endDate, starGiftAuctionStateFinishedData.averagePrice, starGiftAuctionStateFinishedData.listedCount, starGiftAuctionStateFinishedData.fragmentListedCount, starGiftAuctionStateFinishedData.fragmentListedUrl)
|
||||
self = .finished(
|
||||
startDate: startDate,
|
||||
endDate: endDate,
|
||||
|
|
@ -348,7 +356,8 @@ extension GiftAuctionContext.State.AuctionState {
|
|||
extension GiftAuctionContext.State.MyState {
|
||||
init(apiAuctionUserState: Api.StarGiftAuctionUserState) {
|
||||
switch apiAuctionUserState {
|
||||
case let .starGiftAuctionUserState(flags, bidAmount, bidDate, minBidAmount, bidPeerId, acquiredCount):
|
||||
case let .starGiftAuctionUserState(starGiftAuctionUserStateData):
|
||||
let (flags, bidAmount, bidDate, minBidAmount, bidPeerId, acquiredCount) = (starGiftAuctionUserStateData.flags, starGiftAuctionUserStateData.bidAmount, starGiftAuctionUserStateData.bidDate, starGiftAuctionUserStateData.minBidAmount, starGiftAuctionUserStateData.bidPeer, starGiftAuctionUserStateData.acquiredCount)
|
||||
self.isReturned = (flags & (1 << 1)) != 0
|
||||
self.bidAmount = bidAmount
|
||||
self.bidDate = bidDate
|
||||
|
|
@ -390,7 +399,8 @@ func _internal_getGiftAuctionAcquiredGifts(account: Account, giftId: Int64) -> S
|
|||
var mappedGifts: [GiftAuctionAcquiredGift] = []
|
||||
for gift in gifts {
|
||||
switch gift {
|
||||
case let .starGiftAuctionAcquiredGift(flags, peerId, date, bidAmount, round, pos, message, number):
|
||||
case let .starGiftAuctionAcquiredGift(starGiftAuctionAcquiredGiftData):
|
||||
let (flags, peerId, date, bidAmount, round, pos, message, number) = (starGiftAuctionAcquiredGiftData.flags, starGiftAuctionAcquiredGiftData.peer, starGiftAuctionAcquiredGiftData.date, starGiftAuctionAcquiredGiftData.bidAmount, starGiftAuctionAcquiredGiftData.round, starGiftAuctionAcquiredGiftData.pos, starGiftAuctionAcquiredGiftData.message, starGiftAuctionAcquiredGiftData.giftNum)
|
||||
if let peer = transaction.getPeer(peerId.peerId) {
|
||||
var text: String?
|
||||
var entities: [MessageTextEntity]?
|
||||
|
|
@ -434,7 +444,8 @@ func _internal_getActiveGiftAuctions(account: Account, hash: Int64) -> Signal<[G
|
|||
var auctionContexts: [GiftAuctionContext] = []
|
||||
for auction in auctions {
|
||||
switch auction {
|
||||
case let .starGiftActiveAuctionState(apiGift, auctionState, userState):
|
||||
case let .starGiftActiveAuctionState(starGiftActiveAuctionStateData):
|
||||
let (apiGift, auctionState, userState) = (starGiftActiveAuctionStateData.gift, starGiftActiveAuctionStateData.state, starGiftActiveAuctionStateData.userState)
|
||||
guard let gift = StarGift(apiStarGift: apiGift) else {
|
||||
continue
|
||||
}
|
||||
|
|
|
|||
|
|
@ -42,7 +42,13 @@ public struct StarGiftCollection: Codable, Equatable {
|
|||
extension StarGiftCollection {
|
||||
init?(apiStarGiftCollection: Api.StarGiftCollection) {
|
||||
switch apiStarGiftCollection {
|
||||
case let .starGiftCollection(_, collectionId, title, icon, giftsCount, hash):
|
||||
case let .starGiftCollection(starGiftCollectionData):
|
||||
let _ = starGiftCollectionData.flags
|
||||
let collectionId = starGiftCollectionData.collectionId
|
||||
let title = starGiftCollectionData.title
|
||||
let icon = starGiftCollectionData.icon
|
||||
let giftsCount = starGiftCollectionData.giftsCount
|
||||
let hash = starGiftCollectionData.hash
|
||||
self.id = collectionId
|
||||
self.title = title
|
||||
self.icon = icon.flatMap { telegramMediaFileFromApiDocument($0, altDocuments: nil) }
|
||||
|
|
|
|||
|
|
@ -117,7 +117,8 @@ public struct StarsGiftOption: Equatable, Codable {
|
|||
extension StarsGiftOption {
|
||||
init(apiStarsGiftOption: Api.StarsGiftOption) {
|
||||
switch apiStarsGiftOption {
|
||||
case let .starsGiftOption(flags, stars, storeProduct, currency, amount):
|
||||
case let .starsGiftOption(starsGiftOptionData):
|
||||
let (flags, stars, storeProduct, currency, amount) = (starsGiftOptionData.flags, starsGiftOptionData.stars, starsGiftOptionData.storeProduct, starsGiftOptionData.currency, starsGiftOptionData.amount)
|
||||
self.init(count: stars, storeProductId: storeProduct, currency: currency, amount: amount, isExtended: (flags & (1 << 1)) != 0)
|
||||
}
|
||||
}
|
||||
|
|
@ -241,7 +242,8 @@ public struct StarsGiveawayOption: Equatable, Codable {
|
|||
extension StarsGiveawayOption.Winners {
|
||||
init(apiStarsGiveawayWinnersOption: Api.StarsGiveawayWinnersOption) {
|
||||
switch apiStarsGiveawayWinnersOption {
|
||||
case let .starsGiveawayWinnersOption(flags, users, starsPerUser):
|
||||
case let .starsGiveawayWinnersOption(starsGiveawayWinnersOptionData):
|
||||
let (flags, users, starsPerUser) = (starsGiveawayWinnersOptionData.flags, starsGiveawayWinnersOptionData.users, starsGiveawayWinnersOptionData.perUserStars)
|
||||
self.init(users: users, starsPerUser: starsPerUser, isDefault: (flags & (1 << 0)) != 0)
|
||||
}
|
||||
}
|
||||
|
|
@ -250,7 +252,8 @@ extension StarsGiveawayOption.Winners {
|
|||
extension StarsGiveawayOption {
|
||||
init(apiStarsGiveawayOption: Api.StarsGiveawayOption) {
|
||||
switch apiStarsGiveawayOption {
|
||||
case let .starsGiveawayOption(flags, stars, yearlyBoosts, storeProduct, currency, amount, winners):
|
||||
case let .starsGiveawayOption(starsGiveawayOptionData):
|
||||
let (flags, stars, yearlyBoosts, storeProduct, currency, amount, winners) = (starsGiveawayOptionData.flags, starsGiveawayOptionData.stars, starsGiveawayOptionData.yearlyBoosts, starsGiveawayOptionData.storeProduct, starsGiveawayOptionData.currency, starsGiveawayOptionData.amount, starsGiveawayOptionData.winners)
|
||||
self.init(count: stars, yearlyBoosts: yearlyBoosts, storeProductId: storeProduct, currency: currency, amount: amount, winners: winners.map { StarsGiveawayOption.Winners(apiStarsGiveawayWinnersOption: $0) }, isExtended: (flags & (1 << 0)) != 0, isDefault: (flags & (1 << 1)) != 0)
|
||||
}
|
||||
}
|
||||
|
|
@ -346,9 +349,11 @@ public struct StarsAmount: Equatable, Comparable, Hashable, Codable, CustomStrin
|
|||
extension StarsAmount {
|
||||
init(apiAmount: Api.StarsAmount) {
|
||||
switch apiAmount {
|
||||
case let .starsAmount(amount, nanos):
|
||||
case let .starsAmount(starsAmountData):
|
||||
let (amount, nanos) = (starsAmountData.amount, starsAmountData.nanos)
|
||||
self.init(value: amount, nanos: nanos)
|
||||
case let .starsTonAmount(amount):
|
||||
case let .starsTonAmount(starsTonAmountData):
|
||||
let amount = starsTonAmountData.amount
|
||||
self.init(value: amount, nanos: 0)
|
||||
}
|
||||
}
|
||||
|
|
@ -389,9 +394,11 @@ public struct CurrencyAmount: Equatable, Hashable, Codable {
|
|||
extension CurrencyAmount {
|
||||
init(apiAmount: Api.StarsAmount) {
|
||||
switch apiAmount {
|
||||
case let .starsAmount(amount, nanos):
|
||||
case let .starsAmount(starsAmountData):
|
||||
let (amount, nanos) = (starsAmountData.amount, starsAmountData.nanos)
|
||||
self.init(amount: StarsAmount(value: amount, nanos: nanos), currency: .stars)
|
||||
case let .starsTonAmount(amount):
|
||||
case let .starsTonAmount(starsTonAmountData):
|
||||
let amount = starsTonAmountData.amount
|
||||
self.init(amount: StarsAmount(value: amount, nanos: 0), currency: .ton)
|
||||
}
|
||||
}
|
||||
|
|
@ -399,10 +406,10 @@ extension CurrencyAmount {
|
|||
var apiAmount: Api.StarsAmount {
|
||||
switch self.currency {
|
||||
case .stars:
|
||||
return .starsAmount(amount: self.amount.value, nanos: self.amount.nanos)
|
||||
return .starsAmount(.init(amount: self.amount.value, nanos: self.amount.nanos))
|
||||
case .ton:
|
||||
assert(self.amount.nanos == 0)
|
||||
return .starsTonAmount(amount: self.amount.value)
|
||||
return .starsTonAmount(.init(amount: self.amount.value))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue