mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-11-06 17:00:13 +00:00
Auth payment help
(cherry picked from commit e69f383a405d7f558f77506228959499b397115c)
This commit is contained in:
parent
fde974e51d
commit
e2cd4a5f8f
@ -451,6 +451,8 @@
|
||||
"Login.PhoneGenericEmailSubject" = "Telegram iOS error: %@";
|
||||
"Login.PhoneGenericEmailBody" = "I'm trying to use my mobile phone number: %1$@\nBut Telegram shows an error. Please help.\n\nError: %2$@\nApp version: %3$@\nOS version: %4$@\nLocale: %5$@\nMNC: %6$@";
|
||||
|
||||
"Login.PhonePaidEmailSubject" = "Payment Issue";
|
||||
"Login.PhonePaidEmailBody" = "Hello Telegram Support,\n\nI’m experiencing an issue with an in-app purchase on iOS.\nMy phone number: %1$@\nApple ID (email used in the App Store): \nApp version: %2$@\nDevice model / iOS version: %3$@\nApp Store country/region: %4$@\nDate & time of attempt (with timezone): %5$@\nExact error message: \n\n#payment_failed";
|
||||
|
||||
"Login.PhoneTitle" = "Your Phone";
|
||||
"Login.PhonePlaceholder" = "Your phone number";
|
||||
|
||||
@ -45,6 +45,7 @@ swift_library(
|
||||
"//submodules/ContextUI:ContextUI",
|
||||
"//submodules/InAppPurchaseManager",
|
||||
"//submodules/TelegramUI/Components/Premium/PremiumCoinComponent",
|
||||
"//submodules/TelegramUI/Components/PlainButtonComponent",
|
||||
],
|
||||
visibility = [
|
||||
"//visibility:public",
|
||||
|
||||
@ -26,6 +26,8 @@ import AlertUI
|
||||
import MessageUI
|
||||
import CoreTelephony
|
||||
import PhoneNumberFormat
|
||||
import PlainButtonComponent
|
||||
import StoreKit
|
||||
|
||||
final class AuthorizationSequencePaymentScreenComponent: Component {
|
||||
typealias EnvironmentType = ViewControllerComponentContainer.Environment
|
||||
@ -75,6 +77,7 @@ final class AuthorizationSequencePaymentScreenComponent: Component {
|
||||
private let list = ComponentView<Empty>()
|
||||
private let check = ComponentView<Empty>()
|
||||
private let button = ComponentView<Empty>()
|
||||
private let helpButton = ComponentView<Empty>()
|
||||
|
||||
private var isUpdating: Bool = false
|
||||
|
||||
@ -224,6 +227,51 @@ final class AuthorizationSequencePaymentScreenComponent: Component {
|
||||
|
||||
let sideInset: CGFloat = 16.0 + environment.safeInsets.left
|
||||
|
||||
let presentationData = component.presentationData
|
||||
let helpButtonSize = self.helpButton.update(
|
||||
transition: transition,
|
||||
component: AnyComponent(PlainButtonComponent(
|
||||
content: AnyComponent(MultilineTextComponent(
|
||||
text: .plain(NSAttributedString(string: environment.strings.Login_PhoneNumberHelp, font: Font.regular(17.0), textColor: environment.theme.list.itemAccentColor))
|
||||
)),
|
||||
minSize: CGSize(width: 0.0, height: 44.0),
|
||||
contentInsets: UIEdgeInsets(top: 0.0, left: 8.0, bottom: 0.0, right: 8.0),
|
||||
action: { [weak self] in
|
||||
guard let self, let environment = self.environment, let controller = environment.controller() else {
|
||||
return
|
||||
}
|
||||
let formattedNumber = formatPhoneNumber(component.phoneNumber)
|
||||
let appVersion = (Bundle.main.infoDictionary?["CFBundleShortVersionString"] as? String) ?? "unknown"
|
||||
let systemVersion = UIDevice.current.systemVersion
|
||||
let region = SKPaymentQueue.default().storefront?.countryCode ?? ""
|
||||
let dateFormatter = DateFormatter()
|
||||
dateFormatter.dateFormat = "yyyy-MM-dd HH:mm:ss zzz"
|
||||
let dateString = dateFormatter.string(from: Date())
|
||||
|
||||
let body = environment.strings.Login_PhonePaidEmailBody(
|
||||
formattedNumber,
|
||||
appVersion,
|
||||
systemVersion,
|
||||
region,
|
||||
dateString
|
||||
).string
|
||||
|
||||
AuthorizationSequenceController.presentEmailComposeController(address: component.supportEmailAddress, subject: environment.strings.Login_PhonePaidEmailSubject, body: body, from: controller, presentationData: presentationData)
|
||||
},
|
||||
animateScale: false,
|
||||
animateContents: false
|
||||
)),
|
||||
environment: {},
|
||||
containerSize: CGSize(width: 200.0, height: 100.0)
|
||||
)
|
||||
let helpButtonFrame = CGRect(origin: CGPoint(x: availableSize.width - 8.0 - helpButtonSize.width, y: environment.statusBarHeight), size: helpButtonSize)
|
||||
if let helpButtonView = self.helpButton.view {
|
||||
if helpButtonView.superview == nil {
|
||||
self.addSubview(helpButtonView)
|
||||
}
|
||||
transition.setFrame(view: helpButtonView, frame: helpButtonFrame)
|
||||
}
|
||||
|
||||
let animationSize = self.animation.update(
|
||||
transition: transition,
|
||||
component: AnyComponent(PremiumCoinComponent(
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user