diff --git a/submodules/TelegramCore/Sources/TelegramEngine/Payments/StarGifts.swift b/submodules/TelegramCore/Sources/TelegramEngine/Payments/StarGifts.swift index 7b5a1c63b5..e7ca7d8f5c 100644 --- a/submodules/TelegramCore/Sources/TelegramEngine/Payments/StarGifts.swift +++ b/submodules/TelegramCore/Sources/TelegramEngine/Payments/StarGifts.swift @@ -2463,7 +2463,7 @@ private final class ResaleGiftsContextImpl { let filterAttributes = self.filterAttributes let currentAttributesHash = self.attributesHash - let dataState = self.dataState + let dataState = self.dataState if case let .ready(true, initialNextOffset) = dataState { self.dataState = .loading diff --git a/submodules/TelegramUI/Components/Gifts/GiftStoreScreen/Sources/GiftStoreScreen.swift b/submodules/TelegramUI/Components/Gifts/GiftStoreScreen/Sources/GiftStoreScreen.swift index 6827a62fbf..62c712d1f4 100644 --- a/submodules/TelegramUI/Components/Gifts/GiftStoreScreen/Sources/GiftStoreScreen.swift +++ b/submodules/TelegramUI/Components/Gifts/GiftStoreScreen/Sources/GiftStoreScreen.swift @@ -95,7 +95,8 @@ final class GiftStoreScreenComponent: Component { private var starsStateDisposable: Disposable? private var starsState: StarsContext.State? - private var initialCount: Int? + private var initialCount: Int32? + private var showLoading = true private var component: GiftStoreScreenComponent? private(set) weak var state: State? @@ -451,7 +452,7 @@ final class GiftStoreScreenComponent: Component { } let bottomContentOffset = max(0.0, self.scrollView.contentSize.height - self.scrollView.contentOffset.y - self.scrollView.frame.height) - if interactive, bottomContentOffset < 320.0 { + if interactive, bottomContentOffset < 1000.0 { self.state?.starGiftsContext.loadMore() } } @@ -471,6 +472,7 @@ final class GiftStoreScreenComponent: Component { guard let self else { return } + self.showLoading = true self.state?.starGiftsContext.updateSorting(.value) self.scrollToTop() }))) @@ -481,6 +483,7 @@ final class GiftStoreScreenComponent: Component { guard let self else { return } + self.showLoading = true self.state?.starGiftsContext.updateSorting(.date) self.scrollToTop() }))) @@ -491,6 +494,7 @@ final class GiftStoreScreenComponent: Component { guard let self else { return } + self.showLoading = true self.state?.starGiftsContext.updateSorting(.number) self.scrollToTop() }))) @@ -564,6 +568,7 @@ final class GiftStoreScreenComponent: Component { updatedFilterAttributes.append(attribute) } } + self.showLoading = true self.state?.starGiftsContext.updateFilterAttributes(updatedFilterAttributes) self.scrollToTop() }, @@ -577,6 +582,7 @@ final class GiftStoreScreenComponent: Component { } return true } + self.showLoading = true self.state?.starGiftsContext.updateFilterAttributes(updatedFilterAttributes) self.scrollToTop() } @@ -657,6 +663,7 @@ final class GiftStoreScreenComponent: Component { updatedFilterAttributes.append(attribute) } } + self.showLoading = true self.state?.starGiftsContext.updateFilterAttributes(updatedFilterAttributes) self.scrollToTop() }, @@ -670,6 +677,7 @@ final class GiftStoreScreenComponent: Component { } return true } + self.showLoading = true self.state?.starGiftsContext.updateFilterAttributes(updatedFilterAttributes) self.scrollToTop() } @@ -750,6 +758,7 @@ final class GiftStoreScreenComponent: Component { updatedFilterAttributes.append(attribute) } } + self.showLoading = true self.state?.starGiftsContext.updateFilterAttributes(updatedFilterAttributes) self.scrollToTop() }, @@ -763,6 +772,7 @@ final class GiftStoreScreenComponent: Component { } return true } + self.showLoading = true self.state?.starGiftsContext.updateFilterAttributes(updatedFilterAttributes) self.scrollToTop() } @@ -804,6 +814,12 @@ final class GiftStoreScreenComponent: Component { self.component = component let isLoading = self.effectiveIsLoading + if case let .ready(loadMore, nextOffset) = self.state?.starGiftsState?.dataState { + if loadMore && nextOffset == nil { + } else { + self.showLoading = false + } + } let theme = environment.theme let strings = environment.strings @@ -927,7 +943,7 @@ final class GiftStoreScreenComponent: Component { } let effectiveCount: Int32 - if let count = self.effectiveGifts?.count, count > 0 || self.initialCount != nil { + if let count = self.state?.starGiftsState?.count, count > 0 || self.initialCount != nil { if self.initialCount == nil { self.initialCount = count } @@ -1112,7 +1128,7 @@ final class GiftStoreScreenComponent: Component { self.updateScrolling(transition: transition) - if isLoading { + if isLoading && self.showLoading { self.loadingNode.update(size: availableSize, theme: environment.theme, transition: .immediate) loadingTransition.setAlpha(view: self.loadingNode.view, alpha: 1.0) } else { diff --git a/submodules/TelegramUI/Components/Gifts/GiftViewScreen/Sources/GiftViewScreen.swift b/submodules/TelegramUI/Components/Gifts/GiftViewScreen/Sources/GiftViewScreen.swift index 5cc4395dcb..c07308affd 100644 --- a/submodules/TelegramUI/Components/Gifts/GiftViewScreen/Sources/GiftViewScreen.swift +++ b/submodules/TelegramUI/Components/Gifts/GiftViewScreen/Sources/GiftViewScreen.swift @@ -958,7 +958,7 @@ private final class GiftViewSheetContent: CombinedComponent { let location = CGRect(origin: CGPoint(x: absoluteLocation.x, y: absoluteLocation.y - 12.0), size: CGSize()) let tooltipController = TooltipScreen(account: self.context.account, sharedContext: self.context.sharedContext, text: .plain(text: text), style: .wide, location: .point(location, .bottom), displayDuration: .default, inset: 16.0, shouldDismissOnTouch: { _, _ in - return .ignore + return .dismiss(consume: false) }) controller.present(tooltipController, in: .current) } diff --git a/submodules/TelegramUI/Components/Stars/StarsWithdrawalScreen/Sources/StarsWithdrawalScreen.swift b/submodules/TelegramUI/Components/Stars/StarsWithdrawalScreen/Sources/StarsWithdrawalScreen.swift index 237d089380..3f42f70678 100644 --- a/submodules/TelegramUI/Components/Stars/StarsWithdrawalScreen/Sources/StarsWithdrawalScreen.swift +++ b/submodules/TelegramUI/Components/Stars/StarsWithdrawalScreen/Sources/StarsWithdrawalScreen.swift @@ -279,7 +279,7 @@ private final class SheetContent: CombinedComponent { case .starGiftResell: let amountInfoString: NSAttributedString if let value = state.amount?.value, value > 0 { - let starsValue = Int32(floor(Float(value) * Float(resaleConfiguration.paidMessageCommissionPermille) / 1000.0)) + let starsValue = Int32(floor(Float(value) * Float(resaleConfiguration.starGiftCommissionPermille) / 1000.0)) let starsString = environment.strings.Stars_SellGift_AmountInfo_Stars(starsValue) amountInfoString = NSAttributedString(attributedString: parseMarkdownIntoAttributedString(environment.strings.Stars_SellGift_AmountInfo(starsString).string, attributes: amountMarkdownAttributes, textAlignment: .natural)) @@ -288,7 +288,7 @@ private final class SheetContent: CombinedComponent { amountRightLabel = "≈\(formatTonUsdValue(Int64(starsValue), divide: false, rate: usdRate, dateTimeFormat: environment.dateTimeFormat))" } } else { - amountInfoString = NSAttributedString(attributedString: parseMarkdownIntoAttributedString(environment.strings.Stars_SellGift_AmountInfo("\(resaleConfiguration.paidMessageCommissionPermille / 10)%").string, attributes: amountMarkdownAttributes, textAlignment: .natural)) + amountInfoString = NSAttributedString(attributedString: parseMarkdownIntoAttributedString(environment.strings.Stars_SellGift_AmountInfo("\(resaleConfiguration.starGiftCommissionPermille / 10)%").string, attributes: amountMarkdownAttributes, textAlignment: .natural)) } amountFooter = AnyComponent(MultilineTextComponent( text: .plain(amountInfoString),