Skip to content

Commit 8ec6964

Browse files
committed
Update API [skip ci]
1 parent 9a46522 commit 8ec6964

File tree

9 files changed

+110
-26
lines changed

9 files changed

+110
-26
lines changed

submodules/TelegramApi/Sources/Api0.swift

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -487,7 +487,7 @@ fileprivate let parsers: [Int32 : (BufferReader) -> Any?] = {
487487
dict[-193992412] = { return Api.InputWebFileLocation.parse_inputWebFileAudioAlbumThumbLocation($0) }
488488
dict[-1625153079] = { return Api.InputWebFileLocation.parse_inputWebFileGeoPointLocation($0) }
489489
dict[-1036396922] = { return Api.InputWebFileLocation.parse_inputWebFileLocation($0) }
490-
dict[1572428309] = { return Api.Invoice.parse_invoice($0) }
490+
dict[77522308] = { return Api.Invoice.parse_invoice($0) }
491491
dict[-1059185703] = { return Api.JSONObjectValue.parse_jsonObjectValue($0) }
492492
dict[-146520221] = { return Api.JSONValue.parse_jsonArray($0) }
493493
dict[-952869270] = { return Api.JSONValue.parse_jsonBool($0) }
@@ -899,7 +899,7 @@ fileprivate let parsers: [Int32 : (BufferReader) -> Any?] = {
899899
dict[-1798404822] = { return Api.StarsGiveawayOption.parse_starsGiveawayOption($0) }
900900
dict[1411605001] = { return Api.StarsGiveawayWinnersOption.parse_starsGiveawayWinnersOption($0) }
901901
dict[2033461574] = { return Api.StarsRevenueStatus.parse_starsRevenueStatus($0) }
902-
dict[1401868056] = { return Api.StarsSubscription.parse_starsSubscription($0) }
902+
dict[779004698] = { return Api.StarsSubscription.parse_starsSubscription($0) }
903903
dict[88173912] = { return Api.StarsSubscriptionPricing.parse_starsSubscriptionPricing($0) }
904904
dict[198776256] = { return Api.StarsTopupOption.parse_starsTopupOption($0) }
905905
dict[903148150] = { return Api.StarsTransaction.parse_starsTransaction($0) }
@@ -974,6 +974,7 @@ fileprivate let parsers: [Int32 : (BufferReader) -> Any?] = {
974974
dict[675009298] = { return Api.Update.parse_updateBotPurchasedPaidMedia($0) }
975975
dict[-1246823043] = { return Api.Update.parse_updateBotShippingQuery($0) }
976976
dict[-997782967] = { return Api.Update.parse_updateBotStopped($0) }
977+
dict[-1464975695] = { return Api.Update.parse_updateBotSubscriptionExpire($0) }
977978
dict[-2095595325] = { return Api.Update.parse_updateBotWebhookJSON($0) }
978979
dict[-1684914010] = { return Api.Update.parse_updateBotWebhookJSONQuery($0) }
979980
dict[-539401739] = { return Api.Update.parse_updateBroadcastRevenueTransactions($0) }

submodules/TelegramApi/Sources/Api13.swift

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -416,13 +416,13 @@ public extension Api {
416416
}
417417
public extension Api {
418418
enum Invoice: TypeConstructorDescription {
419-
case invoice(flags: Int32, currency: String, prices: [Api.LabeledPrice], maxTipAmount: Int64?, suggestedTipAmounts: [Int64]?, termsUrl: String?)
419+
case invoice(flags: Int32, currency: String, prices: [Api.LabeledPrice], maxTipAmount: Int64?, suggestedTipAmounts: [Int64]?, termsUrl: String?, subscriptionPeriod: Int32?)
420420

421421
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
422422
switch self {
423-
case .invoice(let flags, let currency, let prices, let maxTipAmount, let suggestedTipAmounts, let termsUrl):
423+
case .invoice(let flags, let currency, let prices, let maxTipAmount, let suggestedTipAmounts, let termsUrl, let subscriptionPeriod):
424424
if boxed {
425-
buffer.appendInt32(1572428309)
425+
buffer.appendInt32(77522308)
426426
}
427427
serializeInt32(flags, buffer: buffer, boxed: false)
428428
serializeString(currency, buffer: buffer, boxed: false)
@@ -438,14 +438,15 @@ public extension Api {
438438
serializeInt64(item, buffer: buffer, boxed: false)
439439
}}
440440
if Int(flags) & Int(1 << 10) != 0 {serializeString(termsUrl!, buffer: buffer, boxed: false)}
441+
if Int(flags) & Int(1 << 11) != 0 {serializeInt32(subscriptionPeriod!, buffer: buffer, boxed: false)}
441442
break
442443
}
443444
}
444445

445446
public func descriptionFields() -> (String, [(String, Any)]) {
446447
switch self {
447-
case .invoice(let flags, let currency, let prices, let maxTipAmount, let suggestedTipAmounts, let termsUrl):
448-
return ("invoice", [("flags", flags as Any), ("currency", currency as Any), ("prices", prices as Any), ("maxTipAmount", maxTipAmount as Any), ("suggestedTipAmounts", suggestedTipAmounts as Any), ("termsUrl", termsUrl as Any)])
448+
case .invoice(let flags, let currency, let prices, let maxTipAmount, let suggestedTipAmounts, let termsUrl, let subscriptionPeriod):
449+
return ("invoice", [("flags", flags as Any), ("currency", currency as Any), ("prices", prices as Any), ("maxTipAmount", maxTipAmount as Any), ("suggestedTipAmounts", suggestedTipAmounts as Any), ("termsUrl", termsUrl as Any), ("subscriptionPeriod", subscriptionPeriod as Any)])
449450
}
450451
}
451452

@@ -466,14 +467,17 @@ public extension Api {
466467
} }
467468
var _6: String?
468469
if Int(_1!) & Int(1 << 10) != 0 {_6 = parseString(reader) }
470+
var _7: Int32?
471+
if Int(_1!) & Int(1 << 11) != 0 {_7 = reader.readInt32() }
469472
let _c1 = _1 != nil
470473
let _c2 = _2 != nil
471474
let _c3 = _3 != nil
472475
let _c4 = (Int(_1!) & Int(1 << 8) == 0) || _4 != nil
473476
let _c5 = (Int(_1!) & Int(1 << 8) == 0) || _5 != nil
474477
let _c6 = (Int(_1!) & Int(1 << 10) == 0) || _6 != nil
475-
if _c1 && _c2 && _c3 && _c4 && _c5 && _c6 {
476-
return Api.Invoice.invoice(flags: _1!, currency: _2!, prices: _3!, maxTipAmount: _4, suggestedTipAmounts: _5, termsUrl: _6)
478+
let _c7 = (Int(_1!) & Int(1 << 11) == 0) || _7 != nil
479+
if _c1 && _c2 && _c3 && _c4 && _c5 && _c6 && _c7 {
480+
return Api.Invoice.invoice(flags: _1!, currency: _2!, prices: _3!, maxTipAmount: _4, suggestedTipAmounts: _5, termsUrl: _6, subscriptionPeriod: _7)
477481
}
478482
else {
479483
return nil

submodules/TelegramApi/Sources/Api23.swift

Lines changed: 21 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -858,28 +858,31 @@ public extension Api {
858858
}
859859
public extension Api {
860860
enum StarsSubscription: TypeConstructorDescription {
861-
case starsSubscription(flags: Int32, id: String, peer: Api.Peer, untilDate: Int32, pricing: Api.StarsSubscriptionPricing, chatInviteHash: String?)
861+
case starsSubscription(flags: Int32, id: String, peer: Api.Peer, untilDate: Int32, pricing: Api.StarsSubscriptionPricing, chatInviteHash: String?, title: String?, photo: Api.WebDocument?, invoiceSlug: String?)
862862

863863
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
864864
switch self {
865-
case .starsSubscription(let flags, let id, let peer, let untilDate, let pricing, let chatInviteHash):
865+
case .starsSubscription(let flags, let id, let peer, let untilDate, let pricing, let chatInviteHash, let title, let photo, let invoiceSlug):
866866
if boxed {
867-
buffer.appendInt32(1401868056)
867+
buffer.appendInt32(779004698)
868868
}
869869
serializeInt32(flags, buffer: buffer, boxed: false)
870870
serializeString(id, buffer: buffer, boxed: false)
871871
peer.serialize(buffer, true)
872872
serializeInt32(untilDate, buffer: buffer, boxed: false)
873873
pricing.serialize(buffer, true)
874874
if Int(flags) & Int(1 << 3) != 0 {serializeString(chatInviteHash!, buffer: buffer, boxed: false)}
875+
if Int(flags) & Int(1 << 4) != 0 {serializeString(title!, buffer: buffer, boxed: false)}
876+
if Int(flags) & Int(1 << 5) != 0 {photo!.serialize(buffer, true)}
877+
if Int(flags) & Int(1 << 6) != 0 {serializeString(invoiceSlug!, buffer: buffer, boxed: false)}
875878
break
876879
}
877880
}
878881

879882
public func descriptionFields() -> (String, [(String, Any)]) {
880883
switch self {
881-
case .starsSubscription(let flags, let id, let peer, let untilDate, let pricing, let chatInviteHash):
882-
return ("starsSubscription", [("flags", flags as Any), ("id", id as Any), ("peer", peer as Any), ("untilDate", untilDate as Any), ("pricing", pricing as Any), ("chatInviteHash", chatInviteHash as Any)])
884+
case .starsSubscription(let flags, let id, let peer, let untilDate, let pricing, let chatInviteHash, let title, let photo, let invoiceSlug):
885+
return ("starsSubscription", [("flags", flags as Any), ("id", id as Any), ("peer", peer as Any), ("untilDate", untilDate as Any), ("pricing", pricing as Any), ("chatInviteHash", chatInviteHash as Any), ("title", title as Any), ("photo", photo as Any), ("invoiceSlug", invoiceSlug as Any)])
883886
}
884887
}
885888

@@ -900,14 +903,25 @@ public extension Api {
900903
}
901904
var _6: String?
902905
if Int(_1!) & Int(1 << 3) != 0 {_6 = parseString(reader) }
906+
var _7: String?
907+
if Int(_1!) & Int(1 << 4) != 0 {_7 = parseString(reader) }
908+
var _8: Api.WebDocument?
909+
if Int(_1!) & Int(1 << 5) != 0 {if let signature = reader.readInt32() {
910+
_8 = Api.parse(reader, signature: signature) as? Api.WebDocument
911+
} }
912+
var _9: String?
913+
if Int(_1!) & Int(1 << 6) != 0 {_9 = parseString(reader) }
903914
let _c1 = _1 != nil
904915
let _c2 = _2 != nil
905916
let _c3 = _3 != nil
906917
let _c4 = _4 != nil
907918
let _c5 = _5 != nil
908919
let _c6 = (Int(_1!) & Int(1 << 3) == 0) || _6 != nil
909-
if _c1 && _c2 && _c3 && _c4 && _c5 && _c6 {
910-
return Api.StarsSubscription.starsSubscription(flags: _1!, id: _2!, peer: _3!, untilDate: _4!, pricing: _5!, chatInviteHash: _6)
920+
let _c7 = (Int(_1!) & Int(1 << 4) == 0) || _7 != nil
921+
let _c8 = (Int(_1!) & Int(1 << 5) == 0) || _8 != nil
922+
let _c9 = (Int(_1!) & Int(1 << 6) == 0) || _9 != nil
923+
if _c1 && _c2 && _c3 && _c4 && _c5 && _c6 && _c7 && _c8 && _c9 {
924+
return Api.StarsSubscription.starsSubscription(flags: _1!, id: _2!, peer: _3!, untilDate: _4!, pricing: _5!, chatInviteHash: _6, title: _7, photo: _8, invoiceSlug: _9)
911925
}
912926
else {
913927
return nil

submodules/TelegramApi/Sources/Api25.swift

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -645,6 +645,7 @@ public extension Api {
645645
case updateBotPurchasedPaidMedia(userId: Int64, payload: String, qts: Int32)
646646
case updateBotShippingQuery(queryId: Int64, userId: Int64, payload: Buffer, shippingAddress: Api.PostAddress)
647647
case updateBotStopped(userId: Int64, date: Int32, stopped: Api.Bool, qts: Int32)
648+
case updateBotSubscriptionExpire(userId: Int64, payload: String, untilDate: Int32, qts: Int32)
648649
case updateBotWebhookJSON(data: Api.DataJSON)
649650
case updateBotWebhookJSONQuery(queryId: Int64, data: Api.DataJSON, timeout: Int32)
650651
case updateBroadcastRevenueTransactions(peer: Api.Peer, balances: Api.BroadcastRevenueBalances)
@@ -969,6 +970,15 @@ public extension Api {
969970
stopped.serialize(buffer, true)
970971
serializeInt32(qts, buffer: buffer, boxed: false)
971972
break
973+
case .updateBotSubscriptionExpire(let userId, let payload, let untilDate, let qts):
974+
if boxed {
975+
buffer.appendInt32(-1464975695)
976+
}
977+
serializeInt64(userId, buffer: buffer, boxed: false)
978+
serializeString(payload, buffer: buffer, boxed: false)
979+
serializeInt32(untilDate, buffer: buffer, boxed: false)
980+
serializeInt32(qts, buffer: buffer, boxed: false)
981+
break
972982
case .updateBotWebhookJSON(let data):
973983
if boxed {
974984
buffer.appendInt32(-2095595325)
@@ -2041,6 +2051,8 @@ public extension Api {
20412051
return ("updateBotShippingQuery", [("queryId", queryId as Any), ("userId", userId as Any), ("payload", payload as Any), ("shippingAddress", shippingAddress as Any)])
20422052
case .updateBotStopped(let userId, let date, let stopped, let qts):
20432053
return ("updateBotStopped", [("userId", userId as Any), ("date", date as Any), ("stopped", stopped as Any), ("qts", qts as Any)])
2054+
case .updateBotSubscriptionExpire(let userId, let payload, let untilDate, let qts):
2055+
return ("updateBotSubscriptionExpire", [("userId", userId as Any), ("payload", payload as Any), ("untilDate", untilDate as Any), ("qts", qts as Any)])
20442056
case .updateBotWebhookJSON(let data):
20452057
return ("updateBotWebhookJSON", [("data", data as Any)])
20462058
case .updateBotWebhookJSONQuery(let queryId, let data, let timeout):
@@ -2732,6 +2744,26 @@ public extension Api {
27322744
return nil
27332745
}
27342746
}
2747+
public static func parse_updateBotSubscriptionExpire(_ reader: BufferReader) -> Update? {
2748+
var _1: Int64?
2749+
_1 = reader.readInt64()
2750+
var _2: String?
2751+
_2 = parseString(reader)
2752+
var _3: Int32?
2753+
_3 = reader.readInt32()
2754+
var _4: Int32?
2755+
_4 = reader.readInt32()
2756+
let _c1 = _1 != nil
2757+
let _c2 = _2 != nil
2758+
let _c3 = _3 != nil
2759+
let _c4 = _4 != nil
2760+
if _c1 && _c2 && _c3 && _c4 {
2761+
return Api.Update.updateBotSubscriptionExpire(userId: _1!, payload: _2!, untilDate: _3!, qts: _4!)
2762+
}
2763+
else {
2764+
return nil
2765+
}
2766+
}
27352767
public static func parse_updateBotWebhookJSON(_ reader: BufferReader) -> Update? {
27362768
var _1: Api.DataJSON?
27372769
if let signature = reader.readInt32() {

submodules/TelegramCore/Sources/State/Serialization.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,7 @@ public class BoxedMessage: NSObject {
210210

211211
public class Serialization: NSObject, MTSerialization {
212212
public func currentLayer() -> UInt {
213-
return 192
213+
return 194
214214
}
215215

216216
public func parseMessage(_ data: Data!) -> Any! {

submodules/TelegramCore/Sources/SyncCore/SyncCore_TelegramMediaInvoice.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -114,8 +114,8 @@ public final class TelegramMediaInvoice: Media, Equatable {
114114
self.currency = currency
115115
self.totalAmount = totalAmount
116116
self.startParam = startParam
117-
self.flags = flags
118117
self.extendedMedia = extendedMedia
118+
self.flags = flags
119119
self.version = version
120120
}
121121

@@ -126,8 +126,8 @@ public final class TelegramMediaInvoice: Media, Equatable {
126126
self.totalAmount = decoder.decodeInt64ForKey("ta", orElse: 0)
127127
self.startParam = decoder.decodeStringForKey("sp", orElse: "")
128128
self.photo = decoder.decodeObjectForKey("p") as? TelegramMediaWebFile
129-
self.flags = TelegramMediaInvoiceFlags(rawValue: decoder.decodeInt32ForKey("f", orElse: 0))
130129
self.extendedMedia = decoder.decodeObjectForKey("m", decoder: { TelegramExtendedMedia(decoder: $0) }) as? TelegramExtendedMedia
130+
self.flags = TelegramMediaInvoiceFlags(rawValue: decoder.decodeInt32ForKey("f", orElse: 0))
131131

132132
if let receiptMessageIdPeerId = decoder.decodeOptionalInt64ForKey("r.p") as Int64?, let receiptMessageIdNamespace = decoder.decodeOptionalInt32ForKey("r.n") as Int32?, let receiptMessageIdId = decoder.decodeOptionalInt32ForKey("r.i") as Int32? {
133133
self.receiptMessageId = MessageId(peerId: PeerId(receiptMessageIdPeerId), namespace: receiptMessageIdNamespace, id: receiptMessageIdId)

submodules/TelegramCore/Sources/TelegramEngine/Messages/BotWebView.swift

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,9 @@ func _internal_requestSimpleWebView(postbox: Postbox, network: Network, botId: P
5656
if (flags & (1 << 1)) != 0 {
5757
resultFlags.insert(.fullSize)
5858
}
59+
if (flags & (1 << 2)) != 0 {
60+
resultFlags.insert(.fullScreen)
61+
}
5962
return .single(RequestWebViewResult(flags: resultFlags, queryId: queryId, url: url, keepAliveSignal: nil))
6063
}
6164
}
@@ -103,6 +106,9 @@ func _internal_requestMainWebView(postbox: Postbox, network: Network, botId: Pee
103106
if (flags & (1 << 1)) != 0 {
104107
resultFlags.insert(.fullSize)
105108
}
109+
if (flags & (1 << 2)) != 0 {
110+
resultFlags.insert(.fullScreen)
111+
}
106112
return .single(RequestWebViewResult(flags: resultFlags, queryId: queryId, url: url, keepAliveSignal: nil))
107113
}
108114
}
@@ -128,6 +134,7 @@ public struct RequestWebViewResult {
128134
}
129135

130136
public static let fullSize = Flags(rawValue: 1 << 0)
137+
public static let fullScreen = Flags(rawValue: 1 << 1)
131138
}
132139

133140
public let flags: Flags
@@ -237,6 +244,9 @@ func _internal_requestWebView(postbox: Postbox, network: Network, stateManager:
237244
if (webViewFlags & (1 << 1)) != 0 {
238245
resultFlags.insert(.fullSize)
239246
}
247+
if (flags & (1 << 2)) != 0 {
248+
resultFlags.insert(.fullScreen)
249+
}
240250
let keepAlive: Signal<Never, KeepWebViewError>?
241251
if let queryId {
242252
keepAlive = keepWebViewSignal(network: network, stateManager: stateManager, flags: flags, peer: inputPeer, bot: inputBot, queryId: queryId, replyToMessageId: replyToMessageId, threadId: threadId, sendAs: nil)
@@ -323,6 +333,9 @@ func _internal_requestAppWebView(postbox: Postbox, network: Network, stateManage
323333
if (flags & (1 << 1)) != 0 {
324334
resultFlags.insert(.fullSize)
325335
}
336+
if (flags & (1 << 2)) != 0 {
337+
resultFlags.insert(.fullScreen)
338+
}
326339
return .single(RequestWebViewResult(flags: resultFlags, queryId: queryId, url: url, keepAliveSignal: nil))
327340
}
328341
}

submodules/TelegramCore/Sources/TelegramEngine/Payments/BotPaymentForm.swift

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -63,14 +63,16 @@ public struct BotPaymentInvoice : Equatable {
6363
public let prices: [BotPaymentPrice]
6464
public let tip: Tip?
6565
public let termsInfo: RecurrentInfo?
66+
public let subscriptionPeriod: Int32?
6667

67-
public init(isTest: Bool, requestedFields: BotPaymentInvoiceFields, currency: String, prices: [BotPaymentPrice], tip: Tip?, termsInfo: RecurrentInfo?) {
68+
public init(isTest: Bool, requestedFields: BotPaymentInvoiceFields, currency: String, prices: [BotPaymentPrice], tip: Tip?, termsInfo: RecurrentInfo?, subscriptionPeriod: Int32?) {
6869
self.isTest = isTest
6970
self.requestedFields = requestedFields
7071
self.currency = currency
7172
self.prices = prices
7273
self.tip = tip
7374
self.termsInfo = termsInfo
75+
self.subscriptionPeriod = subscriptionPeriod
7476
}
7577
}
7678

@@ -175,7 +177,7 @@ public enum BotPaymentFormRequestError {
175177
extension BotPaymentInvoice {
176178
init(apiInvoice: Api.Invoice) {
177179
switch apiInvoice {
178-
case let .invoice(flags, currency, prices, maxTipAmount, suggestedTipAmounts, termsUrl):
180+
case let .invoice(flags, currency, prices, maxTipAmount, suggestedTipAmounts, termsUrl, subscriptionPeriod):
179181
var fields = BotPaymentInvoiceFields()
180182
if (flags & (1 << 1)) != 0 {
181183
fields.insert(.name)
@@ -212,7 +214,7 @@ extension BotPaymentInvoice {
212214
case let .labeledPrice(label, amount):
213215
return BotPaymentPrice(label: label, amount: amount)
214216
}
215-
}, tip: parsedTip, termsInfo: termsInfo)
217+
}, tip: parsedTip, termsInfo: termsInfo, subscriptionPeriod: subscriptionPeriod)
216218
}
217219
}
218220
}

0 commit comments

Comments
 (0)