@@ -2186,12 +2186,79 @@ private final class GiftAuctionBidScreenComponent: Component {
21862186 giftsPerRound = giftsPerRoundValue
21872187 }
21882188
2189+ var myBidTitleComponent : AnyComponent < Empty > ?
2190+ var myBidComponent : AnyComponent < Empty > ?
2191+
2192+ var topBidsTitleComponent : AnyComponent < Empty > ?
2193+ var topBidsComponents : [ ( EnginePeer . Id , AnyComponent < Empty > ) ] = [ ]
2194+
2195+ let place : Int32
2196+ if let giftAuctionState = self . giftAuctionState, case let . ongoing( _, _, _, _, bidLevels, topBidders, _, _, _, _) = giftAuctionState. auctionState {
2197+ var myBidAmount = Int64 ( self . amount. realValue)
2198+ var myBidDate = currentTime
2199+ var isBiddingUp = true
2200+
2201+ if let currentAmount = giftAuctionState. myState. bidAmount, let currentDate = giftAuctionState. myState. bidDate, currentAmount >= myBidAmount {
2202+ myBidAmount = currentAmount
2203+ myBidDate = currentDate
2204+ isBiddingUp = false
2205+ }
2206+
2207+ place = giftAuctionState. getPlace ( myBid: myBidAmount, myBidDate: myBidDate) ?? 1
2208+
2209+ var bidTitle : String
2210+ var bidTitleColor : UIColor
2211+ var bidStatus : PeerComponent . Status ?
2212+ if isBiddingUp {
2213+ bidTitleColor = environment. theme. list. itemSecondaryTextColor
2214+ bidTitle = environment. strings. Gift_AuctionBid_BidPreview
2215+ } else if giftAuctionState. myState. isReturned {
2216+ bidTitle = environment. strings. Gift_AuctionBid_Outbid
2217+ bidTitleColor = environment. theme. list. itemDestructiveColor
2218+ bidStatus = . returned
2219+ } else if place > giftsPerRound {
2220+ bidTitle = environment. strings. Gift_AuctionBid_Outbid
2221+ bidTitleColor = environment. theme. list. itemDestructiveColor
2222+ bidStatus = . outbid
2223+ } else {
2224+ bidTitle = environment. strings. Gift_AuctionBid_Winning
2225+ bidTitleColor = environment. theme. list. itemDisclosureActions. constructive. fillColor
2226+ bidStatus = . winning
2227+ }
2228+
2229+ if let peer = self . peersMap [ component. context. account. peerId] {
2230+ myBidTitleComponent = AnyComponent ( MultilineTextComponent ( text: . plain( NSAttributedString ( string: bidTitle. uppercased ( ) , font: Font . medium ( 13.0 ) , textColor: bidTitleColor) ) ) )
2231+ myBidComponent = AnyComponent ( PeerComponent ( context: component. context, theme: environment. theme, groupingSeparator: environment. dateTimeFormat. groupingSeparator, peer: peer, place: place, amount: myBidAmount, status: bidStatus, isLast: true , action: nil ) )
2232+ }
2233+
2234+ var i : Int32 = 1
2235+ for peer in topBidders {
2236+ var bid : Int64 = 0
2237+ for level in bidLevels {
2238+ if level. position == i {
2239+ bid = level. amount
2240+ break
2241+ }
2242+ }
2243+ topBidsComponents. append ( ( peer. id, AnyComponent ( PeerComponent ( context: component. context, theme: environment. theme, groupingSeparator: environment. dateTimeFormat. groupingSeparator, peer: peer, place: i, amount: bid, isLast: i == topBidders. count, action: nil ) ) ) )
2244+ i += 1
2245+ }
2246+
2247+ if !topBidsComponents. isEmpty {
2248+ topBidsTitleComponent = AnyComponent ( MultilineTextComponent ( text: . plain( NSAttributedString ( string: environment. strings. Gift_AuctionBid_TopWinners. uppercased ( ) , font: Font . medium ( 13.0 ) , textColor: environment. theme. list. itemSecondaryTextColor) ) ) )
2249+ }
2250+ } else {
2251+ place = 1
2252+ }
2253+
21892254 var topCutoffRealValue : Int ?
2190- if let giftAuctionState = self . giftAuctionState, case let . ongoing( _, _, _, _, bidLevels, _, _, _, _, _) = giftAuctionState. auctionState {
2191- for bidLevel in bidLevels {
2192- if bidLevel. position == giftsPerRound - 1 {
2193- topCutoffRealValue = Int ( bidLevel. amount)
2194- break
2255+ if place > giftsPerRound {
2256+ if let giftAuctionState = self . giftAuctionState, case let . ongoing( _, _, _, _, bidLevels, _, _, _, _, _) = giftAuctionState. auctionState {
2257+ for bidLevel in bidLevels {
2258+ if bidLevel. position == giftsPerRound - 1 {
2259+ topCutoffRealValue = Int ( bidLevel. amount)
2260+ break
2261+ }
21952262 }
21962263 }
21972264 }
@@ -2298,72 +2365,7 @@ private final class GiftAuctionBidScreenComponent: Component {
22982365 self . badgeStars. frame = starsRect
22992366 self . badgeStars. update ( size: starsRect. size, color: sliderColor, emitterPosition: CGPoint ( x: badgeFrame. midX, y: badgeFrame. maxY - 32.0 ) )
23002367 }
2301-
2302- var myBidTitleComponent : AnyComponent < Empty > ?
2303- var myBidComponent : AnyComponent < Empty > ?
2304-
2305- var topBidsTitleComponent : AnyComponent < Empty > ?
2306- var topBidsComponents : [ ( EnginePeer . Id , AnyComponent < Empty > ) ] = [ ]
2307-
2308- let place : Int32
2309- if let giftAuctionState = self . giftAuctionState, case let . ongoing( _, _, _, _, bidLevels, topBidders, _, _, _, _) = giftAuctionState. auctionState {
2310- var myBidAmount = Int64 ( self . amount. realValue)
2311- var myBidDate = currentTime
2312- var isBiddingUp = true
2313-
2314- if let currentAmount = giftAuctionState. myState. bidAmount, let currentDate = giftAuctionState. myState. bidDate, currentAmount >= myBidAmount {
2315- myBidAmount = currentAmount
2316- myBidDate = currentDate
2317- isBiddingUp = false
2318- }
2319-
2320- place = giftAuctionState. getPlace ( myBid: myBidAmount, myBidDate: myBidDate) ?? 1
2321-
2322- var bidTitle : String
2323- var bidTitleColor : UIColor
2324- var bidStatus : PeerComponent . Status ?
2325- if isBiddingUp {
2326- bidTitleColor = environment. theme. list. itemSecondaryTextColor
2327- bidTitle = environment. strings. Gift_AuctionBid_BidPreview
2328- } else if giftAuctionState. myState. isReturned {
2329- bidTitle = environment. strings. Gift_AuctionBid_Outbid
2330- bidTitleColor = environment. theme. list. itemDestructiveColor
2331- bidStatus = . returned
2332- } else if place > giftsPerRound {
2333- bidTitle = environment. strings. Gift_AuctionBid_Outbid
2334- bidTitleColor = environment. theme. list. itemDestructiveColor
2335- bidStatus = . outbid
2336- } else {
2337- bidTitle = environment. strings. Gift_AuctionBid_Winning
2338- bidTitleColor = environment. theme. list. itemDisclosureActions. constructive. fillColor
2339- bidStatus = . winning
2340- }
2341-
2342- if let peer = self . peersMap [ component. context. account. peerId] {
2343- myBidTitleComponent = AnyComponent ( MultilineTextComponent ( text: . plain( NSAttributedString ( string: bidTitle. uppercased ( ) , font: Font . medium ( 13.0 ) , textColor: bidTitleColor) ) ) )
2344- myBidComponent = AnyComponent ( PeerComponent ( context: component. context, theme: environment. theme, groupingSeparator: environment. dateTimeFormat. groupingSeparator, peer: peer, place: place, amount: myBidAmount, status: bidStatus, isLast: true , action: nil ) )
2345- }
2346-
2347- var i : Int32 = 1
2348- for peer in topBidders {
2349- var bid : Int64 = 0
2350- for level in bidLevels {
2351- if level. position == i {
2352- bid = level. amount
2353- break
2354- }
2355- }
2356- topBidsComponents. append ( ( peer. id, AnyComponent ( PeerComponent ( context: component. context, theme: environment. theme, groupingSeparator: environment. dateTimeFormat. groupingSeparator, peer: peer, place: i, amount: bid, isLast: i == topBidders. count, action: nil ) ) ) )
2357- i += 1
2358- }
2359-
2360- if !topBidsComponents. isEmpty {
2361- topBidsTitleComponent = AnyComponent ( MultilineTextComponent ( text: . plain( NSAttributedString ( string: environment. strings. Gift_AuctionBid_TopWinners. uppercased ( ) , font: Font . medium ( 13.0 ) , textColor: environment. theme. list. itemSecondaryTextColor) ) ) )
2362- }
2363- } else {
2364- place = 1
2365- }
2366-
2368+
23672369 var perks : [ ( [ AnimatedTextComponent . Item ] , String ) ] = [ ]
23682370
23692371 var minBidAnimatedItems : [ AnimatedTextComponent . Item ] = [ ]
0 commit comments