no message

This commit is contained in:
Peter 2018-06-08 19:28:27 +03:00
parent f4758d0b0d
commit 4c2f395ee6
13 changed files with 269 additions and 183 deletions

View File

@ -437,6 +437,7 @@ public enum AccountServiceTaskMasterMode {
public struct AccountNetworkProxyState: Equatable { public struct AccountNetworkProxyState: Equatable {
public let address: String public let address: String
public let hasConnectionIssues: Bool
} }
public enum AccountNetworkState: Equatable { public enum AccountNetworkState: Equatable {
@ -639,15 +640,28 @@ public class Account {
switch connectionStatus { switch connectionStatus {
case .waitingForNetwork: case .waitingForNetwork:
return .waitingForNetwork return .waitingForNetwork
case let .connecting(proxyAddress): case let .connecting(proxyAddress, proxyHasConnectionIssues):
return .connecting(proxy: proxyAddress.flatMap(AccountNetworkProxyState.init(address:))) var proxyState: AccountNetworkProxyState?
if let proxyAddress = proxyAddress {
proxyState = AccountNetworkProxyState(address: proxyAddress, hasConnectionIssues: proxyHasConnectionIssues)
}
return .connecting(proxy: proxyState)
case let .updating(proxyAddress): case let .updating(proxyAddress):
return .updating(proxy: proxyAddress.flatMap(AccountNetworkProxyState.init(address:))) var proxyState: AccountNetworkProxyState?
if let proxyAddress = proxyAddress {
proxyState = AccountNetworkProxyState(address: proxyAddress, hasConnectionIssues: false)
}
return .updating(proxy: proxyState)
case let .online(proxyAddress): case let .online(proxyAddress):
var proxyState: AccountNetworkProxyState?
if let proxyAddress = proxyAddress {
proxyState = AccountNetworkProxyState(address: proxyAddress, hasConnectionIssues: false)
}
if isUpdating { if isUpdating {
return .updating(proxy: proxyAddress.flatMap(AccountNetworkProxyState.init(address:))) return .updating(proxy: proxyState)
} else { } else {
return .online(proxy: proxyAddress.flatMap(AccountNetworkProxyState.init(address:))) return .online(proxy: proxyState)
} }
} }
} }

View File

@ -245,10 +245,10 @@ fileprivate let parsers: [Int32 : (BufferReader) -> Any?] = {
dict[-2054908813] = { return Api.WebPage.parse_webPageNotModified($0) } dict[-2054908813] = { return Api.WebPage.parse_webPageNotModified($0) }
dict[1036876423] = { return Api.InputBotInlineMessage.parse_inputBotInlineMessageText($0) } dict[1036876423] = { return Api.InputBotInlineMessage.parse_inputBotInlineMessageText($0) }
dict[-190472735] = { return Api.InputBotInlineMessage.parse_inputBotInlineMessageMediaGeo($0) } dict[-190472735] = { return Api.InputBotInlineMessage.parse_inputBotInlineMessageMediaGeo($0) }
dict[766443943] = { return Api.InputBotInlineMessage.parse_inputBotInlineMessageMediaContact($0) }
dict[1262639204] = { return Api.InputBotInlineMessage.parse_inputBotInlineMessageGame($0) } dict[1262639204] = { return Api.InputBotInlineMessage.parse_inputBotInlineMessageGame($0) }
dict[864077702] = { return Api.InputBotInlineMessage.parse_inputBotInlineMessageMediaAuto($0) } dict[864077702] = { return Api.InputBotInlineMessage.parse_inputBotInlineMessageMediaAuto($0) }
dict[1098628881] = { return Api.InputBotInlineMessage.parse_inputBotInlineMessageMediaVenue($0) } dict[1098628881] = { return Api.InputBotInlineMessage.parse_inputBotInlineMessageMediaVenue($0) }
dict[-1494368259] = { return Api.InputBotInlineMessage.parse_inputBotInlineMessageMediaContact($0) }
dict[2002815875] = { return Api.KeyboardButtonRow.parse_keyboardButtonRow($0) } dict[2002815875] = { return Api.KeyboardButtonRow.parse_keyboardButtonRow($0) }
dict[1434820921] = { return Api.StickerSet.parse_stickerSet($0) } dict[1434820921] = { return Api.StickerSet.parse_stickerSet($0) }
dict[539045032] = { return Api.photos.Photo.parse_photo($0) } dict[539045032] = { return Api.photos.Photo.parse_photo($0) }
@ -271,7 +271,6 @@ fileprivate let parsers: [Int32 : (BufferReader) -> Any?] = {
dict[-1964327229] = { return Api.SecureData.parse_secureData($0) } dict[-1964327229] = { return Api.SecureData.parse_secureData($0) }
dict[-1771768449] = { return Api.InputMedia.parse_inputMediaEmpty($0) } dict[-1771768449] = { return Api.InputMedia.parse_inputMediaEmpty($0) }
dict[-104578748] = { return Api.InputMedia.parse_inputMediaGeoPoint($0) } dict[-104578748] = { return Api.InputMedia.parse_inputMediaGeoPoint($0) }
dict[-1494984313] = { return Api.InputMedia.parse_inputMediaContact($0) }
dict[1212395773] = { return Api.InputMedia.parse_inputMediaGifExternal($0) } dict[1212395773] = { return Api.InputMedia.parse_inputMediaGifExternal($0) }
dict[-750828557] = { return Api.InputMedia.parse_inputMediaGame($0) } dict[-750828557] = { return Api.InputMedia.parse_inputMediaGame($0) }
dict[2065305999] = { return Api.InputMedia.parse_inputMediaGeoLive($0) } dict[2065305999] = { return Api.InputMedia.parse_inputMediaGeoLive($0) }
@ -283,6 +282,7 @@ fileprivate let parsers: [Int32 : (BufferReader) -> Any?] = {
dict[598418386] = { return Api.InputMedia.parse_inputMediaDocument($0) } dict[598418386] = { return Api.InputMedia.parse_inputMediaDocument($0) }
dict[-440664550] = { return Api.InputMedia.parse_inputMediaPhotoExternal($0) } dict[-440664550] = { return Api.InputMedia.parse_inputMediaPhotoExternal($0) }
dict[-78455655] = { return Api.InputMedia.parse_inputMediaDocumentExternal($0) } dict[-78455655] = { return Api.InputMedia.parse_inputMediaDocumentExternal($0) }
dict[-122978821] = { return Api.InputMedia.parse_inputMediaContact($0) }
dict[2134579434] = { return Api.InputPeer.parse_inputPeerEmpty($0) } dict[2134579434] = { return Api.InputPeer.parse_inputPeerEmpty($0) }
dict[2107670217] = { return Api.InputPeer.parse_inputPeerSelf($0) } dict[2107670217] = { return Api.InputPeer.parse_inputPeerSelf($0) }
dict[396093539] = { return Api.InputPeer.parse_inputPeerChat($0) } dict[396093539] = { return Api.InputPeer.parse_inputPeerChat($0) }
@ -385,7 +385,7 @@ fileprivate let parsers: [Int32 : (BufferReader) -> Any?] = {
dict[182649427] = { return Api.MessageRange.parse_messageRange($0) } dict[182649427] = { return Api.MessageRange.parse_messageRange($0) }
dict[946083368] = { return Api.messages.StickerSetInstallResult.parse_stickerSetInstallResultSuccess($0) } dict[946083368] = { return Api.messages.StickerSetInstallResult.parse_stickerSetInstallResultSuccess($0) }
dict[904138920] = { return Api.messages.StickerSetInstallResult.parse_stickerSetInstallResultArchive($0) } dict[904138920] = { return Api.messages.StickerSetInstallResult.parse_stickerSetInstallResultArchive($0) }
dict[-344215200] = { return Api.Config.parse_config($0) } dict[474704476] = { return Api.Config.parse_config($0) }
dict[-75283823] = { return Api.TopPeerCategoryPeers.parse_topPeerCategoryPeers($0) } dict[-75283823] = { return Api.TopPeerCategoryPeers.parse_topPeerCategoryPeers($0) }
dict[-1107729093] = { return Api.Game.parse_game($0) } dict[-1107729093] = { return Api.Game.parse_game($0) }
dict[-1032140601] = { return Api.BotCommand.parse_botCommand($0) } dict[-1032140601] = { return Api.BotCommand.parse_botCommand($0) }
@ -421,7 +421,6 @@ fileprivate let parsers: [Int32 : (BufferReader) -> Any?] = {
dict[301019932] = { return Api.Updates.parse_updateShortSentMessage($0) } dict[301019932] = { return Api.Updates.parse_updateShortSentMessage($0) }
dict[1038967584] = { return Api.MessageMedia.parse_messageMediaEmpty($0) } dict[1038967584] = { return Api.MessageMedia.parse_messageMediaEmpty($0) }
dict[1457575028] = { return Api.MessageMedia.parse_messageMediaGeo($0) } dict[1457575028] = { return Api.MessageMedia.parse_messageMediaGeo($0) }
dict[1585262393] = { return Api.MessageMedia.parse_messageMediaContact($0) }
dict[-1618676578] = { return Api.MessageMedia.parse_messageMediaUnsupported($0) } dict[-1618676578] = { return Api.MessageMedia.parse_messageMediaUnsupported($0) }
dict[-1557277184] = { return Api.MessageMedia.parse_messageMediaWebPage($0) } dict[-1557277184] = { return Api.MessageMedia.parse_messageMediaWebPage($0) }
dict[-38694904] = { return Api.MessageMedia.parse_messageMediaGame($0) } dict[-38694904] = { return Api.MessageMedia.parse_messageMediaGame($0) }
@ -430,6 +429,7 @@ fileprivate let parsers: [Int32 : (BufferReader) -> Any?] = {
dict[784356159] = { return Api.MessageMedia.parse_messageMediaVenue($0) } dict[784356159] = { return Api.MessageMedia.parse_messageMediaVenue($0) }
dict[1766936791] = { return Api.MessageMedia.parse_messageMediaPhoto($0) } dict[1766936791] = { return Api.MessageMedia.parse_messageMediaPhoto($0) }
dict[-1666158377] = { return Api.MessageMedia.parse_messageMediaDocument($0) } dict[-1666158377] = { return Api.MessageMedia.parse_messageMediaDocument($0) }
dict[-873313984] = { return Api.MessageMedia.parse_messageMediaContact($0) }
dict[-842892769] = { return Api.PaymentSavedCredentials.parse_paymentSavedCredentialsCard($0) } dict[-842892769] = { return Api.PaymentSavedCredentials.parse_paymentSavedCredentialsCard($0) }
dict[1450380236] = { return Api.Null.parse_null($0) } dict[1450380236] = { return Api.Null.parse_null($0) }
dict[1923290508] = { return Api.auth.CodeType.parse_codeTypeSms($0) } dict[1923290508] = { return Api.auth.CodeType.parse_codeTypeSms($0) }
@ -531,9 +531,9 @@ fileprivate let parsers: [Int32 : (BufferReader) -> Any?] = {
dict[415997816] = { return Api.help.InviteText.parse_inviteText($0) } dict[415997816] = { return Api.help.InviteText.parse_inviteText($0) }
dict[-1937807902] = { return Api.BotInlineMessage.parse_botInlineMessageText($0) } dict[-1937807902] = { return Api.BotInlineMessage.parse_botInlineMessageText($0) }
dict[982505656] = { return Api.BotInlineMessage.parse_botInlineMessageMediaGeo($0) } dict[982505656] = { return Api.BotInlineMessage.parse_botInlineMessageMediaGeo($0) }
dict[904770772] = { return Api.BotInlineMessage.parse_botInlineMessageMediaContact($0) }
dict[1984755728] = { return Api.BotInlineMessage.parse_botInlineMessageMediaAuto($0) } dict[1984755728] = { return Api.BotInlineMessage.parse_botInlineMessageMediaAuto($0) }
dict[-1970903652] = { return Api.BotInlineMessage.parse_botInlineMessageMediaVenue($0) } dict[-1970903652] = { return Api.BotInlineMessage.parse_botInlineMessageMediaVenue($0) }
dict[416402882] = { return Api.BotInlineMessage.parse_botInlineMessageMediaContact($0) }
dict[-1673717362] = { return Api.InputPeerNotifySettings.parse_inputPeerNotifySettings($0) } dict[-1673717362] = { return Api.InputPeerNotifySettings.parse_inputPeerNotifySettings($0) }
dict[-1634752813] = { return Api.messages.FavedStickers.parse_favedStickersNotModified($0) } dict[-1634752813] = { return Api.messages.FavedStickers.parse_favedStickersNotModified($0) }
dict[-209768682] = { return Api.messages.FavedStickers.parse_favedStickers($0) } dict[-209768682] = { return Api.messages.FavedStickers.parse_favedStickers($0) }

View File

@ -5924,10 +5924,10 @@ extension Api {
enum InputBotInlineMessage: TypeConstructorDescription { enum InputBotInlineMessage: TypeConstructorDescription {
case inputBotInlineMessageText(flags: Int32, message: String, entities: [Api.MessageEntity]?, replyMarkup: Api.ReplyMarkup?) case inputBotInlineMessageText(flags: Int32, message: String, entities: [Api.MessageEntity]?, replyMarkup: Api.ReplyMarkup?)
case inputBotInlineMessageMediaGeo(flags: Int32, geoPoint: Api.InputGeoPoint, replyMarkup: Api.ReplyMarkup?) case inputBotInlineMessageMediaGeo(flags: Int32, geoPoint: Api.InputGeoPoint, replyMarkup: Api.ReplyMarkup?)
case inputBotInlineMessageMediaContact(flags: Int32, phoneNumber: String, firstName: String, lastName: String, replyMarkup: Api.ReplyMarkup?)
case inputBotInlineMessageGame(flags: Int32, replyMarkup: Api.ReplyMarkup?) case inputBotInlineMessageGame(flags: Int32, replyMarkup: Api.ReplyMarkup?)
case inputBotInlineMessageMediaAuto(flags: Int32, message: String, entities: [Api.MessageEntity]?, replyMarkup: Api.ReplyMarkup?) case inputBotInlineMessageMediaAuto(flags: Int32, message: String, entities: [Api.MessageEntity]?, replyMarkup: Api.ReplyMarkup?)
case inputBotInlineMessageMediaVenue(flags: Int32, geoPoint: Api.InputGeoPoint, title: String, address: String, provider: String, venueId: String, venueType: String, replyMarkup: Api.ReplyMarkup?) case inputBotInlineMessageMediaVenue(flags: Int32, geoPoint: Api.InputGeoPoint, title: String, address: String, provider: String, venueId: String, venueType: String, replyMarkup: Api.ReplyMarkup?)
case inputBotInlineMessageMediaContact(flags: Int32, phoneNumber: String, firstName: String, lastName: String, vcard: String, replyMarkup: Api.ReplyMarkup?)
func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) { func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
switch self { switch self {
@ -5952,16 +5952,6 @@ extension Api {
geoPoint.serialize(buffer, true) geoPoint.serialize(buffer, true)
if Int(flags) & Int(1 << 2) != 0 {replyMarkup!.serialize(buffer, true)} if Int(flags) & Int(1 << 2) != 0 {replyMarkup!.serialize(buffer, true)}
break break
case .inputBotInlineMessageMediaContact(let flags, let phoneNumber, let firstName, let lastName, let replyMarkup):
if boxed {
buffer.appendInt32(766443943)
}
serializeInt32(flags, buffer: buffer, boxed: false)
serializeString(phoneNumber, buffer: buffer, boxed: false)
serializeString(firstName, buffer: buffer, boxed: false)
serializeString(lastName, buffer: buffer, boxed: false)
if Int(flags) & Int(1 << 2) != 0 {replyMarkup!.serialize(buffer, true)}
break
case .inputBotInlineMessageGame(let flags, let replyMarkup): case .inputBotInlineMessageGame(let flags, let replyMarkup):
if boxed { if boxed {
buffer.appendInt32(1262639204) buffer.appendInt32(1262639204)
@ -5995,6 +5985,17 @@ extension Api {
serializeString(venueType, buffer: buffer, boxed: false) serializeString(venueType, buffer: buffer, boxed: false)
if Int(flags) & Int(1 << 2) != 0 {replyMarkup!.serialize(buffer, true)} if Int(flags) & Int(1 << 2) != 0 {replyMarkup!.serialize(buffer, true)}
break break
case .inputBotInlineMessageMediaContact(let flags, let phoneNumber, let firstName, let lastName, let vcard, let replyMarkup):
if boxed {
buffer.appendInt32(-1494368259)
}
serializeInt32(flags, buffer: buffer, boxed: false)
serializeString(phoneNumber, buffer: buffer, boxed: false)
serializeString(firstName, buffer: buffer, boxed: false)
serializeString(lastName, buffer: buffer, boxed: false)
serializeString(vcard, buffer: buffer, boxed: false)
if Int(flags) & Int(1 << 2) != 0 {replyMarkup!.serialize(buffer, true)}
break
} }
} }
@ -6004,14 +6005,14 @@ extension Api {
return ("inputBotInlineMessageText", [("flags", flags), ("message", message), ("entities", entities), ("replyMarkup", replyMarkup)]) return ("inputBotInlineMessageText", [("flags", flags), ("message", message), ("entities", entities), ("replyMarkup", replyMarkup)])
case .inputBotInlineMessageMediaGeo(let flags, let geoPoint, let replyMarkup): case .inputBotInlineMessageMediaGeo(let flags, let geoPoint, let replyMarkup):
return ("inputBotInlineMessageMediaGeo", [("flags", flags), ("geoPoint", geoPoint), ("replyMarkup", replyMarkup)]) return ("inputBotInlineMessageMediaGeo", [("flags", flags), ("geoPoint", geoPoint), ("replyMarkup", replyMarkup)])
case .inputBotInlineMessageMediaContact(let flags, let phoneNumber, let firstName, let lastName, let replyMarkup):
return ("inputBotInlineMessageMediaContact", [("flags", flags), ("phoneNumber", phoneNumber), ("firstName", firstName), ("lastName", lastName), ("replyMarkup", replyMarkup)])
case .inputBotInlineMessageGame(let flags, let replyMarkup): case .inputBotInlineMessageGame(let flags, let replyMarkup):
return ("inputBotInlineMessageGame", [("flags", flags), ("replyMarkup", replyMarkup)]) return ("inputBotInlineMessageGame", [("flags", flags), ("replyMarkup", replyMarkup)])
case .inputBotInlineMessageMediaAuto(let flags, let message, let entities, let replyMarkup): case .inputBotInlineMessageMediaAuto(let flags, let message, let entities, let replyMarkup):
return ("inputBotInlineMessageMediaAuto", [("flags", flags), ("message", message), ("entities", entities), ("replyMarkup", replyMarkup)]) return ("inputBotInlineMessageMediaAuto", [("flags", flags), ("message", message), ("entities", entities), ("replyMarkup", replyMarkup)])
case .inputBotInlineMessageMediaVenue(let flags, let geoPoint, let title, let address, let provider, let venueId, let venueType, let replyMarkup): case .inputBotInlineMessageMediaVenue(let flags, let geoPoint, let title, let address, let provider, let venueId, let venueType, let replyMarkup):
return ("inputBotInlineMessageMediaVenue", [("flags", flags), ("geoPoint", geoPoint), ("title", title), ("address", address), ("provider", provider), ("venueId", venueId), ("venueType", venueType), ("replyMarkup", replyMarkup)]) return ("inputBotInlineMessageMediaVenue", [("flags", flags), ("geoPoint", geoPoint), ("title", title), ("address", address), ("provider", provider), ("venueId", venueId), ("venueType", venueType), ("replyMarkup", replyMarkup)])
case .inputBotInlineMessageMediaContact(let flags, let phoneNumber, let firstName, let lastName, let vcard, let replyMarkup):
return ("inputBotInlineMessageMediaContact", [("flags", flags), ("phoneNumber", phoneNumber), ("firstName", firstName), ("lastName", lastName), ("vcard", vcard), ("replyMarkup", replyMarkup)])
} }
} }
@ -6060,31 +6061,6 @@ extension Api {
return nil return nil
} }
} }
static func parse_inputBotInlineMessageMediaContact(_ reader: BufferReader) -> InputBotInlineMessage? {
var _1: Int32?
_1 = reader.readInt32()
var _2: String?
_2 = parseString(reader)
var _3: String?
_3 = parseString(reader)
var _4: String?
_4 = parseString(reader)
var _5: Api.ReplyMarkup?
if Int(_1!) & Int(1 << 2) != 0 {if let signature = reader.readInt32() {
_5 = Api.parse(reader, signature: signature) as? Api.ReplyMarkup
} }
let _c1 = _1 != nil
let _c2 = _2 != nil
let _c3 = _3 != nil
let _c4 = _4 != nil
let _c5 = (Int(_1!) & Int(1 << 2) == 0) || _5 != nil
if _c1 && _c2 && _c3 && _c4 && _c5 {
return Api.InputBotInlineMessage.inputBotInlineMessageMediaContact(flags: _1!, phoneNumber: _2!, firstName: _3!, lastName: _4!, replyMarkup: _5)
}
else {
return nil
}
}
static func parse_inputBotInlineMessageGame(_ reader: BufferReader) -> InputBotInlineMessage? { static func parse_inputBotInlineMessageGame(_ reader: BufferReader) -> InputBotInlineMessage? {
var _1: Int32? var _1: Int32?
_1 = reader.readInt32() _1 = reader.readInt32()
@ -6161,6 +6137,34 @@ extension Api {
return nil return nil
} }
} }
static func parse_inputBotInlineMessageMediaContact(_ reader: BufferReader) -> InputBotInlineMessage? {
var _1: Int32?
_1 = reader.readInt32()
var _2: String?
_2 = parseString(reader)
var _3: String?
_3 = parseString(reader)
var _4: String?
_4 = parseString(reader)
var _5: String?
_5 = parseString(reader)
var _6: Api.ReplyMarkup?
if Int(_1!) & Int(1 << 2) != 0 {if let signature = reader.readInt32() {
_6 = Api.parse(reader, signature: signature) as? Api.ReplyMarkup
} }
let _c1 = _1 != nil
let _c2 = _2 != nil
let _c3 = _3 != nil
let _c4 = _4 != nil
let _c5 = _5 != nil
let _c6 = (Int(_1!) & Int(1 << 2) == 0) || _6 != nil
if _c1 && _c2 && _c3 && _c4 && _c5 && _c6 {
return Api.InputBotInlineMessage.inputBotInlineMessageMediaContact(flags: _1!, phoneNumber: _2!, firstName: _3!, lastName: _4!, vcard: _5!, replyMarkup: _6)
}
else {
return nil
}
}
} }
enum KeyboardButtonRow: TypeConstructorDescription { enum KeyboardButtonRow: TypeConstructorDescription {
@ -6548,7 +6552,6 @@ extension Api {
enum InputMedia: TypeConstructorDescription { enum InputMedia: TypeConstructorDescription {
case inputMediaEmpty case inputMediaEmpty
case inputMediaGeoPoint(geoPoint: Api.InputGeoPoint) case inputMediaGeoPoint(geoPoint: Api.InputGeoPoint)
case inputMediaContact(phoneNumber: String, firstName: String, lastName: String)
case inputMediaGifExternal(url: String, q: String) case inputMediaGifExternal(url: String, q: String)
case inputMediaGame(id: Api.InputGame) case inputMediaGame(id: Api.InputGame)
case inputMediaGeoLive(geoPoint: Api.InputGeoPoint, period: Int32) case inputMediaGeoLive(geoPoint: Api.InputGeoPoint, period: Int32)
@ -6560,6 +6563,7 @@ extension Api {
case inputMediaDocument(flags: Int32, id: Api.InputDocument, ttlSeconds: Int32?) case inputMediaDocument(flags: Int32, id: Api.InputDocument, ttlSeconds: Int32?)
case inputMediaPhotoExternal(flags: Int32, url: String, ttlSeconds: Int32?) case inputMediaPhotoExternal(flags: Int32, url: String, ttlSeconds: Int32?)
case inputMediaDocumentExternal(flags: Int32, url: String, ttlSeconds: Int32?) case inputMediaDocumentExternal(flags: Int32, url: String, ttlSeconds: Int32?)
case inputMediaContact(phoneNumber: String, firstName: String, lastName: String, vcard: String)
func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) { func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
switch self { switch self {
@ -6575,14 +6579,6 @@ extension Api {
} }
geoPoint.serialize(buffer, true) geoPoint.serialize(buffer, true)
break break
case .inputMediaContact(let phoneNumber, let firstName, let lastName):
if boxed {
buffer.appendInt32(-1494984313)
}
serializeString(phoneNumber, buffer: buffer, boxed: false)
serializeString(firstName, buffer: buffer, boxed: false)
serializeString(lastName, buffer: buffer, boxed: false)
break
case .inputMediaGifExternal(let url, let q): case .inputMediaGifExternal(let url, let q):
if boxed { if boxed {
buffer.appendInt32(1212395773) buffer.appendInt32(1212395773)
@ -6693,6 +6689,15 @@ extension Api {
serializeString(url, buffer: buffer, boxed: false) serializeString(url, buffer: buffer, boxed: false)
if Int(flags) & Int(1 << 0) != 0 {serializeInt32(ttlSeconds!, buffer: buffer, boxed: false)} if Int(flags) & Int(1 << 0) != 0 {serializeInt32(ttlSeconds!, buffer: buffer, boxed: false)}
break break
case .inputMediaContact(let phoneNumber, let firstName, let lastName, let vcard):
if boxed {
buffer.appendInt32(-122978821)
}
serializeString(phoneNumber, buffer: buffer, boxed: false)
serializeString(firstName, buffer: buffer, boxed: false)
serializeString(lastName, buffer: buffer, boxed: false)
serializeString(vcard, buffer: buffer, boxed: false)
break
} }
} }
@ -6702,8 +6707,6 @@ extension Api {
return ("inputMediaEmpty", []) return ("inputMediaEmpty", [])
case .inputMediaGeoPoint(let geoPoint): case .inputMediaGeoPoint(let geoPoint):
return ("inputMediaGeoPoint", [("geoPoint", geoPoint)]) return ("inputMediaGeoPoint", [("geoPoint", geoPoint)])
case .inputMediaContact(let phoneNumber, let firstName, let lastName):
return ("inputMediaContact", [("phoneNumber", phoneNumber), ("firstName", firstName), ("lastName", lastName)])
case .inputMediaGifExternal(let url, let q): case .inputMediaGifExternal(let url, let q):
return ("inputMediaGifExternal", [("url", url), ("q", q)]) return ("inputMediaGifExternal", [("url", url), ("q", q)])
case .inputMediaGame(let id): case .inputMediaGame(let id):
@ -6726,6 +6729,8 @@ extension Api {
return ("inputMediaPhotoExternal", [("flags", flags), ("url", url), ("ttlSeconds", ttlSeconds)]) return ("inputMediaPhotoExternal", [("flags", flags), ("url", url), ("ttlSeconds", ttlSeconds)])
case .inputMediaDocumentExternal(let flags, let url, let ttlSeconds): case .inputMediaDocumentExternal(let flags, let url, let ttlSeconds):
return ("inputMediaDocumentExternal", [("flags", flags), ("url", url), ("ttlSeconds", ttlSeconds)]) return ("inputMediaDocumentExternal", [("flags", flags), ("url", url), ("ttlSeconds", ttlSeconds)])
case .inputMediaContact(let phoneNumber, let firstName, let lastName, let vcard):
return ("inputMediaContact", [("phoneNumber", phoneNumber), ("firstName", firstName), ("lastName", lastName), ("vcard", vcard)])
} }
} }
@ -6745,23 +6750,6 @@ extension Api {
return nil return nil
} }
} }
static func parse_inputMediaContact(_ reader: BufferReader) -> InputMedia? {
var _1: String?
_1 = parseString(reader)
var _2: String?
_2 = parseString(reader)
var _3: String?
_3 = parseString(reader)
let _c1 = _1 != nil
let _c2 = _2 != nil
let _c3 = _3 != nil
if _c1 && _c2 && _c3 {
return Api.InputMedia.inputMediaContact(phoneNumber: _1!, firstName: _2!, lastName: _3!)
}
else {
return nil
}
}
static func parse_inputMediaGifExternal(_ reader: BufferReader) -> InputMedia? { static func parse_inputMediaGifExternal(_ reader: BufferReader) -> InputMedia? {
var _1: String? var _1: String?
_1 = parseString(reader) _1 = parseString(reader)
@ -7007,6 +6995,26 @@ extension Api {
return nil return nil
} }
} }
static func parse_inputMediaContact(_ reader: BufferReader) -> InputMedia? {
var _1: String?
_1 = parseString(reader)
var _2: String?
_2 = parseString(reader)
var _3: String?
_3 = parseString(reader)
var _4: String?
_4 = parseString(reader)
let _c1 = _1 != nil
let _c2 = _2 != nil
let _c3 = _3 != nil
let _c4 = _4 != nil
if _c1 && _c2 && _c3 && _c4 {
return Api.InputMedia.inputMediaContact(phoneNumber: _1!, firstName: _2!, lastName: _3!, vcard: _4!)
}
else {
return nil
}
}
} }
enum InputPeer: TypeConstructorDescription { enum InputPeer: TypeConstructorDescription {
@ -9276,13 +9284,13 @@ extension Api {
} }
enum Config: TypeConstructorDescription { enum Config: TypeConstructorDescription {
case config(flags: Int32, date: Int32, expires: Int32, testMode: Api.Bool, thisDc: Int32, dcOptions: [Api.DcOption], chatSizeMax: Int32, megagroupSizeMax: Int32, forwardedCountMax: Int32, onlineUpdatePeriodMs: Int32, offlineBlurTimeoutMs: Int32, offlineIdleTimeoutMs: Int32, onlineCloudTimeoutMs: Int32, notifyCloudDelayMs: Int32, notifyDefaultDelayMs: Int32, pushChatPeriodMs: Int32, pushChatLimit: Int32, savedGifsLimit: Int32, editTimeLimit: Int32, revokeTimeLimit: Int32, revokePmTimeLimit: Int32, ratingEDecay: Int32, stickersRecentLimit: Int32, stickersFavedLimit: Int32, channelsReadMediaPeriod: Int32, tmpSessions: Int32?, pinnedDialogsCountMax: Int32, callReceiveTimeoutMs: Int32, callRingTimeoutMs: Int32, callConnectTimeoutMs: Int32, callPacketTimeoutMs: Int32, meUrlPrefix: String, autoupdateUrlPrefix: String?, suggestedLangCode: String?, langPackVersion: Int32?) case config(flags: Int32, date: Int32, expires: Int32, testMode: Api.Bool, thisDc: Int32, dcOptions: [Api.DcOption], dcTxtDomainName: String, chatSizeMax: Int32, megagroupSizeMax: Int32, forwardedCountMax: Int32, onlineUpdatePeriodMs: Int32, offlineBlurTimeoutMs: Int32, offlineIdleTimeoutMs: Int32, onlineCloudTimeoutMs: Int32, notifyCloudDelayMs: Int32, notifyDefaultDelayMs: Int32, pushChatPeriodMs: Int32, pushChatLimit: Int32, savedGifsLimit: Int32, editTimeLimit: Int32, revokeTimeLimit: Int32, revokePmTimeLimit: Int32, ratingEDecay: Int32, stickersRecentLimit: Int32, stickersFavedLimit: Int32, channelsReadMediaPeriod: Int32, tmpSessions: Int32?, pinnedDialogsCountMax: Int32, callReceiveTimeoutMs: Int32, callRingTimeoutMs: Int32, callConnectTimeoutMs: Int32, callPacketTimeoutMs: Int32, meUrlPrefix: String, autoupdateUrlPrefix: String?, gifSearchUsername: String?, venueSearchUsername: String?, imgSearchUsername: String?, suggestedLangCode: String?, langPackVersion: Int32?)
func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) { func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
switch self { switch self {
case .config(let flags, let date, let expires, let testMode, let thisDc, let dcOptions, let chatSizeMax, let megagroupSizeMax, let forwardedCountMax, let onlineUpdatePeriodMs, let offlineBlurTimeoutMs, let offlineIdleTimeoutMs, let onlineCloudTimeoutMs, let notifyCloudDelayMs, let notifyDefaultDelayMs, let pushChatPeriodMs, let pushChatLimit, let savedGifsLimit, let editTimeLimit, let revokeTimeLimit, let revokePmTimeLimit, let ratingEDecay, let stickersRecentLimit, let stickersFavedLimit, let channelsReadMediaPeriod, let tmpSessions, let pinnedDialogsCountMax, let callReceiveTimeoutMs, let callRingTimeoutMs, let callConnectTimeoutMs, let callPacketTimeoutMs, let meUrlPrefix, let autoupdateUrlPrefix, let suggestedLangCode, let langPackVersion): case .config(let flags, let date, let expires, let testMode, let thisDc, let dcOptions, let dcTxtDomainName, let chatSizeMax, let megagroupSizeMax, let forwardedCountMax, let onlineUpdatePeriodMs, let offlineBlurTimeoutMs, let offlineIdleTimeoutMs, let onlineCloudTimeoutMs, let notifyCloudDelayMs, let notifyDefaultDelayMs, let pushChatPeriodMs, let pushChatLimit, let savedGifsLimit, let editTimeLimit, let revokeTimeLimit, let revokePmTimeLimit, let ratingEDecay, let stickersRecentLimit, let stickersFavedLimit, let channelsReadMediaPeriod, let tmpSessions, let pinnedDialogsCountMax, let callReceiveTimeoutMs, let callRingTimeoutMs, let callConnectTimeoutMs, let callPacketTimeoutMs, let meUrlPrefix, let autoupdateUrlPrefix, let gifSearchUsername, let venueSearchUsername, let imgSearchUsername, let suggestedLangCode, let langPackVersion):
if boxed { if boxed {
buffer.appendInt32(-344215200) buffer.appendInt32(474704476)
} }
serializeInt32(flags, buffer: buffer, boxed: false) serializeInt32(flags, buffer: buffer, boxed: false)
serializeInt32(date, buffer: buffer, boxed: false) serializeInt32(date, buffer: buffer, boxed: false)
@ -9294,6 +9302,7 @@ extension Api {
for item in dcOptions { for item in dcOptions {
item.serialize(buffer, true) item.serialize(buffer, true)
} }
serializeString(dcTxtDomainName, buffer: buffer, boxed: false)
serializeInt32(chatSizeMax, buffer: buffer, boxed: false) serializeInt32(chatSizeMax, buffer: buffer, boxed: false)
serializeInt32(megagroupSizeMax, buffer: buffer, boxed: false) serializeInt32(megagroupSizeMax, buffer: buffer, boxed: false)
serializeInt32(forwardedCountMax, buffer: buffer, boxed: false) serializeInt32(forwardedCountMax, buffer: buffer, boxed: false)
@ -9321,6 +9330,9 @@ extension Api {
serializeInt32(callPacketTimeoutMs, buffer: buffer, boxed: false) serializeInt32(callPacketTimeoutMs, buffer: buffer, boxed: false)
serializeString(meUrlPrefix, buffer: buffer, boxed: false) serializeString(meUrlPrefix, buffer: buffer, boxed: false)
if Int(flags) & Int(1 << 7) != 0 {serializeString(autoupdateUrlPrefix!, buffer: buffer, boxed: false)} if Int(flags) & Int(1 << 7) != 0 {serializeString(autoupdateUrlPrefix!, buffer: buffer, boxed: false)}
if Int(flags) & Int(1 << 9) != 0 {serializeString(gifSearchUsername!, buffer: buffer, boxed: false)}
if Int(flags) & Int(1 << 10) != 0 {serializeString(venueSearchUsername!, buffer: buffer, boxed: false)}
if Int(flags) & Int(1 << 11) != 0 {serializeString(imgSearchUsername!, buffer: buffer, boxed: false)}
if Int(flags) & Int(1 << 2) != 0 {serializeString(suggestedLangCode!, buffer: buffer, boxed: false)} if Int(flags) & Int(1 << 2) != 0 {serializeString(suggestedLangCode!, buffer: buffer, boxed: false)}
if Int(flags) & Int(1 << 2) != 0 {serializeInt32(langPackVersion!, buffer: buffer, boxed: false)} if Int(flags) & Int(1 << 2) != 0 {serializeInt32(langPackVersion!, buffer: buffer, boxed: false)}
break break
@ -9329,8 +9341,8 @@ extension Api {
func descriptionFields() -> (String, [(String, Any)]) { func descriptionFields() -> (String, [(String, Any)]) {
switch self { switch self {
case .config(let flags, let date, let expires, let testMode, let thisDc, let dcOptions, let chatSizeMax, let megagroupSizeMax, let forwardedCountMax, let onlineUpdatePeriodMs, let offlineBlurTimeoutMs, let offlineIdleTimeoutMs, let onlineCloudTimeoutMs, let notifyCloudDelayMs, let notifyDefaultDelayMs, let pushChatPeriodMs, let pushChatLimit, let savedGifsLimit, let editTimeLimit, let revokeTimeLimit, let revokePmTimeLimit, let ratingEDecay, let stickersRecentLimit, let stickersFavedLimit, let channelsReadMediaPeriod, let tmpSessions, let pinnedDialogsCountMax, let callReceiveTimeoutMs, let callRingTimeoutMs, let callConnectTimeoutMs, let callPacketTimeoutMs, let meUrlPrefix, let autoupdateUrlPrefix, let suggestedLangCode, let langPackVersion): case .config(let flags, let date, let expires, let testMode, let thisDc, let dcOptions, let dcTxtDomainName, let chatSizeMax, let megagroupSizeMax, let forwardedCountMax, let onlineUpdatePeriodMs, let offlineBlurTimeoutMs, let offlineIdleTimeoutMs, let onlineCloudTimeoutMs, let notifyCloudDelayMs, let notifyDefaultDelayMs, let pushChatPeriodMs, let pushChatLimit, let savedGifsLimit, let editTimeLimit, let revokeTimeLimit, let revokePmTimeLimit, let ratingEDecay, let stickersRecentLimit, let stickersFavedLimit, let channelsReadMediaPeriod, let tmpSessions, let pinnedDialogsCountMax, let callReceiveTimeoutMs, let callRingTimeoutMs, let callConnectTimeoutMs, let callPacketTimeoutMs, let meUrlPrefix, let autoupdateUrlPrefix, let gifSearchUsername, let venueSearchUsername, let imgSearchUsername, let suggestedLangCode, let langPackVersion):
return ("config", [("flags", flags), ("date", date), ("expires", expires), ("testMode", testMode), ("thisDc", thisDc), ("dcOptions", dcOptions), ("chatSizeMax", chatSizeMax), ("megagroupSizeMax", megagroupSizeMax), ("forwardedCountMax", forwardedCountMax), ("onlineUpdatePeriodMs", onlineUpdatePeriodMs), ("offlineBlurTimeoutMs", offlineBlurTimeoutMs), ("offlineIdleTimeoutMs", offlineIdleTimeoutMs), ("onlineCloudTimeoutMs", onlineCloudTimeoutMs), ("notifyCloudDelayMs", notifyCloudDelayMs), ("notifyDefaultDelayMs", notifyDefaultDelayMs), ("pushChatPeriodMs", pushChatPeriodMs), ("pushChatLimit", pushChatLimit), ("savedGifsLimit", savedGifsLimit), ("editTimeLimit", editTimeLimit), ("revokeTimeLimit", revokeTimeLimit), ("revokePmTimeLimit", revokePmTimeLimit), ("ratingEDecay", ratingEDecay), ("stickersRecentLimit", stickersRecentLimit), ("stickersFavedLimit", stickersFavedLimit), ("channelsReadMediaPeriod", channelsReadMediaPeriod), ("tmpSessions", tmpSessions), ("pinnedDialogsCountMax", pinnedDialogsCountMax), ("callReceiveTimeoutMs", callReceiveTimeoutMs), ("callRingTimeoutMs", callRingTimeoutMs), ("callConnectTimeoutMs", callConnectTimeoutMs), ("callPacketTimeoutMs", callPacketTimeoutMs), ("meUrlPrefix", meUrlPrefix), ("autoupdateUrlPrefix", autoupdateUrlPrefix), ("suggestedLangCode", suggestedLangCode), ("langPackVersion", langPackVersion)]) return ("config", [("flags", flags), ("date", date), ("expires", expires), ("testMode", testMode), ("thisDc", thisDc), ("dcOptions", dcOptions), ("dcTxtDomainName", dcTxtDomainName), ("chatSizeMax", chatSizeMax), ("megagroupSizeMax", megagroupSizeMax), ("forwardedCountMax", forwardedCountMax), ("onlineUpdatePeriodMs", onlineUpdatePeriodMs), ("offlineBlurTimeoutMs", offlineBlurTimeoutMs), ("offlineIdleTimeoutMs", offlineIdleTimeoutMs), ("onlineCloudTimeoutMs", onlineCloudTimeoutMs), ("notifyCloudDelayMs", notifyCloudDelayMs), ("notifyDefaultDelayMs", notifyDefaultDelayMs), ("pushChatPeriodMs", pushChatPeriodMs), ("pushChatLimit", pushChatLimit), ("savedGifsLimit", savedGifsLimit), ("editTimeLimit", editTimeLimit), ("revokeTimeLimit", revokeTimeLimit), ("revokePmTimeLimit", revokePmTimeLimit), ("ratingEDecay", ratingEDecay), ("stickersRecentLimit", stickersRecentLimit), ("stickersFavedLimit", stickersFavedLimit), ("channelsReadMediaPeriod", channelsReadMediaPeriod), ("tmpSessions", tmpSessions), ("pinnedDialogsCountMax", pinnedDialogsCountMax), ("callReceiveTimeoutMs", callReceiveTimeoutMs), ("callRingTimeoutMs", callRingTimeoutMs), ("callConnectTimeoutMs", callConnectTimeoutMs), ("callPacketTimeoutMs", callPacketTimeoutMs), ("meUrlPrefix", meUrlPrefix), ("autoupdateUrlPrefix", autoupdateUrlPrefix), ("gifSearchUsername", gifSearchUsername), ("venueSearchUsername", venueSearchUsername), ("imgSearchUsername", imgSearchUsername), ("suggestedLangCode", suggestedLangCode), ("langPackVersion", langPackVersion)])
} }
} }
@ -9351,8 +9363,8 @@ extension Api {
if let _ = reader.readInt32() { if let _ = reader.readInt32() {
_6 = Api.parseVector(reader, elementSignature: 0, elementType: Api.DcOption.self) _6 = Api.parseVector(reader, elementSignature: 0, elementType: Api.DcOption.self)
} }
var _7: Int32? var _7: String?
_7 = reader.readInt32() _7 = parseString(reader)
var _8: Int32? var _8: Int32?
_8 = reader.readInt32() _8 = reader.readInt32()
var _9: Int32? var _9: Int32?
@ -9390,9 +9402,9 @@ extension Api {
var _25: Int32? var _25: Int32?
_25 = reader.readInt32() _25 = reader.readInt32()
var _26: Int32? var _26: Int32?
if Int(_1!) & Int(1 << 0) != 0 {_26 = reader.readInt32() } _26 = reader.readInt32()
var _27: Int32? var _27: Int32?
_27 = reader.readInt32() if Int(_1!) & Int(1 << 0) != 0 {_27 = reader.readInt32() }
var _28: Int32? var _28: Int32?
_28 = reader.readInt32() _28 = reader.readInt32()
var _29: Int32? var _29: Int32?
@ -9401,14 +9413,22 @@ extension Api {
_30 = reader.readInt32() _30 = reader.readInt32()
var _31: Int32? var _31: Int32?
_31 = reader.readInt32() _31 = reader.readInt32()
var _32: String? var _32: Int32?
_32 = parseString(reader) _32 = reader.readInt32()
var _33: String? var _33: String?
if Int(_1!) & Int(1 << 7) != 0 {_33 = parseString(reader) } _33 = parseString(reader)
var _34: String? var _34: String?
if Int(_1!) & Int(1 << 2) != 0 {_34 = parseString(reader) } if Int(_1!) & Int(1 << 7) != 0 {_34 = parseString(reader) }
var _35: Int32? var _35: String?
if Int(_1!) & Int(1 << 2) != 0 {_35 = reader.readInt32() } if Int(_1!) & Int(1 << 9) != 0 {_35 = parseString(reader) }
var _36: String?
if Int(_1!) & Int(1 << 10) != 0 {_36 = parseString(reader) }
var _37: String?
if Int(_1!) & Int(1 << 11) != 0 {_37 = parseString(reader) }
var _38: String?
if Int(_1!) & Int(1 << 2) != 0 {_38 = parseString(reader) }
var _39: Int32?
if Int(_1!) & Int(1 << 2) != 0 {_39 = reader.readInt32() }
let _c1 = _1 != nil let _c1 = _1 != nil
let _c2 = _2 != nil let _c2 = _2 != nil
let _c3 = _3 != nil let _c3 = _3 != nil
@ -9434,18 +9454,22 @@ extension Api {
let _c23 = _23 != nil let _c23 = _23 != nil
let _c24 = _24 != nil let _c24 = _24 != nil
let _c25 = _25 != nil let _c25 = _25 != nil
let _c26 = (Int(_1!) & Int(1 << 0) == 0) || _26 != nil let _c26 = _26 != nil
let _c27 = _27 != nil let _c27 = (Int(_1!) & Int(1 << 0) == 0) || _27 != nil
let _c28 = _28 != nil let _c28 = _28 != nil
let _c29 = _29 != nil let _c29 = _29 != nil
let _c30 = _30 != nil let _c30 = _30 != nil
let _c31 = _31 != nil let _c31 = _31 != nil
let _c32 = _32 != nil let _c32 = _32 != nil
let _c33 = (Int(_1!) & Int(1 << 7) == 0) || _33 != nil let _c33 = _33 != nil
let _c34 = (Int(_1!) & Int(1 << 2) == 0) || _34 != nil let _c34 = (Int(_1!) & Int(1 << 7) == 0) || _34 != nil
let _c35 = (Int(_1!) & Int(1 << 2) == 0) || _35 != nil let _c35 = (Int(_1!) & Int(1 << 9) == 0) || _35 != nil
if _c1 && _c2 && _c3 && _c4 && _c5 && _c6 && _c7 && _c8 && _c9 && _c10 && _c11 && _c12 && _c13 && _c14 && _c15 && _c16 && _c17 && _c18 && _c19 && _c20 && _c21 && _c22 && _c23 && _c24 && _c25 && _c26 && _c27 && _c28 && _c29 && _c30 && _c31 && _c32 && _c33 && _c34 && _c35 { let _c36 = (Int(_1!) & Int(1 << 10) == 0) || _36 != nil
return Api.Config.config(flags: _1!, date: _2!, expires: _3!, testMode: _4!, thisDc: _5!, dcOptions: _6!, chatSizeMax: _7!, megagroupSizeMax: _8!, forwardedCountMax: _9!, onlineUpdatePeriodMs: _10!, offlineBlurTimeoutMs: _11!, offlineIdleTimeoutMs: _12!, onlineCloudTimeoutMs: _13!, notifyCloudDelayMs: _14!, notifyDefaultDelayMs: _15!, pushChatPeriodMs: _16!, pushChatLimit: _17!, savedGifsLimit: _18!, editTimeLimit: _19!, revokeTimeLimit: _20!, revokePmTimeLimit: _21!, ratingEDecay: _22!, stickersRecentLimit: _23!, stickersFavedLimit: _24!, channelsReadMediaPeriod: _25!, tmpSessions: _26, pinnedDialogsCountMax: _27!, callReceiveTimeoutMs: _28!, callRingTimeoutMs: _29!, callConnectTimeoutMs: _30!, callPacketTimeoutMs: _31!, meUrlPrefix: _32!, autoupdateUrlPrefix: _33, suggestedLangCode: _34, langPackVersion: _35) let _c37 = (Int(_1!) & Int(1 << 11) == 0) || _37 != nil
let _c38 = (Int(_1!) & Int(1 << 2) == 0) || _38 != nil
let _c39 = (Int(_1!) & Int(1 << 2) == 0) || _39 != nil
if _c1 && _c2 && _c3 && _c4 && _c5 && _c6 && _c7 && _c8 && _c9 && _c10 && _c11 && _c12 && _c13 && _c14 && _c15 && _c16 && _c17 && _c18 && _c19 && _c20 && _c21 && _c22 && _c23 && _c24 && _c25 && _c26 && _c27 && _c28 && _c29 && _c30 && _c31 && _c32 && _c33 && _c34 && _c35 && _c36 && _c37 && _c38 && _c39 {
return Api.Config.config(flags: _1!, date: _2!, expires: _3!, testMode: _4!, thisDc: _5!, dcOptions: _6!, dcTxtDomainName: _7!, chatSizeMax: _8!, megagroupSizeMax: _9!, forwardedCountMax: _10!, onlineUpdatePeriodMs: _11!, offlineBlurTimeoutMs: _12!, offlineIdleTimeoutMs: _13!, onlineCloudTimeoutMs: _14!, notifyCloudDelayMs: _15!, notifyDefaultDelayMs: _16!, pushChatPeriodMs: _17!, pushChatLimit: _18!, savedGifsLimit: _19!, editTimeLimit: _20!, revokeTimeLimit: _21!, revokePmTimeLimit: _22!, ratingEDecay: _23!, stickersRecentLimit: _24!, stickersFavedLimit: _25!, channelsReadMediaPeriod: _26!, tmpSessions: _27, pinnedDialogsCountMax: _28!, callReceiveTimeoutMs: _29!, callRingTimeoutMs: _30!, callConnectTimeoutMs: _31!, callPacketTimeoutMs: _32!, meUrlPrefix: _33!, autoupdateUrlPrefix: _34, gifSearchUsername: _35, venueSearchUsername: _36, imgSearchUsername: _37, suggestedLangCode: _38, langPackVersion: _39)
} }
else { else {
return nil return nil
@ -10450,7 +10474,6 @@ extension Api {
enum MessageMedia: TypeConstructorDescription { enum MessageMedia: TypeConstructorDescription {
case messageMediaEmpty case messageMediaEmpty
case messageMediaGeo(geo: Api.GeoPoint) case messageMediaGeo(geo: Api.GeoPoint)
case messageMediaContact(phoneNumber: String, firstName: String, lastName: String, userId: Int32)
case messageMediaUnsupported case messageMediaUnsupported
case messageMediaWebPage(webpage: Api.WebPage) case messageMediaWebPage(webpage: Api.WebPage)
case messageMediaGame(game: Api.Game) case messageMediaGame(game: Api.Game)
@ -10459,6 +10482,7 @@ extension Api {
case messageMediaVenue(geo: Api.GeoPoint, title: String, address: String, provider: String, venueId: String, venueType: String) case messageMediaVenue(geo: Api.GeoPoint, title: String, address: String, provider: String, venueId: String, venueType: String)
case messageMediaPhoto(flags: Int32, photo: Api.Photo?, ttlSeconds: Int32?) case messageMediaPhoto(flags: Int32, photo: Api.Photo?, ttlSeconds: Int32?)
case messageMediaDocument(flags: Int32, document: Api.Document?, ttlSeconds: Int32?) case messageMediaDocument(flags: Int32, document: Api.Document?, ttlSeconds: Int32?)
case messageMediaContact(phoneNumber: String, firstName: String, lastName: String, vcard: String, userId: Int32)
func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) { func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
switch self { switch self {
@ -10474,15 +10498,6 @@ extension Api {
} }
geo.serialize(buffer, true) geo.serialize(buffer, true)
break break
case .messageMediaContact(let phoneNumber, let firstName, let lastName, let userId):
if boxed {
buffer.appendInt32(1585262393)
}
serializeString(phoneNumber, buffer: buffer, boxed: false)
serializeString(firstName, buffer: buffer, boxed: false)
serializeString(lastName, buffer: buffer, boxed: false)
serializeInt32(userId, buffer: buffer, boxed: false)
break
case .messageMediaUnsupported: case .messageMediaUnsupported:
if boxed { if boxed {
buffer.appendInt32(-1618676578) buffer.appendInt32(-1618676578)
@ -10548,6 +10563,16 @@ extension Api {
if Int(flags) & Int(1 << 0) != 0 {document!.serialize(buffer, true)} if Int(flags) & Int(1 << 0) != 0 {document!.serialize(buffer, true)}
if Int(flags) & Int(1 << 2) != 0 {serializeInt32(ttlSeconds!, buffer: buffer, boxed: false)} if Int(flags) & Int(1 << 2) != 0 {serializeInt32(ttlSeconds!, buffer: buffer, boxed: false)}
break break
case .messageMediaContact(let phoneNumber, let firstName, let lastName, let vcard, let userId):
if boxed {
buffer.appendInt32(-873313984)
}
serializeString(phoneNumber, buffer: buffer, boxed: false)
serializeString(firstName, buffer: buffer, boxed: false)
serializeString(lastName, buffer: buffer, boxed: false)
serializeString(vcard, buffer: buffer, boxed: false)
serializeInt32(userId, buffer: buffer, boxed: false)
break
} }
} }
@ -10557,8 +10582,6 @@ extension Api {
return ("messageMediaEmpty", []) return ("messageMediaEmpty", [])
case .messageMediaGeo(let geo): case .messageMediaGeo(let geo):
return ("messageMediaGeo", [("geo", geo)]) return ("messageMediaGeo", [("geo", geo)])
case .messageMediaContact(let phoneNumber, let firstName, let lastName, let userId):
return ("messageMediaContact", [("phoneNumber", phoneNumber), ("firstName", firstName), ("lastName", lastName), ("userId", userId)])
case .messageMediaUnsupported: case .messageMediaUnsupported:
return ("messageMediaUnsupported", []) return ("messageMediaUnsupported", [])
case .messageMediaWebPage(let webpage): case .messageMediaWebPage(let webpage):
@ -10575,6 +10598,8 @@ extension Api {
return ("messageMediaPhoto", [("flags", flags), ("photo", photo), ("ttlSeconds", ttlSeconds)]) return ("messageMediaPhoto", [("flags", flags), ("photo", photo), ("ttlSeconds", ttlSeconds)])
case .messageMediaDocument(let flags, let document, let ttlSeconds): case .messageMediaDocument(let flags, let document, let ttlSeconds):
return ("messageMediaDocument", [("flags", flags), ("document", document), ("ttlSeconds", ttlSeconds)]) return ("messageMediaDocument", [("flags", flags), ("document", document), ("ttlSeconds", ttlSeconds)])
case .messageMediaContact(let phoneNumber, let firstName, let lastName, let vcard, let userId):
return ("messageMediaContact", [("phoneNumber", phoneNumber), ("firstName", firstName), ("lastName", lastName), ("vcard", vcard), ("userId", userId)])
} }
} }
@ -10594,26 +10619,6 @@ extension Api {
return nil return nil
} }
} }
static func parse_messageMediaContact(_ reader: BufferReader) -> MessageMedia? {
var _1: String?
_1 = parseString(reader)
var _2: String?
_2 = parseString(reader)
var _3: String?
_3 = parseString(reader)
var _4: Int32?
_4 = reader.readInt32()
let _c1 = _1 != nil
let _c2 = _2 != nil
let _c3 = _3 != nil
let _c4 = _4 != nil
if _c1 && _c2 && _c3 && _c4 {
return Api.MessageMedia.messageMediaContact(phoneNumber: _1!, firstName: _2!, lastName: _3!, userId: _4!)
}
else {
return nil
}
}
static func parse_messageMediaUnsupported(_ reader: BufferReader) -> MessageMedia? { static func parse_messageMediaUnsupported(_ reader: BufferReader) -> MessageMedia? {
return Api.MessageMedia.messageMediaUnsupported return Api.MessageMedia.messageMediaUnsupported
} }
@ -10759,6 +10764,29 @@ extension Api {
return nil return nil
} }
} }
static func parse_messageMediaContact(_ reader: BufferReader) -> MessageMedia? {
var _1: String?
_1 = parseString(reader)
var _2: String?
_2 = parseString(reader)
var _3: String?
_3 = parseString(reader)
var _4: String?
_4 = parseString(reader)
var _5: Int32?
_5 = reader.readInt32()
let _c1 = _1 != nil
let _c2 = _2 != nil
let _c3 = _3 != nil
let _c4 = _4 != nil
let _c5 = _5 != nil
if _c1 && _c2 && _c3 && _c4 && _c5 {
return Api.MessageMedia.messageMediaContact(phoneNumber: _1!, firstName: _2!, lastName: _3!, vcard: _4!, userId: _5!)
}
else {
return nil
}
}
} }
enum PaymentSavedCredentials: TypeConstructorDescription { enum PaymentSavedCredentials: TypeConstructorDescription {
@ -13024,9 +13052,9 @@ extension Api {
enum BotInlineMessage: TypeConstructorDescription { enum BotInlineMessage: TypeConstructorDescription {
case botInlineMessageText(flags: Int32, message: String, entities: [Api.MessageEntity]?, replyMarkup: Api.ReplyMarkup?) case botInlineMessageText(flags: Int32, message: String, entities: [Api.MessageEntity]?, replyMarkup: Api.ReplyMarkup?)
case botInlineMessageMediaGeo(flags: Int32, geo: Api.GeoPoint, replyMarkup: Api.ReplyMarkup?) case botInlineMessageMediaGeo(flags: Int32, geo: Api.GeoPoint, replyMarkup: Api.ReplyMarkup?)
case botInlineMessageMediaContact(flags: Int32, phoneNumber: String, firstName: String, lastName: String, replyMarkup: Api.ReplyMarkup?)
case botInlineMessageMediaAuto(flags: Int32, message: String, entities: [Api.MessageEntity]?, replyMarkup: Api.ReplyMarkup?) case botInlineMessageMediaAuto(flags: Int32, message: String, entities: [Api.MessageEntity]?, replyMarkup: Api.ReplyMarkup?)
case botInlineMessageMediaVenue(flags: Int32, geo: Api.GeoPoint, title: String, address: String, provider: String, venueId: String, venueType: String, replyMarkup: Api.ReplyMarkup?) case botInlineMessageMediaVenue(flags: Int32, geo: Api.GeoPoint, title: String, address: String, provider: String, venueId: String, venueType: String, replyMarkup: Api.ReplyMarkup?)
case botInlineMessageMediaContact(flags: Int32, phoneNumber: String, firstName: String, lastName: String, vcard: String, replyMarkup: Api.ReplyMarkup?)
func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) { func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
switch self { switch self {
@ -13051,16 +13079,6 @@ extension Api {
geo.serialize(buffer, true) geo.serialize(buffer, true)
if Int(flags) & Int(1 << 2) != 0 {replyMarkup!.serialize(buffer, true)} if Int(flags) & Int(1 << 2) != 0 {replyMarkup!.serialize(buffer, true)}
break break
case .botInlineMessageMediaContact(let flags, let phoneNumber, let firstName, let lastName, let replyMarkup):
if boxed {
buffer.appendInt32(904770772)
}
serializeInt32(flags, buffer: buffer, boxed: false)
serializeString(phoneNumber, buffer: buffer, boxed: false)
serializeString(firstName, buffer: buffer, boxed: false)
serializeString(lastName, buffer: buffer, boxed: false)
if Int(flags) & Int(1 << 2) != 0 {replyMarkup!.serialize(buffer, true)}
break
case .botInlineMessageMediaAuto(let flags, let message, let entities, let replyMarkup): case .botInlineMessageMediaAuto(let flags, let message, let entities, let replyMarkup):
if boxed { if boxed {
buffer.appendInt32(1984755728) buffer.appendInt32(1984755728)
@ -13087,6 +13105,17 @@ extension Api {
serializeString(venueType, buffer: buffer, boxed: false) serializeString(venueType, buffer: buffer, boxed: false)
if Int(flags) & Int(1 << 2) != 0 {replyMarkup!.serialize(buffer, true)} if Int(flags) & Int(1 << 2) != 0 {replyMarkup!.serialize(buffer, true)}
break break
case .botInlineMessageMediaContact(let flags, let phoneNumber, let firstName, let lastName, let vcard, let replyMarkup):
if boxed {
buffer.appendInt32(416402882)
}
serializeInt32(flags, buffer: buffer, boxed: false)
serializeString(phoneNumber, buffer: buffer, boxed: false)
serializeString(firstName, buffer: buffer, boxed: false)
serializeString(lastName, buffer: buffer, boxed: false)
serializeString(vcard, buffer: buffer, boxed: false)
if Int(flags) & Int(1 << 2) != 0 {replyMarkup!.serialize(buffer, true)}
break
} }
} }
@ -13096,12 +13125,12 @@ extension Api {
return ("botInlineMessageText", [("flags", flags), ("message", message), ("entities", entities), ("replyMarkup", replyMarkup)]) return ("botInlineMessageText", [("flags", flags), ("message", message), ("entities", entities), ("replyMarkup", replyMarkup)])
case .botInlineMessageMediaGeo(let flags, let geo, let replyMarkup): case .botInlineMessageMediaGeo(let flags, let geo, let replyMarkup):
return ("botInlineMessageMediaGeo", [("flags", flags), ("geo", geo), ("replyMarkup", replyMarkup)]) return ("botInlineMessageMediaGeo", [("flags", flags), ("geo", geo), ("replyMarkup", replyMarkup)])
case .botInlineMessageMediaContact(let flags, let phoneNumber, let firstName, let lastName, let replyMarkup):
return ("botInlineMessageMediaContact", [("flags", flags), ("phoneNumber", phoneNumber), ("firstName", firstName), ("lastName", lastName), ("replyMarkup", replyMarkup)])
case .botInlineMessageMediaAuto(let flags, let message, let entities, let replyMarkup): case .botInlineMessageMediaAuto(let flags, let message, let entities, let replyMarkup):
return ("botInlineMessageMediaAuto", [("flags", flags), ("message", message), ("entities", entities), ("replyMarkup", replyMarkup)]) return ("botInlineMessageMediaAuto", [("flags", flags), ("message", message), ("entities", entities), ("replyMarkup", replyMarkup)])
case .botInlineMessageMediaVenue(let flags, let geo, let title, let address, let provider, let venueId, let venueType, let replyMarkup): case .botInlineMessageMediaVenue(let flags, let geo, let title, let address, let provider, let venueId, let venueType, let replyMarkup):
return ("botInlineMessageMediaVenue", [("flags", flags), ("geo", geo), ("title", title), ("address", address), ("provider", provider), ("venueId", venueId), ("venueType", venueType), ("replyMarkup", replyMarkup)]) return ("botInlineMessageMediaVenue", [("flags", flags), ("geo", geo), ("title", title), ("address", address), ("provider", provider), ("venueId", venueId), ("venueType", venueType), ("replyMarkup", replyMarkup)])
case .botInlineMessageMediaContact(let flags, let phoneNumber, let firstName, let lastName, let vcard, let replyMarkup):
return ("botInlineMessageMediaContact", [("flags", flags), ("phoneNumber", phoneNumber), ("firstName", firstName), ("lastName", lastName), ("vcard", vcard), ("replyMarkup", replyMarkup)])
} }
} }
@ -13150,31 +13179,6 @@ extension Api {
return nil return nil
} }
} }
static func parse_botInlineMessageMediaContact(_ reader: BufferReader) -> BotInlineMessage? {
var _1: Int32?
_1 = reader.readInt32()
var _2: String?
_2 = parseString(reader)
var _3: String?
_3 = parseString(reader)
var _4: String?
_4 = parseString(reader)
var _5: Api.ReplyMarkup?
if Int(_1!) & Int(1 << 2) != 0 {if let signature = reader.readInt32() {
_5 = Api.parse(reader, signature: signature) as? Api.ReplyMarkup
} }
let _c1 = _1 != nil
let _c2 = _2 != nil
let _c3 = _3 != nil
let _c4 = _4 != nil
let _c5 = (Int(_1!) & Int(1 << 2) == 0) || _5 != nil
if _c1 && _c2 && _c3 && _c4 && _c5 {
return Api.BotInlineMessage.botInlineMessageMediaContact(flags: _1!, phoneNumber: _2!, firstName: _3!, lastName: _4!, replyMarkup: _5)
}
else {
return nil
}
}
static func parse_botInlineMessageMediaAuto(_ reader: BufferReader) -> BotInlineMessage? { static func parse_botInlineMessageMediaAuto(_ reader: BufferReader) -> BotInlineMessage? {
var _1: Int32? var _1: Int32?
_1 = reader.readInt32() _1 = reader.readInt32()
@ -13235,6 +13239,34 @@ extension Api {
return nil return nil
} }
} }
static func parse_botInlineMessageMediaContact(_ reader: BufferReader) -> BotInlineMessage? {
var _1: Int32?
_1 = reader.readInt32()
var _2: String?
_2 = parseString(reader)
var _3: String?
_3 = parseString(reader)
var _4: String?
_4 = parseString(reader)
var _5: String?
_5 = parseString(reader)
var _6: Api.ReplyMarkup?
if Int(_1!) & Int(1 << 2) != 0 {if let signature = reader.readInt32() {
_6 = Api.parse(reader, signature: signature) as? Api.ReplyMarkup
} }
let _c1 = _1 != nil
let _c2 = _2 != nil
let _c3 = _3 != nil
let _c4 = _4 != nil
let _c5 = _5 != nil
let _c6 = (Int(_1!) & Int(1 << 2) == 0) || _6 != nil
if _c1 && _c2 && _c3 && _c4 && _c5 && _c6 {
return Api.BotInlineMessage.botInlineMessageMediaContact(flags: _1!, phoneNumber: _2!, firstName: _3!, lastName: _4!, vcard: _5!, replyMarkup: _6)
}
else {
return nil
}
}
} }
enum InputPeerNotifySettings: TypeConstructorDescription { enum InputPeerNotifySettings: TypeConstructorDescription {

View File

@ -126,7 +126,9 @@ public func togglePeerUnreadMarkInteractively(postbox: Postbox, peerId: PeerId)
for i in 0 ..< states.count { for i in 0 ..< states.count {
if states[i].0 == namespace { if states[i].0 == namespace {
if states[i].1.isUnread { if states[i].1.isUnread {
let _ = modifier.applyInteractiveReadMaxIndex(MessageIndex(id: MessageId(peerId: peerId, namespace: namespace, id: 1), timestamp: 1)) if let index = modifier.getTopPeerMessageIndex(peerId: peerId, namespace: namespace) {
let _ = modifier.applyInteractiveReadMaxIndex(index)
}
} else { } else {
modifier.applyMarkUnread(peerId: peerId, namespace: namespace, value: true, interactive: true) modifier.applyMarkUnread(peerId: peerId, namespace: namespace, value: true, interactive: true)
} }

View File

@ -366,8 +366,8 @@ extension ChatContextResultMessage {
parsedReplyMarkup = ReplyMarkupMessageAttribute(apiMarkup: replyMarkup) parsedReplyMarkup = ReplyMarkupMessageAttribute(apiMarkup: replyMarkup)
} }
self = .mapLocation(media: media, replyMarkup: parsedReplyMarkup) self = .mapLocation(media: media, replyMarkup: parsedReplyMarkup)
case let .botInlineMessageMediaContact(_, phoneNumber, firstName, lastName, replyMarkup): case let .botInlineMessageMediaContact(_, phoneNumber, firstName, lastName, vcard, replyMarkup):
let media = TelegramMediaContact(firstName: firstName, lastName: lastName, phoneNumber: phoneNumber, peerId: nil) let media = TelegramMediaContact(firstName: firstName, lastName: lastName, phoneNumber: phoneNumber, peerId: nil, vCardData: vcard.isEmpty ? nil : vcard)
var parsedReplyMarkup: ReplyMarkupMessageAttribute? var parsedReplyMarkup: ReplyMarkupMessageAttribute?
if let replyMarkup = replyMarkup { if let replyMarkup = replyMarkup {
parsedReplyMarkup = ReplyMarkupMessageAttribute(apiMarkup: replyMarkup) parsedReplyMarkup = ReplyMarkupMessageAttribute(apiMarkup: replyMarkup)

View File

@ -14,7 +14,7 @@ func managedConfigurationUpdates(postbox: Postbox, network: Network) -> Signal<V
return (network.request(Api.functions.help.getConfig()) |> retryRequest |> mapToSignal { result -> Signal<Void, NoError> in return (network.request(Api.functions.help.getConfig()) |> retryRequest |> mapToSignal { result -> Signal<Void, NoError> in
return postbox.modify { modifier -> Void in return postbox.modify { modifier -> Void in
switch result { switch result {
case let .config(flags, _, _, _, _, dcOptions, chatSizeMax, megagroupSizeMax, forwardedCountMax, _, _, _, onlineCloudTimeoutMs, notifyCloudDelayMs, notifyDefaultDelayMs, pushChatPeriodMs, pushChatLimit, savedGifsLimit, editTimeLimit, revokeTimeLimit, revokePmTimeLimit, ratingEDecay, stickersRecentLimit, stickersFavedLimit, channelsReadMediaPeriod, tmpSessions, pinnedDialogsCountMax, callReceiveTimeoutMs, callRingTimeoutMs, callConnectTimeoutMs, callPacketTimeoutMs, meUrlPrefix, autoupdateUrlPrefix, suggestedLangCode, langPackVersion): case let .config(flags, _, _, _, _, dcOptions, dcTxtDomainName, chatSizeMax, megagroupSizeMax, forwardedCountMax, _, _, _, onlineCloudTimeoutMs, notifyCloudDelayMs, notifyDefaultDelayMs, pushChatPeriodMs, pushChatLimit, savedGifsLimit, editTimeLimit, revokeTimeLimit, revokePmTimeLimit, ratingEDecay, stickersRecentLimit, stickersFavedLimit, channelsReadMediaPeriod, tmpSessions, pinnedDialogsCountMax, callReceiveTimeoutMs, callRingTimeoutMs, callConnectTimeoutMs, callPacketTimeoutMs, meUrlPrefix, autoupdateUrlPrefix, gifSearchUsername, venueSearchUsername, imgSearchUsername, suggestedLangCode, langPackVersion):
var addressList: [Int: [MTDatacenterAddress]] = [:] var addressList: [Int: [MTDatacenterAddress]] = [:]
for option in dcOptions { for option in dcOptions {
switch option { switch option {

View File

@ -12,7 +12,7 @@ import TelegramCorePrivateModule
public enum ConnectionStatus: Equatable { public enum ConnectionStatus: Equatable {
case waitingForNetwork case waitingForNetwork
case connecting(proxyAddress: String?) case connecting(proxyAddress: String?, proxyHasConnectionIssues: Bool)
case updating(proxyAddress: String?) case updating(proxyAddress: String?)
case online(proxyAddress: String?) case online(proxyAddress: String?)
} }
@ -24,6 +24,7 @@ private struct MTProtoConnectionFlags: OptionSet {
static let Connected = MTProtoConnectionFlags(rawValue: 2) static let Connected = MTProtoConnectionFlags(rawValue: 2)
static let UpdatingConnectionContext = MTProtoConnectionFlags(rawValue: 4) static let UpdatingConnectionContext = MTProtoConnectionFlags(rawValue: 4)
static let PerformingServiceTasks = MTProtoConnectionFlags(rawValue: 8) static let PerformingServiceTasks = MTProtoConnectionFlags(rawValue: 8)
static let ProxyHasConnectionIssues = MTProtoConnectionFlags(rawValue: 16)
} }
private struct MTProtoConnectionInfo: Equatable { private struct MTProtoConnectionInfo: Equatable {
@ -83,11 +84,18 @@ private class MTProtoConnectionStatusDelegate: NSObject, MTProtoDelegate {
if let state = state { if let state = state {
if state.isConnected { if state.isConnected {
info.flags.insert(.Connected) info.flags.insert(.Connected)
info.flags.remove(.ProxyHasConnectionIssues)
} else { } else {
info.flags.remove(.Connected) info.flags.remove(.Connected)
if state.proxyHasConnectionIssues {
info.flags.insert(.ProxyHasConnectionIssues)
} else {
info.flags.remove(.ProxyHasConnectionIssues)
}
} }
} else { } else {
info.flags.remove(.Connected) info.flags.remove(.Connected)
info.flags.remove(.ProxyHasConnectionIssues)
} }
info.proxyAddress = state?.proxyAddress info.proxyAddress = state?.proxyAddress
return info return info
@ -386,6 +394,7 @@ func initializedNetwork(arguments: NetworkInitializationArguments, supplementary
let mtProto = MTProto(context: context, datacenterId: datacenterId, usageCalculationInfo: usageCalculationInfo(basePath: basePath, category: nil))! let mtProto = MTProto(context: context, datacenterId: datacenterId, usageCalculationInfo: usageCalculationInfo(basePath: basePath, category: nil))!
mtProto.useTempAuthKeys = context.useTempAuthKeys mtProto.useTempAuthKeys = context.useTempAuthKeys
mtProto.checkForProxyConnectionIssues = true
let connectionStatus = Promise<ConnectionStatus>(.waitingForNetwork) let connectionStatus = Promise<ConnectionStatus>(.waitingForNetwork)
@ -402,7 +411,7 @@ func initializedNetwork(arguments: NetworkInitializationArguments, supplementary
if !info.flags.contains(.NetworkAvailable) { if !info.flags.contains(.NetworkAvailable) {
connectionStatus?.set(.single(ConnectionStatus.waitingForNetwork)) connectionStatus?.set(.single(ConnectionStatus.waitingForNetwork))
} else if !info.flags.contains(.Connected) { } else if !info.flags.contains(.Connected) {
connectionStatus?.set(.single(.connecting(proxyAddress: info.proxyAddress))) connectionStatus?.set(.single(.connecting(proxyAddress: info.proxyAddress, proxyHasConnectionIssues: info.flags.contains(.ProxyHasConnectionIssues))))
} else if !info.flags.intersection([.UpdatingConnectionContext, .PerformingServiceTasks]).isEmpty { } else if !info.flags.intersection([.UpdatingConnectionContext, .PerformingServiceTasks]).isEmpty {
connectionStatus?.set(.single(.updating(proxyAddress: info.proxyAddress))) connectionStatus?.set(.single(.updating(proxyAddress: info.proxyAddress)))
} else { } else {

View File

@ -90,7 +90,7 @@ func mediaContentToUpload(network: Network, postbox: Postbox, auxiliaryMethods:
return .upload(uploadedMediaFileContent(network: network, postbox: postbox, auxiliaryMethods: auxiliaryMethods, transformOutgoingMessageMedia: transformOutgoingMessageMedia, messageMediaPreuploadManager: messageMediaPreuploadManager, peerId: peerId, messageId: messageId, text: text, attributes: attributes, file: file)) return .upload(uploadedMediaFileContent(network: network, postbox: postbox, auxiliaryMethods: auxiliaryMethods, transformOutgoingMessageMedia: transformOutgoingMessageMedia, messageMediaPreuploadManager: messageMediaPreuploadManager, peerId: peerId, messageId: messageId, text: text, attributes: attributes, file: file))
} }
} else if let contact = media as? TelegramMediaContact { } else if let contact = media as? TelegramMediaContact {
let input = Api.InputMedia.inputMediaContact(phoneNumber: contact.phoneNumber, firstName: contact.firstName, lastName: contact.lastName) let input = Api.InputMedia.inputMediaContact(phoneNumber: contact.phoneNumber, firstName: contact.firstName, lastName: contact.lastName, vcard: contact.vCardData ?? "")
return .ready(.media(input, text)) return .ready(.media(input, text))
} else if let map = media as? TelegramMediaMap { } else if let map = media as? TelegramMediaMap {
let input: Api.InputMedia let input: Api.InputMedia

View File

@ -674,7 +674,7 @@ private func parseMessage(peerId: PeerId, authorId: PeerId, tagLocalIndex: Int32
case let .decryptedMessageMediaGeoPoint(lat, long): case let .decryptedMessageMediaGeoPoint(lat, long):
parsedMedia.append(TelegramMediaMap(latitude: lat, longitude: long, geoPlace: nil, venue: nil, liveBroadcastingTimeout: nil)) parsedMedia.append(TelegramMediaMap(latitude: lat, longitude: long, geoPlace: nil, venue: nil, liveBroadcastingTimeout: nil))
case let .decryptedMessageMediaContact(phoneNumber, firstName, lastName, userId): case let .decryptedMessageMediaContact(phoneNumber, firstName, lastName, userId):
parsedMedia.append(TelegramMediaContact(firstName: firstName, lastName: lastName, phoneNumber: phoneNumber, peerId: userId == 0 ? nil : PeerId(namespace: Namespaces.Peer.CloudUser, id: userId))) parsedMedia.append(TelegramMediaContact(firstName: firstName, lastName: lastName, phoneNumber: phoneNumber, peerId: userId == 0 ? nil : PeerId(namespace: Namespaces.Peer.CloudUser, id: userId), vCardData: nil))
case let .decryptedMessageMediaVenue(lat, long, title, address, provider, venueId): case let .decryptedMessageMediaVenue(lat, long, title, address, provider, venueId):
parsedMedia.append(TelegramMediaMap(latitude: lat, longitude: long, geoPlace: nil, venue: MapVenue(title: title, address: address, provider: provider, id: venueId, type: nil), liveBroadcastingTimeout: nil)) parsedMedia.append(TelegramMediaMap(latitude: lat, longitude: long, geoPlace: nil, venue: MapVenue(title: title, address: address, provider: provider, id: venueId, type: nil), liveBroadcastingTimeout: nil))
case .decryptedMessageMediaEmpty: case .decryptedMessageMediaEmpty:
@ -871,7 +871,7 @@ private func parseMessage(peerId: PeerId, authorId: PeerId, tagLocalIndex: Int32
case let .decryptedMessageMediaGeoPoint(lat, long): case let .decryptedMessageMediaGeoPoint(lat, long):
parsedMedia.append(TelegramMediaMap(latitude: lat, longitude: long, geoPlace: nil, venue: nil, liveBroadcastingTimeout: nil)) parsedMedia.append(TelegramMediaMap(latitude: lat, longitude: long, geoPlace: nil, venue: nil, liveBroadcastingTimeout: nil))
case let .decryptedMessageMediaContact(phoneNumber, firstName, lastName, userId): case let .decryptedMessageMediaContact(phoneNumber, firstName, lastName, userId):
parsedMedia.append(TelegramMediaContact(firstName: firstName, lastName: lastName, phoneNumber: phoneNumber, peerId: userId == 0 ? nil : PeerId(namespace: Namespaces.Peer.CloudUser, id: userId))) parsedMedia.append(TelegramMediaContact(firstName: firstName, lastName: lastName, phoneNumber: phoneNumber, peerId: userId == 0 ? nil : PeerId(namespace: Namespaces.Peer.CloudUser, id: userId), vCardData: nil))
case let .decryptedMessageMediaVenue(lat, long, title, address, provider, venueId): case let .decryptedMessageMediaVenue(lat, long, title, address, provider, venueId):
parsedMedia.append(TelegramMediaMap(latitude: lat, longitude: long, geoPlace: nil, venue: MapVenue(title: title, address: address, provider: provider, id: venueId, type: nil), liveBroadcastingTimeout: nil)) parsedMedia.append(TelegramMediaMap(latitude: lat, longitude: long, geoPlace: nil, venue: MapVenue(title: title, address: address, provider: provider, id: venueId, type: nil), liveBroadcastingTimeout: nil))
case .decryptedMessageMediaEmpty: case .decryptedMessageMediaEmpty:

View File

@ -294,3 +294,23 @@ public func dropSecureId(network: Network, currentPassword: String) -> Signal<Vo
} }
} }
} }
public enum GetAllSecureIdValuesError {
case generic
}
public func getAllSecureIdValues(network: Network, context: SecureIdAccessContext) -> Signal<[SecureIdValueWithContext], GetAllSecureIdValuesError> {
return network.request(Api.functions.account.getAllSecureValues())
|> mapError { _ -> GetAllSecureIdValuesError in
return .generic
}
|> map { result -> [SecureIdValueWithContext] in
var values: [SecureIdValueWithContext] = []
for value in result {
if let parsedValue = parseSecureValue(context: context, value: value, errors: []) {
values.append(parsedValue.valueWithContext)
}
}
return values
}
}

View File

@ -208,7 +208,7 @@ public class BoxedMessage: NSObject {
public class Serialization: NSObject, MTSerialization { public class Serialization: NSObject, MTSerialization {
public func currentLayer() -> UInt { public func currentLayer() -> UInt {
return 81 return 82
} }
public func parseMessage(_ data: Data!) -> Any! { public func parseMessage(_ data: Data!) -> Any! {

View File

@ -164,7 +164,7 @@ func apiMessagePeerIds(_ message: Api.Message) -> [PeerId] {
if let media = media { if let media = media {
switch media { switch media {
case let .messageMediaContact(_, _, _, userId): case let .messageMediaContact(_, _, _, _, userId):
if userId != 0 { if userId != 0 {
result.append(PeerId(namespace: Namespaces.Peer.CloudUser, id: userId)) result.append(PeerId(namespace: Namespaces.Peer.CloudUser, id: userId))
} }
@ -275,9 +275,9 @@ func textMediaAndExpirationTimerFromApiMedia(_ media: Api.MessageMedia?, _ peerI
} else { } else {
return (TelegramMediaExpiredContent(data: .image), nil) return (TelegramMediaExpiredContent(data: .image), nil)
} }
case let .messageMediaContact(phoneNumber, firstName, lastName, userId): case let .messageMediaContact(phoneNumber, firstName, lastName, vcard, userId):
let contactPeerId: PeerId? = userId == 0 ? nil : PeerId(namespace: Namespaces.Peer.CloudUser, id: userId) let contactPeerId: PeerId? = userId == 0 ? nil : PeerId(namespace: Namespaces.Peer.CloudUser, id: userId)
let mediaContact = TelegramMediaContact(firstName: firstName, lastName: lastName, phoneNumber: phoneNumber, peerId: contactPeerId) let mediaContact = TelegramMediaContact(firstName: firstName, lastName: lastName, phoneNumber: phoneNumber, peerId: contactPeerId, vCardData: vcard.isEmpty ? nil : vcard)
return (mediaContact, nil) return (mediaContact, nil)
case let .messageMediaGeo(geo): case let .messageMediaGeo(geo):
let mediaMap = telegramMediaMapFromApiGeoPoint(geo, title: nil, address: nil, provider: nil, venueId: nil, venueType: nil, liveBroadcastingTimeout: nil) let mediaMap = telegramMediaMapFromApiGeoPoint(geo, title: nil, address: nil, provider: nil, venueId: nil, venueType: nil, liveBroadcastingTimeout: nil)

View File

@ -11,13 +11,16 @@ public final class TelegramMediaContact: Media {
public let lastName: String public let lastName: String
public let phoneNumber: String public let phoneNumber: String
public let peerId: PeerId? public let peerId: PeerId?
public let vCardData: String?
public let peerIds: [PeerId] public let peerIds: [PeerId]
public init(firstName: String, lastName: String, phoneNumber: String, peerId: PeerId?) { public init(firstName: String, lastName: String, phoneNumber: String, peerId: PeerId?, vCardData: String?) {
self.firstName = firstName self.firstName = firstName
self.lastName = lastName self.lastName = lastName
self.phoneNumber = phoneNumber self.phoneNumber = phoneNumber
self.peerId = peerId self.peerId = peerId
self.vCardData = vCardData
if let peerId = peerId { if let peerId = peerId {
self.peerIds = [peerId] self.peerIds = [peerId]
} else { } else {
@ -36,6 +39,7 @@ public final class TelegramMediaContact: Media {
self.peerId = nil self.peerId = nil
self.peerIds = [] self.peerIds = []
} }
self.vCardData = decoder.decodeOptionalStringForKey("vc")
} }
public func encode(_ encoder: PostboxEncoder) { public func encode(_ encoder: PostboxEncoder) {
@ -45,11 +49,16 @@ public final class TelegramMediaContact: Media {
if let peerId = self.peerId { if let peerId = self.peerId {
encoder.encodeInt64(peerId.toInt64(), forKey: "p") encoder.encodeInt64(peerId.toInt64(), forKey: "p")
} }
if let vCardData = self.vCardData {
encoder.encodeString(vCardData, forKey: "vc")
} else {
encoder.encodeNil(forKey: "vc")
}
} }
public func isEqual(_ other: Media) -> Bool { public func isEqual(_ other: Media) -> Bool {
if let other = other as? TelegramMediaContact { if let other = other as? TelegramMediaContact {
if self.id == other.id && self.firstName == other.firstName && self.lastName == other.lastName && self.phoneNumber == other.phoneNumber && self.peerId == other.peerId && self.peerIds == other.peerIds { if self.id == other.id && self.firstName == other.firstName && self.lastName == other.lastName && self.phoneNumber == other.phoneNumber && self.peerId == other.peerId && self.vCardData == other.vCardData && self.peerIds == other.peerIds {
return true return true
} }
} }