Various fixes

This commit is contained in:
Ilya Laktyushin 2022-06-11 20:00:35 +04:00
parent d8f7f18652
commit 3481e44afa
3 changed files with 20 additions and 2 deletions

View File

@ -1227,6 +1227,10 @@ private final class PremiumIntroScreenContentComponent: CombinedComponent {
size.height += 10.0
size.height += scrollEnvironment.insets.bottom
if context.component.source != .settings {
size.height += 44.0
}
return size
}
}
@ -1391,7 +1395,7 @@ private final class PremiumIntroScreenComponent: CombinedComponent {
guard !self.context.account.testingEnvironment else {
let presentationData = self.context.sharedContext.currentPresentationData.with { $0 }
let alertController = textAlertController(context: self.context, title: nil, text: "Telegram Premium purchase is not available in the test environment.", actions: [TextAlertAction(type: .defaultAction, title: presentationData.strings.Common_OK, action: {})])
let alertController = textAlertController(context: self.context, title: nil, text: "Telegram Premium is not available in the test environment.", actions: [TextAlertAction(type: .defaultAction, title: presentationData.strings.Common_OK, action: {})])
self.present(alertController)
return
}
@ -1425,6 +1429,8 @@ private final class PremiumIntroScreenComponent: CombinedComponent {
|> deliverOnMainQueue).start(error: { [weak self] _ in
if let strongSelf = self {
strongSelf.inProgress = false
strongSelf.updateInProgress(false)
strongSelf.updated(transition: .immediate)
strongSelf.completion()
@ -1439,6 +1445,8 @@ private final class PremiumIntroScreenComponent: CombinedComponent {
if let strongSelf = self {
let _ = updatePremiumPromoConfigurationOnce(account: strongSelf.context.account).start()
strongSelf.inProgress = false
strongSelf.updateInProgress(false)
strongSelf.isPremium = true
strongSelf.updated(transition: .easeInOut(duration: 0.25))
strongSelf.completion()

View File

@ -118,6 +118,7 @@ public final class SolidRoundedButtonNode: ASDisplayNode {
let animationNode = SimpleAnimationNode(animationName: animation, size: CGSize(width: 30.0, height: 30.0))
animationNode.customColor = self.theme.foregroundColor
animationNode.isUserInteractionEnabled = false
self.addSubnode(animationNode)
self.animationNode = animationNode
@ -227,6 +228,8 @@ public final class SolidRoundedButtonNode: ASDisplayNode {
strongSelf.subtitleNode.alpha = 0.55
strongSelf.iconNode.layer.removeAnimation(forKey: "opacity")
strongSelf.iconNode.alpha = 0.55
strongSelf.animationNode?.layer.removeAnimation(forKey: "opacity")
strongSelf.animationNode?.alpha = 0.55
} else {
if strongSelf.buttonBackgroundNode.alpha > 0.0 {
strongSelf.buttonBackgroundNode.alpha = 1.0
@ -237,6 +240,8 @@ public final class SolidRoundedButtonNode: ASDisplayNode {
strongSelf.subtitleNode.layer.animateAlpha(from: 0.55, to: 1.0, duration: 0.2)
strongSelf.iconNode.alpha = 1.0
strongSelf.iconNode.layer.animateAlpha(from: 0.55, to: 1.0, duration: 0.2)
strongSelf.animationNode?.alpha = 1.0
strongSelf.animationNode?.layer.animateAlpha(from: 0.55, to: 1.0, duration: 0.2)
}
}
}
@ -662,6 +667,7 @@ public final class SolidRoundedButtonView: UIView {
let animationNode = SimpleAnimationNode(animationName: animation, size: CGSize(width: 30.0, height: 30.0))
animationNode.customColor = self.theme.foregroundColor
animationNode.isUserInteractionEnabled = false
self.addSubview(animationNode.view)
self.animationNode = animationNode
@ -784,6 +790,8 @@ public final class SolidRoundedButtonView: UIView {
strongSelf.subtitleNode.alpha = 0.55
strongSelf.iconNode.layer.removeAnimation(forKey: "opacity")
strongSelf.iconNode.alpha = 0.55
strongSelf.animationNode?.layer.removeAnimation(forKey: "opacity")
strongSelf.animationNode?.alpha = 0.55
} else {
if strongSelf.buttonBackgroundNode.alpha > 0.0 {
strongSelf.buttonBackgroundNode.alpha = 1.0
@ -794,6 +802,8 @@ public final class SolidRoundedButtonView: UIView {
strongSelf.subtitleNode.layer.animateAlpha(from: 0.55, to: 1.0, duration: 0.2)
strongSelf.iconNode.alpha = 1.0
strongSelf.iconNode.layer.animateAlpha(from: 0.55, to: 1.0, duration: 0.2)
strongSelf.animationNode?.alpha = 1.0
strongSelf.animationNode?.layer.animateAlpha(from: 0.55, to: 1.0, duration: 0.2)
}
}
}

View File

@ -2310,7 +2310,7 @@ final class PeerInfoHeaderNode: ASDisplayNode {
credibilityIcon = .scam
} else if peer.isVerified {
credibilityIcon = .verified
} else if peer.isPremium && !premiumConfiguration.isPremiumDisabled && peer.id != self.context.account.peerId {
} else if peer.isPremium && !premiumConfiguration.isPremiumDisabled && (peer.id != self.context.account.peerId || self.isSettings) {
credibilityIcon = .premium
} else {
credibilityIcon = .none