mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-12-03 05:03:45 +00:00
Various fixes
This commit is contained in:
parent
a799acacd1
commit
cf275a1cd6
@ -2087,15 +2087,17 @@ private final class PremiumIntroScreenComponent: CombinedComponent {
|
||||
let context: AccountContext
|
||||
let source: PremiumSource
|
||||
let forceDark: Bool
|
||||
let forceHasPremium: Bool
|
||||
let updateInProgress: (Bool) -> Void
|
||||
let present: (ViewController) -> Void
|
||||
let push: (ViewController) -> Void
|
||||
let completion: () -> Void
|
||||
|
||||
init(context: AccountContext, source: PremiumSource, forceDark: Bool, updateInProgress: @escaping (Bool) -> Void, present: @escaping (ViewController) -> Void, push: @escaping (ViewController) -> Void, completion: @escaping () -> Void) {
|
||||
init(context: AccountContext, source: PremiumSource, forceDark: Bool, forceHasPremium: Bool, updateInProgress: @escaping (Bool) -> Void, present: @escaping (ViewController) -> Void, push: @escaping (ViewController) -> Void, completion: @escaping () -> Void) {
|
||||
self.context = context
|
||||
self.source = source
|
||||
self.forceDark = forceDark
|
||||
self.forceHasPremium = forceHasPremium
|
||||
self.updateInProgress = updateInProgress
|
||||
self.present = present
|
||||
self.push = push
|
||||
@ -2112,6 +2114,9 @@ private final class PremiumIntroScreenComponent: CombinedComponent {
|
||||
if lhs.forceDark != rhs.forceDark {
|
||||
return false
|
||||
}
|
||||
if lhs.forceHasPremium != rhs.forceHasPremium {
|
||||
return false
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
@ -2171,7 +2176,7 @@ private final class PremiumIntroScreenComponent: CombinedComponent {
|
||||
}
|
||||
}
|
||||
|
||||
init(context: AccountContext, source: PremiumSource, updateInProgress: @escaping (Bool) -> Void, present: @escaping (ViewController) -> Void, completion: @escaping () -> Void) {
|
||||
init(context: AccountContext, source: PremiumSource, forceHasPremium: Bool, updateInProgress: @escaping (Bool) -> Void, present: @escaping (ViewController) -> Void, completion: @escaping () -> Void) {
|
||||
self.context = context
|
||||
self.updateInProgress = updateInProgress
|
||||
self.present = present
|
||||
@ -2212,6 +2217,10 @@ private final class PremiumIntroScreenComponent: CombinedComponent {
|
||||
otherPeerName = .single(nil)
|
||||
}
|
||||
|
||||
if forceHasPremium {
|
||||
self.isPremium = true
|
||||
}
|
||||
|
||||
self.disposable = combineLatest(
|
||||
queue: Queue.mainQueue(),
|
||||
availableProducts,
|
||||
@ -2235,7 +2244,7 @@ private final class PremiumIntroScreenComponent: CombinedComponent {
|
||||
}
|
||||
|
||||
strongSelf.products = products
|
||||
strongSelf.isPremium = isPremium
|
||||
strongSelf.isPremium = forceHasPremium || isPremium
|
||||
strongSelf.otherPeerName = otherPeerName
|
||||
|
||||
if !hadProducts {
|
||||
@ -2409,7 +2418,7 @@ private final class PremiumIntroScreenComponent: CombinedComponent {
|
||||
}
|
||||
|
||||
func makeState() -> State {
|
||||
return State(context: self.context, source: self.source, updateInProgress: self.updateInProgress, present: self.present, completion: self.completion)
|
||||
return State(context: self.context, source: self.source, forceHasPremium: self.forceHasPremium, updateInProgress: self.updateInProgress, present: self.present, completion: self.completion)
|
||||
}
|
||||
|
||||
static var body: Body {
|
||||
@ -2863,7 +2872,7 @@ public final class PremiumIntroScreen: ViewControllerComponentContainer {
|
||||
public weak var containerView: UIView?
|
||||
public var animationColor: UIColor?
|
||||
|
||||
public init(context: AccountContext, modal: Bool = true, source: PremiumSource, forceDark: Bool = false) {
|
||||
public init(context: AccountContext, modal: Bool = true, source: PremiumSource, forceDark: Bool = false, forceHasPremium: Bool = false) {
|
||||
self.context = context
|
||||
|
||||
var updateInProgressImpl: ((Bool) -> Void)?
|
||||
@ -2874,6 +2883,7 @@ public final class PremiumIntroScreen: ViewControllerComponentContainer {
|
||||
context: context,
|
||||
source: source,
|
||||
forceDark: forceDark,
|
||||
forceHasPremium: forceHasPremium,
|
||||
updateInProgress: { inProgress in
|
||||
updateInProgressImpl?(inProgress)
|
||||
},
|
||||
|
||||
@ -903,7 +903,7 @@ func openResolvedUrlImpl(_ resolvedUrl: ResolvedUrl, context: AccountContext, ur
|
||||
|> deliverOnMainQueue).startStandalone(completed: {
|
||||
dismissImpl?()
|
||||
|
||||
let controller = context.sharedContext.makePremiumIntroController(context: context, source: .settings, forceDark: forceDark, dismissed: nil)
|
||||
let controller = PremiumIntroScreen(context: context, source: .settings, forceDark: forceDark, forceHasPremium: true)
|
||||
navigationController?.pushViewController(controller)
|
||||
if let controller = controller as? PremiumIntroScreen {
|
||||
Queue.mainQueue().after(0.3, {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user