mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-10-09 11:23:48 +00:00
Various improvements
This commit is contained in:
parent
eb8464f687
commit
effaa875a6
@ -65,6 +65,7 @@ public final class SheetComponent<ChildEnvironmentType: Sendable & Equatable>: 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<Action<()>>
|
||||
public let onPan: () -> Void
|
||||
@ -77,6 +78,7 @@ public final class SheetComponent<ChildEnvironmentType: Sendable & Equatable>: C
|
||||
clipsContent: Bool = false,
|
||||
isScrollEnabled: Bool = true,
|
||||
hasDimView: Bool = true,
|
||||
autoAnimateOut: Bool = true,
|
||||
externalState: ExternalState? = nil,
|
||||
animateOut: ActionSlot<Action<()>>,
|
||||
onPan: @escaping () -> Void = {},
|
||||
@ -88,6 +90,7 @@ public final class SheetComponent<ChildEnvironmentType: Sendable & Equatable>: 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<ChildEnvironmentType: Sendable & Equatable>: 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<ChildEnvironmentType: Sendable & Equatable>: 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) {
|
||||
if component.autoAnimateOut {
|
||||
self.animateOut(completion: {})
|
||||
}
|
||||
}
|
||||
if !sheetEnvironment.isDisplaying && !component.autoAnimateOut {
|
||||
|
||||
} else {
|
||||
self.previousIsDisplaying = sheetEnvironment.isDisplaying
|
||||
}
|
||||
self.dismiss = sheetEnvironment.dismiss
|
||||
|
||||
return availableSize
|
||||
|
@ -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<Api.payments.ResaleStarGifts?, NoError> in
|
||||
return .single(nil)
|
||||
|
@ -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: {
|
||||
|
@ -676,7 +676,9 @@ private final class GiftViewSheetContent: CombinedComponent {
|
||||
guard let self else {
|
||||
return
|
||||
}
|
||||
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 {
|
||||
|
@ -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
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user