Skip to content

Commit 0640245

Browse files
committed
Various fixes
1 parent 6e00be4 commit 0640245

File tree

2 files changed

+14
-9
lines changed

2 files changed

+14
-9
lines changed

submodules/TelegramUI/Components/Gifts/GiftStoreScreen/Sources/GiftStoreScreen.swift

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -339,6 +339,7 @@ final class GiftStoreScreenComponent: Component {
339339
guard let self else {
340340
return
341341
}
342+
self.showLoading = true
342343
self.state?.starGiftsContext.updateFilterAttributes([])
343344
},
344345
animateScale: false
@@ -1063,6 +1064,7 @@ final class GiftStoreScreenComponent: Component {
10631064

10641065
let loadingTransition: ComponentTransition = .easeInOut(duration: 0.25)
10651066

1067+
var showingFilters = false
10661068
let filterSize = self.filterSelector.update(
10671069
transition: transition,
10681070
component: AnyComponent(FilterSelectorComponent(
@@ -1085,6 +1087,7 @@ final class GiftStoreScreenComponent: Component {
10851087

10861088
if let initialCount = self.initialCount, initialCount >= minimumCountToDisplayFilters {
10871089
loadingTransition.setAlpha(view: filterSelectorView, alpha: 1.0)
1090+
showingFilters = true
10881091
}
10891092
}
10901093

@@ -1129,7 +1132,7 @@ final class GiftStoreScreenComponent: Component {
11291132
self.updateScrolling(transition: transition)
11301133

11311134
if isLoading && self.showLoading {
1132-
self.loadingNode.update(size: availableSize, theme: environment.theme, transition: .immediate)
1135+
self.loadingNode.update(size: availableSize, theme: environment.theme, showFilters: !showingFilters, transition: .immediate)
11331136
loadingTransition.setAlpha(view: self.loadingNode.view, alpha: 1.0)
11341137
} else {
11351138
loadingTransition.setAlpha(view: self.loadingNode.view, alpha: 0.0)

submodules/TelegramUI/Components/Gifts/GiftStoreScreen/Sources/LoadingShimmerComponent.swift

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ final class LoadingShimmerNode: ASDisplayNode {
125125
private let backgroundColorNode: ASDisplayNode
126126
private let effectNode: SearchShimmerEffectNode
127127
private let maskNode: ASImageNode
128-
private var currentParams: (size: CGSize, theme: PresentationTheme)?
128+
private var currentParams: (size: CGSize, theme: PresentationTheme, showFilters: Bool)?
129129

130130
override init() {
131131
self.backgroundColorNode = ASDisplayNode()
@@ -142,11 +142,11 @@ final class LoadingShimmerNode: ASDisplayNode {
142142
self.addSubnode(self.maskNode)
143143
}
144144

145-
func update(size: CGSize, theme: PresentationTheme, transition: ContainedViewLayoutTransition) {
145+
func update(size: CGSize, theme: PresentationTheme, showFilters: Bool, transition: ContainedViewLayoutTransition) {
146146
let color = theme.list.itemSecondaryTextColor.mixedWith(theme.list.blocksBackgroundColor, alpha: 0.85)
147147

148-
if self.currentParams?.size != size || self.currentParams?.theme !== theme {
149-
self.currentParams = (size, theme)
148+
if self.currentParams?.size != size || self.currentParams?.theme !== theme || self.currentParams?.showFilters != showFilters {
149+
self.currentParams = (size, theme, showFilters)
150150

151151
self.backgroundColorNode.backgroundColor = color
152152

@@ -156,10 +156,12 @@ final class LoadingShimmerNode: ASDisplayNode {
156156

157157
let sideInset: CGFloat = 16.0
158158

159-
let filterSpacing: CGFloat = 6.0
160-
let filterWidth = (size.width - sideInset * 2.0 - filterSpacing * 3.0) / 4.0
161-
for i in 0 ..< 4 {
162-
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))
159+
if showFilters {
160+
let filterSpacing: CGFloat = 6.0
161+
let filterWidth = (size.width - sideInset * 2.0 - filterSpacing * 3.0) / 4.0
162+
for i in 0 ..< 4 {
163+
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))
164+
}
163165
}
164166

165167
var currentY: CGFloat = 39.0 + 7.0

0 commit comments

Comments
 (0)