mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-12-23 22:55:00 +00:00
Various fixes
This commit is contained in:
@@ -234,11 +234,11 @@ private final class PremiumGiftScreenContentComponent: CombinedComponent {
|
||||
UIColor(rgb: 0xb36eee)
|
||||
]
|
||||
|
||||
let shortestOptionPrice: Int64
|
||||
let shortestOptionPrice: (Int64, NSDecimalNumber)
|
||||
if let product = products.last {
|
||||
shortestOptionPrice = Int64(Float(product.storeProduct.priceCurrencyAndAmount.amount) / Float(product.months))
|
||||
shortestOptionPrice = (Int64(Float(product.storeProduct.priceCurrencyAndAmount.amount) / Float(product.months)), product.storeProduct.priceValue.dividing(by: NSDecimalNumber(value: product.months)))
|
||||
} else {
|
||||
shortestOptionPrice = 1
|
||||
shortestOptionPrice = (1, NSDecimalNumber(decimal: 1))
|
||||
}
|
||||
|
||||
for product in products {
|
||||
@@ -249,7 +249,7 @@ private final class PremiumGiftScreenContentComponent: CombinedComponent {
|
||||
giftTitle = strings.Premium_Gift_Months(product.months)
|
||||
}
|
||||
|
||||
let discountValue = Int((1.0 - Float(product.storeProduct.priceCurrencyAndAmount.amount) / Float(product.months) / Float(shortestOptionPrice)) * 100.0)
|
||||
let discountValue = Int((1.0 - Float(product.storeProduct.priceCurrencyAndAmount.amount) / Float(product.months) / Float(shortestOptionPrice.0)) * 100.0)
|
||||
let discount: String
|
||||
if discountValue > 0 {
|
||||
discount = "-\(discountValue)%"
|
||||
@@ -257,15 +257,23 @@ private final class PremiumGiftScreenContentComponent: CombinedComponent {
|
||||
discount = ""
|
||||
}
|
||||
|
||||
let pricePerMonth = product.storeProduct.pricePerMonth(Int(product.months))
|
||||
let defaultPrice = product.storeProduct.defaultPrice(shortestOptionPrice.1, monthsCount: Int(product.months))
|
||||
|
||||
var subtitle = ""
|
||||
var pricePerMonth = product.storeProduct.pricePerMonth(Int(product.months))
|
||||
pricePerMonth = environment.strings.Premium_PricePerMonth(pricePerMonth).string
|
||||
|
||||
if discountValue > 0 {
|
||||
subtitle = "**\(defaultPrice)** \(product.price)"
|
||||
}
|
||||
|
||||
items.append(SectionGroupComponent.Item(
|
||||
AnyComponentWithIdentity(
|
||||
id: product.id,
|
||||
component: AnyComponent(
|
||||
PremiumOptionComponent(
|
||||
title: giftTitle,
|
||||
subtitle: product.price,
|
||||
subtitle: subtitle,
|
||||
labelPrice: pricePerMonth,
|
||||
discount: discount,
|
||||
selected: product.id == component.selectedProductId,
|
||||
|
||||
@@ -1285,7 +1285,7 @@ private final class PremiumIntroScreenContentComponent: CombinedComponent {
|
||||
if months > 1 {
|
||||
pricePerMonth = product.pricePerMonth(Int(months))
|
||||
|
||||
if defaultPrice != product.price {
|
||||
if discountValue > 0 {
|
||||
subtitle = "**\(defaultPrice)** \(product.price)"
|
||||
if months == 12 {
|
||||
subtitle = environment.strings.Premium_PricePerYear(subtitle).string
|
||||
|
||||
@@ -472,7 +472,9 @@ private func privacyAndSecurityControllerEntries(
|
||||
}
|
||||
entries.append(.twoStepVerification(presentationData.theme, presentationData.strings.PrivacySettings_TwoStepAuth, twoStepAuthString, twoStepAuthData))
|
||||
|
||||
if loginEmail != nil {
|
||||
entries.append(.loginEmail(presentationData.theme, presentationData.strings.PrivacySettings_LoginEmail, loginEmail))
|
||||
}
|
||||
|
||||
entries.append(.privacyHeader(presentationData.theme, presentationData.strings.PrivacySettings_PrivacyTitle))
|
||||
if let privacySettings = privacySettings {
|
||||
|
||||
Reference in New Issue
Block a user