Various fixes

This commit is contained in:
Ilya Laktyushin
2023-10-25 15:54:27 +04:00
parent 014e3d8b76
commit 9e8bf48a96
7 changed files with 80 additions and 34 deletions

View File

@@ -219,7 +219,7 @@ private final class ChannelBoostersContextImpl {
}
func loadMore() {
if self.isLoadingMore {
if self.isLoadingMore || !self.canLoadMore {
return
}
self.isLoadingMore = true
@@ -312,11 +312,19 @@ private final class ChannelBoostersContextImpl {
}
strongSelf.isLoadingMore = false
strongSelf.hasLoadedOnce = true
strongSelf.canLoadMore = !boosters.isEmpty
strongSelf.canLoadMore = !boosters.isEmpty && nextOffset != nil
if strongSelf.canLoadMore {
strongSelf.count = max(updatedCount, Int32(strongSelf.results.count))
var resultsCount: Int32 = 0
for result in strongSelf.results {
resultsCount += result.multiplier
}
strongSelf.count = max(updatedCount, resultsCount)
} else {
strongSelf.count = Int32(strongSelf.results.count)
var resultsCount: Int32 = 0
for result in strongSelf.results {
resultsCount += result.multiplier
}
strongSelf.count = resultsCount
}
strongSelf.updateState()
}))