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
fcac7312f9
commit
85207874a1
@ -62,7 +62,9 @@ public func PremiumBoostScreen(
|
||||
}
|
||||
|
||||
let subject: PremiumLimitScreen.Subject = .storiesChannelBoost(peer: peer, isCurrent: isCurrent, level: currentLevel, currentLevelBoosts: currentLevelBoosts, nextLevelBoosts: nextLevelBoosts, link: nil, myBoostCount: myBoostCount)
|
||||
let nextSubject: PremiumLimitScreen.Subject = .storiesChannelBoost(peer: peer, isCurrent: isCurrent, level: currentLevel, currentLevelBoosts: currentLevelBoosts, nextLevelBoosts: nextLevelBoosts, link: nil, myBoostCount: myBoostCount + 1)
|
||||
let nextSubject = Promise<PremiumLimitScreen.Subject>()
|
||||
nextSubject.set(.single(.storiesChannelBoost(peer: peer, isCurrent: isCurrent, level: currentLevel, currentLevelBoosts: currentLevelBoosts, nextLevelBoosts: nextLevelBoosts, link: nil, myBoostCount: myBoostCount + 1)))
|
||||
|
||||
var nextCount = Int32(status.boosts + 1)
|
||||
|
||||
var updateImpl: (() -> Void)?
|
||||
@ -86,7 +88,11 @@ public func PremiumBoostScreen(
|
||||
if let _ = status.nextLevelBoosts {
|
||||
if let availableBoost = availableBoosts.first {
|
||||
let _ = context.engine.peers.applyChannelBoost(peerId: peerId, slots: [availableBoost.slot]).startStandalone()
|
||||
controller?.updateSubject(nextSubject, count: nextCount)
|
||||
let _ = (nextSubject.get()
|
||||
|> take(1)
|
||||
|> deliverOnMainQueue).startStandalone(next: { nextSubject in
|
||||
controller?.updateSubject(nextSubject, count: nextCount)
|
||||
})
|
||||
|
||||
availableBoosts.removeFirst()
|
||||
nextCount += 1
|
||||
|
||||
@ -52,14 +52,17 @@ public class WebAppCancelButtonNode: ASDisplayNode {
|
||||
}
|
||||
private let strings: PresentationStrings
|
||||
|
||||
private weak var colorSnapshotView: UIView?
|
||||
|
||||
public func updateColor(_ color: UIColor?, transition: ContainedViewLayoutTransition) {
|
||||
let previousColor = self.color
|
||||
self.color = color
|
||||
|
||||
if case let .animated(duration, curve) = transition, previousColor != color {
|
||||
|
||||
if case let .animated(duration, curve) = transition, previousColor != color, !self.animatingStateChange {
|
||||
if let snapshotView = self.view.snapshotContentTree() {
|
||||
snapshotView.frame = self.bounds
|
||||
self.view.addSubview(snapshotView)
|
||||
self.colorSnapshotView = snapshotView
|
||||
|
||||
snapshotView.layer.animateAlpha(from: 1.0, to: 0.0, duration: duration, timingFunction: curve.timingFunction, removeOnCompletion: false, completion: { _ in
|
||||
snapshotView.removeFromSuperview()
|
||||
@ -125,6 +128,11 @@ public class WebAppCancelButtonNode: ASDisplayNode {
|
||||
}
|
||||
self.state = state
|
||||
|
||||
if let colorSnapshotView = self.colorSnapshotView {
|
||||
self.colorSnapshotView = nil
|
||||
colorSnapshotView.removeFromSuperview()
|
||||
}
|
||||
|
||||
if animated, let snapshotView = self.buttonNode.view.snapshotContentTree() {
|
||||
self.animatingStateChange = true
|
||||
snapshotView.layer.sublayerTransform = self.buttonNode.subnodeTransform
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user