diff --git a/submodules/TelegramApi/Sources/Api20.swift b/submodules/TelegramApi/Sources/Api20.swift index e63a5026c2..533bd21f69 100644 --- a/submodules/TelegramApi/Sources/Api20.swift +++ b/submodules/TelegramApi/Sources/Api20.swift @@ -617,8 +617,32 @@ public extension Api { } public extension Api { enum PostInteractionCounters: TypeConstructorDescription { - case postInteractionCountersMessage(msgId: Int32, views: Int32, forwards: Int32, reactions: Int32) - case postInteractionCountersStory(storyId: Int32, views: Int32, forwards: Int32, reactions: Int32) + public class Cons_postInteractionCountersMessage { + public var msgId: Int32 + public var views: Int32 + public var forwards: Int32 + public var reactions: Int32 + public init(msgId: Int32, views: Int32, forwards: Int32, reactions: Int32) { + self.msgId = msgId + self.views = views + self.forwards = forwards + self.reactions = reactions + } + } + public class Cons_postInteractionCountersStory { + public var storyId: Int32 + public var views: Int32 + public var forwards: Int32 + public var reactions: Int32 + public init(storyId: Int32, views: Int32, forwards: Int32, reactions: Int32) { + self.storyId = storyId + self.views = views + self.forwards = forwards + self.reactions = reactions + } + } + case postInteractionCountersMessage(Cons_postInteractionCountersMessage) + case postInteractionCountersStory(Cons_postInteractionCountersStory) public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) { #if DEBUG @@ -654,7 +678,25 @@ public extension Api { } public extension Api { enum PremiumGiftCodeOption: TypeConstructorDescription { - case premiumGiftCodeOption(flags: Int32, users: Int32, months: Int32, storeProduct: String?, storeQuantity: Int32?, currency: String, amount: Int64) + public class Cons_premiumGiftCodeOption { + public var flags: Int32 + public var users: Int32 + public var months: Int32 + public var storeProduct: String? + public var storeQuantity: Int32? + public var currency: String + public var amount: Int64 + public init(flags: Int32, users: Int32, months: Int32, storeProduct: String?, storeQuantity: Int32?, currency: String, amount: Int64) { + self.flags = flags + self.users = users + self.months = months + self.storeProduct = storeProduct + self.storeQuantity = storeQuantity + self.currency = currency + self.amount = amount + } + } + case premiumGiftCodeOption(Cons_premiumGiftCodeOption) public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) { #if DEBUG @@ -683,7 +725,25 @@ public extension Api { } public extension Api { enum PremiumSubscriptionOption: TypeConstructorDescription { - case premiumSubscriptionOption(flags: Int32, transaction: String?, months: Int32, currency: String, amount: Int64, botUrl: String, storeProduct: String?) + public class Cons_premiumSubscriptionOption { + public var flags: Int32 + public var transaction: String? + public var months: Int32 + public var currency: String + public var amount: Int64 + public var botUrl: String + public var storeProduct: String? + public init(flags: Int32, transaction: String?, months: Int32, currency: String, amount: Int64, botUrl: String, storeProduct: String?) { + self.flags = flags + self.transaction = transaction + self.months = months + self.currency = currency + self.amount = amount + self.botUrl = botUrl + self.storeProduct = storeProduct + } + } + case premiumSubscriptionOption(Cons_premiumSubscriptionOption) public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) { #if DEBUG @@ -712,8 +772,34 @@ public extension Api { } public extension Api { enum PrepaidGiveaway: TypeConstructorDescription { - case prepaidGiveaway(id: Int64, months: Int32, quantity: Int32, date: Int32) - case prepaidStarsGiveaway(id: Int64, stars: Int64, quantity: Int32, boosts: Int32, date: Int32) + public class Cons_prepaidGiveaway { + public var id: Int64 + public var months: Int32 + public var quantity: Int32 + public var date: Int32 + public init(id: Int64, months: Int32, quantity: Int32, date: Int32) { + self.id = id + self.months = months + self.quantity = quantity + self.date = date + } + } + public class Cons_prepaidStarsGiveaway { + public var id: Int64 + public var stars: Int64 + public var quantity: Int32 + public var boosts: Int32 + public var date: Int32 + public init(id: Int64, stars: Int64, quantity: Int32, boosts: Int32, date: Int32) { + self.id = id + self.stars = stars + self.quantity = quantity + self.boosts = boosts + self.date = date + } + } + case prepaidGiveaway(Cons_prepaidGiveaway) + case prepaidStarsGiveaway(Cons_prepaidStarsGiveaway) public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) { #if DEBUG diff --git a/submodules/TelegramApi/Sources/Api21.swift b/submodules/TelegramApi/Sources/Api21.swift index 6c0097c2de..9c0f848891 100644 --- a/submodules/TelegramApi/Sources/Api21.swift +++ b/submodules/TelegramApi/Sources/Api21.swift @@ -1,17 +1,41 @@ public extension Api { enum PrivacyRule: TypeConstructorDescription { + public class Cons_privacyValueAllowChatParticipants { + public var chats: [Int64] + public init(chats: [Int64]) { + self.chats = chats + } + } + public class Cons_privacyValueAllowUsers { + public var users: [Int64] + public init(users: [Int64]) { + self.users = users + } + } + public class Cons_privacyValueDisallowChatParticipants { + public var chats: [Int64] + public init(chats: [Int64]) { + self.chats = chats + } + } + public class Cons_privacyValueDisallowUsers { + public var users: [Int64] + public init(users: [Int64]) { + self.users = users + } + } case privacyValueAllowAll case privacyValueAllowBots - case privacyValueAllowChatParticipants(chats: [Int64]) + case privacyValueAllowChatParticipants(Cons_privacyValueAllowChatParticipants) case privacyValueAllowCloseFriends case privacyValueAllowContacts case privacyValueAllowPremium - case privacyValueAllowUsers(users: [Int64]) + case privacyValueAllowUsers(Cons_privacyValueAllowUsers) case privacyValueDisallowAll case privacyValueDisallowBots - case privacyValueDisallowChatParticipants(chats: [Int64]) + case privacyValueDisallowChatParticipants(Cons_privacyValueDisallowChatParticipants) case privacyValueDisallowContacts - case privacyValueDisallowUsers(users: [Int64]) + case privacyValueDisallowUsers(Cons_privacyValueDisallowUsers) public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) { #if DEBUG @@ -202,8 +226,22 @@ public extension Api { } public extension Api { indirect enum PublicForward: TypeConstructorDescription { - case publicForwardMessage(message: Api.Message) - case publicForwardStory(peer: Api.Peer, story: Api.StoryItem) + public class Cons_publicForwardMessage { + public var message: Api.Message + public init(message: Api.Message) { + self.message = message + } + } + public class Cons_publicForwardStory { + public var peer: Api.Peer + public var story: Api.StoryItem + public init(peer: Api.Peer, story: Api.StoryItem) { + self.peer = peer + self.story = story + } + } + case publicForwardMessage(Cons_publicForwardMessage) + case publicForwardStory(Cons_publicForwardStory) public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) { #if DEBUG @@ -239,7 +277,19 @@ public extension Api { } public extension Api { enum QuickReply: TypeConstructorDescription { - case quickReply(shortcutId: Int32, shortcut: String, topMessage: Int32, count: Int32) + public class Cons_quickReply { + public var shortcutId: Int32 + public var shortcut: String + public var topMessage: Int32 + public var count: Int32 + public init(shortcutId: Int32, shortcut: String, topMessage: Int32, count: Int32) { + self.shortcutId = shortcutId + self.shortcut = shortcut + self.topMessage = topMessage + self.count = count + } + } + case quickReply(Cons_quickReply) public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) { #if DEBUG @@ -268,8 +318,20 @@ public extension Api { } public extension Api { enum Reaction: TypeConstructorDescription { - case reactionCustomEmoji(documentId: Int64) - case reactionEmoji(emoticon: String) + public class Cons_reactionCustomEmoji { + public var documentId: Int64 + public init(documentId: Int64) { + self.documentId = documentId + } + } + public class Cons_reactionEmoji { + public var emoticon: String + public init(emoticon: String) { + self.emoticon = emoticon + } + } + case reactionCustomEmoji(Cons_reactionCustomEmoji) + case reactionEmoji(Cons_reactionEmoji) case reactionEmpty case reactionPaid diff --git a/submodules/TelegramCore/Sources/Settings/PrivacySettings.swift b/submodules/TelegramCore/Sources/Settings/PrivacySettings.swift index 025d56f732..e8495e3b02 100644 --- a/submodules/TelegramCore/Sources/Settings/PrivacySettings.swift +++ b/submodules/TelegramCore/Sources/Settings/PrivacySettings.swift @@ -230,7 +230,8 @@ extension SelectivePrivacySettings { current = .enableEveryone(disableFor: [:]) case .privacyValueAllowContacts: current = .enableContacts(enableFor: [:], disableFor: [:], enableForPremium: false, enableForBots: false) - case let .privacyValueAllowUsers(users): + case let .privacyValueAllowUsers(privacyValueAllowUsersData): + let users = privacyValueAllowUsersData.users for id in users { if let peer = peers[PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt64Value(id))] { enableFor[peer.peer.id] = peer @@ -240,13 +241,15 @@ extension SelectivePrivacySettings { break case .privacyValueDisallowContacts: break - case let .privacyValueDisallowUsers(users): + case let .privacyValueDisallowUsers(privacyValueDisallowUsersData): + let users = privacyValueDisallowUsersData.users for id in users { if let peer = peers[PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt64Value(id))] { disableFor[peer.peer.id] = peer } } - case let .privacyValueAllowChatParticipants(chats): + case let .privacyValueAllowChatParticipants(privacyValueAllowChatParticipantsData): + let chats = privacyValueAllowChatParticipantsData.chats for id in chats { for possibleId in [PeerId(namespace: Namespaces.Peer.CloudGroup, id: PeerId.Id._internalFromInt64Value(id)), PeerId(namespace: Namespaces.Peer.CloudChannel, id: PeerId.Id._internalFromInt64Value(id))] { if let peer = peers[possibleId] { @@ -254,7 +257,8 @@ extension SelectivePrivacySettings { } } } - case let .privacyValueDisallowChatParticipants(chats): + case let .privacyValueDisallowChatParticipants(privacyValueDisallowChatParticipantsData): + let chats = privacyValueDisallowChatParticipantsData.chats for id in chats { for possibleId in [PeerId(namespace: Namespaces.Peer.CloudGroup, id: PeerId.Id._internalFromInt64Value(id)), PeerId(namespace: Namespaces.Peer.CloudChannel, id: PeerId.Id._internalFromInt64Value(id))] { if let peer = peers[possibleId] { diff --git a/submodules/TelegramCore/Sources/State/ManagedPremiumPromoConfigurationUpdates.swift b/submodules/TelegramCore/Sources/State/ManagedPremiumPromoConfigurationUpdates.swift index 9f1018bef7..f086200acd 100644 --- a/submodules/TelegramCore/Sources/State/ManagedPremiumPromoConfigurationUpdates.swift +++ b/submodules/TelegramCore/Sources/State/ManagedPremiumPromoConfigurationUpdates.swift @@ -73,7 +73,8 @@ private extension PremiumPromoConfiguration { var productOptions: [PremiumProductOption] = [] for option in options { - if case let .premiumSubscriptionOption(flags, transaction, months, currency, amount, botUrl, storeProduct) = option { + if case let .premiumSubscriptionOption(premiumSubscriptionOptionData) = option { + let (flags, transaction, months, currency, amount, botUrl, storeProduct) = (premiumSubscriptionOptionData.flags, premiumSubscriptionOptionData.transaction, premiumSubscriptionOptionData.months, premiumSubscriptionOptionData.currency, premiumSubscriptionOptionData.amount, premiumSubscriptionOptionData.botUrl, premiumSubscriptionOptionData.storeProduct) productOptions.append(PremiumProductOption(isCurrent: (flags & (1 << 1)) != 0, months: months, currency: currency, amount: amount, botUrl: botUrl, transactionId: transaction, availableForUpgrade: (flags & (1 << 2)) != 0, storeProductId: storeProduct)) } } diff --git a/submodules/TelegramCore/Sources/Statistics/PeerStatistics.swift b/submodules/TelegramCore/Sources/Statistics/PeerStatistics.swift index bfc3e21de9..eb10d8e74b 100644 --- a/submodules/TelegramCore/Sources/Statistics/PeerStatistics.swift +++ b/submodules/TelegramCore/Sources/Statistics/PeerStatistics.swift @@ -1184,9 +1184,11 @@ extension StatsPercentValue { extension ChannelStatsPostInteractions { init(apiPostInteractionCounters: Api.PostInteractionCounters, peerId: PeerId) { switch apiPostInteractionCounters { - case let .postInteractionCountersMessage(msgId, views, forwards, reactions): + case let .postInteractionCountersMessage(postInteractionCountersMessageData): + let (msgId, views, forwards, reactions) = (postInteractionCountersMessageData.msgId, postInteractionCountersMessageData.views, postInteractionCountersMessageData.forwards, postInteractionCountersMessageData.reactions) self = ChannelStatsPostInteractions(postId: .message(id: EngineMessage.Id(peerId: peerId, namespace: Namespaces.Message.Cloud, id: msgId)), views: views, forwards: forwards, reactions: reactions) - case let .postInteractionCountersStory(storyId, views, forwards, reactions): + case let .postInteractionCountersStory(postInteractionCountersStoryData): + let (storyId, views, forwards, reactions) = (postInteractionCountersStoryData.storyId, postInteractionCountersStoryData.views, postInteractionCountersStoryData.forwards, postInteractionCountersStoryData.reactions) self = ChannelStatsPostInteractions(postId: .story(peerId: peerId, id: storyId), views: views, forwards: forwards, reactions: reactions) } } diff --git a/submodules/TelegramCore/Sources/Statistics/StoryStatistics.swift b/submodules/TelegramCore/Sources/Statistics/StoryStatistics.swift index e7f3b86f94..591d1c9da2 100644 --- a/submodules/TelegramCore/Sources/Statistics/StoryStatistics.swift +++ b/submodules/TelegramCore/Sources/Statistics/StoryStatistics.swift @@ -310,11 +310,13 @@ private final class StoryStatsPublicForwardsContextImpl { var resultForwards: [StoryStatsPublicForwardsContext.State.Forward] = [] for forward in forwards { switch forward { - case let .publicForwardMessage(apiMessage): + case let .publicForwardMessage(publicForwardMessageData): + let apiMessage = publicForwardMessageData.message if let message = StoreMessage(apiMessage: apiMessage, accountPeerId: accountPeerId, peerIsForum: false), let renderedMessage = locallyRenderedMessage(message: message, peers: peers) { resultForwards.append(.message(EngineMessage(renderedMessage))) } - case let .publicForwardStory(apiPeer, apiStory): + case let .publicForwardStory(publicForwardStoryData): + let (apiPeer, apiStory) = (publicForwardStoryData.peer, publicForwardStoryData.story) if let storedItem = Stories.StoredItem(apiStoryItem: apiStory, peerId: apiPeer.peerId, transaction: transaction), case let .item(item) = storedItem, let media = item.media, let peer = peers[apiPeer.peerId] { let mappedItem = EngineStoryItem( id: item.id, diff --git a/submodules/TelegramCore/Sources/SyncCore/SyncCore_ReactionsMessageAttribute.swift b/submodules/TelegramCore/Sources/SyncCore/SyncCore_ReactionsMessageAttribute.swift index db40bcab2b..6b2c4b8519 100644 --- a/submodules/TelegramCore/Sources/SyncCore/SyncCore_ReactionsMessageAttribute.swift +++ b/submodules/TelegramCore/Sources/SyncCore/SyncCore_ReactionsMessageAttribute.swift @@ -183,9 +183,11 @@ extension MessageReaction.Reaction { switch apiReaction { case .reactionEmpty: return nil - case let .reactionEmoji(emoticon): + case let .reactionEmoji(reactionEmojiData): + let emoticon = reactionEmojiData.emoticon self = .builtin(emoticon) - case let .reactionCustomEmoji(documentId): + case let .reactionCustomEmoji(reactionCustomEmojiData): + let documentId = reactionCustomEmojiData.documentId self = .custom(documentId) case .reactionPaid: self = .stars @@ -195,9 +197,9 @@ extension MessageReaction.Reaction { var apiReaction: Api.Reaction { switch self { case let .builtin(value): - return .reactionEmoji(emoticon: value) + return .reactionEmoji(.init(emoticon: value)) case let .custom(fileId): - return .reactionCustomEmoji(documentId: fileId) + return .reactionCustomEmoji(.init(documentId: fileId)) case .stars: return .reactionPaid } diff --git a/submodules/TelegramCore/Sources/TelegramEngine/Messages/QuickReplyMessages.swift b/submodules/TelegramCore/Sources/TelegramEngine/Messages/QuickReplyMessages.swift index f660789097..ef4e13a0ee 100644 --- a/submodules/TelegramCore/Sources/TelegramEngine/Messages/QuickReplyMessages.swift +++ b/submodules/TelegramCore/Sources/TelegramEngine/Messages/QuickReplyMessages.swift @@ -171,7 +171,8 @@ func _internal_keepShortcutMessagesUpdated(account: Account) -> Signal