Various improvements

This commit is contained in:
Ilya Laktyushin 2025-02-27 19:01:45 +04:00
parent c026f5af0b
commit 3e8c42cea4
10 changed files with 60 additions and 25 deletions

View File

@ -13896,6 +13896,7 @@ Sorry for the inconvenience.";
"Chat.NonContactUser.UpdatedDays_any" = "%@ days ago"; "Chat.NonContactUser.UpdatedDays_any" = "%@ days ago";
"Chat.InputTextPaidMessagePlaceholder" = "Message for %@"; "Chat.InputTextPaidMessagePlaceholder" = "Message for %@";
"Chat.InputTextPaidCommentPlaceholder" = "Comment for %@";
"Privacy.Messages.Stars_1" = "%@ Star"; "Privacy.Messages.Stars_1" = "%@ Star";
"Privacy.Messages.Stars_any" = "%@ Stars"; "Privacy.Messages.Stars_any" = "%@ Stars";
@ -13943,6 +13944,7 @@ Sorry for the inconvenience.";
"Chat.PaidMessage.Confirm.PayForMessage_1" = "Pay for %@ Message"; "Chat.PaidMessage.Confirm.PayForMessage_1" = "Pay for %@ Message";
"Chat.PaidMessage.Confirm.PayForMessage_any" = "Pay for %@ Messages"; "Chat.PaidMessage.Confirm.PayForMessage_any" = "Pay for %@ Messages";
"Chat.PaidMessage.Confirm.Single.Text" = "**%1$@** charges **%2$@** per incoming message. Would you like to pay **%3$@** to send %4$@?"; "Chat.PaidMessage.Confirm.Single.Text" = "**%1$@** charges **%2$@** per incoming message. Would you like to pay **%3$@** to send %4$@?";
"Chat.PaidMessage.Confirm.SingleComment.Text" = "**%1$@** charges **%2$@** per comment. Would you like to pay **%3$@** to send %4$@?";
"Chat.PaidMessage.Confirm.Multiple.Text" = "You selected %1$@ who charge Stars for messages. Would you like to pay **%2$@** Stars to send %3$@?"; "Chat.PaidMessage.Confirm.Multiple.Text" = "You selected %1$@ who charge Stars for messages. Would you like to pay **%2$@** Stars to send %3$@?";
"Chat.PaidMessage.Confirm.Text.Users_1" = "**%@** user"; "Chat.PaidMessage.Confirm.Text.Users_1" = "**%@** user";
"Chat.PaidMessage.Confirm.Text.Users_any" = "**%@** users"; "Chat.PaidMessage.Confirm.Text.Users_any" = "**%@** users";

View File

