mirror of
https://github.com/TelegramMessenger/Telegram-iOS.git
synced 2026-07-06 03:33:41 +02:00
Refactor Api types 120-149 to use struct-wrapped constructors
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
parent
6b2c0f9c53
commit
33a0d9e62c
66 changed files with 918 additions and 260 deletions
|
|
@ -1,14 +1,116 @@
|
|||
public extension Api {
|
||||
indirect enum InputFileLocation: TypeConstructorDescription {
|
||||
case inputDocumentFileLocation(id: Int64, accessHash: Int64, fileReference: Buffer, thumbSize: String)
|
||||
case inputEncryptedFileLocation(id: Int64, accessHash: Int64)
|
||||
case inputFileLocation(volumeId: Int64, localId: Int32, secret: Int64, fileReference: Buffer)
|
||||
case inputGroupCallStream(flags: Int32, call: Api.InputGroupCall, timeMs: Int64, scale: Int32, videoChannel: Int32?, videoQuality: Int32?)
|
||||
case inputPeerPhotoFileLocation(flags: Int32, peer: Api.InputPeer, photoId: Int64)
|
||||
case inputPhotoFileLocation(id: Int64, accessHash: Int64, fileReference: Buffer, thumbSize: String)
|
||||
case inputPhotoLegacyFileLocation(id: Int64, accessHash: Int64, fileReference: Buffer, volumeId: Int64, localId: Int32, secret: Int64)
|
||||
case inputSecureFileLocation(id: Int64, accessHash: Int64)
|
||||
case inputStickerSetThumb(stickerset: Api.InputStickerSet, thumbVersion: Int32)
|
||||
public class Cons_inputDocumentFileLocation {
|
||||
public var id: Int64
|
||||
public var accessHash: Int64
|
||||
public var fileReference: Buffer
|
||||
public var thumbSize: String
|
||||
public init(id: Int64, accessHash: Int64, fileReference: Buffer, thumbSize: String) {
|
||||
self.id = id
|
||||
self.accessHash = accessHash
|
||||
self.fileReference = fileReference
|
||||
self.thumbSize = thumbSize
|
||||
}
|
||||
}
|
||||
public class Cons_inputEncryptedFileLocation {
|
||||
public var id: Int64
|
||||
public var accessHash: Int64
|
||||
public init(id: Int64, accessHash: Int64) {
|
||||
self.id = id
|
||||
self.accessHash = accessHash
|
||||
}
|
||||
}
|
||||
public class Cons_inputFileLocation {
|
||||
public var volumeId: Int64
|
||||
public var localId: Int32
|
||||
public var secret: Int64
|
||||
public var fileReference: Buffer
|
||||
public init(volumeId: Int64, localId: Int32, secret: Int64, fileReference: Buffer) {
|
||||
self.volumeId = volumeId
|
||||
self.localId = localId
|
||||
self.secret = secret
|
||||
self.fileReference = fileReference
|
||||
}
|
||||
}
|
||||
public class Cons_inputGroupCallStream {
|
||||
public var flags: Int32
|
||||
public var call: Api.InputGroupCall
|
||||
public var timeMs: Int64
|
||||
public var scale: Int32
|
||||
public var videoChannel: Int32?
|
||||
public var videoQuality: Int32?
|
||||
public init(flags: Int32, call: Api.InputGroupCall, timeMs: Int64, scale: Int32, videoChannel: Int32?, videoQuality: Int32?) {
|
||||
self.flags = flags
|
||||
self.call = call
|
||||
self.timeMs = timeMs
|
||||
self.scale = scale
|
||||
self.videoChannel = videoChannel
|
||||
self.videoQuality = videoQuality
|
||||
}
|
||||
}
|
||||
public class Cons_inputPeerPhotoFileLocation {
|
||||
public var flags: Int32
|
||||
public var peer: Api.InputPeer
|
||||
public var photoId: Int64
|
||||
public init(flags: Int32, peer: Api.InputPeer, photoId: Int64) {
|
||||
self.flags = flags
|
||||
self.peer = peer
|
||||
self.photoId = photoId
|
||||
}
|
||||
}
|
||||
public class Cons_inputPhotoFileLocation {
|
||||
public var id: Int64
|
||||
public var accessHash: Int64
|
||||
public var fileReference: Buffer
|
||||
public var thumbSize: String
|
||||
public init(id: Int64, accessHash: Int64, fileReference: Buffer, thumbSize: String) {
|
||||
self.id = id
|
||||
self.accessHash = accessHash
|
||||
self.fileReference = fileReference
|
||||
self.thumbSize = thumbSize
|
||||
}
|
||||
}
|
||||
public class Cons_inputPhotoLegacyFileLocation {
|
||||
public var id: Int64
|
||||
public var accessHash: Int64
|
||||
public var fileReference: Buffer
|
||||
public var volumeId: Int64
|
||||
public var localId: Int32
|
||||
public var secret: Int64
|
||||
public init(id: Int64, accessHash: Int64, fileReference: Buffer, volumeId: Int64, localId: Int32, secret: Int64) {
|
||||
self.id = id
|
||||
self.accessHash = accessHash
|
||||
self.fileReference = fileReference
|
||||
self.volumeId = volumeId
|
||||
self.localId = localId
|
||||
self.secret = secret
|
||||
}
|
||||
}
|
||||
public class Cons_inputSecureFileLocation {
|
||||
public var id: Int64
|
||||
public var accessHash: Int64
|
||||
public init(id: Int64, accessHash: Int64) {
|
||||
self.id = id
|
||||
self.accessHash = accessHash
|
||||
}
|
||||
}
|
||||
public class Cons_inputStickerSetThumb {
|
||||
public var stickerset: Api.InputStickerSet
|
||||
public var thumbVersion: Int32
|
||||
public init(stickerset: Api.InputStickerSet, thumbVersion: Int32) {
|
||||
self.stickerset = stickerset
|
||||
self.thumbVersion = thumbVersion
|
||||
}
|
||||
}
|
||||
case inputDocumentFileLocation(Cons_inputDocumentFileLocation)
|
||||
case inputEncryptedFileLocation(Cons_inputEncryptedFileLocation)
|
||||
case inputFileLocation(Cons_inputFileLocation)
|
||||
case inputGroupCallStream(Cons_inputGroupCallStream)
|
||||
case inputPeerPhotoFileLocation(Cons_inputPeerPhotoFileLocation)
|
||||
case inputPhotoFileLocation(Cons_inputPhotoFileLocation)
|
||||
case inputPhotoLegacyFileLocation(Cons_inputPhotoLegacyFileLocation)
|
||||
case inputSecureFileLocation(Cons_inputSecureFileLocation)
|
||||
case inputStickerSetThumb(Cons_inputStickerSetThumb)
|
||||
case inputTakeoutFileLocation
|
||||
|
||||
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
||||
|
|
@ -101,7 +203,15 @@ public extension Api {
|
|||
}
|
||||
public extension Api {
|
||||
indirect enum InputFolderPeer: TypeConstructorDescription {
|
||||
case inputFolderPeer(peer: Api.InputPeer, folderId: Int32)
|
||||
public class Cons_inputFolderPeer {
|
||||
public var peer: Api.InputPeer
|
||||
public var folderId: Int32
|
||||
public init(peer: Api.InputPeer, folderId: Int32) {
|
||||
self.peer = peer
|
||||
self.folderId = folderId
|
||||
}
|
||||
}
|
||||
case inputFolderPeer(Cons_inputFolderPeer)
|
||||
|
||||
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
||||
#if DEBUG
|
||||
|
|
@ -130,8 +240,24 @@ public extension Api {
|
|||
}
|
||||
public extension Api {
|
||||
indirect enum InputGame: TypeConstructorDescription {
|
||||
case inputGameID(id: Int64, accessHash: Int64)
|
||||
case inputGameShortName(botId: Api.InputUser, shortName: String)
|
||||
public class Cons_inputGameID {
|
||||
public var id: Int64
|
||||
public var accessHash: Int64
|
||||
public init(id: Int64, accessHash: Int64) {
|
||||
self.id = id
|
||||
self.accessHash = accessHash
|
||||
}
|
||||
}
|
||||
public class Cons_inputGameShortName {
|
||||
public var botId: Api.InputUser
|
||||
public var shortName: String
|
||||
public init(botId: Api.InputUser, shortName: String) {
|
||||
self.botId = botId
|
||||
self.shortName = shortName
|
||||
}
|
||||
}
|
||||
case inputGameID(Cons_inputGameID)
|
||||
case inputGameShortName(Cons_inputGameShortName)
|
||||
|
||||
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
||||
#if DEBUG
|
||||
|
|
@ -167,7 +293,19 @@ public extension Api {
|
|||
}
|
||||
public extension Api {
|
||||
enum InputGeoPoint: TypeConstructorDescription {
|
||||
case inputGeoPoint(flags: Int32, lat: Double, long: Double, accuracyRadius: Int32?)
|
||||
public class Cons_inputGeoPoint {
|
||||
public var flags: Int32
|
||||
public var lat: Double
|
||||
public var long: Double
|
||||
public var accuracyRadius: Int32?
|
||||
public init(flags: Int32, lat: Double, long: Double, accuracyRadius: Int32?) {
|
||||
self.flags = flags
|
||||
self.lat = lat
|
||||
self.long = long
|
||||
self.accuracyRadius = accuracyRadius
|
||||
}
|
||||
}
|
||||
case inputGeoPoint(Cons_inputGeoPoint)
|
||||
case inputGeoPointEmpty
|
||||
|
||||
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
||||
|
|
@ -204,9 +342,29 @@ public extension Api {
|
|||
}
|
||||
public extension Api {
|
||||
enum InputGroupCall: TypeConstructorDescription {
|
||||
case inputGroupCall(id: Int64, accessHash: Int64)
|
||||
case inputGroupCallInviteMessage(msgId: Int32)
|
||||
case inputGroupCallSlug(slug: String)
|
||||
public class Cons_inputGroupCall {
|
||||
public var id: Int64
|
||||
public var accessHash: Int64
|
||||
public init(id: Int64, accessHash: Int64) {
|
||||
self.id = id
|
||||
self.accessHash = accessHash
|
||||
}
|
||||
}
|
||||
public class Cons_inputGroupCallInviteMessage {
|
||||
public var msgId: Int32
|
||||
public init(msgId: Int32) {
|
||||
self.msgId = msgId
|
||||
}
|
||||
}
|
||||
public class Cons_inputGroupCallSlug {
|
||||
public var slug: String
|
||||
public init(slug: String) {
|
||||
self.slug = slug
|
||||
}
|
||||
}
|
||||
case inputGroupCall(Cons_inputGroupCall)
|
||||
case inputGroupCallInviteMessage(Cons_inputGroupCallInviteMessage)
|
||||
case inputGroupCallSlug(Cons_inputGroupCallSlug)
|
||||
|
||||
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
||||
#if DEBUG
|
||||
|
|
|
|||
|
|
@ -391,7 +391,19 @@ public extension Api {
|
|||
}
|
||||
public extension Api {
|
||||
enum InputAppEvent: TypeConstructorDescription {
|
||||
case inputAppEvent(time: Double, type: String, peer: Int64, data: Api.JSONValue)
|
||||
public class Cons_inputAppEvent {
|
||||
public var time: Double
|
||||
public var type: String
|
||||
public var peer: Int64
|
||||
public var data: Api.JSONValue
|
||||
public init(time: Double, type: String, peer: Int64, data: Api.JSONValue) {
|
||||
self.time = time
|
||||
self.type = type
|
||||
self.peer = peer
|
||||
self.data = data
|
||||
}
|
||||
}
|
||||
case inputAppEvent(Cons_inputAppEvent)
|
||||
|
||||
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
||||
#if DEBUG
|
||||
|
|
@ -420,8 +432,24 @@ public extension Api {
|
|||
}
|
||||
public extension Api {
|
||||
indirect enum InputBotApp: TypeConstructorDescription {
|
||||
case inputBotAppID(id: Int64, accessHash: Int64)
|
||||
case inputBotAppShortName(botId: Api.InputUser, shortName: String)
|
||||
public class Cons_inputBotAppID {
|
||||
public var id: Int64
|
||||
public var accessHash: Int64
|
||||
public init(id: Int64, accessHash: Int64) {
|
||||
self.id = id
|
||||
self.accessHash = accessHash
|
||||
}
|
||||
}
|
||||
public class Cons_inputBotAppShortName {
|
||||
public var botId: Api.InputUser
|
||||
public var shortName: String
|
||||
public init(botId: Api.InputUser, shortName: String) {
|
||||
self.botId = botId
|
||||
self.shortName = shortName
|
||||
}
|
||||
}
|
||||
case inputBotAppID(Cons_inputBotAppID)
|
||||
case inputBotAppShortName(Cons_inputBotAppShortName)
|
||||
|
||||
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
||||
#if DEBUG
|
||||
|
|
@ -457,14 +485,134 @@ public extension Api {
|
|||
}
|
||||
public extension Api {
|
||||
enum InputBotInlineMessage: TypeConstructorDescription {
|
||||
case inputBotInlineMessageGame(flags: Int32, replyMarkup: Api.ReplyMarkup?)
|
||||
case inputBotInlineMessageMediaAuto(flags: Int32, message: String, entities: [Api.MessageEntity]?, replyMarkup: Api.ReplyMarkup?)
|
||||
case inputBotInlineMessageMediaContact(flags: Int32, phoneNumber: String, firstName: String, lastName: String, vcard: String, replyMarkup: Api.ReplyMarkup?)
|
||||
case inputBotInlineMessageMediaGeo(flags: Int32, geoPoint: Api.InputGeoPoint, heading: Int32?, period: Int32?, proximityNotificationRadius: Int32?, replyMarkup: Api.ReplyMarkup?)
|
||||
case inputBotInlineMessageMediaInvoice(flags: Int32, title: String, description: String, photo: Api.InputWebDocument?, invoice: Api.Invoice, payload: Buffer, provider: String, providerData: Api.DataJSON, replyMarkup: Api.ReplyMarkup?)
|
||||
case inputBotInlineMessageMediaVenue(flags: Int32, geoPoint: Api.InputGeoPoint, title: String, address: String, provider: String, venueId: String, venueType: String, replyMarkup: Api.ReplyMarkup?)
|
||||
case inputBotInlineMessageMediaWebPage(flags: Int32, message: String, entities: [Api.MessageEntity]?, url: String, replyMarkup: Api.ReplyMarkup?)
|
||||
case inputBotInlineMessageText(flags: Int32, message: String, entities: [Api.MessageEntity]?, replyMarkup: Api.ReplyMarkup?)
|
||||
public class Cons_inputBotInlineMessageGame {
|
||||
public var flags: Int32
|
||||
public var replyMarkup: Api.ReplyMarkup?
|
||||
public init(flags: Int32, replyMarkup: Api.ReplyMarkup?) {
|
||||
self.flags = flags
|
||||
self.replyMarkup = replyMarkup
|
||||
}
|
||||
}
|
||||
public class Cons_inputBotInlineMessageMediaAuto {
|
||||
public var flags: Int32
|
||||
public var message: String
|
||||
public var entities: [Api.MessageEntity]?
|
||||
public var replyMarkup: Api.ReplyMarkup?
|
||||
public init(flags: Int32, message: String, entities: [Api.MessageEntity]?, replyMarkup: Api.ReplyMarkup?) {
|
||||
self.flags = flags
|
||||
self.message = message
|
||||
self.entities = entities
|
||||
self.replyMarkup = replyMarkup
|
||||
}
|
||||
}
|
||||
public class Cons_inputBotInlineMessageMediaContact {
|
||||
public var flags: Int32
|
||||
public var phoneNumber: String
|
||||
public var firstName: String
|
||||
public var lastName: String
|
||||
public var vcard: String
|
||||
public var replyMarkup: Api.ReplyMarkup?
|
||||
public init(flags: Int32, phoneNumber: String, firstName: String, lastName: String, vcard: String, replyMarkup: Api.ReplyMarkup?) {
|
||||
self.flags = flags
|
||||
self.phoneNumber = phoneNumber
|
||||
self.firstName = firstName
|
||||
self.lastName = lastName
|
||||
self.vcard = vcard
|
||||
self.replyMarkup = replyMarkup
|
||||
}
|
||||
}
|
||||
public class Cons_inputBotInlineMessageMediaGeo {
|
||||
public var flags: Int32
|
||||
public var geoPoint: Api.InputGeoPoint
|
||||
public var heading: Int32?
|
||||
public var period: Int32?
|
||||
public var proximityNotificationRadius: Int32?
|
||||
public var replyMarkup: Api.ReplyMarkup?
|
||||
public init(flags: Int32, geoPoint: Api.InputGeoPoint, heading: Int32?, period: Int32?, proximityNotificationRadius: Int32?, replyMarkup: Api.ReplyMarkup?) {
|
||||
self.flags = flags
|
||||
self.geoPoint = geoPoint
|
||||
self.heading = heading
|
||||
self.period = period
|
||||
self.proximityNotificationRadius = proximityNotificationRadius
|
||||
self.replyMarkup = replyMarkup
|
||||
}
|
||||
}
|
||||
public class Cons_inputBotInlineMessageMediaInvoice {
|
||||
public var flags: Int32
|
||||
public var title: String
|
||||
public var description: String
|
||||
public var photo: Api.InputWebDocument?
|
||||
public var invoice: Api.Invoice
|
||||
public var payload: Buffer
|
||||
public var provider: String
|
||||
public var providerData: Api.DataJSON
|
||||
public var replyMarkup: Api.ReplyMarkup?
|
||||
public init(flags: Int32, title: String, description: String, photo: Api.InputWebDocument?, invoice: Api.Invoice, payload: Buffer, provider: String, providerData: Api.DataJSON, replyMarkup: Api.ReplyMarkup?) {
|
||||
self.flags = flags
|
||||
self.title = title
|
||||
self.description = description
|
||||
self.photo = photo
|
||||
self.invoice = invoice
|
||||
self.payload = payload
|
||||
self.provider = provider
|
||||
self.providerData = providerData
|
||||
self.replyMarkup = replyMarkup
|
||||
}
|
||||
}
|
||||
public class Cons_inputBotInlineMessageMediaVenue {
|
||||
public var flags: Int32
|
||||
public var geoPoint: Api.InputGeoPoint
|
||||
public var title: String
|
||||
public var address: String
|
||||
public var provider: String
|
||||
public var venueId: String
|
||||
public var venueType: String
|
||||
public var replyMarkup: Api.ReplyMarkup?
|
||||
public init(flags: Int32, geoPoint: Api.InputGeoPoint, title: String, address: String, provider: String, venueId: String, venueType: String, replyMarkup: Api.ReplyMarkup?) {
|
||||
self.flags = flags
|
||||
self.geoPoint = geoPoint
|
||||
self.title = title
|
||||
self.address = address
|
||||
self.provider = provider
|
||||
self.venueId = venueId
|
||||
self.venueType = venueType
|
||||
self.replyMarkup = replyMarkup
|
||||
}
|
||||
}
|
||||
public class Cons_inputBotInlineMessageMediaWebPage {
|
||||
public var flags: Int32
|
||||
public var message: String
|
||||
public var entities: [Api.MessageEntity]?
|
||||
public var url: String
|
||||
public var replyMarkup: Api.ReplyMarkup?
|
||||
public init(flags: Int32, message: String, entities: [Api.MessageEntity]?, url: String, replyMarkup: Api.ReplyMarkup?) {
|
||||
self.flags = flags
|
||||
self.message = message
|
||||
self.entities = entities
|
||||
self.url = url
|
||||
self.replyMarkup = replyMarkup
|
||||
}
|
||||
}
|
||||
public class Cons_inputBotInlineMessageText {
|
||||
public var flags: Int32
|
||||
public var message: String
|
||||
public var entities: [Api.MessageEntity]?
|
||||
public var replyMarkup: Api.ReplyMarkup?
|
||||
public init(flags: Int32, message: String, entities: [Api.MessageEntity]?, replyMarkup: Api.ReplyMarkup?) {
|
||||
self.flags = flags
|
||||
self.message = message
|
||||
self.entities = entities
|
||||
self.replyMarkup = replyMarkup
|
||||
}
|
||||
}
|
||||
case inputBotInlineMessageGame(Cons_inputBotInlineMessageGame)
|
||||
case inputBotInlineMessageMediaAuto(Cons_inputBotInlineMessageMediaAuto)
|
||||
case inputBotInlineMessageMediaContact(Cons_inputBotInlineMessageMediaContact)
|
||||
case inputBotInlineMessageMediaGeo(Cons_inputBotInlineMessageMediaGeo)
|
||||
case inputBotInlineMessageMediaInvoice(Cons_inputBotInlineMessageMediaInvoice)
|
||||
case inputBotInlineMessageMediaVenue(Cons_inputBotInlineMessageMediaVenue)
|
||||
case inputBotInlineMessageMediaWebPage(Cons_inputBotInlineMessageMediaWebPage)
|
||||
case inputBotInlineMessageText(Cons_inputBotInlineMessageText)
|
||||
|
||||
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
||||
#if DEBUG
|
||||
|
|
@ -542,8 +690,30 @@ public extension Api {
|
|||
}
|
||||
public extension Api {
|
||||
enum InputBotInlineMessageID: TypeConstructorDescription {
|
||||
case inputBotInlineMessageID(dcId: Int32, id: Int64, accessHash: Int64)
|
||||
case inputBotInlineMessageID64(dcId: Int32, ownerId: Int64, id: Int32, accessHash: Int64)
|
||||
public class Cons_inputBotInlineMessageID {
|
||||
public var dcId: Int32
|
||||
public var id: Int64
|
||||
public var accessHash: Int64
|
||||
public init(dcId: Int32, id: Int64, accessHash: Int64) {
|
||||
self.dcId = dcId
|
||||
self.id = id
|
||||
self.accessHash = accessHash
|
||||
}
|
||||
}
|
||||
public class Cons_inputBotInlineMessageID64 {
|
||||
public var dcId: Int32
|
||||
public var ownerId: Int64
|
||||
public var id: Int32
|
||||
public var accessHash: Int64
|
||||
public init(dcId: Int32, ownerId: Int64, id: Int32, accessHash: Int64) {
|
||||
self.dcId = dcId
|
||||
self.ownerId = ownerId
|
||||
self.id = id
|
||||
self.accessHash = accessHash
|
||||
}
|
||||
}
|
||||
case inputBotInlineMessageID(Cons_inputBotInlineMessageID)
|
||||
case inputBotInlineMessageID64(Cons_inputBotInlineMessageID64)
|
||||
|
||||
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
||||
#if DEBUG
|
||||
|
|
@ -579,10 +749,72 @@ public extension Api {
|
|||
}
|
||||
public extension Api {
|
||||
enum InputBotInlineResult: TypeConstructorDescription {
|
||||
case inputBotInlineResult(flags: Int32, id: String, type: String, title: String?, description: String?, url: String?, thumb: Api.InputWebDocument?, content: Api.InputWebDocument?, sendMessage: Api.InputBotInlineMessage)
|
||||
case inputBotInlineResultDocument(flags: Int32, id: String, type: String, title: String?, description: String?, document: Api.InputDocument, sendMessage: Api.InputBotInlineMessage)
|
||||
case inputBotInlineResultGame(id: String, shortName: String, sendMessage: Api.InputBotInlineMessage)
|
||||
case inputBotInlineResultPhoto(id: String, type: String, photo: Api.InputPhoto, sendMessage: Api.InputBotInlineMessage)
|
||||
public class Cons_inputBotInlineResult {
|
||||
public var flags: Int32
|
||||
public var id: String
|
||||
public var type: String
|
||||
public var title: String?
|
||||
public var description: String?
|
||||
public var url: String?
|
||||
public var thumb: Api.InputWebDocument?
|
||||
public var content: Api.InputWebDocument?
|
||||
public var sendMessage: Api.InputBotInlineMessage
|
||||
public init(flags: Int32, id: String, type: String, title: String?, description: String?, url: String?, thumb: Api.InputWebDocument?, content: Api.InputWebDocument?, sendMessage: Api.InputBotInlineMessage) {
|
||||
self.flags = flags
|
||||
self.id = id
|
||||
self.type = type
|
||||
self.title = title
|
||||
self.description = description
|
||||
self.url = url
|
||||
self.thumb = thumb
|
||||
self.content = content
|
||||
self.sendMessage = sendMessage
|
||||
}
|
||||
}
|
||||
public class Cons_inputBotInlineResultDocument {
|
||||
public var flags: Int32
|
||||
public var id: String
|
||||
public var type: String
|
||||
public var title: String?
|
||||
public var description: String?
|
||||
public var document: Api.InputDocument
|
||||
public var sendMessage: Api.InputBotInlineMessage
|
||||
public init(flags: Int32, id: String, type: String, title: String?, description: String?, document: Api.InputDocument, sendMessage: Api.InputBotInlineMessage) {
|
||||
self.flags = flags
|
||||
self.id = id
|
||||
self.type = type
|
||||
self.title = title
|
||||
self.description = description
|
||||
self.document = document
|
||||
self.sendMessage = sendMessage
|
||||
}
|
||||
}
|
||||
public class Cons_inputBotInlineResultGame {
|
||||
public var id: String
|
||||
public var shortName: String
|
||||
public var sendMessage: Api.InputBotInlineMessage
|
||||
public init(id: String, shortName: String, sendMessage: Api.InputBotInlineMessage) {
|
||||
self.id = id
|
||||
self.shortName = shortName
|
||||
self.sendMessage = sendMessage
|
||||
}
|
||||
}
|
||||
public class Cons_inputBotInlineResultPhoto {
|
||||
public var id: String
|
||||
public var type: String
|
||||
public var photo: Api.InputPhoto
|
||||
public var sendMessage: Api.InputBotInlineMessage
|
||||
public init(id: String, type: String, photo: Api.InputPhoto, sendMessage: Api.InputBotInlineMessage) {
|
||||
self.id = id
|
||||
self.type = type
|
||||
self.photo = photo
|
||||
self.sendMessage = sendMessage
|
||||
}
|
||||
}
|
||||
case inputBotInlineResult(Cons_inputBotInlineResult)
|
||||
case inputBotInlineResultDocument(Cons_inputBotInlineResultDocument)
|
||||
case inputBotInlineResultGame(Cons_inputBotInlineResultGame)
|
||||
case inputBotInlineResultPhoto(Cons_inputBotInlineResultPhoto)
|
||||
|
||||
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
||||
#if DEBUG
|
||||
|
|
@ -632,7 +864,19 @@ public extension Api {
|
|||
}
|
||||
public extension Api {
|
||||
enum InputBusinessAwayMessage: TypeConstructorDescription {
|
||||
case inputBusinessAwayMessage(flags: Int32, shortcutId: Int32, schedule: Api.BusinessAwayMessageSchedule, recipients: Api.InputBusinessRecipients)
|
||||
public class Cons_inputBusinessAwayMessage {
|
||||
public var flags: Int32
|
||||
public var shortcutId: Int32
|
||||
public var schedule: Api.BusinessAwayMessageSchedule
|
||||
public var recipients: Api.InputBusinessRecipients
|
||||
public init(flags: Int32, shortcutId: Int32, schedule: Api.BusinessAwayMessageSchedule, recipients: Api.InputBusinessRecipients) {
|
||||
self.flags = flags
|
||||
self.shortcutId = shortcutId
|
||||
self.schedule = schedule
|
||||
self.recipients = recipients
|
||||
}
|
||||
}
|
||||
case inputBusinessAwayMessage(Cons_inputBusinessAwayMessage)
|
||||
|
||||
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
||||
#if DEBUG
|
||||
|
|
|
|||
|
|
@ -1,6 +1,16 @@
|
|||
public extension Api {
|
||||
enum InputBusinessBotRecipients: TypeConstructorDescription {
|
||||
case inputBusinessBotRecipients(flags: Int32, users: [Api.InputUser]?, excludeUsers: [Api.InputUser]?)
|
||||
public class Cons_inputBusinessBotRecipients {
|
||||
public var flags: Int32
|
||||
public var users: [Api.InputUser]?
|
||||
public var excludeUsers: [Api.InputUser]?
|
||||
public init(flags: Int32, users: [Api.InputUser]?, excludeUsers: [Api.InputUser]?) {
|
||||
self.flags = flags
|
||||
self.users = users
|
||||
self.excludeUsers = excludeUsers
|
||||
}
|
||||
}
|
||||
case inputBusinessBotRecipients(Cons_inputBusinessBotRecipients)
|
||||
|
||||
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
||||
#if DEBUG
|
||||
|
|
@ -29,7 +39,19 @@ public extension Api {
|
|||
}
|
||||
public extension Api {
|
||||
enum InputBusinessChatLink: TypeConstructorDescription {
|
||||
case inputBusinessChatLink(flags: Int32, message: String, entities: [Api.MessageEntity]?, title: String?)
|
||||
public class Cons_inputBusinessChatLink {
|
||||
public var flags: Int32
|
||||
public var message: String
|
||||
public var entities: [Api.MessageEntity]?
|
||||
public var title: String?
|
||||
public init(flags: Int32, message: String, entities: [Api.MessageEntity]?, title: String?) {
|
||||
self.flags = flags
|
||||
self.message = message
|
||||
self.entities = entities
|
||||
self.title = title
|
||||
}
|
||||
}
|
||||
case inputBusinessChatLink(Cons_inputBusinessChatLink)
|
||||
|
||||
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
||||
#if DEBUG
|
||||
|
|
@ -58,7 +80,17 @@ public extension Api {
|
|||
}
|
||||
public extension Api {
|
||||
enum InputBusinessGreetingMessage: TypeConstructorDescription {
|
||||
case inputBusinessGreetingMessage(shortcutId: Int32, recipients: Api.InputBusinessRecipients, noActivityDays: Int32)
|
||||
public class Cons_inputBusinessGreetingMessage {
|
||||
public var shortcutId: Int32
|
||||
public var recipients: Api.InputBusinessRecipients
|
||||
public var noActivityDays: Int32
|
||||
public init(shortcutId: Int32, recipients: Api.InputBusinessRecipients, noActivityDays: Int32) {
|
||||
self.shortcutId = shortcutId
|
||||
self.recipients = recipients
|
||||
self.noActivityDays = noActivityDays
|
||||
}
|
||||
}
|
||||
case inputBusinessGreetingMessage(Cons_inputBusinessGreetingMessage)
|
||||
|
||||
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
||||
#if DEBUG
|
||||
|
|
@ -87,7 +119,19 @@ public extension Api {
|
|||
}
|
||||
public extension Api {
|
||||
enum InputBusinessIntro: TypeConstructorDescription {
|
||||
case inputBusinessIntro(flags: Int32, title: String, description: String, sticker: Api.InputDocument?)
|
||||
public class Cons_inputBusinessIntro {
|
||||
public var flags: Int32
|
||||
public var title: String
|
||||
public var description: String
|
||||
public var sticker: Api.InputDocument?
|
||||
public init(flags: Int32, title: String, description: String, sticker: Api.InputDocument?) {
|
||||
self.flags = flags
|
||||
self.title = title
|
||||
self.description = description
|
||||
self.sticker = sticker
|
||||
}
|
||||
}
|
||||
case inputBusinessIntro(Cons_inputBusinessIntro)
|
||||
|
||||
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
||||
#if DEBUG
|
||||
|
|
@ -116,7 +160,15 @@ public extension Api {
|
|||
}
|
||||
public extension Api {
|
||||
enum InputBusinessRecipients: TypeConstructorDescription {
|
||||
case inputBusinessRecipients(flags: Int32, users: [Api.InputUser]?)
|
||||
public class Cons_inputBusinessRecipients {
|
||||
public var flags: Int32
|
||||
public var users: [Api.InputUser]?
|
||||
public init(flags: Int32, users: [Api.InputUser]?) {
|
||||
self.flags = flags
|
||||
self.users = users
|
||||
}
|
||||
}
|
||||
case inputBusinessRecipients(Cons_inputBusinessRecipients)
|
||||
|
||||
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
||||
#if DEBUG
|
||||
|
|
@ -145,9 +197,27 @@ public extension Api {
|
|||
}
|
||||
public extension Api {
|
||||
indirect enum InputChannel: TypeConstructorDescription {
|
||||
case inputChannel(channelId: Int64, accessHash: Int64)
|
||||
public class Cons_inputChannel {
|
||||
public var channelId: Int64
|
||||
public var accessHash: Int64
|
||||
public init(channelId: Int64, accessHash: Int64) {
|
||||
self.channelId = channelId
|
||||
self.accessHash = accessHash
|
||||
}
|
||||
}
|
||||
public class Cons_inputChannelFromMessage {
|
||||
public var peer: Api.InputPeer
|
||||
public var msgId: Int32
|
||||
public var channelId: Int64
|
||||
public init(peer: Api.InputPeer, msgId: Int32, channelId: Int64) {
|
||||
self.peer = peer
|
||||
self.msgId = msgId
|
||||
self.channelId = channelId
|
||||
}
|
||||
}
|
||||
case inputChannel(Cons_inputChannel)
|
||||
case inputChannelEmpty
|
||||
case inputChannelFromMessage(peer: Api.InputPeer, msgId: Int32, channelId: Int64)
|
||||
case inputChannelFromMessage(Cons_inputChannelFromMessage)
|
||||
|
||||
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
||||
#if DEBUG
|
||||
|
|
@ -190,9 +260,29 @@ public extension Api {
|
|||
}
|
||||
public extension Api {
|
||||
enum InputChatPhoto: TypeConstructorDescription {
|
||||
case inputChatPhoto(id: Api.InputPhoto)
|
||||
public class Cons_inputChatPhoto {
|
||||
public var id: Api.InputPhoto
|
||||
public init(id: Api.InputPhoto) {
|
||||
self.id = id
|
||||
}
|
||||
}
|
||||
public class Cons_inputChatUploadedPhoto {
|
||||
public var flags: Int32
|
||||
public var file: Api.InputFile?
|
||||
public var video: Api.InputFile?
|
||||
public var videoStartTs: Double?
|
||||
public var videoEmojiMarkup: Api.VideoSize?
|
||||
public init(flags: Int32, file: Api.InputFile?, video: Api.InputFile?, videoStartTs: Double?, videoEmojiMarkup: Api.VideoSize?) {
|
||||
self.flags = flags
|
||||
self.file = file
|
||||
self.video = video
|
||||
self.videoStartTs = videoStartTs
|
||||
self.videoEmojiMarkup = videoEmojiMarkup
|
||||
}
|
||||
}
|
||||
case inputChatPhoto(Cons_inputChatPhoto)
|
||||
case inputChatPhotoEmpty
|
||||
case inputChatUploadedPhoto(flags: Int32, file: Api.InputFile?, video: Api.InputFile?, videoStartTs: Double?, videoEmojiMarkup: Api.VideoSize?)
|
||||
case inputChatUploadedPhoto(Cons_inputChatUploadedPhoto)
|
||||
|
||||
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
||||
#if DEBUG
|
||||
|
|
@ -235,9 +325,21 @@ public extension Api {
|
|||
}
|
||||
public extension Api {
|
||||
enum InputChatTheme: TypeConstructorDescription {
|
||||
case inputChatTheme(emoticon: String)
|
||||
public class Cons_inputChatTheme {
|
||||
public var emoticon: String
|
||||
public init(emoticon: String) {
|
||||
self.emoticon = emoticon
|
||||
}
|
||||
}
|
||||
public class Cons_inputChatThemeUniqueGift {
|
||||
public var slug: String
|
||||
public init(slug: String) {
|
||||
self.slug = slug
|
||||
}
|
||||
}
|
||||
case inputChatTheme(Cons_inputChatTheme)
|
||||
case inputChatThemeEmpty
|
||||
case inputChatThemeUniqueGift(slug: String)
|
||||
case inputChatThemeUniqueGift(Cons_inputChatThemeUniqueGift)
|
||||
|
||||
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
||||
#if DEBUG
|
||||
|
|
@ -280,7 +382,13 @@ public extension Api {
|
|||
}
|
||||
public extension Api {
|
||||
enum InputChatlist: TypeConstructorDescription {
|
||||
case inputChatlistDialogFilter(filterId: Int32)
|
||||
public class Cons_inputChatlistDialogFilter {
|
||||
public var filterId: Int32
|
||||
public init(filterId: Int32) {
|
||||
self.filterId = filterId
|
||||
}
|
||||
}
|
||||
case inputChatlistDialogFilter(Cons_inputChatlistDialogFilter)
|
||||
|
||||
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
||||
#if DEBUG
|
||||
|
|
@ -309,8 +417,18 @@ public extension Api {
|
|||
}
|
||||
public extension Api {
|
||||
enum InputCheckPasswordSRP: TypeConstructorDescription {
|
||||
public class Cons_inputCheckPasswordSRP {
|
||||
public var srpId: Int64
|
||||
public var A: Buffer
|
||||
public var M1: Buffer
|
||||
public init(srpId: Int64, A: Buffer, M1: Buffer) {
|
||||
self.srpId = srpId
|
||||
self.A = A
|
||||
self.M1 = M1
|
||||
}
|
||||
}
|
||||
case inputCheckPasswordEmpty
|
||||
case inputCheckPasswordSRP(srpId: Int64, A: Buffer, M1: Buffer)
|
||||
case inputCheckPasswordSRP(Cons_inputCheckPasswordSRP)
|
||||
|
||||
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
||||
#if DEBUG
|
||||
|
|
@ -346,7 +464,15 @@ public extension Api {
|
|||
}
|
||||
public extension Api {
|
||||
enum InputClientProxy: TypeConstructorDescription {
|
||||
case inputClientProxy(address: String, port: Int32)
|
||||
public class Cons_inputClientProxy {
|
||||
public var address: String
|
||||
public var port: Int32
|
||||
public init(address: String, port: Int32) {
|
||||
self.address = address
|
||||
self.port = port
|
||||
}
|
||||
}
|
||||
case inputClientProxy(Cons_inputClientProxy)
|
||||
|
||||
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
||||
#if DEBUG
|
||||
|
|
@ -375,8 +501,20 @@ public extension Api {
|
|||
}
|
||||
public extension Api {
|
||||
enum InputCollectible: TypeConstructorDescription {
|
||||
case inputCollectiblePhone(phone: String)
|
||||
case inputCollectibleUsername(username: String)
|
||||
public class Cons_inputCollectiblePhone {
|
||||
public var phone: String
|
||||
public init(phone: String) {
|
||||
self.phone = phone
|
||||
}
|
||||
}
|
||||
public class Cons_inputCollectibleUsername {
|
||||
public var username: String
|
||||
public init(username: String) {
|
||||
self.username = username
|
||||
}
|
||||
}
|
||||
case inputCollectiblePhone(Cons_inputCollectiblePhone)
|
||||
case inputCollectibleUsername(Cons_inputCollectibleUsername)
|
||||
|
||||
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
||||
#if DEBUG
|
||||
|
|
@ -412,7 +550,23 @@ public extension Api {
|
|||
}
|
||||
public extension Api {
|
||||
enum InputContact: TypeConstructorDescription {
|
||||
case inputPhoneContact(flags: Int32, clientId: Int64, phone: String, firstName: String, lastName: String, note: Api.TextWithEntities?)
|
||||
public class Cons_inputPhoneContact {
|
||||
public var flags: Int32
|
||||
public var clientId: Int64
|
||||
public var phone: String
|
||||
public var firstName: String
|
||||
public var lastName: String
|
||||
public var note: Api.TextWithEntities?
|
||||
public init(flags: Int32, clientId: Int64, phone: String, firstName: String, lastName: String, note: Api.TextWithEntities?) {
|
||||
self.flags = flags
|
||||
self.clientId = clientId
|
||||
self.phone = phone
|
||||
self.firstName = firstName
|
||||
self.lastName = lastName
|
||||
self.note = note
|
||||
}
|
||||
}
|
||||
case inputPhoneContact(Cons_inputPhoneContact)
|
||||
|
||||
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
||||
#if DEBUG
|
||||
|
|
@ -441,8 +595,20 @@ public extension Api {
|
|||
}
|
||||
public extension Api {
|
||||
indirect enum InputDialogPeer: TypeConstructorDescription {
|
||||
case inputDialogPeer(peer: Api.InputPeer)
|
||||
case inputDialogPeerFolder(folderId: Int32)
|
||||
public class Cons_inputDialogPeer {
|
||||
public var peer: Api.InputPeer
|
||||
public init(peer: Api.InputPeer) {
|
||||
self.peer = peer
|
||||
}
|
||||
}
|
||||
public class Cons_inputDialogPeerFolder {
|
||||
public var folderId: Int32
|
||||
public init(folderId: Int32) {
|
||||
self.folderId = folderId
|
||||
}
|
||||
}
|
||||
case inputDialogPeer(Cons_inputDialogPeer)
|
||||
case inputDialogPeerFolder(Cons_inputDialogPeerFolder)
|
||||
|
||||
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
||||
#if DEBUG
|
||||
|
|
@ -478,7 +644,17 @@ public extension Api {
|
|||
}
|
||||
public extension Api {
|
||||
enum InputDocument: TypeConstructorDescription {
|
||||
case inputDocument(id: Int64, accessHash: Int64, fileReference: Buffer)
|
||||
public class Cons_inputDocument {
|
||||
public var id: Int64
|
||||
public var accessHash: Int64
|
||||
public var fileReference: Buffer
|
||||
public init(id: Int64, accessHash: Int64, fileReference: Buffer) {
|
||||
self.id = id
|
||||
self.accessHash = accessHash
|
||||
self.fileReference = fileReference
|
||||
}
|
||||
}
|
||||
case inputDocument(Cons_inputDocument)
|
||||
case inputDocumentEmpty
|
||||
|
||||
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
||||
|
|
@ -515,7 +691,15 @@ public extension Api {
|
|||
}
|
||||
public extension Api {
|
||||
enum InputEncryptedChat: TypeConstructorDescription {
|
||||
case inputEncryptedChat(chatId: Int32, accessHash: Int64)
|
||||
public class Cons_inputEncryptedChat {
|
||||
public var chatId: Int32
|
||||
public var accessHash: Int64
|
||||
public init(chatId: Int32, accessHash: Int64) {
|
||||
self.chatId = chatId
|
||||
self.accessHash = accessHash
|
||||
}
|
||||
}
|
||||
case inputEncryptedChat(Cons_inputEncryptedChat)
|
||||
|
||||
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
||||
#if DEBUG
|
||||
|
|
@ -544,10 +728,40 @@ public extension Api {
|
|||
}
|
||||
public extension Api {
|
||||
enum InputEncryptedFile: TypeConstructorDescription {
|
||||
case inputEncryptedFile(id: Int64, accessHash: Int64)
|
||||
case inputEncryptedFileBigUploaded(id: Int64, parts: Int32, keyFingerprint: Int32)
|
||||
public class Cons_inputEncryptedFile {
|
||||
public var id: Int64
|
||||
public var accessHash: Int64
|
||||
public init(id: Int64, accessHash: Int64) {
|
||||
self.id = id
|
||||
self.accessHash = accessHash
|
||||
}
|
||||
}
|
||||
public class Cons_inputEncryptedFileBigUploaded {
|
||||
public var id: Int64
|
||||
public var parts: Int32
|
||||
public var keyFingerprint: Int32
|
||||
public init(id: Int64, parts: Int32, keyFingerprint: Int32) {
|
||||
self.id = id
|
||||
self.parts = parts
|
||||
self.keyFingerprint = keyFingerprint
|
||||
}
|
||||
}
|
||||
public class Cons_inputEncryptedFileUploaded {
|
||||
public var id: Int64
|
||||
public var parts: Int32
|
||||
public var md5Checksum: String
|
||||
public var keyFingerprint: Int32
|
||||
public init(id: Int64, parts: Int32, md5Checksum: String, keyFingerprint: Int32) {
|
||||
self.id = id
|
||||
self.parts = parts
|
||||
self.md5Checksum = md5Checksum
|
||||
self.keyFingerprint = keyFingerprint
|
||||
}
|
||||
}
|
||||
case inputEncryptedFile(Cons_inputEncryptedFile)
|
||||
case inputEncryptedFileBigUploaded(Cons_inputEncryptedFileBigUploaded)
|
||||
case inputEncryptedFileEmpty
|
||||
case inputEncryptedFileUploaded(id: Int64, parts: Int32, md5Checksum: String, keyFingerprint: Int32)
|
||||
case inputEncryptedFileUploaded(Cons_inputEncryptedFileUploaded)
|
||||
|
||||
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
||||
#if DEBUG
|
||||
|
|
@ -597,9 +811,37 @@ public extension Api {
|
|||
}
|
||||
public extension Api {
|
||||
enum InputFile: TypeConstructorDescription {
|
||||
case inputFile(id: Int64, parts: Int32, name: String, md5Checksum: String)
|
||||
case inputFileBig(id: Int64, parts: Int32, name: String)
|
||||
case inputFileStoryDocument(id: Api.InputDocument)
|
||||
public class Cons_inputFile {
|
||||
public var id: Int64
|
||||
public var parts: Int32
|
||||
public var name: String
|
||||
public var md5Checksum: String
|
||||
public init(id: Int64, parts: Int32, name: String, md5Checksum: String) {
|
||||
self.id = id
|
||||
self.parts = parts
|
||||
self.name = name
|
||||
self.md5Checksum = md5Checksum
|
||||
}
|
||||
}
|
||||
public class Cons_inputFileBig {
|
||||
public var id: Int64
|
||||
public var parts: Int32
|
||||
public var name: String
|
||||
public init(id: Int64, parts: Int32, name: String) {
|
||||
self.id = id
|
||||
self.parts = parts
|
||||
self.name = name
|
||||
}
|
||||
}
|
||||
public class Cons_inputFileStoryDocument {
|
||||
public var id: Api.InputDocument
|
||||
public init(id: Api.InputDocument) {
|
||||
self.id = id
|
||||
}
|
||||
}
|
||||
case inputFile(Cons_inputFile)
|
||||
case inputFileBig(Cons_inputFileBig)
|
||||
case inputFileStoryDocument(Cons_inputFileStoryDocument)
|
||||
|
||||
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
||||
#if DEBUG
|
||||
|
|
|
|||
|
|
@ -866,7 +866,7 @@ func verifyPassword(_ account: UnauthorizedAccount, password: String) -> Signal<
|
|||
let kdfResult = passwordKDF(encryptionProvider: account.network.encryptionProvider, password: password, derivation: currentPasswordDerivation, srpSessionData: srpSessionData)
|
||||
|
||||
if let kdfResult = kdfResult {
|
||||
return account.network.request(Api.functions.auth.checkPassword(password: .inputCheckPasswordSRP(srpId: kdfResult.id, A: Buffer(data: kdfResult.A), M1: Buffer(data: kdfResult.M1))), automaticFloodWait: false)
|
||||
return account.network.request(Api.functions.auth.checkPassword(password: .inputCheckPasswordSRP(.init(srpId: kdfResult.id, A: Buffer(data: kdfResult.A), M1: Buffer(data: kdfResult.M1)))), automaticFloodWait: false)
|
||||
} else {
|
||||
return .fail(MTRpcError(errorCode: 400, errorDescription: "KDF_ERROR"))
|
||||
}
|
||||
|
|
@ -1525,7 +1525,7 @@ public class Account {
|
|||
return .complete()
|
||||
} else {
|
||||
return network.request(Api.functions.help.saveAppLog(events: events.map { event -> Api.InputAppEvent in
|
||||
return .inputAppEvent(time: event.0, type: "", peer: 0, data: .jsonString(value: event.1))
|
||||
return .inputAppEvent(.init(time: event.0, type: "", peer: 0, data: .jsonString(value: event.1)))
|
||||
}))
|
||||
|> ignoreValues
|
||||
|> `catch` { _ -> Signal<Never, NoError> in
|
||||
|
|
|
|||
|
|
@ -31,7 +31,8 @@ func parseTelegramGroupOrChannel(chat: Api.Chat) -> Peer? {
|
|||
var migrationReference: TelegramGroupToChannelMigrationReference?
|
||||
if let migratedTo = migratedTo {
|
||||
switch migratedTo {
|
||||
case let .inputChannel(channelId, accessHash):
|
||||
case let .inputChannel(inputChannelData):
|
||||
let (channelId, accessHash) = (inputChannelData.channelId, inputChannelData.accessHash)
|
||||
migrationReference = TelegramGroupToChannelMigrationReference(peerId: PeerId(namespace: Namespaces.Peer.CloudChannel, id: PeerId.Id._internalFromInt64Value(channelId)), accessHash: accessHash)
|
||||
case .inputChannelEmpty:
|
||||
break
|
||||
|
|
|
|||
|
|
@ -38,7 +38,7 @@ extension PeerReference {
|
|||
|
||||
var inputChannel: Api.InputChannel? {
|
||||
if case let .channel(id, accessHash) = self {
|
||||
return .inputChannel(channelId: id, accessHash: accessHash)
|
||||
return .inputChannel(.init(channelId: id, accessHash: accessHash))
|
||||
} else {
|
||||
return nil
|
||||
}
|
||||
|
|
@ -88,7 +88,7 @@ func apiInputPeerOrSelf(_ peer: Peer, accountPeerId: PeerId) -> Api.InputPeer? {
|
|||
|
||||
func apiInputChannel(_ peer: Peer) -> Api.InputChannel? {
|
||||
if let channel = peer as? TelegramChannel, let accessHash = channel.accessHash {
|
||||
return Api.InputChannel.inputChannel(channelId: channel.id.id._internalGetInt64Value(), accessHash: accessHash.value)
|
||||
return Api.InputChannel.inputChannel(.init(channelId: channel.id.id._internalGetInt64Value(), accessHash: accessHash.value))
|
||||
} else {
|
||||
return nil
|
||||
}
|
||||
|
|
@ -104,7 +104,7 @@ func apiInputUser(_ peer: Peer) -> Api.InputUser? {
|
|||
|
||||
func apiInputSecretChat(_ peer: Peer) -> Api.InputEncryptedChat? {
|
||||
if let chat = peer as? TelegramSecretChat {
|
||||
return Api.InputEncryptedChat.inputEncryptedChat(chatId: Int32(peer.id.id._internalGetInt64Value()), accessHash: chat.accessHash)
|
||||
return Api.InputEncryptedChat.inputEncryptedChat(.init(chatId: Int32(peer.id.id._internalGetInt64Value()), accessHash: chat.accessHash))
|
||||
} else {
|
||||
return nil
|
||||
}
|
||||
|
|
|
|||
|
|
@ -28,19 +28,19 @@ public protocol TelegramCloudMediaResourceWithFileReference {
|
|||
|
||||
extension CloudFileMediaResource: TelegramCloudMediaResource, TelegramMultipartFetchableResource, TelegramCloudMediaResourceWithFileReference {
|
||||
func apiInputLocation(fileReference: Data?) -> Api.InputFileLocation? {
|
||||
return Api.InputFileLocation.inputFileLocation(volumeId: self.volumeId, localId: self.localId, secret: self.secret, fileReference: Buffer(data: fileReference ?? Data()))
|
||||
return Api.InputFileLocation.inputFileLocation(.init(volumeId: self.volumeId, localId: self.localId, secret: self.secret, fileReference: Buffer(data: fileReference ?? Data())))
|
||||
}
|
||||
}
|
||||
|
||||
extension CloudPhotoSizeMediaResource: TelegramCloudMediaResource, TelegramMultipartFetchableResource, TelegramCloudMediaResourceWithFileReference {
|
||||
func apiInputLocation(fileReference: Data?) -> Api.InputFileLocation? {
|
||||
return Api.InputFileLocation.inputPhotoFileLocation(id: self.photoId, accessHash: self.accessHash, fileReference: Buffer(data: fileReference ?? Data()), thumbSize: self.sizeSpec)
|
||||
return Api.InputFileLocation.inputPhotoFileLocation(.init(id: self.photoId, accessHash: self.accessHash, fileReference: Buffer(data: fileReference ?? Data()), thumbSize: self.sizeSpec))
|
||||
}
|
||||
}
|
||||
|
||||
extension CloudDocumentSizeMediaResource: TelegramCloudMediaResource, TelegramMultipartFetchableResource, TelegramCloudMediaResourceWithFileReference {
|
||||
func apiInputLocation(fileReference: Data?) -> Api.InputFileLocation? {
|
||||
return Api.InputFileLocation.inputDocumentFileLocation(id: self.documentId, accessHash: self.accessHash, fileReference: Buffer(data: fileReference ?? Data()), thumbSize: self.sizeSpec)
|
||||
return Api.InputFileLocation.inputDocumentFileLocation(.init(id: self.documentId, accessHash: self.accessHash, fileReference: Buffer(data: fileReference ?? Data()), thumbSize: self.sizeSpec))
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -54,7 +54,7 @@ extension CloudPeerPhotoSizeMediaResource: TelegramMultipartFetchableResource {
|
|||
flags = 1 << 0
|
||||
}
|
||||
if let photoId = self.photoId {
|
||||
return Api.InputFileLocation.inputPeerPhotoFileLocation(flags: flags, peer: peerReference.inputPeer, photoId: photoId)
|
||||
return Api.InputFileLocation.inputPeerPhotoFileLocation(.init(flags: flags, peer: peerReference.inputPeer, photoId: photoId))
|
||||
} else {
|
||||
return nil
|
||||
}
|
||||
|
|
@ -64,7 +64,7 @@ extension CloudPeerPhotoSizeMediaResource: TelegramMultipartFetchableResource {
|
|||
extension CloudStickerPackThumbnailMediaResource: TelegramMultipartFetchableResource {
|
||||
func apiInputLocation(packReference: StickerPackReference) -> Api.InputFileLocation? {
|
||||
if let thumbVersion = self.thumbVersion {
|
||||
return Api.InputFileLocation.inputStickerSetThumb(stickerset: packReference.apiInputStickerSet, thumbVersion: thumbVersion)
|
||||
return Api.InputFileLocation.inputStickerSetThumb(.init(stickerset: packReference.apiInputStickerSet, thumbVersion: thumbVersion))
|
||||
} else {
|
||||
return nil
|
||||
}
|
||||
|
|
@ -73,12 +73,12 @@ extension CloudStickerPackThumbnailMediaResource: TelegramMultipartFetchableReso
|
|||
|
||||
extension CloudDocumentMediaResource: TelegramCloudMediaResource, TelegramMultipartFetchableResource, TelegramCloudMediaResourceWithFileReference {
|
||||
func apiInputLocation(fileReference: Data?) -> Api.InputFileLocation? {
|
||||
return Api.InputFileLocation.inputDocumentFileLocation(id: self.fileId, accessHash: self.accessHash, fileReference: Buffer(data: fileReference ?? Data()), thumbSize: "")
|
||||
return Api.InputFileLocation.inputDocumentFileLocation(.init(id: self.fileId, accessHash: self.accessHash, fileReference: Buffer(data: fileReference ?? Data()), thumbSize: ""))
|
||||
}
|
||||
}
|
||||
|
||||
extension SecretFileMediaResource: TelegramCloudMediaResource, TelegramMultipartFetchableResource {
|
||||
func apiInputLocation(fileReference: Data?) -> Api.InputFileLocation? {
|
||||
return .inputEncryptedFileLocation(id: self.fileId, accessHash: self.accessHash)
|
||||
return .inputEncryptedFileLocation(.init(id: self.fileId, accessHash: self.accessHash))
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -79,14 +79,16 @@ func telegramMediaActionFromApiAction(_ action: Api.MessageAction) -> TelegramMe
|
|||
return TelegramMediaAction(action: .geoProximityReached(from: fromId.peerId, to: toId.peerId, distance: distance))
|
||||
case let .messageActionGroupCall(_, call, duration):
|
||||
switch call {
|
||||
case let .inputGroupCall(id, accessHash):
|
||||
case let .inputGroupCall(inputGroupCallData):
|
||||
let (id, accessHash) = (inputGroupCallData.id, inputGroupCallData.accessHash)
|
||||
return TelegramMediaAction(action: .groupPhoneCall(callId: id, accessHash: accessHash, scheduleDate: nil, duration: duration))
|
||||
case .inputGroupCallSlug, .inputGroupCallInviteMessage:
|
||||
return nil
|
||||
}
|
||||
case let .messageActionInviteToGroupCall(call, userIds):
|
||||
switch call {
|
||||
case let .inputGroupCall(id, accessHash):
|
||||
case let .inputGroupCall(inputGroupCallData):
|
||||
let (id, accessHash) = (inputGroupCallData.id, inputGroupCallData.accessHash)
|
||||
return TelegramMediaAction(action: .inviteToGroupPhoneCall(callId: id, accessHash: accessHash, peerIds: userIds.map { userId in
|
||||
PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt64Value(userId))
|
||||
}))
|
||||
|
|
@ -97,7 +99,8 @@ func telegramMediaActionFromApiAction(_ action: Api.MessageAction) -> TelegramMe
|
|||
return TelegramMediaAction(action: .messageAutoremoveTimeoutUpdated(period: period, autoSettingSource: autoSettingFrom.flatMap { PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt64Value($0)) }))
|
||||
case let .messageActionGroupCallScheduled(call, scheduleDate):
|
||||
switch call {
|
||||
case let .inputGroupCall(id, accessHash):
|
||||
case let .inputGroupCall(inputGroupCallData):
|
||||
let (id, accessHash) = (inputGroupCallData.id, inputGroupCallData.accessHash)
|
||||
return TelegramMediaAction(action: .groupPhoneCall(callId: id, accessHash: accessHash, scheduleDate: scheduleDate, duration: nil))
|
||||
case .inputGroupCallSlug, .inputGroupCallInviteMessage:
|
||||
return nil
|
||||
|
|
|
|||
|
|
@ -489,7 +489,7 @@ func _internal_setForumChannelPinnedTopics(account: Account, id: EnginePeer.Id,
|
|||
return account.postbox.transaction { transaction -> [Api.InputDialogPeer] in
|
||||
transaction.setPeerPinnedThreads(peerId: id, threadIds: threadIds)
|
||||
|
||||
return threadIds.compactMap { transaction.getPeer(PeerId($0)).flatMap(apiInputPeer).flatMap({ .inputDialogPeer(peer: $0) }) }
|
||||
return threadIds.compactMap { transaction.getPeer(PeerId($0)).flatMap(apiInputPeer).flatMap({ .inputDialogPeer(.init(peer: $0)) }) }
|
||||
}
|
||||
|> castError(SetForumChannelTopicPinnedError.self)
|
||||
|> mapToSignal { inputPeers -> Signal<Never, SetForumChannelTopicPinnedError> in
|
||||
|
|
|
|||
|
|
@ -505,18 +505,18 @@ func multipartUpload(network: Network, postbox: Postbox, source: MultipartUpload
|
|||
})
|
||||
}
|
||||
if let _ = result.bigTotalParts {
|
||||
let inputFile = Api.InputEncryptedFile.inputEncryptedFileBigUploaded(id: result.id, parts: result.partCount, keyFingerprint: fingerprint)
|
||||
let inputFile = Api.InputEncryptedFile.inputEncryptedFileBigUploaded(.init(id: result.id, parts: result.partCount, keyFingerprint: fingerprint))
|
||||
subscriber.putNext(.inputSecretFile(inputFile, result.size, encryptionKey))
|
||||
} else {
|
||||
let inputFile = Api.InputEncryptedFile.inputEncryptedFileUploaded(id: result.id, parts: result.partCount, md5Checksum: result.md5Digest, keyFingerprint: fingerprint)
|
||||
let inputFile = Api.InputEncryptedFile.inputEncryptedFileUploaded(.init(id: result.id, parts: result.partCount, md5Checksum: result.md5Digest, keyFingerprint: fingerprint))
|
||||
subscriber.putNext(.inputSecretFile(inputFile, result.size, encryptionKey))
|
||||
}
|
||||
} else {
|
||||
if let _ = result.bigTotalParts {
|
||||
let inputFile = Api.InputFile.inputFileBig(id: result.id, parts: result.partCount, name: "file.jpg")
|
||||
let inputFile = Api.InputFile.inputFileBig(.init(id: result.id, parts: result.partCount, name: "file.jpg"))
|
||||
subscriber.putNext(.inputFile(inputFile))
|
||||
} else {
|
||||
let inputFile = Api.InputFile.inputFile(id: result.id, parts: result.partCount, name: "file.jpg", md5Checksum: result.md5Digest)
|
||||
let inputFile = Api.InputFile.inputFile(.init(id: result.id, parts: result.partCount, name: "file.jpg", md5Checksum: result.md5Digest))
|
||||
subscriber.putNext(.inputFile(inputFile))
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -181,7 +181,7 @@ func mediaContentToUpload(accountPeerId: PeerId, network: Network, postbox: Post
|
|||
}
|
||||
if let image = media as? TelegramMediaImage, let largest = largestImageRepresentation(image.representations) {
|
||||
if peerId.namespace == Namespaces.Peer.SecretChat, let resource = largest.resource as? SecretFileMediaResource {
|
||||
return .single(.content(PendingMessageUploadedContentAndReuploadInfo(content: .secretMedia(.inputEncryptedFile(id: resource.fileId, accessHash: resource.accessHash), resource.decryptedSize, resource.key), reuploadInfo: nil, cacheReferenceKey: nil)))
|
||||
return .single(.content(PendingMessageUploadedContentAndReuploadInfo(content: .secretMedia(.inputEncryptedFile(.init(id: resource.fileId, accessHash: resource.accessHash)), resource.decryptedSize, resource.key), reuploadInfo: nil, cacheReferenceKey: nil)))
|
||||
}
|
||||
if peerId.namespace != Namespaces.Peer.SecretChat, let reference = image.reference, case let .cloud(id, accessHash, maybeFileReference) = reference, let fileReference = maybeFileReference {
|
||||
return .single(.content(PendingMessageUploadedContentAndReuploadInfo(content: .media(Api.InputMedia.inputMediaPhoto(flags: 0, id: Api.InputPhoto.inputPhoto(id: id, accessHash: accessHash, fileReference: Buffer(data: fileReference)), ttlSeconds: nil), text), reuploadInfo: nil, cacheReferenceKey: nil)))
|
||||
|
|
@ -244,7 +244,7 @@ func mediaContentToUpload(accountPeerId: PeerId, network: Network, postbox: Post
|
|||
flags |= 1 << 4
|
||||
}
|
||||
|
||||
return .single(.content(PendingMessageUploadedContentAndReuploadInfo(content: .media(Api.InputMedia.inputMediaDocument(flags: flags, id: Api.InputDocument.inputDocument(id: resource.fileId, accessHash: resource.accessHash, fileReference: Buffer(data: reference)), videoCover: nil, videoTimestamp: videoTimestamp, ttlSeconds: nil, query: nil), text), reuploadInfo: nil, cacheReferenceKey: nil)))
|
||||
return .single(.content(PendingMessageUploadedContentAndReuploadInfo(content: .media(Api.InputMedia.inputMediaDocument(flags: flags, id: Api.InputDocument.inputDocument(.init(id: resource.fileId, accessHash: resource.accessHash, fileReference: Buffer(data: reference))), videoCover: nil, videoTimestamp: videoTimestamp, ttlSeconds: nil, query: nil), text), reuploadInfo: nil, cacheReferenceKey: nil)))
|
||||
} else {
|
||||
return .fail(.generic)
|
||||
}
|
||||
|
|
@ -265,7 +265,7 @@ func mediaContentToUpload(accountPeerId: PeerId, network: Network, postbox: Post
|
|||
}
|
||||
}
|
||||
|
||||
return .single(.content(PendingMessageUploadedContentAndReuploadInfo(content: .media(Api.InputMedia.inputMediaDocument(flags: flags, id: Api.InputDocument.inputDocument(id: resource.fileId, accessHash: resource.accessHash, fileReference: Buffer(data: resource.fileReference ?? Data())), videoCover: nil, videoTimestamp: videoTimestamp, ttlSeconds: nil, query: emojiSearchQuery), text), reuploadInfo: nil, cacheReferenceKey: nil)))
|
||||
return .single(.content(PendingMessageUploadedContentAndReuploadInfo(content: .media(Api.InputMedia.inputMediaDocument(flags: flags, id: Api.InputDocument.inputDocument(.init(id: resource.fileId, accessHash: resource.accessHash, fileReference: Buffer(data: resource.fileReference ?? Data()))), videoCover: nil, videoTimestamp: videoTimestamp, ttlSeconds: nil, query: emojiSearchQuery), text), reuploadInfo: nil, cacheReferenceKey: nil)))
|
||||
}
|
||||
} else {
|
||||
return uploadedMediaFileContent(network: network, postbox: postbox, auxiliaryMethods: auxiliaryMethods, transformOutgoingMessageMedia: transformOutgoingMessageMedia, messageMediaPreuploadManager: messageMediaPreuploadManager, forceReupload: forceReupload, isGrouped: isGrouped, isPaid: false, passFetchProgress: passFetchProgress, forceNoBigParts: forceNoBigParts, peerId: peerId, messageId: messageId, text: text, attributes: attributes, autoremoveMessageAttribute: autoremoveMessageAttribute, autoclearMessageAttribute: autoclearMessageAttribute, file: file)
|
||||
|
|
@ -287,11 +287,11 @@ func mediaContentToUpload(accountPeerId: PeerId, network: Network, postbox: Post
|
|||
geoFlags |= 1 << 0
|
||||
}
|
||||
if let liveBroadcastingTimeout = map.liveBroadcastingTimeout {
|
||||
input = .inputMediaGeoLive(flags: flags, geoPoint: Api.InputGeoPoint.inputGeoPoint(flags: geoFlags, lat: map.latitude, long: map.longitude, accuracyRadius: map.accuracyRadius.flatMap({ Int32($0) })), heading: map.heading, period: liveBroadcastingTimeout, proximityNotificationRadius: map.liveProximityNotificationRadius.flatMap({ Int32($0) }))
|
||||
input = .inputMediaGeoLive(flags: flags, geoPoint: Api.InputGeoPoint.inputGeoPoint(.init(flags: geoFlags, lat: map.latitude, long: map.longitude, accuracyRadius: map.accuracyRadius.flatMap({ Int32($0) }))), heading: map.heading, period: liveBroadcastingTimeout, proximityNotificationRadius: map.liveProximityNotificationRadius.flatMap({ Int32($0) }))
|
||||
} else if let venue = map.venue {
|
||||
input = .inputMediaVenue(geoPoint: Api.InputGeoPoint.inputGeoPoint(flags: geoFlags, lat: map.latitude, long: map.longitude, accuracyRadius: map.accuracyRadius.flatMap({ Int32($0) })), title: venue.title, address: venue.address ?? "", provider: venue.provider ?? "", venueId: venue.id ?? "", venueType: venue.type ?? "")
|
||||
input = .inputMediaVenue(geoPoint: Api.InputGeoPoint.inputGeoPoint(.init(flags: geoFlags, lat: map.latitude, long: map.longitude, accuracyRadius: map.accuracyRadius.flatMap({ Int32($0) }))), title: venue.title, address: venue.address ?? "", provider: venue.provider ?? "", venueId: venue.id ?? "", venueType: venue.type ?? "")
|
||||
} else {
|
||||
input = .inputMediaGeoPoint(geoPoint: Api.InputGeoPoint.inputGeoPoint(flags: geoFlags, lat: map.latitude, long: map.longitude, accuracyRadius: map.accuracyRadius.flatMap({ Int32($0) })))
|
||||
input = .inputMediaGeoPoint(geoPoint: Api.InputGeoPoint.inputGeoPoint(.init(flags: geoFlags, lat: map.latitude, long: map.longitude, accuracyRadius: map.accuracyRadius.flatMap({ Int32($0) }))))
|
||||
}
|
||||
return .single(.content(PendingMessageUploadedContentAndReuploadInfo(content: .media(input, text), reuploadInfo: nil, cacheReferenceKey: nil)))
|
||||
} else if let poll = media as? TelegramMediaPoll {
|
||||
|
|
@ -657,7 +657,7 @@ if "".isEmpty {
|
|||
var stickersValue: [Api.InputDocument] = []
|
||||
for file in attribute.files {
|
||||
if let resource = file.resource as? CloudDocumentMediaResource, let fileReference = resource.fileReference {
|
||||
stickersValue.append(Api.InputDocument.inputDocument(id: resource.fileId, accessHash: resource.accessHash, fileReference: Buffer(data: fileReference)))
|
||||
stickersValue.append(Api.InputDocument.inputDocument(.init(id: resource.fileId, accessHash: resource.accessHash, fileReference: Buffer(data: fileReference))))
|
||||
}
|
||||
}
|
||||
if !stickersValue.isEmpty {
|
||||
|
|
@ -947,7 +947,7 @@ private func uploadedMediaFileContent(network: Network, postbox: Postbox, auxili
|
|||
|
||||
return .single(.progress(PendingMessageUploadedContentProgress(progress: 1.0)))
|
||||
|> then(
|
||||
.single(.content(PendingMessageUploadedContentAndReuploadInfo(content: .media(Api.InputMedia.inputMediaDocument(flags: flags, id: Api.InputDocument.inputDocument(id: resource.fileId, accessHash: resource.accessHash, fileReference: Buffer(data: fileReference)), videoCover: videoCoverPhoto, videoTimestamp: videoTimestamp, ttlSeconds: ttlSeconds, query: nil), text), reuploadInfo: nil, cacheReferenceKey: nil)))
|
||||
.single(.content(PendingMessageUploadedContentAndReuploadInfo(content: .media(Api.InputMedia.inputMediaDocument(flags: flags, id: Api.InputDocument.inputDocument(.init(id: resource.fileId, accessHash: resource.accessHash, fileReference: Buffer(data: fileReference))), videoCover: videoCoverPhoto, videoTimestamp: videoTimestamp, ttlSeconds: ttlSeconds, query: nil), text), reuploadInfo: nil, cacheReferenceKey: nil)))
|
||||
)
|
||||
}
|
||||
}
|
||||
|
|
@ -1195,7 +1195,7 @@ private func uploadedMediaFileContent(network: Network, postbox: Postbox, auxili
|
|||
var stickersValue: [Api.InputDocument] = []
|
||||
for file in attribute.files {
|
||||
if let resource = file.resource as? CloudDocumentMediaResource, let fileReference = resource.fileReference {
|
||||
stickersValue.append(Api.InputDocument.inputDocument(id: resource.fileId, accessHash: resource.accessHash, fileReference: Buffer(data: fileReference)))
|
||||
stickersValue.append(Api.InputDocument.inputDocument(.init(id: resource.fileId, accessHash: resource.accessHash, fileReference: Buffer(data: fileReference))))
|
||||
}
|
||||
}
|
||||
if !stickersValue.isEmpty {
|
||||
|
|
@ -1248,7 +1248,7 @@ private func uploadedMediaFileContent(network: Network, postbox: Postbox, auxili
|
|||
flags |= (1 << 4)
|
||||
}
|
||||
|
||||
let result: PendingMessageUploadedContentResult = .content(PendingMessageUploadedContentAndReuploadInfo(content: .media(.inputMediaDocument(flags: flags, id: .inputDocument(id: resource.fileId, accessHash: resource.accessHash, fileReference: Buffer(data: fileReference)), videoCover: videoCoverPhoto, videoTimestamp: videoTimestamp, ttlSeconds: ttlSeconds, query: nil), text), reuploadInfo: nil, cacheReferenceKey: nil))
|
||||
let result: PendingMessageUploadedContentResult = .content(PendingMessageUploadedContentAndReuploadInfo(content: .media(.inputMediaDocument(flags: flags, id: .inputDocument(.init(id: resource.fileId, accessHash: resource.accessHash, fileReference: Buffer(data: fileReference))), videoCover: videoCoverPhoto, videoTimestamp: videoTimestamp, ttlSeconds: ttlSeconds, query: nil), text), reuploadInfo: nil, cacheReferenceKey: nil))
|
||||
if let _ = ttlSeconds {
|
||||
return .single(result)
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -315,13 +315,13 @@ func _internal_requestEditLiveLocation(postbox: Postbox, network: Network, state
|
|||
if let _ = coordinate.accuracyRadius {
|
||||
geoFlags |= 1 << 0
|
||||
}
|
||||
inputGeoPoint = .inputGeoPoint(flags: geoFlags, lat: coordinate.latitude, long: coordinate.longitude, accuracyRadius: coordinate.accuracyRadius.flatMap({ Int32($0) }))
|
||||
inputGeoPoint = .inputGeoPoint(.init(flags: geoFlags, lat: coordinate.latitude, long: coordinate.longitude, accuracyRadius: coordinate.accuracyRadius.flatMap({ Int32($0) })))
|
||||
} else {
|
||||
var geoFlags: Int32 = 0
|
||||
if let _ = media.accuracyRadius {
|
||||
geoFlags |= 1 << 0
|
||||
}
|
||||
inputGeoPoint = .inputGeoPoint(flags: geoFlags, lat: media.latitude, long: media.longitude, accuracyRadius: media.accuracyRadius.flatMap({ Int32($0) }))
|
||||
inputGeoPoint = .inputGeoPoint(.init(flags: geoFlags, lat: media.latitude, long: media.longitude, accuracyRadius: media.accuracyRadius.flatMap({ Int32($0) })))
|
||||
}
|
||||
if let _ = heading {
|
||||
flags |= 1 << 2
|
||||
|
|
@ -343,7 +343,7 @@ func _internal_requestEditLiveLocation(postbox: Postbox, network: Network, state
|
|||
|
||||
inputMedia = .inputMediaGeoLive(flags: flags, geoPoint: inputGeoPoint, heading: heading, period: period, proximityNotificationRadius: proximityNotificationRadius)
|
||||
} else {
|
||||
inputMedia = .inputMediaGeoLive(flags: 1 << 0, geoPoint: .inputGeoPoint(flags: 0, lat: media.latitude, long: media.longitude, accuracyRadius: nil), heading: nil, period: nil, proximityNotificationRadius: nil)
|
||||
inputMedia = .inputMediaGeoLive(flags: 1 << 0, geoPoint: .inputGeoPoint(.init(flags: 0, lat: media.latitude, long: media.longitude, accuracyRadius: nil)), heading: nil, period: nil, proximityNotificationRadius: nil)
|
||||
}
|
||||
|
||||
return network.request(Api.functions.messages.editMessage(flags: 1 << 14, peer: inputPeer, id: messageId.id, message: nil, media: inputMedia, replyMarkup: nil, entities: nil, scheduleDate: nil, scheduleRepeatPeriod: nil, quickReplyShortcutId: nil))
|
||||
|
|
|
|||
|
|
@ -765,7 +765,8 @@ private func uploadedImage(account: Account, data: Data) -> Signal<UploadMediaEv
|
|||
|> mapError { _ -> StandaloneSendMessageError in return .generic }
|
||||
|> map { next -> UploadMediaEvent in
|
||||
switch next {
|
||||
case let .inputFile(inputFile):
|
||||
case let .inputFile(inputFileData):
|
||||
let inputFile = inputFileData
|
||||
return .result(Api.InputMedia.inputMediaUploadedPhoto(flags: 0, file: inputFile, stickers: nil, ttlSeconds: nil))
|
||||
case .inputSecretFile:
|
||||
preconditionFailure()
|
||||
|
|
@ -780,7 +781,8 @@ private func uploadedFile(account: Account, data: Data, mimeType: String, attrib
|
|||
|> mapError { _ -> PendingMessageUploadError in return .generic }
|
||||
|> map { next -> UploadMediaEvent in
|
||||
switch next {
|
||||
case let .inputFile(inputFile):
|
||||
case let .inputFile(inputFileData):
|
||||
let inputFile = inputFileData
|
||||
return .result(Api.InputMedia.inputMediaUploadedDocument(flags: 0, file: inputFile, thumb: nil, mimeType: mimeType, attributes: inputDocumentAttributesFromFileAttributes(attributes), stickers: nil, videoCover: nil, videoTimestamp: nil, ttlSeconds: nil))
|
||||
case .inputSecretFile:
|
||||
preconditionFailure()
|
||||
|
|
|
|||
|
|
@ -86,7 +86,7 @@ public func standaloneUploadedImage(postbox: Postbox, network: Network, peerId:
|
|||
case let .inputSecretFile(file, _, key):
|
||||
return postbox.transaction { transaction -> Api.InputEncryptedChat? in
|
||||
if let peer = transaction.getPeer(peerId) as? TelegramSecretChat {
|
||||
return Api.InputEncryptedChat.inputEncryptedChat(chatId: Int32(peer.id.id._internalGetInt64Value()), accessHash: peer.accessHash)
|
||||
return Api.InputEncryptedChat.inputEncryptedChat(.init(chatId: Int32(peer.id.id._internalGetInt64Value()), accessHash: peer.accessHash))
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
|
@ -181,7 +181,7 @@ public func standaloneUploadedFile(postbox: Postbox, network: Network, peerId: P
|
|||
case let .inputSecretFile(file, _, key):
|
||||
return postbox.transaction { transaction -> Api.InputEncryptedChat? in
|
||||
if let peer = transaction.getPeer(peerId) as? TelegramSecretChat {
|
||||
return Api.InputEncryptedChat.inputEncryptedChat(chatId: Int32(peer.id.id._internalGetInt64Value()), accessHash: peer.accessHash)
|
||||
return Api.InputEncryptedChat.inputEncryptedChat(.init(chatId: Int32(peer.id.id._internalGetInt64Value()), accessHash: peer.accessHash))
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,11 +6,14 @@ import TelegramApi
|
|||
extension SecretChatOutgoingFileReference {
|
||||
init?(_ apiFile: Api.InputEncryptedFile) {
|
||||
switch apiFile {
|
||||
case let .inputEncryptedFile(id, accessHash):
|
||||
case let .inputEncryptedFile(inputEncryptedFileData):
|
||||
let (id, accessHash) = (inputEncryptedFileData.id, inputEncryptedFileData.accessHash)
|
||||
self = .remote(id: id, accessHash: accessHash)
|
||||
case let .inputEncryptedFileBigUploaded(id, parts, keyFingerprint):
|
||||
case let .inputEncryptedFileBigUploaded(inputEncryptedFileBigUploadedData):
|
||||
let (id, parts, keyFingerprint) = (inputEncryptedFileBigUploadedData.id, inputEncryptedFileBigUploadedData.parts, inputEncryptedFileBigUploadedData.keyFingerprint)
|
||||
self = .uploadedLarge(id: id, partCount: parts, keyFingerprint: keyFingerprint)
|
||||
case let .inputEncryptedFileUploaded(id, parts, md5Checksum, keyFingerprint):
|
||||
case let .inputEncryptedFileUploaded(inputEncryptedFileUploadedData):
|
||||
let (id, parts, md5Checksum, keyFingerprint) = (inputEncryptedFileUploadedData.id, inputEncryptedFileUploadedData.parts, inputEncryptedFileUploadedData.md5Checksum, inputEncryptedFileUploadedData.keyFingerprint)
|
||||
self = .uploadedRegular(id: id, partCount: parts, md5Digest: md5Checksum, keyFingerprint: keyFingerprint)
|
||||
case .inputEncryptedFileEmpty:
|
||||
return nil
|
||||
|
|
@ -20,11 +23,11 @@ extension SecretChatOutgoingFileReference {
|
|||
var apiInputFile: Api.InputEncryptedFile {
|
||||
switch self {
|
||||
case let .remote(id, accessHash):
|
||||
return .inputEncryptedFile(id: id, accessHash: accessHash)
|
||||
return .inputEncryptedFile(.init(id: id, accessHash: accessHash))
|
||||
case let .uploadedRegular(id, partCount, md5Digest, keyFingerprint):
|
||||
return .inputEncryptedFileUploaded(id: id, parts: partCount, md5Checksum: md5Digest, keyFingerprint: keyFingerprint)
|
||||
return .inputEncryptedFileUploaded(.init(id: id, parts: partCount, md5Checksum: md5Digest, keyFingerprint: keyFingerprint))
|
||||
case let .uploadedLarge(id, partCount, keyFingerprint):
|
||||
return .inputEncryptedFileBigUploaded(id: id, parts: partCount, keyFingerprint: keyFingerprint)
|
||||
return .inputEncryptedFileBigUploaded(.init(id: id, parts: partCount, keyFingerprint: keyFingerprint))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1681,7 +1681,8 @@ private func finalStateWithUpdatesAndServerTime(accountPeerId: PeerId, postbox:
|
|||
updatedState.addCallSignalingData(callId: phoneCallId, data: data.makeData())
|
||||
case let .updateGroupCallParticipants(call, participants, version):
|
||||
switch call {
|
||||
case let .inputGroupCall(id, accessHash):
|
||||
case let .inputGroupCall(inputGroupCallData):
|
||||
let (id, accessHash) = (inputGroupCallData.id, inputGroupCallData.accessHash)
|
||||
updatedState.updateGroupCallParticipants(id: id, accessHash: accessHash, participants: participants, version: version)
|
||||
case .inputGroupCallSlug, .inputGroupCallInviteMessage:
|
||||
break
|
||||
|
|
@ -1689,11 +1690,13 @@ private func finalStateWithUpdatesAndServerTime(accountPeerId: PeerId, postbox:
|
|||
case let .updateGroupCall(_, channelId, call):
|
||||
updatedState.updateGroupCall(peerId: channelId?.peerId, call: call)
|
||||
case let .updateGroupCallChainBlocks(call, subChainId, blocks, nextOffset):
|
||||
if case let .inputGroupCall(id, accessHash) = call {
|
||||
if case let .inputGroupCall(inputGroupCallData) = call {
|
||||
let (id, accessHash) = (inputGroupCallData.id, inputGroupCallData.accessHash)
|
||||
updatedState.updateGroupCallChainBlocks(id: id, accessHash: accessHash, subChainId: subChainId, blocks: blocks.map { $0.makeData() }, nextOffset: nextOffset)
|
||||
}
|
||||
case let .updateGroupCallMessage(call, message):
|
||||
if case let .inputGroupCall(id, _) = call {
|
||||
if case let .inputGroupCall(inputGroupCallData) = call {
|
||||
let id = inputGroupCallData.id
|
||||
switch message {
|
||||
case let .groupCallMessage(groupCallMessageData):
|
||||
let (flags, messageId, fromId, date, message, paidMessageStars) = (groupCallMessageData.flags, groupCallMessageData.id, groupCallMessageData.fromId, groupCallMessageData.date, groupCallMessageData.message, groupCallMessageData.paidMessageStars)
|
||||
|
|
@ -1701,7 +1704,8 @@ private func finalStateWithUpdatesAndServerTime(accountPeerId: PeerId, postbox:
|
|||
}
|
||||
}
|
||||
case let .updateGroupCallEncryptedMessage(call, fromId, encryptedMessage):
|
||||
if case let .inputGroupCall(id, _) = call {
|
||||
if case let .inputGroupCall(inputGroupCallData) = call {
|
||||
let id = inputGroupCallData.id
|
||||
updatedState.updateGroupCallOpaqueMessage(id: id, authorId: fromId.peerId, data: encryptedMessage.makeData())
|
||||
}
|
||||
case let .updatePeerHistoryTTL(_, peer, ttl):
|
||||
|
|
@ -2847,7 +2851,7 @@ private func resolveMissingPeerChatInfos(accountPeerId: PeerId, network: Network
|
|||
return .single((state, hadError))
|
||||
} else {
|
||||
Logger.shared.log("State", "will fetch chat info for \(missingPeers.count) peers")
|
||||
let signal = network.request(Api.functions.messages.getPeerDialogs(peers: missingPeers.values.map(Api.InputDialogPeer.inputDialogPeer(peer:))))
|
||||
let signal = network.request(Api.functions.messages.getPeerDialogs(peers: missingPeers.values.map { .inputDialogPeer(.init(peer: $0)) }))
|
||||
|> map(Optional.init)
|
||||
|
||||
return signal
|
||||
|
|
@ -3079,7 +3083,7 @@ func resetChannels(accountPeerId: PeerId, postbox: Postbox, network: Network, pe
|
|||
var inputPeers: [Api.InputDialogPeer] = []
|
||||
for peer in peers {
|
||||
if let inputPeer = apiInputPeer(peer) {
|
||||
inputPeers.append(.inputDialogPeer(peer: inputPeer))
|
||||
inputPeers.append(.inputDialogPeer(.init(peer: inputPeer)))
|
||||
}
|
||||
}
|
||||
return network.request(Api.functions.messages.getPeerDialogs(peers: inputPeers))
|
||||
|
|
|
|||
|
|
@ -88,7 +88,7 @@ private func fetchWebpage(account: Account, messageId: MessageId, threadId: Int6
|
|||
} else {
|
||||
switch inputPeer {
|
||||
case let .inputPeerChannel(channelId, accessHash):
|
||||
messages = account.network.request(Api.functions.channels.getMessages(channel: Api.InputChannel.inputChannel(channelId: channelId, accessHash: accessHash), id: [Api.InputMessage.inputMessageID(id: messageId.id)]))
|
||||
messages = account.network.request(Api.functions.channels.getMessages(channel: Api.InputChannel.inputChannel(.init(channelId: channelId, accessHash: accessHash)), id: [Api.InputMessage.inputMessageID(id: messageId.id)]))
|
||||
default:
|
||||
messages = account.network.request(Api.functions.messages.getMessages(id: [Api.InputMessage.inputMessageID(id: messageId.id)]))
|
||||
}
|
||||
|
|
@ -950,7 +950,7 @@ public final class AccountViewTracker {
|
|||
request = account.network.request(Api.functions.messages.readMessageContents(id: messageIds.map { $0.id }))
|
||||
|> map { _ in true }
|
||||
case let .inputPeerChannel(channelId, accessHash):
|
||||
request = account.network.request(Api.functions.channels.readMessageContents(channel: .inputChannel(channelId: channelId, accessHash: accessHash), id: messageIds.map { $0.id }))
|
||||
request = account.network.request(Api.functions.channels.readMessageContents(channel: .inputChannel(.init(channelId: channelId, accessHash: accessHash)), id: messageIds.map { $0.id }))
|
||||
|> map { _ in true }
|
||||
default:
|
||||
return .complete()
|
||||
|
|
|
|||
|
|
@ -66,7 +66,8 @@ public struct GroupCallReference: Codable, Equatable {
|
|||
extension GroupCallReference {
|
||||
init?(_ apiGroupCall: Api.InputGroupCall) {
|
||||
switch apiGroupCall {
|
||||
case let .inputGroupCall(id, accessHash):
|
||||
case let .inputGroupCall(inputGroupCallData):
|
||||
let (id, accessHash) = (inputGroupCallData.id, inputGroupCallData.accessHash)
|
||||
self.init(id: id, accessHash: accessHash)
|
||||
case .inputGroupCallSlug, .inputGroupCallInviteMessage:
|
||||
return nil
|
||||
|
|
@ -74,7 +75,7 @@ extension GroupCallReference {
|
|||
}
|
||||
|
||||
var apiInputGroupCall: Api.InputGroupCall {
|
||||
return .inputGroupCall(id: self.id, accessHash: self.accessHash)
|
||||
return .inputGroupCall(.init(id: self.id, accessHash: self.accessHash))
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -326,7 +326,7 @@ private func pushDeviceContactData(accountPeerId: PeerId, postbox: Postbox, netw
|
|||
batches = batches
|
||||
|> mapToSignal { intermediateResult -> Signal<PushDeviceContactsResult, NoError> in
|
||||
return network.request(Api.functions.contacts.importContacts(contacts: zip(0 ..< batch.count, batch).map { index, item -> Api.InputContact in
|
||||
return .inputPhoneContact(flags: 0, clientId: Int64(index), phone: item.0.rawValue, firstName: item.1.firstName, lastName: item.1.lastName, note: nil)
|
||||
return .inputPhoneContact(.init(flags: 0, clientId: Int64(index), phone: item.0.rawValue, firstName: item.1.firstName, lastName: item.1.lastName, note: nil))
|
||||
}))
|
||||
|> map(Optional.init)
|
||||
|> `catch` { _ -> Signal<Api.contacts.ImportedContacts?, NoError> in
|
||||
|
|
|
|||
|
|
@ -386,7 +386,7 @@ private func synchronizeReadMessageReactions(transaction: Transaction, postbox:
|
|||
private func synchronizeUnseenPersonalMentionsTag(postbox: Postbox, network: Network, entry: InvalidatedMessageHistoryTagsSummaryEntry) -> Signal<Void, NoError> {
|
||||
return postbox.transaction { transaction -> Signal<Void, NoError> in
|
||||
if let peer = transaction.getPeer(entry.key.peerId), let inputPeer = apiInputPeer(peer) {
|
||||
return network.request(Api.functions.messages.getPeerDialogs(peers: [.inputDialogPeer(peer: inputPeer)]))
|
||||
return network.request(Api.functions.messages.getPeerDialogs(peers: [.inputDialogPeer(.init(peer: inputPeer))]))
|
||||
|> map(Optional.init)
|
||||
|> `catch` { _ -> Signal<Api.messages.PeerDialogs?, NoError> in
|
||||
return .single(nil)
|
||||
|
|
@ -429,7 +429,7 @@ private func synchronizeUnseenPersonalMentionsTag(postbox: Postbox, network: Net
|
|||
private func synchronizeUnseenReactionsTag(postbox: Postbox, network: Network, entry: InvalidatedMessageHistoryTagsSummaryEntry) -> Signal<Void, NoError> {
|
||||
return postbox.transaction { transaction -> Signal<Void, NoError> in
|
||||
if let peer = transaction.getPeer(entry.key.peerId), let inputPeer = apiInputPeer(peer) {
|
||||
return network.request(Api.functions.messages.getPeerDialogs(peers: [.inputDialogPeer(peer: inputPeer)]))
|
||||
return network.request(Api.functions.messages.getPeerDialogs(peers: [.inputDialogPeer(.init(peer: inputPeer))]))
|
||||
|> map(Optional.init)
|
||||
|> `catch` { _ -> Signal<Api.messages.PeerDialogs?, NoError> in
|
||||
return .single(nil)
|
||||
|
|
|
|||
|
|
@ -190,7 +190,7 @@ private func requestActivity(postbox: Postbox, network: Network, accountPeerId:
|
|||
}
|
||||
} else if let peer = peer as? TelegramSecretChat, activity == .typingText {
|
||||
let _ = PeerId(peer.id.toInt64())
|
||||
return network.request(Api.functions.messages.setEncryptedTyping(peer: .inputEncryptedChat(chatId: Int32(peer.id.id._internalGetInt64Value()), accessHash: peer.accessHash), typing: .boolTrue))
|
||||
return network.request(Api.functions.messages.setEncryptedTyping(peer: .inputEncryptedChat(.init(chatId: Int32(peer.id.id._internalGetInt64Value()), accessHash: peer.accessHash)), typing: .boolTrue))
|
||||
|> `catch` { _ -> Signal<Api.Bool, NoError> in
|
||||
return .single(.boolFalse)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -246,7 +246,7 @@ private func initialHandshakeAccept(postbox: Postbox, network: Network, peerId:
|
|||
memcpy(&keyFingerprint, bytes.advanced(by: keyHash.count - 8), 8)
|
||||
}
|
||||
|
||||
let result = network.request(Api.functions.messages.acceptEncryption(peer: .inputEncryptedChat(chatId: Int32(peerId.id._internalGetInt64Value()), accessHash: accessHash), gB: Buffer(data: gb), keyFingerprint: keyFingerprint))
|
||||
let result = network.request(Api.functions.messages.acceptEncryption(peer: .inputEncryptedChat(.init(chatId: Int32(peerId.id._internalGetInt64Value()), accessHash: accessHash)), gB: Buffer(data: gb), keyFingerprint: keyFingerprint))
|
||||
|
||||
let response = result
|
||||
|> map { result -> Api.EncryptedChat? in
|
||||
|
|
@ -2132,7 +2132,7 @@ private func sendBoxedDecryptedMessage(postbox: Postbox, network: Network, peer:
|
|||
decryptedMessage.serialize(payload, role: state.role, sequenceInfo: sequenceInfo)
|
||||
let encryptedPayload = encryptedMessageContents(parameters: parameters, data: MemoryBuffer(payload))
|
||||
let sendMessage: Signal<Api.messages.SentEncryptedMessage, MTRpcError>
|
||||
let inputPeer = Api.InputEncryptedChat.inputEncryptedChat(chatId: Int32(peer.id.id._internalGetInt64Value()), accessHash: peer.accessHash)
|
||||
let inputPeer = Api.InputEncryptedChat.inputEncryptedChat(.init(chatId: Int32(peer.id.id._internalGetInt64Value()), accessHash: peer.accessHash))
|
||||
|
||||
var flags: Int32 = 0
|
||||
if silent {
|
||||
|
|
@ -2188,7 +2188,7 @@ private func requestTerminateSecretChat(postbox: Postbox, network: Network, peer
|
|||
}
|
||||
|> mapToSignal { peer -> Signal<Void, NoError> in
|
||||
if let peer = peer {
|
||||
return network.request(Api.functions.messages.reportEncryptedSpam(peer: Api.InputEncryptedChat.inputEncryptedChat(chatId: Int32(peer.id.id._internalGetInt64Value()), accessHash: peer.accessHash)))
|
||||
return network.request(Api.functions.messages.reportEncryptedSpam(peer: Api.InputEncryptedChat.inputEncryptedChat(.init(chatId: Int32(peer.id.id._internalGetInt64Value()), accessHash: peer.accessHash))))
|
||||
|> map(Optional.init)
|
||||
|> `catch` { _ -> Signal<Api.Bool?, NoError> in
|
||||
return .single(nil)
|
||||
|
|
|
|||
|
|
@ -117,7 +117,7 @@ private func synchronizeAppLogEvents(transaction: Transaction, postbox: Postbox,
|
|||
switch operation.content {
|
||||
case let .add(time, type, peerId, data):
|
||||
if let data = apiJson(data) {
|
||||
events.append(.inputAppEvent(time: time, type: type, peer: peerId?.toInt64() ?? 0, data: data))
|
||||
events.append(.inputAppEvent(.init(time: time, type: type, peer: peerId?.toInt64() ?? 0, data: data)))
|
||||
}
|
||||
default:
|
||||
break
|
||||
|
|
|
|||
|
|
@ -79,7 +79,7 @@ private func synchronizeGroupMessageStats(postbox: Postbox, network: Network, gr
|
|||
return .complete()
|
||||
}
|
||||
|
||||
return network.request(Api.functions.messages.getPeerDialogs(peers: [.inputDialogPeerFolder(folderId: groupId.rawValue)]))
|
||||
return network.request(Api.functions.messages.getPeerDialogs(peers: [.inputDialogPeerFolder(.init(folderId: groupId.rawValue))]))
|
||||
|> map(Optional.init)
|
||||
|> `catch` { _ -> Signal<Api.messages.PeerDialogs?, NoError> in
|
||||
return .single(nil)
|
||||
|
|
|
|||
|
|
@ -134,7 +134,7 @@ private func synchronizeGroupedPeers(transaction: Transaction, postbox: Postbox,
|
|||
var folderPeers: [Api.InputFolderPeer] = []
|
||||
for operation in operations {
|
||||
if let inputPeer = transaction.getPeer(operation.peerId).flatMap(apiInputPeer) {
|
||||
folderPeers.append(.inputFolderPeer(peer: inputPeer, folderId: operation.groupId.rawValue))
|
||||
folderPeers.append(.inputFolderPeer(.init(peer: inputPeer, folderId: operation.groupId.rawValue)))
|
||||
}
|
||||
}
|
||||
if folderPeers.isEmpty {
|
||||
|
|
|
|||
|
|
@ -266,7 +266,7 @@ private func synchronizePinnedChats(transaction: Transaction, postbox: Postbox,
|
|||
switch itemId {
|
||||
case let .peer(peerId):
|
||||
if let peer = transaction.getPeer(peerId), let inputPeer = apiInputPeer(peer) {
|
||||
inputDialogPeers.append(Api.InputDialogPeer.inputDialogPeer(peer: inputPeer))
|
||||
inputDialogPeers.append(Api.InputDialogPeer.inputDialogPeer(.init(peer: inputPeer)))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -128,7 +128,7 @@ private func synchronizeRecentlyUsedMedia(transaction: Transaction, accountPeerI
|
|||
}
|
||||
|
||||
let addSticker: (Data) -> Signal<Api.Bool, SaveRecentlyUsedMediaError> = { fileReference in
|
||||
return network.request(Api.functions.messages.saveRecentSticker(flags: 0, id: .inputDocument(id: id, accessHash: accessHash, fileReference: Buffer(data: fileReference)), unsave: .boolFalse))
|
||||
return network.request(Api.functions.messages.saveRecentSticker(flags: 0, id: .inputDocument(.init(id: id, accessHash: accessHash, fileReference: Buffer(data: fileReference))), unsave: .boolFalse))
|
||||
|> mapError { error -> SaveRecentlyUsedMediaError in
|
||||
if error.errorDescription.hasPrefix("FILEREF_INVALID") || error.errorDescription.hasPrefix("FILE_REFERENCE_") {
|
||||
return .invalidReference
|
||||
|
|
@ -170,7 +170,7 @@ private func synchronizeRecentlyUsedMedia(transaction: Transaction, accountPeerI
|
|||
return .complete()
|
||||
}
|
||||
case let .remove(id, accessHash):
|
||||
return network.request(Api.functions.messages.saveRecentSticker(flags: 0, id: .inputDocument(id: id, accessHash: accessHash, fileReference: Buffer()), unsave: .boolTrue))
|
||||
return network.request(Api.functions.messages.saveRecentSticker(flags: 0, id: .inputDocument(.init(id: id, accessHash: accessHash, fileReference: Buffer())), unsave: .boolTrue))
|
||||
|> `catch` { _ -> Signal<Api.Bool, NoError> in
|
||||
return .single(.boolFalse)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -124,7 +124,7 @@ private func synchronizeSavedGifs(transaction: Transaction, accountPeerId: PeerI
|
|||
}
|
||||
|
||||
let saveGif: (Data) -> Signal<Api.Bool, SaveGifError> = { fileReference in
|
||||
return network.request(Api.functions.messages.saveGif(id: .inputDocument(id: id, accessHash: accessHash, fileReference: Buffer(data: fileReference)), unsave: .boolFalse))
|
||||
return network.request(Api.functions.messages.saveGif(id: .inputDocument(.init(id: id, accessHash: accessHash, fileReference: Buffer(data: fileReference))), unsave: .boolFalse))
|
||||
|> mapError { error -> SaveGifError in
|
||||
if error.errorDescription.hasPrefix("FILEREF_INVALID") || error.errorDescription.hasPrefix("FILE_REFERENCE_") {
|
||||
return .invalidReference
|
||||
|
|
@ -166,7 +166,7 @@ private func synchronizeSavedGifs(transaction: Transaction, accountPeerId: PeerI
|
|||
return .complete()
|
||||
}
|
||||
case let .remove(id, accessHash):
|
||||
return network.request(Api.functions.messages.saveGif(id: .inputDocument(id: id, accessHash: accessHash, fileReference: Buffer()), unsave: .boolTrue))
|
||||
return network.request(Api.functions.messages.saveGif(id: .inputDocument(.init(id: id, accessHash: accessHash, fileReference: Buffer())), unsave: .boolTrue))
|
||||
|> `catch` { _ -> Signal<Api.Bool, NoError> in
|
||||
return .single(.boolFalse)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -124,7 +124,7 @@ private func synchronizeSavedStickers(transaction: Transaction, accountPeerId: P
|
|||
}
|
||||
|
||||
let saveSticker: (Data) -> Signal<Api.Bool, SaveStickerError> = { fileReference in
|
||||
return network.request(Api.functions.messages.faveSticker(id: .inputDocument(id: id, accessHash: accessHash, fileReference: Buffer(data: fileReference)), unfave: .boolFalse))
|
||||
return network.request(Api.functions.messages.faveSticker(id: .inputDocument(.init(id: id, accessHash: accessHash, fileReference: Buffer(data: fileReference))), unfave: .boolFalse))
|
||||
|> mapError { error -> SaveStickerError in
|
||||
if error.errorDescription.hasPrefix("FILEREF_INVALID") || error.errorDescription.hasPrefix("FILE_REFERENCE_") {
|
||||
return .invalidReference
|
||||
|
|
@ -166,7 +166,7 @@ private func synchronizeSavedStickers(transaction: Transaction, accountPeerId: P
|
|||
return .complete()
|
||||
}
|
||||
case let .remove(id, accessHash):
|
||||
return network.request(Api.functions.messages.faveSticker(id: .inputDocument(id: id, accessHash: accessHash, fileReference: Buffer()), unfave: .boolTrue))
|
||||
return network.request(Api.functions.messages.faveSticker(id: .inputDocument(.init(id: id, accessHash: accessHash, fileReference: Buffer())), unfave: .boolTrue))
|
||||
|> `catch` { _ -> Signal<Api.Bool, NoError> in
|
||||
return .single(.boolFalse)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -74,7 +74,7 @@ private func dialogReadState(network: Network, postbox: Postbox, peerId: PeerId)
|
|||
|
||||
return inputPeer(postbox: postbox, peerId: peerId)
|
||||
|> mapToSignal { inputPeer -> Signal<(PeerReadState, PeerReadStateMarker)?, PeerReadStateValidationError> in
|
||||
return network.request(Api.functions.messages.getPeerDialogs(peers: [.inputDialogPeer(peer: inputPeer)]))
|
||||
return network.request(Api.functions.messages.getPeerDialogs(peers: [.inputDialogPeer(.init(peer: inputPeer))]))
|
||||
|> retryRequest
|
||||
|> mapToSignalPromotingError { result -> Signal<(PeerReadState, PeerReadStateMarker)?, PeerReadStateValidationError> in
|
||||
switch result {
|
||||
|
|
@ -243,7 +243,7 @@ private func pushPeerReadState(network: Network, postbox: Postbox, stateManager:
|
|||
case let .inputPeerChannel(channelId, accessHash):
|
||||
switch readState {
|
||||
case let .idBased(maxIncomingReadId, _, _, _, markedUnread):
|
||||
var pushSignal: Signal<Void, NoError> = network.request(Api.functions.channels.readHistory(channel: Api.InputChannel.inputChannel(channelId: channelId, accessHash: accessHash), maxId: maxIncomingReadId))
|
||||
var pushSignal: Signal<Void, NoError> = network.request(Api.functions.channels.readHistory(channel: Api.InputChannel.inputChannel(.init(channelId: channelId, accessHash: accessHash)), maxId: maxIncomingReadId))
|
||||
|> `catch` { _ -> Signal<Api.Bool, NoError> in
|
||||
return .complete()
|
||||
}
|
||||
|
|
@ -252,7 +252,7 @@ private func pushPeerReadState(network: Network, postbox: Postbox, stateManager:
|
|||
}
|
||||
if markedUnread {
|
||||
pushSignal = pushSignal
|
||||
|> then(network.request(Api.functions.messages.markDialogUnread(flags: 1 << 0, parentPeer: nil, peer: .inputDialogPeer(peer: inputPeer)))
|
||||
|> then(network.request(Api.functions.messages.markDialogUnread(flags: 1 << 0, parentPeer: nil, peer: .inputDialogPeer(.init(peer: inputPeer))))
|
||||
|> `catch` { _ -> Signal<Api.Bool, NoError> in
|
||||
return .complete()
|
||||
}
|
||||
|
|
@ -287,10 +287,10 @@ private func pushPeerReadState(network: Network, postbox: Postbox, stateManager:
|
|||
}
|
||||
return .complete()
|
||||
}
|
||||
|
||||
|
||||
if markedUnread {
|
||||
pushSignal = pushSignal
|
||||
|> then(network.request(Api.functions.messages.markDialogUnread(flags: 1 << 0, parentPeer: nil, peer: .inputDialogPeer(peer: inputPeer)))
|
||||
|> then(network.request(Api.functions.messages.markDialogUnread(flags: 1 << 0, parentPeer: nil, peer: .inputDialogPeer(.init(peer: inputPeer))))
|
||||
|> `catch` { _ -> Signal<Api.Bool, NoError> in
|
||||
return .complete()
|
||||
}
|
||||
|
|
|
|||
|
|
@ -408,7 +408,7 @@ func _internal_requestStarsRevenueWithdrawalUrl(account: Account, ton: Bool, pee
|
|||
guard let kdfResult = passwordKDF(encryptionProvider: account.network.encryptionProvider, password: password, derivation: currentPasswordDerivation, srpSessionData: srpSessionData) else {
|
||||
return .fail(.generic)
|
||||
}
|
||||
return .single(.inputCheckPasswordSRP(srpId: kdfResult.id, A: Buffer(data: kdfResult.A), M1: Buffer(data: kdfResult.M1)))
|
||||
return .single(.inputCheckPasswordSRP(.init(srpId: kdfResult.id, A: Buffer(data: kdfResult.A), M1: Buffer(data: kdfResult.M1))))
|
||||
} else {
|
||||
return .fail(.twoStepAuthMissing)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -865,7 +865,7 @@ extension TelegramBusinessLocation.Coordinates {
|
|||
}
|
||||
|
||||
var apiInputGeoPoint: Api.InputGeoPoint {
|
||||
return .inputGeoPoint(flags: 0, lat: self.latitude, long: self.longitude, accuracyRadius: nil)
|
||||
return .inputGeoPoint(.init(flags: 0, lat: self.latitude, long: self.longitude, accuracyRadius: nil))
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1929,7 +1929,7 @@ func _internal_createBusinessChatLink(account: Account, message: String, entitie
|
|||
flags |= 1 << 1
|
||||
}
|
||||
|
||||
return account.network.request(Api.functions.account.createBusinessChatLink(link: .inputBusinessChatLink(flags: flags, message: message, entities: apiEntities, title: title)))
|
||||
return account.network.request(Api.functions.account.createBusinessChatLink(link: .inputBusinessChatLink(.init(flags: flags, message: message, entities: apiEntities, title: title))))
|
||||
|> mapError { error -> AddBusinessChatLinkError in
|
||||
if error.errorDescription == "CHATLINKS_TOO_MUCH" {
|
||||
return .tooManyLinks
|
||||
|
|
@ -1969,7 +1969,7 @@ func _internal_editBusinessChatLink(account: Account, url: String, message: Stri
|
|||
flags |= 1 << 1
|
||||
}
|
||||
|
||||
return account.network.request(Api.functions.account.editBusinessChatLink(slug: url, link: .inputBusinessChatLink(flags: flags, message: message, entities: apiEntities, title: title)))
|
||||
return account.network.request(Api.functions.account.editBusinessChatLink(slug: url, link: .inputBusinessChatLink(.init(flags: flags, message: message, entities: apiEntities, title: title))))
|
||||
|> mapError { _ -> AddBusinessChatLinkError in
|
||||
return .generic
|
||||
}
|
||||
|
|
|
|||
|
|
@ -762,7 +762,7 @@ final class AlbumCoverResource: TelegramMediaResource, MediaResourceWithWebFileR
|
|||
var flags: Int32 = 0
|
||||
var document: Api.InputDocument?
|
||||
if let file = self.file, let resource = file.media.resource as? CloudDocumentMediaResource {
|
||||
document = .inputDocument(id: resource.fileId, accessHash: resource.accessHash, fileReference: Buffer(data: resource.fileReference ?? Data()))
|
||||
document = .inputDocument(.init(id: resource.fileId, accessHash: resource.accessHash, fileReference: Buffer(data: resource.fileReference ?? Data())))
|
||||
flags |= 1 << 0
|
||||
}
|
||||
var requestTitle: String?
|
||||
|
|
|
|||
|
|
@ -116,7 +116,7 @@ public extension TelegramEngine {
|
|||
guard let kdfResult = passwordKDF(encryptionProvider: network.encryptionProvider, password: password, derivation: currentPasswordDerivation, srpSessionData: srpSessionData) else {
|
||||
return .fail(.generic)
|
||||
}
|
||||
return .single(.inputCheckPasswordSRP(srpId: kdfResult.id, A: Buffer(data: kdfResult.A), M1: Buffer(data: kdfResult.M1)))
|
||||
return .single(.inputCheckPasswordSRP(.init(srpId: kdfResult.id, A: Buffer(data: kdfResult.A), M1: Buffer(data: kdfResult.M1))))
|
||||
} else {
|
||||
return .single(nil)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -56,7 +56,7 @@ func _internal_requestTwoStepVerifiationSettings(network: Network, password: Str
|
|||
return .fail(.generic)
|
||||
}
|
||||
|
||||
return network.request(Api.functions.account.getPasswordSettings(password: .inputCheckPasswordSRP(srpId: kdfResult.id, A: Buffer(data: kdfResult.A), M1: Buffer(data: kdfResult.M1))), automaticFloodWait: false)
|
||||
return network.request(Api.functions.account.getPasswordSettings(password: .inputCheckPasswordSRP(.init(srpId: kdfResult.id, A: Buffer(data: kdfResult.A), M1: Buffer(data: kdfResult.M1)))), automaticFloodWait: false)
|
||||
|> mapError { error -> AuthorizationPasswordVerificationError in
|
||||
if error.errorDescription.hasPrefix("FLOOD_WAIT") {
|
||||
return .limitExceeded
|
||||
|
|
@ -141,7 +141,7 @@ func _internal_updateTwoStepVerificationPassword(network: Network, currentPasswo
|
|||
let checkPassword: Api.InputCheckPasswordSRP
|
||||
if let currentPasswordDerivation = authData.currentPasswordDerivation, let srpSessionData = authData.srpSessionData {
|
||||
if let kdfResult = passwordKDF(encryptionProvider: network.encryptionProvider, password: currentPassword ?? "", derivation: currentPasswordDerivation, srpSessionData: srpSessionData) {
|
||||
checkPassword = .inputCheckPasswordSRP(srpId: kdfResult.id, A: Buffer(data: kdfResult.A), M1: Buffer(data: kdfResult.M1))
|
||||
checkPassword = .inputCheckPasswordSRP(.init(srpId: kdfResult.id, A: Buffer(data: kdfResult.A), M1: Buffer(data: kdfResult.M1)))
|
||||
} else {
|
||||
return .fail(.generic)
|
||||
}
|
||||
|
|
@ -245,7 +245,7 @@ func updateTwoStepVerificationSecureSecret(network: Network, password: String, s
|
|||
return .fail(.generic)
|
||||
}
|
||||
|
||||
let checkPassword: Api.InputCheckPasswordSRP = .inputCheckPasswordSRP(srpId: kdfResult.id, A: Buffer(data: kdfResult.A), M1: Buffer(data: kdfResult.M1))
|
||||
let checkPassword: Api.InputCheckPasswordSRP = .inputCheckPasswordSRP(.init(srpId: kdfResult.id, A: Buffer(data: kdfResult.A), M1: Buffer(data: kdfResult.M1)))
|
||||
|
||||
guard let (encryptedSecret, secretDerivation, secretId) = encryptedSecureSecret(secretData: secret, password: password, inputDerivation: authData.nextSecurePasswordDerivation) else {
|
||||
return .fail(.generic)
|
||||
|
|
@ -273,7 +273,7 @@ func _internal_updateTwoStepVerificationEmail(network: Network, currentPassword:
|
|||
guard let kdfResult = passwordKDF(encryptionProvider: network.encryptionProvider, password: currentPassword, derivation: currentPasswordDerivation, srpSessionData: srpSessionData) else {
|
||||
return .fail(.generic)
|
||||
}
|
||||
checkPassword = .inputCheckPasswordSRP(srpId: kdfResult.id, A: Buffer(data: kdfResult.A), M1: Buffer(data: kdfResult.M1))
|
||||
checkPassword = .inputCheckPasswordSRP(.init(srpId: kdfResult.id, A: Buffer(data: kdfResult.A), M1: Buffer(data: kdfResult.M1)))
|
||||
} else {
|
||||
checkPassword = .inputCheckPasswordEmpty
|
||||
}
|
||||
|
|
@ -370,7 +370,7 @@ func _internal_requestTemporaryTwoStepPasswordToken(account: Account, password:
|
|||
return .fail(MTRpcError(errorCode: 400, errorDescription: "KDF_ERROR"))
|
||||
}
|
||||
|
||||
let checkPassword: Api.InputCheckPasswordSRP = .inputCheckPasswordSRP(srpId: kdfResult.id, A: Buffer(data: kdfResult.A), M1: Buffer(data: kdfResult.M1))
|
||||
let checkPassword: Api.InputCheckPasswordSRP = .inputCheckPasswordSRP(.init(srpId: kdfResult.id, A: Buffer(data: kdfResult.A), M1: Buffer(data: kdfResult.M1)))
|
||||
|
||||
return account.network.request(Api.functions.account.getTmpPassword(password: checkPassword, period: period), automaticFloodWait: false)
|
||||
|> map { result -> TemporaryTwoStepPasswordToken in
|
||||
|
|
|
|||
|
|
@ -186,11 +186,11 @@ extension InternalGroupCallReference {
|
|||
var apiInputGroupCall: Api.InputGroupCall {
|
||||
switch self {
|
||||
case let .id(id, accessHash):
|
||||
return .inputGroupCall(id: id, accessHash: accessHash)
|
||||
return .inputGroupCall(.init(id: id, accessHash: accessHash))
|
||||
case let .link(slug):
|
||||
return .inputGroupCallSlug(slug: slug)
|
||||
return .inputGroupCallSlug(.init(slug: slug))
|
||||
case let .message(id):
|
||||
return .inputGroupCallInviteMessage(msgId: id.id)
|
||||
return .inputGroupCallInviteMessage(.init(msgId: id.id))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -200,9 +200,9 @@ func _internal_getCurrentGroupCall(account: Account, reference: InternalGroupCal
|
|||
let inputCall: Api.InputGroupCall
|
||||
switch reference {
|
||||
case let .id(id, accessHash):
|
||||
inputCall = .inputGroupCall(id: id, accessHash: accessHash)
|
||||
inputCall = .inputGroupCall(.init(id: id, accessHash: accessHash))
|
||||
case let .link(slug):
|
||||
inputCall = .inputGroupCallSlug(slug: slug)
|
||||
inputCall = .inputGroupCallSlug(.init(slug: slug))
|
||||
case let .message(id):
|
||||
if id.peerId.namespace != Namespaces.Peer.CloudUser {
|
||||
return .fail(.generic)
|
||||
|
|
@ -210,7 +210,7 @@ func _internal_getCurrentGroupCall(account: Account, reference: InternalGroupCal
|
|||
if id.namespace != Namespaces.Message.Cloud {
|
||||
return .fail(.generic)
|
||||
}
|
||||
inputCall = .inputGroupCallInviteMessage(msgId: id.id)
|
||||
inputCall = .inputGroupCallInviteMessage(.init(msgId: id.id))
|
||||
}
|
||||
return account.network.request(Api.functions.phone.getGroupCall(call: inputCall, limit: 4))
|
||||
|> mapError { _ -> GetCurrentGroupCallError in
|
||||
|
|
@ -256,9 +256,9 @@ func _internal_getCurrentGroupCallInfo(account: Account, reference: InternalGrou
|
|||
let inputCall: Api.InputGroupCall
|
||||
switch reference {
|
||||
case let .id(id, accessHash):
|
||||
inputCall = .inputGroupCall(id: id, accessHash: accessHash)
|
||||
inputCall = .inputGroupCall(.init(id: id, accessHash: accessHash))
|
||||
case let .link(slug):
|
||||
inputCall = .inputGroupCallSlug(slug: slug)
|
||||
inputCall = .inputGroupCallSlug(.init(slug: slug))
|
||||
case let .message(id):
|
||||
if id.peerId.namespace != Namespaces.Peer.CloudUser {
|
||||
return .single(nil)
|
||||
|
|
@ -266,7 +266,7 @@ func _internal_getCurrentGroupCallInfo(account: Account, reference: InternalGrou
|
|||
if id.namespace != Namespaces.Message.Cloud {
|
||||
return .single(nil)
|
||||
}
|
||||
inputCall = .inputGroupCallInviteMessage(msgId: id.id)
|
||||
inputCall = .inputGroupCallInviteMessage(.init(msgId: id.id))
|
||||
}
|
||||
return account.network.request(Api.functions.phone.getGroupCall(call: inputCall, limit: 4))
|
||||
|> map(Optional.init)
|
||||
|
|
@ -375,7 +375,7 @@ public enum StartScheduledGroupCallError {
|
|||
}
|
||||
|
||||
func _internal_startScheduledGroupCall(account: Account, peerId: PeerId, callId: Int64, accessHash: Int64) -> Signal<GroupCallInfo, StartScheduledGroupCallError> {
|
||||
return account.network.request(Api.functions.phone.startScheduledGroupCall(call: .inputGroupCall(id: callId, accessHash: accessHash)))
|
||||
return account.network.request(Api.functions.phone.startScheduledGroupCall(call: .inputGroupCall(.init(id: callId, accessHash: accessHash))))
|
||||
|> mapError { error -> StartScheduledGroupCallError in
|
||||
return .generic
|
||||
}
|
||||
|
|
@ -1023,7 +1023,7 @@ func _internal_removeGroupCallBlockchainParticipants(account: Account, callId: I
|
|||
case .cleanup:
|
||||
flags |= 1 << 0
|
||||
}
|
||||
return account.network.request(Api.functions.phone.deleteConferenceCallParticipants(flags: flags, call: .inputGroupCall(id: callId, accessHash: accessHash), ids: participantIds, block: Buffer(data: block)))
|
||||
return account.network.request(Api.functions.phone.deleteConferenceCallParticipants(flags: flags, call: .inputGroupCall(.init(id: callId, accessHash: accessHash)), ids: participantIds, block: Buffer(data: block)))
|
||||
|> map { updates -> RemoveGroupCallBlockchainParticipantsResult in
|
||||
account.stateManager.addUpdates(updates)
|
||||
return .success
|
||||
|
|
@ -1039,7 +1039,7 @@ public struct JoinGroupCallAsScreencastResult {
|
|||
}
|
||||
|
||||
func _internal_joinGroupCallAsScreencast(account: Account, callId: Int64, accessHash: Int64, joinPayload: String) -> Signal<JoinGroupCallAsScreencastResult, JoinGroupCallError> {
|
||||
return account.network.request(Api.functions.phone.joinGroupCallPresentation(call: .inputGroupCall(id: callId, accessHash: accessHash), params: .dataJSON(.init(data: joinPayload))))
|
||||
return account.network.request(Api.functions.phone.joinGroupCallPresentation(call: .inputGroupCall(.init(id: callId, accessHash: accessHash)), params: .dataJSON(.init(data: joinPayload))))
|
||||
|> mapError { _ -> JoinGroupCallError in
|
||||
return .generic
|
||||
}
|
||||
|
|
@ -1088,7 +1088,7 @@ public enum LeaveGroupCallAsScreencastError {
|
|||
}
|
||||
|
||||
func _internal_leaveGroupCallAsScreencast(account: Account, callId: Int64, accessHash: Int64) -> Signal<Never, LeaveGroupCallAsScreencastError> {
|
||||
return account.network.request(Api.functions.phone.leaveGroupCallPresentation(call: .inputGroupCall(id: callId, accessHash: accessHash)))
|
||||
return account.network.request(Api.functions.phone.leaveGroupCallPresentation(call: .inputGroupCall(.init(id: callId, accessHash: accessHash))))
|
||||
|> mapError { _ -> LeaveGroupCallAsScreencastError in
|
||||
return .generic
|
||||
}
|
||||
|
|
@ -1104,7 +1104,7 @@ public enum LeaveGroupCallError {
|
|||
}
|
||||
|
||||
func _internal_leaveGroupCall(account: Account, callId: Int64, accessHash: Int64, source: UInt32) -> Signal<Never, LeaveGroupCallError> {
|
||||
return account.network.request(Api.functions.phone.leaveGroupCall(call: .inputGroupCall(id: callId, accessHash: accessHash), source: Int32(bitPattern: source)))
|
||||
return account.network.request(Api.functions.phone.leaveGroupCall(call: .inputGroupCall(.init(id: callId, accessHash: accessHash)), source: Int32(bitPattern: source)))
|
||||
|> mapError { _ -> LeaveGroupCallError in
|
||||
return .generic
|
||||
}
|
||||
|
|
@ -1120,7 +1120,7 @@ public enum StopGroupCallError {
|
|||
}
|
||||
|
||||
func _internal_stopGroupCall(account: Account, peerId: PeerId?, callId: Int64, accessHash: Int64) -> Signal<Never, StopGroupCallError> {
|
||||
return account.network.request(Api.functions.phone.discardGroupCall(call: .inputGroupCall(id: callId, accessHash: accessHash)))
|
||||
return account.network.request(Api.functions.phone.discardGroupCall(call: .inputGroupCall(.init(id: callId, accessHash: accessHash))))
|
||||
|> mapError { _ -> StopGroupCallError in
|
||||
return .generic
|
||||
}
|
||||
|
|
@ -1164,7 +1164,7 @@ func _internal_stopGroupCall(account: Account, peerId: PeerId?, callId: Int64, a
|
|||
}
|
||||
|
||||
func _internal_checkGroupCall(account: Account, callId: Int64, accessHash: Int64, ssrcs: [UInt32]) -> Signal<[UInt32], NoError> {
|
||||
return account.network.request(Api.functions.phone.checkGroupCall(call: .inputGroupCall(id: callId, accessHash: accessHash), sources: ssrcs.map(Int32.init(bitPattern:))))
|
||||
return account.network.request(Api.functions.phone.checkGroupCall(call: .inputGroupCall(.init(id: callId, accessHash: accessHash)), sources: ssrcs.map(Int32.init(bitPattern:))))
|
||||
|> `catch` { _ -> Signal<[Int32], NoError> in
|
||||
return .single([])
|
||||
}
|
||||
|
|
@ -2495,7 +2495,8 @@ public final class GroupCallParticipantsContext {
|
|||
switch update {
|
||||
case let .updateGroupCallParticipants(call, participants, version):
|
||||
switch call {
|
||||
case let .inputGroupCall(updateCallId, _):
|
||||
case let .inputGroupCall(inputGroupCallData):
|
||||
let updateCallId = inputGroupCallData.id
|
||||
if updateCallId != id {
|
||||
continue loop
|
||||
}
|
||||
|
|
@ -2507,9 +2508,9 @@ public final class GroupCallParticipantsContext {
|
|||
break
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
strongSelf.addUpdates(updates: stateUpdates)
|
||||
|
||||
|
||||
strongSelf.account.stateManager.addUpdates(updates)
|
||||
} else {
|
||||
strongSelf.stateValue.overlayState.pendingMuteStateChanges.removeValue(forKey: peerId)
|
||||
|
|
@ -2583,7 +2584,8 @@ public final class GroupCallParticipantsContext {
|
|||
switch update {
|
||||
case let .updateGroupCallParticipants(call, participants, version):
|
||||
switch call {
|
||||
case let .inputGroupCall(updateCallId, _):
|
||||
case let .inputGroupCall(inputGroupCallData):
|
||||
let updateCallId = inputGroupCallData.id
|
||||
if updateCallId != id {
|
||||
continue loop
|
||||
}
|
||||
|
|
@ -2808,7 +2810,7 @@ func _internal_inviteToGroupCall(account: Account, callId: Int64, accessHash: In
|
|||
return .fail(.generic)
|
||||
}
|
||||
|
||||
return account.network.request(Api.functions.phone.inviteToGroupCall(call: .inputGroupCall(id: callId, accessHash: accessHash), users: [apiUser]))
|
||||
return account.network.request(Api.functions.phone.inviteToGroupCall(call: .inputGroupCall(.init(id: callId, accessHash: accessHash)), users: [apiUser]))
|
||||
|> mapError { _ -> InviteToGroupCallError in
|
||||
return .generic
|
||||
}
|
||||
|
|
@ -2882,7 +2884,7 @@ public enum EditGroupCallTitleError {
|
|||
}
|
||||
|
||||
func _internal_editGroupCallTitle(account: Account, callId: Int64, accessHash: Int64, title: String) -> Signal<Never, EditGroupCallTitleError> {
|
||||
return account.network.request(Api.functions.phone.editGroupCallTitle(call: .inputGroupCall(id: callId, accessHash: accessHash), title: title)) |> mapError { _ -> EditGroupCallTitleError in
|
||||
return account.network.request(Api.functions.phone.editGroupCallTitle(call: .inputGroupCall(.init(id: callId, accessHash: accessHash)), title: title)) |> mapError { _ -> EditGroupCallTitleError in
|
||||
return .generic
|
||||
}
|
||||
|> mapToSignal { result -> Signal<Never, EditGroupCallTitleError> in
|
||||
|
|
@ -3058,7 +3060,7 @@ public final class AudioBroadcastDataSource {
|
|||
}
|
||||
|
||||
func _internal_getAudioBroadcastDataSource(account: Account, callId: Int64, accessHash: Int64) -> Signal<AudioBroadcastDataSource?, NoError> {
|
||||
return account.network.request(Api.functions.phone.getGroupCall(call: .inputGroupCall(id: callId, accessHash: accessHash), limit: 4))
|
||||
return account.network.request(Api.functions.phone.getGroupCall(call: .inputGroupCall(.init(id: callId, accessHash: accessHash)), limit: 4))
|
||||
|> map(Optional.init)
|
||||
|> `catch` { _ -> Signal<Api.phone.GroupCall?, NoError> in
|
||||
return .single(nil)
|
||||
|
|
@ -3109,7 +3111,7 @@ func _internal_getAudioBroadcastPart(dataSource: AudioBroadcastDataSource, callI
|
|||
return .single(GetAudioBroadcastPartResult(status: .notReady, responseTimestamp: Double(timestampIdMilliseconds) / 1000.0))
|
||||
}
|
||||
|
||||
return dataSource.download.requestWithAdditionalData(Api.functions.upload.getFile(flags: 0, location: .inputGroupCallStream(flags: 0, call: .inputGroupCall(id: callId, accessHash: accessHash), timeMs: timestampIdMilliseconds, scale: scale, videoChannel: nil, videoQuality: nil), offset: 0, limit: 128 * 1024), automaticFloodWait: false, failOnServerErrors: true)
|
||||
return dataSource.download.requestWithAdditionalData(Api.functions.upload.getFile(flags: 0, location: .inputGroupCallStream(.init(flags: 0, call: .inputGroupCall(.init(id: callId, accessHash: accessHash)), timeMs: timestampIdMilliseconds, scale: scale, videoChannel: nil, videoQuality: nil)), offset: 0, limit: 128 * 1024), automaticFloodWait: false, failOnServerErrors: true)
|
||||
|> map { result, responseTimestamp -> GetAudioBroadcastPartResult in
|
||||
switch result {
|
||||
case let .file(_, _, bytes):
|
||||
|
|
@ -3162,7 +3164,7 @@ func _internal_getVideoBroadcastPart(dataSource: AudioBroadcastDataSource, callI
|
|||
return .single(GetAudioBroadcastPartResult(status: .notReady, responseTimestamp: Double(timestampIdMilliseconds) / 1000.0))
|
||||
}
|
||||
|
||||
return dataSource.download.requestWithAdditionalData(Api.functions.upload.getFile(flags: 0, location: .inputGroupCallStream(flags: 1 << 0, call: .inputGroupCall(id: callId, accessHash: accessHash), timeMs: timestampIdMilliseconds, scale: scale, videoChannel: channelId, videoQuality: quality), offset: 0, limit: 512 * 1024), automaticFloodWait: false, failOnServerErrors: true)
|
||||
return dataSource.download.requestWithAdditionalData(Api.functions.upload.getFile(flags: 0, location: .inputGroupCallStream(.init(flags: 1 << 0, call: .inputGroupCall(.init(id: callId, accessHash: accessHash)), timeMs: timestampIdMilliseconds, scale: scale, videoChannel: channelId, videoQuality: quality)), offset: 0, limit: 512 * 1024), automaticFloodWait: false, failOnServerErrors: true)
|
||||
|> map { result, responseTimestamp -> GetAudioBroadcastPartResult in
|
||||
switch result {
|
||||
case let .file(_, _, bytes):
|
||||
|
|
@ -3339,7 +3341,7 @@ func _internal_createConferenceCall(postbox: Postbox, network: Network, accountP
|
|||
|
||||
updatePeers(transaction: transaction, accountPeerId: accountPeerId, peers: parsedPeers)
|
||||
|
||||
let speakerInvite: Signal<EngineCreatedGroupCall, CreateConferenceCallError> = network.request(Api.functions.phone.exportGroupCallInvite(flags: 1 << 0, call: .inputGroupCall(id: info.id, accessHash: info.accessHash)))
|
||||
let speakerInvite: Signal<EngineCreatedGroupCall, CreateConferenceCallError> = network.request(Api.functions.phone.exportGroupCallInvite(flags: 1 << 0, call: .inputGroupCall(.init(id: info.id, accessHash: info.accessHash))))
|
||||
|> map(Optional.init)
|
||||
|> `catch` { _ -> Signal<Api.phone.ExportedGroupCallInvite?, NoError> in
|
||||
return .single(nil)
|
||||
|
|
@ -3426,7 +3428,7 @@ func _internal_pollConferenceCallBlockchain(network: Network, reference: Interna
|
|||
}
|
||||
|
||||
func _internal_sendConferenceCallBroadcast(account: Account, callId: Int64, accessHash: Int64, block: Data) -> Signal<Never, NoError> {
|
||||
return account.network.request(Api.functions.phone.sendConferenceCallBroadcast(call: .inputGroupCall(id: callId, accessHash: accessHash), block: Buffer(data: block)))
|
||||
return account.network.request(Api.functions.phone.sendConferenceCallBroadcast(call: .inputGroupCall(.init(id: callId, accessHash: accessHash)), block: Buffer(data: block)))
|
||||
|> retry(retryOnError: { _ in
|
||||
return true
|
||||
}, delayIncrement: 0.1, maxDelay: 1.0, maxRetries: 5, onQueue: Queue.concurrentDefaultQueue())
|
||||
|
|
|
|||
|
|
@ -158,7 +158,7 @@ public extension TelegramEngine {
|
|||
}
|
||||
|
||||
public func requestStreamState(dataSource: AudioBroadcastDataSource, callId: Int64, accessHash: Int64) -> Signal<EngineCallStreamState?, NoError> {
|
||||
return dataSource.download.request(Api.functions.phone.getGroupCallStreamChannels(call: .inputGroupCall(id: callId, accessHash: accessHash)))
|
||||
return dataSource.download.request(Api.functions.phone.getGroupCallStreamChannels(call: .inputGroupCall(.init(id: callId, accessHash: accessHash))))
|
||||
|> mapToSignal { result -> Signal<EngineCallStreamState?, MTRpcError> in
|
||||
switch result {
|
||||
case let .groupCallStreamChannels(channels):
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@ func _internal_importContact(account: Account, firstName: String, lastName: Stri
|
|||
note = .textWithEntities(text: noteText, entities: apiEntitiesFromMessageTextEntities(noteEntities, associatedPeers: SimpleDictionary()))
|
||||
}
|
||||
|
||||
let input = Api.InputContact.inputPhoneContact(flags: 0, clientId: 1, phone: phoneNumber, firstName: firstName, lastName: lastName, note: note)
|
||||
let input = Api.InputContact.inputPhoneContact(.init(flags: 0, clientId: 1, phone: phoneNumber, firstName: firstName, lastName: lastName, note: note))
|
||||
|
||||
return account.network.request(Api.functions.contacts.importContacts(contacts: [input]))
|
||||
|> map(Optional.init)
|
||||
|
|
|
|||
|
|
@ -164,7 +164,7 @@ func _internal_toggleForumThreadUnreadMarkInteractively(transaction: Transaction
|
|||
if peer.isForum {
|
||||
} else if peer.isMonoForum {
|
||||
if let inputPeer = apiInputPeer(peer), let subPeer = transaction.getPeer(PeerId(threadId)).flatMap(apiInputPeer) {
|
||||
let _ = network.request(Api.functions.messages.markDialogUnread(flags: 1 << 0, parentPeer: inputPeer, peer: .inputDialogPeer(peer: subPeer))).start()
|
||||
let _ = network.request(Api.functions.messages.markDialogUnread(flags: 1 << 0, parentPeer: inputPeer, peer: .inputDialogPeer(.init(peer: subPeer)))).start()
|
||||
}
|
||||
}
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -733,12 +733,12 @@ func _internal_getBotApp(account: Account, reference: BotAppReference) -> Signal
|
|||
let app: Api.InputBotApp
|
||||
switch reference {
|
||||
case let .id(id, accessHash):
|
||||
app = .inputBotAppID(id: id, accessHash: accessHash)
|
||||
app = .inputBotAppID(.init(id: id, accessHash: accessHash))
|
||||
case let .shortName(peerId, shortName):
|
||||
guard let bot = transaction.getPeer(peerId), let inputBot = apiInputUser(bot) else {
|
||||
return .fail(.generic)
|
||||
}
|
||||
app = .inputBotAppShortName(botId: inputBot, shortName: shortName)
|
||||
app = .inputBotAppShortName(.init(botId: inputBot, shortName: shortName))
|
||||
}
|
||||
|
||||
return account.network.request(Api.functions.messages.getBotApp(app: app, hash: 0))
|
||||
|
|
|
|||
|
|
@ -320,12 +320,12 @@ func _internal_requestAppWebView(postbox: Postbox, network: Network, stateManage
|
|||
let app: Api.InputBotApp
|
||||
switch appReference {
|
||||
case let .id(id, accessHash):
|
||||
app = .inputBotAppID(id: id, accessHash: accessHash)
|
||||
app = .inputBotAppID(.init(id: id, accessHash: accessHash))
|
||||
case let .shortName(peerId, shortName):
|
||||
guard let bot = transaction.getPeer(peerId), let inputBot = apiInputUser(bot) else {
|
||||
return .fail(.generic)
|
||||
}
|
||||
app = .inputBotAppShortName(botId: inputBot, shortName: shortName)
|
||||
app = .inputBotAppShortName(.init(botId: inputBot, shortName: shortName))
|
||||
}
|
||||
|
||||
var flags: Int32 = 0
|
||||
|
|
|
|||
|
|
@ -757,15 +757,15 @@ extension TelegramBusinessIntro {
|
|||
if let stickerFile = self.stickerFile {
|
||||
if let fileResource = stickerFile.resource as? CloudDocumentMediaResource, let resource = stickerFile.resource as? TelegramCloudMediaResourceWithFileReference, let reference = resource.fileReference {
|
||||
flags |= 1 << 0
|
||||
sticker = .inputDocument(id: fileResource.fileId, accessHash: fileResource.accessHash, fileReference: Buffer(data: reference))
|
||||
sticker = .inputDocument(.init(id: fileResource.fileId, accessHash: fileResource.accessHash, fileReference: Buffer(data: reference)))
|
||||
}
|
||||
}
|
||||
return .inputBusinessIntro(
|
||||
return .inputBusinessIntro(.init(
|
||||
flags: flags,
|
||||
title: self.title,
|
||||
description: self.text,
|
||||
sticker: sticker
|
||||
)
|
||||
))
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -905,7 +905,7 @@ extension TelegramBusinessRecipients {
|
|||
flags |= 1 << 4
|
||||
}
|
||||
|
||||
return .inputBusinessRecipients(flags: flags, users: users)
|
||||
return .inputBusinessRecipients(.init(flags: flags, users: users))
|
||||
}
|
||||
|
||||
func apiInputBotValue(additionalPeers: [Peer], excludePeers: [Peer]) -> Api.InputBusinessBotRecipients {
|
||||
|
|
@ -942,7 +942,7 @@ extension TelegramBusinessRecipients {
|
|||
flags |= 1 << 6
|
||||
}
|
||||
|
||||
return .inputBusinessBotRecipients(flags: flags, users: users, excludeUsers: excludeUsers)
|
||||
return .inputBusinessBotRecipients(.init(flags: flags, users: users, excludeUsers: excludeUsers))
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -956,11 +956,11 @@ func _internal_updateBusinessGreetingMessage(account: Account, greetingMessage:
|
|||
|> mapToSignal { additionalPeers in
|
||||
var mappedMessage: Api.InputBusinessGreetingMessage?
|
||||
if let greetingMessage {
|
||||
mappedMessage = .inputBusinessGreetingMessage(
|
||||
mappedMessage = .inputBusinessGreetingMessage(.init(
|
||||
shortcutId: greetingMessage.shortcutId,
|
||||
recipients: greetingMessage.recipients.apiInputValue(additionalPeers: additionalPeers),
|
||||
noActivityDays: Int32(clamping: greetingMessage.inactivityDays)
|
||||
)
|
||||
))
|
||||
}
|
||||
|
||||
var flags: Int32 = 0
|
||||
|
|
@ -1013,12 +1013,12 @@ func _internal_updateBusinessAwayMessage(account: Account, awayMessage: Telegram
|
|||
flags |= 1 << 0
|
||||
}
|
||||
|
||||
mappedMessage = .inputBusinessAwayMessage(
|
||||
mappedMessage = .inputBusinessAwayMessage(.init(
|
||||
flags: flags,
|
||||
shortcutId: awayMessage.shortcutId,
|
||||
schedule: mappedSchedule,
|
||||
recipients: awayMessage.recipients.apiInputValue(additionalPeers: additionalPeers)
|
||||
)
|
||||
))
|
||||
}
|
||||
|
||||
var flags: Int32 = 0
|
||||
|
|
@ -1177,7 +1177,7 @@ public func _internal_setAccountConnectedBot(account: Account, bot: TelegramAcco
|
|||
var flags: Int32 = 0
|
||||
var mappedRights: Api.BusinessBotRights?
|
||||
var mappedBot: Api.InputUser = .inputUserEmpty
|
||||
var mappedRecipients: Api.InputBusinessBotRecipients = .inputBusinessBotRecipients(flags: 0, users: nil, excludeUsers: nil)
|
||||
var mappedRecipients: Api.InputBusinessBotRecipients = .inputBusinessBotRecipients(.init(flags: 0, users: nil, excludeUsers: nil))
|
||||
|
||||
if let bot, let inputBotUser = botUser.flatMap(apiInputUser) {
|
||||
mappedBot = inputBotUser
|
||||
|
|
|
|||
|
|
@ -119,7 +119,7 @@ func _internal_requestChatContextResults(account: Account, botId: PeerId, peerId
|
|||
if let (latitude, longitude) = location {
|
||||
flags |= (1 << 0)
|
||||
let geoPointFlags: Int32 = 0
|
||||
geoPoint = Api.InputGeoPoint.inputGeoPoint(flags: geoPointFlags, lat: latitude, long: longitude, accuracyRadius: nil)
|
||||
geoPoint = Api.InputGeoPoint.inputGeoPoint(.init(flags: geoPointFlags, lat: latitude, long: longitude, accuracyRadius: nil))
|
||||
}
|
||||
|
||||
var signal: Signal<RequestChatContextResultsResult?, RequestChatContextResultsError> = account.network.request(Api.functions.messages.getInlineBotResults(flags: flags, bot: inputBot, peer: inputPeer, geoPoint: geoPoint, query: query, offset: offset))
|
||||
|
|
|
|||
|
|
@ -104,7 +104,7 @@ func _internal_requestMessageActionCallback(account: Account, messageId: Message
|
|||
guard let kdfResult = passwordKDF(encryptionProvider: account.network.encryptionProvider, password: password, derivation: currentPasswordDerivation, srpSessionData: srpSessionData) else {
|
||||
return .fail(.generic)
|
||||
}
|
||||
return .single(.inputCheckPasswordSRP(srpId: kdfResult.id, A: Buffer(data: kdfResult.A), M1: Buffer(data: kdfResult.M1)))
|
||||
return .single(.inputCheckPasswordSRP(.init(srpId: kdfResult.id, A: Buffer(data: kdfResult.A), M1: Buffer(data: kdfResult.M1))))
|
||||
} else {
|
||||
return .fail(.twoStepAuthMissing)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1595,7 +1595,7 @@ func _internal_deleteBotPreviews(account: Account, peerId: PeerId, language: Str
|
|||
inputMedia.append(.inputMediaPhoto(flags: 0, id: .inputPhoto(id: resource.photoId, accessHash: resource.accessHash, fileReference: Buffer(data: resource.fileReference)), ttlSeconds: nil))
|
||||
inputMedia.append(Api.InputMedia.inputMediaPhoto(flags: 0, id: Api.InputPhoto.inputPhoto(id: resource.photoId, accessHash: resource.accessHash, fileReference: Buffer(data: resource.fileReference)), ttlSeconds: nil))
|
||||
} else if let file = item as? TelegramMediaFile, let resource = file.resource as? CloudDocumentMediaResource {
|
||||
inputMedia.append(.inputMediaDocument(flags: 0, id: .inputDocument(id: resource.fileId, accessHash: resource.accessHash, fileReference: Buffer(data: resource.fileReference ?? Data())), videoCover: nil, videoTimestamp: nil, ttlSeconds: nil, query: nil))
|
||||
inputMedia.append(.inputMediaDocument(flags: 0, id: .inputDocument(.init(id: resource.fileId, accessHash: resource.accessHash, fileReference: Buffer(data: resource.fileReference ?? Data()))), videoCover: nil, videoTimestamp: nil, ttlSeconds: nil, query: nil))
|
||||
}
|
||||
}
|
||||
if language == nil {
|
||||
|
|
@ -1653,7 +1653,7 @@ func _internal_deleteBotPreviewsLanguage(account: Account, peerId: PeerId, langu
|
|||
inputMedia.append(.inputMediaPhoto(flags: 0, id: .inputPhoto(id: resource.photoId, accessHash: resource.accessHash, fileReference: Buffer(data: resource.fileReference)), ttlSeconds: nil))
|
||||
inputMedia.append(Api.InputMedia.inputMediaPhoto(flags: 0, id: Api.InputPhoto.inputPhoto(id: resource.photoId, accessHash: resource.accessHash, fileReference: Buffer(data: resource.fileReference)), ttlSeconds: nil))
|
||||
} else if let file = item as? TelegramMediaFile, let resource = file.resource as? CloudDocumentMediaResource {
|
||||
inputMedia.append(.inputMediaDocument(flags: 0, id: .inputDocument(id: resource.fileId, accessHash: resource.accessHash, fileReference: Buffer(data: resource.fileReference ?? Data())), videoCover: nil, videoTimestamp: nil, ttlSeconds: nil, query: nil))
|
||||
inputMedia.append(.inputMediaDocument(flags: 0, id: .inputDocument(.init(id: resource.fileId, accessHash: resource.accessHash, fileReference: Buffer(data: resource.fileReference ?? Data()))), videoCover: nil, videoTimestamp: nil, ttlSeconds: nil, query: nil))
|
||||
}
|
||||
}
|
||||
transaction.updatePeerCachedData(peerIds: Set([peerId]), update: { _, current -> CachedPeerData? in
|
||||
|
|
@ -1718,7 +1718,7 @@ func _internal_editStory(account: Account, peerId: PeerId, id: Int32, media: Eng
|
|||
if let result = result, case let .content(uploadedContent) = result, case let .media(media, _) = uploadedContent.content {
|
||||
inputMedia = media
|
||||
} else if case let .existing(media) = media, let file = media as? TelegramMediaFile, let resource = file.resource as? CloudDocumentMediaResource {
|
||||
inputMedia = .inputMediaUploadedDocument(flags: 0, file: .inputFileStoryDocument(id: .inputDocument(id: resource.fileId, accessHash: resource.accessHash, fileReference: Buffer(data: resource.fileReference))), thumb: nil, mimeType: file.mimeType, attributes: inputDocumentAttributesFromFileAttributes(file.attributes), stickers: nil, videoCover: nil, videoTimestamp: nil, ttlSeconds: nil)
|
||||
inputMedia = .inputMediaUploadedDocument(flags: 0, file: .inputFileStoryDocument(.init(id: .inputDocument(.init(id: resource.fileId, accessHash: resource.accessHash, fileReference: Buffer(data: resource.fileReference))))), thumb: nil, mimeType: file.mimeType, attributes: inputDocumentAttributesFromFileAttributes(file.attributes), stickers: nil, videoCover: nil, videoTimestamp: nil, ttlSeconds: nil)
|
||||
updatingCoverTime = true
|
||||
} else {
|
||||
inputMedia = nil
|
||||
|
|
|
|||
|
|
@ -3377,7 +3377,7 @@ public final class BotPreviewStoryListContext: StoryListContext {
|
|||
inputMedia.append(.inputMediaPhoto(flags: 0, id: .inputPhoto(id: resource.photoId, accessHash: resource.accessHash, fileReference: Buffer(data: resource.fileReference)), ttlSeconds: nil))
|
||||
inputMedia.append(Api.InputMedia.inputMediaPhoto(flags: 0, id: Api.InputPhoto.inputPhoto(id: resource.photoId, accessHash: resource.accessHash, fileReference: Buffer(data: resource.fileReference)), ttlSeconds: nil))
|
||||
} else if let file = item as? TelegramMediaFile, let resource = file.resource as? CloudDocumentMediaResource {
|
||||
inputMedia.append(.inputMediaDocument(flags: 0, id: .inputDocument(id: resource.fileId, accessHash: resource.accessHash, fileReference: Buffer(data: resource.fileReference ?? Data())), videoCover: nil, videoTimestamp: nil, ttlSeconds: nil, query: nil))
|
||||
inputMedia.append(.inputMediaDocument(flags: 0, id: .inputDocument(.init(id: resource.fileId, accessHash: resource.accessHash, fileReference: Buffer(data: resource.fileReference ?? Data()))), videoCover: nil, videoTimestamp: nil, ttlSeconds: nil, query: nil))
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -3614,7 +3614,7 @@ func _internal_requestStarGiftWithdrawalUrl(account: Account, reference: StarGif
|
|||
guard let kdfResult = passwordKDF(encryptionProvider: account.network.encryptionProvider, password: password, derivation: currentPasswordDerivation, srpSessionData: srpSessionData) else {
|
||||
return .fail(.generic)
|
||||
}
|
||||
return .single(.inputCheckPasswordSRP(srpId: kdfResult.id, A: Buffer(data: kdfResult.A), M1: Buffer(data: kdfResult.M1)))
|
||||
return .single(.inputCheckPasswordSRP(.init(srpId: kdfResult.id, A: Buffer(data: kdfResult.A), M1: Buffer(data: kdfResult.M1))))
|
||||
} else {
|
||||
return .fail(.twoStepAuthMissing)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -37,7 +37,7 @@ private func createChannel(postbox: Postbox, network: Network, stateManager: Acc
|
|||
var address: String?
|
||||
if let location = location {
|
||||
flags |= (1 << 2)
|
||||
geoPoint = .inputGeoPoint(flags: 0, lat: location.latitude, long: location.longitude, accuracyRadius: nil)
|
||||
geoPoint = .inputGeoPoint(.init(flags: 0, lat: location.latitude, long: location.longitude, accuracyRadius: nil))
|
||||
address = location.address
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -101,7 +101,7 @@ func _internal_updateChannelOwnership(account: Account, channelId: PeerId, membe
|
|||
guard let kdfResult = passwordKDF(encryptionProvider: account.network.encryptionProvider, password: password, derivation: currentPasswordDerivation, srpSessionData: srpSessionData) else {
|
||||
return .fail(.generic)
|
||||
}
|
||||
return .single(.inputCheckPasswordSRP(srpId: kdfResult.id, A: Buffer(data: kdfResult.A), M1: Buffer(data: kdfResult.M1)))
|
||||
return .single(.inputCheckPasswordSRP(.init(srpId: kdfResult.id, A: Buffer(data: kdfResult.A), M1: Buffer(data: kdfResult.M1))))
|
||||
} else {
|
||||
return .fail(.twoStepAuthMissing)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -677,7 +677,7 @@ private func requestChatListFilters(accountPeerId: PeerId, postbox: Postbox, net
|
|||
case .inputPeerSelf:
|
||||
missingUsers.append(.inputUserSelf)
|
||||
case let .inputPeerChannel(channelId, accessHash):
|
||||
missingChannels.append(.inputChannel(channelId: channelId, accessHash: accessHash))
|
||||
missingChannels.append(.inputChannel(.init(channelId: channelId, accessHash: accessHash)))
|
||||
case let .inputPeerChat(id):
|
||||
missingGroups.append(id)
|
||||
case .inputPeerEmpty:
|
||||
|
|
@ -783,7 +783,7 @@ private func requestChatListFilters(accountPeerId: PeerId, postbox: Postbox, net
|
|||
}
|
||||
|
||||
private func loadAndStorePeerChatInfos(accountPeerId: PeerId, postbox: Postbox, network: Network, peers: [Api.InputPeer]) -> Signal<Never, NoError> {
|
||||
let signal = network.request(Api.functions.messages.getPeerDialogs(peers: peers.map(Api.InputDialogPeer.inputDialogPeer(peer:))))
|
||||
let signal = network.request(Api.functions.messages.getPeerDialogs(peers: peers.map { .inputDialogPeer(.init(peer: $0)) }))
|
||||
|> map(Optional.init)
|
||||
|
||||
return signal
|
||||
|
|
|
|||
|
|
@ -72,7 +72,7 @@ func _internal_exportChatFolder(account: Account, filterId: Int32, title: String
|
|||
}
|
||||
|> castError(ExportChatFolderError.self)
|
||||
|> mapToSignal { inputPeers -> Signal<ExportedChatFolderLink, ExportChatFolderError> in
|
||||
return account.network.request(Api.functions.chatlists.exportChatlistInvite(chatlist: .inputChatlistDialogFilter(filterId: filterId), title: title, peers: inputPeers))
|
||||
return account.network.request(Api.functions.chatlists.exportChatlistInvite(chatlist: .inputChatlistDialogFilter(.init(filterId: filterId)), title: title, peers: inputPeers))
|
||||
|> `catch` { error -> Signal<Api.chatlists.ExportedChatlistInvite, ExportChatFolderError> in
|
||||
if error.errorDescription == "INVITES_TOO_MUCH" || error.errorDescription == "CHATLISTS_TOO_MUCH" {
|
||||
return account.postbox.transaction { transaction -> (AppConfiguration, Bool) in
|
||||
|
|
@ -155,7 +155,7 @@ func _internal_exportChatFolder(account: Account, filterId: Int32, title: String
|
|||
|
||||
func _internal_getExportedChatFolderLinks(account: Account, id: Int32) -> Signal<[ExportedChatFolderLink]?, NoError> {
|
||||
let accountPeerId = account.peerId
|
||||
return account.network.request(Api.functions.chatlists.getExportedInvites(chatlist: .inputChatlistDialogFilter(filterId: id)))
|
||||
return account.network.request(Api.functions.chatlists.getExportedInvites(chatlist: .inputChatlistDialogFilter(.init(filterId: id))))
|
||||
|> map(Optional.init)
|
||||
|> `catch` { _ -> Signal<Api.chatlists.ExportedInvites?, NoError> in
|
||||
return .single(nil)
|
||||
|
|
@ -208,7 +208,7 @@ func _internal_editChatFolderLink(account: Account, filterId: Int32, link: Expor
|
|||
flags |= 1 << 2
|
||||
peers = peerIds.compactMap(transaction.getPeer).compactMap(apiInputPeer)
|
||||
}
|
||||
return account.network.request(Api.functions.chatlists.editExportedInvite(flags: flags, chatlist: .inputChatlistDialogFilter(filterId: filterId), slug: link.slug, title: title, peers: peers))
|
||||
return account.network.request(Api.functions.chatlists.editExportedInvite(flags: flags, chatlist: .inputChatlistDialogFilter(.init(filterId: filterId)), slug: link.slug, title: title, peers: peers))
|
||||
|> mapError { _ -> EditChatFolderLinkError in
|
||||
return .generic
|
||||
}
|
||||
|
|
@ -234,7 +234,7 @@ public enum RevokeChatFolderLinkError {
|
|||
}
|
||||
|
||||
func _internal_deleteChatFolderLink(account: Account, filterId: Int32, link: ExportedChatFolderLink) -> Signal<Never, RevokeChatFolderLinkError> {
|
||||
return account.network.request(Api.functions.chatlists.deleteExportedInvite(chatlist: .inputChatlistDialogFilter(filterId: filterId), slug: link.slug))
|
||||
return account.network.request(Api.functions.chatlists.deleteExportedInvite(chatlist: .inputChatlistDialogFilter(.init(filterId: filterId)), slug: link.slug))
|
||||
|> mapError { error -> RevokeChatFolderLinkError in
|
||||
return .generic
|
||||
}
|
||||
|
|
@ -591,7 +591,7 @@ func _internal_pollChatFolderUpdatesOnce(account: Account, folderId: Int32) -> S
|
|||
firstTimeFolderUpdates.insert(key)
|
||||
}
|
||||
|
||||
return account.network.request(Api.functions.chatlists.getChatlistUpdates(chatlist: .inputChatlistDialogFilter(filterId: folderId)))
|
||||
return account.network.request(Api.functions.chatlists.getChatlistUpdates(chatlist: .inputChatlistDialogFilter(.init(filterId: folderId))))
|
||||
|> map(Optional.init)
|
||||
|> `catch` { _ -> Signal<Api.chatlists.ChatlistUpdates?, NoError> in
|
||||
return .single(nil)
|
||||
|
|
@ -693,7 +693,7 @@ func _internal_joinAvailableChatsInFolder(account: Account, updates: ChatFolderU
|
|||
}
|
||||
|> castError(JoinChatFolderLinkError.self)
|
||||
|> mapToSignal { inputPeers -> Signal<Never, JoinChatFolderLinkError> in
|
||||
return account.network.request(Api.functions.chatlists.joinChatlistUpdates(chatlist: .inputChatlistDialogFilter(filterId: updates.folderId), peers: inputPeers))
|
||||
return account.network.request(Api.functions.chatlists.joinChatlistUpdates(chatlist: .inputChatlistDialogFilter(.init(filterId: updates.folderId)), peers: inputPeers))
|
||||
|> `catch` { error -> Signal<Api.Updates, JoinChatFolderLinkError> in
|
||||
if error.errorDescription == "DIALOG_FILTERS_TOO_MUCH" {
|
||||
return account.postbox.transaction { transaction -> (AppConfiguration, Bool) in
|
||||
|
|
@ -748,7 +748,7 @@ func _internal_hideChatFolderUpdates(account: Account, folderId: Int32) -> Signa
|
|||
})
|
||||
}
|
||||
|> mapToSignal { _ -> Signal<Never, NoError> in
|
||||
return account.network.request(Api.functions.chatlists.hideChatlistUpdates(chatlist: .inputChatlistDialogFilter(filterId: folderId)))
|
||||
return account.network.request(Api.functions.chatlists.hideChatlistUpdates(chatlist: .inputChatlistDialogFilter(.init(filterId: folderId))))
|
||||
|> `catch` { _ -> Signal<Api.Bool, NoError> in
|
||||
return .single(.boolFalse)
|
||||
}
|
||||
|
|
@ -761,7 +761,7 @@ func _internal_leaveChatFolder(account: Account, folderId: Int32, removePeerIds:
|
|||
return removePeerIds.compactMap(transaction.getPeer).compactMap(apiInputPeer)
|
||||
}
|
||||
|> mapToSignal { inputPeers -> Signal<Never, NoError> in
|
||||
return account.network.request(Api.functions.chatlists.leaveChatlist(chatlist: .inputChatlistDialogFilter(filterId: folderId), peers: inputPeers))
|
||||
return account.network.request(Api.functions.chatlists.leaveChatlist(chatlist: .inputChatlistDialogFilter(.init(filterId: folderId)), peers: inputPeers))
|
||||
|> map(Optional.init)
|
||||
|> `catch` { _ -> Signal<Api.Updates?, NoError> in
|
||||
return .single(nil)
|
||||
|
|
@ -778,7 +778,7 @@ func _internal_leaveChatFolder(account: Account, folderId: Int32, removePeerIds:
|
|||
}
|
||||
|
||||
func _internal_requestLeaveChatFolderSuggestions(account: Account, folderId: Int32) -> Signal<[EnginePeer.Id], NoError> {
|
||||
return account.network.request(Api.functions.chatlists.getLeaveChatlistSuggestions(chatlist: .inputChatlistDialogFilter(filterId: folderId)))
|
||||
return account.network.request(Api.functions.chatlists.getLeaveChatlistSuggestions(chatlist: .inputChatlistDialogFilter(.init(filterId: folderId))))
|
||||
|> map { result -> [EnginePeer.Id] in
|
||||
return result.map(\.peerId)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ import Postbox
|
|||
import TelegramApi
|
||||
|
||||
func _internal_findChannelById(accountPeerId: PeerId, postbox: Postbox, network: Network, channelId: Int64) -> Signal<Peer?, NoError> {
|
||||
return network.request(Api.functions.channels.getChannels(id: [.inputChannel(channelId: channelId, accessHash: 0)]))
|
||||
return network.request(Api.functions.channels.getChannels(id: [.inputChannel(.init(channelId: channelId, accessHash: 0))]))
|
||||
|> map(Optional.init)
|
||||
|> `catch` { _ -> Signal<Api.messages.Chats?, NoError> in
|
||||
return .single(nil)
|
||||
|
|
|
|||
|
|
@ -269,7 +269,7 @@ func _internal_saveNotificationSound(account: Account, file: FileMediaReference,
|
|||
return .fail(.generic)
|
||||
}
|
||||
let accountPeerId = account.peerId
|
||||
return account.network.request(Api.functions.account.saveRingtone(id: .inputDocument(id: resource.fileId, accessHash: resource.accessHash, fileReference: Buffer(data: resource.fileReference)), unsave: unsave ? .boolTrue : .boolFalse))
|
||||
return account.network.request(Api.functions.account.saveRingtone(id: .inputDocument(.init(id: resource.fileId, accessHash: resource.accessHash, fileReference: Buffer(data: resource.fileReference))), unsave: unsave ? .boolTrue : .boolFalse))
|
||||
|> `catch` { error -> Signal<Api.account.SavedRingtone, MTRpcError> in
|
||||
if error.errorDescription == "FILE_REFERENCE_EXPIRED" {
|
||||
return revalidateMediaResourceReference(accountPeerId: accountPeerId, postbox: account.postbox, network: account.network, revalidationContext: account.mediaReferenceRevalidationContext, info: TelegramCloudMediaResourceFetchInfo(reference: file.abstract.resourceReference(file.media.resource), preferBackgroundReferenceRevalidation: false, continueInBackground: false), resource: file.media.resource)
|
||||
|
|
@ -280,8 +280,8 @@ func _internal_saveNotificationSound(account: Account, file: FileMediaReference,
|
|||
guard let resource = result.updatedResource as? CloudDocumentMediaResource else {
|
||||
return .fail(MTRpcError(errorCode: 500, errorDescription: "Internal"))
|
||||
}
|
||||
|
||||
return account.network.request(Api.functions.account.saveRingtone(id: .inputDocument(id: resource.fileId, accessHash: resource.accessHash, fileReference: Buffer(data: resource.fileReference)), unsave: unsave ? .boolTrue : .boolFalse))
|
||||
|
||||
return account.network.request(Api.functions.account.saveRingtone(id: .inputDocument(.init(id: resource.fileId, accessHash: resource.accessHash, fileReference: Buffer(data: resource.fileReference))), unsave: unsave ? .boolTrue : .boolFalse))
|
||||
}
|
||||
} else {
|
||||
return .fail(error)
|
||||
|
|
@ -354,7 +354,7 @@ func _internal_deleteNotificationSound(account: Account, fileId: Int64) -> Signa
|
|||
return .fail(.generic)
|
||||
}
|
||||
|
||||
return account.network.request(Api.functions.account.saveRingtone(id: .inputDocument(id: resource.fileId, accessHash: resource.accessHash, fileReference: Buffer(data: resource.fileReference)), unsave: .boolTrue))
|
||||
return account.network.request(Api.functions.account.saveRingtone(id: .inputDocument(.init(id: resource.fileId, accessHash: resource.accessHash, fileReference: Buffer(data: resource.fileReference))), unsave: .boolTrue))
|
||||
|> mapError { _ -> DeleteNotificationSoundError in
|
||||
return .generic
|
||||
}
|
||||
|
|
|
|||
|
|
@ -58,7 +58,7 @@ public struct UploadedPeerPhotoData {
|
|||
}
|
||||
|
||||
static func withResource(_ resource: MediaResource) -> UploadedPeerPhotoData {
|
||||
return UploadedPeerPhotoData(resource: resource, content: .result(.inputFile(.inputFile(id: 0, parts: 0, name: "", md5Checksum: ""))), local: true)
|
||||
return UploadedPeerPhotoData(resource: resource, content: .result(.inputFile(.inputFile(.init(id: 0, parts: 0, name: "", md5Checksum: "")))), local: true)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -164,8 +164,8 @@ func _internal_updatePeerPhotoInternal(postbox: Postbox, network: Network, state
|
|||
case let .progress(progress):
|
||||
let mappedProgress = 0.2 + progress * 0.8
|
||||
return .single((.progress(mappedProgress), photoResult.resource, videoResult.resource))
|
||||
case let .inputFile(file):
|
||||
videoFile = file
|
||||
case let .inputFile(videoInputFile):
|
||||
videoFile = videoInputFile
|
||||
break
|
||||
default:
|
||||
return .fail(.generic)
|
||||
|
|
@ -339,9 +339,9 @@ func _internal_updatePeerPhotoInternal(postbox: Postbox, network: Network, state
|
|||
|
||||
let request: Signal<Api.Updates, MTRpcError>
|
||||
if let peer = peer as? TelegramGroup {
|
||||
request = network.request(Api.functions.messages.editChatPhoto(chatId: peer.id.id._internalGetInt64Value(), photo: .inputChatUploadedPhoto(flags: flags, file: file, video: videoFile, videoStartTs: videoStartTimestamp, videoEmojiMarkup: videoEmojiMarkup)))
|
||||
request = network.request(Api.functions.messages.editChatPhoto(chatId: peer.id.id._internalGetInt64Value(), photo: .inputChatUploadedPhoto(.init(flags: flags, file: file, video: videoFile, videoStartTs: videoStartTimestamp, videoEmojiMarkup: videoEmojiMarkup))))
|
||||
} else if let peer = peer as? TelegramChannel, let inputChannel = apiInputChannel(peer) {
|
||||
request = network.request(Api.functions.channels.editPhoto(channel: inputChannel, photo: .inputChatUploadedPhoto(flags: flags, file: file, video: videoFile, videoStartTs: videoStartTimestamp, videoEmojiMarkup: videoEmojiMarkup)))
|
||||
request = network.request(Api.functions.channels.editPhoto(channel: inputChannel, photo: .inputChatUploadedPhoto(.init(flags: flags, file: file, video: videoFile, videoStartTs: videoStartTimestamp, videoEmojiMarkup: videoEmojiMarkup))))
|
||||
} else {
|
||||
assertionFailure()
|
||||
request = .complete()
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ func _internal_reportPeer(account: Account, peerId: PeerId) -> Signal<Void, NoEr
|
|||
return account.postbox.transaction { transaction -> Signal<Void, NoError> in
|
||||
if let peer = transaction.getPeer(peerId) {
|
||||
if let peer = peer as? TelegramSecretChat {
|
||||
return account.network.request(Api.functions.messages.reportEncryptedSpam(peer: Api.InputEncryptedChat.inputEncryptedChat(chatId: Int32(peer.id.id._internalGetInt64Value()), accessHash: peer.accessHash)))
|
||||
return account.network.request(Api.functions.messages.reportEncryptedSpam(peer: Api.InputEncryptedChat.inputEncryptedChat(.init(chatId: Int32(peer.id.id._internalGetInt64Value()), accessHash: peer.accessHash))))
|
||||
|> map(Optional.init)
|
||||
|> `catch` { _ -> Signal<Api.Bool?, NoError> in
|
||||
return .single(nil)
|
||||
|
|
|
|||
|
|
@ -54,7 +54,7 @@ func _internal_getSavedMusicById(postbox: Postbox, network: Network, peer: PeerR
|
|||
guard let inputUser, let resource = file.resource as? CloudDocumentMediaResource else {
|
||||
return .single(nil)
|
||||
}
|
||||
return network.request(Api.functions.users.getSavedMusicByID(id: inputUser, documents: [.inputDocument(id: resource.fileId, accessHash: resource.accessHash, fileReference: Buffer(data: resource.fileReference))]))
|
||||
return network.request(Api.functions.users.getSavedMusicByID(id: inputUser, documents: [.inputDocument(.init(id: resource.fileId, accessHash: resource.accessHash, fileReference: Buffer(data: resource.fileReference)))]))
|
||||
|> map(Optional.init)
|
||||
|> `catch` { _ -> Signal<Api.users.SavedMusic?, NoError> in
|
||||
return .single(nil)
|
||||
|
|
@ -188,9 +188,9 @@ func _internal_addSavedMusic(account: Account, file: FileMediaReference, afterFi
|
|||
var afterId: Api.InputDocument?
|
||||
if let afterFile, let resource = afterFile.media.resource as? CloudDocumentMediaResource {
|
||||
flags = 1 << 1
|
||||
afterId = .inputDocument(id: resource.fileId, accessHash: resource.accessHash, fileReference: Buffer(data: resource.fileReference))
|
||||
afterId = .inputDocument(.init(id: resource.fileId, accessHash: resource.accessHash, fileReference: Buffer(data: resource.fileReference)))
|
||||
}
|
||||
return account.network.request(Api.functions.account.saveMusic(flags: flags, id: .inputDocument(id: resource.fileId, accessHash: resource.accessHash, fileReference: Buffer(data: resource.fileReference)), afterId: afterId))
|
||||
return account.network.request(Api.functions.account.saveMusic(flags: flags, id: .inputDocument(.init(id: resource.fileId, accessHash: resource.accessHash, fileReference: Buffer(data: resource.fileReference))), afterId: afterId))
|
||||
})
|
||||
|> mapError { _ -> AddSavedMusicError in
|
||||
return .generic
|
||||
|
|
@ -233,7 +233,7 @@ func _internal_removeSavedMusic(account: Account, file: FileMediaReference) -> S
|
|||
}
|
||||
let flags: Int32 = 1 << 0
|
||||
return revalidatedMusic(account: account, file: file, signal: { resource in
|
||||
return account.network.request(Api.functions.account.saveMusic(flags: flags, id: .inputDocument(id: resource.fileId, accessHash: resource.accessHash, fileReference: Buffer(data: resource.fileReference)), afterId: nil))
|
||||
return account.network.request(Api.functions.account.saveMusic(flags: flags, id: .inputDocument(.init(id: resource.fileId, accessHash: resource.accessHash, fileReference: Buffer(data: resource.fileReference))), afterId: nil))
|
||||
})
|
||||
|> `catch` { _ -> Signal<Api.Bool, NoError> in
|
||||
return .complete()
|
||||
|
|
|
|||
|
|
@ -1648,7 +1648,7 @@ public extension TelegramEngine {
|
|||
}
|
||||
|
||||
public func getCollectibleUsernameInfo(username: String) -> Signal<TelegramCollectibleItemInfo?, NoError> {
|
||||
return self.account.network.request(Api.functions.fragment.getCollectibleInfo(collectible: .inputCollectibleUsername(username: username)))
|
||||
return self.account.network.request(Api.functions.fragment.getCollectibleInfo(collectible: .inputCollectibleUsername(.init(username: username))))
|
||||
|> map(Optional.init)
|
||||
|> `catch` { _ -> Signal<Api.fragment.CollectibleInfo?, NoError> in
|
||||
return .single(nil)
|
||||
|
|
@ -1673,7 +1673,7 @@ public extension TelegramEngine {
|
|||
}
|
||||
|
||||
public func getCollectiblePhoneNumberInfo(phoneNumber: String) -> Signal<TelegramCollectibleItemInfo?, NoError> {
|
||||
return self.account.network.request(Api.functions.fragment.getCollectibleInfo(collectible: .inputCollectiblePhone(phone: phoneNumber)))
|
||||
return self.account.network.request(Api.functions.fragment.getCollectibleInfo(collectible: .inputCollectiblePhone(.init(phone: phoneNumber))))
|
||||
|> map(Optional.init)
|
||||
|> `catch` { _ -> Signal<Api.fragment.CollectibleInfo?, NoError> in
|
||||
return .single(nil)
|
||||
|
|
|
|||
|
|
@ -559,7 +559,8 @@ func _internal_fetchAndUpdateCachedPeerData(accountPeerId: PeerId, peerId rawPee
|
|||
var updatedActiveCall: CachedChannelData.ActiveCall?
|
||||
if let inputCall = chatFullCall {
|
||||
switch inputCall {
|
||||
case let .inputGroupCall(id, accessHash):
|
||||
case let .inputGroupCall(inputGroupCallData):
|
||||
let (id, accessHash) = (inputGroupCallData.id, inputGroupCallData.accessHash)
|
||||
updatedActiveCall = CachedChannelData.ActiveCall(id: id, accessHash: accessHash, title: previous.activeCall?.title, scheduleTimestamp: previous.activeCall?.scheduleTimestamp, subscribedToScheduled: previous.activeCall?.subscribedToScheduled ?? false, isStream: previous.activeCall?.isStream)
|
||||
case .inputGroupCallSlug, .inputGroupCallInviteMessage:
|
||||
break
|
||||
|
|
@ -828,7 +829,8 @@ func _internal_fetchAndUpdateCachedPeerData(accountPeerId: PeerId, peerId rawPee
|
|||
var updatedActiveCall: CachedChannelData.ActiveCall?
|
||||
if let inputCall = inputCall {
|
||||
switch inputCall {
|
||||
case let .inputGroupCall(id, accessHash):
|
||||
case let .inputGroupCall(inputGroupCallData):
|
||||
let (id, accessHash) = (inputGroupCallData.id, inputGroupCallData.accessHash)
|
||||
updatedActiveCall = CachedChannelData.ActiveCall(id: id, accessHash: accessHash, title: previous.activeCall?.title, scheduleTimestamp: previous.activeCall?.scheduleTimestamp, subscribedToScheduled: previous.activeCall?.subscribedToScheduled ?? false, isStream: previous.activeCall?.isStream)
|
||||
case .inputGroupCallSlug, .inputGroupCallInviteMessage:
|
||||
break
|
||||
|
|
|
|||
|
|
@ -32,10 +32,10 @@ func _internal_updatePeersNearbyVisibility(account: Account, update: PeerNearbyV
|
|||
switch update {
|
||||
case let .visible(latitude, longitude):
|
||||
flags |= (1 << 0)
|
||||
geoPoint = .inputGeoPoint(flags: 0, lat: latitude, long: longitude, accuracyRadius: nil)
|
||||
geoPoint = .inputGeoPoint(.init(flags: 0, lat: latitude, long: longitude, accuracyRadius: nil))
|
||||
selfExpires = 10800
|
||||
case let .location(latitude, longitude):
|
||||
geoPoint = .inputGeoPoint(flags: 0, lat: latitude, long: longitude, accuracyRadius: nil)
|
||||
geoPoint = .inputGeoPoint(.init(flags: 0, lat: latitude, long: longitude, accuracyRadius: nil))
|
||||
case .invisible:
|
||||
flags |= (1 << 0)
|
||||
geoPoint = .inputGeoPointEmpty
|
||||
|
|
@ -95,7 +95,7 @@ public final class PeersNearbyContext {
|
|||
public init(network: Network, stateManager: AccountStateManager, coordinate: (latitude: Double, longitude: Double)) {
|
||||
let expiryExtension: Double = 10.0
|
||||
|
||||
let poll = network.request(Api.functions.contacts.getLocated(flags: 0, geoPoint: .inputGeoPoint(flags: 0, lat: coordinate.latitude, long: coordinate.longitude, accuracyRadius: nil), selfExpires: nil))
|
||||
let poll = network.request(Api.functions.contacts.getLocated(flags: 0, geoPoint: .inputGeoPoint(.init(flags: 0, lat: coordinate.latitude, long: coordinate.longitude, accuracyRadius: nil)), selfExpires: nil))
|
||||
|> map(Optional.init)
|
||||
|> `catch` { _ -> Signal<Api.Updates?, NoError> in
|
||||
return .single(nil)
|
||||
|
|
@ -241,7 +241,7 @@ public func updateChannelGeoLocation(postbox: Postbox, network: Network, channel
|
|||
|
||||
let geoPoint: Api.InputGeoPoint
|
||||
if let (latitude, longitude) = coordinate, let _ = address {
|
||||
geoPoint = .inputGeoPoint(flags: 0, lat: latitude, long: longitude, accuracyRadius: nil)
|
||||
geoPoint = .inputGeoPoint(.init(flags: 0, lat: latitude, long: longitude, accuracyRadius: nil))
|
||||
} else {
|
||||
geoPoint = .inputGeoPointEmpty
|
||||
}
|
||||
|
|
|
|||
|
|
@ -286,7 +286,7 @@ public func dropSecureId(network: Network, currentPassword: String) -> Signal<Vo
|
|||
if let currentPasswordDerivation = authData.currentPasswordDerivation, let srpSessionData = authData.srpSessionData {
|
||||
let kdfResult = passwordKDF(encryptionProvider: network.encryptionProvider, password: currentPassword, derivation: currentPasswordDerivation, srpSessionData: srpSessionData)
|
||||
if let kdfResult = kdfResult {
|
||||
checkPassword = .inputCheckPasswordSRP(srpId: kdfResult.id, A: Buffer(data: kdfResult.A), M1: Buffer(data: kdfResult.M1))
|
||||
checkPassword = .inputCheckPasswordSRP(.init(srpId: kdfResult.id, A: Buffer(data: kdfResult.A), M1: Buffer(data: kdfResult.M1)))
|
||||
} else {
|
||||
return .fail(.generic)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ import TelegramApi
|
|||
|
||||
extension SecureFileMediaResource: TelegramCloudMediaResource, TelegramMultipartFetchableResource, EncryptedMediaResource {
|
||||
func apiInputLocation(fileReference: Data?) -> Api.InputFileLocation? {
|
||||
return Api.InputFileLocation.inputSecureFileLocation(id: self.file.id, accessHash: self.file.accessHash)
|
||||
return Api.InputFileLocation.inputSecureFileLocation(.init(id: self.file.id, accessHash: self.file.accessHash))
|
||||
}
|
||||
|
||||
public func decrypt(data: Data, params: Any) -> Data? {
|
||||
|
|
|
|||
|
|
@ -112,12 +112,8 @@ public func uploadSecureIdFile(context: SecureIdAccessContext, postbox: Postbox,
|
|||
switch result {
|
||||
case let .progress(value):
|
||||
return .single(.progress(value))
|
||||
case let .inputFile(file):
|
||||
if case let .inputFile(id, parts, _, md5Checksum) = file {
|
||||
return .single(.result(UploadedSecureIdFile(id: id, parts: parts, md5Checksum: md5Checksum, fileHash: encryptedData.hash, encryptedSecret: encryptedData.encryptedSecret), encryptedData.data))
|
||||
} else {
|
||||
return .fail(.generic)
|
||||
}
|
||||
case let .inputFile(.inputFile(fileData)):
|
||||
return .single(.result(UploadedSecureIdFile(id: fileData.id, parts: fileData.parts, md5Checksum: fileData.md5Checksum, fileHash: encryptedData.hash, encryptedSecret: encryptedData.encryptedSecret), encryptedData.data))
|
||||
default:
|
||||
return .fail(.generic)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -243,12 +243,12 @@ func _internal_createStickerSet(account: Account, title: String, shortName: Stri
|
|||
flags |= (1 << 1)
|
||||
}
|
||||
|
||||
inputStickers.append(.inputStickerSetItem(flags: flags, document: .inputDocument(id: resource.fileId, accessHash: resource.accessHash, fileReference: Buffer(data: resource.fileReference ?? Data())), emoji: sticker.emojis.joined(), maskCoords: nil, keywords: sticker.keywords))
|
||||
inputStickers.append(.inputStickerSetItem(flags: flags, document: .inputDocument(.init(id: resource.fileId, accessHash: resource.accessHash, fileReference: Buffer(data: resource.fileReference ?? Data()))), emoji: sticker.emojis.joined(), maskCoords: nil, keywords: sticker.keywords))
|
||||
}
|
||||
var thumbnailDocument: Api.InputDocument?
|
||||
if thumbnail != nil, let resource = resources.last {
|
||||
flags |= (1 << 2)
|
||||
thumbnailDocument = .inputDocument(id: resource.fileId, accessHash: resource.accessHash, fileReference: Buffer(data: resource.fileReference ?? Data()))
|
||||
thumbnailDocument = .inputDocument(.init(id: resource.fileId, accessHash: resource.accessHash, fileReference: Buffer(data: resource.fileReference ?? Data())))
|
||||
}
|
||||
if let software = software, !software.isEmpty {
|
||||
flags |= (1 << 3)
|
||||
|
|
@ -388,7 +388,7 @@ func _internal_addStickerToStickerSet(account: Account, packReference: StickerPa
|
|||
if sticker.keywords.count > 0 {
|
||||
flags |= (1 << 1)
|
||||
}
|
||||
let inputSticker: Api.InputStickerSetItem = .inputStickerSetItem(flags: flags, document: .inputDocument(id: resource.fileId, accessHash: resource.accessHash, fileReference: Buffer(data: resource.fileReference ?? Data())), emoji: sticker.emojis.joined(), maskCoords: nil, keywords: sticker.keywords)
|
||||
let inputSticker: Api.InputStickerSetItem = .inputStickerSetItem(flags: flags, document: .inputDocument(.init(id: resource.fileId, accessHash: resource.accessHash, fileReference: Buffer(data: resource.fileReference ?? Data()))), emoji: sticker.emojis.joined(), maskCoords: nil, keywords: sticker.keywords)
|
||||
return account.network.request(Api.functions.stickers.addStickerToSet(stickerset: packReference.apiInputStickerSet, sticker: inputSticker))
|
||||
|> `catch` { error -> Signal<Api.messages.StickerSet, MTRpcError> in
|
||||
if error.errorDescription == "FILE_REFERENCE_EXPIRED" {
|
||||
|
|
@ -400,8 +400,8 @@ func _internal_addStickerToStickerSet(account: Account, packReference: StickerPa
|
|||
guard let resource = result.updatedResource as? CloudDocumentMediaResource else {
|
||||
return .fail(MTRpcError(errorCode: 500, errorDescription: "Internal"))
|
||||
}
|
||||
|
||||
let inputSticker: Api.InputStickerSetItem = .inputStickerSetItem(flags: flags, document: .inputDocument(id: resource.fileId, accessHash: resource.accessHash, fileReference: Buffer(data: resource.fileReference)), emoji: sticker.emojis.joined(), maskCoords: nil, keywords: sticker.keywords)
|
||||
|
||||
let inputSticker: Api.InputStickerSetItem = .inputStickerSetItem(flags: flags, document: .inputDocument(.init(id: resource.fileId, accessHash: resource.accessHash, fileReference: Buffer(data: resource.fileReference))), emoji: sticker.emojis.joined(), maskCoords: nil, keywords: sticker.keywords)
|
||||
|
||||
return account.network.request(Api.functions.stickers.addStickerToSet(stickerset: packReference.apiInputStickerSet, sticker: inputSticker))
|
||||
}
|
||||
|
|
@ -434,7 +434,7 @@ public enum ReorderStickerError {
|
|||
|
||||
func _internal_reorderSticker(account: Account, sticker: FileMediaReference, position: Int) -> Signal<Never, ReorderStickerError> {
|
||||
return revalidatedSticker(account: account, sticker: sticker, signal: { resource in
|
||||
return account.network.request(Api.functions.stickers.changeStickerPosition(sticker: .inputDocument(id: resource.fileId, accessHash: resource.accessHash, fileReference: Buffer(data: resource.fileReference)), position: Int32(position)))
|
||||
return account.network.request(Api.functions.stickers.changeStickerPosition(sticker: .inputDocument(.init(id: resource.fileId, accessHash: resource.accessHash, fileReference: Buffer(data: resource.fileReference))), position: Int32(position)))
|
||||
})
|
||||
|> mapError { error -> ReorderStickerError in
|
||||
return .generic
|
||||
|
|
@ -461,7 +461,7 @@ public enum DeleteStickerError {
|
|||
|
||||
func _internal_deleteStickerFromStickerSet(account: Account, sticker: FileMediaReference) -> Signal<Never, DeleteStickerError> {
|
||||
return revalidatedSticker(account: account, sticker: sticker, signal: { resource in
|
||||
return account.network.request(Api.functions.stickers.removeStickerFromSet(sticker: .inputDocument(id: resource.fileId, accessHash: resource.accessHash, fileReference: Buffer(data: resource.fileReference))))
|
||||
return account.network.request(Api.functions.stickers.removeStickerFromSet(sticker: .inputDocument(.init(id: resource.fileId, accessHash: resource.accessHash, fileReference: Buffer(data: resource.fileReference)))))
|
||||
})
|
||||
|> mapError { error -> DeleteStickerError in
|
||||
return .generic
|
||||
|
|
@ -508,9 +508,9 @@ func _internal_replaceSticker(account: Account, previousSticker: FileMediaRefere
|
|||
if sticker.keywords.count > 0 {
|
||||
flags |= (1 << 1)
|
||||
}
|
||||
let inputSticker: Api.InputStickerSetItem = .inputStickerSetItem(flags: flags, document: .inputDocument(id: resource.fileId, accessHash: resource.accessHash, fileReference: Buffer(data: resource.fileReference ?? Data())), emoji: sticker.emojis.joined(), maskCoords: nil, keywords: sticker.keywords)
|
||||
let inputSticker: Api.InputStickerSetItem = .inputStickerSetItem(flags: flags, document: .inputDocument(.init(id: resource.fileId, accessHash: resource.accessHash, fileReference: Buffer(data: resource.fileReference ?? Data()))), emoji: sticker.emojis.joined(), maskCoords: nil, keywords: sticker.keywords)
|
||||
return revalidatedSticker(account: account, sticker: previousSticker, signal: { previousResource in
|
||||
return account.network.request(Api.functions.stickers.replaceSticker(sticker: .inputDocument(id: previousResource.fileId, accessHash: previousResource.accessHash, fileReference: Buffer(data: previousResource.fileReference)), newSticker: inputSticker))
|
||||
return account.network.request(Api.functions.stickers.replaceSticker(sticker: .inputDocument(.init(id: previousResource.fileId, accessHash: previousResource.accessHash, fileReference: Buffer(data: previousResource.fileReference))), newSticker: inputSticker))
|
||||
})
|
||||
|> mapError { error -> ReplaceStickerError in
|
||||
return .generic
|
||||
|
|
|
|||
|
|
@ -85,7 +85,7 @@ func _internal_stickerPacksAttachedToMedia(account: Account, media: AnyMediaRefe
|
|||
inputMedia = .inputStickeredMediaPhoto(id: Api.InputPhoto.inputPhoto(id: imageId, accessHash: accessHash, fileReference: Buffer(data: fileReference ?? Data())))
|
||||
resourceReference = imageReference.resourceReference(representation.resource)
|
||||
} else if let fileReference = media.concrete(TelegramMediaFile.self), let resource = fileReference.media.resource as? CloudDocumentMediaResource {
|
||||
inputMedia = .inputStickeredMediaDocument(id: Api.InputDocument.inputDocument(id: resource.fileId, accessHash: resource.accessHash, fileReference: Buffer(data: resource.fileReference ?? Data())))
|
||||
inputMedia = .inputStickeredMediaDocument(id: Api.InputDocument.inputDocument(.init(id: resource.fileId, accessHash: resource.accessHash, fileReference: Buffer(data: resource.fileReference ?? Data()))))
|
||||
resourceReference = fileReference.resourceReference(fileReference.media.resource)
|
||||
} else {
|
||||
return .single([])
|
||||
|
|
@ -103,7 +103,7 @@ func _internal_stickerPacksAttachedToMedia(account: Account, media: AnyMediaRefe
|
|||
if let imageReference = media.concrete(TelegramMediaImage.self), let reference = imageReference.media.reference, case let .cloud(imageId, accessHash, _) = reference, let _ = largestImageRepresentation(imageReference.media.representations) {
|
||||
inputMedia = .inputStickeredMediaPhoto(id: Api.InputPhoto.inputPhoto(id: imageId, accessHash: accessHash, fileReference: Buffer(data: updatedReference)))
|
||||
} else if let fileReference = media.concrete(TelegramMediaFile.self), let resource = fileReference.media.resource as? CloudDocumentMediaResource {
|
||||
inputMedia = .inputStickeredMediaDocument(id: Api.InputDocument.inputDocument(id: resource.fileId, accessHash: resource.accessHash, fileReference: Buffer(data: updatedReference)))
|
||||
inputMedia = .inputStickeredMediaDocument(id: Api.InputDocument.inputDocument(.init(id: resource.fileId, accessHash: resource.accessHash, fileReference: Buffer(data: updatedReference))))
|
||||
} else {
|
||||
return .single([])
|
||||
}
|
||||
|
|
|
|||
|
|
@ -182,11 +182,11 @@ extension ChatTheme {
|
|||
var apiChatTheme: Api.InputChatTheme {
|
||||
switch self {
|
||||
case let .emoticon(emoticon):
|
||||
return .inputChatTheme(emoticon: emoticon)
|
||||
return .inputChatTheme(.init(emoticon: emoticon))
|
||||
case let .gift(gift, _):
|
||||
switch gift {
|
||||
case let .unique(uniqueGift):
|
||||
return .inputChatThemeUniqueGift(slug: uniqueGift.slug)
|
||||
return .inputChatThemeUniqueGift(.init(slug: uniqueGift.slug))
|
||||
default:
|
||||
fatalError()
|
||||
}
|
||||
|
|
|
|||
|
|
@ -251,8 +251,8 @@ private func uploadTheme(account: Account, resource: MediaResource, thumbnailDat
|
|||
case let .inputFile(file):
|
||||
var flags: Int32 = 0
|
||||
var thumbnailFile: Api.InputFile?
|
||||
if let thumbnailResult = thumbnailResult?.content, case let .result(result) = thumbnailResult, case let .inputFile(file) = result {
|
||||
thumbnailFile = file
|
||||
if let thumbnailResult = thumbnailResult?.content, case let .result(result) = thumbnailResult, case let .inputFile(thumbFile) = result {
|
||||
thumbnailFile = thumbFile
|
||||
flags |= 1 << 0
|
||||
}
|
||||
return account.network.request(Api.functions.account.uploadTheme(flags: flags, file: file, thumb: thumbnailFile, fileName: fileName, mimeType: mimeType))
|
||||
|
|
@ -302,7 +302,7 @@ public func createTheme(account: Account, title: String, resource: MediaResource
|
|||
switch result {
|
||||
case let .complete(file):
|
||||
if let resource = file.resource as? CloudDocumentMediaResource {
|
||||
return account.network.request(Api.functions.account.createTheme(flags: flags, slug: "", title: title, document: .inputDocument(id: resource.fileId, accessHash: resource.accessHash, fileReference: Buffer(data: resource.fileReference)), settings: inputSettings))
|
||||
return account.network.request(Api.functions.account.createTheme(flags: flags, slug: "", title: title, document: .inputDocument(.init(id: resource.fileId, accessHash: resource.accessHash, fileReference: Buffer(data: resource.fileReference))), settings: inputSettings))
|
||||
|> mapError { error in
|
||||
if error.errorDescription == "THEME_SLUG_INVALID" {
|
||||
return .slugInvalid
|
||||
|
|
@ -408,7 +408,7 @@ public func updateTheme(account: Account, accountManager: AccountManager<Telegra
|
|||
switch status {
|
||||
case let .complete(file):
|
||||
if let resource = file.resource as? CloudDocumentMediaResource {
|
||||
inputDocument = .inputDocument(id: resource.fileId, accessHash: resource.accessHash, fileReference: Buffer(data: resource.fileReference))
|
||||
inputDocument = .inputDocument(.init(id: resource.fileId, accessHash: resource.accessHash, fileReference: Buffer(data: resource.fileReference)))
|
||||
} else {
|
||||
return .fail(.generic)
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue