mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2026-01-04 12:14:29 +00:00
Various fixes
This commit is contained in:
@@ -7663,6 +7663,7 @@ Sorry for the inconvenience.";
|
||||
"Premium.AppIconStandaloneInfo" = "Unlock a wider range of app icons by subscribing to **Telegram Premium**.";
|
||||
|
||||
"Premium.SubscribeFor" = "Subscribe for %@ / month";
|
||||
"Premium.SubscribeForAnnual" = "Subscribe for %@ / year";
|
||||
|
||||
"Premium.AboutTitle" = "ABOUT TELEGRAM PREMIUM";
|
||||
"Premium.AboutText" = "While the free version of Telegram already gives its users more than any other messaging application, **Telegram Premium** pushes its capabilities even further.\n\n**Telegram Premium** is a paid option, because most Premium Features require additional expenses from Telegram to third parties such as data center providers and server manufacturers. Contributions from **Telegram Premium** users allow us to cover such costs and also help Telegram stay free for everyone.";
|
||||
|
||||
@@ -68,6 +68,8 @@ private final class PremiumGiftScreenContentComponent: CombinedComponent {
|
||||
private var stickersDisposable: Disposable?
|
||||
private var preloadDisposableSet = DisposableSet()
|
||||
|
||||
var price: String?
|
||||
|
||||
init(context: AccountContext) {
|
||||
self.context = context
|
||||
|
||||
@@ -305,6 +307,7 @@ private final class PremiumGiftScreenContentComponent: CombinedComponent {
|
||||
let buy = context.component.buy
|
||||
|
||||
let price = context.component.products?.first(where: { $0.id == context.component.selectedProductId })?.price
|
||||
state.price = price
|
||||
|
||||
let gradientColors: [UIColor] = [
|
||||
UIColor(rgb: 0xF27C30),
|
||||
@@ -347,7 +350,7 @@ private final class PremiumGiftScreenContentComponent: CombinedComponent {
|
||||
switch perk {
|
||||
case .doubleLimits:
|
||||
var dismissImpl: (() -> Void)?
|
||||
let controller = PremimLimitsListScreen(context: accountContext, buttonText: strings.Premium_Gift_GiftSubscription(price ?? "–").string, isPremium: false)
|
||||
let controller = PremimLimitsListScreen(context: accountContext, buttonText: strings.Premium_Gift_GiftSubscription(state?.price ?? "–").string, isPremium: false)
|
||||
controller.action = {
|
||||
dismissImpl?()
|
||||
buy()
|
||||
@@ -388,7 +391,7 @@ private final class PremiumGiftScreenContentComponent: CombinedComponent {
|
||||
let controller = PremiumDemoScreen(
|
||||
context: accountContext,
|
||||
subject: demoSubject,
|
||||
source: .gift(price),
|
||||
source: .gift(state?.price),
|
||||
order: state?.configuration.perks,
|
||||
action: {
|
||||
buy()
|
||||
|
||||
@@ -984,6 +984,10 @@ private final class PremiumIntroScreenContentComponent: CombinedComponent {
|
||||
return self.products?.first(where: { $0.id == self.selectedProductId })?.price
|
||||
}
|
||||
|
||||
var isAnnual: Bool {
|
||||
return self.products?.first(where: { $0.id == self.selectedProductId })?.id.hasSuffix(".annual") ?? false
|
||||
}
|
||||
|
||||
init(context: AccountContext, source: PremiumSource) {
|
||||
self.context = context
|
||||
|
||||
@@ -1292,8 +1296,10 @@ private final class PremiumIntroScreenContentComponent: CombinedComponent {
|
||||
var demoSubject: PremiumDemoScreen.Subject
|
||||
switch perk {
|
||||
case .doubleLimits:
|
||||
let isPremium = state?.isPremium == true
|
||||
|
||||
var dismissImpl: (() -> Void)?
|
||||
let controller = PremimLimitsListScreen(context: accountContext, buttonText: state?.isPremium == true ? strings.Common_OK : strings.Premium_SubscribeFor(state?.price ?? "–").string, isPremium: state?.isPremium == true)
|
||||
let controller = PremimLimitsListScreen(context: accountContext, buttonText: isPremium ? strings.Common_OK : (state?.isAnnual == true ? strings.Premium_SubscribeForAnnual(state?.price ?? "–").string : strings.Premium_SubscribeFor(state?.price ?? "–").string), isPremium: isPremium)
|
||||
controller.action = { [weak state] in
|
||||
dismissImpl?()
|
||||
if state?.isPremium == false {
|
||||
@@ -1633,6 +1639,10 @@ private final class PremiumIntroScreenComponent: CombinedComponent {
|
||||
return self.products?.first(where: { $0.id == self.selectedProductId })?.price
|
||||
}
|
||||
|
||||
var isAnnual: Bool {
|
||||
return self.products?.first(where: { $0.id == self.selectedProductId })?.id.hasSuffix(".annual") ?? false
|
||||
}
|
||||
|
||||
init(context: AccountContext, source: PremiumSource, updateInProgress: @escaping (Bool) -> Void, present: @escaping (ViewController) -> Void, completion: @escaping () -> Void) {
|
||||
self.context = context
|
||||
self.updateInProgress = updateInProgress
|
||||
@@ -2050,10 +2060,11 @@ private final class PremiumIntroScreenComponent: CombinedComponent {
|
||||
if state.isPremium == true || isGiftView {
|
||||
|
||||
} else {
|
||||
|
||||
let sideInset: CGFloat = 16.0
|
||||
let button = button.update(
|
||||
component: SolidRoundedButtonComponent(
|
||||
title: environment.strings.Premium_SubscribeFor(state.price ?? "—").string,
|
||||
title: state.isAnnual ? environment.strings.Premium_SubscribeForAnnual(state.price ?? "—").string : environment.strings.Premium_SubscribeFor(state.price ?? "—").string,
|
||||
theme: SolidRoundedButtonComponent.Theme(
|
||||
backgroundColor: UIColor(rgb: 0x8878ff),
|
||||
backgroundColors: [
|
||||
|
||||
@@ -296,6 +296,7 @@ public func foldLineBreaks(_ text: String) -> String {
|
||||
result += " " + line
|
||||
}
|
||||
}
|
||||
result = result.replacingOccurrences(of: "\\s+", with: " ", options: .regularExpression)
|
||||
return result
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user