mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-12-05 05:51:42 +00:00
Fix month formatting
This commit is contained in:
parent
b8fe2a6d87
commit
7c40b8322e
@ -74,7 +74,7 @@ final class BotCheckoutNativeCardEntryController: ViewController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
override public func loadDisplayNode() {
|
override public func loadDisplayNode() {
|
||||||
self.displayNode = BotCheckoutNativeCardEntryControllerNode(provider: self.provider, theme: self.presentationData.theme, strings: self.presentationData.strings, present: { [weak self] c, a in
|
self.displayNode = BotCheckoutNativeCardEntryControllerNode(context: self.context, provider: self.provider, theme: self.presentationData.theme, strings: self.presentationData.strings, present: { [weak self] c, a in
|
||||||
self?.present(c, in: .window(.root), with: a)
|
self?.present(c, in: .window(.root), with: a)
|
||||||
}, dismiss: { [weak self] in
|
}, dismiss: { [weak self] in
|
||||||
self?.presentingViewController?.dismiss(animated: false, completion: nil)
|
self?.presentingViewController?.dismiss(animated: false, completion: nil)
|
||||||
|
|||||||
@ -9,6 +9,8 @@ import SwiftSignalKit
|
|||||||
import TelegramPresentationData
|
import TelegramPresentationData
|
||||||
import Stripe
|
import Stripe
|
||||||
import CountrySelectionUI
|
import CountrySelectionUI
|
||||||
|
import PresentationDataUtils
|
||||||
|
import AccountContext
|
||||||
|
|
||||||
private final class BotCheckoutNativeCardEntryScrollerNodeView: UIScrollView {
|
private final class BotCheckoutNativeCardEntryScrollerNodeView: UIScrollView {
|
||||||
var ignoreUpdateBounds = false
|
var ignoreUpdateBounds = false
|
||||||
@ -42,6 +44,7 @@ private final class BotCheckoutNativeCardEntryScrollerNode: ASDisplayNode {
|
|||||||
}
|
}
|
||||||
|
|
||||||
final class BotCheckoutNativeCardEntryControllerNode: ViewControllerTracingNode, UIScrollViewDelegate {
|
final class BotCheckoutNativeCardEntryControllerNode: ViewControllerTracingNode, UIScrollViewDelegate {
|
||||||
|
private let context: AccountContext
|
||||||
private let provider: BotCheckoutNativeCardEntryController.Provider
|
private let provider: BotCheckoutNativeCardEntryController.Provider
|
||||||
|
|
||||||
private let present: (ViewController, Any?) -> Void
|
private let present: (ViewController, Any?) -> Void
|
||||||
@ -73,7 +76,8 @@ final class BotCheckoutNativeCardEntryControllerNode: ViewControllerTracingNode,
|
|||||||
|
|
||||||
private var dataTask: URLSessionDataTask?
|
private var dataTask: URLSessionDataTask?
|
||||||
|
|
||||||
init(provider: BotCheckoutNativeCardEntryController.Provider, theme: PresentationTheme, strings: PresentationStrings, present: @escaping (ViewController, Any?) -> Void, dismiss: @escaping () -> Void, openCountrySelection: @escaping () -> Void, updateStatus: @escaping (BotCheckoutNativeCardEntryStatus) -> Void, completion: @escaping (BotCheckoutPaymentMethod) -> Void) {
|
init(context: AccountContext, provider: BotCheckoutNativeCardEntryController.Provider, theme: PresentationTheme, strings: PresentationStrings, present: @escaping (ViewController, Any?) -> Void, dismiss: @escaping () -> Void, openCountrySelection: @escaping () -> Void, updateStatus: @escaping (BotCheckoutNativeCardEntryStatus) -> Void, completion: @escaping (BotCheckoutPaymentMethod) -> Void) {
|
||||||
|
self.context = context
|
||||||
self.provider = provider
|
self.provider = provider
|
||||||
|
|
||||||
self.present = present
|
self.present = present
|
||||||
@ -302,8 +306,8 @@ final class BotCheckoutNativeCardEntryControllerNode: ViewControllerTracingNode,
|
|||||||
let jsonPayload: [String: Any] = [
|
let jsonPayload: [String: Any] = [
|
||||||
"card": [
|
"card": [
|
||||||
"number": cardData.number,
|
"number": cardData.number,
|
||||||
"expiration_month": "\(cardData.month)",
|
"expiration_month": String(format: "%02d", cardData.month),
|
||||||
"expiration_year": "\(cardData.year)",
|
"expiration_year": String(format: "%02d", cardData.year),
|
||||||
"security_code": "\(cardData.code)"
|
"security_code": "\(cardData.code)"
|
||||||
] as [String: Any]
|
] as [String: Any]
|
||||||
]
|
]
|
||||||
@ -384,6 +388,9 @@ final class BotCheckoutNativeCardEntryControllerNode: ViewControllerTracingNode,
|
|||||||
} catch {
|
} catch {
|
||||||
strongSelf.isVerifying = false
|
strongSelf.isVerifying = false
|
||||||
strongSelf.updateDone()
|
strongSelf.updateDone()
|
||||||
|
|
||||||
|
strongSelf.present(textAlertController(context: strongSelf.context, title: nil, text: strongSelf.strings.Login_UnknownError, actions: [TextAlertAction(type: .defaultAction, title: strongSelf.strings.Common_OK, action: {
|
||||||
|
})]), nil)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user