mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-12-23 22:55:00 +00:00
Various improvements
This commit is contained in:
@@ -1213,9 +1213,9 @@ public final class ChatEmptyNodePremiumRequiredChatContent: ASDisplayNode, ChatE
|
||||
private var currentTheme: PresentationTheme?
|
||||
private var currentStrings: PresentationStrings?
|
||||
|
||||
private let stars: StarsAmount?
|
||||
private let stars: Int64?
|
||||
|
||||
public init(context: AccountContext, interaction: ChatPanelInterfaceInteraction?, stars: StarsAmount?) {
|
||||
public init(context: AccountContext, interaction: ChatPanelInterfaceInteraction?, stars: Int64?) {
|
||||
let premiumConfiguration = PremiumConfiguration.with(appConfiguration: context.currentAppConfiguration.with { $0 })
|
||||
self.isPremiumDisabled = premiumConfiguration.isPremiumDisabled
|
||||
self.stars = stars
|
||||
@@ -1295,7 +1295,7 @@ public final class ChatEmptyNodePremiumRequiredChatContent: ASDisplayNode, ChatE
|
||||
}
|
||||
)
|
||||
if let amount = self.stars {
|
||||
let starsString = presentationStringsFormattedNumber(Int32(amount.value), interfaceState.dateTimeFormat.groupingSeparator)
|
||||
let starsString = presentationStringsFormattedNumber(Int32(amount), interfaceState.dateTimeFormat.groupingSeparator)
|
||||
let rawText: String
|
||||
if self.isPremiumDisabled {
|
||||
rawText = interfaceState.strings.Chat_EmptyStatePaidMessagingDisabled_Text(peerTitle, " $ \(starsString)").string
|
||||
@@ -1426,7 +1426,7 @@ private enum ChatEmptyNodeContentType: Equatable {
|
||||
case greeting
|
||||
case topic
|
||||
case premiumRequired
|
||||
case starsRequired
|
||||
case starsRequired(Int64)
|
||||
}
|
||||
|
||||
private final class EmptyAttachedDescriptionNode: HighlightTrackingButtonNode {
|
||||
@@ -1815,8 +1815,8 @@ public final class ChatEmptyNode: ASDisplayNode {
|
||||
} else if let _ = interfaceState.peerNearbyData {
|
||||
contentType = .peerNearby
|
||||
} else if let peer = peer as? TelegramUser {
|
||||
if let _ = interfaceState.sendPaidMessageStars, interfaceState.businessIntro == nil {
|
||||
contentType = .starsRequired
|
||||
if let sendPaidMessageStars = interfaceState.sendPaidMessageStars, interfaceState.businessIntro == nil {
|
||||
contentType = .starsRequired(sendPaidMessageStars.value)
|
||||
} else if interfaceState.isPremiumRequiredForMessaging {
|
||||
contentType = .premiumRequired
|
||||
} else {
|
||||
@@ -1881,8 +1881,8 @@ public final class ChatEmptyNode: ASDisplayNode {
|
||||
node = ChatEmptyNodeTopicChatContent(context: self.context)
|
||||
case .premiumRequired:
|
||||
node = ChatEmptyNodePremiumRequiredChatContent(context: self.context, interaction: self.interaction, stars: nil)
|
||||
case .starsRequired:
|
||||
node = ChatEmptyNodePremiumRequiredChatContent(context: self.context, interaction: self.interaction, stars: interfaceState.sendPaidMessageStars)
|
||||
case let .starsRequired(stars):
|
||||
node = ChatEmptyNodePremiumRequiredChatContent(context: self.context, interaction: self.interaction, stars: stars)
|
||||
}
|
||||
self.content = (contentType, node)
|
||||
self.addSubnode(node)
|
||||
@@ -1893,7 +1893,12 @@ public final class ChatEmptyNode: ASDisplayNode {
|
||||
node.layer.animateScale(from: 0.0, to: 1.0, duration: duration, timingFunction: curve.timingFunction)
|
||||
}
|
||||
}
|
||||
self.isUserInteractionEnabled = [.peerNearby, .greeting, .premiumRequired, .starsRequired, .cloud].contains(contentType)
|
||||
switch contentType {
|
||||
case .peerNearby, .greeting, .premiumRequired, .starsRequired, .cloud:
|
||||
self.isUserInteractionEnabled = true
|
||||
default:
|
||||
self.isUserInteractionEnabled = false
|
||||
}
|
||||
|
||||
let displayRect = CGRect(origin: CGPoint(x: 0.0, y: insets.top), size: CGSize(width: size.width, height: size.height - insets.top - insets.bottom))
|
||||
|
||||
|
||||
Reference in New Issue
Block a user