Merge branch 'feature/secureid' of https://github.com/peter-iakovlev/TelegramCoreDev into feature/secureid

This commit is contained in:
overtake 2018-06-15 23:17:38 +03:00
commit 805f019364
17 changed files with 221 additions and 216 deletions

View File

@ -644,6 +644,7 @@
D0E8174A2010E7E300B82BBB /* ChannelAdminEventLogContext.swift in Sources */ = {isa = PBXBuildFile; fileRef = D0E817482010E7E300B82BBB /* ChannelAdminEventLogContext.swift */; };
D0E8B8B32044706300605593 /* ForwardGame.swift in Sources */ = {isa = PBXBuildFile; fileRef = D0E8B8B22044706300605593 /* ForwardGame.swift */; };
D0E8B8B42044706300605593 /* ForwardGame.swift in Sources */ = {isa = PBXBuildFile; fileRef = D0E8B8B22044706300605593 /* ForwardGame.swift */; };
D0EA188220D3D2B1001AEE19 /* RemoteStorageConfiguration.swift in Sources */ = {isa = PBXBuildFile; fileRef = D0EA188120D3D2B1001AEE19 /* RemoteStorageConfiguration.swift */; };
D0EE7FC120986BF400981319 /* SecureIdInternalPassportValue.swift in Sources */ = {isa = PBXBuildFile; fileRef = D0EE7FC020986BF400981319 /* SecureIdInternalPassportValue.swift */; };
D0EE7FC220986BF400981319 /* SecureIdInternalPassportValue.swift in Sources */ = {isa = PBXBuildFile; fileRef = D0EE7FC020986BF400981319 /* SecureIdInternalPassportValue.swift */; };
D0EE7FC420986C5300981319 /* SecureIdPassportRegistrationValue.swift in Sources */ = {isa = PBXBuildFile; fileRef = D0EE7FC320986C5300981319 /* SecureIdPassportRegistrationValue.swift */; };
@ -1079,6 +1080,7 @@
D0E68768207534C90064BDB2 /* Api0.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Api0.swift; sourceTree = "<group>"; };
D0E817482010E7E300B82BBB /* ChannelAdminEventLogContext.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ChannelAdminEventLogContext.swift; sourceTree = "<group>"; };
D0E8B8B22044706300605593 /* ForwardGame.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ForwardGame.swift; sourceTree = "<group>"; };
D0EA188120D3D2B1001AEE19 /* RemoteStorageConfiguration.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RemoteStorageConfiguration.swift; sourceTree = "<group>"; };
D0EE7FC020986BF400981319 /* SecureIdInternalPassportValue.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SecureIdInternalPassportValue.swift; sourceTree = "<group>"; };
D0EE7FC320986C5300981319 /* SecureIdPassportRegistrationValue.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SecureIdPassportRegistrationValue.swift; sourceTree = "<group>"; };
D0EE7FC62098853100981319 /* SecureIdTemporaryRegistrationValue.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SecureIdTemporaryRegistrationValue.swift; sourceTree = "<group>"; };
@ -1162,6 +1164,7 @@
D0FA35041EA6135D00E56FFA /* CacheStorageSettings.swift */,
D08CAA7C1ED77EE90000FDA8 /* LocalizationSettings.swift */,
D01C7ED21EF5DF83008305F1 /* LimitsConfiguration.swift */,
D0EA188120D3D2B1001AEE19 /* RemoteStorageConfiguration.swift */,
D01C7ED51EF5E468008305F1 /* ProxySettings.swift */,
D04D8FF3209A4B0700865719 /* NetworkSettings.swift */,
D0B167221F9F972E00976B40 /* LoggingSettings.swift */,
@ -2049,6 +2052,7 @@
D03B0CBD1D62234300955575 /* Regex.swift in Sources */,
D00BDA191EE593D600C64C5E /* TelegramChannelAdminRights.swift in Sources */,
D0B843B91DA7FF30005F29E1 /* NBMetadataCoreTest.m in Sources */,
D0EA188220D3D2B1001AEE19 /* RemoteStorageConfiguration.swift in Sources */,
D018EE002044939F00CBB130 /* SecretApiLayer73.swift in Sources */,
D09A2FE61D7CD4940018FB72 /* TelegramChannel.swift in Sources */,
D03B0D0E1D62255C00955575 /* UpdateGroup.swift in Sources */,

View File

