Skip to content

Commit 6e00be4

Browse files
committed
Various fixes
1 parent 6016842 commit 6e00be4

File tree

4 files changed

+24
-8
lines changed

4 files changed

+24
-8
lines changed

submodules/TelegramCore/Sources/TelegramEngine/Payments/StarGifts.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2463,7 +2463,7 @@ private final class ResaleGiftsContextImpl {
24632463
let filterAttributes = self.filterAttributes
24642464
let currentAttributesHash = self.attributesHash
24652465

2466-
let dataState = self.dataState
2466+
let dataState = self.dataState
24672467

24682468
if case let .ready(true, initialNextOffset) = dataState {
24692469
self.dataState = .loading

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

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,8 @@ final class GiftStoreScreenComponent: Component {
9595

9696
private var starsStateDisposable: Disposable?
9797
private var starsState: StarsContext.State?
98-
private var initialCount: Int?
98+
private var initialCount: Int32?
99+
private var showLoading = true
99100

100101
private var component: GiftStoreScreenComponent?
101102
private(set) weak var state: State?
@@ -451,7 +452,7 @@ final class GiftStoreScreenComponent: Component {
451452
}
452453

453454
let bottomContentOffset = max(0.0, self.scrollView.contentSize.height - self.scrollView.contentOffset.y - self.scrollView.frame.height)
454-
if interactive, bottomContentOffset < 320.0 {
455+
if interactive, bottomContentOffset < 1000.0 {
455456
self.state?.starGiftsContext.loadMore()
456457
}
457458
}
@@ -471,6 +472,7 @@ final class GiftStoreScreenComponent: Component {
471472
guard let self else {
472473
return
473474
}
475+
self.showLoading = true
474476
self.state?.starGiftsContext.updateSorting(.value)
475477
self.scrollToTop()
476478
})))
@@ -481,6 +483,7 @@ final class GiftStoreScreenComponent: Component {
481483
guard let self else {
482484
return
483485
}
486+
self.showLoading = true
484487
self.state?.starGiftsContext.updateSorting(.date)
485488
self.scrollToTop()
486489
})))
@@ -491,6 +494,7 @@ final class GiftStoreScreenComponent: Component {
491494
guard let self else {
492495
return
493496
}
497+
self.showLoading = true
494498
self.state?.starGiftsContext.updateSorting(.number)
495499
self.scrollToTop()
496500
})))
@@ -564,6 +568,7 @@ final class GiftStoreScreenComponent: Component {
564568
updatedFilterAttributes.append(attribute)
565569
}
566570
}
571+
self.showLoading = true
567572
self.state?.starGiftsContext.updateFilterAttributes(updatedFilterAttributes)
568573
self.scrollToTop()
569574
},
@@ -577,6 +582,7 @@ final class GiftStoreScreenComponent: Component {
577582
}
578583
return true
579584
}
585+
self.showLoading = true
580586
self.state?.starGiftsContext.updateFilterAttributes(updatedFilterAttributes)
581587
self.scrollToTop()
582588
}
@@ -657,6 +663,7 @@ final class GiftStoreScreenComponent: Component {
657663
updatedFilterAttributes.append(attribute)
658664
}
659665
}
666+
self.showLoading = true
660667
self.state?.starGiftsContext.updateFilterAttributes(updatedFilterAttributes)
661668
self.scrollToTop()
662669
},
@@ -670,6 +677,7 @@ final class GiftStoreScreenComponent: Component {
670677
}
671678
return true
672679
}
680+
self.showLoading = true
673681
self.state?.starGiftsContext.updateFilterAttributes(updatedFilterAttributes)
674682
self.scrollToTop()
675683
}
@@ -750,6 +758,7 @@ final class GiftStoreScreenComponent: Component {
750758
updatedFilterAttributes.append(attribute)
751759
}
752760
}
761+
self.showLoading = true
753762
self.state?.starGiftsContext.updateFilterAttributes(updatedFilterAttributes)
754763
self.scrollToTop()
755764
},
@@ -763,6 +772,7 @@ final class GiftStoreScreenComponent: Component {
763772
}
764773
return true
765774
}
775+
self.showLoading = true
766776
self.state?.starGiftsContext.updateFilterAttributes(updatedFilterAttributes)
767777
self.scrollToTop()
768778
}
@@ -804,6 +814,12 @@ final class GiftStoreScreenComponent: Component {
804814
self.component = component
805815

806816
let isLoading = self.effectiveIsLoading
817+
if case let .ready(loadMore, nextOffset) = self.state?.starGiftsState?.dataState {
818+
if loadMore && nextOffset == nil {
819+
} else {
820+
self.showLoading = false
821+
}
822+
}
807823

808824
let theme = environment.theme
809825
let strings = environment.strings
@@ -927,7 +943,7 @@ final class GiftStoreScreenComponent: Component {
927943
}
928944

929945
let effectiveCount: Int32
930-
if let count = self.effectiveGifts?.count, count > 0 || self.initialCount != nil {
946+
if let count = self.state?.starGiftsState?.count, count > 0 || self.initialCount != nil {
931947
if self.initialCount == nil {
932948
self.initialCount = count
933949
}
@@ -1112,7 +1128,7 @@ final class GiftStoreScreenComponent: Component {
11121128

11131129
self.updateScrolling(transition: transition)
11141130

1115-
if isLoading {
1131+
if isLoading && self.showLoading {
11161132
self.loadingNode.update(size: availableSize, theme: environment.theme, transition: .immediate)
11171133
loadingTransition.setAlpha(view: self.loadingNode.view, alpha: 1.0)
11181134
} else {

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -958,7 +958,7 @@ private final class GiftViewSheetContent: CombinedComponent {
958958

959959
let location = CGRect(origin: CGPoint(x: absoluteLocation.x, y: absoluteLocation.y - 12.0), size: CGSize())
960960
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
961-
return .ignore
961+
return .dismiss(consume: false)
962962
})
963963
controller.present(tooltipController, in: .current)
964964
}

submodules/TelegramUI/Components/Stars/StarsWithdrawalScreen/Sources/StarsWithdrawalScreen.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -279,7 +279,7 @@ private final class SheetContent: CombinedComponent {
279279
case .starGiftResell:
280280
let amountInfoString: NSAttributedString
281281
if let value = state.amount?.value, value > 0 {
282-
let starsValue = Int32(floor(Float(value) * Float(resaleConfiguration.paidMessageCommissionPermille) / 1000.0))
282+
let starsValue = Int32(floor(Float(value) * Float(resaleConfiguration.starGiftCommissionPermille) / 1000.0))
283283
let starsString = environment.strings.Stars_SellGift_AmountInfo_Stars(starsValue)
284284
amountInfoString = NSAttributedString(attributedString: parseMarkdownIntoAttributedString(environment.strings.Stars_SellGift_AmountInfo(starsString).string, attributes: amountMarkdownAttributes, textAlignment: .natural))
285285

@@ -288,7 +288,7 @@ private final class SheetContent: CombinedComponent {
288288
amountRightLabel = "\(formatTonUsdValue(Int64(starsValue), divide: false, rate: usdRate, dateTimeFormat: environment.dateTimeFormat))"
289289
}
290290
} else {
291-
amountInfoString = NSAttributedString(attributedString: parseMarkdownIntoAttributedString(environment.strings.Stars_SellGift_AmountInfo("\(resaleConfiguration.paidMessageCommissionPermille / 10)%").string, attributes: amountMarkdownAttributes, textAlignment: .natural))
291+
amountInfoString = NSAttributedString(attributedString: parseMarkdownIntoAttributedString(environment.strings.Stars_SellGift_AmountInfo("\(resaleConfiguration.starGiftCommissionPermille / 10)%").string, attributes: amountMarkdownAttributes, textAlignment: .natural))
292292
}
293293
amountFooter = AnyComponent(MultilineTextComponent(
294294
text: .plain(amountInfoString),

0 commit comments

Comments
 (0)