mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-08-08 08:31:13 +00:00
Update API [skip ci]
This commit is contained in:
parent
32165652c8
commit
f56903608c
@ -885,7 +885,7 @@ fileprivate let parsers: [Int32 : (BufferReader) -> Any?] = {
|
||||
dict[1124938064] = { return Api.SponsoredMessageReportOption.parse_sponsoredMessageReportOption($0) }
|
||||
dict[1577421297] = { return Api.StarsGiftOption.parse_starsGiftOption($0) }
|
||||
dict[2033461574] = { return Api.StarsRevenueStatus.parse_starsRevenueStatus($0) }
|
||||
dict[-797707802] = { return Api.StarsSubscription.parse_starsSubscription($0) }
|
||||
dict[1401868056] = { return Api.StarsSubscription.parse_starsSubscription($0) }
|
||||
dict[88173912] = { return Api.StarsSubscriptionPricing.parse_starsSubscriptionPricing($0) }
|
||||
dict[198776256] = { return Api.StarsTopupOption.parse_starsTopupOption($0) }
|
||||
dict[1127934763] = { return Api.StarsTransaction.parse_starsTransaction($0) }
|
||||
@ -1408,7 +1408,7 @@ public extension Api {
|
||||
return parser(reader)
|
||||
}
|
||||
else {
|
||||
telegramApiLog("Type constructor \(String(UInt32(bitPattern: signature), radix: 16, uppercase: false)) not found")
|
||||
telegramApiLog("Type constructor \(String(signature, radix: 16, uppercase: false)) not found")
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
@ -672,27 +672,28 @@ public extension Api {
|
||||
}
|
||||
public extension Api {
|
||||
enum StarsSubscription: TypeConstructorDescription {
|
||||
case starsSubscription(flags: Int32, id: String, peer: Api.Peer, untilDate: Int32, pricing: Api.StarsSubscriptionPricing)
|
||||
case starsSubscription(flags: Int32, id: String, peer: Api.Peer, untilDate: Int32, pricing: Api.StarsSubscriptionPricing, chatInviteHash: String?)
|
||||
|
||||
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
||||
switch self {
|
||||
case .starsSubscription(let flags, let id, let peer, let untilDate, let pricing):
|
||||
case .starsSubscription(let flags, let id, let peer, let untilDate, let pricing, let chatInviteHash):
|
||||
if boxed {
|
||||
buffer.appendInt32(-797707802)
|
||||
buffer.appendInt32(1401868056)
|
||||
}
|
||||
serializeInt32(flags, buffer: buffer, boxed: false)
|
||||
serializeString(id, buffer: buffer, boxed: false)
|
||||
peer.serialize(buffer, true)
|
||||
serializeInt32(untilDate, buffer: buffer, boxed: false)
|
||||
pricing.serialize(buffer, true)
|
||||
if Int(flags) & Int(1 << 3) != 0 {serializeString(chatInviteHash!, buffer: buffer, boxed: false)}
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
public func descriptionFields() -> (String, [(String, Any)]) {
|
||||
switch self {
|
||||
case .starsSubscription(let flags, let id, let peer, let untilDate, let pricing):
|
||||
return ("starsSubscription", [("flags", flags as Any), ("id", id as Any), ("peer", peer as Any), ("untilDate", untilDate as Any), ("pricing", pricing as Any)])
|
||||
case .starsSubscription(let flags, let id, let peer, let untilDate, let pricing, let chatInviteHash):
|
||||
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)])
|
||||
}
|
||||
}
|
||||
|
||||
@ -711,13 +712,16 @@ public extension Api {
|
||||
if let signature = reader.readInt32() {
|
||||
_5 = Api.parse(reader, signature: signature) as? Api.StarsSubscriptionPricing
|
||||
}
|
||||
var _6: String?
|
||||
if Int(_1!) & Int(1 << 3) != 0 {_6 = parseString(reader) }
|
||||
let _c1 = _1 != nil
|
||||
let _c2 = _2 != nil
|
||||
let _c3 = _3 != nil
|
||||
let _c4 = _4 != nil
|
||||
let _c5 = _5 != nil
|
||||
if _c1 && _c2 && _c3 && _c4 && _c5 {
|
||||
return Api.StarsSubscription.starsSubscription(flags: _1!, id: _2!, peer: _3!, untilDate: _4!, pricing: _5!)
|
||||
let _c6 = (Int(_1!) & Int(1 << 3) == 0) || _6 != nil
|
||||
if _c1 && _c2 && _c3 && _c4 && _c5 && _c6 {
|
||||
return Api.StarsSubscription.starsSubscription(flags: _1!, id: _2!, peer: _3!, untilDate: _4!, pricing: _5!, chatInviteHash: _6)
|
||||
}
|
||||
else {
|
||||
return nil
|
||||
|
@ -419,7 +419,7 @@ private extension StarsContext.State.Transaction {
|
||||
private extension StarsContext.State.Subscription {
|
||||
init?(apiSubscription: Api.StarsSubscription, transaction: Transaction) {
|
||||
switch apiSubscription {
|
||||
case let .starsSubscription(apiFlags, id, apiPeer, untilDate, pricing):
|
||||
case let .starsSubscription(apiFlags, id, apiPeer, untilDate, pricing, inviteHash):
|
||||
guard let peer = transaction.getPeer(apiPeer.peerId) else {
|
||||
return nil
|
||||
}
|
||||
@ -433,7 +433,7 @@ private extension StarsContext.State.Subscription {
|
||||
if (apiFlags & (1 << 2)) != 0 {
|
||||
flags.insert(.missingBalance)
|
||||
}
|
||||
self.init(flags: flags, id: id, peer: EnginePeer(peer), untilDate: untilDate, pricing: StarsSubscriptionPricing(apiStarsSubscriptionPricing: pricing))
|
||||
self.init(flags: flags, id: id, peer: EnginePeer(peer), untilDate: untilDate, pricing: StarsSubscriptionPricing(apiStarsSubscriptionPricing: pricing), inviteHash: inviteHash)
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -572,19 +572,22 @@ public final class StarsContext {
|
||||
public let peer: EnginePeer
|
||||
public let untilDate: Int32
|
||||
public let pricing: StarsSubscriptionPricing
|
||||
public let inviteHash: String?
|
||||
|
||||
public init(
|
||||
flags: Flags,
|
||||
id: String,
|
||||
peer: EnginePeer,
|
||||
untilDate: Int32,
|
||||
pricing: StarsSubscriptionPricing
|
||||
pricing: StarsSubscriptionPricing,
|
||||
inviteHash: String?
|
||||
) {
|
||||
self.flags = flags
|
||||
self.id = id
|
||||
self.peer = peer
|
||||
self.untilDate = untilDate
|
||||
self.pricing = pricing
|
||||
self.inviteHash = inviteHash
|
||||
}
|
||||
|
||||
public static func == (lhs: Subscription, rhs: Subscription) -> Bool {
|
||||
@ -603,6 +606,9 @@ public final class StarsContext {
|
||||
if lhs.pricing != rhs.pricing {
|
||||
return false
|
||||
}
|
||||
if lhs.inviteHash != rhs.inviteHash {
|
||||
return false
|
||||
}
|
||||
return true
|
||||
}
|
||||
}
|
||||
@ -980,7 +986,7 @@ private final class StarsSubscriptionsContextImpl {
|
||||
} else {
|
||||
updatedFlags.remove(.isCancelled)
|
||||
}
|
||||
let updatedSubscription = StarsContext.State.Subscription(flags: updatedFlags, id: subscription.id, peer: subscription.peer, untilDate: subscription.untilDate, pricing: subscription.pricing)
|
||||
let updatedSubscription = StarsContext.State.Subscription(flags: updatedFlags, id: subscription.id, peer: subscription.peer, untilDate: subscription.untilDate, pricing: subscription.pricing, inviteHash: subscription.inviteHash)
|
||||
updatedState.subscriptions[index] = updatedSubscription
|
||||
}
|
||||
self.updateState(updatedState)
|
||||
|
Loading…
x
Reference in New Issue
Block a user