@@ -957,7 +957,7 @@ private final class GiftAuctionBidScreenComponent: Component {
957957 let hideName : Bool
958958 let gift : StarGift
959959 let auctionContext : GiftAuctionContext
960- let acquiredGifts : [ GiftAuctionAcquiredGift ] ?
960+ let acquiredGifts : Signal < [ GiftAuctionAcquiredGift ] , NoError > ?
961961
962962 init (
963963 context: AccountContext ,
@@ -967,7 +967,7 @@ private final class GiftAuctionBidScreenComponent: Component {
967967 hideName: Bool ,
968968 gift: StarGift ,
969969 auctionContext: GiftAuctionContext ,
970- acquiredGifts: [ GiftAuctionAcquiredGift ] ?
970+ acquiredGifts: Signal < [ GiftAuctionAcquiredGift ] , NoError > ?
971971 ) {
972972 self . context = context
973973 self . toPeerId = toPeerId
@@ -1922,8 +1922,6 @@ private final class GiftAuctionBidScreenComponent: Component {
19221922 }
19231923
19241924 if self . component == nil {
1925- self . giftAuctionAcquiredGifts = component. acquiredGifts
1926-
19271925 if let starsContext = component. context. starsContext {
19281926 self . balanceDisposable = ( starsContext. state
19291927 |> deliverOnMainQueue) . startStrict ( next: { [ weak self] state in
@@ -1957,6 +1955,18 @@ private final class GiftAuctionBidScreenComponent: Component {
19571955 peerIds. append ( context. account. peerId)
19581956 self . resetSliderValue ( component: component)
19591957 transition = . immediate
1958+
1959+ if let acquiredGifts = component. acquiredGifts {
1960+ self . giftAuctionAcquiredGiftsDisposable. set ( ( acquiredGifts
1961+ |> take ( 1 )
1962+ |> deliverOnMainQueue) . start ( next: { [ weak self] acquiredGifts in
1963+ self ? . giftAuctionAcquiredGifts = acquiredGifts
1964+ } ) )
1965+ } else if let acquiredCount = auctionState? . myState. acquiredCount, acquiredCount > 0 {
1966+ Queue . mainQueue ( ) . justDispatch {
1967+ self . loadAcquiredGifts ( )
1968+ }
1969+ }
19601970 }
19611971
19621972 if !peerIds. isEmpty {
@@ -1981,13 +1991,7 @@ private final class GiftAuctionBidScreenComponent: Component {
19811991 }
19821992 self . state? . updated ( transition: transition)
19831993
1984- let previousAcquiredCount : Int32
1985- if let previousState {
1986- previousAcquiredCount = previousState. myState. acquiredCount
1987- } else {
1988- previousAcquiredCount = Int32 ( component. acquiredGifts? . count ?? 0 )
1989- }
1990- if let acquiredCount = auctionState? . myState. acquiredCount, acquiredCount > previousAcquiredCount {
1994+ if let acquiredCount = auctionState? . myState. acquiredCount, let previousAcquiredCount = previousState? . myState. acquiredCount, acquiredCount > previousAcquiredCount {
19911995 Queue . mainQueue ( ) . justDispatch {
19921996 self . loadAcquiredGifts ( )
19931997 }
@@ -2310,7 +2314,6 @@ private final class GiftAuctionBidScreenComponent: Component {
23102314
23112315 var perks : [ ( [ AnimatedTextComponent . Item ] , String ) ] = [ ]
23122316
2313- var minBidIsSmall = false
23142317 var minBidAnimatedItems : [ AnimatedTextComponent . Item ] = [ ]
23152318 var untilNextDropAnimatedItems : [ AnimatedTextComponent . Item ] = [ ]
23162319 var dropsLeftAnimatedItems : [ AnimatedTextComponent . Item ] = [ ]
@@ -2321,11 +2324,13 @@ private final class GiftAuctionBidScreenComponent: Component {
23212324 if let myMinBidAmmount = self . giftAuctionState? . myState. minBidAmount {
23222325 minBidAmount = myMinBidAmmount
23232326 }
2324- var minBidString = " # \( presentationStringsFormattedNumber ( Int32 ( clamping: minBidAmount) , environment. dateTimeFormat. groupingSeparator) ) "
2325- if minBidAmount > 999999 {
2326- minBidString = " # \( minBidAmount) "
2327- minBidIsSmall = true
2327+ var minBidString : String
2328+ if minBidAmount > 99999 {
2329+ minBidString = compactNumericCountString ( Int ( minBidAmount) , decimalSeparator: environment. dateTimeFormat. decimalSeparator, showDecimalPart: false )
2330+ } else {
2331+ minBidString = presentationStringsFormattedNumber ( Int32 ( clamping: minBidAmount) , environment. dateTimeFormat. groupingSeparator)
23282332 }
2333+ minBidString = " # \( minBidString) "
23292334 if let hashIndex = minBidString. firstIndex ( of: " # " ) {
23302335 var prefix = String ( minBidString [ ..< hashIndex] )
23312336 if !prefix. isEmpty {
@@ -2440,7 +2445,7 @@ private final class GiftAuctionBidScreenComponent: Component {
24402445 gift: i == perks. count - 1 ? component. auctionContext. gift : nil ,
24412446 title: perk. 0 ,
24422447 subtitle: perk. 1 ,
2443- small: i == 0 && minBidIsSmall ,
2448+ small: false ,
24442449 theme: environment. theme
24452450 ) ) ,
24462451 environment: { } ,
@@ -2939,7 +2944,7 @@ public class GiftAuctionBidScreen: ViewControllerComponentContainer {
29392944 private var didPlayAppearAnimation : Bool = false
29402945 private var isDismissed : Bool = false
29412946
2942- public init ( context: AccountContext , toPeerId: EnginePeer . Id , text: String ? , entities: [ MessageTextEntity ] ? , hideName: Bool , auctionContext: GiftAuctionContext , acquiredGifts: [ GiftAuctionAcquiredGift ] ? ) {
2947+ public init ( context: AccountContext , toPeerId: EnginePeer . Id , text: String ? , entities: [ MessageTextEntity ] ? , hideName: Bool , auctionContext: GiftAuctionContext , acquiredGifts: Signal < [ GiftAuctionAcquiredGift ] , NoError > ? ) {
29432948 self . context = context
29442949
29452950 super. init ( context: context, component: GiftAuctionBidScreenComponent (
0 commit comments