Various fixes

This commit is contained in:
Ilya Laktyushin 2025-02-14 21:36:20 +04:00
parent fe81be7931
commit 9c486969ea
3 changed files with 83 additions and 82 deletions

View File

@ -962,7 +962,11 @@
[_coverImageCache setImage:image forKey:itemId attributes:NULL];
_coverImagePipe.sink([TGMediaImageUpdate imageUpdateWithItem:item representation:image]);
if (position != nil) {
[_coverPositions setObject:position forKey:itemId];
} else {
[_coverPositions removeObjectForKey:itemId];
}
}
- (void)setFullSizeImage:(UIImage *)image forItem:(id<TGMediaEditableItem>)item

View File

@ -367,21 +367,19 @@ final class GiftSetupScreenComponent: Component {
let entities = generateChatInputTextEntities(self.textInputState.text)
let source: BotPaymentInvoiceSource = .starGift(hideName: self.hideName, includeUpgrade: self.includeUpgrade, peerId: peerId, giftId: starGift.id, text: self.textInputState.text.string, entities: entities)
let inputData = BotCheckoutController.InputData.fetch(context: component.context, source: source)
|> map(Optional.init)
|> `catch` { _ -> Signal<BotCheckoutController.InputData?, NoError> in
return .single(nil)
}
let completion = component.completion
let _ = (inputData
|> deliverOnMainQueue).startStandalone(next: { [weak self] inputData in
guard let inputData else {
return
let signal = BotCheckoutController.InputData.fetch(context: component.context, source: source)
|> `catch` { _ -> Signal<BotCheckoutController.InputData, SendBotPaymentFormError> in
return .fail(.generic)
}
let _ = (component.context.engine.payments.sendStarsPaymentForm(formId: inputData.form.id, source: source)
|> deliverOnMainQueue).start(next: { [weak self] result in
|> mapToSignal { inputData -> Signal<SendBotPaymentResult, SendBotPaymentFormError> in
return component.context.engine.payments.sendStarsPaymentForm(formId: inputData.form.id, source: source)
}
|> deliverOnMainQueue
let _ = signal.start(next: { [weak self] result in
guard let self, let controller = self.environment?.controller(), let navigationController = controller.navigationController as? NavigationController else {
return
}
@ -457,7 +455,6 @@ final class GiftSetupScreenComponent: Component {
controller.present(alertController, in: .window(.root))
}
})
})
}
if starsState.balance < StarsAmount(value: finalPrice, nanos: 0) {

View File

@ -141,11 +141,11 @@ public final class PeerInfoGiftsPaneNode: ASDisplayNode, PeerInfoPaneNode, UIScr
}
public func scrollViewDidScroll(_ scrollView: UIScrollView) {
self.updateScrolling(transition: .immediate)
self.updateScrolling(interactive: true, transition: .immediate)
}
private var notify = false
func updateScrolling(transition: ComponentTransition) {
func updateScrolling(interactive: Bool = false, transition: ComponentTransition) {
if let starsProducts = self.starsProducts, let params = self.currentParams {
let optionSpacing: CGFloat = 10.0
let itemsSideInset = params.sideInset + 16.0
@ -644,7 +644,7 @@ public final class PeerInfoGiftsPaneNode: ASDisplayNode, PeerInfoPaneNode, UIScr
}
let bottomContentOffset = max(0.0, self.scrollNode.view.contentSize.height - self.scrollNode.view.contentOffset.y - self.scrollNode.view.frame.height)
if bottomContentOffset < 200.0 {
if interactive, bottomContentOffset < 200.0 {
self.profileGifts.loadMore()
}
}