@@ -229,7 +229,7 @@ private final class BadgeComponent: Component {
229229 self . badgeForeground. bounds = CGRect ( origin: CGPoint ( ) , size: CGSize ( width: 600.0 , height: badgeFullSize. height + 10.0 ) )
230230
231231 self . badgeIcon. frame = CGRect ( x: 10.0 , y: 9.0 , width: 30.0 , height: 30.0 )
232- self . badgeLabelMaskView. frame = CGRect ( x: 0.0 , y: 0.0 , width: 100 .0, height: 36.0 )
232+ self . badgeLabelMaskView. frame = CGRect ( x: 0.0 , y: 0.0 , width: 140 .0, height: 36.0 )
233233
234234 self . badgeView. alpha = 1.0
235235
@@ -1732,11 +1732,43 @@ private final class GiftAuctionBidScreenComponent: Component {
17321732 return
17331733 }
17341734 self . commitBid ( value: value)
1735+ } ,
1736+ cancel: { [ weak self] in
1737+ guard let self else {
1738+ return
1739+ }
1740+ self . resetSliderValue ( )
1741+ self . state? . updated ( )
17351742 }
17361743 )
17371744 self . environment? . controller ( ) ? . present ( controller, in: . window( . root) )
17381745 }
17391746
1747+ func resetSliderValue( ) {
1748+ guard let state = self . giftAuctionState else {
1749+ return
1750+ }
1751+ var minBidAmount : Int64 = 100
1752+ var maxBidAmount : Int64 = 50000
1753+ if case let . ongoing( _, _, _, auctionMinBidAmount, bidLevels, _, _, _, _, _) = state. auctionState {
1754+ minBidAmount = auctionMinBidAmount
1755+ if let firstLevel = bidLevels. first ( where: { $0. position == 1 } ) {
1756+ maxBidAmount = max ( maxBidAmount, Int64 ( Double ( firstLevel. amount) * 1.5 ) )
1757+ }
1758+ }
1759+ var currentValue = max ( Int ( minBidAmount) , 100 )
1760+ if let myBidAmount = state. myState. bidAmount {
1761+ currentValue = Int ( myBidAmount)
1762+ }
1763+
1764+ var minAllowedRealValue : Int64 = minBidAmount
1765+ if let myBidAmount = state. myState. bidAmount {
1766+ minAllowedRealValue = myBidAmount
1767+ }
1768+
1769+ self . amount = Amount ( realValue: currentValue, minRealValue: Int ( minBidAmount) , minAllowedRealValue: Int ( minAllowedRealValue) , maxRealValue: Int ( maxBidAmount) , maxSliderValue: 999 , isLogarithmic: true )
1770+ }
1771+
17401772 func update( component: GiftAuctionBidScreenComponent , availableSize: CGSize , state: EmptyComponentState , environment: Environment < ViewControllerComponentContainer . Environment > , transition: ComponentTransition ) -> CGSize {
17411773 self . isUpdating = true
17421774 defer {
@@ -1833,26 +1865,7 @@ private final class GiftAuctionBidScreenComponent: Component {
18331865
18341866 if isFirstTime {
18351867 peerIds. append ( context. account. peerId)
1836-
1837- var minBidAmount : Int64 = 100
1838- var maxBidAmount : Int64 = 50000
1839- if case let . ongoing( _, _, _, auctionMinBidAmount, bidLevels, _, _, _, _, _) = state? . auctionState {
1840- minBidAmount = auctionMinBidAmount
1841- if let firstLevel = bidLevels. first ( where: { $0. position == 1 } ) {
1842- maxBidAmount = max ( maxBidAmount, Int64 ( Double ( firstLevel. amount) * 1.5 ) )
1843- }
1844- }
1845- var currentValue = max ( Int ( minBidAmount) , 100 )
1846- if let myBidAmount = state? . myState. bidAmount {
1847- currentValue = Int ( myBidAmount)
1848- }
1849-
1850- var minAllowedRealValue : Int64 = minBidAmount
1851- if let myBidAmount = state? . myState. bidAmount {
1852- minAllowedRealValue = myBidAmount
1853- }
1854-
1855- self . amount = Amount ( realValue: currentValue, minRealValue: Int ( minBidAmount) , minAllowedRealValue: Int ( minAllowedRealValue) , maxRealValue: Int ( maxBidAmount) , maxSliderValue: 999 , isLogarithmic: true )
1868+ self . resetSliderValue ( )
18561869 transition = . immediate
18571870 }
18581871
@@ -1940,6 +1953,10 @@ private final class GiftAuctionBidScreenComponent: Component {
19401953
19411954 if sliderValue == 1.0 && self . previousSliderValue != 1.0 {
19421955 self . presentCustomBidController ( )
1956+ HapticFeedback ( ) . tap ( )
1957+ if let sliderView = self . slider. view as? SliderComponent . View {
1958+ sliderView. cancelGestures ( )
1959+ }
19431960 }
19441961
19451962 self . previousSliderValue = sliderValue
@@ -1967,7 +1984,14 @@ private final class GiftAuctionBidScreenComponent: Component {
19671984 let sliderPlusSize = self . sliderPlus. update (
19681985 transition: . immediate,
19691986 component: AnyComponent (
1970- MultilineTextComponent ( text: . plain( NSAttributedString ( string: " + " , font: Font . with ( size: 26.0 , design: . round, weight: . regular) , textColor: environment. theme. list. itemSecondaryTextColor. withAlphaComponent ( 0.5 ) ) ) )
1987+ Button (
1988+ content: AnyComponent (
1989+ MultilineTextComponent ( text: . plain( NSAttributedString ( string: " + " , font: Font . with ( size: 26.0 , design: . round, weight: . regular) , textColor: environment. theme. list. itemSecondaryTextColor. withAlphaComponent ( 0.5 ) ) ) )
1990+ ) ,
1991+ action: { [ weak self] in
1992+ self ? . presentCustomBidController ( )
1993+ }
1994+ ) . minSize ( CGSize ( width: 30.0 , height: 30.0 ) )
19711995 ) ,
19721996 environment: { } ,
19731997 containerSize: availableSize
@@ -1977,7 +2001,7 @@ private final class GiftAuctionBidScreenComponent: Component {
19772001
19782002 let sliderFrame = CGRect ( origin: CGPoint ( x: sliderInset, y: contentHeight) , size: sliderSize)
19792003 let sliderBackgroundFrame = CGRect ( origin: CGPoint ( x: sliderFrame. minX - 8.0 , y: sliderFrame. minY + 7.0 ) , size: CGSize ( width: sliderFrame. width + 16.0 , height: sliderFrame. height - 14.0 ) )
1980- let sliderPlusFrame = CGRect ( origin: CGPoint ( x: sliderBackgroundFrame. maxX - sliderPlusSize. width - 6 .0, y: sliderBackgroundFrame. minY - 3.0 + UIScreenPixel) , size: sliderPlusSize)
2004+ let sliderPlusFrame = CGRect ( origin: CGPoint ( x: sliderBackgroundFrame. maxX - sliderPlusSize. width + 1 .0, y: sliderBackgroundFrame. minY - 3.0 + UIScreenPixel) , size: sliderPlusSize)
19812005
19822006 let progressFraction : CGFloat = CGFloat ( self . amount. sliderValue) / CGFloat( self . amount. maxSliderValue)
19832007
@@ -2022,8 +2046,6 @@ private final class GiftAuctionBidScreenComponent: Component {
20222046 self . scrollContentView. addSubview ( sliderBackgroundView)
20232047 self . scrollContentView. addSubview ( sliderView)
20242048 self . scrollContentView. addSubview ( sliderPlusView)
2025-
2026- sliderPlusView. isUserInteractionEnabled = false
20272049 }
20282050 transition. setFrame ( view: sliderView, frame: sliderFrame)
20292051
@@ -2032,13 +2054,12 @@ private final class GiftAuctionBidScreenComponent: Component {
20322054 transition. setFrame ( view: sliderPlusView, frame: sliderPlusFrame)
20332055
20342056 var subtitle : String ?
2035- let badgeValue : String = " \( self . amount. realValue) "
2057+ var badgeValue : String = " \( self . amount. realValue) "
20362058 var subtitleOnTop = false
20372059
2038- // if self.amount.sliderValue == self.amount.maxSliderValue {
2039- // badgeValue = "Custom"
2040- // } else
2041- if let myBidAmount = self . giftAuctionState? . myState. bidAmount {
2060+ if self . amount. sliderValue == self . amount. maxSliderValue {
2061+ badgeValue = environment. strings. Gift_AuctionBid_Custom
2062+ } else if let myBidAmount = self . giftAuctionState? . myState. bidAmount {
20422063 if self . amount. realValue > myBidAmount {
20432064 subtitle = " + \( self . amount. realValue - Int( myBidAmount) ) "
20442065 subtitleOnTop = true
0 commit comments