mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-10-09 03:20:48 +00:00
Merge branch 'master' into webrtc-compatibility
This commit is contained in:
commit
475e54fbfe
@ -302,11 +302,7 @@ private func botCheckoutControllerEntries(presentationData: PresentationData, st
|
||||
if let tip = paymentForm.invoice.tip {
|
||||
let tipTitle: String
|
||||
//TODO:localize
|
||||
if tip.min == 0 {
|
||||
tipTitle = "Tip (Optional)"
|
||||
} else {
|
||||
tipTitle = "Tip"
|
||||
}
|
||||
tipTitle = "Tip"
|
||||
entries.append(.tip(presentationData.theme, tipTitle, "\(formatCurrencyAmount(currentTip ?? 0, currency: paymentForm.invoice.currency))"))
|
||||
}
|
||||
|
||||
|
@ -104,9 +104,10 @@ private struct CachedMediaResourceRepresentationKey: Hashable {
|
||||
static func ==(lhs: CachedMediaResourceRepresentationKey, rhs: CachedMediaResourceRepresentationKey) -> Bool {
|
||||
return lhs.resourceId.isEqual(to: rhs.resourceId) && lhs.representation.isEqual(to: rhs.representation)
|
||||
}
|
||||
|
||||
var hashValue: Int {
|
||||
return self.resourceId.hashValue
|
||||
|
||||
func hash(into hasher: inout Hasher) {
|
||||
hasher.combine(self.resourceId.hashValue)
|
||||
hasher.combine(self.representation.uniqueId)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
import Foundation
|
||||
import Postbox
|
||||
|
||||
public struct CloudFileMediaResourceId: MediaResourceId {
|
||||
public struct CloudFileMediaResourceId: MediaResourceId, Hashable, Equatable {
|
||||
let datacenterId: Int
|
||||
let volumeId: Int64
|
||||
let localId: Int32
|
||||
@ -18,13 +18,9 @@ public struct CloudFileMediaResourceId: MediaResourceId {
|
||||
return "telegram-cloud-file-\(self.datacenterId)-\(self.volumeId)-\(self.localId)-\(self.secret)"
|
||||
}
|
||||
|
||||
public var hashValue: Int {
|
||||
return self.secret.hashValue
|
||||
}
|
||||
|
||||
public func isEqual(to: MediaResourceId) -> Bool {
|
||||
if let to = to as? CloudFileMediaResourceId {
|
||||
return self.datacenterId == to.datacenterId && self.volumeId == to.volumeId && self.localId == to.localId && self.secret == to.secret
|
||||
return self == to
|
||||
} else {
|
||||
return false
|
||||
}
|
||||
@ -91,7 +87,7 @@ public final class CloudFileMediaResource: TelegramMediaResource {
|
||||
}
|
||||
}
|
||||
|
||||
public struct CloudPhotoSizeMediaResourceId: MediaResourceId, Hashable {
|
||||
public struct CloudPhotoSizeMediaResourceId: MediaResourceId, Hashable, Equatable {
|
||||
let datacenterId: Int32
|
||||
let photoId: Int64
|
||||
let sizeSpec: String
|
||||
@ -108,7 +104,7 @@ public struct CloudPhotoSizeMediaResourceId: MediaResourceId, Hashable {
|
||||
|
||||
public func isEqual(to: MediaResourceId) -> Bool {
|
||||
if let to = to as? CloudPhotoSizeMediaResourceId {
|
||||
return self.datacenterId == to.datacenterId && self.photoId == to.photoId && self.sizeSpec == to.sizeSpec
|
||||
return self == to
|
||||
} else {
|
||||
return false
|
||||
}
|
||||
@ -175,7 +171,7 @@ public final class CloudPhotoSizeMediaResource: TelegramMediaResource {
|
||||
}
|
||||
}
|
||||
|
||||
public struct CloudDocumentSizeMediaResourceId: MediaResourceId, Hashable {
|
||||
public struct CloudDocumentSizeMediaResourceId: MediaResourceId, Hashable, Equatable {
|
||||
let datacenterId: Int32
|
||||
let documentId: Int64
|
||||
let sizeSpec: String
|
||||
@ -192,7 +188,7 @@ public struct CloudDocumentSizeMediaResourceId: MediaResourceId, Hashable {
|
||||
|
||||
public func isEqual(to: MediaResourceId) -> Bool {
|
||||
if let to = to as? CloudDocumentSizeMediaResourceId {
|
||||
return self.datacenterId == to.datacenterId && self.documentId == to.documentId && self.sizeSpec == to.sizeSpec
|
||||
return self == to
|
||||
} else {
|
||||
return false
|
||||
}
|
||||
@ -252,7 +248,7 @@ public enum CloudPeerPhotoSizeSpec: Int32 {
|
||||
case fullSize
|
||||
}
|
||||
|
||||
public struct CloudPeerPhotoSizeMediaResourceId: MediaResourceId, Hashable {
|
||||
public struct CloudPeerPhotoSizeMediaResourceId: MediaResourceId, Hashable, Equatable {
|
||||
let datacenterId: Int32
|
||||
let photoId: Int64?
|
||||
let sizeSpec: CloudPeerPhotoSizeSpec
|
||||
@ -277,7 +273,7 @@ public struct CloudPeerPhotoSizeMediaResourceId: MediaResourceId, Hashable {
|
||||
|
||||
public func isEqual(to: MediaResourceId) -> Bool {
|
||||
if let to = to as? CloudPeerPhotoSizeMediaResourceId {
|
||||
return self.datacenterId == to.datacenterId && self.photoId == to.photoId && self.sizeSpec == to.sizeSpec && self.volumeId == to.volumeId && self.localId == to.localId
|
||||
return self == to
|
||||
} else {
|
||||
return false
|
||||
}
|
||||
@ -340,7 +336,7 @@ public final class CloudPeerPhotoSizeMediaResource: TelegramMediaResource {
|
||||
}
|
||||
}
|
||||
|
||||
public struct CloudStickerPackThumbnailMediaResourceId: MediaResourceId, Hashable {
|
||||
public struct CloudStickerPackThumbnailMediaResourceId: MediaResourceId, Hashable, Equatable {
|
||||
let datacenterId: Int32
|
||||
let thumbVersion: Int32?
|
||||
let volumeId: Int64?
|
||||
@ -363,7 +359,7 @@ public struct CloudStickerPackThumbnailMediaResourceId: MediaResourceId, Hashabl
|
||||
|
||||
public func isEqual(to: MediaResourceId) -> Bool {
|
||||
if let to = to as? CloudStickerPackThumbnailMediaResourceId {
|
||||
return self.datacenterId == to.datacenterId && self.volumeId == to.volumeId && self.localId == to.localId
|
||||
return self == to
|
||||
} else {
|
||||
return false
|
||||
}
|
||||
@ -422,7 +418,7 @@ public final class CloudStickerPackThumbnailMediaResource: TelegramMediaResource
|
||||
}
|
||||
}
|
||||
|
||||
public struct CloudDocumentMediaResourceId: MediaResourceId {
|
||||
public struct CloudDocumentMediaResourceId: MediaResourceId, Hashable, Equatable {
|
||||
public let datacenterId: Int
|
||||
public let fileId: Int64
|
||||
|
||||
@ -435,13 +431,9 @@ public struct CloudDocumentMediaResourceId: MediaResourceId {
|
||||
return "telegram-cloud-document-\(self.datacenterId)-\(self.fileId)"
|
||||
}
|
||||
|
||||
public var hashValue: Int {
|
||||
return self.fileId.hashValue
|
||||
}
|
||||
|
||||
public func isEqual(to: MediaResourceId) -> Bool {
|
||||
if let to = to as? CloudDocumentMediaResourceId {
|
||||
return self.datacenterId == to.datacenterId && self.fileId == to.fileId
|
||||
return self == to
|
||||
} else {
|
||||
return false
|
||||
}
|
||||
@ -512,20 +504,16 @@ public final class CloudDocumentMediaResource: TelegramMediaResource {
|
||||
}
|
||||
}
|
||||
|
||||
public struct LocalFileMediaResourceId: MediaResourceId {
|
||||
public struct LocalFileMediaResourceId: MediaResourceId, Hashable, Equatable {
|
||||
public let fileId: Int64
|
||||
|
||||
public var uniqueId: String {
|
||||
return "telegram-local-file-\(self.fileId)"
|
||||
}
|
||||
|
||||
public var hashValue: Int {
|
||||
return self.fileId.hashValue
|
||||
}
|
||||
|
||||
public func isEqual(to: MediaResourceId) -> Bool {
|
||||
if let to = to as? LocalFileMediaResourceId {
|
||||
return self.fileId == to.fileId
|
||||
return self == to
|
||||
} else {
|
||||
return false
|
||||
}
|
||||
@ -577,20 +565,16 @@ public class LocalFileMediaResource: TelegramMediaResource {
|
||||
}
|
||||
}
|
||||
|
||||
public struct LocalFileReferenceMediaResourceId: MediaResourceId {
|
||||
public struct LocalFileReferenceMediaResourceId: MediaResourceId, Hashable, Equatable {
|
||||
public let randomId: Int64
|
||||
|
||||
public var uniqueId: String {
|
||||
return "local-file-\(self.randomId)"
|
||||
}
|
||||
|
||||
public var hashValue: Int {
|
||||
return self.randomId.hashValue
|
||||
}
|
||||
|
||||
public func isEqual(to: MediaResourceId) -> Bool {
|
||||
if let to = to as? LocalFileReferenceMediaResourceId {
|
||||
return self.randomId == to.randomId
|
||||
return self == to
|
||||
} else {
|
||||
return false
|
||||
}
|
||||
@ -641,21 +625,17 @@ public class LocalFileReferenceMediaResource: TelegramMediaResource {
|
||||
}
|
||||
}
|
||||
|
||||
public struct HttpReferenceMediaResourceId: MediaResourceId {
|
||||
public struct HttpReferenceMediaResourceId: MediaResourceId, Hashable, Equatable {
|
||||
public let url: String
|
||||
|
||||
public func isEqual(to: MediaResourceId) -> Bool {
|
||||
if let to = to as? HttpReferenceMediaResourceId {
|
||||
return self.url == to.url
|
||||
return self == to
|
||||
} else {
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
||||
public var hashValue: Int {
|
||||
return self.url.hashValue
|
||||
}
|
||||
|
||||
public var uniqueId: String {
|
||||
return "http-\(persistentHash32(self.url))"
|
||||
}
|
||||
@ -701,23 +681,19 @@ public final class HttpReferenceMediaResource: TelegramMediaResource {
|
||||
}
|
||||
}
|
||||
|
||||
public struct WebFileReferenceMediaResourceId: MediaResourceId {
|
||||
public struct WebFileReferenceMediaResourceId: MediaResourceId, Hashable, Equatable {
|
||||
public let url: String
|
||||
public let accessHash: Int64
|
||||
public let size: Int32
|
||||
|
||||
public func isEqual(to: MediaResourceId) -> Bool {
|
||||
if let to = to as? WebFileReferenceMediaResourceId {
|
||||
return self.url == to.url && size == to.size && accessHash == to.accessHash
|
||||
return self == to
|
||||
} else {
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
||||
public var hashValue: Int {
|
||||
return self.url.hashValue
|
||||
}
|
||||
|
||||
public var uniqueId: String {
|
||||
return "proxy-\(persistentHash32(self.url))-\(size)-\(accessHash)"
|
||||
}
|
||||
@ -760,7 +736,7 @@ public final class WebFileReferenceMediaResource: TelegramMediaResource {
|
||||
}
|
||||
|
||||
|
||||
public struct SecretFileMediaResourceId: MediaResourceId {
|
||||
public struct SecretFileMediaResourceId: MediaResourceId, Hashable, Equatable {
|
||||
public let fileId: Int64
|
||||
public let datacenterId: Int32
|
||||
|
||||
@ -773,13 +749,9 @@ public struct SecretFileMediaResourceId: MediaResourceId {
|
||||
self.datacenterId = datacenterId
|
||||
}
|
||||
|
||||
public var hashValue: Int {
|
||||
return self.fileId.hashValue
|
||||
}
|
||||
|
||||
public func isEqual(to: MediaResourceId) -> Bool {
|
||||
if let to = to as? SecretFileMediaResourceId {
|
||||
return self.fileId == to.fileId && self.datacenterId == to.datacenterId
|
||||
return self == to
|
||||
} else {
|
||||
return false
|
||||
}
|
||||
|
@ -7,7 +7,7 @@ fileprivate let parsers: [Int32 : (BufferReader) -> Any?] = {
|
||||
dict[-1255641564] = { return parseString($0) }
|
||||
dict[-1240849242] = { return Api.messages.StickerSet.parse_stickerSet($0) }
|
||||
dict[2004925620] = { return Api.GroupCall.parse_groupCallDiscarded($0) }
|
||||
dict[-1061026514] = { return Api.GroupCall.parse_groupCall($0) }
|
||||
dict[-916691372] = { return Api.GroupCall.parse_groupCall($0) }
|
||||
dict[-457104426] = { return Api.InputGeoPoint.parse_inputGeoPointEmpty($0) }
|
||||
dict[1210199983] = { return Api.InputGeoPoint.parse_inputGeoPoint($0) }
|
||||
dict[-784000893] = { return Api.payments.ValidatedRequestedInfo.parse_validatedRequestedInfo($0) }
|
||||
@ -587,7 +587,7 @@ fileprivate let parsers: [Int32 : (BufferReader) -> Any?] = {
|
||||
dict[978610270] = { return Api.messages.Messages.parse_messagesSlice($0) }
|
||||
dict[1682413576] = { return Api.messages.Messages.parse_channelMessages($0) }
|
||||
dict[1951620897] = { return Api.messages.Messages.parse_messagesNotModified($0) }
|
||||
dict[615970509] = { return Api.Invoice.parse_invoice($0) }
|
||||
dict[215516896] = { return Api.Invoice.parse_invoice($0) }
|
||||
dict[1933519201] = { return Api.PeerSettings.parse_peerSettings($0) }
|
||||
dict[1577067778] = { return Api.auth.SentCode.parse_sentCode($0) }
|
||||
dict[480546647] = { return Api.InputChatPhoto.parse_inputChatPhotoEmpty($0) }
|
||||
@ -825,6 +825,7 @@ fileprivate let parsers: [Int32 : (BufferReader) -> Any?] = {
|
||||
dict[2047704898] = { return Api.MessageAction.parse_messageActionGroupCall($0) }
|
||||
dict[1991897370] = { return Api.MessageAction.parse_messageActionInviteToGroupCall($0) }
|
||||
dict[-1441072131] = { return Api.MessageAction.parse_messageActionSetMessagesTTL($0) }
|
||||
dict[-1281329567] = { return Api.MessageAction.parse_messageActionGroupCallScheduled($0) }
|
||||
dict[1399245077] = { return Api.PhoneCall.parse_phoneCallEmpty($0) }
|
||||
dict[462375633] = { return Api.PhoneCall.parse_phoneCallWaiting($0) }
|
||||
dict[-2014659757] = { return Api.PhoneCall.parse_phoneCallRequested($0) }
|
||||
|
@ -1,7 +1,7 @@
|
||||
public extension Api {
|
||||
public enum GroupCall: TypeConstructorDescription {
|
||||
case groupCallDiscarded(id: Int64, accessHash: Int64, duration: Int32)
|
||||
case groupCall(flags: Int32, id: Int64, accessHash: Int64, participantsCount: Int32, params: Api.DataJSON?, title: String?, streamDcId: Int32?, recordStartDate: Int32?, version: Int32)
|
||||
case groupCall(flags: Int32, id: Int64, accessHash: Int64, participantsCount: Int32, params: Api.DataJSON?, title: String?, streamDcId: Int32?, recordStartDate: Int32?, scheduleDate: Int32?, version: Int32)
|
||||
|
||||
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
||||
switch self {
|
||||
@ -13,9 +13,9 @@ public extension Api {
|
||||
serializeInt64(accessHash, buffer: buffer, boxed: false)
|
||||
serializeInt32(duration, buffer: buffer, boxed: false)
|
||||
break
|
||||
case .groupCall(let flags, let id, let accessHash, let participantsCount, let params, let title, let streamDcId, let recordStartDate, let version):
|
||||
case .groupCall(let flags, let id, let accessHash, let participantsCount, let params, let title, let streamDcId, let recordStartDate, let scheduleDate, let version):
|
||||
if boxed {
|
||||
buffer.appendInt32(-1061026514)
|
||||
buffer.appendInt32(-916691372)
|
||||
}
|
||||
serializeInt32(flags, buffer: buffer, boxed: false)
|
||||
serializeInt64(id, buffer: buffer, boxed: false)
|
||||
@ -25,6 +25,7 @@ public extension Api {
|
||||
if Int(flags) & Int(1 << 3) != 0 {serializeString(title!, buffer: buffer, boxed: false)}
|
||||
if Int(flags) & Int(1 << 4) != 0 {serializeInt32(streamDcId!, buffer: buffer, boxed: false)}
|
||||
if Int(flags) & Int(1 << 5) != 0 {serializeInt32(recordStartDate!, buffer: buffer, boxed: false)}
|
||||
if Int(flags) & Int(1 << 7) != 0 {serializeInt32(scheduleDate!, buffer: buffer, boxed: false)}
|
||||
serializeInt32(version, buffer: buffer, boxed: false)
|
||||
break
|
||||
}
|
||||
@ -34,8 +35,8 @@ public extension Api {
|
||||
switch self {
|
||||
case .groupCallDiscarded(let id, let accessHash, let duration):
|
||||
return ("groupCallDiscarded", [("id", id), ("accessHash", accessHash), ("duration", duration)])
|
||||
case .groupCall(let flags, let id, let accessHash, let participantsCount, let params, let title, let streamDcId, let recordStartDate, let version):
|
||||
return ("groupCall", [("flags", flags), ("id", id), ("accessHash", accessHash), ("participantsCount", participantsCount), ("params", params), ("title", title), ("streamDcId", streamDcId), ("recordStartDate", recordStartDate), ("version", version)])
|
||||
case .groupCall(let flags, let id, let accessHash, let participantsCount, let params, let title, let streamDcId, let recordStartDate, let scheduleDate, let version):
|
||||
return ("groupCall", [("flags", flags), ("id", id), ("accessHash", accessHash), ("participantsCount", participantsCount), ("params", params), ("title", title), ("streamDcId", streamDcId), ("recordStartDate", recordStartDate), ("scheduleDate", scheduleDate), ("version", version)])
|
||||
}
|
||||
}
|
||||
|
||||
@ -76,7 +77,9 @@ public extension Api {
|
||||
var _8: Int32?
|
||||
if Int(_1!) & Int(1 << 5) != 0 {_8 = reader.readInt32() }
|
||||
var _9: Int32?
|
||||
_9 = reader.readInt32()
|
||||
if Int(_1!) & Int(1 << 7) != 0 {_9 = reader.readInt32() }
|
||||
var _10: Int32?
|
||||
_10 = reader.readInt32()
|
||||
let _c1 = _1 != nil
|
||||
let _c2 = _2 != nil
|
||||
let _c3 = _3 != nil
|
||||
@ -85,9 +88,10 @@ public extension Api {
|
||||
let _c6 = (Int(_1!) & Int(1 << 3) == 0) || _6 != nil
|
||||
let _c7 = (Int(_1!) & Int(1 << 4) == 0) || _7 != nil
|
||||
let _c8 = (Int(_1!) & Int(1 << 5) == 0) || _8 != nil
|
||||
let _c9 = _9 != nil
|
||||
if _c1 && _c2 && _c3 && _c4 && _c5 && _c6 && _c7 && _c8 && _c9 {
|
||||
return Api.GroupCall.groupCall(flags: _1!, id: _2!, accessHash: _3!, participantsCount: _4!, params: _5, title: _6, streamDcId: _7, recordStartDate: _8, version: _9!)
|
||||
let _c9 = (Int(_1!) & Int(1 << 7) == 0) || _9 != nil
|
||||
let _c10 = _10 != nil
|
||||
if _c1 && _c2 && _c3 && _c4 && _c5 && _c6 && _c7 && _c8 && _c9 && _c10 {
|
||||
return Api.GroupCall.groupCall(flags: _1!, id: _2!, accessHash: _3!, participantsCount: _4!, params: _5, title: _6, streamDcId: _7, recordStartDate: _8, scheduleDate: _9, version: _10!)
|
||||
}
|
||||
else {
|
||||
return nil
|
||||
@ -15026,13 +15030,13 @@ public extension Api {
|
||||
|
||||
}
|
||||
public enum Invoice: TypeConstructorDescription {
|
||||
case invoice(flags: Int32, currency: String, prices: [Api.LabeledPrice], minTipAmount: Int64?, maxTipAmount: Int64?, defaultTipAmount: Int64?)
|
||||
case invoice(flags: Int32, currency: String, prices: [Api.LabeledPrice], maxTipAmount: Int64?, suggestedTipAmounts: [Int64]?)
|
||||
|
||||
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
||||
switch self {
|
||||
case .invoice(let flags, let currency, let prices, let minTipAmount, let maxTipAmount, let defaultTipAmount):
|
||||
case .invoice(let flags, let currency, let prices, let maxTipAmount, let suggestedTipAmounts):
|
||||
if boxed {
|
||||
buffer.appendInt32(615970509)
|
||||
buffer.appendInt32(215516896)
|
||||
}
|
||||
serializeInt32(flags, buffer: buffer, boxed: false)
|
||||
serializeString(currency, buffer: buffer, boxed: false)
|
||||
@ -15041,17 +15045,20 @@ public extension Api {
|
||||
for item in prices {
|
||||
item.serialize(buffer, true)
|
||||
}
|
||||
if Int(flags) & Int(1 << 8) != 0 {serializeInt64(minTipAmount!, buffer: buffer, boxed: false)}
|
||||
if Int(flags) & Int(1 << 8) != 0 {serializeInt64(maxTipAmount!, buffer: buffer, boxed: false)}
|
||||
if Int(flags) & Int(1 << 8) != 0 {serializeInt64(defaultTipAmount!, buffer: buffer, boxed: false)}
|
||||
if Int(flags) & Int(1 << 8) != 0 {buffer.appendInt32(481674261)
|
||||
buffer.appendInt32(Int32(suggestedTipAmounts!.count))
|
||||
for item in suggestedTipAmounts! {
|
||||
serializeInt64(item, buffer: buffer, boxed: false)
|
||||
}}
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
public func descriptionFields() -> (String, [(String, Any)]) {
|
||||
switch self {
|
||||
case .invoice(let flags, let currency, let prices, let minTipAmount, let maxTipAmount, let defaultTipAmount):
|
||||
return ("invoice", [("flags", flags), ("currency", currency), ("prices", prices), ("minTipAmount", minTipAmount), ("maxTipAmount", maxTipAmount), ("defaultTipAmount", defaultTipAmount)])
|
||||
case .invoice(let flags, let currency, let prices, let maxTipAmount, let suggestedTipAmounts):
|
||||
return ("invoice", [("flags", flags), ("currency", currency), ("prices", prices), ("maxTipAmount", maxTipAmount), ("suggestedTipAmounts", suggestedTipAmounts)])
|
||||
}
|
||||
}
|
||||
|
||||
@ -15066,18 +15073,17 @@ public extension Api {
|
||||
}
|
||||
var _4: Int64?
|
||||
if Int(_1!) & Int(1 << 8) != 0 {_4 = reader.readInt64() }
|
||||
var _5: Int64?
|
||||
if Int(_1!) & Int(1 << 8) != 0 {_5 = reader.readInt64() }
|
||||
var _6: Int64?
|
||||
if Int(_1!) & Int(1 << 8) != 0 {_6 = reader.readInt64() }
|
||||
var _5: [Int64]?
|
||||
if Int(_1!) & Int(1 << 8) != 0 {if let _ = reader.readInt32() {
|
||||
_5 = Api.parseVector(reader, elementSignature: 570911930, elementType: Int64.self)
|
||||
} }
|
||||
let _c1 = _1 != nil
|
||||
let _c2 = _2 != nil
|
||||
let _c3 = _3 != nil
|
||||
let _c4 = (Int(_1!) & Int(1 << 8) == 0) || _4 != nil
|
||||
let _c5 = (Int(_1!) & Int(1 << 8) == 0) || _5 != nil
|
||||
let _c6 = (Int(_1!) & Int(1 << 8) == 0) || _6 != nil
|
||||
if _c1 && _c2 && _c3 && _c4 && _c5 && _c6 {
|
||||
return Api.Invoice.invoice(flags: _1!, currency: _2!, prices: _3!, minTipAmount: _4, maxTipAmount: _5, defaultTipAmount: _6)
|
||||
if _c1 && _c2 && _c3 && _c4 && _c5 {
|
||||
return Api.Invoice.invoice(flags: _1!, currency: _2!, prices: _3!, maxTipAmount: _4, suggestedTipAmounts: _5)
|
||||
}
|
||||
else {
|
||||
return nil
|
||||
@ -20433,6 +20439,7 @@ public extension Api {
|
||||
case messageActionGroupCall(flags: Int32, call: Api.InputGroupCall, duration: Int32?)
|
||||
case messageActionInviteToGroupCall(call: Api.InputGroupCall, users: [Int32])
|
||||
case messageActionSetMessagesTTL(period: Int32)
|
||||
case messageActionGroupCallScheduled(call: Api.InputGroupCall, scheduleDate: Int32)
|
||||
|
||||
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
||||
switch self {
|
||||
@ -20637,6 +20644,13 @@ public extension Api {
|
||||
}
|
||||
serializeInt32(period, buffer: buffer, boxed: false)
|
||||
break
|
||||
case .messageActionGroupCallScheduled(let call, let scheduleDate):
|
||||
if boxed {
|
||||
buffer.appendInt32(-1281329567)
|
||||
}
|
||||
call.serialize(buffer, true)
|
||||
serializeInt32(scheduleDate, buffer: buffer, boxed: false)
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
@ -20696,6 +20710,8 @@ public extension Api {
|
||||
return ("messageActionInviteToGroupCall", [("call", call), ("users", users)])
|
||||
case .messageActionSetMessagesTTL(let period):
|
||||
return ("messageActionSetMessagesTTL", [("period", period)])
|
||||
case .messageActionGroupCallScheduled(let call, let scheduleDate):
|
||||
return ("messageActionGroupCallScheduled", [("call", call), ("scheduleDate", scheduleDate)])
|
||||
}
|
||||
}
|
||||
|
||||
@ -21033,6 +21049,22 @@ public extension Api {
|
||||
return nil
|
||||
}
|
||||
}
|
||||
public static func parse_messageActionGroupCallScheduled(_ reader: BufferReader) -> MessageAction? {
|
||||
var _1: Api.InputGroupCall?
|
||||
if let signature = reader.readInt32() {
|
||||
_1 = Api.parse(reader, signature: signature) as? Api.InputGroupCall
|
||||
}
|
||||
var _2: Int32?
|
||||
_2 = reader.readInt32()
|
||||
let _c1 = _1 != nil
|
||||
let _c2 = _2 != nil
|
||||
if _c1 && _c2 {
|
||||
return Api.MessageAction.messageActionGroupCallScheduled(call: _1!, scheduleDate: _2!)
|
||||
}
|
||||
else {
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
public enum PhoneCall: TypeConstructorDescription {
|
||||
|
@ -7697,12 +7697,15 @@ public extension Api {
|
||||
})
|
||||
}
|
||||
|
||||
public static func createGroupCall(peer: Api.InputPeer, randomId: Int32) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.Updates>) {
|
||||
public static func createGroupCall(flags: Int32, peer: Api.InputPeer, randomId: Int32, title: String?, scheduleDate: Int32?) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.Updates>) {
|
||||
let buffer = Buffer()
|
||||
buffer.appendInt32(-1120031776)
|
||||
buffer.appendInt32(1221445336)
|
||||
serializeInt32(flags, buffer: buffer, boxed: false)
|
||||
peer.serialize(buffer, true)
|
||||
serializeInt32(randomId, buffer: buffer, boxed: false)
|
||||
return (FunctionDescription(name: "phone.createGroupCall", parameters: [("peer", peer), ("randomId", randomId)]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.Updates? in
|
||||
if Int(flags) & Int(1 << 0) != 0 {serializeString(title!, buffer: buffer, boxed: false)}
|
||||
if Int(flags) & Int(1 << 1) != 0 {serializeInt32(scheduleDate!, buffer: buffer, boxed: false)}
|
||||
return (FunctionDescription(name: "phone.createGroupCall", parameters: [("flags", flags), ("peer", peer), ("randomId", randomId), ("title", title), ("scheduleDate", scheduleDate)]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.Updates? in
|
||||
let reader = BufferReader(buffer)
|
||||
var result: Api.Updates?
|
||||
if let signature = reader.readInt32() {
|
||||
@ -7926,6 +7929,35 @@ public extension Api {
|
||||
return result
|
||||
})
|
||||
}
|
||||
|
||||
public static func toggleGroupCallStartSubscription(call: Api.InputGroupCall, subscribed: Api.Bool) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.Updates>) {
|
||||
let buffer = Buffer()
|
||||
buffer.appendInt32(563885286)
|
||||
call.serialize(buffer, true)
|
||||
subscribed.serialize(buffer, true)
|
||||
return (FunctionDescription(name: "phone.toggleGroupCallStartSubscription", parameters: [("call", call), ("subscribed", subscribed)]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.Updates? in
|
||||
let reader = BufferReader(buffer)
|
||||
var result: Api.Updates?
|
||||
if let signature = reader.readInt32() {
|
||||
result = Api.parse(reader, signature: signature) as? Api.Updates
|
||||
}
|
||||
return result
|
||||
})
|
||||
}
|
||||
|
||||
public static func startScheduledGroupCall(call: Api.InputGroupCall) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.Updates>) {
|
||||
let buffer = Buffer()
|
||||
buffer.appendInt32(1451287362)
|
||||
call.serialize(buffer, true)
|
||||
return (FunctionDescription(name: "phone.startScheduledGroupCall", parameters: [("call", call)]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.Updates? in
|
||||
let reader = BufferReader(buffer)
|
||||
var result: Api.Updates?
|
||||
if let signature = reader.readInt32() {
|
||||
result = Api.parse(reader, signature: signature) as? Api.Updates
|
||||
}
|
||||
return result
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -73,11 +73,11 @@ func telegramMediaActionFromApiAction(_ action: Api.MessageAction) -> TelegramMe
|
||||
}
|
||||
case let .messageActionSetMessagesTTL(period):
|
||||
return TelegramMediaAction(action: .messageAutoremoveTimeoutUpdated(period))
|
||||
/*case let .messageActionGroupCallScheduled(call, scheduleDate):
|
||||
case let .messageActionGroupCallScheduled(call, scheduleDate):
|
||||
switch call {
|
||||
case let .inputGroupCall(id, accessHash):
|
||||
return TelegramMediaAction(action: .groupPhoneCall(callId: id, accessHash: accessHash, scheduleDate: scheduleDate, duration: nil))
|
||||
}*/
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -38,9 +38,8 @@ public struct BotPaymentPrice : Equatable {
|
||||
|
||||
public struct BotPaymentInvoice : Equatable {
|
||||
public struct Tip: Equatable {
|
||||
public var min: Int64
|
||||
public var max: Int64
|
||||
public var `default`: Int64
|
||||
public var suggested: [Int64]
|
||||
}
|
||||
|
||||
public let isTest: Bool
|
||||
@ -121,7 +120,7 @@ public enum BotPaymentFormRequestError {
|
||||
extension BotPaymentInvoice {
|
||||
init(apiInvoice: Api.Invoice) {
|
||||
switch apiInvoice {
|
||||
case let .invoice(flags, currency, prices, minTipAmount, maxTipAmount, defaultTipAmount):
|
||||
case let .invoice(flags, currency, prices, maxTipAmount, suggestedTipAmounts):
|
||||
var fields = BotPaymentInvoiceFields()
|
||||
if (flags & (1 << 1)) != 0 {
|
||||
fields.insert(.name)
|
||||
@ -145,8 +144,8 @@ extension BotPaymentInvoice {
|
||||
fields.insert(.emailAvailableToProvider)
|
||||
}
|
||||
var parsedTip: BotPaymentInvoice.Tip?
|
||||
if let minTipAmount = minTipAmount, let maxTipAmount = maxTipAmount, let defaultTipAmount = defaultTipAmount {
|
||||
parsedTip = BotPaymentInvoice.Tip(min: minTipAmount, max: maxTipAmount, default: defaultTipAmount)
|
||||
if let maxTipAmount = maxTipAmount, let suggestedTipAmounts = suggestedTipAmounts {
|
||||
parsedTip = BotPaymentInvoice.Tip(max: maxTipAmount, suggested: suggestedTipAmounts)
|
||||
}
|
||||
self.init(isTest: (flags & (1 << 0)) != 0, requestedFields: fields, currency: currency, prices: prices.map {
|
||||
switch $0 {
|
||||
|
@ -43,7 +43,7 @@ public struct GroupCallSummary: Equatable {
|
||||
extension GroupCallInfo {
|
||||
init?(_ call: Api.GroupCall) {
|
||||
switch call {
|
||||
case let .groupCall(flags, id, accessHash, participantCount, params, title, streamDcId, recordStartDate/*, scheduleDate*/, _):
|
||||
case let .groupCall(flags, id, accessHash, participantCount, params, title, streamDcId, recordStartDate, scheduleDate, _):
|
||||
var clientParams: String?
|
||||
if let params = params {
|
||||
switch params {
|
||||
@ -177,8 +177,7 @@ public func createGroupCall(account: Account, peerId: PeerId) -> Signal<GroupCal
|
||||
return .fail(.generic)
|
||||
}
|
||||
|
||||
//return account.network.request(Api.functions.phone.createGroupCall(flags: 0, peer: inputPeer, randomId: Int32.random(in: Int32.min ... Int32.max), title: nil, scheduleDate: nil))
|
||||
return account.network.request(Api.functions.phone.createGroupCall(peer: inputPeer, randomId: Int32.random(in: Int32.min ... Int32.max)))
|
||||
return account.network.request(Api.functions.phone.createGroupCall(flags: 0, peer: inputPeer, randomId: Int32.random(in: Int32.min ... Int32.max), title: nil, scheduleDate: nil))
|
||||
|> mapError { error -> CreateGroupCallError in
|
||||
if error.errorDescription == "ANONYMOUS_CALLS_DISABLED" {
|
||||
return .anonymousNotAllowed
|
||||
@ -466,7 +465,7 @@ public func joinGroupCall(account: Account, peerId: PeerId, joinAs: PeerId?, cal
|
||||
maybeParsedCall = GroupCallInfo(call)
|
||||
|
||||
switch call {
|
||||
case let .groupCall(flags, _, _, _, _, title, _, recordStartDate/*, scheduleDate*/, _):
|
||||
case let .groupCall(flags, _, _, _, _, title, _, recordStartDate, scheduleDate, _):
|
||||
let isMuted = (flags & (1 << 1)) != 0
|
||||
let canChange = (flags & (1 << 2)) != 0
|
||||
state.defaultParticipantsAreMuted = GroupCallParticipantsContext.State.DefaultParticipantsAreMuted(isMuted: isMuted, canChange: canChange)
|
||||
|
@ -2991,7 +2991,7 @@ func replayFinalState(accountManager: AccountManager, postbox: Postbox, accountP
|
||||
})
|
||||
|
||||
switch call {
|
||||
case let .groupCall(flags, _, _, _, _, title, streamDcId, recordStartDate, _):
|
||||
case let .groupCall(flags, _, _, _, _, title, _, recordStartDate, scheduleDate, _):
|
||||
let isMuted = (flags & (1 << 1)) != 0
|
||||
let canChange = (flags & (1 << 2)) != 0
|
||||
let defaultParticipantsAreMuted = GroupCallParticipantsContext.State.DefaultParticipantsAreMuted(isMuted: isMuted, canChange: canChange)
|
||||
|
@ -196,7 +196,7 @@ func apiMessagePeerIds(_ message: Api.Message) -> [PeerId] {
|
||||
}
|
||||
|
||||
switch action {
|
||||
case .messageActionChannelCreate, .messageActionChatDeletePhoto, .messageActionChatEditPhoto, .messageActionChatEditTitle, .messageActionEmpty, .messageActionPinMessage, .messageActionHistoryClear, .messageActionGameScore, .messageActionPaymentSent, .messageActionPaymentSentMe, .messageActionPhoneCall, .messageActionScreenshotTaken, .messageActionCustomAction, .messageActionBotAllowed, .messageActionSecureValuesSent, .messageActionSecureValuesSentMe, .messageActionContactSignUp, .messageActionGroupCall, .messageActionSetMessagesTTL/*, .messageActionGroupCallScheduled*/:
|
||||
case .messageActionChannelCreate, .messageActionChatDeletePhoto, .messageActionChatEditPhoto, .messageActionChatEditTitle, .messageActionEmpty, .messageActionPinMessage, .messageActionHistoryClear, .messageActionGameScore, .messageActionPaymentSent, .messageActionPaymentSentMe, .messageActionPhoneCall, .messageActionScreenshotTaken, .messageActionCustomAction, .messageActionBotAllowed, .messageActionSecureValuesSent, .messageActionSecureValuesSentMe, .messageActionContactSignUp, .messageActionGroupCall, .messageActionSetMessagesTTL, .messageActionGroupCallScheduled:
|
||||
break
|
||||
case let .messageActionChannelMigrateFrom(_, chatId):
|
||||
result.append(PeerId(namespace: Namespaces.Peer.CloudGroup, id: PeerId.Id._internalFromInt32Value(chatId)))
|
||||
|
Loading…
x
Reference in New Issue
Block a user