mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-12-22 22:25:57 +00:00
Update API
This commit is contained in:
@@ -103,10 +103,11 @@ public final class TelegramMediaInvoice: Media, Equatable {
|
||||
public let photo: TelegramMediaWebFile?
|
||||
public let flags: TelegramMediaInvoiceFlags
|
||||
public let extendedMedia: TelegramExtendedMedia?
|
||||
public let subscriptionPeriod: Int32?
|
||||
|
||||
public let version: Int32
|
||||
|
||||
public init(title: String, description: String, photo: TelegramMediaWebFile?, receiptMessageId: MessageId?, currency: String, totalAmount: Int64, startParam: String, extendedMedia: TelegramExtendedMedia?, flags: TelegramMediaInvoiceFlags, version: Int32) {
|
||||
public init(title: String, description: String, photo: TelegramMediaWebFile?, receiptMessageId: MessageId?, currency: String, totalAmount: Int64, startParam: String, extendedMedia: TelegramExtendedMedia?, subscriptionPeriod: Int32?, flags: TelegramMediaInvoiceFlags, version: Int32) {
|
||||
self.title = title
|
||||
self.description = description
|
||||
self.photo = photo
|
||||
@@ -115,6 +116,7 @@ public final class TelegramMediaInvoice: Media, Equatable {
|
||||
self.totalAmount = totalAmount
|
||||
self.startParam = startParam
|
||||
self.extendedMedia = extendedMedia
|
||||
self.subscriptionPeriod = subscriptionPeriod
|
||||
self.flags = flags
|
||||
self.version = version
|
||||
}
|
||||
@@ -127,6 +129,7 @@ public final class TelegramMediaInvoice: Media, Equatable {
|
||||
self.startParam = decoder.decodeStringForKey("sp", orElse: "")
|
||||
self.photo = decoder.decodeObjectForKey("p") as? TelegramMediaWebFile
|
||||
self.extendedMedia = decoder.decodeObjectForKey("m", decoder: { TelegramExtendedMedia(decoder: $0) }) as? TelegramExtendedMedia
|
||||
self.subscriptionPeriod = decoder.decodeOptionalInt32ForKey("sp")
|
||||
self.flags = TelegramMediaInvoiceFlags(rawValue: decoder.decodeInt32ForKey("f", orElse: 0))
|
||||
|
||||
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? {
|
||||
@@ -158,6 +161,12 @@ public final class TelegramMediaInvoice: Media, Equatable {
|
||||
encoder.encodeNil(forKey: "m")
|
||||
}
|
||||
|
||||
if let subscriptionPeriod = self.subscriptionPeriod {
|
||||
encoder.encodeInt32(subscriptionPeriod, forKey: "sp")
|
||||
} else {
|
||||
encoder.encodeNil(forKey: "sp")
|
||||
}
|
||||
|
||||
if let receiptMessageId = self.receiptMessageId {
|
||||
encoder.encodeInt64(receiptMessageId.peerId.toInt64(), forKey: "r.p")
|
||||
encoder.encodeInt32(receiptMessageId.namespace, forKey: "r.n")
|
||||
@@ -212,6 +221,10 @@ public final class TelegramMediaInvoice: Media, Equatable {
|
||||
return false
|
||||
}
|
||||
|
||||
if self.subscriptionPeriod != other.subscriptionPeriod {
|
||||
return false
|
||||
}
|
||||
|
||||
if self.version != other.version {
|
||||
return false
|
||||
}
|
||||
@@ -233,6 +246,7 @@ public final class TelegramMediaInvoice: Media, Equatable {
|
||||
totalAmount: self.totalAmount,
|
||||
startParam: self.startParam,
|
||||
extendedMedia: extendedMedia,
|
||||
subscriptionPeriod: self.subscriptionPeriod,
|
||||
flags: self.flags,
|
||||
version: self.version
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user