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