mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-06-16 05:55:20 +00:00
Use embedded gift remaining count if no actual data available
This commit is contained in:
parent
c529ba1c87
commit
765bca915e
@ -462,6 +462,7 @@ private final class GiftViewSheetContent: CombinedComponent {
|
|||||||
let convertStars: Int64?
|
let convertStars: Int64?
|
||||||
let text: String?
|
let text: String?
|
||||||
let entities: [MessageTextEntity]?
|
let entities: [MessageTextEntity]?
|
||||||
|
var limitRemains: Int32?
|
||||||
let limitTotal: Int32?
|
let limitTotal: Int32?
|
||||||
var incoming = false
|
var incoming = false
|
||||||
var savedToProfile = false
|
var savedToProfile = false
|
||||||
@ -483,6 +484,7 @@ private final class GiftViewSheetContent: CombinedComponent {
|
|||||||
stars = gift.price
|
stars = gift.price
|
||||||
text = nil
|
text = nil
|
||||||
entities = nil
|
entities = nil
|
||||||
|
limitRemains = nil
|
||||||
limitTotal = gift.availability?.total
|
limitTotal = gift.availability?.total
|
||||||
convertStars = nil
|
convertStars = nil
|
||||||
soldOut = true
|
soldOut = true
|
||||||
@ -494,6 +496,7 @@ private final class GiftViewSheetContent: CombinedComponent {
|
|||||||
stars = gift.price
|
stars = gift.price
|
||||||
text = arguments.text
|
text = arguments.text
|
||||||
entities = arguments.entities
|
entities = arguments.entities
|
||||||
|
limitRemains = gift.availability?.remains
|
||||||
limitTotal = gift.availability?.total
|
limitTotal = gift.availability?.total
|
||||||
convertStars = arguments.convertStars
|
convertStars = arguments.convertStars
|
||||||
converted = arguments.converted
|
converted = arguments.converted
|
||||||
@ -506,6 +509,7 @@ private final class GiftViewSheetContent: CombinedComponent {
|
|||||||
stars = 0
|
stars = 0
|
||||||
text = nil
|
text = nil
|
||||||
entities = nil
|
entities = nil
|
||||||
|
limitRemains = nil
|
||||||
limitTotal = nil
|
limitTotal = nil
|
||||||
convertStars = nil
|
convertStars = nil
|
||||||
uniqueGift = gift
|
uniqueGift = gift
|
||||||
@ -1818,7 +1822,7 @@ private final class GiftViewSheetContent: CombinedComponent {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if let limitTotal {
|
if let limitTotal {
|
||||||
var remains: Int32 = 0
|
var remains: Int32 = limitRemains ?? 0
|
||||||
if let gift = state.starGiftsMap[giftId], let availability = gift.availability {
|
if let gift = state.starGiftsMap[giftId], let availability = gift.availability {
|
||||||
remains = availability.remains
|
remains = availability.remains
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user