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 {
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)

View File

@ -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