From 064024514cee79965bfee184ed2957193e39e090 Mon Sep 17 00:00:00 2001 From: Ilya Laktyushin Date: Wed, 7 May 2025 16:01:08 +0400 Subject: [PATCH] Various fixes --- .../Sources/GiftStoreScreen.swift | 5 ++++- .../Sources/LoadingShimmerComponent.swift | 18 ++++++++++-------- 2 files changed, 14 insertions(+), 9 deletions(-) diff --git a/submodules/TelegramUI/Components/Gifts/GiftStoreScreen/Sources/GiftStoreScreen.swift b/submodules/TelegramUI/Components/Gifts/GiftStoreScreen/Sources/GiftStoreScreen.swift index 62c712d1f4..c2400ed3d3 100644 --- a/submodules/TelegramUI/Components/Gifts/GiftStoreScreen/Sources/GiftStoreScreen.swift +++ b/submodules/TelegramUI/Components/Gifts/GiftStoreScreen/Sources/GiftStoreScreen.swift @@ -339,6 +339,7 @@ final class GiftStoreScreenComponent: Component { guard let self else { return } + self.showLoading = true self.state?.starGiftsContext.updateFilterAttributes([]) }, animateScale: false @@ -1063,6 +1064,7 @@ final class GiftStoreScreenComponent: Component { let loadingTransition: ComponentTransition = .easeInOut(duration: 0.25) + var showingFilters = false let filterSize = self.filterSelector.update( transition: transition, component: AnyComponent(FilterSelectorComponent( @@ -1085,6 +1087,7 @@ final class GiftStoreScreenComponent: Component { if let initialCount = self.initialCount, initialCount >= minimumCountToDisplayFilters { loadingTransition.setAlpha(view: filterSelectorView, alpha: 1.0) + showingFilters = true } } @@ -1129,7 +1132,7 @@ final class GiftStoreScreenComponent: Component { self.updateScrolling(transition: transition) 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) } else { loadingTransition.setAlpha(view: self.loadingNode.view, alpha: 0.0) diff --git a/submodules/TelegramUI/Components/Gifts/GiftStoreScreen/Sources/LoadingShimmerComponent.swift b/submodules/TelegramUI/Components/Gifts/GiftStoreScreen/Sources/LoadingShimmerComponent.swift index 73e314820f..af253d4b3e 100644 --- a/submodules/TelegramUI/Components/Gifts/GiftStoreScreen/Sources/LoadingShimmerComponent.swift +++ b/submodules/TelegramUI/Components/Gifts/GiftStoreScreen/Sources/LoadingShimmerComponent.swift @@ -125,7 +125,7 @@ final class LoadingShimmerNode: ASDisplayNode { private let backgroundColorNode: ASDisplayNode private let effectNode: SearchShimmerEffectNode private let maskNode: ASImageNode - private var currentParams: (size: CGSize, theme: PresentationTheme)? + private var currentParams: (size: CGSize, theme: PresentationTheme, showFilters: Bool)? override init() { self.backgroundColorNode = ASDisplayNode() @@ -142,11 +142,11 @@ final class LoadingShimmerNode: ASDisplayNode { 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) - if self.currentParams?.size != size || self.currentParams?.theme !== theme { - self.currentParams = (size, theme) + if self.currentParams?.size != size || self.currentParams?.theme !== theme || self.currentParams?.showFilters != showFilters { + self.currentParams = (size, theme, showFilters) self.backgroundColorNode.backgroundColor = color @@ -156,10 +156,12 @@ final class LoadingShimmerNode: ASDisplayNode { let sideInset: CGFloat = 16.0 - let filterSpacing: CGFloat = 6.0 - let filterWidth = (size.width - sideInset * 2.0 - filterSpacing * 3.0) / 4.0 - 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)) + if showFilters { + let filterSpacing: CGFloat = 6.0 + let filterWidth = (size.width - sideInset * 2.0 - filterSpacing * 3.0) / 4.0 + 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)) + } } var currentY: CGFloat = 39.0 + 7.0