mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-06-16 05:55:20 +00:00
Various fixes
This commit is contained in:
parent
55215a7304
commit
3f9f29b7fb
@ -810,9 +810,9 @@ final class BotCheckoutControllerNode: ItemListControllerNode, PKPaymentAuthoriz
|
||||
}
|
||||
}
|
||||
|
||||
let openNewCard: () -> Void = { [weak self] in
|
||||
let openNewCard: (String?) -> Void = { [weak self] customUrl in
|
||||
if let strongSelf = self, let paymentForm = strongSelf.paymentFormValue {
|
||||
if let nativeProvider = paymentForm.nativeProvider, nativeProvider.name == "stripe" {
|
||||
if customUrl == nil, let nativeProvider = paymentForm.nativeProvider, nativeProvider.name == "stripe" {
|
||||
guard let paramsData = nativeProvider.params.data(using: .utf8) else {
|
||||
return
|
||||
}
|
||||
@ -891,7 +891,7 @@ final class BotCheckoutControllerNode: ItemListControllerNode, PKPaymentAuthoriz
|
||||
controller?.dismiss()
|
||||
}
|
||||
strongSelf.present(controller, ViewControllerPresentationArguments(presentationAnimation: .modalSheet))
|
||||
} else if let nativeProvider = paymentForm.nativeProvider, nativeProvider.name == "smartglocal" {
|
||||
} else if customUrl == nil, let nativeProvider = paymentForm.nativeProvider, nativeProvider.name == "smartglocal" {
|
||||
guard let paramsData = nativeProvider.params.data(using: .utf8) else {
|
||||
return
|
||||
}
|
||||
@ -961,7 +961,7 @@ final class BotCheckoutControllerNode: ItemListControllerNode, PKPaymentAuthoriz
|
||||
strongSelf.present(controller, ViewControllerPresentationArguments(presentationAnimation: .modalSheet))
|
||||
} else {
|
||||
var dismissImpl: (() -> Void)?
|
||||
let controller = BotCheckoutWebInteractionController(context: context, url: paymentForm.url, intent: .addPaymentMethod({ [weak self] token in
|
||||
let controller = BotCheckoutWebInteractionController(context: context, url: customUrl ?? paymentForm.url, intent: .addPaymentMethod({ [weak self] token in
|
||||
dismissImpl?()
|
||||
|
||||
guard let strongSelf = self else {
|
||||
@ -1060,12 +1060,14 @@ final class BotCheckoutControllerNode: ItemListControllerNode, PKPaymentAuthoriz
|
||||
strongSelf.controller?.view.endEditing(true)
|
||||
let methods = availablePaymentMethods(form: paymentForm, current: strongSelf.currentPaymentMethod)
|
||||
if methods.isEmpty {
|
||||
openNewCard()
|
||||
openNewCard(nil)
|
||||
} else {
|
||||
strongSelf.present(BotCheckoutPaymentMethodSheetController(context: strongSelf.context, currentMethod: strongSelf.currentPaymentMethod, methods: methods, applyValue: { method in
|
||||
applyPaymentMethod(method)
|
||||
}, newCard: {
|
||||
openNewCard()
|
||||
openNewCard(nil)
|
||||
}, otherMethod: { url in
|
||||
openNewCard(url)
|
||||
}), ViewControllerPresentationArguments(presentationAnimation: .modalSheet))
|
||||
}
|
||||
}
|
||||
|
@ -39,7 +39,7 @@ enum BotCheckoutPaymentMethod: Equatable {
|
||||
final class BotCheckoutPaymentMethodSheetController: ActionSheetController {
|
||||
private var presentationDisposable: Disposable?
|
||||
|
||||
init(context: AccountContext, currentMethod: BotCheckoutPaymentMethod?, methods: [BotCheckoutPaymentMethod], applyValue: @escaping (BotCheckoutPaymentMethod) -> Void, newCard: @escaping () -> Void) {
|
||||
init(context: AccountContext, currentMethod: BotCheckoutPaymentMethod?, methods: [BotCheckoutPaymentMethod], applyValue: @escaping (BotCheckoutPaymentMethod) -> Void, newCard: @escaping () -> Void, otherMethod: @escaping (String) -> Void) {
|
||||
let presentationData = context.sharedContext.currentPresentationData.with { $0 }
|
||||
let strings = presentationData.strings
|
||||
|
||||
@ -82,7 +82,11 @@ final class BotCheckoutPaymentMethodSheetController: ActionSheetController {
|
||||
value = nil
|
||||
}
|
||||
items.append(BotCheckoutPaymentMethodItem(title: title, icon: icon, value: value, action: { [weak self] _ in
|
||||
applyValue(method)
|
||||
if case let .other(method) = method {
|
||||
otherMethod(method.url)
|
||||
} else {
|
||||
applyValue(method)
|
||||
}
|
||||
self?.dismissAnimated()
|
||||
}))
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user