@ -236,6 +236,7 @@ private var declaredEncodables: Void = {
declareEncodable(LocalizationSettings.self, f: { LocalizationSettings(decoder: $0) })
declareEncodable(ProxySettings.self, f: { ProxySettings(decoder: $0) })
declareEncodable(NetworkSettings.self, f: { NetworkSettings(decoder: $0) })
declareEncodable(RemoteStorageConfiguration.self, f: { RemoteStorageConfiguration(decoder: $0) })
declareEncodable(LimitsConfiguration.self, f: { LimitsConfiguration(decoder: $0) })
declareEncodable(SuggestedLocalizationEntry.self, f: { SuggestedLocalizationEntry(decoder: $0) })
declareEncodable(SynchronizeLocalizationUpdatesOperation.self, f: { SynchronizeLocalizationUpdatesOperation(decoder: $0) })

View File

@ -98,7 +98,6 @@ fileprivate let parsers: [Int32 : (BufferReader) -> Any?] = {
dict[767652808] = { return Api.InputEncryptedFile.parse_inputEncryptedFileBigUploaded($0) }
dict[1443858741] = { return Api.messages.SentEncryptedMessage.parse_sentEncryptedMessage($0) }
dict[-1802240206] = { return Api.messages.SentEncryptedMessage.parse_sentEncryptedFile($0) }
dict[966688703] = { return Api.SavedContact.parse_savedPhoneContact($0) }
dict[1571494644] = { return Api.ExportedMessageLink.parse_exportedMessageLink($0) }
dict[-855308010] = { return Api.auth.Authorization.parse_authorization($0) }
dict[-181407105] = { return Api.InputFile.parse_inputFile($0) }
@ -386,7 +385,7 @@ fileprivate let parsers: [Int32 : (BufferReader) -> Any?] = {
dict[182649427] = { return Api.MessageRange.parse_messageRange($0) }
dict[946083368] = { return Api.messages.StickerSetInstallResult.parse_stickerSetInstallResultSuccess($0) }
dict[904138920] = { return Api.messages.StickerSetInstallResult.parse_stickerSetInstallResultArchive($0) }
dict[398844646] = { return Api.Config.parse_config($0) }
dict[840162234] = { return Api.Config.parse_config($0) }
dict[-75283823] = { return Api.TopPeerCategoryPeers.parse_topPeerCategoryPeers($0) }
dict[-1107729093] = { return Api.Game.parse_game($0) }
dict[-1032140601] = { return Api.BotCommand.parse_botCommand($0) }
@ -468,7 +467,7 @@ fileprivate let parsers: [Int32 : (BufferReader) -> Any?] = {
dict[1125058340] = { return Api.InputFileLocation.parse_inputDocumentFileLocation($0) }
dict[-876089816] = { return Api.InputFileLocation.parse_inputSecureFileLocation($0) }
dict[286776671] = { return Api.GeoPoint.parse_geoPointEmpty($0) }
dict[541710092] = { return Api.GeoPoint.parse_geoPoint($0) }
dict[43446532] = { return Api.GeoPoint.parse_geoPoint($0) }
dict[506920429] = { return Api.InputPhoneCall.parse_inputPhoneCall($0) }
dict[-1551583367] = { return Api.ReceivedNotifyMessage.parse_receivedNotifyMessage($0) }
dict[-57668565] = { return Api.ChatParticipants.parse_chatParticipantsForbidden($0) }
@ -503,8 +502,8 @@ fileprivate let parsers: [Int32 : (BufferReader) -> Any?] = {
dict[1816636575] = { return Api.LangPackString.parse_langPackStringPluralized($0) }
dict[695856818] = { return Api.LangPackString.parse_langPackStringDeleted($0) }
dict[-1036396922] = { return Api.InputWebFileLocation.parse_inputWebFileLocation($0) }
dict[1713855074] = { return Api.InputWebFileLocation.parse_inputWebFileGeoPointLocation($0) }
dict[1430205163] = { return Api.InputWebFileLocation.parse_inputWebFileGeoMessageLocation($0) }
dict[-1625153079] = { return Api.InputWebFileLocation.parse_inputWebFileGeoPointLocation($0) }
dict[1436466797] = { return Api.MessageFwdHeader.parse_messageFwdHeader($0) }
dict[398898678] = { return Api.help.Support.parse_support($0) }
dict[1474492012] = { return Api.MessagesFilter.parse_inputMessagesFilterEmpty($0) }
@ -609,8 +608,8 @@ fileprivate let parsers: [Int32 : (BufferReader) -> Any?] = {
dict[-17968211] = { return Api.ContactLink.parse_contactLinkNone($0) }
dict[646922073] = { return Api.ContactLink.parse_contactLinkHasPhone($0) }
dict[-721239344] = { return Api.ContactLink.parse_contactLinkContact($0) }
dict[-971322408] = { return Api.WebDocument.parse_webDocument($0) }
dict[-104284986] = { return Api.WebDocument.parse_webDocumentNoProxy($0) }
dict[475467473] = { return Api.WebDocument.parse_webDocument($0) }
dict[-1290580579] = { return Api.contacts.Found.parse_found($0) }
dict[-368018716] = { return Api.ChannelAdminLogEventsFilter.parse_channelAdminLogEventsFilter($0) }
dict[1889961234] = { return Api.PeerNotifySettings.parse_peerNotifySettingsEmpty($0) }
@ -773,8 +772,6 @@ struct Api {
_1.serialize(buffer, boxed)
case let _1 as Api.messages.SentEncryptedMessage:
_1.serialize(buffer, boxed)
case let _1 as Api.SavedContact:
_1.serialize(buffer, boxed)
case let _1 as Api.ExportedMessageLink:
_1.serialize(buffer, boxed)
case let _1 as Api.auth.Authorization:

View File

@ -2164,48 +2164,6 @@ extension Api {
}
}
}
enum SavedContact: TypeConstructorDescription {
case savedPhoneContact(phone: String, firstName: String, lastName: String)
func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
switch self {
case .savedPhoneContact(let phone, let firstName, let lastName):
if boxed {
buffer.appendInt32(966688703)
}
serializeString(phone, buffer: buffer, boxed: false)
serializeString(firstName, buffer: buffer, boxed: false)
serializeString(lastName, buffer: buffer, boxed: false)
break
}
}
func descriptionFields() -> (String, [(String, Any)]) {
switch self {
case .savedPhoneContact(let phone, let firstName, let lastName):
return ("savedPhoneContact", [("phone", phone), ("firstName", firstName), ("lastName", lastName)])
}
}
static func parse_savedPhoneContact(_ reader: BufferReader) -> SavedContact? {
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.SavedContact.savedPhoneContact(phone: _1!, firstName: _2!, lastName: _3!)
}
else {
return nil
}
}
}
enum ExportedMessageLink: TypeConstructorDescription {
case exportedMessageLink(link: String, html: String)
@ -9338,13 +9296,13 @@ extension Api {
}
enum Config: TypeConstructorDescription {
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?, staticMapsProvider: String?, captionLengthMax: Int32, messageLengthMax: Int32, 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?, staticMapsProvider: String?, captionLengthMax: Int32, messageLengthMax: Int32, webfileDcId: Int32, suggestedLangCode: String?, langPackVersion: Int32?)
func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
switch self {
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 staticMapsProvider, let captionLengthMax, let messageLengthMax, 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 staticMapsProvider, let captionLengthMax, let messageLengthMax, let webfileDcId, let suggestedLangCode, let langPackVersion):
if boxed {
buffer.appendInt32(398844646)
buffer.appendInt32(840162234)
}
serializeInt32(flags, buffer: buffer, boxed: false)
serializeInt32(date, buffer: buffer, boxed: false)
@ -9390,6 +9348,7 @@ extension Api {
if Int(flags) & Int(1 << 12) != 0 {serializeString(staticMapsProvider!, buffer: buffer, boxed: false)}
serializeInt32(captionLengthMax, buffer: buffer, boxed: false)
serializeInt32(messageLengthMax, buffer: buffer, boxed: false)
serializeInt32(webfileDcId, 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)}
break
@ -9398,8 +9357,8 @@ extension Api {
func descriptionFields() -> (String, [(String, Any)]) {
switch self {
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 staticMapsProvider, let captionLengthMax, let messageLengthMax, let suggestedLangCode, let 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), ("staticMapsProvider", staticMapsProvider), ("captionLengthMax", captionLengthMax), ("messageLengthMax", messageLengthMax), ("suggestedLangCode", suggestedLangCode), ("langPackVersion", 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 staticMapsProvider, let captionLengthMax, let messageLengthMax, let webfileDcId, let suggestedLangCode, let 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), ("staticMapsProvider", staticMapsProvider), ("captionLengthMax", captionLengthMax), ("messageLengthMax", messageLengthMax), ("webfileDcId", webfileDcId), ("suggestedLangCode", suggestedLangCode), ("langPackVersion", langPackVersion)])
}
}
@ -9488,10 +9447,12 @@ extension Api {
_39 = reader.readInt32()
var _40: Int32?
_40 = reader.readInt32()
var _41: String?
if Int(_1!) & Int(1 << 2) != 0 {_41 = parseString(reader) }
var _42: Int32?
if Int(_1!) & Int(1 << 2) != 0 {_42 = reader.readInt32() }
var _41: Int32?
_41 = reader.readInt32()
var _42: String?
if Int(_1!) & Int(1 << 2) != 0 {_42 = parseString(reader) }
var _43: Int32?
if Int(_1!) & Int(1 << 2) != 0 {_43 = reader.readInt32() }
let _c1 = _1 != nil
let _c2 = _2 != nil
let _c3 = _3 != nil
@ -9532,10 +9493,11 @@ extension Api {
let _c38 = (Int(_1!) & Int(1 << 12) == 0) || _38 != nil
let _c39 = _39 != nil
let _c40 = _40 != nil
let _c41 = (Int(_1!) & Int(1 << 2) == 0) || _41 != nil
let _c41 = _41 != nil
let _c42 = (Int(_1!) & Int(1 << 2) == 0) || _42 != 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 && _c40 && _c41 && _c42 {
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, staticMapsProvider: _38, captionLengthMax: _39!, messageLengthMax: _40!, suggestedLangCode: _41, langPackVersion: _42)
let _c43 = (Int(_1!) & Int(1 << 2) == 0) || _43 != 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 && _c40 && _c41 && _c42 && _c43 {
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, staticMapsProvider: _38, captionLengthMax: _39!, messageLengthMax: _40!, webfileDcId: _41!, suggestedLangCode: _42, langPackVersion: _43)
}
else {
return nil
@ -11765,7 +11727,7 @@ extension Api {
}
enum GeoPoint: TypeConstructorDescription {
case geoPointEmpty
case geoPoint(long: Double, lat: Double)
case geoPoint(long: Double, lat: Double, accessHash: Int64)
func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
switch self {
@ -11775,12 +11737,13 @@ extension Api {
}
break
case .geoPoint(let long, let lat):
case .geoPoint(let long, let lat, let accessHash):
if boxed {
buffer.appendInt32(541710092)
buffer.appendInt32(43446532)
}
serializeDouble(long, buffer: buffer, boxed: false)
serializeDouble(lat, buffer: buffer, boxed: false)
serializeInt64(accessHash, buffer: buffer, boxed: false)
break
}
}
@ -11789,8 +11752,8 @@ extension Api {
switch self {
case .geoPointEmpty:
return ("geoPointEmpty", [])
case .geoPoint(let long, let lat):
return ("geoPoint", [("long", long), ("lat", lat)])
case .geoPoint(let long, let lat, let accessHash):
return ("geoPoint", [("long", long), ("lat", lat), ("accessHash", accessHash)])
}
}
@ -11802,10 +11765,13 @@ extension Api {
_1 = reader.readDouble()
var _2: Double?
_2 = reader.readDouble()
var _3: Int64?
_3 = reader.readInt64()
let _c1 = _1 != nil
let _c2 = _2 != nil
if _c1 && _c2 {
return Api.GeoPoint.geoPoint(long: _1!, lat: _2!)
let _c3 = _3 != nil
if _c1 && _c2 && _c3 {
return Api.GeoPoint.geoPoint(long: _1!, lat: _2!, accessHash: _3!)
}
else {
return nil
@ -12697,8 +12663,8 @@ extension Api {
}
enum InputWebFileLocation: TypeConstructorDescription {
case inputWebFileLocation(url: String, accessHash: Int64)
case inputWebFileGeoPointLocation(geoPoint: Api.InputGeoPoint, w: Int32, h: Int32, zoom: Int32, scale: Int32)
case inputWebFileGeoMessageLocation(peer: Api.InputPeer, msgId: Int32, w: Int32, h: Int32, zoom: Int32, scale: Int32)
case inputWebFileGeoPointLocation(geoPoint: Api.InputGeoPoint, accessHash: Int64, w: Int32, h: Int32, zoom: Int32, scale: Int32)
func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
switch self {
@ -12709,16 +12675,6 @@ extension Api {
serializeString(url, buffer: buffer, boxed: false)
serializeInt64(accessHash, buffer: buffer, boxed: false)
break
case .inputWebFileGeoPointLocation(let geoPoint, let w, let h, let zoom, let scale):
if boxed {
buffer.appendInt32(1713855074)
}
geoPoint.serialize(buffer, true)
serializeInt32(w, buffer: buffer, boxed: false)
serializeInt32(h, buffer: buffer, boxed: false)
serializeInt32(zoom, buffer: buffer, boxed: false)
serializeInt32(scale, buffer: buffer, boxed: false)
break
case .inputWebFileGeoMessageLocation(let peer, let msgId, let w, let h, let zoom, let scale):
if boxed {
buffer.appendInt32(1430205163)
@ -12730,6 +12686,17 @@ extension Api {
serializeInt32(zoom, buffer: buffer, boxed: false)
serializeInt32(scale, buffer: buffer, boxed: false)
break
case .inputWebFileGeoPointLocation(let geoPoint, let accessHash, let w, let h, let zoom, let scale):
if boxed {
buffer.appendInt32(-1625153079)
}
geoPoint.serialize(buffer, true)
serializeInt64(accessHash, buffer: buffer, boxed: false)
serializeInt32(w, buffer: buffer, boxed: false)
serializeInt32(h, buffer: buffer, boxed: false)
serializeInt32(zoom, buffer: buffer, boxed: false)
serializeInt32(scale, buffer: buffer, boxed: false)
break
}
}
@ -12737,10 +12704,10 @@ extension Api {
switch self {
case .inputWebFileLocation(let url, let accessHash):
return ("inputWebFileLocation", [("url", url), ("accessHash", accessHash)])
case .inputWebFileGeoPointLocation(let geoPoint, let w, let h, let zoom, let scale):
return ("inputWebFileGeoPointLocation", [("geoPoint", geoPoint), ("w", w), ("h", h), ("zoom", zoom), ("scale", scale)])
case .inputWebFileGeoMessageLocation(let peer, let msgId, let w, let h, let zoom, let scale):
return ("inputWebFileGeoMessageLocation", [("peer", peer), ("msgId", msgId), ("w", w), ("h", h), ("zoom", zoom), ("scale", scale)])
case .inputWebFileGeoPointLocation(let geoPoint, let accessHash, let w, let h, let zoom, let scale):
return ("inputWebFileGeoPointLocation", [("geoPoint", geoPoint), ("accessHash", accessHash), ("w", w), ("h", h), ("zoom", zoom), ("scale", scale)])
}
}
@ -12758,31 +12725,6 @@ extension Api {
return nil
}
}
static func parse_inputWebFileGeoPointLocation(_ reader: BufferReader) -> InputWebFileLocation? {
var _1: Api.InputGeoPoint?
if let signature = reader.readInt32() {
_1 = Api.parse(reader, signature: signature) as? Api.InputGeoPoint
}
var _2: Int32?
_2 = reader.readInt32()
var _3: Int32?
_3 = reader.readInt32()
var _4: Int32?
_4 = reader.readInt32()
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.InputWebFileLocation.inputWebFileGeoPointLocation(geoPoint: _1!, w: _2!, h: _3!, zoom: _4!, scale: _5!)
}
else {
return nil
}
}
static func parse_inputWebFileGeoMessageLocation(_ reader: BufferReader) -> InputWebFileLocation? {
var _1: Api.InputPeer?
if let signature = reader.readInt32() {
@ -12811,6 +12753,34 @@ extension Api {
return nil
}
}
static func parse_inputWebFileGeoPointLocation(_ reader: BufferReader) -> InputWebFileLocation? {
var _1: Api.InputGeoPoint?
if let signature = reader.readInt32() {
_1 = Api.parse(reader, signature: signature) as? Api.InputGeoPoint
}
var _2: Int64?
_2 = reader.readInt64()
var _3: Int32?
_3 = reader.readInt32()
var _4: Int32?
_4 = reader.readInt32()
var _5: Int32?
_5 = reader.readInt32()
var _6: Int32?
_6 = reader.readInt32()
let _c1 = _1 != nil
let _c2 = _2 != nil
let _c3 = _3 != nil
let _c4 = _4 != nil
let _c5 = _5 != nil
let _c6 = _6 != nil
if _c1 && _c2 && _c3 && _c4 && _c5 && _c6 {
return Api.InputWebFileLocation.inputWebFileGeoPointLocation(geoPoint: _1!, accessHash: _2!, w: _3!, h: _4!, zoom: _5!, scale: _6!)
}
else {
return nil
}
}
}
enum MessageFwdHeader: TypeConstructorDescription {
@ -15000,26 +14970,11 @@ extension Api {
}
enum WebDocument: TypeConstructorDescription {
case webDocument(url: String, accessHash: Int64, size: Int32, mimeType: String, attributes: [Api.DocumentAttribute], dcId: Int32)
case webDocumentNoProxy(url: String, size: Int32, mimeType: String, attributes: [Api.DocumentAttribute])
case webDocument(url: String, accessHash: Int64, size: Int32, mimeType: String, attributes: [Api.DocumentAttribute])
func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
switch self {
case .webDocument(let url, let accessHash, let size, let mimeType, let attributes, let dcId):
if boxed {
buffer.appendInt32(-971322408)
}
serializeString(url, buffer: buffer, boxed: false)
serializeInt64(accessHash, buffer: buffer, boxed: false)
serializeInt32(size, buffer: buffer, boxed: false)
serializeString(mimeType, buffer: buffer, boxed: false)
buffer.appendInt32(481674261)
buffer.appendInt32(Int32(attributes.count))
for item in attributes {
item.serialize(buffer, true)
}
serializeInt32(dcId, buffer: buffer, boxed: false)
break
case .webDocumentNoProxy(let url, let size, let mimeType, let attributes):
if boxed {
buffer.appendInt32(-104284986)
@ -15033,46 +14988,32 @@ extension Api {
item.serialize(buffer, true)
}
break
case .webDocument(let url, let accessHash, let size, let mimeType, let attributes):
if boxed {
buffer.appendInt32(475467473)
}
serializeString(url, buffer: buffer, boxed: false)
serializeInt64(accessHash, buffer: buffer, boxed: false)
serializeInt32(size, buffer: buffer, boxed: false)
serializeString(mimeType, buffer: buffer, boxed: false)
buffer.appendInt32(481674261)
buffer.appendInt32(Int32(attributes.count))
for item in attributes {
item.serialize(buffer, true)
}
break
}
}
func descriptionFields() -> (String, [(String, Any)]) {
switch self {
case .webDocument(let url, let accessHash, let size, let mimeType, let attributes, let dcId):
return ("webDocument", [("url", url), ("accessHash", accessHash), ("size", size), ("mimeType", mimeType), ("attributes", attributes), ("dcId", dcId)])
case .webDocumentNoProxy(let url, let size, let mimeType, let attributes):
return ("webDocumentNoProxy", [("url", url), ("size", size), ("mimeType", mimeType), ("attributes", attributes)])
case .webDocument(let url, let accessHash, let size, let mimeType, let attributes):
return ("webDocument", [("url", url), ("accessHash", accessHash), ("size", size), ("mimeType", mimeType), ("attributes", attributes)])
}
}
static func parse_webDocument(_ reader: BufferReader) -> WebDocument? {
var _1: String?
_1 = parseString(reader)
var _2: Int64?
_2 = reader.readInt64()
var _3: Int32?
_3 = reader.readInt32()
var _4: String?
_4 = parseString(reader)
var _5: [Api.DocumentAttribute]?
if let _ = reader.readInt32() {
_5 = Api.parseVector(reader, elementSignature: 0, elementType: Api.DocumentAttribute.self)
}
var _6: Int32?
_6 = reader.readInt32()
let _c1 = _1 != nil
let _c2 = _2 != nil
let _c3 = _3 != nil
let _c4 = _4 != nil
let _c5 = _5 != nil
let _c6 = _6 != nil
if _c1 && _c2 && _c3 && _c4 && _c5 && _c6 {
return Api.WebDocument.webDocument(url: _1!, accessHash: _2!, size: _3!, mimeType: _4!, attributes: _5!, dcId: _6!)
}
else {
return nil
}
}
static func parse_webDocumentNoProxy(_ reader: BufferReader) -> WebDocument? {
var _1: String?
_1 = parseString(reader)
@ -15095,6 +15036,31 @@ extension Api {
return nil
}
}
static func parse_webDocument(_ reader: BufferReader) -> WebDocument? {
var _1: String?
_1 = parseString(reader)
var _2: Int64?
_2 = reader.readInt64()
var _3: Int32?
_3 = reader.readInt32()
var _4: String?
_4 = parseString(reader)
var _5: [Api.DocumentAttribute]?
if let _ = reader.readInt32() {
_5 = Api.parseVector(reader, elementSignature: 0, elementType: Api.DocumentAttribute.self)
}
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.WebDocument.webDocument(url: _1!, accessHash: _2!, size: _3!, mimeType: _4!, attributes: _5!)
}
else {
return nil
}
}
}
enum ChannelAdminLogEventsFilter: TypeConstructorDescription {

View File

@ -3892,20 +3892,6 @@ extension Api {
return result
})
}
static func getSaved() -> (FunctionDescription, Buffer, DeserializeFunctionResponse<[Api.SavedContact]>) {
let buffer = Buffer()
buffer.appendInt32(-2098076769)
return (FunctionDescription(name: "contacts.getSaved", parameters: []), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> [Api.SavedContact]? in
let reader = BufferReader(buffer)
var result: [Api.SavedContact]?
if let _ = reader.readInt32() {
result = Api.parseVector(reader, elementSignature: 0, elementType: Api.SavedContact.self)
}
return result
})
}
}
struct help {
static func getConfig() -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.Config>) {
@ -4918,21 +4904,6 @@ extension Api {
return result
})
}
static func initTakeoutSession(flags: Int32, fileMaxSize: Int32?) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.Bool>) {
let buffer = Buffer()
buffer.appendInt32(-74035733)
serializeInt32(flags, buffer: buffer, boxed: false)
if Int(flags) & Int(1 << 5) != 0 {serializeInt32(fileMaxSize!, buffer: buffer, boxed: false)}
return (FunctionDescription(name: "account.initTakeoutSession", parameters: [("flags", flags), ("fileMaxSize", fileMaxSize)]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.Bool? in
let reader = BufferReader(buffer)
var result: Api.Bool?
if let signature = reader.readInt32() {
result = Api.parse(reader, signature: signature) as? Api.Bool
}
return result
})
}
}
struct langpack {
static func getLangPack(langCode: String) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.LangPackDifference>) {

View File

@ -162,7 +162,7 @@ final class ChatHistoryPreloadManager {
self.postbox = postbox
self.network = network
self.accountPeerId = accountPeerId
self.download.set(network.download(datacenterId: network.datacenterId, tag: nil))
self.download.set(network.background())
self.automaticChatListDisposable = (postbox.tailChatListView(groupId: nil, count: 20, summaryComponents: ChatListEntrySummaryComponents()) |> deliverOnMainQueue).start(next: { [weak self] view in
if let strongSelf = self {

View File

@ -365,12 +365,12 @@ public final class HttpReferenceMediaResource: TelegramMediaResource {
public struct WebFileReferenceMediaResourceId: MediaResourceId {
public let url: String
public let datacenterId:Int32
public let accessHash: Int64
public let size: Int32
public func isEqual(to: MediaResourceId) -> Bool {
if let to = to as? WebFileReferenceMediaResourceId {
return self.url == to.url && datacenterId == to.datacenterId && size == to.size && accessHash == to.accessHash
return self.url == to.url && size == to.size && accessHash == to.accessHash
} else {
return false
}
@ -381,24 +381,18 @@ public struct WebFileReferenceMediaResourceId: MediaResourceId {
}
public var uniqueId: String {
return "proxy-\(persistentHash32(self.url))-\(datacenterId)-\(size)-\(accessHash)"
return "proxy-\(persistentHash32(self.url))-\(size)-\(accessHash)"
}
}
public final class WebFileReferenceMediaResource: TelegramMediaResource, TelegramMultipartFetchableResource {
var datacenterId: Int {
return Int(_datacenterId)
}
public final class WebFileReferenceMediaResource: TelegramMediaResource {
public let url: String
public let size: Int32
private let _datacenterId: Int32
public let accessHash: Int64
public init(url: String, size: Int32, datacenterId: Int32, accessHash: Int64) {
public init(url: String, size: Int32, accessHash: Int64) {
self.url = url
self.size = size
self._datacenterId = datacenterId
self.accessHash = accessHash
}
@ -409,24 +403,22 @@ public final class WebFileReferenceMediaResource: TelegramMediaResource, Telegra
public required init(decoder: PostboxDecoder) {
self.url = decoder.decodeStringForKey("u", orElse: "")
self.size = decoder.decodeInt32ForKey("s", orElse: 0)
self._datacenterId = decoder.decodeInt32ForKey("d", orElse: 0)
self.accessHash = decoder.decodeInt64ForKey("h", orElse: 0)
}
public func encode(_ encoder: PostboxEncoder) {
encoder.encodeString(self.url, forKey: "u")
encoder.encodeInt32(self.size, forKey: "s")
encoder.encodeInt32(self._datacenterId, forKey: "d")
encoder.encodeInt64(self.accessHash, forKey: "h")
}
public var id: MediaResourceId {
return WebFileReferenceMediaResourceId(url: self.url, datacenterId: self._datacenterId, accessHash: accessHash, size: self.size)
return WebFileReferenceMediaResourceId(url: self.url, accessHash: accessHash, size: self.size)
}
public func isEqual(to: TelegramMediaResource) -> Bool {
if let to = to as? WebFileReferenceMediaResource {
return to.url == self.url && to.datacenterId == self.datacenterId && to.size == self.size && to.accessHash == self.accessHash
return to.url == self.url && to.size == self.size && to.accessHash == self.accessHash
} else {
return false
}

View File

@ -37,7 +37,7 @@ class Download: NSObject, MTRequestMessageServiceDelegate {
private var shouldKeepConnectionDisposable: Disposable?
init(queue: Queue, datacenterId: Int, isCdn: Bool, context: MTContext, masterDatacenterId: Int, usageInfo: MTNetworkUsageCalculationInfo?, shouldKeepConnection: Signal<Bool, NoError>) {
init(queue: Queue, datacenterId: Int, isMedia: Bool, isCdn: Bool, context: MTContext, masterDatacenterId: Int, usageInfo: MTNetworkUsageCalculationInfo?, shouldKeepConnection: Signal<Bool, NoError>) {
self.datacenterId = datacenterId
self.isCdn = isCdn
self.context = context
@ -45,7 +45,7 @@ class Download: NSObject, MTRequestMessageServiceDelegate {
self.mtProto = MTProto(context: self.context, datacenterId: datacenterId, usageCalculationInfo: usageInfo)
self.mtProto.cdn = isCdn
self.mtProto.useTempAuthKeys = self.context.useTempAuthKeys && !isCdn
self.mtProto.media = true;
self.mtProto.media = isMedia
if !isCdn && datacenterId != masterDatacenterId {
self.mtProto.authTokenMasterDatacenterId = masterDatacenterId
self.mtProto.requiredAuthToken = Int(datacenterId) as NSNumber

View File

@ -9,8 +9,8 @@ import SwiftSignalKit
import Photos
#endif
private func fetchCloudMediaLocation(account: Account, resource: TelegramMultipartFetchableResource, size: Int?, ranges: Signal<IndexSet, NoError>, tag: MediaResourceFetchTag?) -> Signal<MediaResourceDataFetchResult, NoError> {
return multipartFetch(account: account, resource: resource, size: size, ranges: ranges, tag: tag)
private func fetchCloudMediaLocation(account: Account, resource: TelegramMediaResource, datacenterId: Int, size: Int?, ranges: Signal<IndexSet, NoError>, tag: MediaResourceFetchTag?) -> Signal<MediaResourceDataFetchResult, NoError> {
return multipartFetch(account: account, resource: resource, datacenterId: datacenterId, size: size, ranges: ranges, tag: tag)
}
private func fetchLocalFileResource(path: String, move: Bool) -> Signal<MediaResourceDataFetchResult, NoError> {
@ -36,7 +36,12 @@ func fetchResource(account: Account, resource: MediaResource, ranges: Signal<Ind
} else if let secretFileResource = resource as? SecretFileMediaResource {
return .single(.dataPart(resourceOffset: 0, data: Data(), range: 0 ..< 0, complete: false)) |> then(fetchSecretFileResource(account: account, resource: secretFileResource, ranges: ranges, tag: tag))
} else if let cloudResource = resource as? TelegramMultipartFetchableResource {
return .single(.dataPart(resourceOffset: 0, data: Data(), range: 0 ..< 0, complete: false)) |> then(fetchCloudMediaLocation(account: account, resource: cloudResource, size: resource.size == 0 ? nil : resource.size, ranges: ranges, tag: tag))
return .single(.dataPart(resourceOffset: 0, data: Data(), range: 0 ..< 0, complete: false)) |> then(fetchCloudMediaLocation(account: account, resource: cloudResource, datacenterId: cloudResource.datacenterId, size: resource.size == 0 ? nil : resource.size, ranges: ranges, tag: tag))
} else if let webFileResource = resource as? WebFileReferenceMediaResource {
return currentWebDocumentsHostDatacenterId(postbox: account.postbox, isTestingEnvironment: account.testingEnvironment)
|> mapToSignal { datacenterId -> Signal<MediaResourceDataFetchResult, NoError> in
return .single(.dataPart(resourceOffset: 0, data: Data(), range: 0 ..< 0, complete: false)) |> then(fetchCloudMediaLocation(account: account, resource: webFileResource, datacenterId: Int(datacenterId), size: resource.size == 0 ? nil : resource.size, ranges: ranges, tag: tag))
}
} else if let localFileResource = resource as? LocalFileReferenceMediaResource {
return fetchLocalFileResource(path: localFileResource.localFilePath, move: localFileResource.isUniquelyReferencedTemporaryFile)
} else if let httpReference = resource as? HttpReferenceMediaResource {

View File

@ -10,5 +10,5 @@ import Foundation
#endif
func fetchSecretFileResource(account: Account, resource: SecretFileMediaResource, ranges: Signal<IndexSet, NoError>, tag: MediaResourceFetchTag?) -> Signal<MediaResourceDataFetchResult, NoError> {
return multipartFetch(account: account, resource: resource, size: resource.size, ranges: ranges, tag: tag, encryptionKey: resource.key, decryptedSize: resource.decryptedSize)
return multipartFetch(account: account, resource: resource, datacenterId: resource.datacenterId, size: resource.size, ranges: ranges, tag: tag, encryptionKey: resource.key, decryptedSize: resource.decryptedSize)
}

View File

@ -43,6 +43,8 @@ func managedConfigurationUpdates(postbox: Postbox, network: Network) -> Signal<V
return settings
})
updateRemoteStorageConfiguration(transaction: transaction, configuration: RemoteStorageConfiguration(webDocumentsHostDatacenterId: config.webfileDcId))
transaction.updatePreferencesEntry(key: PreferencesKeys.suggestedLocalization, { entry in
var currentLanguageCode: String?
if let entry = entry as? SuggestedLocalizationEntry {

View File

@ -728,9 +728,8 @@ private final class MultipartFetchManager {
}
}
func multipartFetch(account: Account, resource: TelegramMultipartFetchableResource, size: Int?, ranges: Signal<IndexSet, NoError>, tag: MediaResourceFetchTag?, encryptionKey: SecretFileEncryptionKey? = nil, decryptedSize: Int32? = nil) -> Signal<MediaResourceDataFetchResult, NoError> {
func multipartFetch(account: Account, resource: TelegramMediaResource, datacenterId: Int, size: Int?, ranges: Signal<IndexSet, NoError>, tag: MediaResourceFetchTag?, encryptionKey: SecretFileEncryptionKey? = nil, decryptedSize: Int32? = nil) -> Signal<MediaResourceDataFetchResult, NoError> {
return Signal { subscriber in
let datacenterId = resource.datacenterId
let location: MultipartFetchMasterLocation
if let resource = resource as? TelegramCloudMediaResource {
location = .generic(Int32(datacenterId), resource.apiInputLocation)
@ -746,7 +745,7 @@ func multipartFetch(account: Account, resource: TelegramMultipartFetchableResour
}
let manager = MultipartFetchManager(size: size, ranges: ranges, encryptionKey: encryptionKey, decryptedSize: decryptedSize, location: location, takeDownloader: { id, cdn in
return account.network.download(datacenterId: Int(id), isCdn: cdn, tag: tag)
return account.network.download(datacenterId: Int(id), isMedia: true, isCdn: cdn, tag: tag)
}, partReady: { dataOffset, data in
subscriber.putNext(.dataPart(resourceOffset: dataOffset, data: data, range: 0 ..< data.count, complete: false))
}, reportCompleteSize: { size in

View File

@ -136,6 +136,7 @@ private enum PreferencesKeyValues: Int32 {
case coreSettings = 7
case contentPrivacySettings = 8
case networkSettings = 9
case remoteStorageConfiguration = 10
}
public func applicationSpecificPreferencesKey(_ value: Int32) -> ValueBoxKey {
@ -204,4 +205,10 @@ public struct PreferencesKeys {
key.setInt32(0, value: PreferencesKeyValues.networkSettings.rawValue)
return key
}()
public static let remoteStorageConfiguration: ValueBoxKey = {
let key = ValueBoxKey(length: 4)
key.setInt32(0, value: PreferencesKeyValues.remoteStorageConfiguration.rawValue)
return key
}()
}

View File

@ -362,7 +362,7 @@ func initializedNetwork(arguments: NetworkInitializationArguments, supplementary
apiEnvironment = apiEnvironment.withUpdatedNetworkSettings((networkSettings ?? NetworkSettings.defaultSettings).mtNetworkSettings)
let context = MTContext(serialization: serialization, apiEnvironment: apiEnvironment, useTempAuthKeys: false)!
let context = MTContext(serialization: serialization, apiEnvironment: apiEnvironment, isTestingEnvironment: testingEnvironment, useTempAuthKeys: false)!
let seedAddressList: [Int: [String]]
@ -620,15 +620,19 @@ public final class Network: NSObject, MTRequestMessageServiceDelegate {
self.loggedOut?()
}
func download(datacenterId: Int, isCdn: Bool = false, tag: MediaResourceFetchTag?) -> Signal<Download, NoError> {
return self.worker(datacenterId: datacenterId, isCdn: isCdn, tag: tag)
func download(datacenterId: Int, isMedia: Bool, isCdn: Bool = false, tag: MediaResourceFetchTag?) -> Signal<Download, NoError> {
return self.worker(datacenterId: datacenterId, isCdn: isCdn, isMedia: isMedia, tag: tag)
}
func upload(tag: MediaResourceFetchTag?) -> Signal<Download, NoError> {
return self.worker(datacenterId: self.datacenterId, isCdn: false, tag: tag)
return self.worker(datacenterId: self.datacenterId, isCdn: false, isMedia: false, tag: tag)
}
private func worker(datacenterId: Int, isCdn: Bool, tag: MediaResourceFetchTag?) -> Signal<Download, NoError> {
func background() -> Signal<Download, NoError> {
return self.worker(datacenterId: self.datacenterId, isCdn: false, isMedia: false, tag: nil)
}
private func worker(datacenterId: Int, isCdn: Bool, isMedia: Bool, tag: MediaResourceFetchTag?) -> Signal<Download, NoError> {
return Signal { [weak self] subscriber in
if let strongSelf = self {
let shouldKeepWorkerConnection: Signal<Bool, NoError> = combineLatest(strongSelf.shouldKeepConnection.get(), strongSelf.shouldExplicitelyKeepWorkerConnections.get())
@ -636,7 +640,7 @@ public final class Network: NSObject, MTRequestMessageServiceDelegate {
return shouldKeepConnection || shouldExplicitelyKeepWorkerConnections
}
|> distinctUntilChanged
subscriber.putNext(Download(queue: strongSelf.queue, datacenterId: datacenterId, isCdn: isCdn, context: strongSelf.context, masterDatacenterId: strongSelf.datacenterId, usageInfo: usageCalculationInfo(basePath: strongSelf.basePath, category: (tag as? TelegramMediaResourceFetchTag)?.statsCategory), shouldKeepConnection: shouldKeepWorkerConnection))
subscriber.putNext(Download(queue: strongSelf.queue, datacenterId: datacenterId, isMedia: isMedia, isCdn: isCdn, context: strongSelf.context, masterDatacenterId: strongSelf.datacenterId, usageInfo: usageCalculationInfo(basePath: strongSelf.basePath, category: (tag as? TelegramMediaResourceFetchTag)?.statsCategory), shouldKeepConnection: shouldKeepWorkerConnection))
}
subscriber.putCompletion()

View File

@ -0,0 +1,57 @@
import Foundation
#if os(macOS)
import PostboxMac
import SwiftSignalKitMac
#else
import Postbox
import SwiftSignalKit
#endif
public final class RemoteStorageConfiguration: PreferencesEntry {
public let webDocumentsHostDatacenterId: Int32
init(webDocumentsHostDatacenterId: Int32) {
self.webDocumentsHostDatacenterId = webDocumentsHostDatacenterId
}
public init(decoder: PostboxDecoder) {
self.webDocumentsHostDatacenterId = decoder.decodeInt32ForKey("webDocumentsHostDatacenterId", orElse: 4)
}
public func encode(_ encoder: PostboxEncoder) {
encoder.encodeInt32(self.webDocumentsHostDatacenterId, forKey: "webDocumentsHostDatacenterId")
}
public func isEqual(to: PreferencesEntry) -> Bool {
guard let to = to as? RemoteStorageConfiguration else {
return false
}
if self.webDocumentsHostDatacenterId != to.webDocumentsHostDatacenterId {
return false
}
return true
}
}
public func currentWebDocumentsHostDatacenterId(postbox: Postbox, isTestingEnvironment: Bool) -> Signal<Int32, NoError> {
return postbox.transaction { transaction -> Int32 in
if let entry = transaction.getPreferencesEntry(key: PreferencesKeys.remoteStorageConfiguration) as? RemoteStorageConfiguration {
return entry.webDocumentsHostDatacenterId
} else {
if isTestingEnvironment {
return 2
} else {
return 4
}
}
}
}
func updateRemoteStorageConfiguration(transaction: Transaction, configuration: RemoteStorageConfiguration) {
let current = transaction.getPreferencesEntry(key: PreferencesKeys.remoteStorageConfiguration) as? RemoteStorageConfiguration
if let current = current, current.isEqual(to: configuration) {
return
}
transaction.setPreferencesEntry(key: PreferencesKeys.remoteStorageConfiguration, value: configuration)
}

View File

@ -207,7 +207,7 @@ func telegramMediaMapFromApiGeoPoint(_ geo: Api.GeoPoint, title: String?, addres
venue = MapVenue(title: title, address: address, provider: provider, id: venueId, type: venueType)
}
switch geo {
case let .geoPoint(long, lat):
case let .geoPoint(long, lat, _):
return TelegramMediaMap(latitude: lat, longitude: long, geoPlace: nil, venue: venue, liveBroadcastingTimeout: liveBroadcastingTimeout)
case .geoPointEmpty:
return TelegramMediaMap(latitude: 0.0, longitude: 0.0, geoPlace: nil, venue: venue, liveBroadcastingTimeout: liveBroadcastingTimeout)

View File

@ -70,7 +70,7 @@ extension TelegramMediaWebFile {
convenience init(_ document: Api.WebDocument) {
switch document {
case let .webDocument(data):
self.init(resource: WebFileReferenceMediaResource(url: data.url, size: data.size, datacenterId: data.dcId, accessHash: data.accessHash), mimeType: data.mimeType, size: data.size, attributes: telegramMediaFileAttributesFromApiAttributes(data.attributes))
self.init(resource: WebFileReferenceMediaResource(url: data.url, size: data.size, accessHash: data.accessHash), mimeType: data.mimeType, size: data.size, attributes: telegramMediaFileAttributesFromApiAttributes(data.attributes))
case let .webDocumentNoProxy(url, size, mimeType, attributes):
self.init(resource: HttpReferenceMediaResource(url: url, size: Int(size)), mimeType: mimeType, size: size, attributes: telegramMediaFileAttributesFromApiAttributes(attributes))
}