Various fixes

This commit is contained in:
Ilya Laktyushin 2025-05-07 16:01:08 +04:00
parent 6e00be4796
commit 064024514c
2 changed files with 14 additions and 9 deletions

View File

@ -339,6 +339,7 @@ final class GiftStoreScreenComponent: Component {
guard let self else { guard let self else {
return return
} }
self.showLoading = true
self.state?.starGiftsContext.updateFilterAttributes([]) self.state?.starGiftsContext.updateFilterAttributes([])
}, },
animateScale: false animateScale: false
@ -1063,6 +1064,7 @@ final class GiftStoreScreenComponent: Component {
let loadingTransition: ComponentTransition = .easeInOut(duration: 0.25) let loadingTransition: ComponentTransition = .easeInOut(duration: 0.25)
var showingFilters = false
let filterSize = self.filterSelector.update( let filterSize = self.filterSelector.update(
transition: transition, transition: transition,
component: AnyComponent(FilterSelectorComponent( component: AnyComponent(FilterSelectorComponent(
@ -1085,6 +1087,7 @@ final class GiftStoreScreenComponent: Component {
if let initialCount = self.initialCount, initialCount >= minimumCountToDisplayFilters { if let initialCount = self.initialCount, initialCount >= minimumCountToDisplayFilters {
loadingTransition.setAlpha(view: filterSelectorView, alpha: 1.0) loadingTransition.setAlpha(view: filterSelectorView, alpha: 1.0)
showingFilters = true
} }
} }
@ -1129,7 +1132,7 @@ final class GiftStoreScreenComponent: Component {
self.updateScrolling(transition: transition) self.updateScrolling(transition: transition)
if isLoading && self.showLoading { if isLoading && self.showLoading {
self.loadingNode.update(size: availableSize, theme: environment.theme, transition: .immediate) self.loadingNode.update(size: availableSize, theme: environment.theme, showFilters: !showingFilters, transition: .immediate)
loadingTransition.setAlpha(view: self.loadingNode.view, alpha: 1.0) loadingTransition.setAlpha(view: self.loadingNode.view, alpha: 1.0)
} else { } else {
loadingTransition.setAlpha(view: self.loadingNode.view, alpha: 0.0) loadingTransition.setAlpha(view: self.loadingNode.view, alpha: 0.0)

View File

@ -125,7 +125,7 @@ final class LoadingShimmerNode: ASDisplayNode {
private let backgroundColorNode: ASDisplayNode private let backgroundColorNode: ASDisplayNode
private let effectNode: SearchShimmerEffectNode private let effectNode: SearchShimmerEffectNode
private let maskNode: ASImageNode private let maskNode: ASImageNode
private var currentParams: (size: CGSize, theme: PresentationTheme)? private var currentParams: (size: CGSize, theme: PresentationTheme, showFilters: Bool)?
override init() { override init() {
self.backgroundColorNode = ASDisplayNode() self.backgroundColorNode = ASDisplayNode()
@ -142,11 +142,11 @@ final class LoadingShimmerNode: ASDisplayNode {
self.addSubnode(self.maskNode) self.addSubnode(self.maskNode)
} }
func update(size: CGSize, theme: PresentationTheme, transition: ContainedViewLayoutTransition) { func update(size: CGSize, theme: PresentationTheme, showFilters: Bool, transition: ContainedViewLayoutTransition) {
let color = theme.list.itemSecondaryTextColor.mixedWith(theme.list.blocksBackgroundColor, alpha: 0.85) let color = theme.list.itemSecondaryTextColor.mixedWith(theme.list.blocksBackgroundColor, alpha: 0.85)
if self.currentParams?.size != size || self.currentParams?.theme !== theme { if self.currentParams?.size != size || self.currentParams?.theme !== theme || self.currentParams?.showFilters != showFilters {
self.currentParams = (size, theme) self.currentParams = (size, theme, showFilters)
self.backgroundColorNode.backgroundColor = color self.backgroundColorNode.backgroundColor = color
@ -156,11 +156,13 @@ final class LoadingShimmerNode: ASDisplayNode {
let sideInset: CGFloat = 16.0 let sideInset: CGFloat = 16.0
if showFilters {
let filterSpacing: CGFloat = 6.0 let filterSpacing: CGFloat = 6.0
let filterWidth = (size.width - sideInset * 2.0 - filterSpacing * 3.0) / 4.0 let filterWidth = (size.width - sideInset * 2.0 - filterSpacing * 3.0) / 4.0
for i in 0 ..< 4 { for i in 0 ..< 4 {
context.addPath(CGPath(roundedRect: CGRect(origin: CGPoint(x: sideInset + (filterWidth + filterSpacing) * CGFloat(i), y: 0.0), size: CGSize(width: filterWidth, height: 28.0)), cornerWidth: 14.0, cornerHeight: 14.0, transform: nil)) context.addPath(CGPath(roundedRect: CGRect(origin: CGPoint(x: sideInset + (filterWidth + filterSpacing) * CGFloat(i), y: 0.0), size: CGSize(width: filterWidth, height: 28.0)), cornerWidth: 14.0, cornerHeight: 14.0, transform: nil))
} }
}
var currentY: CGFloat = 39.0 + 7.0 var currentY: CGFloat = 39.0 + 7.0
var rowIndex: Int = 0 var rowIndex: Int = 0