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]; [_coverImageCache setImage:image forKey:itemId attributes:NULL];
_coverImagePipe.sink([TGMediaImageUpdate imageUpdateWithItem:item representation:image]); _coverImagePipe.sink([TGMediaImageUpdate imageUpdateWithItem:item representation:image]);
if (position != nil) {
[_coverPositions setObject:position forKey:itemId]; [_coverPositions setObject:position forKey:itemId];
} else {
[_coverPositions removeObjectForKey:itemId];
}
} }
- (void)setFullSizeImage:(UIImage *)image forItem:(id<TGMediaEditableItem>)item - (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 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 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 completion = component.completion
let _ = (inputData let signal = BotCheckoutController.InputData.fetch(context: component.context, source: source)
|> deliverOnMainQueue).startStandalone(next: { [weak self] inputData in |> `catch` { _ -> Signal<BotCheckoutController.InputData, SendBotPaymentFormError> in
guard let inputData else { return .fail(.generic)
return
} }
let _ = (component.context.engine.payments.sendStarsPaymentForm(formId: inputData.form.id, source: source) |> mapToSignal { inputData -> Signal<SendBotPaymentResult, SendBotPaymentFormError> in
|> deliverOnMainQueue).start(next: { [weak self] result 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 { guard let self, let controller = self.environment?.controller(), let navigationController = controller.navigationController as? NavigationController else {
return return
} }
@ -457,7 +455,6 @@ final class GiftSetupScreenComponent: Component {
controller.present(alertController, in: .window(.root)) controller.present(alertController, in: .window(.root))
} }
}) })
})
} }
if starsState.balance < StarsAmount(value: finalPrice, nanos: 0) { 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) { public func scrollViewDidScroll(_ scrollView: UIScrollView) {
self.updateScrolling(transition: .immediate) self.updateScrolling(interactive: true, transition: .immediate)
} }
private var notify = false private var notify = false
func updateScrolling(transition: ComponentTransition) { func updateScrolling(interactive: Bool = false, transition: ComponentTransition) {
if let starsProducts = self.starsProducts, let params = self.currentParams { if let starsProducts = self.starsProducts, let params = self.currentParams {
let optionSpacing: CGFloat = 10.0 let optionSpacing: CGFloat = 10.0
let itemsSideInset = params.sideInset + 16.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) 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() self.profileGifts.loadMore()
} }
} }