@ -936,7 +936,7 @@ fileprivate let parsers: [Int32 : (BufferReader) -> Any?] = {
dict[779004698] = { return Api.StarsSubscription.parse_starsSubscription($0) } dict[779004698] = { return Api.StarsSubscription.parse_starsSubscription($0) }
dict[88173912] = { return Api.StarsSubscriptionPricing.parse_starsSubscriptionPricing($0) } dict[88173912] = { return Api.StarsSubscriptionPricing.parse_starsSubscriptionPricing($0) }
dict[198776256] = { return Api.StarsTopupOption.parse_starsTopupOption($0) } dict[198776256] = { return Api.StarsTopupOption.parse_starsTopupOption($0) }
dict[-321582812] = { return Api.StarsTransaction.parse_starsTransaction($0) } dict[-1549805238] = { return Api.StarsTransaction.parse_starsTransaction($0) }
dict[-670195363] = { return Api.StarsTransactionPeer.parse_starsTransactionPeer($0) } dict[-670195363] = { return Api.StarsTransactionPeer.parse_starsTransactionPeer($0) }
dict[-110658899] = { return Api.StarsTransactionPeer.parse_starsTransactionPeerAPI($0) } dict[-110658899] = { return Api.StarsTransactionPeer.parse_starsTransactionPeerAPI($0) }
dict[1617438738] = { return Api.StarsTransactionPeer.parse_starsTransactionPeerAds($0) } dict[1617438738] = { return Api.StarsTransactionPeer.parse_starsTransactionPeerAds($0) }

View File

@ -334,13 +334,13 @@ public extension Api {
} }
public extension Api { public extension Api {
enum StarsTransaction: TypeConstructorDescription { enum StarsTransaction: TypeConstructorDescription {
case starsTransaction(flags: Int32, id: String, stars: Api.StarsAmount, date: Int32, peer: Api.StarsTransactionPeer, title: String?, description: String?, photo: Api.WebDocument?, transactionDate: Int32?, transactionUrl: String?, botPayload: Buffer?, msgId: Int32?, extendedMedia: [Api.MessageMedia]?, subscriptionPeriod: Int32?, giveawayPostId: Int32?, stargift: Api.StarGift?, floodskipNumber: Int32?, starrefCommissionPermille: Int32?, starrefPeer: Api.Peer?, starrefAmount: Api.StarsAmount?, paidMessages: Int32?) case starsTransaction(flags: Int32, id: String, stars: Api.StarsAmount, date: Int32, peer: Api.StarsTransactionPeer, title: String?, description: String?, photo: Api.WebDocument?, transactionDate: Int32?, transactionUrl: String?, botPayload: Buffer?, msgId: Int32?, extendedMedia: [Api.MessageMedia]?, subscriptionPeriod: Int32?, giveawayPostId: Int32?, stargift: Api.StarGift?, floodskipNumber: Int32?, starrefCommissionPermille: Int32?, starrefPeer: Api.Peer?, starrefAmount: Api.StarsAmount?, paidMessages: Int32?, premiumGiftMonths: Int32?)
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) { public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
switch self { switch self {
case .starsTransaction(let flags, let id, let stars, let date, let peer, let title, let description, let photo, let transactionDate, let transactionUrl, let botPayload, let msgId, let extendedMedia, let subscriptionPeriod, let giveawayPostId, let stargift, let floodskipNumber, let starrefCommissionPermille, let starrefPeer, let starrefAmount, let paidMessages): case .starsTransaction(let flags, let id, let stars, let date, let peer, let title, let description, let photo, let transactionDate, let transactionUrl, let botPayload, let msgId, let extendedMedia, let subscriptionPeriod, let giveawayPostId, let stargift, let floodskipNumber, let starrefCommissionPermille, let starrefPeer, let starrefAmount, let paidMessages, let premiumGiftMonths):
if boxed { if boxed {
buffer.appendInt32(-321582812) buffer.appendInt32(-1549805238)
} }
serializeInt32(flags, buffer: buffer, boxed: false) serializeInt32(flags, buffer: buffer, boxed: false)
serializeString(id, buffer: buffer, boxed: false) serializeString(id, buffer: buffer, boxed: false)
@ -367,14 +367,15 @@ public extension Api {
if Int(flags) & Int(1 << 17) != 0 {starrefPeer!.serialize(buffer, true)} if Int(flags) & Int(1 << 17) != 0 {starrefPeer!.serialize(buffer, true)}
if Int(flags) & Int(1 << 17) != 0 {starrefAmount!.serialize(buffer, true)} if Int(flags) & Int(1 << 17) != 0 {starrefAmount!.serialize(buffer, true)}
if Int(flags) & Int(1 << 19) != 0 {serializeInt32(paidMessages!, buffer: buffer, boxed: false)} if Int(flags) & Int(1 << 19) != 0 {serializeInt32(paidMessages!, buffer: buffer, boxed: false)}
if Int(flags) & Int(1 << 20) != 0 {serializeInt32(premiumGiftMonths!, buffer: buffer, boxed: false)}
break break
} }
} }
public func descriptionFields() -> (String, [(String, Any)]) { public func descriptionFields() -> (String, [(String, Any)]) {
switch self { switch self {
case .starsTransaction(let flags, let id, let stars, let date, let peer, let title, let description, let photo, let transactionDate, let transactionUrl, let botPayload, let msgId, let extendedMedia, let subscriptionPeriod, let giveawayPostId, let stargift, let floodskipNumber, let starrefCommissionPermille, let starrefPeer, let starrefAmount, let paidMessages): case .starsTransaction(let flags, let id, let stars, let date, let peer, let title, let description, let photo, let transactionDate, let transactionUrl, let botPayload, let msgId, let extendedMedia, let subscriptionPeriod, let giveawayPostId, let stargift, let floodskipNumber, let starrefCommissionPermille, let starrefPeer, let starrefAmount, let paidMessages, let premiumGiftMonths):
return ("starsTransaction", [("flags", flags as Any), ("id", id as Any), ("stars", stars as Any), ("date", date as Any), ("peer", peer as Any), ("title", title as Any), ("description", description as Any), ("photo", photo as Any), ("transactionDate", transactionDate as Any), ("transactionUrl", transactionUrl as Any), ("botPayload", botPayload as Any), ("msgId", msgId as Any), ("extendedMedia", extendedMedia as Any), ("subscriptionPeriod", subscriptionPeriod as Any), ("giveawayPostId", giveawayPostId as Any), ("stargift", stargift as Any), ("floodskipNumber", floodskipNumber as Any), ("starrefCommissionPermille", starrefCommissionPermille as Any), ("starrefPeer", starrefPeer as Any), ("starrefAmount", starrefAmount as Any), ("paidMessages", paidMessages as Any)]) return ("starsTransaction", [("flags", flags as Any), ("id", id as Any), ("stars", stars as Any), ("date", date as Any), ("peer", peer as Any), ("title", title as Any), ("description", description as Any), ("photo", photo as Any), ("transactionDate", transactionDate as Any), ("transactionUrl", transactionUrl as Any), ("botPayload", botPayload as Any), ("msgId", msgId as Any), ("extendedMedia", extendedMedia as Any), ("subscriptionPeriod", subscriptionPeriod as Any), ("giveawayPostId", giveawayPostId as Any), ("stargift", stargift as Any), ("floodskipNumber", floodskipNumber as Any), ("starrefCommissionPermille", starrefCommissionPermille as Any), ("starrefPeer", starrefPeer as Any), ("starrefAmount", starrefAmount as Any), ("paidMessages", paidMessages as Any), ("premiumGiftMonths", premiumGiftMonths as Any)])
} }
} }
@ -435,6 +436,8 @@ public extension Api {
} } } }
var _21: Int32? var _21: Int32?
if Int(_1!) & Int(1 << 19) != 0 {_21 = reader.readInt32() } if Int(_1!) & Int(1 << 19) != 0 {_21 = reader.readInt32() }
var _22: Int32?
if Int(_1!) & Int(1 << 20) != 0 {_22 = reader.readInt32() }
let _c1 = _1 != nil let _c1 = _1 != nil
let _c2 = _2 != nil let _c2 = _2 != nil
let _c3 = _3 != nil let _c3 = _3 != nil
@ -456,8 +459,9 @@ public extension Api {
let _c19 = (Int(_1!) & Int(1 << 17) == 0) || _19 != nil let _c19 = (Int(_1!) & Int(1 << 17) == 0) || _19 != nil
let _c20 = (Int(_1!) & Int(1 << 17) == 0) || _20 != nil let _c20 = (Int(_1!) & Int(1 << 17) == 0) || _20 != nil
let _c21 = (Int(_1!) & Int(1 << 19) == 0) || _21 != nil let _c21 = (Int(_1!) & Int(1 << 19) == 0) || _21 != nil
if _c1 && _c2 && _c3 && _c4 && _c5 && _c6 && _c7 && _c8 && _c9 && _c10 && _c11 && _c12 && _c13 && _c14 && _c15 && _c16 && _c17 && _c18 && _c19 && _c20 && _c21 { let _c22 = (Int(_1!) & Int(1 << 20) == 0) || _22 != nil
return Api.StarsTransaction.starsTransaction(flags: _1!, id: _2!, stars: _3!, date: _4!, peer: _5!, title: _6, description: _7, photo: _8, transactionDate: _9, transactionUrl: _10, botPayload: _11, msgId: _12, extendedMedia: _13, subscriptionPeriod: _14, giveawayPostId: _15, stargift: _16, floodskipNumber: _17, starrefCommissionPermille: _18, starrefPeer: _19, starrefAmount: _20, paidMessages: _21) if _c1 && _c2 && _c3 && _c4 && _c5 && _c6 && _c7 && _c8 && _c9 && _c10 && _c11 && _c12 && _c13 && _c14 && _c15 && _c16 && _c17 && _c18 && _c19 && _c20 && _c21 && _c22 {
return Api.StarsTransaction.starsTransaction(flags: _1!, id: _2!, stars: _3!, date: _4!, peer: _5!, title: _6, description: _7, photo: _8, transactionDate: _9, transactionUrl: _10, botPayload: _11, msgId: _12, extendedMedia: _13, subscriptionPeriod: _14, giveawayPostId: _15, stargift: _16, floodskipNumber: _17, starrefCommissionPermille: _18, starrefPeer: _19, starrefAmount: _20, paidMessages: _21, premiumGiftMonths: _22)
} }
else { else {
return nil return nil

View File

@ -551,7 +551,7 @@ private final class StarsContextImpl {
} }
var transactions = state.transactions var transactions = state.transactions
if addTransaction { if addTransaction {
transactions.insert(.init(flags: [.isLocal], id: "\(arc4random())", count: balance, date: Int32(Date().timeIntervalSince1970), peer: .appStore, title: nil, description: nil, photo: nil, transactionDate: nil, transactionUrl: nil, paidMessageId: nil, giveawayMessageId: nil, media: [], subscriptionPeriod: nil, starGift: nil, floodskipNumber: nil, starrefCommissionPermille: nil, starrefPeerId: nil, starrefAmount: nil, paidMessageCount: nil), at: 0) transactions.insert(.init(flags: [.isLocal], id: "\(arc4random())", count: balance, date: Int32(Date().timeIntervalSince1970), peer: .appStore, title: nil, description: nil, photo: nil, transactionDate: nil, transactionUrl: nil, paidMessageId: nil, giveawayMessageId: nil, media: [], subscriptionPeriod: nil, starGift: nil, floodskipNumber: nil, starrefCommissionPermille: nil, starrefPeerId: nil, starrefAmount: nil, paidMessageCount: nil, premiumGiftMonths: nil), at: 0)
} }
self.updateState(StarsContext.State(flags: [.isPendingBalance], balance: max(StarsAmount(value: 0, nanos: 0), state.balance + balance), subscriptions: state.subscriptions, canLoadMoreSubscriptions: state.canLoadMoreSubscriptions, transactions: transactions, canLoadMoreTransactions: state.canLoadMoreTransactions, isLoading: state.isLoading)) self.updateState(StarsContext.State(flags: [.isPendingBalance], balance: max(StarsAmount(value: 0, nanos: 0), state.balance + balance), subscriptions: state.subscriptions, canLoadMoreSubscriptions: state.canLoadMoreSubscriptions, transactions: transactions, canLoadMoreTransactions: state.canLoadMoreTransactions, isLoading: state.isLoading))
@ -573,7 +573,7 @@ private final class StarsContextImpl {
private extension StarsContext.State.Transaction { private extension StarsContext.State.Transaction {
init?(apiTransaction: Api.StarsTransaction, peerId: EnginePeer.Id?, transaction: Transaction) { init?(apiTransaction: Api.StarsTransaction, peerId: EnginePeer.Id?, transaction: Transaction) {
switch apiTransaction { switch apiTransaction {
case let .starsTransaction(apiFlags, id, stars, date, transactionPeer, title, description, photo, transactionDate, transactionUrl, _, messageId, extendedMedia, subscriptionPeriod, giveawayPostId, starGift, floodskipNumber, starrefCommissionPermille, starrefPeer, starrefAmount, paidMessageCount): case let .starsTransaction(apiFlags, id, stars, date, transactionPeer, title, description, photo, transactionDate, transactionUrl, _, messageId, extendedMedia, subscriptionPeriod, giveawayPostId, starGift, floodskipNumber, starrefCommissionPermille, starrefPeer, starrefAmount, paidMessageCount, premiumGiftMonths):
let parsedPeer: StarsContext.State.Transaction.Peer let parsedPeer: StarsContext.State.Transaction.Peer
var paidMessageId: MessageId? var paidMessageId: MessageId?
var giveawayMessageId: MessageId? var giveawayMessageId: MessageId?
@ -636,7 +636,7 @@ private extension StarsContext.State.Transaction {
let media = extendedMedia.flatMap({ $0.compactMap { textMediaAndExpirationTimerFromApiMedia($0, PeerId(0)).media } }) ?? [] let media = extendedMedia.flatMap({ $0.compactMap { textMediaAndExpirationTimerFromApiMedia($0, PeerId(0)).media } }) ?? []
let _ = subscriptionPeriod let _ = subscriptionPeriod
self.init(flags: flags, id: id, count: StarsAmount(apiAmount: stars), date: date, peer: parsedPeer, title: title, description: description, photo: photo.flatMap(TelegramMediaWebFile.init), transactionDate: transactionDate, transactionUrl: transactionUrl, paidMessageId: paidMessageId, giveawayMessageId: giveawayMessageId, media: media, subscriptionPeriod: subscriptionPeriod, starGift: starGift.flatMap { StarGift(apiStarGift: $0) }, floodskipNumber: floodskipNumber, starrefCommissionPermille: starrefCommissionPermille, starrefPeerId: starrefPeer?.peerId, starrefAmount: starrefAmount.flatMap(StarsAmount.init(apiAmount:)), paidMessageCount: paidMessageCount) self.init(flags: flags, id: id, count: StarsAmount(apiAmount: stars), date: date, peer: parsedPeer, title: title, description: description, photo: photo.flatMap(TelegramMediaWebFile.init), transactionDate: transactionDate, transactionUrl: transactionUrl, paidMessageId: paidMessageId, giveawayMessageId: giveawayMessageId, media: media, subscriptionPeriod: subscriptionPeriod, starGift: starGift.flatMap { StarGift(apiStarGift: $0) }, floodskipNumber: floodskipNumber, starrefCommissionPermille: starrefCommissionPermille, starrefPeerId: starrefPeer?.peerId, starrefAmount: starrefAmount.flatMap(StarsAmount.init(apiAmount:)), paidMessageCount: paidMessageCount, premiumGiftMonths: premiumGiftMonths)
} }
} }
} }
@ -717,6 +717,7 @@ public final class StarsContext {
public let starrefPeerId: PeerId? public let starrefPeerId: PeerId?
public let starrefAmount: StarsAmount? public let starrefAmount: StarsAmount?
public let paidMessageCount: Int32? public let paidMessageCount: Int32?
public let premiumGiftMonths: Int32?
public init( public init(
flags: Flags, flags: Flags,
@ -738,7 +739,8 @@ public final class StarsContext {
starrefCommissionPermille: Int32?, starrefCommissionPermille: Int32?,
starrefPeerId: PeerId?, starrefPeerId: PeerId?,
starrefAmount: StarsAmount?, starrefAmount: StarsAmount?,
paidMessageCount: Int32? paidMessageCount: Int32?,
premiumGiftMonths: Int32?
) { ) {
self.flags = flags self.flags = flags
self.id = id self.id = id
@ -760,6 +762,7 @@ public final class StarsContext {
self.starrefPeerId = starrefPeerId self.starrefPeerId = starrefPeerId
self.starrefAmount = starrefAmount self.starrefAmount = starrefAmount
self.paidMessageCount = paidMessageCount self.paidMessageCount = paidMessageCount
self.premiumGiftMonths = premiumGiftMonths
} }
public static func == (lhs: Transaction, rhs: Transaction) -> Bool { public static func == (lhs: Transaction, rhs: Transaction) -> Bool {
@ -823,6 +826,9 @@ public final class StarsContext {
if lhs.paidMessageCount != rhs.paidMessageCount { if lhs.paidMessageCount != rhs.paidMessageCount {
return false return false
} }
if lhs.premiumGiftMonths != rhs.premiumGiftMonths {
return false
}
return true return true
} }
} }

View File

@ -1268,7 +1268,7 @@ public final class ChatEmptyNodePremiumRequiredChatContent: ASDisplayNode, ChatE
public func updateLayout(interfaceState: ChatPresentationInterfaceState, subject: ChatEmptyNode.Subject, size: CGSize, transition: ContainedViewLayoutTransition) -> CGSize { public func updateLayout(interfaceState: ChatPresentationInterfaceState, subject: ChatEmptyNode.Subject, size: CGSize, transition: ContainedViewLayoutTransition) -> CGSize {
let serviceColor = serviceMessageColorComponents(theme: interfaceState.theme, wallpaper: interfaceState.chatWallpaper) let serviceColor = serviceMessageColorComponents(theme: interfaceState.theme, wallpaper: interfaceState.chatWallpaper)
let maxWidth = min(200.0, size.width) let maxWidth = min(270.0, size.width)
let sideInset: CGFloat = 22.0 let sideInset: CGFloat = 22.0
let topInset: CGFloat = 16.0 let topInset: CGFloat = 16.0

View File

@ -439,7 +439,11 @@ public func chatMessagePaymentAlertController(
if peers.count == 1, let peer = peers.first { if peers.count == 1, let peer = peers.first {
let amountString = presentationData.strings.Chat_PaidMessage_Confirm_Text_Stars(Int32(amount.value)) let amountString = presentationData.strings.Chat_PaidMessage_Confirm_Text_Stars(Int32(amount.value))
let totalString = presentationData.strings.Chat_PaidMessage_Confirm_Text_Stars(Int32(amount.value * Int64(count))) let totalString = presentationData.strings.Chat_PaidMessage_Confirm_Text_Stars(Int32(amount.value * Int64(count)))
text = presentationData.strings.Chat_PaidMessage_Confirm_Single_Text(peer.compactDisplayTitle, amountString, totalString, messagesString).string if case let .channel(channel) = peer, case .broadcast = channel.info {
text = presentationData.strings.Chat_PaidMessage_Confirm_SingleComment_Text(peer.compactDisplayTitle, amountString, totalString, messagesString).string
} else {
text = presentationData.strings.Chat_PaidMessage_Confirm_Single_Text(peer.compactDisplayTitle, amountString, totalString, messagesString).string
}
} else { } else {
let amount = totalAmount ?? amount let amount = totalAmount ?? amount
let usersString = presentationData.strings.Chat_PaidMessage_Confirm_Text_Users(Int32(peers.count)) let usersString = presentationData.strings.Chat_PaidMessage_Confirm_Text_Users(Int32(peers.count))

View File

@ -4703,6 +4703,9 @@ final class PeerInfoScreenNode: ViewControllerTracingNode, PeerInfoScreenNodePro
return return
} }
let sourceRect = sourceView.convert(sourceView.bounds, to: controller.view) let sourceRect = sourceView.convert(sourceView.bounds, to: controller.view)
guard sourceRect.minY > 44.0 else {
return
}
let backgroundColor: UIColor let backgroundColor: UIColor
if !self.headerNode.isAvatarExpanded, let contentButtonBackgroundColor = self.headerNode.contentButtonBackgroundColor { if !self.headerNode.isAvatarExpanded, let contentButtonBackgroundColor = self.headerNode.contentButtonBackgroundColor {

View File

@ -36,6 +36,10 @@ extension ChatControllerImpl {
if forceDark { if forceDark {
presentationData = presentationData.withUpdated(theme: defaultDarkColorPresentationTheme) presentationData = presentationData.withUpdated(theme: defaultDarkColorPresentationTheme)
} }
var peer = peer
if let peerDiscussionId = self.presentationInterfaceState.peerDiscussionId, let channel = self.peerView?.peers[peerDiscussionId] {
peer = EnginePeer(channel)
}
let controller = chatMessagePaymentAlertController( let controller = chatMessagePaymentAlertController(
context: self.context, context: self.context,
presentationData: presentationData, presentationData: presentationData,

View File

@ -5743,12 +5743,12 @@ public final class ChatControllerImpl: TelegramBaseController, ChatController, G
if let peer = peerView.peers[peerView.peerId] as? TelegramChannel, let cachedData = peerView.cachedData as? CachedChannelData { if let peer = peerView.peers[peerView.peerId] as? TelegramChannel, let cachedData = peerView.cachedData as? CachedChannelData {
if case .broadcast = peer.info { if case .broadcast = peer.info {
starGiftsAvailable = cachedData.flags.contains(.starGiftsAvailable) starGiftsAvailable = cachedData.flags.contains(.starGiftsAvailable)
if case let .known(value) = cachedData.linkedDiscussionPeerId {
peerDiscussionId = value
}
} else { } else {
peerGeoLocation = cachedData.peerGeoLocation peerGeoLocation = cachedData.peerGeoLocation
} }
if case let .known(value) = cachedData.linkedDiscussionPeerId {
peerDiscussionId = value
}
} }
var renderedPeer: RenderedPeer? var renderedPeer: RenderedPeer?
var contactStatus: ChatContactStatus? var contactStatus: ChatContactStatus?
@ -5787,7 +5787,6 @@ public final class ChatControllerImpl: TelegramBaseController, ChatController, G
if let channel = peerView.peers[peerView.peerId] as? TelegramChannel { if let channel = peerView.peers[peerView.peerId] as? TelegramChannel {
if channel.flags.contains(.isCreator) || channel.adminRights != nil { if channel.flags.contains(.isCreator) || channel.adminRights != nil {
} else { } else {
sendPaidMessageStars = channel.sendPaidMessageStars sendPaidMessageStars = channel.sendPaidMessageStars
} }
@ -5945,7 +5944,7 @@ public final class ChatControllerImpl: TelegramBaseController, ChatController, G
if strongSelf.preloadHistoryPeerId != peerDiscussionId { if strongSelf.preloadHistoryPeerId != peerDiscussionId {
strongSelf.preloadHistoryPeerId = peerDiscussionId strongSelf.preloadHistoryPeerId = peerDiscussionId
if let peerDiscussionId = peerDiscussionId { if let peerDiscussionId = peerDiscussionId, let channel = peerView.peers[peerView.peerId] as? TelegramChannel, case .broadcast = channel.info {
let combinedDisposable = DisposableSet() let combinedDisposable = DisposableSet()
strongSelf.preloadHistoryPeerIdDisposable.set(combinedDisposable) strongSelf.preloadHistoryPeerIdDisposable.set(combinedDisposable)
combinedDisposable.add(strongSelf.context.account.viewTracker.polledChannel(peerId: peerDiscussionId).startStrict()) combinedDisposable.add(strongSelf.context.account.viewTracker.polledChannel(peerId: peerDiscussionId).startStrict())
@ -6347,6 +6346,7 @@ public final class ChatControllerImpl: TelegramBaseController, ChatController, G
var contactStatus: ChatContactStatus? var contactStatus: ChatContactStatus?
var copyProtectionEnabled: Bool = false var copyProtectionEnabled: Bool = false
var businessIntro: TelegramBusinessIntro? var businessIntro: TelegramBusinessIntro?
var sendPaidMessageStars: StarsAmount?
if let peer = peerView.peers[peerView.peerId] { if let peer = peerView.peers[peerView.peerId] {
copyProtectionEnabled = peer.isCopyProtectionEnabled copyProtectionEnabled = peer.isCopyProtectionEnabled
if let cachedData = peerView.cachedData as? CachedUserData { if let cachedData = peerView.cachedData as? CachedUserData {
@ -6375,6 +6375,13 @@ public final class ChatControllerImpl: TelegramBaseController, ChatController, G
} }
} }
contactStatus = ChatContactStatus(canAddContact: false, canReportIrrelevantLocation: canReportIrrelevantLocation, peerStatusSettings: cachedData.peerStatusSettings, invitedBy: invitedBy, managingBot: managingBot) contactStatus = ChatContactStatus(canAddContact: false, canReportIrrelevantLocation: canReportIrrelevantLocation, peerStatusSettings: cachedData.peerStatusSettings, invitedBy: invitedBy, managingBot: managingBot)
if let channel = peerView.peers[peerView.peerId] as? TelegramChannel {
if channel.flags.contains(.isCreator) || channel.adminRights != nil {
} else {
sendPaidMessageStars = channel.sendPaidMessageStars
}
}
} }
var peers = SimpleDictionary<PeerId, Peer>() var peers = SimpleDictionary<PeerId, Peer>()
@ -6517,13 +6524,12 @@ public final class ChatControllerImpl: TelegramBaseController, ChatController, G
var currentSendAsPeerId: PeerId? var currentSendAsPeerId: PeerId?
if let peer = peerView.peers[peerView.peerId] as? TelegramChannel, let cachedData = peerView.cachedData as? CachedChannelData { if let peer = peerView.peers[peerView.peerId] as? TelegramChannel, let cachedData = peerView.cachedData as? CachedChannelData {
currentSendAsPeerId = cachedData.sendAsPeerId currentSendAsPeerId = cachedData.sendAsPeerId
if case .broadcast = peer.info { if case .group = peer.info {
if case let .known(value) = cachedData.linkedDiscussionPeerId {
peerDiscussionId = value
}
} else {
peerGeoLocation = cachedData.peerGeoLocation peerGeoLocation = cachedData.peerGeoLocation
} }
if case let .known(value) = cachedData.linkedDiscussionPeerId {
peerDiscussionId = value
}
} }
var isNotAccessible: Bool = false var isNotAccessible: Bool = false
@ -6638,6 +6644,7 @@ public final class ChatControllerImpl: TelegramBaseController, ChatController, G
.updatedAppliedBoosts(appliedBoosts) .updatedAppliedBoosts(appliedBoosts)
.updatedBoostsToUnrestrict(boostsToUnrestrict) .updatedBoostsToUnrestrict(boostsToUnrestrict)
.updatedBusinessIntro(businessIntro) .updatedBusinessIntro(businessIntro)
.updatedSendPaidMessageStars(sendPaidMessageStars)
.updatedInterfaceState { interfaceState in .updatedInterfaceState { interfaceState in
var interfaceState = interfaceState var interfaceState = interfaceState

View File

@ -1915,7 +1915,12 @@ class ChatTextInputPanelNode: ChatInputPanelNode, ASEditableTextNodeDelegate, Ch
placeholder = interfaceState.strings.Conversation_InputTextAnonymousPlaceholder placeholder = interfaceState.strings.Conversation_InputTextAnonymousPlaceholder
} else if case let .replyThread(replyThreadMessage) = interfaceState.chatLocation, !replyThreadMessage.isForumPost, replyThreadMessage.peerId != self.context?.account.peerId { } else if case let .replyThread(replyThreadMessage) = interfaceState.chatLocation, !replyThreadMessage.isForumPost, replyThreadMessage.peerId != self.context?.account.peerId {
if replyThreadMessage.isChannelPost { if replyThreadMessage.isChannelPost {
placeholder = interfaceState.strings.Conversation_InputTextPlaceholderComment if let sendPaidMessageStars = interfaceState.sendPaidMessageStars {
placeholder = interfaceState.strings.Chat_InputTextPaidCommentPlaceholder(" # \(presentationStringsFormattedNumber(Int32(sendPaidMessageStars.value), interfaceState.dateTimeFormat.groupingSeparator))").string
placeholderHasStar = true
} else {
placeholder = interfaceState.strings.Conversation_InputTextPlaceholderComment
}
} else { } else {
placeholder = interfaceState.strings.Conversation_InputTextPlaceholderReply placeholder = interfaceState.strings.Conversation_InputTextPlaceholderReply
} }