diff --git a/submodules/Components/SheetComponent/Sources/SheetComponent.swift b/submodules/Components/SheetComponent/Sources/SheetComponent.swift index ba85ac254c..1d8c0f4788 100644 --- a/submodules/Components/SheetComponent/Sources/SheetComponent.swift +++ b/submodules/Components/SheetComponent/Sources/SheetComponent.swift @@ -65,6 +65,7 @@ public final class SheetComponent: C public let clipsContent: Bool public let isScrollEnabled: Bool public let hasDimView: Bool + public let autoAnimateOut: Bool public let externalState: ExternalState? public let animateOut: ActionSlot> public let onPan: () -> Void @@ -77,6 +78,7 @@ public final class SheetComponent: C clipsContent: Bool = false, isScrollEnabled: Bool = true, hasDimView: Bool = true, + autoAnimateOut: Bool = true, externalState: ExternalState? = nil, animateOut: ActionSlot>, onPan: @escaping () -> Void = {}, @@ -88,6 +90,7 @@ public final class SheetComponent: C self.clipsContent = clipsContent self.isScrollEnabled = isScrollEnabled self.hasDimView = hasDimView + self.autoAnimateOut = autoAnimateOut self.externalState = externalState self.animateOut = animateOut self.onPan = onPan @@ -110,6 +113,9 @@ public final class SheetComponent: C if lhs.hasDimView != rhs.hasDimView { return false } + if lhs.autoAnimateOut != rhs.autoAnimateOut { + return false + } if lhs.animateOut != rhs.animateOut { return false } @@ -430,9 +436,15 @@ public final class SheetComponent: C if environment[SheetComponentEnvironment.self].value.isDisplaying, !self.previousIsDisplaying, let _ = transition.userData(ViewControllerComponentContainer.AnimateInTransition.self) { self.animateIn() } else if !environment[SheetComponentEnvironment.self].value.isDisplaying, self.previousIsDisplaying, let _ = transition.userData(ViewControllerComponentContainer.AnimateOutTransition.self) { - self.animateOut(completion: {}) + if component.autoAnimateOut { + self.animateOut(completion: {}) + } + } + if !sheetEnvironment.isDisplaying && !component.autoAnimateOut { + + } else { + self.previousIsDisplaying = sheetEnvironment.isDisplaying } - self.previousIsDisplaying = sheetEnvironment.isDisplaying self.dismiss = sheetEnvironment.dismiss return availableSize diff --git a/submodules/TelegramCore/Sources/TelegramEngine/Payments/StarGifts.swift b/submodules/TelegramCore/Sources/TelegramEngine/Payments/StarGifts.swift index 8b77355546..9cba0391f7 100644 --- a/submodules/TelegramCore/Sources/TelegramEngine/Payments/StarGifts.swift +++ b/submodules/TelegramCore/Sources/TelegramEngine/Payments/StarGifts.swift @@ -1379,6 +1379,7 @@ private final class ProfileGiftsContextImpl { private var sorting: ProfileGiftsContext.Sorting private var filter: ProfileGiftsContext.Filters + private var limit: Int32 private var gifts: [ProfileGiftsContext.State.StarGift] = [] private var count: Int32? @@ -1402,7 +1403,8 @@ private final class ProfileGiftsContextImpl { peerId: EnginePeer.Id, collectionId: Int32?, sorting: ProfileGiftsContext.Sorting, - filter: ProfileGiftsContext.Filters + filter: ProfileGiftsContext.Filters, + limit: Int32 ) { self.queue = queue self.account = account @@ -1410,6 +1412,7 @@ private final class ProfileGiftsContextImpl { self.collectionId = collectionId self.sorting = sorting self.filter = filter + self.limit = limit self.loadMore() } @@ -2420,14 +2423,15 @@ public final class ProfileGiftsContext { peerId: EnginePeer.Id, collectionId: Int32? = nil, sorting: ProfileGiftsContext.Sorting = .date, - filter: ProfileGiftsContext.Filters = .All + filter: ProfileGiftsContext.Filters = .All, + limit: Int32 = 36 ) { self.peerId = peerId self.collectionId = collectionId let queue = self.queue self.impl = QueueLocalObject(queue: queue, generate: { - return ProfileGiftsContextImpl(queue: queue, account: account, peerId: peerId, collectionId: collectionId, sorting: sorting, filter: filter) + return ProfileGiftsContextImpl(queue: queue, account: account, peerId: peerId, collectionId: collectionId, sorting: sorting, filter: filter, limit: limit) }) } @@ -3009,6 +3013,7 @@ private final class ResaleGiftsContextImpl { let network = self.account.network let postbox = self.account.postbox let sorting = self.sorting + let limit = self.limit let filterAttributes = self.filterAttributes let currentAttributesHash = self.attributesHash @@ -3048,7 +3053,7 @@ private final class ResaleGiftsContextImpl { let attributesHash = currentAttributesHash ?? 0 flags |= (1 << 0) - let signal = network.request(Api.functions.payments.getResaleStarGifts(flags: flags, attributesHash: attributesHash, giftId: giftId, attributes: apiAttributes, offset: initialNextOffset ?? "", limit: 36)) + let signal = network.request(Api.functions.payments.getResaleStarGifts(flags: flags, attributesHash: attributesHash, giftId: giftId, attributes: apiAttributes, offset: initialNextOffset ?? "", limit: limit)) |> map(Optional.init) |> `catch` { _ -> Signal in return .single(nil) diff --git a/submodules/TelegramUI/Components/Gifts/GiftViewScreen/Sources/GiftValueScreen.swift b/submodules/TelegramUI/Components/Gifts/GiftViewScreen/Sources/GiftValueScreen.swift index cb1b95c110..88a12392aa 100644 --- a/submodules/TelegramUI/Components/Gifts/GiftViewScreen/Sources/GiftValueScreen.swift +++ b/submodules/TelegramUI/Components/Gifts/GiftViewScreen/Sources/GiftValueScreen.swift @@ -149,10 +149,6 @@ private final class GiftValueSheetContent: CombinedComponent { gift: gift ) controller.push(storeController) - - Queue.mainQueue().after(2.0, { - controller.dismiss(animated: false) - }) } func openGiftFragmentResale(url: String) { @@ -721,6 +717,7 @@ final class GiftValueSheetComponent: CombinedComponent { backgroundColor: .color(environment.theme.actionSheet.opaqueItemBackgroundColor), followContentSizeChanges: true, clipsContent: true, + autoAnimateOut: false, externalState: sheetExternalState, animateOut: animateOut, onPan: { diff --git a/submodules/TelegramUI/Components/Gifts/GiftViewScreen/Sources/GiftViewScreen.swift b/submodules/TelegramUI/Components/Gifts/GiftViewScreen/Sources/GiftViewScreen.swift index 3aa13d0f39..49f151d6ce 100644 --- a/submodules/TelegramUI/Components/Gifts/GiftViewScreen/Sources/GiftViewScreen.swift +++ b/submodules/TelegramUI/Components/Gifts/GiftViewScreen/Sources/GiftViewScreen.swift @@ -676,7 +676,9 @@ private final class GiftViewSheetContent: CombinedComponent { guard let self else { return } - self.isOpeningValue = false + Queue.mainQueue().after(0.2) { + self.isOpeningValue = false + } if let valueInfo { let valueController = GiftValueScreen(context: self.context, gift: gift, valueInfo: valueInfo) controller.push(valueController) @@ -4545,8 +4547,8 @@ public class GiftViewScreen: ViewControllerComponentContainer { self.navigationPresentation = .flatModal self.automaticallyControlPresentationContextLayout = false - if "".isEmpty { - let upgradableGiftsContext = ProfileGiftsContext(account: context.account, peerId: context.account.peerId, collectionId: nil, sorting: .date, filter: [.displayed, .hidden, .limitedUpgradable]) + if let gift = subject.arguments?.gift, case .generic = gift { + let upgradableGiftsContext = ProfileGiftsContext(account: context.account, peerId: context.account.peerId, collectionId: nil, sorting: .date, filter: [.displayed, .hidden, .limitedUpgradable], limit: 50) self.upgradableDisposable = (upgradableGiftsContext.state |> deliverOnMainQueue).start(next: { [weak self] state in guard let self else { diff --git a/submodules/TelegramUI/Sources/ChatHistoryListNode.swift b/submodules/TelegramUI/Sources/ChatHistoryListNode.swift index 27843831b2..d620a2a3c9 100644 --- a/submodules/TelegramUI/Sources/ChatHistoryListNode.swift +++ b/submodules/TelegramUI/Sources/ChatHistoryListNode.swift @@ -2053,7 +2053,7 @@ public final class ChatHistoryListNodeImpl: ListView, ChatHistoryNode, ChatHisto } var isSuspiciousPeer = false - if let cachedUserData = data.cachedData as? CachedUserData, let peerStatusSettings = cachedUserData.peerStatusSettings, peerStatusSettings.flags.contains(.canBlock) { + if let cachedUserData = data.cachedData as? CachedUserData, let peerStatusSettings = cachedUserData.peerStatusSettings, peerStatusSettings.flags.contains(.canBlock) || peerStatusSettings.flags.contains(.canReport) { isSuspiciousPeer = true }