diff --git a/Telegram/BUILD b/Telegram/BUILD
index 03a0109fe6..eb5b5aa3c1 100644
--- a/Telegram/BUILD
+++ b/Telegram/BUILD
@@ -492,6 +492,13 @@ communication_notifications_fragment = """
"""
+signin_fragment = """
+com.apple.developer.applesignin
+
+ Default
+
+"""
+
plist_fragment(
name = "TelegramEntitlements",
extension = "entitlements",
@@ -505,6 +512,7 @@ plist_fragment(
unrestricted_voip_fragment,
carplay_fragment,
communication_notifications_fragment,
+ signin_fragment,
])
)
diff --git a/Telegram/Telegram-iOS/Resources/IntroCall.tgs b/Telegram/Telegram-iOS/Resources/IntroCall.tgs
new file mode 100644
index 0000000000..b819c8302f
Binary files /dev/null and b/Telegram/Telegram-iOS/Resources/IntroCall.tgs differ
diff --git a/Telegram/Telegram-iOS/Resources/IntroLetter.tgs b/Telegram/Telegram-iOS/Resources/IntroLetter.tgs
new file mode 100644
index 0000000000..4964d09680
Binary files /dev/null and b/Telegram/Telegram-iOS/Resources/IntroLetter.tgs differ
diff --git a/Telegram/Telegram-iOS/Resources/IntroMail.tgs b/Telegram/Telegram-iOS/Resources/IntroMail.tgs
new file mode 100644
index 0000000000..df7d23dc20
Binary files /dev/null and b/Telegram/Telegram-iOS/Resources/IntroMail.tgs differ
diff --git a/Telegram/Telegram-iOS/Resources/IntroMessage.tgs b/Telegram/Telegram-iOS/Resources/IntroMessage.tgs
new file mode 100644
index 0000000000..ea15a9e93f
Binary files /dev/null and b/Telegram/Telegram-iOS/Resources/IntroMessage.tgs differ
diff --git a/Telegram/Telegram-iOS/Resources/IntroPhone.tgs b/Telegram/Telegram-iOS/Resources/IntroPhone.tgs
new file mode 100644
index 0000000000..51d638ea00
Binary files /dev/null and b/Telegram/Telegram-iOS/Resources/IntroPhone.tgs differ
diff --git a/Telegram/Telegram-iOS/en.lproj/Localizable.strings b/Telegram/Telegram-iOS/en.lproj/Localizable.strings
index ac9a777d0a..f3454d3359 100644
--- a/Telegram/Telegram-iOS/en.lproj/Localizable.strings
+++ b/Telegram/Telegram-iOS/en.lproj/Localizable.strings
@@ -7961,3 +7961,7 @@ Sorry for the inconvenience.";
"Premium.Annual" = "Annual";
"Premium.Monthly" = "Monthly";
+
+"Login.PhoneNumberConfirmation" = "Is this the correct number?";
+"Login.Edit" = "Edit";
+"Login.Yes" = "Yes";
diff --git a/submodules/AuthorizationUI/Sources/AuthorizationOptionText.swift b/submodules/AuthorizationUI/Sources/AuthorizationOptionText.swift
index fe3b3fa0a3..8fd5bf5900 100644
--- a/submodules/AuthorizationUI/Sources/AuthorizationOptionText.swift
+++ b/submodules/AuthorizationUI/Sources/AuthorizationOptionText.swift
@@ -22,6 +22,11 @@ public func authorizationCurrentOptionText(_ type: SentAuthorizationCodeType, st
return NSAttributedString(string: strings.Login_CodeSentCall, font: Font.regular(16.0), textColor: primaryColor, paragraphAlignment: .center)
case .flashCall:
return NSAttributedString(string: strings.ChangePhoneNumberCode_Called, font: Font.regular(16.0), textColor: primaryColor, paragraphAlignment: .center)
+ case .emailSetupRequired:
+ return NSAttributedString(string: "", font: Font.regular(16.0), textColor: primaryColor, paragraphAlignment: .center)
+ case let .email(emailPattern, _, _, _, _):
+ //TODO: localize
+ return NSAttributedString(string: "Please enter the code we have sent to your email \(emailPattern).", font: Font.regular(16.0), textColor: primaryColor, paragraphAlignment: .center)
}
}
diff --git a/submodules/TelegramApi/Sources/Api0.swift b/submodules/TelegramApi/Sources/Api0.swift
index fe59a42be2..28da60f417 100644
--- a/submodules/TelegramApi/Sources/Api0.swift
+++ b/submodules/TelegramApi/Sources/Api0.swift
@@ -190,6 +190,12 @@ fileprivate let parsers: [Int32 : (BufferReader) -> Any?] = {
dict[250621158] = { return Api.DocumentAttribute.parse_documentAttributeVideo($0) }
dict[-40996577] = { return Api.DraftMessage.parse_draftMessage($0) }
dict[453805082] = { return Api.DraftMessage.parse_draftMessageEmpty($0) }
+ dict[-1764723459] = { return Api.EmailVerification.parse_emailVerificationApple($0) }
+ dict[-1842457175] = { return Api.EmailVerification.parse_emailVerificationCode($0) }
+ dict[-611279166] = { return Api.EmailVerification.parse_emailVerificationGoogle($0) }
+ dict[1383932651] = { return Api.EmailVerifyPurpose.parse_emailVerifyPurposeLoginChange($0) }
+ dict[1128644211] = { return Api.EmailVerifyPurpose.parse_emailVerifyPurposeLoginSetup($0) }
+ dict[-1141565819] = { return Api.EmailVerifyPurpose.parse_emailVerifyPurposePassport($0) }
dict[-709641735] = { return Api.EmojiKeyword.parse_emojiKeyword($0) }
dict[594408994] = { return Api.EmojiKeyword.parse_emojiKeywordDeleted($0) }
dict[1556570557] = { return Api.EmojiKeywordsDifference.parse_emojiKeywordsDifference($0) }
@@ -869,7 +875,9 @@ fileprivate let parsers: [Int32 : (BufferReader) -> Any?] = {
dict[1275039392] = { return Api.account.Authorizations.parse_authorizations($0) }
dict[1674235686] = { return Api.account.AutoDownloadSettings.parse_autoDownloadSettings($0) }
dict[1474462241] = { return Api.account.ContentSettings.parse_contentSettings($0) }
- dict[408623183] = { return Api.account.Password.parse_password($0) }
+ dict[731303195] = { return Api.account.EmailVerified.parse_emailVerified($0) }
+ dict[-507835039] = { return Api.account.EmailVerified.parse_emailVerifiedLogin($0) }
+ dict[-1787080453] = { return Api.account.Password.parse_password($0) }
dict[-1036572727] = { return Api.account.PasswordInputSettings.parse_passwordInputSettings($0) }
dict[-1705233435] = { return Api.account.PasswordSettings.parse_passwordSettings($0) }
dict[1352683077] = { return Api.account.PrivacyRules.parse_privacyRules($0) }
@@ -903,8 +911,10 @@ fileprivate let parsers: [Int32 : (BufferReader) -> Any?] = {
dict[1577067778] = { return Api.auth.SentCode.parse_sentCode($0) }
dict[1035688326] = { return Api.auth.SentCodeType.parse_sentCodeTypeApp($0) }
dict[1398007207] = { return Api.auth.SentCodeType.parse_sentCodeTypeCall($0) }
+ dict[1511364673] = { return Api.auth.SentCodeType.parse_sentCodeTypeEmailCode($0) }
dict[-1425815847] = { return Api.auth.SentCodeType.parse_sentCodeTypeFlashCall($0) }
dict[-2113903484] = { return Api.auth.SentCodeType.parse_sentCodeTypeMissedCall($0) }
+ dict[-1521934870] = { return Api.auth.SentCodeType.parse_sentCodeTypeSetUpEmailRequired($0) }
dict[-1073693790] = { return Api.auth.SentCodeType.parse_sentCodeTypeSms($0) }
dict[-309659827] = { return Api.channels.AdminLogResults.parse_adminLogResults($0) }
dict[-541588713] = { return Api.channels.ChannelParticipant.parse_channelParticipant($0) }
@@ -1216,6 +1226,10 @@ public extension Api {
_1.serialize(buffer, boxed)
case let _1 as Api.DraftMessage:
_1.serialize(buffer, boxed)
+ case let _1 as Api.EmailVerification:
+ _1.serialize(buffer, boxed)
+ case let _1 as Api.EmailVerifyPurpose:
+ _1.serialize(buffer, boxed)
case let _1 as Api.EmojiKeyword:
_1.serialize(buffer, boxed)
case let _1 as Api.EmojiKeywordsDifference:
@@ -1594,6 +1608,8 @@ public extension Api {
_1.serialize(buffer, boxed)
case let _1 as Api.account.ContentSettings:
_1.serialize(buffer, boxed)
+ case let _1 as Api.account.EmailVerified:
+ _1.serialize(buffer, boxed)
case let _1 as Api.account.Password:
_1.serialize(buffer, boxed)
case let _1 as Api.account.PasswordInputSettings:
diff --git a/submodules/TelegramApi/Sources/Api10.swift b/submodules/TelegramApi/Sources/Api10.swift
index 26ac5e851b..5bb9ef768b 100644
--- a/submodules/TelegramApi/Sources/Api10.swift
+++ b/submodules/TelegramApi/Sources/Api10.swift
@@ -1,3 +1,487 @@
+public extension Api {
+ enum InputStickerSetItem: TypeConstructorDescription {
+ case inputStickerSetItem(flags: Int32, document: Api.InputDocument, emoji: String, maskCoords: Api.MaskCoords?)
+
+ public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
+ switch self {
+ case .inputStickerSetItem(let flags, let document, let emoji, let maskCoords):
+ if boxed {
+ buffer.appendInt32(-6249322)
+ }
+ serializeInt32(flags, buffer: buffer, boxed: false)
+ document.serialize(buffer, true)
+ serializeString(emoji, buffer: buffer, boxed: false)
+ if Int(flags) & Int(1 << 0) != 0 {maskCoords!.serialize(buffer, true)}
+ break
+ }
+ }
+
+ public func descriptionFields() -> (String, [(String, Any)]) {
+ switch self {
+ case .inputStickerSetItem(let flags, let document, let emoji, let maskCoords):
+ return ("inputStickerSetItem", [("flags", String(describing: flags)), ("document", String(describing: document)), ("emoji", String(describing: emoji)), ("maskCoords", String(describing: maskCoords))])
+ }
+ }
+
+ public static func parse_inputStickerSetItem(_ reader: BufferReader) -> InputStickerSetItem? {
+ var _1: Int32?
+ _1 = reader.readInt32()
+ var _2: Api.InputDocument?
+ if let signature = reader.readInt32() {
+ _2 = Api.parse(reader, signature: signature) as? Api.InputDocument
+ }
+ var _3: String?
+ _3 = parseString(reader)
+ var _4: Api.MaskCoords?
+ if Int(_1!) & Int(1 << 0) != 0 {if let signature = reader.readInt32() {
+ _4 = Api.parse(reader, signature: signature) as? Api.MaskCoords
+ } }
+ let _c1 = _1 != nil
+ let _c2 = _2 != nil
+ let _c3 = _3 != nil
+ let _c4 = (Int(_1!) & Int(1 << 0) == 0) || _4 != nil
+ if _c1 && _c2 && _c3 && _c4 {
+ return Api.InputStickerSetItem.inputStickerSetItem(flags: _1!, document: _2!, emoji: _3!, maskCoords: _4)
+ }
+ else {
+ return nil
+ }
+ }
+
+ }
+}
+public extension Api {
+ enum InputStickeredMedia: TypeConstructorDescription {
+ case inputStickeredMediaDocument(id: Api.InputDocument)
+ case inputStickeredMediaPhoto(id: Api.InputPhoto)
+
+ public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
+ switch self {
+ case .inputStickeredMediaDocument(let id):
+ if boxed {
+ buffer.appendInt32(70813275)
+ }
+ id.serialize(buffer, true)
+ break
+ case .inputStickeredMediaPhoto(let id):
+ if boxed {
+ buffer.appendInt32(1251549527)
+ }
+ id.serialize(buffer, true)
+ break
+ }
+ }
+
+ public func descriptionFields() -> (String, [(String, Any)]) {
+ switch self {
+ case .inputStickeredMediaDocument(let id):
+ return ("inputStickeredMediaDocument", [("id", String(describing: id))])
+ case .inputStickeredMediaPhoto(let id):
+ return ("inputStickeredMediaPhoto", [("id", String(describing: id))])
+ }
+ }
+
+ public static func parse_inputStickeredMediaDocument(_ reader: BufferReader) -> InputStickeredMedia? {
+ var _1: Api.InputDocument?
+ if let signature = reader.readInt32() {
+ _1 = Api.parse(reader, signature: signature) as? Api.InputDocument
+ }
+ let _c1 = _1 != nil
+ if _c1 {
+ return Api.InputStickeredMedia.inputStickeredMediaDocument(id: _1!)
+ }
+ else {
+ return nil
+ }
+ }
+ public static func parse_inputStickeredMediaPhoto(_ reader: BufferReader) -> InputStickeredMedia? {
+ var _1: Api.InputPhoto?
+ if let signature = reader.readInt32() {
+ _1 = Api.parse(reader, signature: signature) as? Api.InputPhoto
+ }
+ let _c1 = _1 != nil
+ if _c1 {
+ return Api.InputStickeredMedia.inputStickeredMediaPhoto(id: _1!)
+ }
+ else {
+ return nil
+ }
+ }
+
+ }
+}
+public extension Api {
+ enum InputStorePaymentPurpose: TypeConstructorDescription {
+ case inputStorePaymentGiftPremium(userId: Api.InputUser, currency: String, amount: Int64)
+ case inputStorePaymentPremiumSubscription(flags: Int32)
+
+ public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
+ switch self {
+ case .inputStorePaymentGiftPremium(let userId, let currency, let amount):
+ if boxed {
+ buffer.appendInt32(1634697192)
+ }
+ userId.serialize(buffer, true)
+ serializeString(currency, buffer: buffer, boxed: false)
+ serializeInt64(amount, buffer: buffer, boxed: false)
+ break
+ case .inputStorePaymentPremiumSubscription(let flags):
+ if boxed {
+ buffer.appendInt32(-1502273946)
+ }
+ serializeInt32(flags, buffer: buffer, boxed: false)
+ break
+ }
+ }
+
+ public func descriptionFields() -> (String, [(String, Any)]) {
+ switch self {
+ case .inputStorePaymentGiftPremium(let userId, let currency, let amount):
+ return ("inputStorePaymentGiftPremium", [("userId", String(describing: userId)), ("currency", String(describing: currency)), ("amount", String(describing: amount))])
+ case .inputStorePaymentPremiumSubscription(let flags):
+ return ("inputStorePaymentPremiumSubscription", [("flags", String(describing: flags))])
+ }
+ }
+
+ public static func parse_inputStorePaymentGiftPremium(_ reader: BufferReader) -> InputStorePaymentPurpose? {
+ var _1: Api.InputUser?
+ if let signature = reader.readInt32() {
+ _1 = Api.parse(reader, signature: signature) as? Api.InputUser
+ }
+ var _2: String?
+ _2 = parseString(reader)
+ var _3: Int64?
+ _3 = reader.readInt64()
+ let _c1 = _1 != nil
+ let _c2 = _2 != nil
+ let _c3 = _3 != nil
+ if _c1 && _c2 && _c3 {
+ return Api.InputStorePaymentPurpose.inputStorePaymentGiftPremium(userId: _1!, currency: _2!, amount: _3!)
+ }
+ else {
+ return nil
+ }
+ }
+ public static func parse_inputStorePaymentPremiumSubscription(_ reader: BufferReader) -> InputStorePaymentPurpose? {
+ var _1: Int32?
+ _1 = reader.readInt32()
+ let _c1 = _1 != nil
+ if _c1 {
+ return Api.InputStorePaymentPurpose.inputStorePaymentPremiumSubscription(flags: _1!)
+ }
+ else {
+ return nil
+ }
+ }
+
+ }
+}
+public extension Api {
+ enum InputTheme: TypeConstructorDescription {
+ case inputTheme(id: Int64, accessHash: Int64)
+ case inputThemeSlug(slug: String)
+
+ public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
+ switch self {
+ case .inputTheme(let id, let accessHash):
+ if boxed {
+ buffer.appendInt32(1012306921)
+ }
+ serializeInt64(id, buffer: buffer, boxed: false)
+ serializeInt64(accessHash, buffer: buffer, boxed: false)
+ break
+ case .inputThemeSlug(let slug):
+ if boxed {
+ buffer.appendInt32(-175567375)
+ }
+ serializeString(slug, buffer: buffer, boxed: false)
+ break
+ }
+ }
+
+ public func descriptionFields() -> (String, [(String, Any)]) {
+ switch self {
+ case .inputTheme(let id, let accessHash):
+ return ("inputTheme", [("id", String(describing: id)), ("accessHash", String(describing: accessHash))])
+ case .inputThemeSlug(let slug):
+ return ("inputThemeSlug", [("slug", String(describing: slug))])
+ }
+ }
+
+ public static func parse_inputTheme(_ reader: BufferReader) -> InputTheme? {
+ var _1: Int64?
+ _1 = reader.readInt64()
+ var _2: Int64?
+ _2 = reader.readInt64()
+ let _c1 = _1 != nil
+ let _c2 = _2 != nil
+ if _c1 && _c2 {
+ return Api.InputTheme.inputTheme(id: _1!, accessHash: _2!)
+ }
+ else {
+ return nil
+ }
+ }
+ public static func parse_inputThemeSlug(_ reader: BufferReader) -> InputTheme? {
+ var _1: String?
+ _1 = parseString(reader)
+ let _c1 = _1 != nil
+ if _c1 {
+ return Api.InputTheme.inputThemeSlug(slug: _1!)
+ }
+ else {
+ return nil
+ }
+ }
+
+ }
+}
+public extension Api {
+ enum InputThemeSettings: TypeConstructorDescription {
+ case inputThemeSettings(flags: Int32, baseTheme: Api.BaseTheme, accentColor: Int32, outboxAccentColor: Int32?, messageColors: [Int32]?, wallpaper: Api.InputWallPaper?, wallpaperSettings: Api.WallPaperSettings?)
+
+ public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
+ switch self {
+ case .inputThemeSettings(let flags, let baseTheme, let accentColor, let outboxAccentColor, let messageColors, let wallpaper, let wallpaperSettings):
+ if boxed {
+ buffer.appendInt32(-1881255857)
+ }
+ serializeInt32(flags, buffer: buffer, boxed: false)
+ baseTheme.serialize(buffer, true)
+ serializeInt32(accentColor, buffer: buffer, boxed: false)
+ if Int(flags) & Int(1 << 3) != 0 {serializeInt32(outboxAccentColor!, buffer: buffer, boxed: false)}
+ if Int(flags) & Int(1 << 0) != 0 {buffer.appendInt32(481674261)
+ buffer.appendInt32(Int32(messageColors!.count))
+ for item in messageColors! {
+ serializeInt32(item, buffer: buffer, boxed: false)
+ }}
+ if Int(flags) & Int(1 << 1) != 0 {wallpaper!.serialize(buffer, true)}
+ if Int(flags) & Int(1 << 1) != 0 {wallpaperSettings!.serialize(buffer, true)}
+ break
+ }
+ }
+
+ public func descriptionFields() -> (String, [(String, Any)]) {
+ switch self {
+ case .inputThemeSettings(let flags, let baseTheme, let accentColor, let outboxAccentColor, let messageColors, let wallpaper, let wallpaperSettings):
+ return ("inputThemeSettings", [("flags", String(describing: flags)), ("baseTheme", String(describing: baseTheme)), ("accentColor", String(describing: accentColor)), ("outboxAccentColor", String(describing: outboxAccentColor)), ("messageColors", String(describing: messageColors)), ("wallpaper", String(describing: wallpaper)), ("wallpaperSettings", String(describing: wallpaperSettings))])
+ }
+ }
+
+ public static func parse_inputThemeSettings(_ reader: BufferReader) -> InputThemeSettings? {
+ var _1: Int32?
+ _1 = reader.readInt32()
+ var _2: Api.BaseTheme?
+ if let signature = reader.readInt32() {
+ _2 = Api.parse(reader, signature: signature) as? Api.BaseTheme
+ }
+ var _3: Int32?
+ _3 = reader.readInt32()
+ var _4: Int32?
+ if Int(_1!) & Int(1 << 3) != 0 {_4 = reader.readInt32() }
+ var _5: [Int32]?
+ if Int(_1!) & Int(1 << 0) != 0 {if let _ = reader.readInt32() {
+ _5 = Api.parseVector(reader, elementSignature: -1471112230, elementType: Int32.self)
+ } }
+ var _6: Api.InputWallPaper?
+ if Int(_1!) & Int(1 << 1) != 0 {if let signature = reader.readInt32() {
+ _6 = Api.parse(reader, signature: signature) as? Api.InputWallPaper
+ } }
+ var _7: Api.WallPaperSettings?
+ if Int(_1!) & Int(1 << 1) != 0 {if let signature = reader.readInt32() {
+ _7 = Api.parse(reader, signature: signature) as? Api.WallPaperSettings
+ } }
+ let _c1 = _1 != nil
+ let _c2 = _2 != nil
+ let _c3 = _3 != nil
+ let _c4 = (Int(_1!) & Int(1 << 3) == 0) || _4 != nil
+ let _c5 = (Int(_1!) & Int(1 << 0) == 0) || _5 != nil
+ let _c6 = (Int(_1!) & Int(1 << 1) == 0) || _6 != nil
+ let _c7 = (Int(_1!) & Int(1 << 1) == 0) || _7 != nil
+ if _c1 && _c2 && _c3 && _c4 && _c5 && _c6 && _c7 {
+ return Api.InputThemeSettings.inputThemeSettings(flags: _1!, baseTheme: _2!, accentColor: _3!, outboxAccentColor: _4, messageColors: _5, wallpaper: _6, wallpaperSettings: _7)
+ }
+ else {
+ return nil
+ }
+ }
+
+ }
+}
+public extension Api {
+ enum InputUser: TypeConstructorDescription {
+ case inputUser(userId: Int64, accessHash: Int64)
+ case inputUserEmpty
+ case inputUserFromMessage(peer: Api.InputPeer, msgId: Int32, userId: Int64)
+ case inputUserSelf
+
+ public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
+ switch self {
+ case .inputUser(let userId, let accessHash):
+ if boxed {
+ buffer.appendInt32(-233744186)
+ }
+ serializeInt64(userId, buffer: buffer, boxed: false)
+ serializeInt64(accessHash, buffer: buffer, boxed: false)
+ break
+ case .inputUserEmpty:
+ if boxed {
+ buffer.appendInt32(-1182234929)
+ }
+
+ break
+ case .inputUserFromMessage(let peer, let msgId, let userId):
+ if boxed {
+ buffer.appendInt32(497305826)
+ }
+ peer.serialize(buffer, true)
+ serializeInt32(msgId, buffer: buffer, boxed: false)
+ serializeInt64(userId, buffer: buffer, boxed: false)
+ break
+ case .inputUserSelf:
+ if boxed {
+ buffer.appendInt32(-138301121)
+ }
+
+ break
+ }
+ }
+
+ public func descriptionFields() -> (String, [(String, Any)]) {
+ switch self {
+ case .inputUser(let userId, let accessHash):
+ return ("inputUser", [("userId", String(describing: userId)), ("accessHash", String(describing: accessHash))])
+ case .inputUserEmpty:
+ return ("inputUserEmpty", [])
+ case .inputUserFromMessage(let peer, let msgId, let userId):
+ return ("inputUserFromMessage", [("peer", String(describing: peer)), ("msgId", String(describing: msgId)), ("userId", String(describing: userId))])
+ case .inputUserSelf:
+ return ("inputUserSelf", [])
+ }
+ }
+
+ public static func parse_inputUser(_ reader: BufferReader) -> InputUser? {
+ var _1: Int64?
+ _1 = reader.readInt64()
+ var _2: Int64?
+ _2 = reader.readInt64()
+ let _c1 = _1 != nil
+ let _c2 = _2 != nil
+ if _c1 && _c2 {
+ return Api.InputUser.inputUser(userId: _1!, accessHash: _2!)
+ }
+ else {
+ return nil
+ }
+ }
+ public static func parse_inputUserEmpty(_ reader: BufferReader) -> InputUser? {
+ return Api.InputUser.inputUserEmpty
+ }
+ public static func parse_inputUserFromMessage(_ reader: BufferReader) -> InputUser? {
+ var _1: Api.InputPeer?
+ if let signature = reader.readInt32() {
+ _1 = Api.parse(reader, signature: signature) as? Api.InputPeer
+ }
+ var _2: Int32?
+ _2 = reader.readInt32()
+ var _3: Int64?
+ _3 = reader.readInt64()
+ let _c1 = _1 != nil
+ let _c2 = _2 != nil
+ let _c3 = _3 != nil
+ if _c1 && _c2 && _c3 {
+ return Api.InputUser.inputUserFromMessage(peer: _1!, msgId: _2!, userId: _3!)
+ }
+ else {
+ return nil
+ }
+ }
+ public static func parse_inputUserSelf(_ reader: BufferReader) -> InputUser? {
+ return Api.InputUser.inputUserSelf
+ }
+
+ }
+}
+public extension Api {
+ enum InputWallPaper: TypeConstructorDescription {
+ case inputWallPaper(id: Int64, accessHash: Int64)
+ case inputWallPaperNoFile(id: Int64)
+ case inputWallPaperSlug(slug: String)
+
+ public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
+ switch self {
+ case .inputWallPaper(let id, let accessHash):
+ if boxed {
+ buffer.appendInt32(-433014407)
+ }
+ serializeInt64(id, buffer: buffer, boxed: false)
+ serializeInt64(accessHash, buffer: buffer, boxed: false)
+ break
+ case .inputWallPaperNoFile(let id):
+ if boxed {
+ buffer.appendInt32(-1770371538)
+ }
+ serializeInt64(id, buffer: buffer, boxed: false)
+ break
+ case .inputWallPaperSlug(let slug):
+ if boxed {
+ buffer.appendInt32(1913199744)
+ }
+ serializeString(slug, buffer: buffer, boxed: false)
+ break
+ }
+ }
+
+ public func descriptionFields() -> (String, [(String, Any)]) {
+ switch self {
+ case .inputWallPaper(let id, let accessHash):
+ return ("inputWallPaper", [("id", String(describing: id)), ("accessHash", String(describing: accessHash))])
+ case .inputWallPaperNoFile(let id):
+ return ("inputWallPaperNoFile", [("id", String(describing: id))])
+ case .inputWallPaperSlug(let slug):
+ return ("inputWallPaperSlug", [("slug", String(describing: slug))])
+ }
+ }
+
+ public static func parse_inputWallPaper(_ reader: BufferReader) -> InputWallPaper? {
+ var _1: Int64?
+ _1 = reader.readInt64()
+ var _2: Int64?
+ _2 = reader.readInt64()
+ let _c1 = _1 != nil
+ let _c2 = _2 != nil
+ if _c1 && _c2 {
+ return Api.InputWallPaper.inputWallPaper(id: _1!, accessHash: _2!)
+ }
+ else {
+ return nil
+ }
+ }
+ public static func parse_inputWallPaperNoFile(_ reader: BufferReader) -> InputWallPaper? {
+ var _1: Int64?
+ _1 = reader.readInt64()
+ let _c1 = _1 != nil
+ if _c1 {
+ return Api.InputWallPaper.inputWallPaperNoFile(id: _1!)
+ }
+ else {
+ return nil
+ }
+ }
+ public static func parse_inputWallPaperSlug(_ reader: BufferReader) -> InputWallPaper? {
+ var _1: String?
+ _1 = parseString(reader)
+ let _c1 = _1 != nil
+ if _c1 {
+ return Api.InputWallPaper.inputWallPaperSlug(slug: _1!)
+ }
+ else {
+ return nil
+ }
+ }
+
+ }
+}
public extension Api {
enum InputWebDocument: TypeConstructorDescription {
case inputWebDocument(url: String, size: Int32, mimeType: String, attributes: [Api.DocumentAttribute])
@@ -818,315 +1302,3 @@ public extension Api {
}
}
-public extension Api {
- enum KeyboardButtonRow: TypeConstructorDescription {
- case keyboardButtonRow(buttons: [Api.KeyboardButton])
-
- public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
- switch self {
- case .keyboardButtonRow(let buttons):
- if boxed {
- buffer.appendInt32(2002815875)
- }
- buffer.appendInt32(481674261)
- buffer.appendInt32(Int32(buttons.count))
- for item in buttons {
- item.serialize(buffer, true)
- }
- break
- }
- }
-
- public func descriptionFields() -> (String, [(String, Any)]) {
- switch self {
- case .keyboardButtonRow(let buttons):
- return ("keyboardButtonRow", [("buttons", String(describing: buttons))])
- }
- }
-
- public static func parse_keyboardButtonRow(_ reader: BufferReader) -> KeyboardButtonRow? {
- var _1: [Api.KeyboardButton]?
- if let _ = reader.readInt32() {
- _1 = Api.parseVector(reader, elementSignature: 0, elementType: Api.KeyboardButton.self)
- }
- let _c1 = _1 != nil
- if _c1 {
- return Api.KeyboardButtonRow.keyboardButtonRow(buttons: _1!)
- }
- else {
- return nil
- }
- }
-
- }
-}
-public extension Api {
- enum LabeledPrice: TypeConstructorDescription {
- case labeledPrice(label: String, amount: Int64)
-
- public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
- switch self {
- case .labeledPrice(let label, let amount):
- if boxed {
- buffer.appendInt32(-886477832)
- }
- serializeString(label, buffer: buffer, boxed: false)
- serializeInt64(amount, buffer: buffer, boxed: false)
- break
- }
- }
-
- public func descriptionFields() -> (String, [(String, Any)]) {
- switch self {
- case .labeledPrice(let label, let amount):
- return ("labeledPrice", [("label", String(describing: label)), ("amount", String(describing: amount))])
- }
- }
-
- public static func parse_labeledPrice(_ reader: BufferReader) -> LabeledPrice? {
- var _1: String?
- _1 = parseString(reader)
- var _2: Int64?
- _2 = reader.readInt64()
- let _c1 = _1 != nil
- let _c2 = _2 != nil
- if _c1 && _c2 {
- return Api.LabeledPrice.labeledPrice(label: _1!, amount: _2!)
- }
- else {
- return nil
- }
- }
-
- }
-}
-public extension Api {
- enum LangPackDifference: TypeConstructorDescription {
- case langPackDifference(langCode: String, fromVersion: Int32, version: Int32, strings: [Api.LangPackString])
-
- public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
- switch self {
- case .langPackDifference(let langCode, let fromVersion, let version, let strings):
- if boxed {
- buffer.appendInt32(-209337866)
- }
- serializeString(langCode, buffer: buffer, boxed: false)
- serializeInt32(fromVersion, buffer: buffer, boxed: false)
- serializeInt32(version, buffer: buffer, boxed: false)
- buffer.appendInt32(481674261)
- buffer.appendInt32(Int32(strings.count))
- for item in strings {
- item.serialize(buffer, true)
- }
- break
- }
- }
-
- public func descriptionFields() -> (String, [(String, Any)]) {
- switch self {
- case .langPackDifference(let langCode, let fromVersion, let version, let strings):
- return ("langPackDifference", [("langCode", String(describing: langCode)), ("fromVersion", String(describing: fromVersion)), ("version", String(describing: version)), ("strings", String(describing: strings))])
- }
- }
-
- public static func parse_langPackDifference(_ reader: BufferReader) -> LangPackDifference? {
- var _1: String?
- _1 = parseString(reader)
- var _2: Int32?
- _2 = reader.readInt32()
- var _3: Int32?
- _3 = reader.readInt32()
- var _4: [Api.LangPackString]?
- if let _ = reader.readInt32() {
- _4 = Api.parseVector(reader, elementSignature: 0, elementType: Api.LangPackString.self)
- }
- let _c1 = _1 != nil
- let _c2 = _2 != nil
- let _c3 = _3 != nil
- let _c4 = _4 != nil
- if _c1 && _c2 && _c3 && _c4 {
- return Api.LangPackDifference.langPackDifference(langCode: _1!, fromVersion: _2!, version: _3!, strings: _4!)
- }
- else {
- return nil
- }
- }
-
- }
-}
-public extension Api {
- enum LangPackLanguage: TypeConstructorDescription {
- case langPackLanguage(flags: Int32, name: String, nativeName: String, langCode: String, baseLangCode: String?, pluralCode: String, stringsCount: Int32, translatedCount: Int32, translationsUrl: String)
-
- public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
- switch self {
- case .langPackLanguage(let flags, let name, let nativeName, let langCode, let baseLangCode, let pluralCode, let stringsCount, let translatedCount, let translationsUrl):
- if boxed {
- buffer.appendInt32(-288727837)
- }
- serializeInt32(flags, buffer: buffer, boxed: false)
- serializeString(name, buffer: buffer, boxed: false)
- serializeString(nativeName, buffer: buffer, boxed: false)
- serializeString(langCode, buffer: buffer, boxed: false)
- if Int(flags) & Int(1 << 1) != 0 {serializeString(baseLangCode!, buffer: buffer, boxed: false)}
- serializeString(pluralCode, buffer: buffer, boxed: false)
- serializeInt32(stringsCount, buffer: buffer, boxed: false)
- serializeInt32(translatedCount, buffer: buffer, boxed: false)
- serializeString(translationsUrl, buffer: buffer, boxed: false)
- break
- }
- }
-
- public func descriptionFields() -> (String, [(String, Any)]) {
- switch self {
- case .langPackLanguage(let flags, let name, let nativeName, let langCode, let baseLangCode, let pluralCode, let stringsCount, let translatedCount, let translationsUrl):
- return ("langPackLanguage", [("flags", String(describing: flags)), ("name", String(describing: name)), ("nativeName", String(describing: nativeName)), ("langCode", String(describing: langCode)), ("baseLangCode", String(describing: baseLangCode)), ("pluralCode", String(describing: pluralCode)), ("stringsCount", String(describing: stringsCount)), ("translatedCount", String(describing: translatedCount)), ("translationsUrl", String(describing: translationsUrl))])
- }
- }
-
- public static func parse_langPackLanguage(_ reader: BufferReader) -> LangPackLanguage? {
- 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?
- if Int(_1!) & Int(1 << 1) != 0 {_5 = parseString(reader) }
- var _6: String?
- _6 = parseString(reader)
- var _7: Int32?
- _7 = reader.readInt32()
- var _8: Int32?
- _8 = reader.readInt32()
- var _9: String?
- _9 = parseString(reader)
- let _c1 = _1 != nil
- let _c2 = _2 != nil
- let _c3 = _3 != nil
- let _c4 = _4 != nil
- let _c5 = (Int(_1!) & Int(1 << 1) == 0) || _5 != nil
- let _c6 = _6 != nil
- let _c7 = _7 != nil
- let _c8 = _8 != nil
- let _c9 = _9 != nil
- if _c1 && _c2 && _c3 && _c4 && _c5 && _c6 && _c7 && _c8 && _c9 {
- return Api.LangPackLanguage.langPackLanguage(flags: _1!, name: _2!, nativeName: _3!, langCode: _4!, baseLangCode: _5, pluralCode: _6!, stringsCount: _7!, translatedCount: _8!, translationsUrl: _9!)
- }
- else {
- return nil
- }
- }
-
- }
-}
-public extension Api {
- enum LangPackString: TypeConstructorDescription {
- case langPackString(key: String, value: String)
- case langPackStringDeleted(key: String)
- case langPackStringPluralized(flags: Int32, key: String, zeroValue: String?, oneValue: String?, twoValue: String?, fewValue: String?, manyValue: String?, otherValue: String)
-
- public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
- switch self {
- case .langPackString(let key, let value):
- if boxed {
- buffer.appendInt32(-892239370)
- }
- serializeString(key, buffer: buffer, boxed: false)
- serializeString(value, buffer: buffer, boxed: false)
- break
- case .langPackStringDeleted(let key):
- if boxed {
- buffer.appendInt32(695856818)
- }
- serializeString(key, buffer: buffer, boxed: false)
- break
- case .langPackStringPluralized(let flags, let key, let zeroValue, let oneValue, let twoValue, let fewValue, let manyValue, let otherValue):
- if boxed {
- buffer.appendInt32(1816636575)
- }
- serializeInt32(flags, buffer: buffer, boxed: false)
- serializeString(key, buffer: buffer, boxed: false)
- if Int(flags) & Int(1 << 0) != 0 {serializeString(zeroValue!, buffer: buffer, boxed: false)}
- if Int(flags) & Int(1 << 1) != 0 {serializeString(oneValue!, buffer: buffer, boxed: false)}
- if Int(flags) & Int(1 << 2) != 0 {serializeString(twoValue!, buffer: buffer, boxed: false)}
- if Int(flags) & Int(1 << 3) != 0 {serializeString(fewValue!, buffer: buffer, boxed: false)}
- if Int(flags) & Int(1 << 4) != 0 {serializeString(manyValue!, buffer: buffer, boxed: false)}
- serializeString(otherValue, buffer: buffer, boxed: false)
- break
- }
- }
-
- public func descriptionFields() -> (String, [(String, Any)]) {
- switch self {
- case .langPackString(let key, let value):
- return ("langPackString", [("key", String(describing: key)), ("value", String(describing: value))])
- case .langPackStringDeleted(let key):
- return ("langPackStringDeleted", [("key", String(describing: key))])
- case .langPackStringPluralized(let flags, let key, let zeroValue, let oneValue, let twoValue, let fewValue, let manyValue, let otherValue):
- return ("langPackStringPluralized", [("flags", String(describing: flags)), ("key", String(describing: key)), ("zeroValue", String(describing: zeroValue)), ("oneValue", String(describing: oneValue)), ("twoValue", String(describing: twoValue)), ("fewValue", String(describing: fewValue)), ("manyValue", String(describing: manyValue)), ("otherValue", String(describing: otherValue))])
- }
- }
-
- public static func parse_langPackString(_ reader: BufferReader) -> LangPackString? {
- var _1: String?
- _1 = parseString(reader)
- var _2: String?
- _2 = parseString(reader)
- let _c1 = _1 != nil
- let _c2 = _2 != nil
- if _c1 && _c2 {
- return Api.LangPackString.langPackString(key: _1!, value: _2!)
- }
- else {
- return nil
- }
- }
- public static func parse_langPackStringDeleted(_ reader: BufferReader) -> LangPackString? {
- var _1: String?
- _1 = parseString(reader)
- let _c1 = _1 != nil
- if _c1 {
- return Api.LangPackString.langPackStringDeleted(key: _1!)
- }
- else {
- return nil
- }
- }
- public static func parse_langPackStringPluralized(_ reader: BufferReader) -> LangPackString? {
- var _1: Int32?
- _1 = reader.readInt32()
- var _2: String?
- _2 = parseString(reader)
- var _3: String?
- if Int(_1!) & Int(1 << 0) != 0 {_3 = parseString(reader) }
- var _4: String?
- if Int(_1!) & Int(1 << 1) != 0 {_4 = parseString(reader) }
- var _5: String?
- if Int(_1!) & Int(1 << 2) != 0 {_5 = parseString(reader) }
- var _6: String?
- if Int(_1!) & Int(1 << 3) != 0 {_6 = parseString(reader) }
- var _7: String?
- if Int(_1!) & Int(1 << 4) != 0 {_7 = parseString(reader) }
- var _8: String?
- _8 = parseString(reader)
- let _c1 = _1 != nil
- let _c2 = _2 != nil
- let _c3 = (Int(_1!) & Int(1 << 0) == 0) || _3 != nil
- let _c4 = (Int(_1!) & Int(1 << 1) == 0) || _4 != nil
- let _c5 = (Int(_1!) & Int(1 << 2) == 0) || _5 != nil
- let _c6 = (Int(_1!) & Int(1 << 3) == 0) || _6 != nil
- let _c7 = (Int(_1!) & Int(1 << 4) == 0) || _7 != nil
- let _c8 = _8 != nil
- if _c1 && _c2 && _c3 && _c4 && _c5 && _c6 && _c7 && _c8 {
- return Api.LangPackString.langPackStringPluralized(flags: _1!, key: _2!, zeroValue: _3, oneValue: _4, twoValue: _5, fewValue: _6, manyValue: _7, otherValue: _8!)
- }
- else {
- return nil
- }
- }
-
- }
-}
diff --git a/submodules/TelegramApi/Sources/Api11.swift b/submodules/TelegramApi/Sources/Api11.swift
index 47642963ed..5613ce9c91 100644
--- a/submodules/TelegramApi/Sources/Api11.swift
+++ b/submodules/TelegramApi/Sources/Api11.swift
@@ -1,3 +1,315 @@
+public extension Api {
+ enum KeyboardButtonRow: TypeConstructorDescription {
+ case keyboardButtonRow(buttons: [Api.KeyboardButton])
+
+ public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
+ switch self {
+ case .keyboardButtonRow(let buttons):
+ if boxed {
+ buffer.appendInt32(2002815875)
+ }
+ buffer.appendInt32(481674261)
+ buffer.appendInt32(Int32(buttons.count))
+ for item in buttons {
+ item.serialize(buffer, true)
+ }
+ break
+ }
+ }
+
+ public func descriptionFields() -> (String, [(String, Any)]) {
+ switch self {
+ case .keyboardButtonRow(let buttons):
+ return ("keyboardButtonRow", [("buttons", String(describing: buttons))])
+ }
+ }
+
+ public static func parse_keyboardButtonRow(_ reader: BufferReader) -> KeyboardButtonRow? {
+ var _1: [Api.KeyboardButton]?
+ if let _ = reader.readInt32() {
+ _1 = Api.parseVector(reader, elementSignature: 0, elementType: Api.KeyboardButton.self)
+ }
+ let _c1 = _1 != nil
+ if _c1 {
+ return Api.KeyboardButtonRow.keyboardButtonRow(buttons: _1!)
+ }
+ else {
+ return nil
+ }
+ }
+
+ }
+}
+public extension Api {
+ enum LabeledPrice: TypeConstructorDescription {
+ case labeledPrice(label: String, amount: Int64)
+
+ public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
+ switch self {
+ case .labeledPrice(let label, let amount):
+ if boxed {
+ buffer.appendInt32(-886477832)
+ }
+ serializeString(label, buffer: buffer, boxed: false)
+ serializeInt64(amount, buffer: buffer, boxed: false)
+ break
+ }
+ }
+
+ public func descriptionFields() -> (String, [(String, Any)]) {
+ switch self {
+ case .labeledPrice(let label, let amount):
+ return ("labeledPrice", [("label", String(describing: label)), ("amount", String(describing: amount))])
+ }
+ }
+
+ public static func parse_labeledPrice(_ reader: BufferReader) -> LabeledPrice? {
+ var _1: String?
+ _1 = parseString(reader)
+ var _2: Int64?
+ _2 = reader.readInt64()
+ let _c1 = _1 != nil
+ let _c2 = _2 != nil
+ if _c1 && _c2 {
+ return Api.LabeledPrice.labeledPrice(label: _1!, amount: _2!)
+ }
+ else {
+ return nil
+ }
+ }
+
+ }
+}
+public extension Api {
+ enum LangPackDifference: TypeConstructorDescription {
+ case langPackDifference(langCode: String, fromVersion: Int32, version: Int32, strings: [Api.LangPackString])
+
+ public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
+ switch self {
+ case .langPackDifference(let langCode, let fromVersion, let version, let strings):
+ if boxed {
+ buffer.appendInt32(-209337866)
+ }
+ serializeString(langCode, buffer: buffer, boxed: false)
+ serializeInt32(fromVersion, buffer: buffer, boxed: false)
+ serializeInt32(version, buffer: buffer, boxed: false)
+ buffer.appendInt32(481674261)
+ buffer.appendInt32(Int32(strings.count))
+ for item in strings {
+ item.serialize(buffer, true)
+ }
+ break
+ }
+ }
+
+ public func descriptionFields() -> (String, [(String, Any)]) {
+ switch self {
+ case .langPackDifference(let langCode, let fromVersion, let version, let strings):
+ return ("langPackDifference", [("langCode", String(describing: langCode)), ("fromVersion", String(describing: fromVersion)), ("version", String(describing: version)), ("strings", String(describing: strings))])
+ }
+ }
+
+ public static func parse_langPackDifference(_ reader: BufferReader) -> LangPackDifference? {
+ var _1: String?
+ _1 = parseString(reader)
+ var _2: Int32?
+ _2 = reader.readInt32()
+ var _3: Int32?
+ _3 = reader.readInt32()
+ var _4: [Api.LangPackString]?
+ if let _ = reader.readInt32() {
+ _4 = Api.parseVector(reader, elementSignature: 0, elementType: Api.LangPackString.self)
+ }
+ let _c1 = _1 != nil
+ let _c2 = _2 != nil
+ let _c3 = _3 != nil
+ let _c4 = _4 != nil
+ if _c1 && _c2 && _c3 && _c4 {
+ return Api.LangPackDifference.langPackDifference(langCode: _1!, fromVersion: _2!, version: _3!, strings: _4!)
+ }
+ else {
+ return nil
+ }
+ }
+
+ }
+}
+public extension Api {
+ enum LangPackLanguage: TypeConstructorDescription {
+ case langPackLanguage(flags: Int32, name: String, nativeName: String, langCode: String, baseLangCode: String?, pluralCode: String, stringsCount: Int32, translatedCount: Int32, translationsUrl: String)
+
+ public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
+ switch self {
+ case .langPackLanguage(let flags, let name, let nativeName, let langCode, let baseLangCode, let pluralCode, let stringsCount, let translatedCount, let translationsUrl):
+ if boxed {
+ buffer.appendInt32(-288727837)
+ }
+ serializeInt32(flags, buffer: buffer, boxed: false)
+ serializeString(name, buffer: buffer, boxed: false)
+ serializeString(nativeName, buffer: buffer, boxed: false)
+ serializeString(langCode, buffer: buffer, boxed: false)
+ if Int(flags) & Int(1 << 1) != 0 {serializeString(baseLangCode!, buffer: buffer, boxed: false)}
+ serializeString(pluralCode, buffer: buffer, boxed: false)
+ serializeInt32(stringsCount, buffer: buffer, boxed: false)
+ serializeInt32(translatedCount, buffer: buffer, boxed: false)
+ serializeString(translationsUrl, buffer: buffer, boxed: false)
+ break
+ }
+ }
+
+ public func descriptionFields() -> (String, [(String, Any)]) {
+ switch self {
+ case .langPackLanguage(let flags, let name, let nativeName, let langCode, let baseLangCode, let pluralCode, let stringsCount, let translatedCount, let translationsUrl):
+ return ("langPackLanguage", [("flags", String(describing: flags)), ("name", String(describing: name)), ("nativeName", String(describing: nativeName)), ("langCode", String(describing: langCode)), ("baseLangCode", String(describing: baseLangCode)), ("pluralCode", String(describing: pluralCode)), ("stringsCount", String(describing: stringsCount)), ("translatedCount", String(describing: translatedCount)), ("translationsUrl", String(describing: translationsUrl))])
+ }
+ }
+
+ public static func parse_langPackLanguage(_ reader: BufferReader) -> LangPackLanguage? {
+ 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?
+ if Int(_1!) & Int(1 << 1) != 0 {_5 = parseString(reader) }
+ var _6: String?
+ _6 = parseString(reader)
+ var _7: Int32?
+ _7 = reader.readInt32()
+ var _8: Int32?
+ _8 = reader.readInt32()
+ var _9: String?
+ _9 = parseString(reader)
+ let _c1 = _1 != nil
+ let _c2 = _2 != nil
+ let _c3 = _3 != nil
+ let _c4 = _4 != nil
+ let _c5 = (Int(_1!) & Int(1 << 1) == 0) || _5 != nil
+ let _c6 = _6 != nil
+ let _c7 = _7 != nil
+ let _c8 = _8 != nil
+ let _c9 = _9 != nil
+ if _c1 && _c2 && _c3 && _c4 && _c5 && _c6 && _c7 && _c8 && _c9 {
+ return Api.LangPackLanguage.langPackLanguage(flags: _1!, name: _2!, nativeName: _3!, langCode: _4!, baseLangCode: _5, pluralCode: _6!, stringsCount: _7!, translatedCount: _8!, translationsUrl: _9!)
+ }
+ else {
+ return nil
+ }
+ }
+
+ }
+}
+public extension Api {
+ enum LangPackString: TypeConstructorDescription {
+ case langPackString(key: String, value: String)
+ case langPackStringDeleted(key: String)
+ case langPackStringPluralized(flags: Int32, key: String, zeroValue: String?, oneValue: String?, twoValue: String?, fewValue: String?, manyValue: String?, otherValue: String)
+
+ public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
+ switch self {
+ case .langPackString(let key, let value):
+ if boxed {
+ buffer.appendInt32(-892239370)
+ }
+ serializeString(key, buffer: buffer, boxed: false)
+ serializeString(value, buffer: buffer, boxed: false)
+ break
+ case .langPackStringDeleted(let key):
+ if boxed {
+ buffer.appendInt32(695856818)
+ }
+ serializeString(key, buffer: buffer, boxed: false)
+ break
+ case .langPackStringPluralized(let flags, let key, let zeroValue, let oneValue, let twoValue, let fewValue, let manyValue, let otherValue):
+ if boxed {
+ buffer.appendInt32(1816636575)
+ }
+ serializeInt32(flags, buffer: buffer, boxed: false)
+ serializeString(key, buffer: buffer, boxed: false)
+ if Int(flags) & Int(1 << 0) != 0 {serializeString(zeroValue!, buffer: buffer, boxed: false)}
+ if Int(flags) & Int(1 << 1) != 0 {serializeString(oneValue!, buffer: buffer, boxed: false)}
+ if Int(flags) & Int(1 << 2) != 0 {serializeString(twoValue!, buffer: buffer, boxed: false)}
+ if Int(flags) & Int(1 << 3) != 0 {serializeString(fewValue!, buffer: buffer, boxed: false)}
+ if Int(flags) & Int(1 << 4) != 0 {serializeString(manyValue!, buffer: buffer, boxed: false)}
+ serializeString(otherValue, buffer: buffer, boxed: false)
+ break
+ }
+ }
+
+ public func descriptionFields() -> (String, [(String, Any)]) {
+ switch self {
+ case .langPackString(let key, let value):
+ return ("langPackString", [("key", String(describing: key)), ("value", String(describing: value))])
+ case .langPackStringDeleted(let key):
+ return ("langPackStringDeleted", [("key", String(describing: key))])
+ case .langPackStringPluralized(let flags, let key, let zeroValue, let oneValue, let twoValue, let fewValue, let manyValue, let otherValue):
+ return ("langPackStringPluralized", [("flags", String(describing: flags)), ("key", String(describing: key)), ("zeroValue", String(describing: zeroValue)), ("oneValue", String(describing: oneValue)), ("twoValue", String(describing: twoValue)), ("fewValue", String(describing: fewValue)), ("manyValue", String(describing: manyValue)), ("otherValue", String(describing: otherValue))])
+ }
+ }
+
+ public static func parse_langPackString(_ reader: BufferReader) -> LangPackString? {
+ var _1: String?
+ _1 = parseString(reader)
+ var _2: String?
+ _2 = parseString(reader)
+ let _c1 = _1 != nil
+ let _c2 = _2 != nil
+ if _c1 && _c2 {
+ return Api.LangPackString.langPackString(key: _1!, value: _2!)
+ }
+ else {
+ return nil
+ }
+ }
+ public static func parse_langPackStringDeleted(_ reader: BufferReader) -> LangPackString? {
+ var _1: String?
+ _1 = parseString(reader)
+ let _c1 = _1 != nil
+ if _c1 {
+ return Api.LangPackString.langPackStringDeleted(key: _1!)
+ }
+ else {
+ return nil
+ }
+ }
+ public static func parse_langPackStringPluralized(_ reader: BufferReader) -> LangPackString? {
+ var _1: Int32?
+ _1 = reader.readInt32()
+ var _2: String?
+ _2 = parseString(reader)
+ var _3: String?
+ if Int(_1!) & Int(1 << 0) != 0 {_3 = parseString(reader) }
+ var _4: String?
+ if Int(_1!) & Int(1 << 1) != 0 {_4 = parseString(reader) }
+ var _5: String?
+ if Int(_1!) & Int(1 << 2) != 0 {_5 = parseString(reader) }
+ var _6: String?
+ if Int(_1!) & Int(1 << 3) != 0 {_6 = parseString(reader) }
+ var _7: String?
+ if Int(_1!) & Int(1 << 4) != 0 {_7 = parseString(reader) }
+ var _8: String?
+ _8 = parseString(reader)
+ let _c1 = _1 != nil
+ let _c2 = _2 != nil
+ let _c3 = (Int(_1!) & Int(1 << 0) == 0) || _3 != nil
+ let _c4 = (Int(_1!) & Int(1 << 1) == 0) || _4 != nil
+ let _c5 = (Int(_1!) & Int(1 << 2) == 0) || _5 != nil
+ let _c6 = (Int(_1!) & Int(1 << 3) == 0) || _6 != nil
+ let _c7 = (Int(_1!) & Int(1 << 4) == 0) || _7 != nil
+ let _c8 = _8 != nil
+ if _c1 && _c2 && _c3 && _c4 && _c5 && _c6 && _c7 && _c8 {
+ return Api.LangPackString.langPackStringPluralized(flags: _1!, key: _2!, zeroValue: _3, oneValue: _4, twoValue: _5, fewValue: _6, manyValue: _7, otherValue: _8!)
+ }
+ else {
+ return nil
+ }
+ }
+
+ }
+}
public extension Api {
enum MaskCoords: TypeConstructorDescription {
case maskCoords(n: Int32, x: Double, y: Double, zoom: Double)
diff --git a/submodules/TelegramApi/Sources/Api22.swift b/submodules/TelegramApi/Sources/Api22.swift
index bcde2a9b8b..412c26b6e3 100644
--- a/submodules/TelegramApi/Sources/Api22.swift
+++ b/submodules/TelegramApi/Sources/Api22.swift
@@ -345,14 +345,76 @@ public extension Api.account {
}
}
public extension Api.account {
- enum Password: TypeConstructorDescription {
- case password(flags: Int32, currentAlgo: Api.PasswordKdfAlgo?, srpB: Buffer?, srpId: Int64?, hint: String?, emailUnconfirmedPattern: String?, newAlgo: Api.PasswordKdfAlgo, newSecureAlgo: Api.SecurePasswordKdfAlgo, secureRandom: Buffer, pendingResetDate: Int32?)
+ enum EmailVerified: TypeConstructorDescription {
+ case emailVerified(email: String)
+ case emailVerifiedLogin(email: String, sentCode: Api.auth.SentCode)
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
switch self {
- case .password(let flags, let currentAlgo, let srpB, let srpId, let hint, let emailUnconfirmedPattern, let newAlgo, let newSecureAlgo, let secureRandom, let pendingResetDate):
+ case .emailVerified(let email):
if boxed {
- buffer.appendInt32(408623183)
+ buffer.appendInt32(731303195)
+ }
+ serializeString(email, buffer: buffer, boxed: false)
+ break
+ case .emailVerifiedLogin(let email, let sentCode):
+ if boxed {
+ buffer.appendInt32(-507835039)
+ }
+ serializeString(email, buffer: buffer, boxed: false)
+ sentCode.serialize(buffer, true)
+ break
+ }
+ }
+
+ public func descriptionFields() -> (String, [(String, Any)]) {
+ switch self {
+ case .emailVerified(let email):
+ return ("emailVerified", [("email", String(describing: email))])
+ case .emailVerifiedLogin(let email, let sentCode):
+ return ("emailVerifiedLogin", [("email", String(describing: email)), ("sentCode", String(describing: sentCode))])
+ }
+ }
+
+ public static func parse_emailVerified(_ reader: BufferReader) -> EmailVerified? {
+ var _1: String?
+ _1 = parseString(reader)
+ let _c1 = _1 != nil
+ if _c1 {
+ return Api.account.EmailVerified.emailVerified(email: _1!)
+ }
+ else {
+ return nil
+ }
+ }
+ public static func parse_emailVerifiedLogin(_ reader: BufferReader) -> EmailVerified? {
+ var _1: String?
+ _1 = parseString(reader)
+ var _2: Api.auth.SentCode?
+ if let signature = reader.readInt32() {
+ _2 = Api.parse(reader, signature: signature) as? Api.auth.SentCode
+ }
+ let _c1 = _1 != nil
+ let _c2 = _2 != nil
+ if _c1 && _c2 {
+ return Api.account.EmailVerified.emailVerifiedLogin(email: _1!, sentCode: _2!)
+ }
+ else {
+ return nil
+ }
+ }
+
+ }
+}
+public extension Api.account {
+ enum Password: TypeConstructorDescription {
+ case password(flags: Int32, currentAlgo: Api.PasswordKdfAlgo?, srpB: Buffer?, srpId: Int64?, hint: String?, emailUnconfirmedPattern: String?, newAlgo: Api.PasswordKdfAlgo, newSecureAlgo: Api.SecurePasswordKdfAlgo, secureRandom: Buffer, pendingResetDate: Int32?, loginEmailPattern: String?)
+
+ public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
+ switch self {
+ case .password(let flags, let currentAlgo, let srpB, let srpId, let hint, let emailUnconfirmedPattern, let newAlgo, let newSecureAlgo, let secureRandom, let pendingResetDate, let loginEmailPattern):
+ if boxed {
+ buffer.appendInt32(-1787080453)
}
serializeInt32(flags, buffer: buffer, boxed: false)
if Int(flags) & Int(1 << 2) != 0 {currentAlgo!.serialize(buffer, true)}
@@ -364,14 +426,15 @@ public extension Api.account {
newSecureAlgo.serialize(buffer, true)
serializeBytes(secureRandom, buffer: buffer, boxed: false)
if Int(flags) & Int(1 << 5) != 0 {serializeInt32(pendingResetDate!, buffer: buffer, boxed: false)}
+ if Int(flags) & Int(1 << 6) != 0 {serializeString(loginEmailPattern!, buffer: buffer, boxed: false)}
break
}
}
public func descriptionFields() -> (String, [(String, Any)]) {
switch self {
- case .password(let flags, let currentAlgo, let srpB, let srpId, let hint, let emailUnconfirmedPattern, let newAlgo, let newSecureAlgo, let secureRandom, let pendingResetDate):
- return ("password", [("flags", String(describing: flags)), ("currentAlgo", String(describing: currentAlgo)), ("srpB", String(describing: srpB)), ("srpId", String(describing: srpId)), ("hint", String(describing: hint)), ("emailUnconfirmedPattern", String(describing: emailUnconfirmedPattern)), ("newAlgo", String(describing: newAlgo)), ("newSecureAlgo", String(describing: newSecureAlgo)), ("secureRandom", String(describing: secureRandom)), ("pendingResetDate", String(describing: pendingResetDate))])
+ case .password(let flags, let currentAlgo, let srpB, let srpId, let hint, let emailUnconfirmedPattern, let newAlgo, let newSecureAlgo, let secureRandom, let pendingResetDate, let loginEmailPattern):
+ return ("password", [("flags", String(describing: flags)), ("currentAlgo", String(describing: currentAlgo)), ("srpB", String(describing: srpB)), ("srpId", String(describing: srpId)), ("hint", String(describing: hint)), ("emailUnconfirmedPattern", String(describing: emailUnconfirmedPattern)), ("newAlgo", String(describing: newAlgo)), ("newSecureAlgo", String(describing: newSecureAlgo)), ("secureRandom", String(describing: secureRandom)), ("pendingResetDate", String(describing: pendingResetDate)), ("loginEmailPattern", String(describing: loginEmailPattern))])
}
}
@@ -402,6 +465,8 @@ public extension Api.account {
_9 = parseBytes(reader)
var _10: Int32?
if Int(_1!) & Int(1 << 5) != 0 {_10 = reader.readInt32() }
+ var _11: String?
+ if Int(_1!) & Int(1 << 6) != 0 {_11 = parseString(reader) }
let _c1 = _1 != nil
let _c2 = (Int(_1!) & Int(1 << 2) == 0) || _2 != nil
let _c3 = (Int(_1!) & Int(1 << 2) == 0) || _3 != nil
@@ -412,8 +477,9 @@ public extension Api.account {
let _c8 = _8 != nil
let _c9 = _9 != nil
let _c10 = (Int(_1!) & Int(1 << 5) == 0) || _10 != nil
- if _c1 && _c2 && _c3 && _c4 && _c5 && _c6 && _c7 && _c8 && _c9 && _c10 {
- return Api.account.Password.password(flags: _1!, currentAlgo: _2, srpB: _3, srpId: _4, hint: _5, emailUnconfirmedPattern: _6, newAlgo: _7!, newSecureAlgo: _8!, secureRandom: _9!, pendingResetDate: _10)
+ let _c11 = (Int(_1!) & Int(1 << 6) == 0) || _11 != nil
+ if _c1 && _c2 && _c3 && _c4 && _c5 && _c6 && _c7 && _c8 && _c9 && _c10 && _c11 {
+ return Api.account.Password.password(flags: _1!, currentAlgo: _2, srpB: _3, srpId: _4, hint: _5, emailUnconfirmedPattern: _6, newAlgo: _7!, newSecureAlgo: _8!, secureRandom: _9!, pendingResetDate: _10, loginEmailPattern: _11)
}
else {
return nil
diff --git a/submodules/TelegramApi/Sources/Api23.swift b/submodules/TelegramApi/Sources/Api23.swift
index b9a26d9242..69890a875c 100644
--- a/submodules/TelegramApi/Sources/Api23.swift
+++ b/submodules/TelegramApi/Sources/Api23.swift
@@ -260,8 +260,10 @@ public extension Api.auth {
enum SentCodeType: TypeConstructorDescription {
case sentCodeTypeApp(length: Int32)
case sentCodeTypeCall(length: Int32)
+ case sentCodeTypeEmailCode(flags: Int32, emailPattern: String, length: Int32, nextPhoneLoginDate: Int32?)
case sentCodeTypeFlashCall(pattern: String)
case sentCodeTypeMissedCall(prefix: String, length: Int32)
+ case sentCodeTypeSetUpEmailRequired(flags: Int32)
case sentCodeTypeSms(length: Int32)
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
@@ -278,6 +280,15 @@ public extension Api.auth {
}
serializeInt32(length, buffer: buffer, boxed: false)
break
+ case .sentCodeTypeEmailCode(let flags, let emailPattern, let length, let nextPhoneLoginDate):
+ if boxed {
+ buffer.appendInt32(1511364673)
+ }
+ serializeInt32(flags, buffer: buffer, boxed: false)
+ serializeString(emailPattern, buffer: buffer, boxed: false)
+ serializeInt32(length, buffer: buffer, boxed: false)
+ if Int(flags) & Int(1 << 2) != 0 {serializeInt32(nextPhoneLoginDate!, buffer: buffer, boxed: false)}
+ break
case .sentCodeTypeFlashCall(let pattern):
if boxed {
buffer.appendInt32(-1425815847)
@@ -291,6 +302,12 @@ public extension Api.auth {
serializeString(prefix, buffer: buffer, boxed: false)
serializeInt32(length, buffer: buffer, boxed: false)
break
+ case .sentCodeTypeSetUpEmailRequired(let flags):
+ if boxed {
+ buffer.appendInt32(-1521934870)
+ }
+ serializeInt32(flags, buffer: buffer, boxed: false)
+ break
case .sentCodeTypeSms(let length):
if boxed {
buffer.appendInt32(-1073693790)
@@ -306,10 +323,14 @@ public extension Api.auth {
return ("sentCodeTypeApp", [("length", String(describing: length))])
case .sentCodeTypeCall(let length):
return ("sentCodeTypeCall", [("length", String(describing: length))])
+ case .sentCodeTypeEmailCode(let flags, let emailPattern, let length, let nextPhoneLoginDate):
+ return ("sentCodeTypeEmailCode", [("flags", String(describing: flags)), ("emailPattern", String(describing: emailPattern)), ("length", String(describing: length)), ("nextPhoneLoginDate", String(describing: nextPhoneLoginDate))])
case .sentCodeTypeFlashCall(let pattern):
return ("sentCodeTypeFlashCall", [("pattern", String(describing: pattern))])
case .sentCodeTypeMissedCall(let prefix, let length):
return ("sentCodeTypeMissedCall", [("prefix", String(describing: prefix)), ("length", String(describing: length))])
+ case .sentCodeTypeSetUpEmailRequired(let flags):
+ return ("sentCodeTypeSetUpEmailRequired", [("flags", String(describing: flags))])
case .sentCodeTypeSms(let length):
return ("sentCodeTypeSms", [("length", String(describing: length))])
}
@@ -337,6 +358,26 @@ public extension Api.auth {
return nil
}
}
+ public static func parse_sentCodeTypeEmailCode(_ reader: BufferReader) -> SentCodeType? {
+ var _1: Int32?
+ _1 = reader.readInt32()
+ var _2: String?
+ _2 = parseString(reader)
+ var _3: Int32?
+ _3 = reader.readInt32()
+ var _4: Int32?
+ if Int(_1!) & Int(1 << 2) != 0 {_4 = reader.readInt32() }
+ let _c1 = _1 != nil
+ let _c2 = _2 != nil
+ let _c3 = _3 != nil
+ let _c4 = (Int(_1!) & Int(1 << 2) == 0) || _4 != nil
+ if _c1 && _c2 && _c3 && _c4 {
+ return Api.auth.SentCodeType.sentCodeTypeEmailCode(flags: _1!, emailPattern: _2!, length: _3!, nextPhoneLoginDate: _4)
+ }
+ else {
+ return nil
+ }
+ }
public static func parse_sentCodeTypeFlashCall(_ reader: BufferReader) -> SentCodeType? {
var _1: String?
_1 = parseString(reader)
@@ -362,6 +403,17 @@ public extension Api.auth {
return nil
}
}
+ public static func parse_sentCodeTypeSetUpEmailRequired(_ reader: BufferReader) -> SentCodeType? {
+ var _1: Int32?
+ _1 = reader.readInt32()
+ let _c1 = _1 != nil
+ if _c1 {
+ return Api.auth.SentCodeType.sentCodeTypeSetUpEmailRequired(flags: _1!)
+ }
+ else {
+ return nil
+ }
+ }
public static func parse_sentCodeTypeSms(_ reader: BufferReader) -> SentCodeType? {
var _1: Int32?
_1 = reader.readInt32()
@@ -1248,61 +1300,3 @@ public extension Api.help {
}
}
-public extension Api.help {
- enum Country: TypeConstructorDescription {
- case country(flags: Int32, iso2: String, defaultName: String, name: String?, countryCodes: [Api.help.CountryCode])
-
- public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
- switch self {
- case .country(let flags, let iso2, let defaultName, let name, let countryCodes):
- if boxed {
- buffer.appendInt32(-1014526429)
- }
- serializeInt32(flags, buffer: buffer, boxed: false)
- serializeString(iso2, buffer: buffer, boxed: false)
- serializeString(defaultName, buffer: buffer, boxed: false)
- if Int(flags) & Int(1 << 1) != 0 {serializeString(name!, buffer: buffer, boxed: false)}
- buffer.appendInt32(481674261)
- buffer.appendInt32(Int32(countryCodes.count))
- for item in countryCodes {
- item.serialize(buffer, true)
- }
- break
- }
- }
-
- public func descriptionFields() -> (String, [(String, Any)]) {
- switch self {
- case .country(let flags, let iso2, let defaultName, let name, let countryCodes):
- return ("country", [("flags", String(describing: flags)), ("iso2", String(describing: iso2)), ("defaultName", String(describing: defaultName)), ("name", String(describing: name)), ("countryCodes", String(describing: countryCodes))])
- }
- }
-
- public static func parse_country(_ reader: BufferReader) -> Country? {
- var _1: Int32?
- _1 = reader.readInt32()
- var _2: String?
- _2 = parseString(reader)
- var _3: String?
- _3 = parseString(reader)
- var _4: String?
- if Int(_1!) & Int(1 << 1) != 0 {_4 = parseString(reader) }
- var _5: [Api.help.CountryCode]?
- if let _ = reader.readInt32() {
- _5 = Api.parseVector(reader, elementSignature: 0, elementType: Api.help.CountryCode.self)
- }
- let _c1 = _1 != nil
- let _c2 = _2 != nil
- let _c3 = _3 != nil
- let _c4 = (Int(_1!) & Int(1 << 1) == 0) || _4 != nil
- let _c5 = _5 != nil
- if _c1 && _c2 && _c3 && _c4 && _c5 {
- return Api.help.Country.country(flags: _1!, iso2: _2!, defaultName: _3!, name: _4, countryCodes: _5!)
- }
- else {
- return nil
- }
- }
-
- }
-}
diff --git a/submodules/TelegramApi/Sources/Api24.swift b/submodules/TelegramApi/Sources/Api24.swift
index 706f76027d..c7ac3a632a 100644
--- a/submodules/TelegramApi/Sources/Api24.swift
+++ b/submodules/TelegramApi/Sources/Api24.swift
@@ -1,3 +1,61 @@
+public extension Api.help {
+ enum Country: TypeConstructorDescription {
+ case country(flags: Int32, iso2: String, defaultName: String, name: String?, countryCodes: [Api.help.CountryCode])
+
+ public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
+ switch self {
+ case .country(let flags, let iso2, let defaultName, let name, let countryCodes):
+ if boxed {
+ buffer.appendInt32(-1014526429)
+ }
+ serializeInt32(flags, buffer: buffer, boxed: false)
+ serializeString(iso2, buffer: buffer, boxed: false)
+ serializeString(defaultName, buffer: buffer, boxed: false)
+ if Int(flags) & Int(1 << 1) != 0 {serializeString(name!, buffer: buffer, boxed: false)}
+ buffer.appendInt32(481674261)
+ buffer.appendInt32(Int32(countryCodes.count))
+ for item in countryCodes {
+ item.serialize(buffer, true)
+ }
+ break
+ }
+ }
+
+ public func descriptionFields() -> (String, [(String, Any)]) {
+ switch self {
+ case .country(let flags, let iso2, let defaultName, let name, let countryCodes):
+ return ("country", [("flags", String(describing: flags)), ("iso2", String(describing: iso2)), ("defaultName", String(describing: defaultName)), ("name", String(describing: name)), ("countryCodes", String(describing: countryCodes))])
+ }
+ }
+
+ public static func parse_country(_ reader: BufferReader) -> Country? {
+ var _1: Int32?
+ _1 = reader.readInt32()
+ var _2: String?
+ _2 = parseString(reader)
+ var _3: String?
+ _3 = parseString(reader)
+ var _4: String?
+ if Int(_1!) & Int(1 << 1) != 0 {_4 = parseString(reader) }
+ var _5: [Api.help.CountryCode]?
+ if let _ = reader.readInt32() {
+ _5 = Api.parseVector(reader, elementSignature: 0, elementType: Api.help.CountryCode.self)
+ }
+ let _c1 = _1 != nil
+ let _c2 = _2 != nil
+ let _c3 = _3 != nil
+ let _c4 = (Int(_1!) & Int(1 << 1) == 0) || _4 != nil
+ let _c5 = _5 != nil
+ if _c1 && _c2 && _c3 && _c4 && _c5 {
+ return Api.help.Country.country(flags: _1!, iso2: _2!, defaultName: _3!, name: _4, countryCodes: _5!)
+ }
+ else {
+ return nil
+ }
+ }
+
+ }
+}
public extension Api.help {
enum CountryCode: TypeConstructorDescription {
case countryCode(flags: Int32, countryCode: String, prefixes: [String]?, patterns: [String]?)
diff --git a/submodules/TelegramApi/Sources/Api28.swift b/submodules/TelegramApi/Sources/Api28.swift
index 0e30946fd1..be3f78a9ea 100644
--- a/submodules/TelegramApi/Sources/Api28.swift
+++ b/submodules/TelegramApi/Sources/Api28.swift
@@ -894,11 +894,12 @@ public extension Api.functions.account {
}
}
public extension Api.functions.account {
- static func sendVerifyEmailCode(email: String) -> (FunctionDescription, Buffer, DeserializeFunctionResponse) {
+ static func sendVerifyEmailCode(purpose: Api.EmailVerifyPurpose, email: String) -> (FunctionDescription, Buffer, DeserializeFunctionResponse) {
let buffer = Buffer()
- buffer.appendInt32(1880182943)
+ buffer.appendInt32(-1730136133)
+ purpose.serialize(buffer, true)
serializeString(email, buffer: buffer, boxed: false)
- return (FunctionDescription(name: "account.sendVerifyEmailCode", parameters: [("email", String(describing: email))]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.account.SentEmailCode? in
+ return (FunctionDescription(name: "account.sendVerifyEmailCode", parameters: [("purpose", String(describing: purpose)), ("email", String(describing: email))]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.account.SentEmailCode? in
let reader = BufferReader(buffer)
var result: Api.account.SentEmailCode?
if let signature = reader.readInt32() {
@@ -1229,16 +1230,16 @@ public extension Api.functions.account {
}
}
public extension Api.functions.account {
- static func verifyEmail(email: String, code: String) -> (FunctionDescription, Buffer, DeserializeFunctionResponse) {
+ static func verifyEmail(purpose: Api.EmailVerifyPurpose, verification: Api.EmailVerification) -> (FunctionDescription, Buffer, DeserializeFunctionResponse) {
let buffer = Buffer()
- buffer.appendInt32(-323339813)
- serializeString(email, buffer: buffer, boxed: false)
- serializeString(code, buffer: buffer, boxed: false)
- return (FunctionDescription(name: "account.verifyEmail", parameters: [("email", String(describing: email)), ("code", String(describing: code))]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.Bool? in
+ buffer.appendInt32(53322959)
+ purpose.serialize(buffer, true)
+ verification.serialize(buffer, true)
+ return (FunctionDescription(name: "account.verifyEmail", parameters: [("purpose", String(describing: purpose)), ("verification", String(describing: verification))]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.account.EmailVerified? in
let reader = BufferReader(buffer)
- var result: Api.Bool?
+ var result: Api.account.EmailVerified?
if let signature = reader.readInt32() {
- result = Api.parse(reader, signature: signature) as? Api.Bool
+ result = Api.parse(reader, signature: signature) as? Api.account.EmailVerified
}
return result
})
@@ -1541,13 +1542,15 @@ public extension Api.functions.auth {
}
}
public extension Api.functions.auth {
- static func signIn(phoneNumber: String, phoneCodeHash: String, phoneCode: String) -> (FunctionDescription, Buffer, DeserializeFunctionResponse) {
+ static func signIn(flags: Int32, phoneNumber: String, phoneCodeHash: String, phoneCode: String?, emailVerification: Api.EmailVerification?) -> (FunctionDescription, Buffer, DeserializeFunctionResponse) {
let buffer = Buffer()
- buffer.appendInt32(-1126886015)
+ buffer.appendInt32(-1923962543)
+ serializeInt32(flags, buffer: buffer, boxed: false)
serializeString(phoneNumber, buffer: buffer, boxed: false)
serializeString(phoneCodeHash, buffer: buffer, boxed: false)
- serializeString(phoneCode, buffer: buffer, boxed: false)
- return (FunctionDescription(name: "auth.signIn", parameters: [("phoneNumber", String(describing: phoneNumber)), ("phoneCodeHash", String(describing: phoneCodeHash)), ("phoneCode", String(describing: phoneCode))]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.auth.Authorization? in
+ if Int(flags) & Int(1 << 0) != 0 {serializeString(phoneCode!, buffer: buffer, boxed: false)}
+ if Int(flags) & Int(1 << 1) != 0 {emailVerification!.serialize(buffer, true)}
+ return (FunctionDescription(name: "auth.signIn", parameters: [("flags", String(describing: flags)), ("phoneNumber", String(describing: phoneNumber)), ("phoneCodeHash", String(describing: phoneCodeHash)), ("phoneCode", String(describing: phoneCode)), ("emailVerification", String(describing: emailVerification))]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.auth.Authorization? in
let reader = BufferReader(buffer)
var result: Api.auth.Authorization?
if let signature = reader.readInt32() {
diff --git a/submodules/TelegramApi/Sources/Api5.swift b/submodules/TelegramApi/Sources/Api5.swift
index aaf674d557..c139bffa03 100644
--- a/submodules/TelegramApi/Sources/Api5.swift
+++ b/submodules/TelegramApi/Sources/Api5.swift
@@ -80,6 +80,146 @@ public extension Api {
}
}
+public extension Api {
+ enum EmailVerification: TypeConstructorDescription {
+ case emailVerificationApple(token: String)
+ case emailVerificationCode(code: String)
+ case emailVerificationGoogle(token: String)
+
+ public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
+ switch self {
+ case .emailVerificationApple(let token):
+ if boxed {
+ buffer.appendInt32(-1764723459)
+ }
+ serializeString(token, buffer: buffer, boxed: false)
+ break
+ case .emailVerificationCode(let code):
+ if boxed {
+ buffer.appendInt32(-1842457175)
+ }
+ serializeString(code, buffer: buffer, boxed: false)
+ break
+ case .emailVerificationGoogle(let token):
+ if boxed {
+ buffer.appendInt32(-611279166)
+ }
+ serializeString(token, buffer: buffer, boxed: false)
+ break
+ }
+ }
+
+ public func descriptionFields() -> (String, [(String, Any)]) {
+ switch self {
+ case .emailVerificationApple(let token):
+ return ("emailVerificationApple", [("token", String(describing: token))])
+ case .emailVerificationCode(let code):
+ return ("emailVerificationCode", [("code", String(describing: code))])
+ case .emailVerificationGoogle(let token):
+ return ("emailVerificationGoogle", [("token", String(describing: token))])
+ }
+ }
+
+ public static func parse_emailVerificationApple(_ reader: BufferReader) -> EmailVerification? {
+ var _1: String?
+ _1 = parseString(reader)
+ let _c1 = _1 != nil
+ if _c1 {
+ return Api.EmailVerification.emailVerificationApple(token: _1!)
+ }
+ else {
+ return nil
+ }
+ }
+ public static func parse_emailVerificationCode(_ reader: BufferReader) -> EmailVerification? {
+ var _1: String?
+ _1 = parseString(reader)
+ let _c1 = _1 != nil
+ if _c1 {
+ return Api.EmailVerification.emailVerificationCode(code: _1!)
+ }
+ else {
+ return nil
+ }
+ }
+ public static func parse_emailVerificationGoogle(_ reader: BufferReader) -> EmailVerification? {
+ var _1: String?
+ _1 = parseString(reader)
+ let _c1 = _1 != nil
+ if _c1 {
+ return Api.EmailVerification.emailVerificationGoogle(token: _1!)
+ }
+ else {
+ return nil
+ }
+ }
+
+ }
+}
+public extension Api {
+ enum EmailVerifyPurpose: TypeConstructorDescription {
+ case emailVerifyPurposeLoginChange
+ case emailVerifyPurposeLoginSetup(phoneNumber: String, phoneCodeHash: String)
+ case emailVerifyPurposePassport
+
+ public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
+ switch self {
+ case .emailVerifyPurposeLoginChange:
+ if boxed {
+ buffer.appendInt32(1383932651)
+ }
+
+ break
+ case .emailVerifyPurposeLoginSetup(let phoneNumber, let phoneCodeHash):
+ if boxed {
+ buffer.appendInt32(1128644211)
+ }
+ serializeString(phoneNumber, buffer: buffer, boxed: false)
+ serializeString(phoneCodeHash, buffer: buffer, boxed: false)
+ break
+ case .emailVerifyPurposePassport:
+ if boxed {
+ buffer.appendInt32(-1141565819)
+ }
+
+ break
+ }
+ }
+
+ public func descriptionFields() -> (String, [(String, Any)]) {
+ switch self {
+ case .emailVerifyPurposeLoginChange:
+ return ("emailVerifyPurposeLoginChange", [])
+ case .emailVerifyPurposeLoginSetup(let phoneNumber, let phoneCodeHash):
+ return ("emailVerifyPurposeLoginSetup", [("phoneNumber", String(describing: phoneNumber)), ("phoneCodeHash", String(describing: phoneCodeHash))])
+ case .emailVerifyPurposePassport:
+ return ("emailVerifyPurposePassport", [])
+ }
+ }
+
+ public static func parse_emailVerifyPurposeLoginChange(_ reader: BufferReader) -> EmailVerifyPurpose? {
+ return Api.EmailVerifyPurpose.emailVerifyPurposeLoginChange
+ }
+ public static func parse_emailVerifyPurposeLoginSetup(_ reader: BufferReader) -> EmailVerifyPurpose? {
+ var _1: String?
+ _1 = parseString(reader)
+ var _2: String?
+ _2 = parseString(reader)
+ let _c1 = _1 != nil
+ let _c2 = _2 != nil
+ if _c1 && _c2 {
+ return Api.EmailVerifyPurpose.emailVerifyPurposeLoginSetup(phoneNumber: _1!, phoneCodeHash: _2!)
+ }
+ else {
+ return nil
+ }
+ }
+ public static func parse_emailVerifyPurposePassport(_ reader: BufferReader) -> EmailVerifyPurpose? {
+ return Api.EmailVerifyPurpose.emailVerifyPurposePassport
+ }
+
+ }
+}
public extension Api {
enum EmojiKeyword: TypeConstructorDescription {
case emojiKeyword(keyword: String, emoticons: [String])
@@ -1060,281 +1200,3 @@ public extension Api {
}
}
-public extension Api {
- enum GlobalPrivacySettings: TypeConstructorDescription {
- case globalPrivacySettings(flags: Int32, archiveAndMuteNewNoncontactPeers: Api.Bool?)
-
- public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
- switch self {
- case .globalPrivacySettings(let flags, let archiveAndMuteNewNoncontactPeers):
- if boxed {
- buffer.appendInt32(-1096616924)
- }
- serializeInt32(flags, buffer: buffer, boxed: false)
- if Int(flags) & Int(1 << 0) != 0 {archiveAndMuteNewNoncontactPeers!.serialize(buffer, true)}
- break
- }
- }
-
- public func descriptionFields() -> (String, [(String, Any)]) {
- switch self {
- case .globalPrivacySettings(let flags, let archiveAndMuteNewNoncontactPeers):
- return ("globalPrivacySettings", [("flags", String(describing: flags)), ("archiveAndMuteNewNoncontactPeers", String(describing: archiveAndMuteNewNoncontactPeers))])
- }
- }
-
- public static func parse_globalPrivacySettings(_ reader: BufferReader) -> GlobalPrivacySettings? {
- var _1: Int32?
- _1 = reader.readInt32()
- var _2: Api.Bool?
- if Int(_1!) & Int(1 << 0) != 0 {if let signature = reader.readInt32() {
- _2 = Api.parse(reader, signature: signature) as? Api.Bool
- } }
- let _c1 = _1 != nil
- let _c2 = (Int(_1!) & Int(1 << 0) == 0) || _2 != nil
- if _c1 && _c2 {
- return Api.GlobalPrivacySettings.globalPrivacySettings(flags: _1!, archiveAndMuteNewNoncontactPeers: _2)
- }
- else {
- return nil
- }
- }
-
- }
-}
-public extension Api {
- enum GroupCall: TypeConstructorDescription {
- case groupCall(flags: Int32, id: Int64, accessHash: Int64, participantsCount: Int32, title: String?, streamDcId: Int32?, recordStartDate: Int32?, scheduleDate: Int32?, unmutedVideoCount: Int32?, unmutedVideoLimit: Int32, version: Int32)
- case groupCallDiscarded(id: Int64, accessHash: Int64, duration: Int32)
-
- public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
- switch self {
- case .groupCall(let flags, let id, let accessHash, let participantsCount, let title, let streamDcId, let recordStartDate, let scheduleDate, let unmutedVideoCount, let unmutedVideoLimit, let version):
- if boxed {
- buffer.appendInt32(-711498484)
- }
- serializeInt32(flags, buffer: buffer, boxed: false)
- serializeInt64(id, buffer: buffer, boxed: false)
- serializeInt64(accessHash, buffer: buffer, boxed: false)
- serializeInt32(participantsCount, buffer: buffer, boxed: false)
- if Int(flags) & Int(1 << 3) != 0 {serializeString(title!, buffer: buffer, boxed: false)}
- if Int(flags) & Int(1 << 4) != 0 {serializeInt32(streamDcId!, buffer: buffer, boxed: false)}
- if Int(flags) & Int(1 << 5) != 0 {serializeInt32(recordStartDate!, buffer: buffer, boxed: false)}
- if Int(flags) & Int(1 << 7) != 0 {serializeInt32(scheduleDate!, buffer: buffer, boxed: false)}
- if Int(flags) & Int(1 << 10) != 0 {serializeInt32(unmutedVideoCount!, buffer: buffer, boxed: false)}
- serializeInt32(unmutedVideoLimit, buffer: buffer, boxed: false)
- serializeInt32(version, buffer: buffer, boxed: false)
- break
- case .groupCallDiscarded(let id, let accessHash, let duration):
- if boxed {
- buffer.appendInt32(2004925620)
- }
- serializeInt64(id, buffer: buffer, boxed: false)
- serializeInt64(accessHash, buffer: buffer, boxed: false)
- serializeInt32(duration, buffer: buffer, boxed: false)
- break
- }
- }
-
- public func descriptionFields() -> (String, [(String, Any)]) {
- switch self {
- case .groupCall(let flags, let id, let accessHash, let participantsCount, let title, let streamDcId, let recordStartDate, let scheduleDate, let unmutedVideoCount, let unmutedVideoLimit, let version):
- return ("groupCall", [("flags", String(describing: flags)), ("id", String(describing: id)), ("accessHash", String(describing: accessHash)), ("participantsCount", String(describing: participantsCount)), ("title", String(describing: title)), ("streamDcId", String(describing: streamDcId)), ("recordStartDate", String(describing: recordStartDate)), ("scheduleDate", String(describing: scheduleDate)), ("unmutedVideoCount", String(describing: unmutedVideoCount)), ("unmutedVideoLimit", String(describing: unmutedVideoLimit)), ("version", String(describing: version))])
- case .groupCallDiscarded(let id, let accessHash, let duration):
- return ("groupCallDiscarded", [("id", String(describing: id)), ("accessHash", String(describing: accessHash)), ("duration", String(describing: duration))])
- }
- }
-
- public static func parse_groupCall(_ reader: BufferReader) -> GroupCall? {
- var _1: Int32?
- _1 = reader.readInt32()
- var _2: Int64?
- _2 = reader.readInt64()
- var _3: Int64?
- _3 = reader.readInt64()
- var _4: Int32?
- _4 = reader.readInt32()
- var _5: String?
- if Int(_1!) & Int(1 << 3) != 0 {_5 = parseString(reader) }
- var _6: Int32?
- if Int(_1!) & Int(1 << 4) != 0 {_6 = reader.readInt32() }
- var _7: Int32?
- if Int(_1!) & Int(1 << 5) != 0 {_7 = reader.readInt32() }
- var _8: Int32?
- if Int(_1!) & Int(1 << 7) != 0 {_8 = reader.readInt32() }
- var _9: Int32?
- if Int(_1!) & Int(1 << 10) != 0 {_9 = reader.readInt32() }
- var _10: Int32?
- _10 = reader.readInt32()
- var _11: Int32?
- _11 = reader.readInt32()
- let _c1 = _1 != nil
- let _c2 = _2 != nil
- let _c3 = _3 != nil
- let _c4 = _4 != nil
- let _c5 = (Int(_1!) & Int(1 << 3) == 0) || _5 != nil
- let _c6 = (Int(_1!) & Int(1 << 4) == 0) || _6 != nil
- let _c7 = (Int(_1!) & Int(1 << 5) == 0) || _7 != nil
- let _c8 = (Int(_1!) & Int(1 << 7) == 0) || _8 != nil
- let _c9 = (Int(_1!) & Int(1 << 10) == 0) || _9 != nil
- let _c10 = _10 != nil
- let _c11 = _11 != nil
- if _c1 && _c2 && _c3 && _c4 && _c5 && _c6 && _c7 && _c8 && _c9 && _c10 && _c11 {
- return Api.GroupCall.groupCall(flags: _1!, id: _2!, accessHash: _3!, participantsCount: _4!, title: _5, streamDcId: _6, recordStartDate: _7, scheduleDate: _8, unmutedVideoCount: _9, unmutedVideoLimit: _10!, version: _11!)
- }
- else {
- return nil
- }
- }
- public static func parse_groupCallDiscarded(_ reader: BufferReader) -> GroupCall? {
- var _1: Int64?
- _1 = reader.readInt64()
- var _2: Int64?
- _2 = reader.readInt64()
- var _3: Int32?
- _3 = reader.readInt32()
- let _c1 = _1 != nil
- let _c2 = _2 != nil
- let _c3 = _3 != nil
- if _c1 && _c2 && _c3 {
- return Api.GroupCall.groupCallDiscarded(id: _1!, accessHash: _2!, duration: _3!)
- }
- else {
- return nil
- }
- }
-
- }
-}
-public extension Api {
- enum GroupCallParticipant: TypeConstructorDescription {
- case groupCallParticipant(flags: Int32, peer: Api.Peer, date: Int32, activeDate: Int32?, source: Int32, volume: Int32?, about: String?, raiseHandRating: Int64?, video: Api.GroupCallParticipantVideo?, presentation: Api.GroupCallParticipantVideo?)
-
- public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
- switch self {
- case .groupCallParticipant(let flags, let peer, let date, let activeDate, let source, let volume, let about, let raiseHandRating, let video, let presentation):
- if boxed {
- buffer.appendInt32(-341428482)
- }
- serializeInt32(flags, buffer: buffer, boxed: false)
- peer.serialize(buffer, true)
- serializeInt32(date, buffer: buffer, boxed: false)
- if Int(flags) & Int(1 << 3) != 0 {serializeInt32(activeDate!, buffer: buffer, boxed: false)}
- serializeInt32(source, buffer: buffer, boxed: false)
- if Int(flags) & Int(1 << 7) != 0 {serializeInt32(volume!, buffer: buffer, boxed: false)}
- if Int(flags) & Int(1 << 11) != 0 {serializeString(about!, buffer: buffer, boxed: false)}
- if Int(flags) & Int(1 << 13) != 0 {serializeInt64(raiseHandRating!, buffer: buffer, boxed: false)}
- if Int(flags) & Int(1 << 6) != 0 {video!.serialize(buffer, true)}
- if Int(flags) & Int(1 << 14) != 0 {presentation!.serialize(buffer, true)}
- break
- }
- }
-
- public func descriptionFields() -> (String, [(String, Any)]) {
- switch self {
- case .groupCallParticipant(let flags, let peer, let date, let activeDate, let source, let volume, let about, let raiseHandRating, let video, let presentation):
- return ("groupCallParticipant", [("flags", String(describing: flags)), ("peer", String(describing: peer)), ("date", String(describing: date)), ("activeDate", String(describing: activeDate)), ("source", String(describing: source)), ("volume", String(describing: volume)), ("about", String(describing: about)), ("raiseHandRating", String(describing: raiseHandRating)), ("video", String(describing: video)), ("presentation", String(describing: presentation))])
- }
- }
-
- public static func parse_groupCallParticipant(_ reader: BufferReader) -> GroupCallParticipant? {
- var _1: Int32?
- _1 = reader.readInt32()
- var _2: Api.Peer?
- if let signature = reader.readInt32() {
- _2 = Api.parse(reader, signature: signature) as? Api.Peer
- }
- var _3: Int32?
- _3 = reader.readInt32()
- var _4: Int32?
- if Int(_1!) & Int(1 << 3) != 0 {_4 = reader.readInt32() }
- var _5: Int32?
- _5 = reader.readInt32()
- var _6: Int32?
- if Int(_1!) & Int(1 << 7) != 0 {_6 = reader.readInt32() }
- var _7: String?
- if Int(_1!) & Int(1 << 11) != 0 {_7 = parseString(reader) }
- var _8: Int64?
- if Int(_1!) & Int(1 << 13) != 0 {_8 = reader.readInt64() }
- var _9: Api.GroupCallParticipantVideo?
- if Int(_1!) & Int(1 << 6) != 0 {if let signature = reader.readInt32() {
- _9 = Api.parse(reader, signature: signature) as? Api.GroupCallParticipantVideo
- } }
- var _10: Api.GroupCallParticipantVideo?
- if Int(_1!) & Int(1 << 14) != 0 {if let signature = reader.readInt32() {
- _10 = Api.parse(reader, signature: signature) as? Api.GroupCallParticipantVideo
- } }
- let _c1 = _1 != nil
- let _c2 = _2 != nil
- let _c3 = _3 != nil
- let _c4 = (Int(_1!) & Int(1 << 3) == 0) || _4 != nil
- let _c5 = _5 != nil
- let _c6 = (Int(_1!) & Int(1 << 7) == 0) || _6 != nil
- let _c7 = (Int(_1!) & Int(1 << 11) == 0) || _7 != nil
- let _c8 = (Int(_1!) & Int(1 << 13) == 0) || _8 != nil
- let _c9 = (Int(_1!) & Int(1 << 6) == 0) || _9 != nil
- let _c10 = (Int(_1!) & Int(1 << 14) == 0) || _10 != nil
- if _c1 && _c2 && _c3 && _c4 && _c5 && _c6 && _c7 && _c8 && _c9 && _c10 {
- return Api.GroupCallParticipant.groupCallParticipant(flags: _1!, peer: _2!, date: _3!, activeDate: _4, source: _5!, volume: _6, about: _7, raiseHandRating: _8, video: _9, presentation: _10)
- }
- else {
- return nil
- }
- }
-
- }
-}
-public extension Api {
- enum GroupCallParticipantVideo: TypeConstructorDescription {
- case groupCallParticipantVideo(flags: Int32, endpoint: String, sourceGroups: [Api.GroupCallParticipantVideoSourceGroup], audioSource: Int32?)
-
- public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
- switch self {
- case .groupCallParticipantVideo(let flags, let endpoint, let sourceGroups, let audioSource):
- if boxed {
- buffer.appendInt32(1735736008)
- }
- serializeInt32(flags, buffer: buffer, boxed: false)
- serializeString(endpoint, buffer: buffer, boxed: false)
- buffer.appendInt32(481674261)
- buffer.appendInt32(Int32(sourceGroups.count))
- for item in sourceGroups {
- item.serialize(buffer, true)
- }
- if Int(flags) & Int(1 << 1) != 0 {serializeInt32(audioSource!, buffer: buffer, boxed: false)}
- break
- }
- }
-
- public func descriptionFields() -> (String, [(String, Any)]) {
- switch self {
- case .groupCallParticipantVideo(let flags, let endpoint, let sourceGroups, let audioSource):
- return ("groupCallParticipantVideo", [("flags", String(describing: flags)), ("endpoint", String(describing: endpoint)), ("sourceGroups", String(describing: sourceGroups)), ("audioSource", String(describing: audioSource))])
- }
- }
-
- public static func parse_groupCallParticipantVideo(_ reader: BufferReader) -> GroupCallParticipantVideo? {
- var _1: Int32?
- _1 = reader.readInt32()
- var _2: String?
- _2 = parseString(reader)
- var _3: [Api.GroupCallParticipantVideoSourceGroup]?
- if let _ = reader.readInt32() {
- _3 = Api.parseVector(reader, elementSignature: 0, elementType: Api.GroupCallParticipantVideoSourceGroup.self)
- }
- var _4: Int32?
- if Int(_1!) & Int(1 << 1) != 0 {_4 = reader.readInt32() }
- let _c1 = _1 != nil
- let _c2 = _2 != nil
- let _c3 = _3 != nil
- let _c4 = (Int(_1!) & Int(1 << 1) == 0) || _4 != nil
- if _c1 && _c2 && _c3 && _c4 {
- return Api.GroupCallParticipantVideo.groupCallParticipantVideo(flags: _1!, endpoint: _2!, sourceGroups: _3!, audioSource: _4)
- }
- else {
- return nil
- }
- }
-
- }
-}
diff --git a/submodules/TelegramApi/Sources/Api6.swift b/submodules/TelegramApi/Sources/Api6.swift
index 6f35caa5d1..d59caef38b 100644
--- a/submodules/TelegramApi/Sources/Api6.swift
+++ b/submodules/TelegramApi/Sources/Api6.swift
@@ -1,3 +1,281 @@
+public extension Api {
+ enum GlobalPrivacySettings: TypeConstructorDescription {
+ case globalPrivacySettings(flags: Int32, archiveAndMuteNewNoncontactPeers: Api.Bool?)
+
+ public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
+ switch self {
+ case .globalPrivacySettings(let flags, let archiveAndMuteNewNoncontactPeers):
+ if boxed {
+ buffer.appendInt32(-1096616924)
+ }
+ serializeInt32(flags, buffer: buffer, boxed: false)
+ if Int(flags) & Int(1 << 0) != 0 {archiveAndMuteNewNoncontactPeers!.serialize(buffer, true)}
+ break
+ }
+ }
+
+ public func descriptionFields() -> (String, [(String, Any)]) {
+ switch self {
+ case .globalPrivacySettings(let flags, let archiveAndMuteNewNoncontactPeers):
+ return ("globalPrivacySettings", [("flags", String(describing: flags)), ("archiveAndMuteNewNoncontactPeers", String(describing: archiveAndMuteNewNoncontactPeers))])
+ }
+ }
+
+ public static func parse_globalPrivacySettings(_ reader: BufferReader) -> GlobalPrivacySettings? {
+ var _1: Int32?
+ _1 = reader.readInt32()
+ var _2: Api.Bool?
+ if Int(_1!) & Int(1 << 0) != 0 {if let signature = reader.readInt32() {
+ _2 = Api.parse(reader, signature: signature) as? Api.Bool
+ } }
+ let _c1 = _1 != nil
+ let _c2 = (Int(_1!) & Int(1 << 0) == 0) || _2 != nil
+ if _c1 && _c2 {
+ return Api.GlobalPrivacySettings.globalPrivacySettings(flags: _1!, archiveAndMuteNewNoncontactPeers: _2)
+ }
+ else {
+ return nil
+ }
+ }
+
+ }
+}
+public extension Api {
+ enum GroupCall: TypeConstructorDescription {
+ case groupCall(flags: Int32, id: Int64, accessHash: Int64, participantsCount: Int32, title: String?, streamDcId: Int32?, recordStartDate: Int32?, scheduleDate: Int32?, unmutedVideoCount: Int32?, unmutedVideoLimit: Int32, version: Int32)
+ case groupCallDiscarded(id: Int64, accessHash: Int64, duration: Int32)
+
+ public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
+ switch self {
+ case .groupCall(let flags, let id, let accessHash, let participantsCount, let title, let streamDcId, let recordStartDate, let scheduleDate, let unmutedVideoCount, let unmutedVideoLimit, let version):
+ if boxed {
+ buffer.appendInt32(-711498484)
+ }
+ serializeInt32(flags, buffer: buffer, boxed: false)
+ serializeInt64(id, buffer: buffer, boxed: false)
+ serializeInt64(accessHash, buffer: buffer, boxed: false)
+ serializeInt32(participantsCount, buffer: buffer, boxed: false)
+ if Int(flags) & Int(1 << 3) != 0 {serializeString(title!, buffer: buffer, boxed: false)}
+ if Int(flags) & Int(1 << 4) != 0 {serializeInt32(streamDcId!, buffer: buffer, boxed: false)}
+ if Int(flags) & Int(1 << 5) != 0 {serializeInt32(recordStartDate!, buffer: buffer, boxed: false)}
+ if Int(flags) & Int(1 << 7) != 0 {serializeInt32(scheduleDate!, buffer: buffer, boxed: false)}
+ if Int(flags) & Int(1 << 10) != 0 {serializeInt32(unmutedVideoCount!, buffer: buffer, boxed: false)}
+ serializeInt32(unmutedVideoLimit, buffer: buffer, boxed: false)
+ serializeInt32(version, buffer: buffer, boxed: false)
+ break
+ case .groupCallDiscarded(let id, let accessHash, let duration):
+ if boxed {
+ buffer.appendInt32(2004925620)
+ }
+ serializeInt64(id, buffer: buffer, boxed: false)
+ serializeInt64(accessHash, buffer: buffer, boxed: false)
+ serializeInt32(duration, buffer: buffer, boxed: false)
+ break
+ }
+ }
+
+ public func descriptionFields() -> (String, [(String, Any)]) {
+ switch self {
+ case .groupCall(let flags, let id, let accessHash, let participantsCount, let title, let streamDcId, let recordStartDate, let scheduleDate, let unmutedVideoCount, let unmutedVideoLimit, let version):
+ return ("groupCall", [("flags", String(describing: flags)), ("id", String(describing: id)), ("accessHash", String(describing: accessHash)), ("participantsCount", String(describing: participantsCount)), ("title", String(describing: title)), ("streamDcId", String(describing: streamDcId)), ("recordStartDate", String(describing: recordStartDate)), ("scheduleDate", String(describing: scheduleDate)), ("unmutedVideoCount", String(describing: unmutedVideoCount)), ("unmutedVideoLimit", String(describing: unmutedVideoLimit)), ("version", String(describing: version))])
+ case .groupCallDiscarded(let id, let accessHash, let duration):
+ return ("groupCallDiscarded", [("id", String(describing: id)), ("accessHash", String(describing: accessHash)), ("duration", String(describing: duration))])
+ }
+ }
+
+ public static func parse_groupCall(_ reader: BufferReader) -> GroupCall? {
+ var _1: Int32?
+ _1 = reader.readInt32()
+ var _2: Int64?
+ _2 = reader.readInt64()
+ var _3: Int64?
+ _3 = reader.readInt64()
+ var _4: Int32?
+ _4 = reader.readInt32()
+ var _5: String?
+ if Int(_1!) & Int(1 << 3) != 0 {_5 = parseString(reader) }
+ var _6: Int32?
+ if Int(_1!) & Int(1 << 4) != 0 {_6 = reader.readInt32() }
+ var _7: Int32?
+ if Int(_1!) & Int(1 << 5) != 0 {_7 = reader.readInt32() }
+ var _8: Int32?
+ if Int(_1!) & Int(1 << 7) != 0 {_8 = reader.readInt32() }
+ var _9: Int32?
+ if Int(_1!) & Int(1 << 10) != 0 {_9 = reader.readInt32() }
+ var _10: Int32?
+ _10 = reader.readInt32()
+ var _11: Int32?
+ _11 = reader.readInt32()
+ let _c1 = _1 != nil
+ let _c2 = _2 != nil
+ let _c3 = _3 != nil
+ let _c4 = _4 != nil
+ let _c5 = (Int(_1!) & Int(1 << 3) == 0) || _5 != nil
+ let _c6 = (Int(_1!) & Int(1 << 4) == 0) || _6 != nil
+ let _c7 = (Int(_1!) & Int(1 << 5) == 0) || _7 != nil
+ let _c8 = (Int(_1!) & Int(1 << 7) == 0) || _8 != nil
+ let _c9 = (Int(_1!) & Int(1 << 10) == 0) || _9 != nil
+ let _c10 = _10 != nil
+ let _c11 = _11 != nil
+ if _c1 && _c2 && _c3 && _c4 && _c5 && _c6 && _c7 && _c8 && _c9 && _c10 && _c11 {
+ return Api.GroupCall.groupCall(flags: _1!, id: _2!, accessHash: _3!, participantsCount: _4!, title: _5, streamDcId: _6, recordStartDate: _7, scheduleDate: _8, unmutedVideoCount: _9, unmutedVideoLimit: _10!, version: _11!)
+ }
+ else {
+ return nil
+ }
+ }
+ public static func parse_groupCallDiscarded(_ reader: BufferReader) -> GroupCall? {
+ var _1: Int64?
+ _1 = reader.readInt64()
+ var _2: Int64?
+ _2 = reader.readInt64()
+ var _3: Int32?
+ _3 = reader.readInt32()
+ let _c1 = _1 != nil
+ let _c2 = _2 != nil
+ let _c3 = _3 != nil
+ if _c1 && _c2 && _c3 {
+ return Api.GroupCall.groupCallDiscarded(id: _1!, accessHash: _2!, duration: _3!)
+ }
+ else {
+ return nil
+ }
+ }
+
+ }
+}
+public extension Api {
+ enum GroupCallParticipant: TypeConstructorDescription {
+ case groupCallParticipant(flags: Int32, peer: Api.Peer, date: Int32, activeDate: Int32?, source: Int32, volume: Int32?, about: String?, raiseHandRating: Int64?, video: Api.GroupCallParticipantVideo?, presentation: Api.GroupCallParticipantVideo?)
+
+ public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
+ switch self {
+ case .groupCallParticipant(let flags, let peer, let date, let activeDate, let source, let volume, let about, let raiseHandRating, let video, let presentation):
+ if boxed {
+ buffer.appendInt32(-341428482)
+ }
+ serializeInt32(flags, buffer: buffer, boxed: false)
+ peer.serialize(buffer, true)
+ serializeInt32(date, buffer: buffer, boxed: false)
+ if Int(flags) & Int(1 << 3) != 0 {serializeInt32(activeDate!, buffer: buffer, boxed: false)}
+ serializeInt32(source, buffer: buffer, boxed: false)
+ if Int(flags) & Int(1 << 7) != 0 {serializeInt32(volume!, buffer: buffer, boxed: false)}
+ if Int(flags) & Int(1 << 11) != 0 {serializeString(about!, buffer: buffer, boxed: false)}
+ if Int(flags) & Int(1 << 13) != 0 {serializeInt64(raiseHandRating!, buffer: buffer, boxed: false)}
+ if Int(flags) & Int(1 << 6) != 0 {video!.serialize(buffer, true)}
+ if Int(flags) & Int(1 << 14) != 0 {presentation!.serialize(buffer, true)}
+ break
+ }
+ }
+
+ public func descriptionFields() -> (String, [(String, Any)]) {
+ switch self {
+ case .groupCallParticipant(let flags, let peer, let date, let activeDate, let source, let volume, let about, let raiseHandRating, let video, let presentation):
+ return ("groupCallParticipant", [("flags", String(describing: flags)), ("peer", String(describing: peer)), ("date", String(describing: date)), ("activeDate", String(describing: activeDate)), ("source", String(describing: source)), ("volume", String(describing: volume)), ("about", String(describing: about)), ("raiseHandRating", String(describing: raiseHandRating)), ("video", String(describing: video)), ("presentation", String(describing: presentation))])
+ }
+ }
+
+ public static func parse_groupCallParticipant(_ reader: BufferReader) -> GroupCallParticipant? {
+ var _1: Int32?
+ _1 = reader.readInt32()
+ var _2: Api.Peer?
+ if let signature = reader.readInt32() {
+ _2 = Api.parse(reader, signature: signature) as? Api.Peer
+ }
+ var _3: Int32?
+ _3 = reader.readInt32()
+ var _4: Int32?
+ if Int(_1!) & Int(1 << 3) != 0 {_4 = reader.readInt32() }
+ var _5: Int32?
+ _5 = reader.readInt32()
+ var _6: Int32?
+ if Int(_1!) & Int(1 << 7) != 0 {_6 = reader.readInt32() }
+ var _7: String?
+ if Int(_1!) & Int(1 << 11) != 0 {_7 = parseString(reader) }
+ var _8: Int64?
+ if Int(_1!) & Int(1 << 13) != 0 {_8 = reader.readInt64() }
+ var _9: Api.GroupCallParticipantVideo?
+ if Int(_1!) & Int(1 << 6) != 0 {if let signature = reader.readInt32() {
+ _9 = Api.parse(reader, signature: signature) as? Api.GroupCallParticipantVideo
+ } }
+ var _10: Api.GroupCallParticipantVideo?
+ if Int(_1!) & Int(1 << 14) != 0 {if let signature = reader.readInt32() {
+ _10 = Api.parse(reader, signature: signature) as? Api.GroupCallParticipantVideo
+ } }
+ let _c1 = _1 != nil
+ let _c2 = _2 != nil
+ let _c3 = _3 != nil
+ let _c4 = (Int(_1!) & Int(1 << 3) == 0) || _4 != nil
+ let _c5 = _5 != nil
+ let _c6 = (Int(_1!) & Int(1 << 7) == 0) || _6 != nil
+ let _c7 = (Int(_1!) & Int(1 << 11) == 0) || _7 != nil
+ let _c8 = (Int(_1!) & Int(1 << 13) == 0) || _8 != nil
+ let _c9 = (Int(_1!) & Int(1 << 6) == 0) || _9 != nil
+ let _c10 = (Int(_1!) & Int(1 << 14) == 0) || _10 != nil
+ if _c1 && _c2 && _c3 && _c4 && _c5 && _c6 && _c7 && _c8 && _c9 && _c10 {
+ return Api.GroupCallParticipant.groupCallParticipant(flags: _1!, peer: _2!, date: _3!, activeDate: _4, source: _5!, volume: _6, about: _7, raiseHandRating: _8, video: _9, presentation: _10)
+ }
+ else {
+ return nil
+ }
+ }
+
+ }
+}
+public extension Api {
+ enum GroupCallParticipantVideo: TypeConstructorDescription {
+ case groupCallParticipantVideo(flags: Int32, endpoint: String, sourceGroups: [Api.GroupCallParticipantVideoSourceGroup], audioSource: Int32?)
+
+ public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
+ switch self {
+ case .groupCallParticipantVideo(let flags, let endpoint, let sourceGroups, let audioSource):
+ if boxed {
+ buffer.appendInt32(1735736008)
+ }
+ serializeInt32(flags, buffer: buffer, boxed: false)
+ serializeString(endpoint, buffer: buffer, boxed: false)
+ buffer.appendInt32(481674261)
+ buffer.appendInt32(Int32(sourceGroups.count))
+ for item in sourceGroups {
+ item.serialize(buffer, true)
+ }
+ if Int(flags) & Int(1 << 1) != 0 {serializeInt32(audioSource!, buffer: buffer, boxed: false)}
+ break
+ }
+ }
+
+ public func descriptionFields() -> (String, [(String, Any)]) {
+ switch self {
+ case .groupCallParticipantVideo(let flags, let endpoint, let sourceGroups, let audioSource):
+ return ("groupCallParticipantVideo", [("flags", String(describing: flags)), ("endpoint", String(describing: endpoint)), ("sourceGroups", String(describing: sourceGroups)), ("audioSource", String(describing: audioSource))])
+ }
+ }
+
+ public static func parse_groupCallParticipantVideo(_ reader: BufferReader) -> GroupCallParticipantVideo? {
+ var _1: Int32?
+ _1 = reader.readInt32()
+ var _2: String?
+ _2 = parseString(reader)
+ var _3: [Api.GroupCallParticipantVideoSourceGroup]?
+ if let _ = reader.readInt32() {
+ _3 = Api.parseVector(reader, elementSignature: 0, elementType: Api.GroupCallParticipantVideoSourceGroup.self)
+ }
+ var _4: Int32?
+ if Int(_1!) & Int(1 << 1) != 0 {_4 = reader.readInt32() }
+ let _c1 = _1 != nil
+ let _c2 = _2 != nil
+ let _c3 = _3 != nil
+ let _c4 = (Int(_1!) & Int(1 << 1) == 0) || _4 != nil
+ if _c1 && _c2 && _c3 && _c4 {
+ return Api.GroupCallParticipantVideo.groupCallParticipantVideo(flags: _1!, endpoint: _2!, sourceGroups: _3!, audioSource: _4)
+ }
+ else {
+ return nil
+ }
+ }
+
+ }
+}
public extension Api {
enum GroupCallParticipantVideoSourceGroup: TypeConstructorDescription {
case groupCallParticipantVideoSourceGroup(semantics: String, sources: [Int32])
@@ -1004,145 +1282,3 @@ public extension Api {
}
}
-public extension Api {
- enum InputChatPhoto: TypeConstructorDescription {
- case inputChatPhoto(id: Api.InputPhoto)
- case inputChatPhotoEmpty
- case inputChatUploadedPhoto(flags: Int32, file: Api.InputFile?, video: Api.InputFile?, videoStartTs: Double?)
-
- public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
- switch self {
- case .inputChatPhoto(let id):
- if boxed {
- buffer.appendInt32(-1991004873)
- }
- id.serialize(buffer, true)
- break
- case .inputChatPhotoEmpty:
- if boxed {
- buffer.appendInt32(480546647)
- }
-
- break
- case .inputChatUploadedPhoto(let flags, let file, let video, let videoStartTs):
- if boxed {
- buffer.appendInt32(-968723890)
- }
- serializeInt32(flags, buffer: buffer, boxed: false)
- if Int(flags) & Int(1 << 0) != 0 {file!.serialize(buffer, true)}
- if Int(flags) & Int(1 << 1) != 0 {video!.serialize(buffer, true)}
- if Int(flags) & Int(1 << 2) != 0 {serializeDouble(videoStartTs!, buffer: buffer, boxed: false)}
- break
- }
- }
-
- public func descriptionFields() -> (String, [(String, Any)]) {
- switch self {
- case .inputChatPhoto(let id):
- return ("inputChatPhoto", [("id", String(describing: id))])
- case .inputChatPhotoEmpty:
- return ("inputChatPhotoEmpty", [])
- case .inputChatUploadedPhoto(let flags, let file, let video, let videoStartTs):
- return ("inputChatUploadedPhoto", [("flags", String(describing: flags)), ("file", String(describing: file)), ("video", String(describing: video)), ("videoStartTs", String(describing: videoStartTs))])
- }
- }
-
- public static func parse_inputChatPhoto(_ reader: BufferReader) -> InputChatPhoto? {
- var _1: Api.InputPhoto?
- if let signature = reader.readInt32() {
- _1 = Api.parse(reader, signature: signature) as? Api.InputPhoto
- }
- let _c1 = _1 != nil
- if _c1 {
- return Api.InputChatPhoto.inputChatPhoto(id: _1!)
- }
- else {
- return nil
- }
- }
- public static func parse_inputChatPhotoEmpty(_ reader: BufferReader) -> InputChatPhoto? {
- return Api.InputChatPhoto.inputChatPhotoEmpty
- }
- public static func parse_inputChatUploadedPhoto(_ reader: BufferReader) -> InputChatPhoto? {
- var _1: Int32?
- _1 = reader.readInt32()
- var _2: Api.InputFile?
- if Int(_1!) & Int(1 << 0) != 0 {if let signature = reader.readInt32() {
- _2 = Api.parse(reader, signature: signature) as? Api.InputFile
- } }
- var _3: Api.InputFile?
- if Int(_1!) & Int(1 << 1) != 0 {if let signature = reader.readInt32() {
- _3 = Api.parse(reader, signature: signature) as? Api.InputFile
- } }
- var _4: Double?
- if Int(_1!) & Int(1 << 2) != 0 {_4 = reader.readDouble() }
- let _c1 = _1 != nil
- let _c2 = (Int(_1!) & Int(1 << 0) == 0) || _2 != nil
- let _c3 = (Int(_1!) & Int(1 << 1) == 0) || _3 != nil
- let _c4 = (Int(_1!) & Int(1 << 2) == 0) || _4 != nil
- if _c1 && _c2 && _c3 && _c4 {
- return Api.InputChatPhoto.inputChatUploadedPhoto(flags: _1!, file: _2, video: _3, videoStartTs: _4)
- }
- else {
- return nil
- }
- }
-
- }
-}
-public extension Api {
- enum InputCheckPasswordSRP: TypeConstructorDescription {
- case inputCheckPasswordEmpty
- case inputCheckPasswordSRP(srpId: Int64, A: Buffer, M1: Buffer)
-
- public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
- switch self {
- case .inputCheckPasswordEmpty:
- if boxed {
- buffer.appendInt32(-1736378792)
- }
-
- break
- case .inputCheckPasswordSRP(let srpId, let A, let M1):
- if boxed {
- buffer.appendInt32(-763367294)
- }
- serializeInt64(srpId, buffer: buffer, boxed: false)
- serializeBytes(A, buffer: buffer, boxed: false)
- serializeBytes(M1, buffer: buffer, boxed: false)
- break
- }
- }
-
- public func descriptionFields() -> (String, [(String, Any)]) {
- switch self {
- case .inputCheckPasswordEmpty:
- return ("inputCheckPasswordEmpty", [])
- case .inputCheckPasswordSRP(let srpId, let A, let M1):
- return ("inputCheckPasswordSRP", [("srpId", String(describing: srpId)), ("A", String(describing: A)), ("M1", String(describing: M1))])
- }
- }
-
- public static func parse_inputCheckPasswordEmpty(_ reader: BufferReader) -> InputCheckPasswordSRP? {
- return Api.InputCheckPasswordSRP.inputCheckPasswordEmpty
- }
- public static func parse_inputCheckPasswordSRP(_ reader: BufferReader) -> InputCheckPasswordSRP? {
- var _1: Int64?
- _1 = reader.readInt64()
- var _2: Buffer?
- _2 = parseBytes(reader)
- var _3: Buffer?
- _3 = parseBytes(reader)
- let _c1 = _1 != nil
- let _c2 = _2 != nil
- let _c3 = _3 != nil
- if _c1 && _c2 && _c3 {
- return Api.InputCheckPasswordSRP.inputCheckPasswordSRP(srpId: _1!, A: _2!, M1: _3!)
- }
- else {
- return nil
- }
- }
-
- }
-}
diff --git a/submodules/TelegramApi/Sources/Api7.swift b/submodules/TelegramApi/Sources/Api7.swift
index 4811f956a1..3500bf1db9 100644
--- a/submodules/TelegramApi/Sources/Api7.swift
+++ b/submodules/TelegramApi/Sources/Api7.swift
@@ -1,3 +1,145 @@
+public extension Api {
+ enum InputChatPhoto: TypeConstructorDescription {
+ case inputChatPhoto(id: Api.InputPhoto)
+ case inputChatPhotoEmpty
+ case inputChatUploadedPhoto(flags: Int32, file: Api.InputFile?, video: Api.InputFile?, videoStartTs: Double?)
+
+ public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
+ switch self {
+ case .inputChatPhoto(let id):
+ if boxed {
+ buffer.appendInt32(-1991004873)
+ }
+ id.serialize(buffer, true)
+ break
+ case .inputChatPhotoEmpty:
+ if boxed {
+ buffer.appendInt32(480546647)
+ }
+
+ break
+ case .inputChatUploadedPhoto(let flags, let file, let video, let videoStartTs):
+ if boxed {
+ buffer.appendInt32(-968723890)
+ }
+ serializeInt32(flags, buffer: buffer, boxed: false)
+ if Int(flags) & Int(1 << 0) != 0 {file!.serialize(buffer, true)}
+ if Int(flags) & Int(1 << 1) != 0 {video!.serialize(buffer, true)}
+ if Int(flags) & Int(1 << 2) != 0 {serializeDouble(videoStartTs!, buffer: buffer, boxed: false)}
+ break
+ }
+ }
+
+ public func descriptionFields() -> (String, [(String, Any)]) {
+ switch self {
+ case .inputChatPhoto(let id):
+ return ("inputChatPhoto", [("id", String(describing: id))])
+ case .inputChatPhotoEmpty:
+ return ("inputChatPhotoEmpty", [])
+ case .inputChatUploadedPhoto(let flags, let file, let video, let videoStartTs):
+ return ("inputChatUploadedPhoto", [("flags", String(describing: flags)), ("file", String(describing: file)), ("video", String(describing: video)), ("videoStartTs", String(describing: videoStartTs))])
+ }
+ }
+
+ public static func parse_inputChatPhoto(_ reader: BufferReader) -> InputChatPhoto? {
+ var _1: Api.InputPhoto?
+ if let signature = reader.readInt32() {
+ _1 = Api.parse(reader, signature: signature) as? Api.InputPhoto
+ }
+ let _c1 = _1 != nil
+ if _c1 {
+ return Api.InputChatPhoto.inputChatPhoto(id: _1!)
+ }
+ else {
+ return nil
+ }
+ }
+ public static func parse_inputChatPhotoEmpty(_ reader: BufferReader) -> InputChatPhoto? {
+ return Api.InputChatPhoto.inputChatPhotoEmpty
+ }
+ public static func parse_inputChatUploadedPhoto(_ reader: BufferReader) -> InputChatPhoto? {
+ var _1: Int32?
+ _1 = reader.readInt32()
+ var _2: Api.InputFile?
+ if Int(_1!) & Int(1 << 0) != 0 {if let signature = reader.readInt32() {
+ _2 = Api.parse(reader, signature: signature) as? Api.InputFile
+ } }
+ var _3: Api.InputFile?
+ if Int(_1!) & Int(1 << 1) != 0 {if let signature = reader.readInt32() {
+ _3 = Api.parse(reader, signature: signature) as? Api.InputFile
+ } }
+ var _4: Double?
+ if Int(_1!) & Int(1 << 2) != 0 {_4 = reader.readDouble() }
+ let _c1 = _1 != nil
+ let _c2 = (Int(_1!) & Int(1 << 0) == 0) || _2 != nil
+ let _c3 = (Int(_1!) & Int(1 << 1) == 0) || _3 != nil
+ let _c4 = (Int(_1!) & Int(1 << 2) == 0) || _4 != nil
+ if _c1 && _c2 && _c3 && _c4 {
+ return Api.InputChatPhoto.inputChatUploadedPhoto(flags: _1!, file: _2, video: _3, videoStartTs: _4)
+ }
+ else {
+ return nil
+ }
+ }
+
+ }
+}
+public extension Api {
+ enum InputCheckPasswordSRP: TypeConstructorDescription {
+ case inputCheckPasswordEmpty
+ case inputCheckPasswordSRP(srpId: Int64, A: Buffer, M1: Buffer)
+
+ public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
+ switch self {
+ case .inputCheckPasswordEmpty:
+ if boxed {
+ buffer.appendInt32(-1736378792)
+ }
+
+ break
+ case .inputCheckPasswordSRP(let srpId, let A, let M1):
+ if boxed {
+ buffer.appendInt32(-763367294)
+ }
+ serializeInt64(srpId, buffer: buffer, boxed: false)
+ serializeBytes(A, buffer: buffer, boxed: false)
+ serializeBytes(M1, buffer: buffer, boxed: false)
+ break
+ }
+ }
+
+ public func descriptionFields() -> (String, [(String, Any)]) {
+ switch self {
+ case .inputCheckPasswordEmpty:
+ return ("inputCheckPasswordEmpty", [])
+ case .inputCheckPasswordSRP(let srpId, let A, let M1):
+ return ("inputCheckPasswordSRP", [("srpId", String(describing: srpId)), ("A", String(describing: A)), ("M1", String(describing: M1))])
+ }
+ }
+
+ public static func parse_inputCheckPasswordEmpty(_ reader: BufferReader) -> InputCheckPasswordSRP? {
+ return Api.InputCheckPasswordSRP.inputCheckPasswordEmpty
+ }
+ public static func parse_inputCheckPasswordSRP(_ reader: BufferReader) -> InputCheckPasswordSRP? {
+ var _1: Int64?
+ _1 = reader.readInt64()
+ var _2: Buffer?
+ _2 = parseBytes(reader)
+ var _3: Buffer?
+ _3 = parseBytes(reader)
+ let _c1 = _1 != nil
+ let _c2 = _2 != nil
+ let _c3 = _3 != nil
+ if _c1 && _c2 && _c3 {
+ return Api.InputCheckPasswordSRP.inputCheckPasswordSRP(srpId: _1!, A: _2!, M1: _3!)
+ }
+ else {
+ return nil
+ }
+ }
+
+ }
+}
public extension Api {
enum InputClientProxy: TypeConstructorDescription {
case inputClientProxy(address: String, port: Int32)
@@ -906,637 +1048,3 @@ public extension Api {
}
}
-public extension Api {
- enum InputGroupCall: TypeConstructorDescription {
- case inputGroupCall(id: Int64, accessHash: Int64)
-
- public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
- switch self {
- case .inputGroupCall(let id, let accessHash):
- if boxed {
- buffer.appendInt32(-659913713)
- }
- serializeInt64(id, buffer: buffer, boxed: false)
- serializeInt64(accessHash, buffer: buffer, boxed: false)
- break
- }
- }
-
- public func descriptionFields() -> (String, [(String, Any)]) {
- switch self {
- case .inputGroupCall(let id, let accessHash):
- return ("inputGroupCall", [("id", String(describing: id)), ("accessHash", String(describing: accessHash))])
- }
- }
-
- public static func parse_inputGroupCall(_ reader: BufferReader) -> InputGroupCall? {
- var _1: Int64?
- _1 = reader.readInt64()
- var _2: Int64?
- _2 = reader.readInt64()
- let _c1 = _1 != nil
- let _c2 = _2 != nil
- if _c1 && _c2 {
- return Api.InputGroupCall.inputGroupCall(id: _1!, accessHash: _2!)
- }
- else {
- return nil
- }
- }
-
- }
-}
-public extension Api {
- enum InputInvoice: TypeConstructorDescription {
- case inputInvoiceMessage(peer: Api.InputPeer, msgId: Int32)
- case inputInvoiceSlug(slug: String)
-
- public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
- switch self {
- case .inputInvoiceMessage(let peer, let msgId):
- if boxed {
- buffer.appendInt32(-977967015)
- }
- peer.serialize(buffer, true)
- serializeInt32(msgId, buffer: buffer, boxed: false)
- break
- case .inputInvoiceSlug(let slug):
- if boxed {
- buffer.appendInt32(-1020867857)
- }
- serializeString(slug, buffer: buffer, boxed: false)
- break
- }
- }
-
- public func descriptionFields() -> (String, [(String, Any)]) {
- switch self {
- case .inputInvoiceMessage(let peer, let msgId):
- return ("inputInvoiceMessage", [("peer", String(describing: peer)), ("msgId", String(describing: msgId))])
- case .inputInvoiceSlug(let slug):
- return ("inputInvoiceSlug", [("slug", String(describing: slug))])
- }
- }
-
- public static func parse_inputInvoiceMessage(_ reader: BufferReader) -> InputInvoice? {
- var _1: Api.InputPeer?
- if let signature = reader.readInt32() {
- _1 = Api.parse(reader, signature: signature) as? Api.InputPeer
- }
- var _2: Int32?
- _2 = reader.readInt32()
- let _c1 = _1 != nil
- let _c2 = _2 != nil
- if _c1 && _c2 {
- return Api.InputInvoice.inputInvoiceMessage(peer: _1!, msgId: _2!)
- }
- else {
- return nil
- }
- }
- public static func parse_inputInvoiceSlug(_ reader: BufferReader) -> InputInvoice? {
- var _1: String?
- _1 = parseString(reader)
- let _c1 = _1 != nil
- if _c1 {
- return Api.InputInvoice.inputInvoiceSlug(slug: _1!)
- }
- else {
- return nil
- }
- }
-
- }
-}
-public extension Api {
- enum InputMedia: TypeConstructorDescription {
- case inputMediaContact(phoneNumber: String, firstName: String, lastName: String, vcard: String)
- case inputMediaDice(emoticon: String)
- case inputMediaDocument(flags: Int32, id: Api.InputDocument, ttlSeconds: Int32?, query: String?)
- case inputMediaDocumentExternal(flags: Int32, url: String, ttlSeconds: Int32?)
- case inputMediaEmpty
- case inputMediaGame(id: Api.InputGame)
- case inputMediaGeoLive(flags: Int32, geoPoint: Api.InputGeoPoint, heading: Int32?, period: Int32?, proximityNotificationRadius: Int32?)
- case inputMediaGeoPoint(geoPoint: Api.InputGeoPoint)
- case inputMediaInvoice(flags: Int32, title: String, description: String, photo: Api.InputWebDocument?, invoice: Api.Invoice, payload: Buffer, provider: String, providerData: Api.DataJSON, startParam: String?)
- case inputMediaPhoto(flags: Int32, id: Api.InputPhoto, ttlSeconds: Int32?)
- case inputMediaPhotoExternal(flags: Int32, url: String, ttlSeconds: Int32?)
- case inputMediaPoll(flags: Int32, poll: Api.Poll, correctAnswers: [Buffer]?, solution: String?, solutionEntities: [Api.MessageEntity]?)
- case inputMediaUploadedDocument(flags: Int32, file: Api.InputFile, thumb: Api.InputFile?, mimeType: String, attributes: [Api.DocumentAttribute], stickers: [Api.InputDocument]?, ttlSeconds: Int32?)
- case inputMediaUploadedPhoto(flags: Int32, file: Api.InputFile, stickers: [Api.InputDocument]?, ttlSeconds: Int32?)
- case inputMediaVenue(geoPoint: Api.InputGeoPoint, title: String, address: String, provider: String, venueId: String, venueType: String)
-
- public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
- switch self {
- 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
- case .inputMediaDice(let emoticon):
- if boxed {
- buffer.appendInt32(-428884101)
- }
- serializeString(emoticon, buffer: buffer, boxed: false)
- break
- case .inputMediaDocument(let flags, let id, let ttlSeconds, let query):
- if boxed {
- buffer.appendInt32(860303448)
- }
- serializeInt32(flags, buffer: buffer, boxed: false)
- id.serialize(buffer, true)
- if Int(flags) & Int(1 << 0) != 0 {serializeInt32(ttlSeconds!, buffer: buffer, boxed: false)}
- if Int(flags) & Int(1 << 1) != 0 {serializeString(query!, buffer: buffer, boxed: false)}
- break
- case .inputMediaDocumentExternal(let flags, let url, let ttlSeconds):
- if boxed {
- buffer.appendInt32(-78455655)
- }
- serializeInt32(flags, buffer: buffer, boxed: false)
- serializeString(url, buffer: buffer, boxed: false)
- if Int(flags) & Int(1 << 0) != 0 {serializeInt32(ttlSeconds!, buffer: buffer, boxed: false)}
- break
- case .inputMediaEmpty:
- if boxed {
- buffer.appendInt32(-1771768449)
- }
-
- break
- case .inputMediaGame(let id):
- if boxed {
- buffer.appendInt32(-750828557)
- }
- id.serialize(buffer, true)
- break
- case .inputMediaGeoLive(let flags, let geoPoint, let heading, let period, let proximityNotificationRadius):
- if boxed {
- buffer.appendInt32(-1759532989)
- }
- serializeInt32(flags, buffer: buffer, boxed: false)
- geoPoint.serialize(buffer, true)
- if Int(flags) & Int(1 << 2) != 0 {serializeInt32(heading!, buffer: buffer, boxed: false)}
- if Int(flags) & Int(1 << 1) != 0 {serializeInt32(period!, buffer: buffer, boxed: false)}
- if Int(flags) & Int(1 << 3) != 0 {serializeInt32(proximityNotificationRadius!, buffer: buffer, boxed: false)}
- break
- case .inputMediaGeoPoint(let geoPoint):
- if boxed {
- buffer.appendInt32(-104578748)
- }
- geoPoint.serialize(buffer, true)
- break
- case .inputMediaInvoice(let flags, let title, let description, let photo, let invoice, let payload, let provider, let providerData, let startParam):
- if boxed {
- buffer.appendInt32(-646342540)
- }
- serializeInt32(flags, buffer: buffer, boxed: false)
- serializeString(title, buffer: buffer, boxed: false)
- serializeString(description, buffer: buffer, boxed: false)
- if Int(flags) & Int(1 << 0) != 0 {photo!.serialize(buffer, true)}
- invoice.serialize(buffer, true)
- serializeBytes(payload, buffer: buffer, boxed: false)
- serializeString(provider, buffer: buffer, boxed: false)
- providerData.serialize(buffer, true)
- if Int(flags) & Int(1 << 1) != 0 {serializeString(startParam!, buffer: buffer, boxed: false)}
- break
- case .inputMediaPhoto(let flags, let id, let ttlSeconds):
- if boxed {
- buffer.appendInt32(-1279654347)
- }
- serializeInt32(flags, buffer: buffer, boxed: false)
- id.serialize(buffer, true)
- if Int(flags) & Int(1 << 0) != 0 {serializeInt32(ttlSeconds!, buffer: buffer, boxed: false)}
- break
- case .inputMediaPhotoExternal(let flags, let url, let ttlSeconds):
- if boxed {
- buffer.appendInt32(-440664550)
- }
- serializeInt32(flags, buffer: buffer, boxed: false)
- serializeString(url, buffer: buffer, boxed: false)
- if Int(flags) & Int(1 << 0) != 0 {serializeInt32(ttlSeconds!, buffer: buffer, boxed: false)}
- break
- case .inputMediaPoll(let flags, let poll, let correctAnswers, let solution, let solutionEntities):
- if boxed {
- buffer.appendInt32(261416433)
- }
- serializeInt32(flags, buffer: buffer, boxed: false)
- poll.serialize(buffer, true)
- if Int(flags) & Int(1 << 0) != 0 {buffer.appendInt32(481674261)
- buffer.appendInt32(Int32(correctAnswers!.count))
- for item in correctAnswers! {
- serializeBytes(item, buffer: buffer, boxed: false)
- }}
- if Int(flags) & Int(1 << 1) != 0 {serializeString(solution!, buffer: buffer, boxed: false)}
- if Int(flags) & Int(1 << 1) != 0 {buffer.appendInt32(481674261)
- buffer.appendInt32(Int32(solutionEntities!.count))
- for item in solutionEntities! {
- item.serialize(buffer, true)
- }}
- break
- case .inputMediaUploadedDocument(let flags, let file, let thumb, let mimeType, let attributes, let stickers, let ttlSeconds):
- if boxed {
- buffer.appendInt32(1530447553)
- }
- serializeInt32(flags, buffer: buffer, boxed: false)
- file.serialize(buffer, true)
- if Int(flags) & Int(1 << 2) != 0 {thumb!.serialize(buffer, true)}
- serializeString(mimeType, buffer: buffer, boxed: false)
- buffer.appendInt32(481674261)
- buffer.appendInt32(Int32(attributes.count))
- for item in attributes {
- item.serialize(buffer, true)
- }
- if Int(flags) & Int(1 << 0) != 0 {buffer.appendInt32(481674261)
- buffer.appendInt32(Int32(stickers!.count))
- for item in stickers! {
- item.serialize(buffer, true)
- }}
- if Int(flags) & Int(1 << 1) != 0 {serializeInt32(ttlSeconds!, buffer: buffer, boxed: false)}
- break
- case .inputMediaUploadedPhoto(let flags, let file, let stickers, let ttlSeconds):
- if boxed {
- buffer.appendInt32(505969924)
- }
- serializeInt32(flags, buffer: buffer, boxed: false)
- file.serialize(buffer, true)
- if Int(flags) & Int(1 << 0) != 0 {buffer.appendInt32(481674261)
- buffer.appendInt32(Int32(stickers!.count))
- for item in stickers! {
- item.serialize(buffer, true)
- }}
- if Int(flags) & Int(1 << 1) != 0 {serializeInt32(ttlSeconds!, buffer: buffer, boxed: false)}
- break
- case .inputMediaVenue(let geoPoint, let title, let address, let provider, let venueId, let venueType):
- if boxed {
- buffer.appendInt32(-1052959727)
- }
- geoPoint.serialize(buffer, true)
- serializeString(title, buffer: buffer, boxed: false)
- serializeString(address, buffer: buffer, boxed: false)
- serializeString(provider, buffer: buffer, boxed: false)
- serializeString(venueId, buffer: buffer, boxed: false)
- serializeString(venueType, buffer: buffer, boxed: false)
- break
- }
- }
-
- public func descriptionFields() -> (String, [(String, Any)]) {
- switch self {
- case .inputMediaContact(let phoneNumber, let firstName, let lastName, let vcard):
- return ("inputMediaContact", [("phoneNumber", String(describing: phoneNumber)), ("firstName", String(describing: firstName)), ("lastName", String(describing: lastName)), ("vcard", String(describing: vcard))])
- case .inputMediaDice(let emoticon):
- return ("inputMediaDice", [("emoticon", String(describing: emoticon))])
- case .inputMediaDocument(let flags, let id, let ttlSeconds, let query):
- return ("inputMediaDocument", [("flags", String(describing: flags)), ("id", String(describing: id)), ("ttlSeconds", String(describing: ttlSeconds)), ("query", String(describing: query))])
- case .inputMediaDocumentExternal(let flags, let url, let ttlSeconds):
- return ("inputMediaDocumentExternal", [("flags", String(describing: flags)), ("url", String(describing: url)), ("ttlSeconds", String(describing: ttlSeconds))])
- case .inputMediaEmpty:
- return ("inputMediaEmpty", [])
- case .inputMediaGame(let id):
- return ("inputMediaGame", [("id", String(describing: id))])
- case .inputMediaGeoLive(let flags, let geoPoint, let heading, let period, let proximityNotificationRadius):
- return ("inputMediaGeoLive", [("flags", String(describing: flags)), ("geoPoint", String(describing: geoPoint)), ("heading", String(describing: heading)), ("period", String(describing: period)), ("proximityNotificationRadius", String(describing: proximityNotificationRadius))])
- case .inputMediaGeoPoint(let geoPoint):
- return ("inputMediaGeoPoint", [("geoPoint", String(describing: geoPoint))])
- case .inputMediaInvoice(let flags, let title, let description, let photo, let invoice, let payload, let provider, let providerData, let startParam):
- return ("inputMediaInvoice", [("flags", String(describing: flags)), ("title", String(describing: title)), ("description", String(describing: description)), ("photo", String(describing: photo)), ("invoice", String(describing: invoice)), ("payload", String(describing: payload)), ("provider", String(describing: provider)), ("providerData", String(describing: providerData)), ("startParam", String(describing: startParam))])
- case .inputMediaPhoto(let flags, let id, let ttlSeconds):
- return ("inputMediaPhoto", [("flags", String(describing: flags)), ("id", String(describing: id)), ("ttlSeconds", String(describing: ttlSeconds))])
- case .inputMediaPhotoExternal(let flags, let url, let ttlSeconds):
- return ("inputMediaPhotoExternal", [("flags", String(describing: flags)), ("url", String(describing: url)), ("ttlSeconds", String(describing: ttlSeconds))])
- case .inputMediaPoll(let flags, let poll, let correctAnswers, let solution, let solutionEntities):
- return ("inputMediaPoll", [("flags", String(describing: flags)), ("poll", String(describing: poll)), ("correctAnswers", String(describing: correctAnswers)), ("solution", String(describing: solution)), ("solutionEntities", String(describing: solutionEntities))])
- case .inputMediaUploadedDocument(let flags, let file, let thumb, let mimeType, let attributes, let stickers, let ttlSeconds):
- return ("inputMediaUploadedDocument", [("flags", String(describing: flags)), ("file", String(describing: file)), ("thumb", String(describing: thumb)), ("mimeType", String(describing: mimeType)), ("attributes", String(describing: attributes)), ("stickers", String(describing: stickers)), ("ttlSeconds", String(describing: ttlSeconds))])
- case .inputMediaUploadedPhoto(let flags, let file, let stickers, let ttlSeconds):
- return ("inputMediaUploadedPhoto", [("flags", String(describing: flags)), ("file", String(describing: file)), ("stickers", String(describing: stickers)), ("ttlSeconds", String(describing: ttlSeconds))])
- case .inputMediaVenue(let geoPoint, let title, let address, let provider, let venueId, let venueType):
- return ("inputMediaVenue", [("geoPoint", String(describing: geoPoint)), ("title", String(describing: title)), ("address", String(describing: address)), ("provider", String(describing: provider)), ("venueId", String(describing: venueId)), ("venueType", String(describing: venueType))])
- }
- }
-
- public 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
- }
- }
- public static func parse_inputMediaDice(_ reader: BufferReader) -> InputMedia? {
- var _1: String?
- _1 = parseString(reader)
- let _c1 = _1 != nil
- if _c1 {
- return Api.InputMedia.inputMediaDice(emoticon: _1!)
- }
- else {
- return nil
- }
- }
- public static func parse_inputMediaDocument(_ reader: BufferReader) -> InputMedia? {
- var _1: Int32?
- _1 = reader.readInt32()
- var _2: Api.InputDocument?
- if let signature = reader.readInt32() {
- _2 = Api.parse(reader, signature: signature) as? Api.InputDocument
- }
- var _3: Int32?
- if Int(_1!) & Int(1 << 0) != 0 {_3 = reader.readInt32() }
- var _4: String?
- if Int(_1!) & Int(1 << 1) != 0 {_4 = parseString(reader) }
- let _c1 = _1 != nil
- let _c2 = _2 != nil
- let _c3 = (Int(_1!) & Int(1 << 0) == 0) || _3 != nil
- let _c4 = (Int(_1!) & Int(1 << 1) == 0) || _4 != nil
- if _c1 && _c2 && _c3 && _c4 {
- return Api.InputMedia.inputMediaDocument(flags: _1!, id: _2!, ttlSeconds: _3, query: _4)
- }
- else {
- return nil
- }
- }
- public static func parse_inputMediaDocumentExternal(_ reader: BufferReader) -> InputMedia? {
- var _1: Int32?
- _1 = reader.readInt32()
- var _2: String?
- _2 = parseString(reader)
- var _3: Int32?
- if Int(_1!) & Int(1 << 0) != 0 {_3 = reader.readInt32() }
- let _c1 = _1 != nil
- let _c2 = _2 != nil
- let _c3 = (Int(_1!) & Int(1 << 0) == 0) || _3 != nil
- if _c1 && _c2 && _c3 {
- return Api.InputMedia.inputMediaDocumentExternal(flags: _1!, url: _2!, ttlSeconds: _3)
- }
- else {
- return nil
- }
- }
- public static func parse_inputMediaEmpty(_ reader: BufferReader) -> InputMedia? {
- return Api.InputMedia.inputMediaEmpty
- }
- public static func parse_inputMediaGame(_ reader: BufferReader) -> InputMedia? {
- var _1: Api.InputGame?
- if let signature = reader.readInt32() {
- _1 = Api.parse(reader, signature: signature) as? Api.InputGame
- }
- let _c1 = _1 != nil
- if _c1 {
- return Api.InputMedia.inputMediaGame(id: _1!)
- }
- else {
- return nil
- }
- }
- public static func parse_inputMediaGeoLive(_ reader: BufferReader) -> InputMedia? {
- var _1: Int32?
- _1 = reader.readInt32()
- var _2: Api.InputGeoPoint?
- if let signature = reader.readInt32() {
- _2 = Api.parse(reader, signature: signature) as? Api.InputGeoPoint
- }
- var _3: Int32?
- if Int(_1!) & Int(1 << 2) != 0 {_3 = reader.readInt32() }
- var _4: Int32?
- if Int(_1!) & Int(1 << 1) != 0 {_4 = reader.readInt32() }
- var _5: Int32?
- if Int(_1!) & Int(1 << 3) != 0 {_5 = reader.readInt32() }
- let _c1 = _1 != nil
- let _c2 = _2 != nil
- let _c3 = (Int(_1!) & Int(1 << 2) == 0) || _3 != nil
- let _c4 = (Int(_1!) & Int(1 << 1) == 0) || _4 != nil
- let _c5 = (Int(_1!) & Int(1 << 3) == 0) || _5 != nil
- if _c1 && _c2 && _c3 && _c4 && _c5 {
- return Api.InputMedia.inputMediaGeoLive(flags: _1!, geoPoint: _2!, heading: _3, period: _4, proximityNotificationRadius: _5)
- }
- else {
- return nil
- }
- }
- public static func parse_inputMediaGeoPoint(_ reader: BufferReader) -> InputMedia? {
- var _1: Api.InputGeoPoint?
- if let signature = reader.readInt32() {
- _1 = Api.parse(reader, signature: signature) as? Api.InputGeoPoint
- }
- let _c1 = _1 != nil
- if _c1 {
- return Api.InputMedia.inputMediaGeoPoint(geoPoint: _1!)
- }
- else {
- return nil
- }
- }
- public static func parse_inputMediaInvoice(_ reader: BufferReader) -> InputMedia? {
- var _1: Int32?
- _1 = reader.readInt32()
- var _2: String?
- _2 = parseString(reader)
- var _3: String?
- _3 = parseString(reader)
- var _4: Api.InputWebDocument?
- if Int(_1!) & Int(1 << 0) != 0 {if let signature = reader.readInt32() {
- _4 = Api.parse(reader, signature: signature) as? Api.InputWebDocument
- } }
- var _5: Api.Invoice?
- if let signature = reader.readInt32() {
- _5 = Api.parse(reader, signature: signature) as? Api.Invoice
- }
- var _6: Buffer?
- _6 = parseBytes(reader)
- var _7: String?
- _7 = parseString(reader)
- var _8: Api.DataJSON?
- if let signature = reader.readInt32() {
- _8 = Api.parse(reader, signature: signature) as? Api.DataJSON
- }
- var _9: String?
- if Int(_1!) & Int(1 << 1) != 0 {_9 = parseString(reader) }
- let _c1 = _1 != nil
- let _c2 = _2 != nil
- let _c3 = _3 != nil
- let _c4 = (Int(_1!) & Int(1 << 0) == 0) || _4 != nil
- let _c5 = _5 != nil
- let _c6 = _6 != nil
- let _c7 = _7 != nil
- let _c8 = _8 != nil
- let _c9 = (Int(_1!) & Int(1 << 1) == 0) || _9 != nil
- if _c1 && _c2 && _c3 && _c4 && _c5 && _c6 && _c7 && _c8 && _c9 {
- return Api.InputMedia.inputMediaInvoice(flags: _1!, title: _2!, description: _3!, photo: _4, invoice: _5!, payload: _6!, provider: _7!, providerData: _8!, startParam: _9)
- }
- else {
- return nil
- }
- }
- public static func parse_inputMediaPhoto(_ reader: BufferReader) -> InputMedia? {
- var _1: Int32?
- _1 = reader.readInt32()
- var _2: Api.InputPhoto?
- if let signature = reader.readInt32() {
- _2 = Api.parse(reader, signature: signature) as? Api.InputPhoto
- }
- var _3: Int32?
- if Int(_1!) & Int(1 << 0) != 0 {_3 = reader.readInt32() }
- let _c1 = _1 != nil
- let _c2 = _2 != nil
- let _c3 = (Int(_1!) & Int(1 << 0) == 0) || _3 != nil
- if _c1 && _c2 && _c3 {
- return Api.InputMedia.inputMediaPhoto(flags: _1!, id: _2!, ttlSeconds: _3)
- }
- else {
- return nil
- }
- }
- public static func parse_inputMediaPhotoExternal(_ reader: BufferReader) -> InputMedia? {
- var _1: Int32?
- _1 = reader.readInt32()
- var _2: String?
- _2 = parseString(reader)
- var _3: Int32?
- if Int(_1!) & Int(1 << 0) != 0 {_3 = reader.readInt32() }
- let _c1 = _1 != nil
- let _c2 = _2 != nil
- let _c3 = (Int(_1!) & Int(1 << 0) == 0) || _3 != nil
- if _c1 && _c2 && _c3 {
- return Api.InputMedia.inputMediaPhotoExternal(flags: _1!, url: _2!, ttlSeconds: _3)
- }
- else {
- return nil
- }
- }
- public static func parse_inputMediaPoll(_ reader: BufferReader) -> InputMedia? {
- var _1: Int32?
- _1 = reader.readInt32()
- var _2: Api.Poll?
- if let signature = reader.readInt32() {
- _2 = Api.parse(reader, signature: signature) as? Api.Poll
- }
- var _3: [Buffer]?
- if Int(_1!) & Int(1 << 0) != 0 {if let _ = reader.readInt32() {
- _3 = Api.parseVector(reader, elementSignature: -1255641564, elementType: Buffer.self)
- } }
- var _4: String?
- if Int(_1!) & Int(1 << 1) != 0 {_4 = parseString(reader) }
- var _5: [Api.MessageEntity]?
- if Int(_1!) & Int(1 << 1) != 0 {if let _ = reader.readInt32() {
- _5 = Api.parseVector(reader, elementSignature: 0, elementType: Api.MessageEntity.self)
- } }
- let _c1 = _1 != nil
- let _c2 = _2 != nil
- let _c3 = (Int(_1!) & Int(1 << 0) == 0) || _3 != nil
- let _c4 = (Int(_1!) & Int(1 << 1) == 0) || _4 != nil
- let _c5 = (Int(_1!) & Int(1 << 1) == 0) || _5 != nil
- if _c1 && _c2 && _c3 && _c4 && _c5 {
- return Api.InputMedia.inputMediaPoll(flags: _1!, poll: _2!, correctAnswers: _3, solution: _4, solutionEntities: _5)
- }
- else {
- return nil
- }
- }
- public static func parse_inputMediaUploadedDocument(_ reader: BufferReader) -> InputMedia? {
- var _1: Int32?
- _1 = reader.readInt32()
- var _2: Api.InputFile?
- if let signature = reader.readInt32() {
- _2 = Api.parse(reader, signature: signature) as? Api.InputFile
- }
- var _3: Api.InputFile?
- if Int(_1!) & Int(1 << 2) != 0 {if let signature = reader.readInt32() {
- _3 = Api.parse(reader, signature: signature) as? Api.InputFile
- } }
- 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: [Api.InputDocument]?
- if Int(_1!) & Int(1 << 0) != 0 {if let _ = reader.readInt32() {
- _6 = Api.parseVector(reader, elementSignature: 0, elementType: Api.InputDocument.self)
- } }
- var _7: Int32?
- if Int(_1!) & Int(1 << 1) != 0 {_7 = reader.readInt32() }
- let _c1 = _1 != nil
- let _c2 = _2 != nil
- let _c3 = (Int(_1!) & Int(1 << 2) == 0) || _3 != nil
- let _c4 = _4 != nil
- let _c5 = _5 != nil
- let _c6 = (Int(_1!) & Int(1 << 0) == 0) || _6 != nil
- let _c7 = (Int(_1!) & Int(1 << 1) == 0) || _7 != nil
- if _c1 && _c2 && _c3 && _c4 && _c5 && _c6 && _c7 {
- return Api.InputMedia.inputMediaUploadedDocument(flags: _1!, file: _2!, thumb: _3, mimeType: _4!, attributes: _5!, stickers: _6, ttlSeconds: _7)
- }
- else {
- return nil
- }
- }
- public static func parse_inputMediaUploadedPhoto(_ reader: BufferReader) -> InputMedia? {
- var _1: Int32?
- _1 = reader.readInt32()
- var _2: Api.InputFile?
- if let signature = reader.readInt32() {
- _2 = Api.parse(reader, signature: signature) as? Api.InputFile
- }
- var _3: [Api.InputDocument]?
- if Int(_1!) & Int(1 << 0) != 0 {if let _ = reader.readInt32() {
- _3 = Api.parseVector(reader, elementSignature: 0, elementType: Api.InputDocument.self)
- } }
- var _4: Int32?
- if Int(_1!) & Int(1 << 1) != 0 {_4 = reader.readInt32() }
- let _c1 = _1 != nil
- let _c2 = _2 != nil
- let _c3 = (Int(_1!) & Int(1 << 0) == 0) || _3 != nil
- let _c4 = (Int(_1!) & Int(1 << 1) == 0) || _4 != nil
- if _c1 && _c2 && _c3 && _c4 {
- return Api.InputMedia.inputMediaUploadedPhoto(flags: _1!, file: _2!, stickers: _3, ttlSeconds: _4)
- }
- else {
- return nil
- }
- }
- public static func parse_inputMediaVenue(_ reader: BufferReader) -> InputMedia? {
- var _1: Api.InputGeoPoint?
- if let signature = reader.readInt32() {
- _1 = Api.parse(reader, signature: signature) as? Api.InputGeoPoint
- }
- 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: String?
- _6 = parseString(reader)
- 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.InputMedia.inputMediaVenue(geoPoint: _1!, title: _2!, address: _3!, provider: _4!, venueId: _5!, venueType: _6!)
- }
- else {
- return nil
- }
- }
-
- }
-}
diff --git a/submodules/TelegramApi/Sources/Api8.swift b/submodules/TelegramApi/Sources/Api8.swift
index 67d9f486fc..1362907e19 100644
--- a/submodules/TelegramApi/Sources/Api8.swift
+++ b/submodules/TelegramApi/Sources/Api8.swift
@@ -1,3 +1,637 @@
+public extension Api {
+ enum InputGroupCall: TypeConstructorDescription {
+ case inputGroupCall(id: Int64, accessHash: Int64)
+
+ public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
+ switch self {
+ case .inputGroupCall(let id, let accessHash):
+ if boxed {
+ buffer.appendInt32(-659913713)
+ }
+ serializeInt64(id, buffer: buffer, boxed: false)
+ serializeInt64(accessHash, buffer: buffer, boxed: false)
+ break
+ }
+ }
+
+ public func descriptionFields() -> (String, [(String, Any)]) {
+ switch self {
+ case .inputGroupCall(let id, let accessHash):
+ return ("inputGroupCall", [("id", String(describing: id)), ("accessHash", String(describing: accessHash))])
+ }
+ }
+
+ public static func parse_inputGroupCall(_ reader: BufferReader) -> InputGroupCall? {
+ var _1: Int64?
+ _1 = reader.readInt64()
+ var _2: Int64?
+ _2 = reader.readInt64()
+ let _c1 = _1 != nil
+ let _c2 = _2 != nil
+ if _c1 && _c2 {
+ return Api.InputGroupCall.inputGroupCall(id: _1!, accessHash: _2!)
+ }
+ else {
+ return nil
+ }
+ }
+
+ }
+}
+public extension Api {
+ enum InputInvoice: TypeConstructorDescription {
+ case inputInvoiceMessage(peer: Api.InputPeer, msgId: Int32)
+ case inputInvoiceSlug(slug: String)
+
+ public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
+ switch self {
+ case .inputInvoiceMessage(let peer, let msgId):
+ if boxed {
+ buffer.appendInt32(-977967015)
+ }
+ peer.serialize(buffer, true)
+ serializeInt32(msgId, buffer: buffer, boxed: false)
+ break
+ case .inputInvoiceSlug(let slug):
+ if boxed {
+ buffer.appendInt32(-1020867857)
+ }
+ serializeString(slug, buffer: buffer, boxed: false)
+ break
+ }
+ }
+
+ public func descriptionFields() -> (String, [(String, Any)]) {
+ switch self {
+ case .inputInvoiceMessage(let peer, let msgId):
+ return ("inputInvoiceMessage", [("peer", String(describing: peer)), ("msgId", String(describing: msgId))])
+ case .inputInvoiceSlug(let slug):
+ return ("inputInvoiceSlug", [("slug", String(describing: slug))])
+ }
+ }
+
+ public static func parse_inputInvoiceMessage(_ reader: BufferReader) -> InputInvoice? {
+ var _1: Api.InputPeer?
+ if let signature = reader.readInt32() {
+ _1 = Api.parse(reader, signature: signature) as? Api.InputPeer
+ }
+ var _2: Int32?
+ _2 = reader.readInt32()
+ let _c1 = _1 != nil
+ let _c2 = _2 != nil
+ if _c1 && _c2 {
+ return Api.InputInvoice.inputInvoiceMessage(peer: _1!, msgId: _2!)
+ }
+ else {
+ return nil
+ }
+ }
+ public static func parse_inputInvoiceSlug(_ reader: BufferReader) -> InputInvoice? {
+ var _1: String?
+ _1 = parseString(reader)
+ let _c1 = _1 != nil
+ if _c1 {
+ return Api.InputInvoice.inputInvoiceSlug(slug: _1!)
+ }
+ else {
+ return nil
+ }
+ }
+
+ }
+}
+public extension Api {
+ enum InputMedia: TypeConstructorDescription {
+ case inputMediaContact(phoneNumber: String, firstName: String, lastName: String, vcard: String)
+ case inputMediaDice(emoticon: String)
+ case inputMediaDocument(flags: Int32, id: Api.InputDocument, ttlSeconds: Int32?, query: String?)
+ case inputMediaDocumentExternal(flags: Int32, url: String, ttlSeconds: Int32?)
+ case inputMediaEmpty
+ case inputMediaGame(id: Api.InputGame)
+ case inputMediaGeoLive(flags: Int32, geoPoint: Api.InputGeoPoint, heading: Int32?, period: Int32?, proximityNotificationRadius: Int32?)
+ case inputMediaGeoPoint(geoPoint: Api.InputGeoPoint)
+ case inputMediaInvoice(flags: Int32, title: String, description: String, photo: Api.InputWebDocument?, invoice: Api.Invoice, payload: Buffer, provider: String, providerData: Api.DataJSON, startParam: String?)
+ case inputMediaPhoto(flags: Int32, id: Api.InputPhoto, ttlSeconds: Int32?)
+ case inputMediaPhotoExternal(flags: Int32, url: String, ttlSeconds: Int32?)
+ case inputMediaPoll(flags: Int32, poll: Api.Poll, correctAnswers: [Buffer]?, solution: String?, solutionEntities: [Api.MessageEntity]?)
+ case inputMediaUploadedDocument(flags: Int32, file: Api.InputFile, thumb: Api.InputFile?, mimeType: String, attributes: [Api.DocumentAttribute], stickers: [Api.InputDocument]?, ttlSeconds: Int32?)
+ case inputMediaUploadedPhoto(flags: Int32, file: Api.InputFile, stickers: [Api.InputDocument]?, ttlSeconds: Int32?)
+ case inputMediaVenue(geoPoint: Api.InputGeoPoint, title: String, address: String, provider: String, venueId: String, venueType: String)
+
+ public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
+ switch self {
+ 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
+ case .inputMediaDice(let emoticon):
+ if boxed {
+ buffer.appendInt32(-428884101)
+ }
+ serializeString(emoticon, buffer: buffer, boxed: false)
+ break
+ case .inputMediaDocument(let flags, let id, let ttlSeconds, let query):
+ if boxed {
+ buffer.appendInt32(860303448)
+ }
+ serializeInt32(flags, buffer: buffer, boxed: false)
+ id.serialize(buffer, true)
+ if Int(flags) & Int(1 << 0) != 0 {serializeInt32(ttlSeconds!, buffer: buffer, boxed: false)}
+ if Int(flags) & Int(1 << 1) != 0 {serializeString(query!, buffer: buffer, boxed: false)}
+ break
+ case .inputMediaDocumentExternal(let flags, let url, let ttlSeconds):
+ if boxed {
+ buffer.appendInt32(-78455655)
+ }
+ serializeInt32(flags, buffer: buffer, boxed: false)
+ serializeString(url, buffer: buffer, boxed: false)
+ if Int(flags) & Int(1 << 0) != 0 {serializeInt32(ttlSeconds!, buffer: buffer, boxed: false)}
+ break
+ case .inputMediaEmpty:
+ if boxed {
+ buffer.appendInt32(-1771768449)
+ }
+
+ break
+ case .inputMediaGame(let id):
+ if boxed {
+ buffer.appendInt32(-750828557)
+ }
+ id.serialize(buffer, true)
+ break
+ case .inputMediaGeoLive(let flags, let geoPoint, let heading, let period, let proximityNotificationRadius):
+ if boxed {
+ buffer.appendInt32(-1759532989)
+ }
+ serializeInt32(flags, buffer: buffer, boxed: false)
+ geoPoint.serialize(buffer, true)
+ if Int(flags) & Int(1 << 2) != 0 {serializeInt32(heading!, buffer: buffer, boxed: false)}
+ if Int(flags) & Int(1 << 1) != 0 {serializeInt32(period!, buffer: buffer, boxed: false)}
+ if Int(flags) & Int(1 << 3) != 0 {serializeInt32(proximityNotificationRadius!, buffer: buffer, boxed: false)}
+ break
+ case .inputMediaGeoPoint(let geoPoint):
+ if boxed {
+ buffer.appendInt32(-104578748)
+ }
+ geoPoint.serialize(buffer, true)
+ break
+ case .inputMediaInvoice(let flags, let title, let description, let photo, let invoice, let payload, let provider, let providerData, let startParam):
+ if boxed {
+ buffer.appendInt32(-646342540)
+ }
+ serializeInt32(flags, buffer: buffer, boxed: false)
+ serializeString(title, buffer: buffer, boxed: false)
+ serializeString(description, buffer: buffer, boxed: false)
+ if Int(flags) & Int(1 << 0) != 0 {photo!.serialize(buffer, true)}
+ invoice.serialize(buffer, true)
+ serializeBytes(payload, buffer: buffer, boxed: false)
+ serializeString(provider, buffer: buffer, boxed: false)
+ providerData.serialize(buffer, true)
+ if Int(flags) & Int(1 << 1) != 0 {serializeString(startParam!, buffer: buffer, boxed: false)}
+ break
+ case .inputMediaPhoto(let flags, let id, let ttlSeconds):
+ if boxed {
+ buffer.appendInt32(-1279654347)
+ }
+ serializeInt32(flags, buffer: buffer, boxed: false)
+ id.serialize(buffer, true)
+ if Int(flags) & Int(1 << 0) != 0 {serializeInt32(ttlSeconds!, buffer: buffer, boxed: false)}
+ break
+ case .inputMediaPhotoExternal(let flags, let url, let ttlSeconds):
+ if boxed {
+ buffer.appendInt32(-440664550)
+ }
+ serializeInt32(flags, buffer: buffer, boxed: false)
+ serializeString(url, buffer: buffer, boxed: false)
+ if Int(flags) & Int(1 << 0) != 0 {serializeInt32(ttlSeconds!, buffer: buffer, boxed: false)}
+ break
+ case .inputMediaPoll(let flags, let poll, let correctAnswers, let solution, let solutionEntities):
+ if boxed {
+ buffer.appendInt32(261416433)
+ }
+ serializeInt32(flags, buffer: buffer, boxed: false)
+ poll.serialize(buffer, true)
+ if Int(flags) & Int(1 << 0) != 0 {buffer.appendInt32(481674261)
+ buffer.appendInt32(Int32(correctAnswers!.count))
+ for item in correctAnswers! {
+ serializeBytes(item, buffer: buffer, boxed: false)
+ }}
+ if Int(flags) & Int(1 << 1) != 0 {serializeString(solution!, buffer: buffer, boxed: false)}
+ if Int(flags) & Int(1 << 1) != 0 {buffer.appendInt32(481674261)
+ buffer.appendInt32(Int32(solutionEntities!.count))
+ for item in solutionEntities! {
+ item.serialize(buffer, true)
+ }}
+ break
+ case .inputMediaUploadedDocument(let flags, let file, let thumb, let mimeType, let attributes, let stickers, let ttlSeconds):
+ if boxed {
+ buffer.appendInt32(1530447553)
+ }
+ serializeInt32(flags, buffer: buffer, boxed: false)
+ file.serialize(buffer, true)
+ if Int(flags) & Int(1 << 2) != 0 {thumb!.serialize(buffer, true)}
+ serializeString(mimeType, buffer: buffer, boxed: false)
+ buffer.appendInt32(481674261)
+ buffer.appendInt32(Int32(attributes.count))
+ for item in attributes {
+ item.serialize(buffer, true)
+ }
+ if Int(flags) & Int(1 << 0) != 0 {buffer.appendInt32(481674261)
+ buffer.appendInt32(Int32(stickers!.count))
+ for item in stickers! {
+ item.serialize(buffer, true)
+ }}
+ if Int(flags) & Int(1 << 1) != 0 {serializeInt32(ttlSeconds!, buffer: buffer, boxed: false)}
+ break
+ case .inputMediaUploadedPhoto(let flags, let file, let stickers, let ttlSeconds):
+ if boxed {
+ buffer.appendInt32(505969924)
+ }
+ serializeInt32(flags, buffer: buffer, boxed: false)
+ file.serialize(buffer, true)
+ if Int(flags) & Int(1 << 0) != 0 {buffer.appendInt32(481674261)
+ buffer.appendInt32(Int32(stickers!.count))
+ for item in stickers! {
+ item.serialize(buffer, true)
+ }}
+ if Int(flags) & Int(1 << 1) != 0 {serializeInt32(ttlSeconds!, buffer: buffer, boxed: false)}
+ break
+ case .inputMediaVenue(let geoPoint, let title, let address, let provider, let venueId, let venueType):
+ if boxed {
+ buffer.appendInt32(-1052959727)
+ }
+ geoPoint.serialize(buffer, true)
+ serializeString(title, buffer: buffer, boxed: false)
+ serializeString(address, buffer: buffer, boxed: false)
+ serializeString(provider, buffer: buffer, boxed: false)
+ serializeString(venueId, buffer: buffer, boxed: false)
+ serializeString(venueType, buffer: buffer, boxed: false)
+ break
+ }
+ }
+
+ public func descriptionFields() -> (String, [(String, Any)]) {
+ switch self {
+ case .inputMediaContact(let phoneNumber, let firstName, let lastName, let vcard):
+ return ("inputMediaContact", [("phoneNumber", String(describing: phoneNumber)), ("firstName", String(describing: firstName)), ("lastName", String(describing: lastName)), ("vcard", String(describing: vcard))])
+ case .inputMediaDice(let emoticon):
+ return ("inputMediaDice", [("emoticon", String(describing: emoticon))])
+ case .inputMediaDocument(let flags, let id, let ttlSeconds, let query):
+ return ("inputMediaDocument", [("flags", String(describing: flags)), ("id", String(describing: id)), ("ttlSeconds", String(describing: ttlSeconds)), ("query", String(describing: query))])
+ case .inputMediaDocumentExternal(let flags, let url, let ttlSeconds):
+ return ("inputMediaDocumentExternal", [("flags", String(describing: flags)), ("url", String(describing: url)), ("ttlSeconds", String(describing: ttlSeconds))])
+ case .inputMediaEmpty:
+ return ("inputMediaEmpty", [])
+ case .inputMediaGame(let id):
+ return ("inputMediaGame", [("id", String(describing: id))])
+ case .inputMediaGeoLive(let flags, let geoPoint, let heading, let period, let proximityNotificationRadius):
+ return ("inputMediaGeoLive", [("flags", String(describing: flags)), ("geoPoint", String(describing: geoPoint)), ("heading", String(describing: heading)), ("period", String(describing: period)), ("proximityNotificationRadius", String(describing: proximityNotificationRadius))])
+ case .inputMediaGeoPoint(let geoPoint):
+ return ("inputMediaGeoPoint", [("geoPoint", String(describing: geoPoint))])
+ case .inputMediaInvoice(let flags, let title, let description, let photo, let invoice, let payload, let provider, let providerData, let startParam):
+ return ("inputMediaInvoice", [("flags", String(describing: flags)), ("title", String(describing: title)), ("description", String(describing: description)), ("photo", String(describing: photo)), ("invoice", String(describing: invoice)), ("payload", String(describing: payload)), ("provider", String(describing: provider)), ("providerData", String(describing: providerData)), ("startParam", String(describing: startParam))])
+ case .inputMediaPhoto(let flags, let id, let ttlSeconds):
+ return ("inputMediaPhoto", [("flags", String(describing: flags)), ("id", String(describing: id)), ("ttlSeconds", String(describing: ttlSeconds))])
+ case .inputMediaPhotoExternal(let flags, let url, let ttlSeconds):
+ return ("inputMediaPhotoExternal", [("flags", String(describing: flags)), ("url", String(describing: url)), ("ttlSeconds", String(describing: ttlSeconds))])
+ case .inputMediaPoll(let flags, let poll, let correctAnswers, let solution, let solutionEntities):
+ return ("inputMediaPoll", [("flags", String(describing: flags)), ("poll", String(describing: poll)), ("correctAnswers", String(describing: correctAnswers)), ("solution", String(describing: solution)), ("solutionEntities", String(describing: solutionEntities))])
+ case .inputMediaUploadedDocument(let flags, let file, let thumb, let mimeType, let attributes, let stickers, let ttlSeconds):
+ return ("inputMediaUploadedDocument", [("flags", String(describing: flags)), ("file", String(describing: file)), ("thumb", String(describing: thumb)), ("mimeType", String(describing: mimeType)), ("attributes", String(describing: attributes)), ("stickers", String(describing: stickers)), ("ttlSeconds", String(describing: ttlSeconds))])
+ case .inputMediaUploadedPhoto(let flags, let file, let stickers, let ttlSeconds):
+ return ("inputMediaUploadedPhoto", [("flags", String(describing: flags)), ("file", String(describing: file)), ("stickers", String(describing: stickers)), ("ttlSeconds", String(describing: ttlSeconds))])
+ case .inputMediaVenue(let geoPoint, let title, let address, let provider, let venueId, let venueType):
+ return ("inputMediaVenue", [("geoPoint", String(describing: geoPoint)), ("title", String(describing: title)), ("address", String(describing: address)), ("provider", String(describing: provider)), ("venueId", String(describing: venueId)), ("venueType", String(describing: venueType))])
+ }
+ }
+
+ public 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
+ }
+ }
+ public static func parse_inputMediaDice(_ reader: BufferReader) -> InputMedia? {
+ var _1: String?
+ _1 = parseString(reader)
+ let _c1 = _1 != nil
+ if _c1 {
+ return Api.InputMedia.inputMediaDice(emoticon: _1!)
+ }
+ else {
+ return nil
+ }
+ }
+ public static func parse_inputMediaDocument(_ reader: BufferReader) -> InputMedia? {
+ var _1: Int32?
+ _1 = reader.readInt32()
+ var _2: Api.InputDocument?
+ if let signature = reader.readInt32() {
+ _2 = Api.parse(reader, signature: signature) as? Api.InputDocument
+ }
+ var _3: Int32?
+ if Int(_1!) & Int(1 << 0) != 0 {_3 = reader.readInt32() }
+ var _4: String?
+ if Int(_1!) & Int(1 << 1) != 0 {_4 = parseString(reader) }
+ let _c1 = _1 != nil
+ let _c2 = _2 != nil
+ let _c3 = (Int(_1!) & Int(1 << 0) == 0) || _3 != nil
+ let _c4 = (Int(_1!) & Int(1 << 1) == 0) || _4 != nil
+ if _c1 && _c2 && _c3 && _c4 {
+ return Api.InputMedia.inputMediaDocument(flags: _1!, id: _2!, ttlSeconds: _3, query: _4)
+ }
+ else {
+ return nil
+ }
+ }
+ public static func parse_inputMediaDocumentExternal(_ reader: BufferReader) -> InputMedia? {
+ var _1: Int32?
+ _1 = reader.readInt32()
+ var _2: String?
+ _2 = parseString(reader)
+ var _3: Int32?
+ if Int(_1!) & Int(1 << 0) != 0 {_3 = reader.readInt32() }
+ let _c1 = _1 != nil
+ let _c2 = _2 != nil
+ let _c3 = (Int(_1!) & Int(1 << 0) == 0) || _3 != nil
+ if _c1 && _c2 && _c3 {
+ return Api.InputMedia.inputMediaDocumentExternal(flags: _1!, url: _2!, ttlSeconds: _3)
+ }
+ else {
+ return nil
+ }
+ }
+ public static func parse_inputMediaEmpty(_ reader: BufferReader) -> InputMedia? {
+ return Api.InputMedia.inputMediaEmpty
+ }
+ public static func parse_inputMediaGame(_ reader: BufferReader) -> InputMedia? {
+ var _1: Api.InputGame?
+ if let signature = reader.readInt32() {
+ _1 = Api.parse(reader, signature: signature) as? Api.InputGame
+ }
+ let _c1 = _1 != nil
+ if _c1 {
+ return Api.InputMedia.inputMediaGame(id: _1!)
+ }
+ else {
+ return nil
+ }
+ }
+ public static func parse_inputMediaGeoLive(_ reader: BufferReader) -> InputMedia? {
+ var _1: Int32?
+ _1 = reader.readInt32()
+ var _2: Api.InputGeoPoint?
+ if let signature = reader.readInt32() {
+ _2 = Api.parse(reader, signature: signature) as? Api.InputGeoPoint
+ }
+ var _3: Int32?
+ if Int(_1!) & Int(1 << 2) != 0 {_3 = reader.readInt32() }
+ var _4: Int32?
+ if Int(_1!) & Int(1 << 1) != 0 {_4 = reader.readInt32() }
+ var _5: Int32?
+ if Int(_1!) & Int(1 << 3) != 0 {_5 = reader.readInt32() }
+ let _c1 = _1 != nil
+ let _c2 = _2 != nil
+ let _c3 = (Int(_1!) & Int(1 << 2) == 0) || _3 != nil
+ let _c4 = (Int(_1!) & Int(1 << 1) == 0) || _4 != nil
+ let _c5 = (Int(_1!) & Int(1 << 3) == 0) || _5 != nil
+ if _c1 && _c2 && _c3 && _c4 && _c5 {
+ return Api.InputMedia.inputMediaGeoLive(flags: _1!, geoPoint: _2!, heading: _3, period: _4, proximityNotificationRadius: _5)
+ }
+ else {
+ return nil
+ }
+ }
+ public static func parse_inputMediaGeoPoint(_ reader: BufferReader) -> InputMedia? {
+ var _1: Api.InputGeoPoint?
+ if let signature = reader.readInt32() {
+ _1 = Api.parse(reader, signature: signature) as? Api.InputGeoPoint
+ }
+ let _c1 = _1 != nil
+ if _c1 {
+ return Api.InputMedia.inputMediaGeoPoint(geoPoint: _1!)
+ }
+ else {
+ return nil
+ }
+ }
+ public static func parse_inputMediaInvoice(_ reader: BufferReader) -> InputMedia? {
+ var _1: Int32?
+ _1 = reader.readInt32()
+ var _2: String?
+ _2 = parseString(reader)
+ var _3: String?
+ _3 = parseString(reader)
+ var _4: Api.InputWebDocument?
+ if Int(_1!) & Int(1 << 0) != 0 {if let signature = reader.readInt32() {
+ _4 = Api.parse(reader, signature: signature) as? Api.InputWebDocument
+ } }
+ var _5: Api.Invoice?
+ if let signature = reader.readInt32() {
+ _5 = Api.parse(reader, signature: signature) as? Api.Invoice
+ }
+ var _6: Buffer?
+ _6 = parseBytes(reader)
+ var _7: String?
+ _7 = parseString(reader)
+ var _8: Api.DataJSON?
+ if let signature = reader.readInt32() {
+ _8 = Api.parse(reader, signature: signature) as? Api.DataJSON
+ }
+ var _9: String?
+ if Int(_1!) & Int(1 << 1) != 0 {_9 = parseString(reader) }
+ let _c1 = _1 != nil
+ let _c2 = _2 != nil
+ let _c3 = _3 != nil
+ let _c4 = (Int(_1!) & Int(1 << 0) == 0) || _4 != nil
+ let _c5 = _5 != nil
+ let _c6 = _6 != nil
+ let _c7 = _7 != nil
+ let _c8 = _8 != nil
+ let _c9 = (Int(_1!) & Int(1 << 1) == 0) || _9 != nil
+ if _c1 && _c2 && _c3 && _c4 && _c5 && _c6 && _c7 && _c8 && _c9 {
+ return Api.InputMedia.inputMediaInvoice(flags: _1!, title: _2!, description: _3!, photo: _4, invoice: _5!, payload: _6!, provider: _7!, providerData: _8!, startParam: _9)
+ }
+ else {
+ return nil
+ }
+ }
+ public static func parse_inputMediaPhoto(_ reader: BufferReader) -> InputMedia? {
+ var _1: Int32?
+ _1 = reader.readInt32()
+ var _2: Api.InputPhoto?
+ if let signature = reader.readInt32() {
+ _2 = Api.parse(reader, signature: signature) as? Api.InputPhoto
+ }
+ var _3: Int32?
+ if Int(_1!) & Int(1 << 0) != 0 {_3 = reader.readInt32() }
+ let _c1 = _1 != nil
+ let _c2 = _2 != nil
+ let _c3 = (Int(_1!) & Int(1 << 0) == 0) || _3 != nil
+ if _c1 && _c2 && _c3 {
+ return Api.InputMedia.inputMediaPhoto(flags: _1!, id: _2!, ttlSeconds: _3)
+ }
+ else {
+ return nil
+ }
+ }
+ public static func parse_inputMediaPhotoExternal(_ reader: BufferReader) -> InputMedia? {
+ var _1: Int32?
+ _1 = reader.readInt32()
+ var _2: String?
+ _2 = parseString(reader)
+ var _3: Int32?
+ if Int(_1!) & Int(1 << 0) != 0 {_3 = reader.readInt32() }
+ let _c1 = _1 != nil
+ let _c2 = _2 != nil
+ let _c3 = (Int(_1!) & Int(1 << 0) == 0) || _3 != nil
+ if _c1 && _c2 && _c3 {
+ return Api.InputMedia.inputMediaPhotoExternal(flags: _1!, url: _2!, ttlSeconds: _3)
+ }
+ else {
+ return nil
+ }
+ }
+ public static func parse_inputMediaPoll(_ reader: BufferReader) -> InputMedia? {
+ var _1: Int32?
+ _1 = reader.readInt32()
+ var _2: Api.Poll?
+ if let signature = reader.readInt32() {
+ _2 = Api.parse(reader, signature: signature) as? Api.Poll
+ }
+ var _3: [Buffer]?
+ if Int(_1!) & Int(1 << 0) != 0 {if let _ = reader.readInt32() {
+ _3 = Api.parseVector(reader, elementSignature: -1255641564, elementType: Buffer.self)
+ } }
+ var _4: String?
+ if Int(_1!) & Int(1 << 1) != 0 {_4 = parseString(reader) }
+ var _5: [Api.MessageEntity]?
+ if Int(_1!) & Int(1 << 1) != 0 {if let _ = reader.readInt32() {
+ _5 = Api.parseVector(reader, elementSignature: 0, elementType: Api.MessageEntity.self)
+ } }
+ let _c1 = _1 != nil
+ let _c2 = _2 != nil
+ let _c3 = (Int(_1!) & Int(1 << 0) == 0) || _3 != nil
+ let _c4 = (Int(_1!) & Int(1 << 1) == 0) || _4 != nil
+ let _c5 = (Int(_1!) & Int(1 << 1) == 0) || _5 != nil
+ if _c1 && _c2 && _c3 && _c4 && _c5 {
+ return Api.InputMedia.inputMediaPoll(flags: _1!, poll: _2!, correctAnswers: _3, solution: _4, solutionEntities: _5)
+ }
+ else {
+ return nil
+ }
+ }
+ public static func parse_inputMediaUploadedDocument(_ reader: BufferReader) -> InputMedia? {
+ var _1: Int32?
+ _1 = reader.readInt32()
+ var _2: Api.InputFile?
+ if let signature = reader.readInt32() {
+ _2 = Api.parse(reader, signature: signature) as? Api.InputFile
+ }
+ var _3: Api.InputFile?
+ if Int(_1!) & Int(1 << 2) != 0 {if let signature = reader.readInt32() {
+ _3 = Api.parse(reader, signature: signature) as? Api.InputFile
+ } }
+ 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: [Api.InputDocument]?
+ if Int(_1!) & Int(1 << 0) != 0 {if let _ = reader.readInt32() {
+ _6 = Api.parseVector(reader, elementSignature: 0, elementType: Api.InputDocument.self)
+ } }
+ var _7: Int32?
+ if Int(_1!) & Int(1 << 1) != 0 {_7 = reader.readInt32() }
+ let _c1 = _1 != nil
+ let _c2 = _2 != nil
+ let _c3 = (Int(_1!) & Int(1 << 2) == 0) || _3 != nil
+ let _c4 = _4 != nil
+ let _c5 = _5 != nil
+ let _c6 = (Int(_1!) & Int(1 << 0) == 0) || _6 != nil
+ let _c7 = (Int(_1!) & Int(1 << 1) == 0) || _7 != nil
+ if _c1 && _c2 && _c3 && _c4 && _c5 && _c6 && _c7 {
+ return Api.InputMedia.inputMediaUploadedDocument(flags: _1!, file: _2!, thumb: _3, mimeType: _4!, attributes: _5!, stickers: _6, ttlSeconds: _7)
+ }
+ else {
+ return nil
+ }
+ }
+ public static func parse_inputMediaUploadedPhoto(_ reader: BufferReader) -> InputMedia? {
+ var _1: Int32?
+ _1 = reader.readInt32()
+ var _2: Api.InputFile?
+ if let signature = reader.readInt32() {
+ _2 = Api.parse(reader, signature: signature) as? Api.InputFile
+ }
+ var _3: [Api.InputDocument]?
+ if Int(_1!) & Int(1 << 0) != 0 {if let _ = reader.readInt32() {
+ _3 = Api.parseVector(reader, elementSignature: 0, elementType: Api.InputDocument.self)
+ } }
+ var _4: Int32?
+ if Int(_1!) & Int(1 << 1) != 0 {_4 = reader.readInt32() }
+ let _c1 = _1 != nil
+ let _c2 = _2 != nil
+ let _c3 = (Int(_1!) & Int(1 << 0) == 0) || _3 != nil
+ let _c4 = (Int(_1!) & Int(1 << 1) == 0) || _4 != nil
+ if _c1 && _c2 && _c3 && _c4 {
+ return Api.InputMedia.inputMediaUploadedPhoto(flags: _1!, file: _2!, stickers: _3, ttlSeconds: _4)
+ }
+ else {
+ return nil
+ }
+ }
+ public static func parse_inputMediaVenue(_ reader: BufferReader) -> InputMedia? {
+ var _1: Api.InputGeoPoint?
+ if let signature = reader.readInt32() {
+ _1 = Api.parse(reader, signature: signature) as? Api.InputGeoPoint
+ }
+ 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: String?
+ _6 = parseString(reader)
+ 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.InputMedia.inputMediaVenue(geoPoint: _1!, title: _2!, address: _3!, provider: _4!, venueId: _5!, venueType: _6!)
+ }
+ else {
+ return nil
+ }
+ }
+
+ }
+}
public extension Api {
enum InputMessage: TypeConstructorDescription {
case inputMessageCallbackQuery(id: Int32, queryId: Int64)
@@ -442,281 +1076,3 @@ public extension Api {
}
}
-public extension Api {
- enum InputPeerNotifySettings: TypeConstructorDescription {
- case inputPeerNotifySettings(flags: Int32, showPreviews: Api.Bool?, silent: Api.Bool?, muteUntil: Int32?, sound: Api.NotificationSound?)
-
- public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
- switch self {
- case .inputPeerNotifySettings(let flags, let showPreviews, let silent, let muteUntil, let sound):
- if boxed {
- buffer.appendInt32(-551616469)
- }
- serializeInt32(flags, buffer: buffer, boxed: false)
- if Int(flags) & Int(1 << 0) != 0 {showPreviews!.serialize(buffer, true)}
- if Int(flags) & Int(1 << 1) != 0 {silent!.serialize(buffer, true)}
- if Int(flags) & Int(1 << 2) != 0 {serializeInt32(muteUntil!, buffer: buffer, boxed: false)}
- if Int(flags) & Int(1 << 3) != 0 {sound!.serialize(buffer, true)}
- break
- }
- }
-
- public func descriptionFields() -> (String, [(String, Any)]) {
- switch self {
- case .inputPeerNotifySettings(let flags, let showPreviews, let silent, let muteUntil, let sound):
- return ("inputPeerNotifySettings", [("flags", String(describing: flags)), ("showPreviews", String(describing: showPreviews)), ("silent", String(describing: silent)), ("muteUntil", String(describing: muteUntil)), ("sound", String(describing: sound))])
- }
- }
-
- public static func parse_inputPeerNotifySettings(_ reader: BufferReader) -> InputPeerNotifySettings? {
- var _1: Int32?
- _1 = reader.readInt32()
- var _2: Api.Bool?
- if Int(_1!) & Int(1 << 0) != 0 {if let signature = reader.readInt32() {
- _2 = Api.parse(reader, signature: signature) as? Api.Bool
- } }
- var _3: Api.Bool?
- if Int(_1!) & Int(1 << 1) != 0 {if let signature = reader.readInt32() {
- _3 = Api.parse(reader, signature: signature) as? Api.Bool
- } }
- var _4: Int32?
- if Int(_1!) & Int(1 << 2) != 0 {_4 = reader.readInt32() }
- var _5: Api.NotificationSound?
- if Int(_1!) & Int(1 << 3) != 0 {if let signature = reader.readInt32() {
- _5 = Api.parse(reader, signature: signature) as? Api.NotificationSound
- } }
- let _c1 = _1 != nil
- let _c2 = (Int(_1!) & Int(1 << 0) == 0) || _2 != nil
- let _c3 = (Int(_1!) & Int(1 << 1) == 0) || _3 != nil
- let _c4 = (Int(_1!) & Int(1 << 2) == 0) || _4 != nil
- let _c5 = (Int(_1!) & Int(1 << 3) == 0) || _5 != nil
- if _c1 && _c2 && _c3 && _c4 && _c5 {
- return Api.InputPeerNotifySettings.inputPeerNotifySettings(flags: _1!, showPreviews: _2, silent: _3, muteUntil: _4, sound: _5)
- }
- else {
- return nil
- }
- }
-
- }
-}
-public extension Api {
- enum InputPhoneCall: TypeConstructorDescription {
- case inputPhoneCall(id: Int64, accessHash: Int64)
-
- public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
- switch self {
- case .inputPhoneCall(let id, let accessHash):
- if boxed {
- buffer.appendInt32(506920429)
- }
- serializeInt64(id, buffer: buffer, boxed: false)
- serializeInt64(accessHash, buffer: buffer, boxed: false)
- break
- }
- }
-
- public func descriptionFields() -> (String, [(String, Any)]) {
- switch self {
- case .inputPhoneCall(let id, let accessHash):
- return ("inputPhoneCall", [("id", String(describing: id)), ("accessHash", String(describing: accessHash))])
- }
- }
-
- public static func parse_inputPhoneCall(_ reader: BufferReader) -> InputPhoneCall? {
- var _1: Int64?
- _1 = reader.readInt64()
- var _2: Int64?
- _2 = reader.readInt64()
- let _c1 = _1 != nil
- let _c2 = _2 != nil
- if _c1 && _c2 {
- return Api.InputPhoneCall.inputPhoneCall(id: _1!, accessHash: _2!)
- }
- else {
- return nil
- }
- }
-
- }
-}
-public extension Api {
- enum InputPhoto: TypeConstructorDescription {
- case inputPhoto(id: Int64, accessHash: Int64, fileReference: Buffer)
- case inputPhotoEmpty
-
- public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
- switch self {
- case .inputPhoto(let id, let accessHash, let fileReference):
- if boxed {
- buffer.appendInt32(1001634122)
- }
- serializeInt64(id, buffer: buffer, boxed: false)
- serializeInt64(accessHash, buffer: buffer, boxed: false)
- serializeBytes(fileReference, buffer: buffer, boxed: false)
- break
- case .inputPhotoEmpty:
- if boxed {
- buffer.appendInt32(483901197)
- }
-
- break
- }
- }
-
- public func descriptionFields() -> (String, [(String, Any)]) {
- switch self {
- case .inputPhoto(let id, let accessHash, let fileReference):
- return ("inputPhoto", [("id", String(describing: id)), ("accessHash", String(describing: accessHash)), ("fileReference", String(describing: fileReference))])
- case .inputPhotoEmpty:
- return ("inputPhotoEmpty", [])
- }
- }
-
- public static func parse_inputPhoto(_ reader: BufferReader) -> InputPhoto? {
- var _1: Int64?
- _1 = reader.readInt64()
- var _2: Int64?
- _2 = reader.readInt64()
- var _3: Buffer?
- _3 = parseBytes(reader)
- let _c1 = _1 != nil
- let _c2 = _2 != nil
- let _c3 = _3 != nil
- if _c1 && _c2 && _c3 {
- return Api.InputPhoto.inputPhoto(id: _1!, accessHash: _2!, fileReference: _3!)
- }
- else {
- return nil
- }
- }
- public static func parse_inputPhotoEmpty(_ reader: BufferReader) -> InputPhoto? {
- return Api.InputPhoto.inputPhotoEmpty
- }
-
- }
-}
-public extension Api {
- enum InputPrivacyKey: TypeConstructorDescription {
- case inputPrivacyKeyAddedByPhone
- case inputPrivacyKeyChatInvite
- case inputPrivacyKeyForwards
- case inputPrivacyKeyPhoneCall
- case inputPrivacyKeyPhoneNumber
- case inputPrivacyKeyPhoneP2P
- case inputPrivacyKeyProfilePhoto
- case inputPrivacyKeyStatusTimestamp
- case inputPrivacyKeyVoiceMessages
-
- public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
- switch self {
- case .inputPrivacyKeyAddedByPhone:
- if boxed {
- buffer.appendInt32(-786326563)
- }
-
- break
- case .inputPrivacyKeyChatInvite:
- if boxed {
- buffer.appendInt32(-1107622874)
- }
-
- break
- case .inputPrivacyKeyForwards:
- if boxed {
- buffer.appendInt32(-1529000952)
- }
-
- break
- case .inputPrivacyKeyPhoneCall:
- if boxed {
- buffer.appendInt32(-88417185)
- }
-
- break
- case .inputPrivacyKeyPhoneNumber:
- if boxed {
- buffer.appendInt32(55761658)
- }
-
- break
- case .inputPrivacyKeyPhoneP2P:
- if boxed {
- buffer.appendInt32(-610373422)
- }
-
- break
- case .inputPrivacyKeyProfilePhoto:
- if boxed {
- buffer.appendInt32(1461304012)
- }
-
- break
- case .inputPrivacyKeyStatusTimestamp:
- if boxed {
- buffer.appendInt32(1335282456)
- }
-
- break
- case .inputPrivacyKeyVoiceMessages:
- if boxed {
- buffer.appendInt32(-1360618136)
- }
-
- break
- }
- }
-
- public func descriptionFields() -> (String, [(String, Any)]) {
- switch self {
- case .inputPrivacyKeyAddedByPhone:
- return ("inputPrivacyKeyAddedByPhone", [])
- case .inputPrivacyKeyChatInvite:
- return ("inputPrivacyKeyChatInvite", [])
- case .inputPrivacyKeyForwards:
- return ("inputPrivacyKeyForwards", [])
- case .inputPrivacyKeyPhoneCall:
- return ("inputPrivacyKeyPhoneCall", [])
- case .inputPrivacyKeyPhoneNumber:
- return ("inputPrivacyKeyPhoneNumber", [])
- case .inputPrivacyKeyPhoneP2P:
- return ("inputPrivacyKeyPhoneP2P", [])
- case .inputPrivacyKeyProfilePhoto:
- return ("inputPrivacyKeyProfilePhoto", [])
- case .inputPrivacyKeyStatusTimestamp:
- return ("inputPrivacyKeyStatusTimestamp", [])
- case .inputPrivacyKeyVoiceMessages:
- return ("inputPrivacyKeyVoiceMessages", [])
- }
- }
-
- public static func parse_inputPrivacyKeyAddedByPhone(_ reader: BufferReader) -> InputPrivacyKey? {
- return Api.InputPrivacyKey.inputPrivacyKeyAddedByPhone
- }
- public static func parse_inputPrivacyKeyChatInvite(_ reader: BufferReader) -> InputPrivacyKey? {
- return Api.InputPrivacyKey.inputPrivacyKeyChatInvite
- }
- public static func parse_inputPrivacyKeyForwards(_ reader: BufferReader) -> InputPrivacyKey? {
- return Api.InputPrivacyKey.inputPrivacyKeyForwards
- }
- public static func parse_inputPrivacyKeyPhoneCall(_ reader: BufferReader) -> InputPrivacyKey? {
- return Api.InputPrivacyKey.inputPrivacyKeyPhoneCall
- }
- public static func parse_inputPrivacyKeyPhoneNumber(_ reader: BufferReader) -> InputPrivacyKey? {
- return Api.InputPrivacyKey.inputPrivacyKeyPhoneNumber
- }
- public static func parse_inputPrivacyKeyPhoneP2P(_ reader: BufferReader) -> InputPrivacyKey? {
- return Api.InputPrivacyKey.inputPrivacyKeyPhoneP2P
- }
- public static func parse_inputPrivacyKeyProfilePhoto(_ reader: BufferReader) -> InputPrivacyKey? {
- return Api.InputPrivacyKey.inputPrivacyKeyProfilePhoto
- }
- public static func parse_inputPrivacyKeyStatusTimestamp(_ reader: BufferReader) -> InputPrivacyKey? {
- return Api.InputPrivacyKey.inputPrivacyKeyStatusTimestamp
- }
- public static func parse_inputPrivacyKeyVoiceMessages(_ reader: BufferReader) -> InputPrivacyKey? {
- return Api.InputPrivacyKey.inputPrivacyKeyVoiceMessages
- }
-
- }
-}
diff --git a/submodules/TelegramApi/Sources/Api9.swift b/submodules/TelegramApi/Sources/Api9.swift
index d7fa9c089c..3abcb9bab0 100644
--- a/submodules/TelegramApi/Sources/Api9.swift
+++ b/submodules/TelegramApi/Sources/Api9.swift
@@ -1,3 +1,281 @@
+public extension Api {
+ enum InputPeerNotifySettings: TypeConstructorDescription {
+ case inputPeerNotifySettings(flags: Int32, showPreviews: Api.Bool?, silent: Api.Bool?, muteUntil: Int32?, sound: Api.NotificationSound?)
+
+ public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
+ switch self {
+ case .inputPeerNotifySettings(let flags, let showPreviews, let silent, let muteUntil, let sound):
+ if boxed {
+ buffer.appendInt32(-551616469)
+ }
+ serializeInt32(flags, buffer: buffer, boxed: false)
+ if Int(flags) & Int(1 << 0) != 0 {showPreviews!.serialize(buffer, true)}
+ if Int(flags) & Int(1 << 1) != 0 {silent!.serialize(buffer, true)}
+ if Int(flags) & Int(1 << 2) != 0 {serializeInt32(muteUntil!, buffer: buffer, boxed: false)}
+ if Int(flags) & Int(1 << 3) != 0 {sound!.serialize(buffer, true)}
+ break
+ }
+ }
+
+ public func descriptionFields() -> (String, [(String, Any)]) {
+ switch self {
+ case .inputPeerNotifySettings(let flags, let showPreviews, let silent, let muteUntil, let sound):
+ return ("inputPeerNotifySettings", [("flags", String(describing: flags)), ("showPreviews", String(describing: showPreviews)), ("silent", String(describing: silent)), ("muteUntil", String(describing: muteUntil)), ("sound", String(describing: sound))])
+ }
+ }
+
+ public static func parse_inputPeerNotifySettings(_ reader: BufferReader) -> InputPeerNotifySettings? {
+ var _1: Int32?
+ _1 = reader.readInt32()
+ var _2: Api.Bool?
+ if Int(_1!) & Int(1 << 0) != 0 {if let signature = reader.readInt32() {
+ _2 = Api.parse(reader, signature: signature) as? Api.Bool
+ } }
+ var _3: Api.Bool?
+ if Int(_1!) & Int(1 << 1) != 0 {if let signature = reader.readInt32() {
+ _3 = Api.parse(reader, signature: signature) as? Api.Bool
+ } }
+ var _4: Int32?
+ if Int(_1!) & Int(1 << 2) != 0 {_4 = reader.readInt32() }
+ var _5: Api.NotificationSound?
+ if Int(_1!) & Int(1 << 3) != 0 {if let signature = reader.readInt32() {
+ _5 = Api.parse(reader, signature: signature) as? Api.NotificationSound
+ } }
+ let _c1 = _1 != nil
+ let _c2 = (Int(_1!) & Int(1 << 0) == 0) || _2 != nil
+ let _c3 = (Int(_1!) & Int(1 << 1) == 0) || _3 != nil
+ let _c4 = (Int(_1!) & Int(1 << 2) == 0) || _4 != nil
+ let _c5 = (Int(_1!) & Int(1 << 3) == 0) || _5 != nil
+ if _c1 && _c2 && _c3 && _c4 && _c5 {
+ return Api.InputPeerNotifySettings.inputPeerNotifySettings(flags: _1!, showPreviews: _2, silent: _3, muteUntil: _4, sound: _5)
+ }
+ else {
+ return nil
+ }
+ }
+
+ }
+}
+public extension Api {
+ enum InputPhoneCall: TypeConstructorDescription {
+ case inputPhoneCall(id: Int64, accessHash: Int64)
+
+ public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
+ switch self {
+ case .inputPhoneCall(let id, let accessHash):
+ if boxed {
+ buffer.appendInt32(506920429)
+ }
+ serializeInt64(id, buffer: buffer, boxed: false)
+ serializeInt64(accessHash, buffer: buffer, boxed: false)
+ break
+ }
+ }
+
+ public func descriptionFields() -> (String, [(String, Any)]) {
+ switch self {
+ case .inputPhoneCall(let id, let accessHash):
+ return ("inputPhoneCall", [("id", String(describing: id)), ("accessHash", String(describing: accessHash))])
+ }
+ }
+
+ public static func parse_inputPhoneCall(_ reader: BufferReader) -> InputPhoneCall? {
+ var _1: Int64?
+ _1 = reader.readInt64()
+ var _2: Int64?
+ _2 = reader.readInt64()
+ let _c1 = _1 != nil
+ let _c2 = _2 != nil
+ if _c1 && _c2 {
+ return Api.InputPhoneCall.inputPhoneCall(id: _1!, accessHash: _2!)
+ }
+ else {
+ return nil
+ }
+ }
+
+ }
+}
+public extension Api {
+ enum InputPhoto: TypeConstructorDescription {
+ case inputPhoto(id: Int64, accessHash: Int64, fileReference: Buffer)
+ case inputPhotoEmpty
+
+ public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
+ switch self {
+ case .inputPhoto(let id, let accessHash, let fileReference):
+ if boxed {
+ buffer.appendInt32(1001634122)
+ }
+ serializeInt64(id, buffer: buffer, boxed: false)
+ serializeInt64(accessHash, buffer: buffer, boxed: false)
+ serializeBytes(fileReference, buffer: buffer, boxed: false)
+ break
+ case .inputPhotoEmpty:
+ if boxed {
+ buffer.appendInt32(483901197)
+ }
+
+ break
+ }
+ }
+
+ public func descriptionFields() -> (String, [(String, Any)]) {
+ switch self {
+ case .inputPhoto(let id, let accessHash, let fileReference):
+ return ("inputPhoto", [("id", String(describing: id)), ("accessHash", String(describing: accessHash)), ("fileReference", String(describing: fileReference))])
+ case .inputPhotoEmpty:
+ return ("inputPhotoEmpty", [])
+ }
+ }
+
+ public static func parse_inputPhoto(_ reader: BufferReader) -> InputPhoto? {
+ var _1: Int64?
+ _1 = reader.readInt64()
+ var _2: Int64?
+ _2 = reader.readInt64()
+ var _3: Buffer?
+ _3 = parseBytes(reader)
+ let _c1 = _1 != nil
+ let _c2 = _2 != nil
+ let _c3 = _3 != nil
+ if _c1 && _c2 && _c3 {
+ return Api.InputPhoto.inputPhoto(id: _1!, accessHash: _2!, fileReference: _3!)
+ }
+ else {
+ return nil
+ }
+ }
+ public static func parse_inputPhotoEmpty(_ reader: BufferReader) -> InputPhoto? {
+ return Api.InputPhoto.inputPhotoEmpty
+ }
+
+ }
+}
+public extension Api {
+ enum InputPrivacyKey: TypeConstructorDescription {
+ case inputPrivacyKeyAddedByPhone
+ case inputPrivacyKeyChatInvite
+ case inputPrivacyKeyForwards
+ case inputPrivacyKeyPhoneCall
+ case inputPrivacyKeyPhoneNumber
+ case inputPrivacyKeyPhoneP2P
+ case inputPrivacyKeyProfilePhoto
+ case inputPrivacyKeyStatusTimestamp
+ case inputPrivacyKeyVoiceMessages
+
+ public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
+ switch self {
+ case .inputPrivacyKeyAddedByPhone:
+ if boxed {
+ buffer.appendInt32(-786326563)
+ }
+
+ break
+ case .inputPrivacyKeyChatInvite:
+ if boxed {
+ buffer.appendInt32(-1107622874)
+ }
+
+ break
+ case .inputPrivacyKeyForwards:
+ if boxed {
+ buffer.appendInt32(-1529000952)
+ }
+
+ break
+ case .inputPrivacyKeyPhoneCall:
+ if boxed {
+ buffer.appendInt32(-88417185)
+ }
+
+ break
+ case .inputPrivacyKeyPhoneNumber:
+ if boxed {
+ buffer.appendInt32(55761658)
+ }
+
+ break
+ case .inputPrivacyKeyPhoneP2P:
+ if boxed {
+ buffer.appendInt32(-610373422)
+ }
+
+ break
+ case .inputPrivacyKeyProfilePhoto:
+ if boxed {
+ buffer.appendInt32(1461304012)
+ }
+
+ break
+ case .inputPrivacyKeyStatusTimestamp:
+ if boxed {
+ buffer.appendInt32(1335282456)
+ }
+
+ break
+ case .inputPrivacyKeyVoiceMessages:
+ if boxed {
+ buffer.appendInt32(-1360618136)
+ }
+
+ break
+ }
+ }
+
+ public func descriptionFields() -> (String, [(String, Any)]) {
+ switch self {
+ case .inputPrivacyKeyAddedByPhone:
+ return ("inputPrivacyKeyAddedByPhone", [])
+ case .inputPrivacyKeyChatInvite:
+ return ("inputPrivacyKeyChatInvite", [])
+ case .inputPrivacyKeyForwards:
+ return ("inputPrivacyKeyForwards", [])
+ case .inputPrivacyKeyPhoneCall:
+ return ("inputPrivacyKeyPhoneCall", [])
+ case .inputPrivacyKeyPhoneNumber:
+ return ("inputPrivacyKeyPhoneNumber", [])
+ case .inputPrivacyKeyPhoneP2P:
+ return ("inputPrivacyKeyPhoneP2P", [])
+ case .inputPrivacyKeyProfilePhoto:
+ return ("inputPrivacyKeyProfilePhoto", [])
+ case .inputPrivacyKeyStatusTimestamp:
+ return ("inputPrivacyKeyStatusTimestamp", [])
+ case .inputPrivacyKeyVoiceMessages:
+ return ("inputPrivacyKeyVoiceMessages", [])
+ }
+ }
+
+ public static func parse_inputPrivacyKeyAddedByPhone(_ reader: BufferReader) -> InputPrivacyKey? {
+ return Api.InputPrivacyKey.inputPrivacyKeyAddedByPhone
+ }
+ public static func parse_inputPrivacyKeyChatInvite(_ reader: BufferReader) -> InputPrivacyKey? {
+ return Api.InputPrivacyKey.inputPrivacyKeyChatInvite
+ }
+ public static func parse_inputPrivacyKeyForwards(_ reader: BufferReader) -> InputPrivacyKey? {
+ return Api.InputPrivacyKey.inputPrivacyKeyForwards
+ }
+ public static func parse_inputPrivacyKeyPhoneCall(_ reader: BufferReader) -> InputPrivacyKey? {
+ return Api.InputPrivacyKey.inputPrivacyKeyPhoneCall
+ }
+ public static func parse_inputPrivacyKeyPhoneNumber(_ reader: BufferReader) -> InputPrivacyKey? {
+ return Api.InputPrivacyKey.inputPrivacyKeyPhoneNumber
+ }
+ public static func parse_inputPrivacyKeyPhoneP2P(_ reader: BufferReader) -> InputPrivacyKey? {
+ return Api.InputPrivacyKey.inputPrivacyKeyPhoneP2P
+ }
+ public static func parse_inputPrivacyKeyProfilePhoto(_ reader: BufferReader) -> InputPrivacyKey? {
+ return Api.InputPrivacyKey.inputPrivacyKeyProfilePhoto
+ }
+ public static func parse_inputPrivacyKeyStatusTimestamp(_ reader: BufferReader) -> InputPrivacyKey? {
+ return Api.InputPrivacyKey.inputPrivacyKeyStatusTimestamp
+ }
+ public static func parse_inputPrivacyKeyVoiceMessages(_ reader: BufferReader) -> InputPrivacyKey? {
+ return Api.InputPrivacyKey.inputPrivacyKeyVoiceMessages
+ }
+
+ }
+}
public extension Api {
enum InputPrivacyRule: TypeConstructorDescription {
case inputPrivacyValueAllowAll
@@ -522,487 +800,3 @@ public extension Api {
}
}
-public extension Api {
- enum InputStickerSetItem: TypeConstructorDescription {
- case inputStickerSetItem(flags: Int32, document: Api.InputDocument, emoji: String, maskCoords: Api.MaskCoords?)
-
- public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
- switch self {
- case .inputStickerSetItem(let flags, let document, let emoji, let maskCoords):
- if boxed {
- buffer.appendInt32(-6249322)
- }
- serializeInt32(flags, buffer: buffer, boxed: false)
- document.serialize(buffer, true)
- serializeString(emoji, buffer: buffer, boxed: false)
- if Int(flags) & Int(1 << 0) != 0 {maskCoords!.serialize(buffer, true)}
- break
- }
- }
-
- public func descriptionFields() -> (String, [(String, Any)]) {
- switch self {
- case .inputStickerSetItem(let flags, let document, let emoji, let maskCoords):
- return ("inputStickerSetItem", [("flags", String(describing: flags)), ("document", String(describing: document)), ("emoji", String(describing: emoji)), ("maskCoords", String(describing: maskCoords))])
- }
- }
-
- public static func parse_inputStickerSetItem(_ reader: BufferReader) -> InputStickerSetItem? {
- var _1: Int32?
- _1 = reader.readInt32()
- var _2: Api.InputDocument?
- if let signature = reader.readInt32() {
- _2 = Api.parse(reader, signature: signature) as? Api.InputDocument
- }
- var _3: String?
- _3 = parseString(reader)
- var _4: Api.MaskCoords?
- if Int(_1!) & Int(1 << 0) != 0 {if let signature = reader.readInt32() {
- _4 = Api.parse(reader, signature: signature) as? Api.MaskCoords
- } }
- let _c1 = _1 != nil
- let _c2 = _2 != nil
- let _c3 = _3 != nil
- let _c4 = (Int(_1!) & Int(1 << 0) == 0) || _4 != nil
- if _c1 && _c2 && _c3 && _c4 {
- return Api.InputStickerSetItem.inputStickerSetItem(flags: _1!, document: _2!, emoji: _3!, maskCoords: _4)
- }
- else {
- return nil
- }
- }
-
- }
-}
-public extension Api {
- enum InputStickeredMedia: TypeConstructorDescription {
- case inputStickeredMediaDocument(id: Api.InputDocument)
- case inputStickeredMediaPhoto(id: Api.InputPhoto)
-
- public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
- switch self {
- case .inputStickeredMediaDocument(let id):
- if boxed {
- buffer.appendInt32(70813275)
- }
- id.serialize(buffer, true)
- break
- case .inputStickeredMediaPhoto(let id):
- if boxed {
- buffer.appendInt32(1251549527)
- }
- id.serialize(buffer, true)
- break
- }
- }
-
- public func descriptionFields() -> (String, [(String, Any)]) {
- switch self {
- case .inputStickeredMediaDocument(let id):
- return ("inputStickeredMediaDocument", [("id", String(describing: id))])
- case .inputStickeredMediaPhoto(let id):
- return ("inputStickeredMediaPhoto", [("id", String(describing: id))])
- }
- }
-
- public static func parse_inputStickeredMediaDocument(_ reader: BufferReader) -> InputStickeredMedia? {
- var _1: Api.InputDocument?
- if let signature = reader.readInt32() {
- _1 = Api.parse(reader, signature: signature) as? Api.InputDocument
- }
- let _c1 = _1 != nil
- if _c1 {
- return Api.InputStickeredMedia.inputStickeredMediaDocument(id: _1!)
- }
- else {
- return nil
- }
- }
- public static func parse_inputStickeredMediaPhoto(_ reader: BufferReader) -> InputStickeredMedia? {
- var _1: Api.InputPhoto?
- if let signature = reader.readInt32() {
- _1 = Api.parse(reader, signature: signature) as? Api.InputPhoto
- }
- let _c1 = _1 != nil
- if _c1 {
- return Api.InputStickeredMedia.inputStickeredMediaPhoto(id: _1!)
- }
- else {
- return nil
- }
- }
-
- }
-}
-public extension Api {
- enum InputStorePaymentPurpose: TypeConstructorDescription {
- case inputStorePaymentGiftPremium(userId: Api.InputUser, currency: String, amount: Int64)
- case inputStorePaymentPremiumSubscription(flags: Int32)
-
- public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
- switch self {
- case .inputStorePaymentGiftPremium(let userId, let currency, let amount):
- if boxed {
- buffer.appendInt32(1634697192)
- }
- userId.serialize(buffer, true)
- serializeString(currency, buffer: buffer, boxed: false)
- serializeInt64(amount, buffer: buffer, boxed: false)
- break
- case .inputStorePaymentPremiumSubscription(let flags):
- if boxed {
- buffer.appendInt32(-1502273946)
- }
- serializeInt32(flags, buffer: buffer, boxed: false)
- break
- }
- }
-
- public func descriptionFields() -> (String, [(String, Any)]) {
- switch self {
- case .inputStorePaymentGiftPremium(let userId, let currency, let amount):
- return ("inputStorePaymentGiftPremium", [("userId", String(describing: userId)), ("currency", String(describing: currency)), ("amount", String(describing: amount))])
- case .inputStorePaymentPremiumSubscription(let flags):
- return ("inputStorePaymentPremiumSubscription", [("flags", String(describing: flags))])
- }
- }
-
- public static func parse_inputStorePaymentGiftPremium(_ reader: BufferReader) -> InputStorePaymentPurpose? {
- var _1: Api.InputUser?
- if let signature = reader.readInt32() {
- _1 = Api.parse(reader, signature: signature) as? Api.InputUser
- }
- var _2: String?
- _2 = parseString(reader)
- var _3: Int64?
- _3 = reader.readInt64()
- let _c1 = _1 != nil
- let _c2 = _2 != nil
- let _c3 = _3 != nil
- if _c1 && _c2 && _c3 {
- return Api.InputStorePaymentPurpose.inputStorePaymentGiftPremium(userId: _1!, currency: _2!, amount: _3!)
- }
- else {
- return nil
- }
- }
- public static func parse_inputStorePaymentPremiumSubscription(_ reader: BufferReader) -> InputStorePaymentPurpose? {
- var _1: Int32?
- _1 = reader.readInt32()
- let _c1 = _1 != nil
- if _c1 {
- return Api.InputStorePaymentPurpose.inputStorePaymentPremiumSubscription(flags: _1!)
- }
- else {
- return nil
- }
- }
-
- }
-}
-public extension Api {
- enum InputTheme: TypeConstructorDescription {
- case inputTheme(id: Int64, accessHash: Int64)
- case inputThemeSlug(slug: String)
-
- public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
- switch self {
- case .inputTheme(let id, let accessHash):
- if boxed {
- buffer.appendInt32(1012306921)
- }
- serializeInt64(id, buffer: buffer, boxed: false)
- serializeInt64(accessHash, buffer: buffer, boxed: false)
- break
- case .inputThemeSlug(let slug):
- if boxed {
- buffer.appendInt32(-175567375)
- }
- serializeString(slug, buffer: buffer, boxed: false)
- break
- }
- }
-
- public func descriptionFields() -> (String, [(String, Any)]) {
- switch self {
- case .inputTheme(let id, let accessHash):
- return ("inputTheme", [("id", String(describing: id)), ("accessHash", String(describing: accessHash))])
- case .inputThemeSlug(let slug):
- return ("inputThemeSlug", [("slug", String(describing: slug))])
- }
- }
-
- public static func parse_inputTheme(_ reader: BufferReader) -> InputTheme? {
- var _1: Int64?
- _1 = reader.readInt64()
- var _2: Int64?
- _2 = reader.readInt64()
- let _c1 = _1 != nil
- let _c2 = _2 != nil
- if _c1 && _c2 {
- return Api.InputTheme.inputTheme(id: _1!, accessHash: _2!)
- }
- else {
- return nil
- }
- }
- public static func parse_inputThemeSlug(_ reader: BufferReader) -> InputTheme? {
- var _1: String?
- _1 = parseString(reader)
- let _c1 = _1 != nil
- if _c1 {
- return Api.InputTheme.inputThemeSlug(slug: _1!)
- }
- else {
- return nil
- }
- }
-
- }
-}
-public extension Api {
- enum InputThemeSettings: TypeConstructorDescription {
- case inputThemeSettings(flags: Int32, baseTheme: Api.BaseTheme, accentColor: Int32, outboxAccentColor: Int32?, messageColors: [Int32]?, wallpaper: Api.InputWallPaper?, wallpaperSettings: Api.WallPaperSettings?)
-
- public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
- switch self {
- case .inputThemeSettings(let flags, let baseTheme, let accentColor, let outboxAccentColor, let messageColors, let wallpaper, let wallpaperSettings):
- if boxed {
- buffer.appendInt32(-1881255857)
- }
- serializeInt32(flags, buffer: buffer, boxed: false)
- baseTheme.serialize(buffer, true)
- serializeInt32(accentColor, buffer: buffer, boxed: false)
- if Int(flags) & Int(1 << 3) != 0 {serializeInt32(outboxAccentColor!, buffer: buffer, boxed: false)}
- if Int(flags) & Int(1 << 0) != 0 {buffer.appendInt32(481674261)
- buffer.appendInt32(Int32(messageColors!.count))
- for item in messageColors! {
- serializeInt32(item, buffer: buffer, boxed: false)
- }}
- if Int(flags) & Int(1 << 1) != 0 {wallpaper!.serialize(buffer, true)}
- if Int(flags) & Int(1 << 1) != 0 {wallpaperSettings!.serialize(buffer, true)}
- break
- }
- }
-
- public func descriptionFields() -> (String, [(String, Any)]) {
- switch self {
- case .inputThemeSettings(let flags, let baseTheme, let accentColor, let outboxAccentColor, let messageColors, let wallpaper, let wallpaperSettings):
- return ("inputThemeSettings", [("flags", String(describing: flags)), ("baseTheme", String(describing: baseTheme)), ("accentColor", String(describing: accentColor)), ("outboxAccentColor", String(describing: outboxAccentColor)), ("messageColors", String(describing: messageColors)), ("wallpaper", String(describing: wallpaper)), ("wallpaperSettings", String(describing: wallpaperSettings))])
- }
- }
-
- public static func parse_inputThemeSettings(_ reader: BufferReader) -> InputThemeSettings? {
- var _1: Int32?
- _1 = reader.readInt32()
- var _2: Api.BaseTheme?
- if let signature = reader.readInt32() {
- _2 = Api.parse(reader, signature: signature) as? Api.BaseTheme
- }
- var _3: Int32?
- _3 = reader.readInt32()
- var _4: Int32?
- if Int(_1!) & Int(1 << 3) != 0 {_4 = reader.readInt32() }
- var _5: [Int32]?
- if Int(_1!) & Int(1 << 0) != 0 {if let _ = reader.readInt32() {
- _5 = Api.parseVector(reader, elementSignature: -1471112230, elementType: Int32.self)
- } }
- var _6: Api.InputWallPaper?
- if Int(_1!) & Int(1 << 1) != 0 {if let signature = reader.readInt32() {
- _6 = Api.parse(reader, signature: signature) as? Api.InputWallPaper
- } }
- var _7: Api.WallPaperSettings?
- if Int(_1!) & Int(1 << 1) != 0 {if let signature = reader.readInt32() {
- _7 = Api.parse(reader, signature: signature) as? Api.WallPaperSettings
- } }
- let _c1 = _1 != nil
- let _c2 = _2 != nil
- let _c3 = _3 != nil
- let _c4 = (Int(_1!) & Int(1 << 3) == 0) || _4 != nil
- let _c5 = (Int(_1!) & Int(1 << 0) == 0) || _5 != nil
- let _c6 = (Int(_1!) & Int(1 << 1) == 0) || _6 != nil
- let _c7 = (Int(_1!) & Int(1 << 1) == 0) || _7 != nil
- if _c1 && _c2 && _c3 && _c4 && _c5 && _c6 && _c7 {
- return Api.InputThemeSettings.inputThemeSettings(flags: _1!, baseTheme: _2!, accentColor: _3!, outboxAccentColor: _4, messageColors: _5, wallpaper: _6, wallpaperSettings: _7)
- }
- else {
- return nil
- }
- }
-
- }
-}
-public extension Api {
- enum InputUser: TypeConstructorDescription {
- case inputUser(userId: Int64, accessHash: Int64)
- case inputUserEmpty
- case inputUserFromMessage(peer: Api.InputPeer, msgId: Int32, userId: Int64)
- case inputUserSelf
-
- public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
- switch self {
- case .inputUser(let userId, let accessHash):
- if boxed {
- buffer.appendInt32(-233744186)
- }
- serializeInt64(userId, buffer: buffer, boxed: false)
- serializeInt64(accessHash, buffer: buffer, boxed: false)
- break
- case .inputUserEmpty:
- if boxed {
- buffer.appendInt32(-1182234929)
- }
-
- break
- case .inputUserFromMessage(let peer, let msgId, let userId):
- if boxed {
- buffer.appendInt32(497305826)
- }
- peer.serialize(buffer, true)
- serializeInt32(msgId, buffer: buffer, boxed: false)
- serializeInt64(userId, buffer: buffer, boxed: false)
- break
- case .inputUserSelf:
- if boxed {
- buffer.appendInt32(-138301121)
- }
-
- break
- }
- }
-
- public func descriptionFields() -> (String, [(String, Any)]) {
- switch self {
- case .inputUser(let userId, let accessHash):
- return ("inputUser", [("userId", String(describing: userId)), ("accessHash", String(describing: accessHash))])
- case .inputUserEmpty:
- return ("inputUserEmpty", [])
- case .inputUserFromMessage(let peer, let msgId, let userId):
- return ("inputUserFromMessage", [("peer", String(describing: peer)), ("msgId", String(describing: msgId)), ("userId", String(describing: userId))])
- case .inputUserSelf:
- return ("inputUserSelf", [])
- }
- }
-
- public static func parse_inputUser(_ reader: BufferReader) -> InputUser? {
- var _1: Int64?
- _1 = reader.readInt64()
- var _2: Int64?
- _2 = reader.readInt64()
- let _c1 = _1 != nil
- let _c2 = _2 != nil
- if _c1 && _c2 {
- return Api.InputUser.inputUser(userId: _1!, accessHash: _2!)
- }
- else {
- return nil
- }
- }
- public static func parse_inputUserEmpty(_ reader: BufferReader) -> InputUser? {
- return Api.InputUser.inputUserEmpty
- }
- public static func parse_inputUserFromMessage(_ reader: BufferReader) -> InputUser? {
- var _1: Api.InputPeer?
- if let signature = reader.readInt32() {
- _1 = Api.parse(reader, signature: signature) as? Api.InputPeer
- }
- var _2: Int32?
- _2 = reader.readInt32()
- var _3: Int64?
- _3 = reader.readInt64()
- let _c1 = _1 != nil
- let _c2 = _2 != nil
- let _c3 = _3 != nil
- if _c1 && _c2 && _c3 {
- return Api.InputUser.inputUserFromMessage(peer: _1!, msgId: _2!, userId: _3!)
- }
- else {
- return nil
- }
- }
- public static func parse_inputUserSelf(_ reader: BufferReader) -> InputUser? {
- return Api.InputUser.inputUserSelf
- }
-
- }
-}
-public extension Api {
- enum InputWallPaper: TypeConstructorDescription {
- case inputWallPaper(id: Int64, accessHash: Int64)
- case inputWallPaperNoFile(id: Int64)
- case inputWallPaperSlug(slug: String)
-
- public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
- switch self {
- case .inputWallPaper(let id, let accessHash):
- if boxed {
- buffer.appendInt32(-433014407)
- }
- serializeInt64(id, buffer: buffer, boxed: false)
- serializeInt64(accessHash, buffer: buffer, boxed: false)
- break
- case .inputWallPaperNoFile(let id):
- if boxed {
- buffer.appendInt32(-1770371538)
- }
- serializeInt64(id, buffer: buffer, boxed: false)
- break
- case .inputWallPaperSlug(let slug):
- if boxed {
- buffer.appendInt32(1913199744)
- }
- serializeString(slug, buffer: buffer, boxed: false)
- break
- }
- }
-
- public func descriptionFields() -> (String, [(String, Any)]) {
- switch self {
- case .inputWallPaper(let id, let accessHash):
- return ("inputWallPaper", [("id", String(describing: id)), ("accessHash", String(describing: accessHash))])
- case .inputWallPaperNoFile(let id):
- return ("inputWallPaperNoFile", [("id", String(describing: id))])
- case .inputWallPaperSlug(let slug):
- return ("inputWallPaperSlug", [("slug", String(describing: slug))])
- }
- }
-
- public static func parse_inputWallPaper(_ reader: BufferReader) -> InputWallPaper? {
- var _1: Int64?
- _1 = reader.readInt64()
- var _2: Int64?
- _2 = reader.readInt64()
- let _c1 = _1 != nil
- let _c2 = _2 != nil
- if _c1 && _c2 {
- return Api.InputWallPaper.inputWallPaper(id: _1!, accessHash: _2!)
- }
- else {
- return nil
- }
- }
- public static func parse_inputWallPaperNoFile(_ reader: BufferReader) -> InputWallPaper? {
- var _1: Int64?
- _1 = reader.readInt64()
- let _c1 = _1 != nil
- if _c1 {
- return Api.InputWallPaper.inputWallPaperNoFile(id: _1!)
- }
- else {
- return nil
- }
- }
- public static func parse_inputWallPaperSlug(_ reader: BufferReader) -> InputWallPaper? {
- var _1: String?
- _1 = parseString(reader)
- let _c1 = _1 != nil
- if _c1 {
- return Api.InputWallPaper.inputWallPaperSlug(slug: _1!)
- }
- else {
- return nil
- }
- }
-
- }
-}
diff --git a/submodules/TelegramCore/Sources/Account/Account.swift b/submodules/TelegramCore/Sources/Account/Account.swift
index bc41ac06c8..583b02fbf1 100644
--- a/submodules/TelegramCore/Sources/Account/Account.swift
+++ b/submodules/TelegramCore/Sources/Account/Account.swift
@@ -321,13 +321,14 @@ public struct TwoStepAuthData {
public let secretRandom: Data
public let nextSecurePasswordDerivation: TwoStepSecurePasswordDerivation
public let pendingResetTimestamp: Int32?
+ public let loginEmailPattern: String?
}
func _internal_twoStepAuthData(_ network: Network) -> Signal {
return network.request(Api.functions.account.getPassword())
|> map { config -> TwoStepAuthData in
switch config {
- case let .password(flags, currentAlgo, srpB, srpId, hint, emailUnconfirmedPattern, newAlgo, newSecureAlgo, secureRandom, pendingResetDate):
+ case let .password(flags, currentAlgo, srpB, srpId, hint, emailUnconfirmedPattern, newAlgo, newSecureAlgo, secureRandom, pendingResetDate, loginEmailPattern):
let hasRecovery = (flags & (1 << 0)) != 0
let hasSecureValues = (flags & (1 << 1)) != 0
@@ -349,7 +350,7 @@ func _internal_twoStepAuthData(_ network: Network) -> Signal mapToSignal { result -> Signal<(SendCodeResult, UnauthorizedAccount), MTRpcError> in
switch result {
- case let .password(_, _, _, _, hint, _, _, _, _, _):
+ case let .password(_, _, _, _, hint, _, _, _, _, _, _):
return .single((.password(hint: hint), updatedAccount))
}
}
@@ -141,7 +141,7 @@ public func sendAuthorizationCode(accountManager: AccountManager mapToSignal { result -> Signal<(SendCodeResult, UnauthorizedAccount), AuthorizationCodeRequestError> in
switch result {
- case let .password(_, _, _, _, hint, _, _, _, _, _):
+ case let .password(_, _, _, _, hint, _, _, _, _, _, _):
return .single((.password(hint: hint), account))
}
}
@@ -156,7 +156,7 @@ public func sendAuthorizationCode(accountManager: AccountManager UnauthorizedAccount in
switch result {
case let .password(hint):
- transaction.setState(UnauthorizedAccountState(isTestingEnvironment: account.testingEnvironment, masterDatacenterId: account.masterDatacenterId, contents: .passwordEntry(hint: hint ?? "", number: nil, code: nil, suggestReset: false, syncContacts: syncContacts)))
+ transaction.setState(UnauthorizedAccountState(isTestingEnvironment: account.testingEnvironment, masterDatacenterId: account.masterDatacenterId, contents: .passwordEntry(hint: hint ?? "", number: nil, code: nil, suggestReset: false, syncContacts: syncContacts)))
case let .sentCode(sentCode):
switch sentCode {
case let .sentCode(_, type, phoneCodeHash, nextType, timeout):
@@ -239,10 +239,65 @@ private enum AuthorizationCodeResult {
case signUp
}
+public enum AuthorizationCode: PostboxCoding, Equatable {
+ private enum CodeType: Int32 {
+ case phoneCode = 0
+ case emailCode = 1
+ case appleToken = 2
+ case googleToken = 3
+ }
+
+ public enum EmailVerification: Equatable {
+ case emailCode(String)
+ case appleToken(String)
+ case googleToken(String)
+ }
+
+ case phoneCode(String)
+ case emailVerification(EmailVerification)
+
+ public init(decoder: PostboxDecoder) {
+ let type = decoder.decodeInt32ForKey("t", orElse: 0)
+ switch type {
+ case CodeType.phoneCode.rawValue:
+ self = .phoneCode(decoder.decodeStringForKey("c", orElse: ""))
+ case CodeType.emailCode.rawValue:
+ self = .emailVerification(.emailCode(decoder.decodeStringForKey("c", orElse: "")))
+ case CodeType.appleToken.rawValue:
+ self = .emailVerification(.appleToken(decoder.decodeStringForKey("c", orElse: "")))
+ case CodeType.googleToken.rawValue:
+ self = .emailVerification(.googleToken(decoder.decodeStringForKey("c", orElse: "")))
+ default:
+ assertionFailure()
+ self = .phoneCode("")
+ }
+ }
+
+ public func encode(_ encoder: PostboxEncoder) {
+ switch self {
+ case let .phoneCode(code):
+ encoder.encodeInt32(CodeType.phoneCode.rawValue, forKey: "t")
+ encoder.encodeString(code, forKey: "c")
+ case let .emailVerification(verification):
+ switch verification {
+ case let .emailCode(code):
+ encoder.encodeInt32(CodeType.emailCode.rawValue, forKey: "t")
+ encoder.encodeString(code, forKey: "c")
+ case let .appleToken(token):
+ encoder.encodeInt32(CodeType.appleToken.rawValue, forKey: "t")
+ encoder.encodeString(token, forKey: "c")
+ case let .googleToken(token):
+ encoder.encodeInt32(CodeType.googleToken.rawValue, forKey: "t")
+ encoder.encodeString(token, forKey: "c")
+ }
+ }
+ }
+}
+
public struct AuthorizationSignUpData {
let number: String
let codeHash: String
- let code: String
+ let code: AuthorizationCode
let termsOfService: UnauthorizedAccountTermsOfService?
let syncContacts: Bool
}
@@ -252,12 +307,153 @@ public enum AuthorizeWithCodeResult {
case loggedIn
}
-public func authorizeWithCode(accountManager: AccountManager, account: UnauthorizedAccount, code: String, termsOfService: UnauthorizedAccountTermsOfService?, forcedPasswordSetupNotice: @escaping (Int32) -> (NoticeEntryKey, CodableEntry)?) -> Signal {
+public enum AuthorizationSendEmailCodeError {
+ case generic
+ case limitExceeded
+ case codeExpired
+ case timeout
+}
+
+public enum AuthorizationEmailVerificationError {
+ case generic
+ case limitExceeded
+ case codeExpired
+ case invalidCode
+ case timeout
+}
+
+public func sendLoginEmailCode(account: UnauthorizedAccount, email: String) -> Signal {
+ return account.postbox.transaction { transaction -> Signal in
+ if let state = transaction.getState() as? UnauthorizedAccountState {
+ switch state.contents {
+ case let .confirmationCodeEntry(phoneNumber, _, phoneCodeHash, _, _, syncContacts):
+ return account.network.request(Api.functions.account.sendVerifyEmailCode(purpose: .emailVerifyPurposeLoginSetup(phoneNumber: phoneNumber, phoneCodeHash: phoneCodeHash), email: email), automaticFloodWait: false)
+ |> `catch` { error -> Signal in
+ let errorDescription = error.errorDescription ?? ""
+ if errorDescription.hasPrefix("FLOOD_WAIT") {
+ return .fail(.limitExceeded)
+ } else if errorDescription == "CODE_HASH_EXPIRED" || errorDescription == "PHONE_CODE_EXPIRED" {
+ return .fail(.codeExpired)
+ } else {
+ return .fail(.generic)
+ }
+ }
+ |> mapToSignal { result -> Signal in
+ return account.postbox.transaction { transaction -> Signal in
+ switch result {
+ case let .sentEmailCode(emailPattern, length):
+ transaction.setState(UnauthorizedAccountState(isTestingEnvironment: account.testingEnvironment, masterDatacenterId: account.masterDatacenterId, contents: .confirmationCodeEntry(number: phoneNumber, type: .email(emailPattern: emailPattern, length: length, nextPhoneLoginDate: nil, appleSignInAllowed: false, setup: true), hash: phoneCodeHash, timeout: nil, nextType: nil, syncContacts: syncContacts)))
+ }
+ return .complete()
+ }
+ |> switchToLatest
+ |> mapError { _ -> AuthorizationSendEmailCodeError in
+ }
+ |> ignoreValues
+ }
+ default:
+ return .fail(.generic)
+ }
+ } else {
+ return .fail(.generic)
+ }
+ }
+ |> mapError { _ -> AuthorizationSendEmailCodeError in
+ }
+ |> switchToLatest
+ |> ignoreValues
+}
+
+public func verifyLoginEmail(account: UnauthorizedAccount, code: AuthorizationCode.EmailVerification) -> Signal {
+ return account.postbox.transaction { transaction -> Signal in
+ if let state = transaction.getState() as? UnauthorizedAccountState {
+ switch state.contents {
+ case let .confirmationCodeEntry(phoneNumber, _, phoneCodeHash, _, _, syncContacts):
+ let verification: Api.EmailVerification
+ switch code {
+ case let .emailCode(code):
+ verification = .emailVerificationCode(code: code)
+ case let .appleToken(token):
+ verification = .emailVerificationApple(token: token)
+ case let .googleToken(token):
+ verification = .emailVerificationGoogle(token: token)
+ }
+
+ return account.network.request(Api.functions.account.verifyEmail(purpose: .emailVerifyPurposeLoginSetup(phoneNumber: phoneNumber, phoneCodeHash: phoneCodeHash), verification: verification), automaticFloodWait: false)
+ |> `catch` { error -> Signal in
+ let errorDescription = error.errorDescription ?? ""
+ if errorDescription.hasPrefix("FLOOD_WAIT") {
+ return .fail(.limitExceeded)
+ } else if errorDescription == "CODE_HASH_EXPIRED" || errorDescription == "PHONE_CODE_EXPIRED" {
+ return .fail(.codeExpired)
+ } else if errorDescription == "" {
+ return .fail(.invalidCode)
+ } else {
+ return .fail(.generic)
+ }
+ }
+ |> mapToSignal { result -> Signal in
+ return account.postbox.transaction { transaction -> Signal in
+ switch result {
+ case let .emailVerifiedLogin(_, sentCode):
+ switch sentCode {
+ case let .sentCode(_, type, phoneCodeHash, nextType, timeout):
+ var parsedNextType: AuthorizationCodeNextType?
+ if let nextType = nextType {
+ parsedNextType = AuthorizationCodeNextType(apiType: nextType)
+ }
+
+ transaction.setState(UnauthorizedAccountState(isTestingEnvironment: account.testingEnvironment, masterDatacenterId: account.masterDatacenterId, contents: .confirmationCodeEntry(number: phoneNumber, type: SentAuthorizationCodeType(apiType: type), hash: phoneCodeHash, timeout: timeout, nextType: parsedNextType, syncContacts: syncContacts)))
+ }
+ case .emailVerified:
+ break
+ }
+ return .complete()
+ }
+ |> switchToLatest
+ |> mapError { _ -> AuthorizationEmailVerificationError in
+ }
+ |> ignoreValues
+ }
+ default:
+ return .fail(.generic)
+ }
+ } else {
+ return .fail(.generic)
+ }
+ }
+ |> mapError { _ -> AuthorizationEmailVerificationError in
+ }
+ |> switchToLatest
+ |> ignoreValues
+}
+
+public func authorizeWithCode(accountManager: AccountManager, account: UnauthorizedAccount, code: AuthorizationCode, termsOfService: UnauthorizedAccountTermsOfService?, forcedPasswordSetupNotice: @escaping (Int32) -> (NoticeEntryKey, CodableEntry)?) -> Signal {
return account.postbox.transaction { transaction -> Signal in
if let state = transaction.getState() as? UnauthorizedAccountState {
switch state.contents {
case let .confirmationCodeEntry(number, _, hash, _, _, syncContacts):
- return account.network.request(Api.functions.auth.signIn(phoneNumber: number, phoneCodeHash: hash, phoneCode: code), automaticFloodWait: false)
+ var flags: Int32 = 0
+ var phoneCode: String?
+ var emailVerification: Api.EmailVerification?
+
+ switch code {
+ case let .phoneCode(code):
+ flags = 1 << 0
+ phoneCode = code
+ case let .emailVerification(verification):
+ flags = 1 << 1
+ switch verification {
+ case let .emailCode(code):
+ emailVerification = .emailVerificationCode(code: code)
+ case let .appleToken(token):
+ emailVerification = .emailVerificationApple(token: token)
+ case let .googleToken(token):
+ emailVerification = .emailVerificationGoogle(token: token)
+ }
+ }
+
+ return account.network.request(Api.functions.auth.signIn(flags: flags, phoneNumber: number, phoneCodeHash: hash, phoneCode: phoneCode, emailVerification: emailVerification), automaticFloodWait: false)
|> map { authorization in
return .authorization(authorization)
}
@@ -274,7 +470,7 @@ public func authorizeWithCode(accountManager: AccountManager mapToSignal { result -> Signal in
switch result {
- case let .password(_, _, _, _, hint, _, _, _, _, _):
+ case let .password(_, _, _, _, hint, _, _, _, _, _, _):
return .single(.password(hint: hint ?? ""))
}
}
diff --git a/submodules/TelegramCore/Sources/State/AccountState.swift b/submodules/TelegramCore/Sources/State/AccountState.swift
index 2d9dfe0b78..6a5ef5f6cc 100644
--- a/submodules/TelegramCore/Sources/State/AccountState.swift
+++ b/submodules/TelegramCore/Sources/State/AccountState.swift
@@ -30,6 +30,10 @@ extension SentAuthorizationCodeType {
self = .flashCall(pattern: pattern)
case let .sentCodeTypeMissedCall(prefix, length):
self = .missedCall(numberPrefix: prefix, length: length)
+ case let .sentCodeTypeEmailCode(flags, emailPattern, length, nextPhoneLoginDate):
+ self = .email(emailPattern: emailPattern, length: length, nextPhoneLoginDate: nextPhoneLoginDate, appleSignInAllowed: (flags & (1 << 0)) != 0, setup: false)
+ case let .sentCodeTypeSetUpEmailRequired(flags):
+ self = .emailSetupRequired(appleSignInAllowed: (flags & (1 << 0)) != 0)
}
}
}
diff --git a/submodules/TelegramCore/Sources/SyncCore/SyncCore_UnauthorizedAccountState.swift b/submodules/TelegramCore/Sources/SyncCore/SyncCore_UnauthorizedAccountState.swift
index 910eca6e48..5b98e3674c 100644
--- a/submodules/TelegramCore/Sources/SyncCore/SyncCore_UnauthorizedAccountState.swift
+++ b/submodules/TelegramCore/Sources/SyncCore/SyncCore_UnauthorizedAccountState.swift
@@ -6,6 +6,8 @@ private enum SentAuthorizationCodeTypeValue: Int32 {
case call = 2
case flashCall = 3
case missedCall = 4
+ case email = 5
+ case emailSetupRequired = 6
}
public enum SentAuthorizationCodeType: PostboxCoding, Equatable {
@@ -14,6 +16,8 @@ public enum SentAuthorizationCodeType: PostboxCoding, Equatable {
case call(length: Int32)
case flashCall(pattern: String)
case missedCall(numberPrefix: String, length: Int32)
+ case email(emailPattern: String, length: Int32, nextPhoneLoginDate: Int32?, appleSignInAllowed: Bool, setup: Bool)
+ case emailSetupRequired(appleSignInAllowed: Bool)
public init(decoder: PostboxDecoder) {
switch decoder.decodeInt32ForKey("v", orElse: 0) {
@@ -27,6 +31,10 @@ public enum SentAuthorizationCodeType: PostboxCoding, Equatable {
self = .flashCall(pattern: decoder.decodeStringForKey("p", orElse: ""))
case SentAuthorizationCodeTypeValue.missedCall.rawValue:
self = .missedCall(numberPrefix: decoder.decodeStringForKey("n", orElse: ""), length: decoder.decodeInt32ForKey("l", orElse: 0))
+ case SentAuthorizationCodeTypeValue.email.rawValue:
+ self = .email(emailPattern: decoder.decodeStringForKey("e", orElse: ""), length: decoder.decodeInt32ForKey("l", orElse: 0), nextPhoneLoginDate: decoder.decodeOptionalInt32ForKey("d"), appleSignInAllowed: decoder.decodeInt32ForKey("a", orElse: 0) != 0, setup: decoder.decodeInt32ForKey("s", orElse: 0) != 0)
+ case SentAuthorizationCodeTypeValue.emailSetupRequired.rawValue:
+ self = .emailSetupRequired(appleSignInAllowed: decoder.decodeInt32ForKey("a", orElse: 0) != 0)
default:
preconditionFailure()
}
@@ -50,6 +58,20 @@ public enum SentAuthorizationCodeType: PostboxCoding, Equatable {
encoder.encodeInt32(SentAuthorizationCodeTypeValue.missedCall.rawValue, forKey: "v")
encoder.encodeString(numberPrefix, forKey: "n")
encoder.encodeInt32(length, forKey: "l")
+ case let .email(emailPattern, length, nextPhoneLoginDate, appleSignInAllowed, setup):
+ encoder.encodeInt32(SentAuthorizationCodeTypeValue.email.rawValue, forKey: "v")
+ encoder.encodeString(emailPattern, forKey: "e")
+ encoder.encodeInt32(length, forKey: "l")
+ if let nextPhoneLoginDate = nextPhoneLoginDate {
+ encoder.encodeInt32(nextPhoneLoginDate, forKey: "d")
+ } else {
+ encoder.encodeNil(forKey: "d")
+ }
+ encoder.encodeInt32(appleSignInAllowed ? 1 : 0, forKey: "a")
+ encoder.encodeInt32(setup ? 1 : 0, forKey: "s")
+ case let .emailSetupRequired(appleSignInAllowed):
+ encoder.encodeInt32(SentAuthorizationCodeTypeValue.emailSetupRequired.rawValue, forKey: "v")
+ encoder.encodeInt32(appleSignInAllowed ? 1 : 0, forKey: "a")
}
}
}
@@ -107,8 +129,8 @@ public enum UnauthorizedAccountStateContents: PostboxCoding, Equatable {
case empty
case phoneEntry(countryCode: Int32, number: String)
case confirmationCodeEntry(number: String, type: SentAuthorizationCodeType, hash: String, timeout: Int32?, nextType: AuthorizationCodeNextType?, syncContacts: Bool)
- case passwordEntry(hint: String, number: String?, code: String?, suggestReset: Bool, syncContacts: Bool)
- case passwordRecovery(hint: String, number: String?, code: String?, emailPattern: String, syncContacts: Bool)
+ case passwordEntry(hint: String, number: String?, code: AuthorizationCode?, suggestReset: Bool, syncContacts: Bool)
+ case passwordRecovery(hint: String, number: String?, code: AuthorizationCode?, emailPattern: String, syncContacts: Bool)
case awaitingAccountReset(protectedUntil: Int32, number: String?, syncContacts: Bool)
case signUp(number: String, codeHash: String, firstName: String, lastName: String, termsOfService: UnauthorizedAccountTermsOfService?, syncContacts: Bool)
@@ -125,9 +147,21 @@ public enum UnauthorizedAccountStateContents: PostboxCoding, Equatable {
}
self = .confirmationCodeEntry(number: decoder.decodeStringForKey("num", orElse: ""), type: decoder.decodeObjectForKey("t", decoder: { SentAuthorizationCodeType(decoder: $0) }) as! SentAuthorizationCodeType, hash: decoder.decodeStringForKey("h", orElse: ""), timeout: decoder.decodeOptionalInt32ForKey("tm"), nextType: nextType, syncContacts: decoder.decodeInt32ForKey("syncContacts", orElse: 1) != 0)
case UnauthorizedAccountStateContentsValue.passwordEntry.rawValue:
- self = .passwordEntry(hint: decoder.decodeStringForKey("h", orElse: ""), number: decoder.decodeOptionalStringForKey("n"), code: decoder.decodeOptionalStringForKey("c"), suggestReset: decoder.decodeInt32ForKey("suggestReset", orElse: 0) != 0, syncContacts: decoder.decodeInt32ForKey("syncContacts", orElse: 1) != 0)
+ var code: AuthorizationCode?
+ if let modernCode = decoder.decodeObjectForKey("modernCode", decoder: { AuthorizationCode(decoder: $0) }) as? AuthorizationCode {
+ code = modernCode
+ } else if let legacyCode = decoder.decodeOptionalStringForKey("c") {
+ code = .phoneCode(legacyCode)
+ }
+ self = .passwordEntry(hint: decoder.decodeStringForKey("h", orElse: ""), number: decoder.decodeOptionalStringForKey("n"), code: code, suggestReset: decoder.decodeInt32ForKey("suggestReset", orElse: 0) != 0, syncContacts: decoder.decodeInt32ForKey("syncContacts", orElse: 1) != 0)
case UnauthorizedAccountStateContentsValue.passwordRecovery.rawValue:
- self = .passwordRecovery(hint: decoder.decodeStringForKey("hint", orElse: ""), number: decoder.decodeOptionalStringForKey("number"), code: decoder.decodeOptionalStringForKey("code"), emailPattern: decoder.decodeStringForKey("emailPattern", orElse: ""), syncContacts: decoder.decodeInt32ForKey("syncContacts", orElse: 1) != 0)
+ var code: AuthorizationCode?
+ if let modernCode = decoder.decodeObjectForKey("modernCode", decoder: { AuthorizationCode(decoder: $0) }) as? AuthorizationCode {
+ code = modernCode
+ } else if let legacyCode = decoder.decodeOptionalStringForKey("code") {
+ code = .phoneCode(legacyCode)
+ }
+ self = .passwordRecovery(hint: decoder.decodeStringForKey("hint", orElse: ""), number: decoder.decodeOptionalStringForKey("number"), code: code, emailPattern: decoder.decodeStringForKey("emailPattern", orElse: ""), syncContacts: decoder.decodeInt32ForKey("syncContacts", orElse: 1) != 0)
case UnauthorizedAccountStateContentsValue.awaitingAccountReset.rawValue:
self = .awaitingAccountReset(protectedUntil: decoder.decodeInt32ForKey("protectedUntil", orElse: 0), number: decoder.decodeOptionalStringForKey("number"), syncContacts: decoder.decodeInt32ForKey("syncContacts", orElse: 1) != 0)
case UnauthorizedAccountStateContentsValue.signUp.rawValue:
@@ -171,9 +205,9 @@ public enum UnauthorizedAccountStateContents: PostboxCoding, Equatable {
encoder.encodeNil(forKey: "n")
}
if let code = code {
- encoder.encodeString(code, forKey: "c")
+ encoder.encodeObject(code, forKey: "modernCode")
} else {
- encoder.encodeNil(forKey: "c")
+ encoder.encodeNil(forKey: "modernCode")
}
encoder.encodeInt32(suggestReset ? 1 : 0, forKey: "suggestReset")
encoder.encodeInt32(syncContacts ? 1 : 0, forKey: "syncContacts")
@@ -186,9 +220,9 @@ public enum UnauthorizedAccountStateContents: PostboxCoding, Equatable {
encoder.encodeNil(forKey: "number")
}
if let code = code {
- encoder.encodeString(code, forKey: "code")
+ encoder.encodeObject(code, forKey: "modernCode")
} else {
- encoder.encodeNil(forKey: "code")
+ encoder.encodeNil(forKey: "modernCode")
}
encoder.encodeString(emailPattern, forKey: "emailPattern")
encoder.encodeInt32(syncContacts ? 1 : 0, forKey: "syncContacts")
diff --git a/submodules/TelegramCore/Sources/TelegramEngine/Auth/AuthTransfer.swift b/submodules/TelegramCore/Sources/TelegramEngine/Auth/AuthTransfer.swift
index 1b2b6751f8..8f07734d2c 100644
--- a/submodules/TelegramCore/Sources/TelegramEngine/Auth/AuthTransfer.swift
+++ b/submodules/TelegramCore/Sources/TelegramEngine/Auth/AuthTransfer.swift
@@ -35,7 +35,7 @@ func _internal_exportAuthTransferToken(accountManager: AccountManager mapToSignal { result -> Signal in
switch result {
- case let .password(_, _, _, _, hint, _, _, _, _, _):
+ case let .password(_, _, _, _, hint, _, _, _, _, _, _):
return account.postbox.transaction { transaction -> Api.auth.LoginToken? in
transaction.setState(UnauthorizedAccountState(isTestingEnvironment: account.testingEnvironment, masterDatacenterId: account.masterDatacenterId, contents: .passwordEntry(hint: hint ?? "", number: nil, code: nil, suggestReset: false, syncContacts: syncContacts)))
return nil
@@ -73,7 +73,7 @@ func _internal_exportAuthTransferToken(accountManager: AccountManager mapToSignal { result -> Signal in
switch result {
- case let .password(_, _, _, _, hint, _, _, _, _, _):
+ case let .password(_, _, _, _, hint, _, _, _, _, _, _):
return updatedAccount.postbox.transaction { transaction -> Api.auth.LoginToken? in
transaction.setState(UnauthorizedAccountState(isTestingEnvironment: updatedAccount.testingEnvironment, masterDatacenterId: updatedAccount.masterDatacenterId, contents: .passwordEntry(hint: hint ?? "", number: nil, code: nil, suggestReset: false, syncContacts: syncContacts)))
return nil
diff --git a/submodules/TelegramCore/Sources/TelegramEngine/Auth/TwoStepVerification.swift b/submodules/TelegramCore/Sources/TelegramEngine/Auth/TwoStepVerification.swift
index a9d94da795..f0750daa0a 100644
--- a/submodules/TelegramCore/Sources/TelegramEngine/Auth/TwoStepVerification.swift
+++ b/submodules/TelegramCore/Sources/TelegramEngine/Auth/TwoStepVerification.swift
@@ -15,7 +15,7 @@ func _internal_twoStepVerificationConfiguration(account: Account) -> Signal retryRequest
|> map { result -> TwoStepVerificationConfiguration in
switch result {
- case let .password(flags, currentAlgo, _, _, hint, emailUnconfirmedPattern, _, _, _, pendingResetDate):
+ case let .password(flags, currentAlgo, _, _, hint, emailUnconfirmedPattern, _, _, _, pendingResetDate, _):
if currentAlgo != nil {
return .set(hint: hint ?? "", hasRecoveryEmail: (flags & (1 << 0)) != 0, pendingEmail: emailUnconfirmedPattern.flatMap({ TwoStepVerificationPendingEmail(pattern: $0, codeLength: nil) }), hasSecureValues: (flags & (1 << 1)) != 0, pendingResetTimestamp: pendingResetDate)
} else {
diff --git a/submodules/TelegramCore/Sources/TelegramEngine/SecureId/VerifySecureIdValue.swift b/submodules/TelegramCore/Sources/TelegramEngine/SecureId/VerifySecureIdValue.swift
index 43dfe11dff..a4a6d28b90 100644
--- a/submodules/TelegramCore/Sources/TelegramEngine/SecureId/VerifySecureIdValue.swift
+++ b/submodules/TelegramCore/Sources/TelegramEngine/SecureId/VerifySecureIdValue.swift
@@ -71,7 +71,7 @@ public struct SecureIdPrepareEmailVerificationPayload {
}
public func secureIdPrepareEmailVerification(network: Network, value: SecureIdEmailValue) -> Signal {
- return network.request(Api.functions.account.sendVerifyEmailCode(email: value.email), automaticFloodWait: false)
+ return network.request(Api.functions.account.sendVerifyEmailCode(purpose: .emailVerifyPurposePassport, email: value.email), automaticFloodWait: false)
|> mapError { error -> SecureIdPrepareEmailVerificationError in
if error.errorDescription.hasPrefix("FLOOD_WAIT") {
return .flood
@@ -95,7 +95,7 @@ public enum SecureIdCommitEmailVerificationError {
}
public func secureIdCommitEmailVerification(postbox: Postbox, network: Network, context: SecureIdAccessContext, payload: SecureIdPrepareEmailVerificationPayload, code: String) -> Signal {
- return network.request(Api.functions.account.verifyEmail(email: payload.email, code: code), automaticFloodWait: false)
+ return network.request(Api.functions.account.verifyEmail(purpose: .emailVerifyPurposePassport, verification: .emailVerificationCode(code: code)), automaticFloodWait: false)
|> mapError { error -> SecureIdCommitEmailVerificationError in
if error.errorDescription.hasPrefix("FLOOD_WAIT") {
return .flood
diff --git a/submodules/TelegramUI/Sources/AuthorizationSequenceCodeEntryController.swift b/submodules/TelegramUI/Sources/AuthorizationSequenceCodeEntryController.swift
index 6b253a4c7c..25816d8d00 100644
--- a/submodules/TelegramUI/Sources/AuthorizationSequenceCodeEntryController.swift
+++ b/submodules/TelegramUI/Sources/AuthorizationSequenceCodeEntryController.swift
@@ -140,10 +140,12 @@ final class AuthorizationSequenceCodeEntryController: ViewController {
minimalCodeLength = Int(length)
case let .call(length):
minimalCodeLength = Int(length)
- case .flashCall:
- break
case let .missedCall(_, length):
minimalCodeLength = Int(length)
+ case let .email(_, length, _, _, _):
+ minimalCodeLength = Int(length)
+ case .flashCall, .emailSetupRequired:
+ break
}
if self.controllerNode.currentCode.count < minimalCodeLength {
diff --git a/submodules/TelegramUI/Sources/AuthorizationSequenceCodeEntryControllerNode.swift b/submodules/TelegramUI/Sources/AuthorizationSequenceCodeEntryControllerNode.swift
index 189bbd7c0b..ce6428dd03 100644
--- a/submodules/TelegramUI/Sources/AuthorizationSequenceCodeEntryControllerNode.swift
+++ b/submodules/TelegramUI/Sources/AuthorizationSequenceCodeEntryControllerNode.swift
@@ -9,11 +9,15 @@ import TextFormat
import AuthorizationUI
import CodeInputView
import PhoneNumberFormat
+import AnimatedStickerNode
+import TelegramAnimatedStickerNode
+import SolidRoundedButtonNode
final class AuthorizationSequenceCodeEntryControllerNode: ASDisplayNode, UITextFieldDelegate {
private let strings: PresentationStrings
private let theme: PresentationTheme
+ private let animationNode: AnimatedStickerNode
private let titleNode: ImmediateTextNode
private let titleIconNode: ASImageNode
private let currentOptionNode: ASTextNode
@@ -59,6 +63,8 @@ final class AuthorizationSequenceCodeEntryControllerNode: ASDisplayNode, UITextF
self.strings = strings
self.theme = theme
+ self.animationNode = DefaultAnimatedStickerNodeImpl()
+
self.titleNode = ImmediateTextNode()
self.titleNode.maximumNumberOfLines = 0
self.titleNode.textAlignment = .center
@@ -116,7 +122,7 @@ final class AuthorizationSequenceCodeEntryControllerNode: ASDisplayNode, UITextF
self.codeField.textField.keyboardAppearance = self.theme.rootController.keyboardColor.keyboardAppearance
self.codeField.textField.disableAutomaticKeyboardHandling = [.forward, .backward]
self.codeField.textField.tintColor = self.theme.list.itemAccentColor*/
-
+
super.init()
self.setViewBlock({
@@ -133,6 +139,7 @@ final class AuthorizationSequenceCodeEntryControllerNode: ASDisplayNode, UITextF
self.addSubnode(self.currentOptionNode)
self.addSubnode(self.currentOptionInfoNode)
self.addSubnode(self.nextOptionButtonNode)
+ self.addSubnode(self.animationNode)
self.codeInputView.updated = { [weak self] in
guard let strongSelf = self else {
@@ -238,46 +245,30 @@ final class AuthorizationSequenceCodeEntryControllerNode: ASDisplayNode, UITextF
insets.bottom += max(inputHeight, layout.standardInputHeight)
}
- if max(layout.size.width, layout.size.height) > 1023.0 {
- if let codeType = self.codeType {
- switch codeType {
- case .otherSession:
- self.titleNode.attributedText = NSAttributedString(string: self.strings.Login_CheckOtherSessionMessages, font: Font.medium(32.0), textColor: self.theme.list.itemPrimaryTextColor)
- case .missedCall:
- self.titleNode.attributedText = NSAttributedString(string: self.strings.Login_EnterMissingDigits, font: Font.medium(32.0), textColor: self.theme.list.itemPrimaryTextColor)
- default:
- self.titleNode.attributedText = NSAttributedString(string: self.phoneNumber, font: Font.light(40.0), textColor: self.theme.list.itemPrimaryTextColor)
- }
- } else {
- self.titleNode.attributedText = NSAttributedString(string: self.phoneNumber, font: Font.light(40.0), textColor: self.theme.list.itemPrimaryTextColor)
+
+ var animationName = "IntroMessage"
+ if let codeType = self.codeType {
+ switch codeType {
+ case .otherSession:
+ self.titleNode.attributedText = NSAttributedString(string: self.strings.Login_CheckOtherSessionMessages, font: Font.semibold(28.0), textColor: self.theme.list.itemPrimaryTextColor)
+ case .missedCall:
+ self.titleNode.attributedText = NSAttributedString(string: self.strings.Login_EnterMissingDigits, font: Font.semibold(28.0), textColor: self.theme.list.itemPrimaryTextColor)
+ case .email:
+ self.titleNode.attributedText = NSAttributedString(string: "Check Your Email", font: Font.semibold(28.0), textColor: self.theme.list.itemPrimaryTextColor)
+ animationName = "IntroLetter"
+ default:
+ self.titleNode.attributedText = NSAttributedString(string: self.phoneNumber, font: Font.semibold(28.0), textColor: self.theme.list.itemPrimaryTextColor)
}
} else {
- if let codeType = self.codeType {
- switch codeType {
- case .otherSession:
- let fontSize: CGFloat
- if layout.size.width > 330.0 {
- fontSize = 22.0
- } else {
- fontSize = 18.0
- }
- self.titleNode.attributedText = NSAttributedString(string: self.strings.Login_CheckOtherSessionMessages, font: Font.semibold(fontSize), textColor: self.theme.list.itemPrimaryTextColor)
- case .missedCall:
- let fontSize: CGFloat
- if layout.size.width > 330.0 {
- fontSize = 22.0
- } else {
- fontSize = 18.0
- }
- self.titleNode.attributedText = NSAttributedString(string: self.strings.Login_EnterMissingDigits, font: Font.semibold(fontSize), textColor: self.theme.list.itemPrimaryTextColor)
- default:
- self.titleNode.attributedText = NSAttributedString(string: self.phoneNumber, font: Font.light(30.0), textColor: self.theme.list.itemPrimaryTextColor)
- }
- } else {
- self.titleNode.attributedText = NSAttributedString(string: self.phoneNumber, font: Font.light(30.0), textColor: self.theme.list.itemPrimaryTextColor)
- }
+ self.titleNode.attributedText = NSAttributedString(string: self.phoneNumber, font: Font.semibold(40.0), textColor: self.theme.list.itemPrimaryTextColor)
}
+ if !self.animationNode.visibility {
+ self.animationNode.setup(source: AnimatedStickerNodeLocalFileSource(name: animationName), width: 256, height: 256, playbackMode: .loop, mode: .direct(cachePathPrefix: nil))
+ self.animationNode.visibility = true
+ }
+
+ let animationSize = CGSize(width: 88.0, height: 88.0)
let titleSize = self.titleNode.updateLayout(CGSize(width: layout.size.width, height: CGFloat.greatestFiniteMagnitude))
let currentOptionSize = self.currentOptionNode.measure(CGSize(width: layout.size.width - 28.0, height: CGFloat.greatestFiniteMagnitude))
@@ -302,6 +293,10 @@ final class AuthorizationSequenceCodeEntryControllerNode: ASDisplayNode, UITextF
codeLength = Int(length)
case let .sms(length):
codeLength = Int(length)
+ case let .email(_, length, _, _, _):
+ codeLength = Int(length)
+ case .emailSetupRequired:
+ codeLength = 6
case .none:
codeLength = 6
}
@@ -319,6 +314,9 @@ final class AuthorizationSequenceCodeEntryControllerNode: ASDisplayNode, UITextF
)
var items: [AuthorizationLayoutItem] = []
+ items.append(AuthorizationLayoutItem(node: self.animationNode, size: animationSize, spacingBefore: AuthorizationLayoutItemSpacing(weight: 0.0, maxValue: 0.0), spacingAfter: AuthorizationLayoutItemSpacing(weight: 0.0, maxValue: 0.0)))
+ self.animationNode.updateLayout(size: animationSize)
+
if let codeType = self.codeType {
switch codeType {
case .otherSession:
@@ -351,7 +349,7 @@ final class AuthorizationSequenceCodeEntryControllerNode: ASDisplayNode, UITextF
})
}
- items.append(AuthorizationLayoutItem(node: self.titleIconNode, size: self.titleIconNode.image!.size, spacingBefore: AuthorizationLayoutItemSpacing(weight: 41.0, maxValue: 41.0), spacingAfter: AuthorizationLayoutItemSpacing(weight: 0.0, maxValue: 0.0)))
+// items.append(AuthorizationLayoutItem(node: self.titleIconNode, size: self.titleIconNode.image!.size, spacingBefore: AuthorizationLayoutItemSpacing(weight: 41.0, maxValue: 41.0), spacingAfter: AuthorizationLayoutItemSpacing(weight: 0.0, maxValue: 0.0)))
items.append(AuthorizationLayoutItem(node: self.titleNode, size: titleSize, spacingBefore: AuthorizationLayoutItemSpacing(weight: 18.0, maxValue: 18.0), spacingAfter: AuthorizationLayoutItemSpacing(weight: 0.0, maxValue: 0.0)))
items.append(AuthorizationLayoutItem(node: self.currentOptionNode, size: currentOptionSize, spacingBefore: AuthorizationLayoutItemSpacing(weight: 10.0, maxValue: 10.0), spacingAfter: AuthorizationLayoutItemSpacing(weight: 0.0, maxValue: 0.0)))
@@ -376,7 +374,7 @@ final class AuthorizationSequenceCodeEntryControllerNode: ASDisplayNode, UITextF
})
}
- items.append(AuthorizationLayoutItem(node: self.titleIconNode, size: self.titleIconNode.image!.size, spacingBefore: AuthorizationLayoutItemSpacing(weight: 41.0, maxValue: 41.0), spacingAfter: AuthorizationLayoutItemSpacing(weight: 0.0, maxValue: 0.0)))
+// items.append(AuthorizationLayoutItem(node: self.titleIconNode, size: self.titleIconNode.image!.size, spacingBefore: AuthorizationLayoutItemSpacing(weight: 41.0, maxValue: 41.0), spacingAfter: AuthorizationLayoutItemSpacing(weight: 0.0, maxValue: 0.0)))
items.append(AuthorizationLayoutItem(node: self.titleNode, size: titleSize, spacingBefore: AuthorizationLayoutItemSpacing(weight: 18.0, maxValue: 18.0), spacingAfter: AuthorizationLayoutItemSpacing(weight: 0.0, maxValue: 0.0)))
items.append(AuthorizationLayoutItem(node: self.currentOptionNode, size: currentOptionSize, spacingBefore: AuthorizationLayoutItemSpacing(weight: 10.0, maxValue: 10.0), spacingAfter: AuthorizationLayoutItemSpacing(weight: 0.0, maxValue: 0.0)))
@@ -443,6 +441,8 @@ final class AuthorizationSequenceCodeEntryControllerNode: ASDisplayNode, UITextF
codeLength = length
case let .sms(length):
codeLength = length
+ case let .email(_, length, _, _, _):
+ codeLength = length
default:
break
}
diff --git a/submodules/TelegramUI/Sources/AuthorizationSequenceController.swift b/submodules/TelegramUI/Sources/AuthorizationSequenceController.swift
index 0989039718..445f213585 100644
--- a/submodules/TelegramUI/Sources/AuthorizationSequenceController.swift
+++ b/submodules/TelegramUI/Sources/AuthorizationSequenceController.swift
@@ -18,13 +18,14 @@ import LegacyComponents
import LegacyMediaPickerUI
import PasswordSetupUI
import TelegramNotices
+import AuthenticationServices
private enum InnerState: Equatable {
case state(UnauthorizedAccountStateContents)
case authorized
}
-public final class AuthorizationSequenceController: NavigationController, MFMailComposeViewControllerDelegate {
+public final class AuthorizationSequenceController: NavigationController, MFMailComposeViewControllerDelegate, ASAuthorizationControllerDelegate, ASAuthorizationControllerPresentationContextProviding {
static func navigationBarTheme(_ theme: PresentationTheme) -> NavigationBarTheme {
return NavigationBarTheme(buttonColor: theme.intro.accentTextColor, disabledButtonColor: theme.intro.disabledTextColor, primaryTextColor: theme.intro.primaryTextColor, backgroundColor: .clear, enableBackgroundBlur: false, separatorColor: .clear, badgeBackgroundColor: theme.rootController.navigationBar.badgeBackgroundColor, badgeStrokeColor: theme.rootController.navigationBar.badgeStrokeColor, badgeTextColor: theme.rootController.navigationBar.badgeTextColor)
}
@@ -284,103 +285,147 @@ public final class AuthorizationSequenceController: NavigationController, MFMail
if let strongSelf = self {
controller?.inProgress = true
- strongSelf.actionDisposable.set((authorizeWithCode(accountManager: strongSelf.sharedContext.accountManager, account: strongSelf.account, code: code, termsOfService: termsOfService?.0, forcedPasswordSetupNotice: { value in
- guard let entry = CodableEntry(ApplicationSpecificCounterNotice(value: value)) else {
- return nil
- }
- return (ApplicationSpecificNotice.forcedPasswordSetupKey(), entry)
- })
- |> deliverOnMainQueue).start(next: { result in
- guard let strongSelf = self else {
- return
- }
- controller?.inProgress = false
- switch result {
- case let .signUp(data):
- if let (termsOfService, explicit) = termsOfService, explicit {
- var presentAlertAgainImpl: (() -> Void)?
- let presentAlertImpl: () -> Void = {
- guard let strongSelf = self else {
- return
- }
- var dismissImpl: (() -> Void)?
- let alertTheme = AlertControllerTheme(presentationData: strongSelf.presentationData)
- let attributedText = stringWithAppliedEntities(termsOfService.text, entities: termsOfService.entities, baseColor: alertTheme.primaryColor, linkColor: alertTheme.accentColor, baseFont: Font.regular(13.0), linkFont: Font.regular(13.0), boldFont: Font.semibold(13.0), italicFont: Font.italic(13.0), boldItalicFont: Font.semiboldItalic(13.0), fixedFont: Font.regular(13.0), blockQuoteFont: Font.regular(13.0), message: nil)
- let contentNode = TextAlertContentNode(theme: alertTheme, title: NSAttributedString(string: strongSelf.presentationData.strings.Login_TermsOfServiceHeader, font: Font.medium(17.0), textColor: alertTheme.primaryColor, paragraphAlignment: .center), text: attributedText, actions: [
- TextAlertAction(type: .defaultAction, title: strongSelf.presentationData.strings.Login_TermsOfServiceAgree, action: {
- dismissImpl?()
- guard let strongSelf = self else {
- return
- }
- let _ = beginSignUp(account: strongSelf.account, data: data).start()
- }), TextAlertAction(type: .genericAction, title: strongSelf.presentationData.strings.Login_TermsOfServiceDecline, action: {
- dismissImpl?()
- guard let strongSelf = self else {
- return
- }
- strongSelf.currentWindow?.present(standardTextAlertController(theme: alertTheme, title: strongSelf.presentationData.strings.Login_TermsOfServiceDecline, text: strongSelf.presentationData.strings.Login_TermsOfServiceSignupDecline, actions: [TextAlertAction(type: .defaultAction, title: strongSelf.presentationData.strings.Common_Cancel, action: {
- presentAlertAgainImpl?()
- }), TextAlertAction(type: .genericAction, title: strongSelf.presentationData.strings.Login_TermsOfServiceDecline, action: {
+ let authorizationCode: AuthorizationCode
+ switch type {
+ case .email:
+ authorizationCode = .emailVerification(.emailCode(code))
+ default:
+ authorizationCode = .phoneCode(code)
+ }
+
+ if case let .email(_, _, _, _, setup) = type, setup, case let .emailVerification(emailCode) = authorizationCode {
+ strongSelf.actionDisposable.set(((verifyLoginEmail(account: strongSelf.account, code: emailCode))
+ |> deliverOnMainQueue).start(error: { error in
+ Queue.mainQueue().async {
+ if let strongSelf = self, let controller = controller {
+ controller.inProgress = false
+
+ var resetCode = false
+ let text: String
+ switch error {
+ case .limitExceeded:
+ resetCode = true
+ text = strongSelf.presentationData.strings.Login_CodeFloodError
+ case .invalidCode:
+ resetCode = true
+ text = strongSelf.presentationData.strings.Login_InvalidCodeError
+ case .generic:
+ text = strongSelf.presentationData.strings.Login_UnknownError
+ case .codeExpired:
+ text = strongSelf.presentationData.strings.Login_CodeExpired
+ let account = strongSelf.account
+ let _ = TelegramEngineUnauthorized(account: strongSelf.account).auth.setState(state: UnauthorizedAccountState(isTestingEnvironment: account.testingEnvironment, masterDatacenterId: account.masterDatacenterId, contents: .empty)).start()
+ case .timeout:
+ text = strongSelf.presentationData.strings.Login_NetworkError
+ }
+
+ if resetCode {
+ controller.resetCode()
+ }
+
+ controller.present(standardTextAlertController(theme: AlertControllerTheme(presentationData: strongSelf.presentationData), title: nil, text: text, actions: [TextAlertAction(type: .defaultAction, title: strongSelf.presentationData.strings.Common_OK, action: {})]), in: .window(.root))
+ }
+ }
+ }))
+ } else {
+ strongSelf.actionDisposable.set((authorizeWithCode(accountManager: strongSelf.sharedContext.accountManager, account: strongSelf.account, code: authorizationCode, termsOfService: termsOfService?.0, forcedPasswordSetupNotice: { value in
+ guard let entry = CodableEntry(ApplicationSpecificCounterNotice(value: value)) else {
+ return nil
+ }
+ return (ApplicationSpecificNotice.forcedPasswordSetupKey(), entry)
+ })
+ |> deliverOnMainQueue).start(next: { result in
+ guard let strongSelf = self else {
+ return
+ }
+ controller?.inProgress = false
+ switch result {
+ case let .signUp(data):
+ if let (termsOfService, explicit) = termsOfService, explicit {
+ var presentAlertAgainImpl: (() -> Void)?
+ let presentAlertImpl: () -> Void = {
+ guard let strongSelf = self else {
+ return
+ }
+ var dismissImpl: (() -> Void)?
+ let alertTheme = AlertControllerTheme(presentationData: strongSelf.presentationData)
+ let attributedText = stringWithAppliedEntities(termsOfService.text, entities: termsOfService.entities, baseColor: alertTheme.primaryColor, linkColor: alertTheme.accentColor, baseFont: Font.regular(13.0), linkFont: Font.regular(13.0), boldFont: Font.semibold(13.0), italicFont: Font.italic(13.0), boldItalicFont: Font.semiboldItalic(13.0), fixedFont: Font.regular(13.0), blockQuoteFont: Font.regular(13.0), message: nil)
+ let contentNode = TextAlertContentNode(theme: alertTheme, title: NSAttributedString(string: strongSelf.presentationData.strings.Login_TermsOfServiceHeader, font: Font.medium(17.0), textColor: alertTheme.primaryColor, paragraphAlignment: .center), text: attributedText, actions: [
+ TextAlertAction(type: .defaultAction, title: strongSelf.presentationData.strings.Login_TermsOfServiceAgree, action: {
+ dismissImpl?()
guard let strongSelf = self else {
return
}
- let account = strongSelf.account
- let _ = TelegramEngineUnauthorized(account: strongSelf.account).auth.setState(state: UnauthorizedAccountState(isTestingEnvironment: account.testingEnvironment, masterDatacenterId: account.masterDatacenterId, contents: .empty)).start()
- })]), on: .root, blockInteraction: false, completion: {})
+ let _ = beginSignUp(account: strongSelf.account, data: data).start()
+ }), TextAlertAction(type: .genericAction, title: strongSelf.presentationData.strings.Login_TermsOfServiceDecline, action: {
+ dismissImpl?()
+ guard let strongSelf = self else {
+ return
+ }
+ strongSelf.currentWindow?.present(standardTextAlertController(theme: alertTheme, title: strongSelf.presentationData.strings.Login_TermsOfServiceDecline, text: strongSelf.presentationData.strings.Login_TermsOfServiceSignupDecline, actions: [TextAlertAction(type: .defaultAction, title: strongSelf.presentationData.strings.Common_Cancel, action: {
+ presentAlertAgainImpl?()
+ }), TextAlertAction(type: .genericAction, title: strongSelf.presentationData.strings.Login_TermsOfServiceDecline, action: {
+ guard let strongSelf = self else {
+ return
+ }
+ let account = strongSelf.account
+ let _ = TelegramEngineUnauthorized(account: strongSelf.account).auth.setState(state: UnauthorizedAccountState(isTestingEnvironment: account.testingEnvironment, masterDatacenterId: account.masterDatacenterId, contents: .empty)).start()
+ })]), on: .root, blockInteraction: false, completion: {})
+ })
+ ], actionLayout: .vertical, dismissOnOutsideTap: true)
+ contentNode.textAttributeAction = (NSAttributedString.Key(rawValue: TelegramTextAttributes.URL), { value in
+ if let value = value as? String {
+ strongSelf.openUrl(value)
+ }
})
- ], actionLayout: .vertical, dismissOnOutsideTap: true)
- contentNode.textAttributeAction = (NSAttributedString.Key(rawValue: TelegramTextAttributes.URL), { value in
- if let value = value as? String {
- strongSelf.openUrl(value)
+ let controller = AlertController(theme: alertTheme, contentNode: contentNode)
+ dismissImpl = { [weak controller] in
+ controller?.dismissAnimated()
}
- })
- let controller = AlertController(theme: alertTheme, contentNode: contentNode)
- dismissImpl = { [weak controller] in
- controller?.dismissAnimated()
+ strongSelf.view.endEditing(true)
+ strongSelf.currentWindow?.present(controller, on: .root, blockInteraction: false, completion: {})
+ }
+ presentAlertAgainImpl = {
+ presentAlertImpl()
}
- strongSelf.view.endEditing(true)
- strongSelf.currentWindow?.present(controller, on: .root, blockInteraction: false, completion: {})
- }
- presentAlertAgainImpl = {
presentAlertImpl()
+ } else {
+ let _ = beginSignUp(account: strongSelf.account, data: data).start()
}
- presentAlertImpl()
- } else {
- let _ = beginSignUp(account: strongSelf.account, data: data).start()
- }
- case .loggedIn:
- break
- }
- }, error: { error in
- Queue.mainQueue().async {
- if let strongSelf = self, let controller = controller {
- controller.inProgress = false
-
- var resetCode = false
- let text: String
- switch error {
- case .limitExceeded:
- resetCode = true
- text = strongSelf.presentationData.strings.Login_CodeFloodError
- case .invalidCode:
- resetCode = true
- text = strongSelf.presentationData.strings.Login_InvalidCodeError
- case .generic:
- text = strongSelf.presentationData.strings.Login_UnknownError
- case .codeExpired:
- text = strongSelf.presentationData.strings.Login_CodeExpired
- let account = strongSelf.account
- let _ = TelegramEngineUnauthorized(account: strongSelf.account).auth.setState(state: UnauthorizedAccountState(isTestingEnvironment: account.testingEnvironment, masterDatacenterId: account.masterDatacenterId, contents: .empty)).start()
- }
-
- if resetCode {
- controller.resetCode()
- }
-
- controller.present(standardTextAlertController(theme: AlertControllerTheme(presentationData: strongSelf.presentationData), title: nil, text: text, actions: [TextAlertAction(type: .defaultAction, title: strongSelf.presentationData.strings.Common_OK, action: {})]), in: .window(.root))
+ case .loggedIn:
+ break
}
- }
- }))
+ }, error: { error in
+ Queue.mainQueue().async {
+ if let strongSelf = self, let controller = controller {
+ controller.inProgress = false
+
+ var resetCode = false
+ let text: String
+ switch error {
+ case .limitExceeded:
+ resetCode = true
+ text = strongSelf.presentationData.strings.Login_CodeFloodError
+ case .invalidCode:
+ resetCode = true
+ text = strongSelf.presentationData.strings.Login_InvalidCodeError
+ case .generic:
+ text = strongSelf.presentationData.strings.Login_UnknownError
+ case .codeExpired:
+ text = strongSelf.presentationData.strings.Login_CodeExpired
+ let account = strongSelf.account
+ let _ = TelegramEngineUnauthorized(account: strongSelf.account).auth.setState(state: UnauthorizedAccountState(isTestingEnvironment: account.testingEnvironment, masterDatacenterId: account.masterDatacenterId, contents: .empty)).start()
+ }
+
+ if resetCode {
+ controller.resetCode()
+ }
+
+ controller.present(standardTextAlertController(theme: AlertControllerTheme(presentationData: strongSelf.presentationData), title: nil, text: text, actions: [TextAlertAction(type: .defaultAction, title: strongSelf.presentationData.strings.Common_OK, action: {})]), in: .window(.root))
+ }
+ }
+ }))
+ }
}
}
}
@@ -434,6 +479,113 @@ public final class AuthorizationSequenceController: NavigationController, MFMail
return controller
}
+ private func emailSetupController(appleSignInAllowed: Bool) -> AuthorizationSequenceEmailEntryController {
+ var currentController: AuthorizationSequenceEmailEntryController?
+ for c in self.viewControllers {
+ if let c = c as? AuthorizationSequenceEmailEntryController {
+ currentController = c
+ break
+ }
+ }
+ let controller: AuthorizationSequenceEmailEntryController
+ if let currentController = currentController {
+ controller = currentController
+ } else {
+ controller = AuthorizationSequenceEmailEntryController(presentationData: self.presentationData, back: { [weak self] in
+ guard let strongSelf = self else {
+ return
+ }
+ let countryCode = defaultCountryCode()
+
+ let _ = TelegramEngineUnauthorized(account: strongSelf.account).auth.setState(state: UnauthorizedAccountState(isTestingEnvironment: strongSelf.account.testingEnvironment, masterDatacenterId: strongSelf.account.masterDatacenterId, contents: .phoneEntry(countryCode: countryCode, number: ""))).start()
+ })
+ }
+ controller.proceedWithEmail = { [weak self, weak controller] email in
+ guard let strongSelf = self else {
+ return
+ }
+
+ controller?.inProgress = true
+
+ strongSelf.actionDisposable.set((sendLoginEmailCode(account: strongSelf.account, email: email)
+ |> deliverOnMainQueue).start(next: { result in
+ controller?.inProgress = false
+ }, error: { error in
+ if let strongSelf = self, let controller = controller {
+ controller.inProgress = false
+
+ let text: String
+ switch error {
+ case .limitExceeded:
+ text = strongSelf.presentationData.strings.Login_CodeFloodError
+ case .generic, .codeExpired:
+ text = strongSelf.presentationData.strings.Login_UnknownError
+ case .timeout:
+ text = strongSelf.presentationData.strings.Login_NetworkError
+ }
+
+ controller.present(standardTextAlertController(theme: AlertControllerTheme(presentationData: strongSelf.presentationData), title: nil, text: text, actions: [TextAlertAction(type: .defaultAction, title: strongSelf.presentationData.strings.Common_OK, action: {})]), in: .window(.root))
+ }
+ }))
+ }
+ controller.signInWithApple = { [weak self] in
+ guard let strongSelf = self else {
+ return
+ }
+
+ if #available(iOS 13.0, *) {
+ let appleIdProvider = ASAuthorizationAppleIDProvider()
+ let request = appleIdProvider.createRequest()
+ request.requestedScopes = [.email]
+
+ let authorizationController = ASAuthorizationController(authorizationRequests: [request])
+ authorizationController.delegate = strongSelf
+ authorizationController.presentationContextProvider = strongSelf
+ authorizationController.performRequests()
+ }
+ }
+ controller.updateData(appleSignInAllowed: appleSignInAllowed)
+ return controller
+ }
+
+ @available(iOS 13.0, *)
+ public func authorizationController(controller: ASAuthorizationController, didCompleteWithAuthorization authorization: ASAuthorization) {
+ let lastController = self.viewControllers.last as? ViewController
+
+ switch authorization.credential {
+ case let appleIdCredential as ASAuthorizationAppleIDCredential:
+ guard let tokenData = appleIdCredential.identityToken, let token = String(data: tokenData, encoding: .utf8) else {
+ lastController?.present(standardTextAlertController(theme: AlertControllerTheme(presentationData: self.presentationData), title: nil, text: self.presentationData.strings.Login_UnknownError, actions: [TextAlertAction(type: .defaultAction, title: self.presentationData.strings.Common_OK, action: {})]), in: .window(.root))
+ return
+ }
+
+ self.actionDisposable.set((verifyLoginEmail(account: self.account, code: .appleToken(token))
+ |> deliverOnMainQueue).start(error: { [weak self] error in
+ if let strongSelf = self, let lastController = lastController {
+ let text: String
+ switch error {
+ case .limitExceeded:
+ text = strongSelf.presentationData.strings.Login_CodeFloodError
+ case .generic, .codeExpired:
+ text = strongSelf.presentationData.strings.Login_UnknownError
+ case .invalidCode:
+ text = strongSelf.presentationData.strings.Login_InvalidCodeError
+ case .timeout:
+ text = strongSelf.presentationData.strings.Login_NetworkError
+ }
+ lastController.present(standardTextAlertController(theme: AlertControllerTheme(presentationData: strongSelf.presentationData), title: nil, text: text, actions: [TextAlertAction(type: .defaultAction, title: strongSelf.presentationData.strings.Common_OK, action: {})]), in: .window(.root))
+ }
+ }))
+ default:
+ break
+ }
+ }
+
+ @available(iOS 13.0, *)
+ public func presentationAnchor(for controller: ASAuthorizationController) -> ASPresentationAnchor {
+ return self.view.window!
+ }
+
private func passwordEntryController(hint: String, suggestReset: Bool, syncContacts: Bool) -> AuthorizationSequencePasswordEntryController {
var currentController: AuthorizationSequencePasswordEntryController?
for c in self.viewControllers {
@@ -782,7 +934,11 @@ public final class AuthorizationSequenceController: NavigationController, MFMail
controllers.append(self.splashController())
}
controllers.append(self.phoneEntryController(countryCode: defaultCountryCode(), number: ""))
- controllers.append(self.codeEntryController(number: number, type: type, nextType: nextType, timeout: timeout, termsOfService: nil))
+ if case let .emailSetupRequired(appleSignInAllowed) = type {
+ controllers.append(self.emailSetupController(appleSignInAllowed: appleSignInAllowed))
+ } else {
+ controllers.append(self.codeEntryController(number: number, type: type, nextType: nextType, timeout: timeout, termsOfService: nil))
+ }
self.setViewControllers(controllers, animated: !self.viewControllers.isEmpty)
case let .passwordEntry(hint, _, _, suggestReset, syncContacts):
var controllers: [ViewController] = []
diff --git a/submodules/TelegramUI/Sources/AuthorizationSequenceEmailEntryController.swift b/submodules/TelegramUI/Sources/AuthorizationSequenceEmailEntryController.swift
new file mode 100644
index 0000000000..383b317194
--- /dev/null
+++ b/submodules/TelegramUI/Sources/AuthorizationSequenceEmailEntryController.swift
@@ -0,0 +1,114 @@
+import Foundation
+import UIKit
+import Display
+import AsyncDisplayKit
+import TelegramPresentationData
+import ProgressNavigationButtonNode
+
+final class AuthorizationSequenceEmailEntryController: ViewController {
+ private var controllerNode: AuthorizationSequenceEmailEntryControllerNode {
+ return self.displayNode as! AuthorizationSequenceEmailEntryControllerNode
+ }
+
+ private let presentationData: PresentationData
+
+ var proceedWithEmail: ((String) -> Void)?
+ var signInWithApple: (() -> Void)?
+
+ private let hapticFeedback = HapticFeedback()
+
+ private var appleSignInAllowed = false
+
+ var inProgress: Bool = false {
+ didSet {
+ if self.inProgress {
+ let item = UIBarButtonItem(customDisplayNode: ProgressNavigationButtonNode(color: self.presentationData.theme.rootController.navigationBar.accentTextColor))
+ self.navigationItem.rightBarButtonItem = item
+ } else {
+ self.navigationItem.rightBarButtonItem = UIBarButtonItem(title: self.presentationData.strings.Common_Next, style: .done, target: self, action: #selector(self.nextPressed))
+ }
+ self.controllerNode.inProgress = self.inProgress
+ }
+ }
+
+ init(presentationData: PresentationData, back: @escaping () -> Void) {
+ self.presentationData = presentationData
+
+ super.init(navigationBarPresentationData: NavigationBarPresentationData(theme: AuthorizationSequenceController.navigationBarTheme(presentationData.theme), strings: NavigationBarStrings(presentationStrings: presentationData.strings)))
+
+ self.supportedOrientations = ViewControllerSupportedOrientations(regularSize: .all, compactSize: .portrait)
+
+ self.hasActiveInput = true
+
+ self.statusBar.statusBarStyle = presentationData.theme.intro.statusBarStyle.style
+
+ self.attemptNavigation = { _ in
+ return false
+ }
+ self.navigationBar?.backPressed = {
+ back()
+ }
+
+// self.navigationItem.rightBarButtonItem = UIBarButtonItem(title: self.presentationData.strings.Common_Next, style: .done, target: self, action: #selector(self.nextPressed))
+ }
+
+ required init(coder aDecoder: NSCoder) {
+ fatalError("init(coder:) has not been implemented")
+ }
+
+ override public func loadDisplayNode() {
+ self.displayNode = AuthorizationSequenceEmailEntryControllerNode(strings: self.presentationData.strings, theme: self.presentationData.theme)
+ self.displayNodeDidLoad()
+
+ self.controllerNode.view.disableAutomaticKeyboardHandling = [.forward, .backward]
+
+ self.controllerNode.proceedWithEmail = { [weak self] _ in
+ self?.nextPressed()
+ }
+
+ self.controllerNode.signInWithApple = { [weak self] in
+ self?.signInWithApple?()
+ }
+
+ self.controllerNode.updateData(appleSignInAllowed: self.appleSignInAllowed)
+ }
+
+ override func viewDidAppear(_ animated: Bool) {
+ super.viewDidAppear(animated)
+
+ self.controllerNode.activateInput()
+ }
+
+ func updateData(appleSignInAllowed: Bool) {
+ var appleSignInAllowed = appleSignInAllowed
+ if #available(iOS 13.0, *) {
+ } else {
+ appleSignInAllowed = false
+ }
+ if self.appleSignInAllowed != appleSignInAllowed {
+ self.appleSignInAllowed = appleSignInAllowed
+ if self.isNodeLoaded {
+ self.controllerNode.updateData(appleSignInAllowed: appleSignInAllowed)
+ }
+ }
+ }
+
+ override func containerLayoutUpdated(_ layout: ContainerViewLayout, transition: ContainedViewLayoutTransition) {
+ super.containerLayoutUpdated(layout, transition: transition)
+
+ self.controllerNode.containerLayoutUpdated(layout, navigationBarHeight: self.navigationLayout(layout: layout).navigationFrame.maxY, transition: transition)
+ }
+
+ @objc func nextPressed() {
+ if self.controllerNode.currentEmail.isEmpty {
+ if self.appleSignInAllowed {
+ self.signInWithApple?()
+ } else {
+ self.hapticFeedback.error()
+ self.controllerNode.animateError()
+ }
+ } else {
+ self.proceedWithEmail?(self.controllerNode.currentEmail)
+ }
+ }
+}
diff --git a/submodules/TelegramUI/Sources/AuthorizationSequenceEmailEntryControllerNode.swift b/submodules/TelegramUI/Sources/AuthorizationSequenceEmailEntryControllerNode.swift
new file mode 100644
index 0000000000..7c51a5e948
--- /dev/null
+++ b/submodules/TelegramUI/Sources/AuthorizationSequenceEmailEntryControllerNode.swift
@@ -0,0 +1,206 @@
+import Foundation
+import UIKit
+import AsyncDisplayKit
+import Display
+import TelegramPresentationData
+import AuthorizationUI
+import AuthenticationServices
+import AnimatedStickerNode
+import TelegramAnimatedStickerNode
+import SolidRoundedButtonNode
+
+final class AuthorizationSequenceEmailEntryControllerNode: ASDisplayNode, UITextFieldDelegate {
+ private let strings: PresentationStrings
+ private let theme: PresentationTheme
+
+ private let animationNode: AnimatedStickerNode
+ private let titleNode: ASTextNode
+ private let noticeNode: ASTextNode
+
+ private var signInWithAppleButton: UIControl?
+ private let proceedNode: SolidRoundedButtonNode
+
+ private let codeField: TextFieldNode
+ private let codeSeparatorNode: ASDisplayNode
+
+ private var layoutArguments: (ContainerViewLayout, CGFloat)?
+
+ var currentEmail: String {
+ return self.codeField.textField.text ?? ""
+ }
+
+ var proceedWithEmail: ((String) -> Void)?
+ var signInWithApple: (() -> Void)?
+
+ private var appleSignInAllowed = false
+
+ var inProgress: Bool = false {
+ didSet {
+ self.codeField.alpha = self.inProgress ? 0.6 : 1.0
+ }
+ }
+
+ init(strings: PresentationStrings, theme: PresentationTheme) {
+ self.strings = strings
+ self.theme = theme
+
+ self.animationNode = DefaultAnimatedStickerNodeImpl()
+ self.animationNode.setup(source: AnimatedStickerNodeLocalFileSource(name: "IntroMail"), width: 256, height: 256, playbackMode: .loop, mode: .direct(cachePathPrefix: nil))
+ self.animationNode.visibility = true
+
+ self.titleNode = ASTextNode()
+ self.titleNode.isUserInteractionEnabled = false
+ self.titleNode.displaysAsynchronously = false
+ self.titleNode.attributedText = NSAttributedString(string: "Add Email", font: Font.light(30.0), textColor: self.theme.list.itemPrimaryTextColor)
+
+ self.noticeNode = ASTextNode()
+ self.noticeNode.isUserInteractionEnabled = false
+ self.noticeNode.displaysAsynchronously = false
+ self.noticeNode.attributedText = NSAttributedString(string: "Please enter your valid email address to protect your account.", font: Font.regular(16.0), textColor: self.theme.list.itemPrimaryTextColor, paragraphAlignment: .center)
+
+ if #available(iOS 13.0, *) {
+ self.signInWithAppleButton = ASAuthorizationAppleIDButton(authorizationButtonType: .signIn, authorizationButtonStyle: theme.overallDarkAppearance ? .white : .black)
+ (self.signInWithAppleButton as? ASAuthorizationAppleIDButton)?.cornerRadius = 11
+ }
+
+ self.proceedNode = SolidRoundedButtonNode(title: "Continue", theme: SolidRoundedButtonTheme(theme: self.theme), height: 50.0, cornerRadius: 11.0, gloss: false)
+
+ self.codeSeparatorNode = ASDisplayNode()
+ self.codeSeparatorNode.isLayerBacked = true
+ self.codeSeparatorNode.backgroundColor = self.theme.list.itemPlainSeparatorColor
+
+ self.codeField = TextFieldNode()
+ self.codeField.textField.font = Font.regular(20.0)
+ self.codeField.textField.textColor = self.theme.list.itemPrimaryTextColor
+ self.codeField.textField.textAlignment = .natural
+ self.codeField.textField.keyboardType = .emailAddress
+ self.codeField.textField.autocorrectionType = .no
+ self.codeField.textField.autocapitalizationType = .none
+ self.codeField.textField.returnKeyType = .done
+ self.codeField.textField.keyboardAppearance = self.theme.rootController.keyboardColor.keyboardAppearance
+ self.codeField.textField.disableAutomaticKeyboardHandling = [.forward, .backward]
+ self.codeField.textField.tintColor = self.theme.list.itemAccentColor
+ self.codeField.textField.placeholder = "Enter Your Email"
+
+ super.init()
+
+ self.setViewBlock({
+ return UITracingLayerView()
+ })
+
+ self.backgroundColor = self.theme.list.plainBackgroundColor
+
+ self.codeField.textField.delegate = self
+
+ self.addSubnode(self.codeSeparatorNode)
+ self.addSubnode(self.codeField)
+ self.addSubnode(self.titleNode)
+ self.addSubnode(self.proceedNode)
+ self.addSubnode(self.noticeNode)
+ self.addSubnode(self.animationNode)
+
+ self.codeField.textField.addTarget(self, action: #selector(self.textDidChange), for: .editingChanged)
+ self.proceedNode.pressed = { [weak self] in
+ self?.proceedPressed()
+ }
+ self.signInWithAppleButton?.addTarget(self, action: #selector(self.signInWithApplePressed), for: .touchUpInside)
+ }
+
+ override func didLoad() {
+ super.didLoad()
+
+ if let signInWithAppleButton = self.signInWithAppleButton {
+ self.view.addSubview(signInWithAppleButton)
+ }
+ }
+
+ @objc private func textDidChange() {
+ self.updateButtonsVisibility(transition: .animated(duration: 0.2, curve: .easeInOut))
+ }
+
+ private func updateButtonsVisibility(transition: ContainedViewLayoutTransition) {
+ if self.currentEmail.isEmpty && self.appleSignInAllowed {
+ transition.updateAlpha(node: self.proceedNode, alpha: 0.0)
+ if let signInWithAppleButton = self.signInWithAppleButton {
+ transition.updateAlpha(layer: signInWithAppleButton.layer, alpha: 1.0)
+ }
+ } else {
+ transition.updateAlpha(node: self.proceedNode, alpha: 1.0)
+ if let signInWithAppleButton = self.signInWithAppleButton {
+ transition.updateAlpha(layer: signInWithAppleButton.layer, alpha: 0.0)
+ }
+ }
+ }
+
+ func updateData(appleSignInAllowed: Bool) {
+ self.appleSignInAllowed = appleSignInAllowed
+ if let (layout, navigationHeight) = self.layoutArguments {
+ self.updateButtonsVisibility(transition: .immediate)
+ self.containerLayoutUpdated(layout, navigationBarHeight: navigationHeight, transition: .immediate)
+ }
+ }
+
+ func containerLayoutUpdated(_ layout: ContainerViewLayout, navigationBarHeight: CGFloat, transition: ContainedViewLayoutTransition) {
+ self.layoutArguments = (layout, navigationBarHeight)
+
+ var insets = layout.insets(options: [])
+ insets.top = navigationBarHeight
+
+ if let inputHeight = layout.inputHeight {
+ insets.bottom += max(inputHeight, layout.standardInputHeight)
+ }
+
+ self.titleNode.attributedText = NSAttributedString(string: "Add Email", font: Font.semibold(28.0), textColor: self.theme.list.itemPrimaryTextColor)
+
+ let animationSize = CGSize(width: 88.0, height: 88.0)
+ let titleSize = self.titleNode.measure(CGSize(width: layout.size.width, height: CGFloat.greatestFiniteMagnitude))
+
+ let noticeSize = self.noticeNode.measure(CGSize(width: layout.size.width - 80.0, height: CGFloat.greatestFiniteMagnitude))
+ let proceedHeight = self.proceedNode.updateLayout(width: layout.size.width - 48.0, transition: transition)
+ let proceedSize = CGSize(width: layout.size.width - 48.0, height: proceedHeight)
+
+ var items: [AuthorizationLayoutItem] = []
+ items.append(AuthorizationLayoutItem(node: self.animationNode, size: animationSize, spacingBefore: AuthorizationLayoutItemSpacing(weight: 0.0, maxValue: 0.0), spacingAfter: AuthorizationLayoutItemSpacing(weight: 0.0, maxValue: 0.0)))
+ self.animationNode.updateLayout(size: animationSize)
+
+ items.append(AuthorizationLayoutItem(node: self.titleNode, size: titleSize, spacingBefore: AuthorizationLayoutItemSpacing(weight: 18.0, maxValue: 18.0), spacingAfter: AuthorizationLayoutItemSpacing(weight: 0.0, maxValue: 0.0)))
+ items.append(AuthorizationLayoutItem(node: self.noticeNode, size: noticeSize, spacingBefore: AuthorizationLayoutItemSpacing(weight: 20.0, maxValue: 20.0), spacingAfter: AuthorizationLayoutItemSpacing(weight: 0.0, maxValue: 0.0)))
+
+ items.append(AuthorizationLayoutItem(node: self.codeField, size: CGSize(width: layout.size.width - 88.0, height: 44.0), spacingBefore: AuthorizationLayoutItemSpacing(weight: 32.0, maxValue: 60.0), spacingAfter: AuthorizationLayoutItemSpacing(weight: 0.0, maxValue: 0.0)))
+ items.append(AuthorizationLayoutItem(node: self.codeSeparatorNode, size: CGSize(width: layout.size.width - 48.0, height: UIScreenPixel), spacingBefore: AuthorizationLayoutItemSpacing(weight: 0.0, maxValue: 0.0), spacingAfter: AuthorizationLayoutItemSpacing(weight: 0.0, maxValue: 0.0)))
+
+ items.append(AuthorizationLayoutItem(node: self.proceedNode, size: proceedSize, spacingBefore: AuthorizationLayoutItemSpacing(weight: 48.0, maxValue: 100.0), spacingAfter: AuthorizationLayoutItemSpacing(weight: 0.0, maxValue: 0.0)))
+
+ let _ = layoutAuthorizationItems(bounds: CGRect(origin: CGPoint(x: 0.0, y: insets.top), size: CGSize(width: layout.size.width, height: layout.size.height - insets.top - insets.bottom - 20.0)), items: items, transition: transition, failIfDoesNotFit: false)
+
+ if let signInWithAppleButton = self.signInWithAppleButton {
+ if self.appleSignInAllowed {
+ signInWithAppleButton.isHidden = false
+ transition.updateFrame(view: signInWithAppleButton, frame: self.proceedNode.frame)
+ } else {
+ signInWithAppleButton.isHidden = true
+ }
+ }
+ }
+
+ func activateInput() {
+ self.codeField.textField.becomeFirstResponder()
+ }
+
+ func animateError() {
+ self.codeField.layer.addShakeAnimation()
+ }
+
+ func textFieldShouldReturn(_ textField: UITextField) -> Bool {
+ self.proceedWithEmail?(self.currentEmail)
+ return false
+ }
+
+ @objc func proceedPressed() {
+ self.proceedWithEmail?(self.currentEmail)
+ }
+
+ @objc func signInWithApplePressed() {
+ self.signInWithApple?()
+ }
+}
diff --git a/submodules/TelegramUI/Sources/AuthorizationSequencePasswordEntryController.swift b/submodules/TelegramUI/Sources/AuthorizationSequencePasswordEntryController.swift
index 76cac93c42..6d339f1532 100644
--- a/submodules/TelegramUI/Sources/AuthorizationSequencePasswordEntryController.swift
+++ b/submodules/TelegramUI/Sources/AuthorizationSequencePasswordEntryController.swift
@@ -121,7 +121,7 @@ final class AuthorizationSequencePasswordEntryController: ViewController {
@objc func nextPressed() {
if self.controllerNode.currentPassword.isEmpty {
- hapticFeedback.error()
+ self.hapticFeedback.error()
self.controllerNode.animateError()
} else {
self.loginWithPassword?(self.controllerNode.currentPassword)
diff --git a/submodules/TelegramUI/Sources/AuthorizationSequencePasswordEntryControllerNode.swift b/submodules/TelegramUI/Sources/AuthorizationSequencePasswordEntryControllerNode.swift
index 7bb6c9fe68..150e8504c4 100644
--- a/submodules/TelegramUI/Sources/AuthorizationSequencePasswordEntryControllerNode.swift
+++ b/submodules/TelegramUI/Sources/AuthorizationSequencePasswordEntryControllerNode.swift
@@ -45,7 +45,7 @@ final class AuthorizationSequencePasswordEntryControllerNode: ASDisplayNode, UIT
self.titleNode = ASTextNode()
self.titleNode.isUserInteractionEnabled = false
self.titleNode.displaysAsynchronously = false
- self.titleNode.attributedText = NSAttributedString(string: strings.LoginPassword_Title, font: Font.light(30.0), textColor: self.theme.list.itemPrimaryTextColor)
+ self.titleNode.attributedText = NSAttributedString(string: strings.LoginPassword_Title, font: Font.semibold(28.0), textColor: self.theme.list.itemPrimaryTextColor)
self.noticeNode = ASTextNode()
self.noticeNode.isUserInteractionEnabled = false
@@ -114,11 +114,7 @@ final class AuthorizationSequencePasswordEntryControllerNode: ASDisplayNode, UIT
insets.bottom += max(inputHeight, layout.standardInputHeight)
}
- if max(layout.size.width, layout.size.height) > 1023.0 {
- self.titleNode.attributedText = NSAttributedString(string: self.strings.LoginPassword_Title, font: Font.light(40.0), textColor: self.theme.list.itemPrimaryTextColor)
- } else {
- self.titleNode.attributedText = NSAttributedString(string: self.strings.LoginPassword_Title, font: Font.light(30.0), textColor: self.theme.list.itemPrimaryTextColor)
- }
+ self.titleNode.attributedText = NSAttributedString(string: self.strings.LoginPassword_Title, font: Font.semibold(28.0), textColor: self.theme.list.itemPrimaryTextColor)
let titleSize = self.titleNode.measure(CGSize(width: layout.size.width, height: CGFloat.greatestFiniteMagnitude))
@@ -128,9 +124,9 @@ final class AuthorizationSequencePasswordEntryControllerNode: ASDisplayNode, UIT
var items: [AuthorizationLayoutItem] = []
items.append(AuthorizationLayoutItem(node: self.titleNode, size: titleSize, spacingBefore: AuthorizationLayoutItemSpacing(weight: 0.0, maxValue: 0.0), spacingAfter: AuthorizationLayoutItemSpacing(weight: 0.0, maxValue: 0.0)))
- items.append(AuthorizationLayoutItem(node: self.noticeNode, size: noticeSize, spacingBefore: AuthorizationLayoutItemSpacing(weight: 10.0, maxValue: 10.0), spacingAfter: AuthorizationLayoutItemSpacing(weight: 0.0, maxValue: 0.0)))
+ items.append(AuthorizationLayoutItem(node: self.noticeNode, size: noticeSize, spacingBefore: AuthorizationLayoutItemSpacing(weight: 18.0, maxValue: 18.0), spacingAfter: AuthorizationLayoutItemSpacing(weight: 0.0, maxValue: 0.0)))
- items.append(AuthorizationLayoutItem(node: self.codeField, size: CGSize(width: layout.size.width - 88.0, height: 44.0), spacingBefore: AuthorizationLayoutItemSpacing(weight: 32.0, maxValue: 100.0), spacingAfter: AuthorizationLayoutItemSpacing(weight: 0.0, maxValue: 0.0)))
+ items.append(AuthorizationLayoutItem(node: self.codeField, size: CGSize(width: layout.size.width - 88.0, height: 44.0), spacingBefore: AuthorizationLayoutItemSpacing(weight: 32.0, maxValue: 60.0), spacingAfter: AuthorizationLayoutItemSpacing(weight: 0.0, maxValue: 0.0)))
items.append(AuthorizationLayoutItem(node: self.codeSeparatorNode, size: CGSize(width: layout.size.width - 88.0, height: UIScreenPixel), spacingBefore: AuthorizationLayoutItemSpacing(weight: 0.0, maxValue: 0.0), spacingAfter: AuthorizationLayoutItemSpacing(weight: 0.0, maxValue: 0.0)))
items.append(AuthorizationLayoutItem(node: self.forgotNode, size: forgotSize, spacingBefore: AuthorizationLayoutItemSpacing(weight: 48.0, maxValue: 100.0), spacingAfter: AuthorizationLayoutItemSpacing(weight: 0.0, maxValue: 0.0)))
diff --git a/submodules/TelegramUI/Sources/AuthorizationSequencePhoneEntryController.swift b/submodules/TelegramUI/Sources/AuthorizationSequencePhoneEntryController.swift
index c657ec572d..8b1a7f3647 100644
--- a/submodules/TelegramUI/Sources/AuthorizationSequencePhoneEntryController.swift
+++ b/submodules/TelegramUI/Sources/AuthorizationSequencePhoneEntryController.swift
@@ -75,7 +75,7 @@ final class AuthorizationSequencePhoneEntryController: ViewController {
if !otherAccountPhoneNumbers.1.isEmpty {
self.navigationItem.leftBarButtonItem = UIBarButtonItem(title: presentationData.strings.Common_Cancel, style: .plain, target: self, action: #selector(self.cancelPressed))
}
- self.navigationItem.rightBarButtonItem = UIBarButtonItem(title: presentationData.strings.Common_Next, style: .done, target: self, action: #selector(self.nextPressed))
+// self.navigationItem.rightBarButtonItem = UIBarButtonItem(title: presentationData.strings.Common_Next, style: .done, target: self, action: #selector(self.nextPressed))
}
required init(coder aDecoder: NSCoder) {
@@ -186,7 +186,14 @@ final class AuthorizationSequencePhoneEntryController: ViewController {
actions.append(TextAlertAction(type: .defaultAction, title: self.presentationData.strings.Common_OK, action: {}))
self.present(standardTextAlertController(theme: AlertControllerTheme(presentationData: self.presentationData), title: nil, text: self.presentationData.strings.Login_PhoneNumberAlreadyAuthorized, actions: actions), in: .window(.root))
} else {
- self.loginWithNumber?(self.controllerNode.currentNumber, self.controllerNode.syncContacts)
+ var actions: [TextAlertAction] = []
+ actions.append(TextAlertAction(type: .genericAction, title: self.presentationData.strings.Login_Edit, action: {}))
+ actions.append(TextAlertAction(type: .defaultAction, title: self.presentationData.strings.Login_Yes, action: { [weak self] in
+ if let strongSelf = self {
+ strongSelf.loginWithNumber?(strongSelf.controllerNode.currentNumber, strongSelf.controllerNode.syncContacts)
+ }
+ }))
+ self.present(standardTextAlertController(theme: AlertControllerTheme(presentationData: self.presentationData), title: logInNumber, text: self.presentationData.strings.Login_PhoneNumberConfirmation, actions: actions), in: .window(.root))
}
} else {
self.hapticFeedback.error()
diff --git a/submodules/TelegramUI/Sources/AuthorizationSequencePhoneEntryControllerNode.swift b/submodules/TelegramUI/Sources/AuthorizationSequencePhoneEntryControllerNode.swift
index 321bb19998..a5595b0645 100644
--- a/submodules/TelegramUI/Sources/AuthorizationSequencePhoneEntryControllerNode.swift
+++ b/submodules/TelegramUI/Sources/AuthorizationSequencePhoneEntryControllerNode.swift
@@ -11,6 +11,9 @@ import QrCode
import SwiftSignalKit
import Postbox
import AccountContext
+import AnimatedStickerNode
+import TelegramAnimatedStickerNode
+import SolidRoundedButtonNode
private final class PhoneAndCountryNode: ASDisplayNode {
let strings: PresentationStrings
@@ -116,7 +119,7 @@ private final class PhoneAndCountryNode: ASDisplayNode {
if let (country, _) = AuthorizationSequenceCountrySelectionController.lookupCountryIdByNumber(number, preferredCountries: strongSelf.preferredCountryIdForCode) {
let flagString = emojiFlagForISOCountryCode(country.id)
let localizedName: String = AuthorizationSequenceCountrySelectionController.lookupCountryNameById(country.id, strings: strongSelf.strings) ?? country.name
- strongSelf.countryButton.setTitle("\(flagString) \(localizedName)", with: Font.regular(20.0), with: theme.list.itemPrimaryTextColor, for: [])
+ strongSelf.countryButton.setTitle("\(flagString) \(localizedName)", with: Font.regular(20.0), with: theme.list.itemAccentColor, for: [])
let maskFont = Font.with(size: 20.0, design: .regular, traits: [.monospacedNumbers])
if let mask = AuthorizationSequenceCountrySelectionController.lookupPatternByNumber(number, preferredCountries: strongSelf.preferredCountryIdForCode).flatMap({ NSAttributedString(string: $0, font: maskFont, textColor: theme.list.itemPlaceholderTextColor) }) {
@@ -148,15 +151,15 @@ private final class PhoneAndCountryNode: ASDisplayNode {
} else if let code = Int(code), let name = name, let countryName = countryCodeAndIdToName[CountryCodeAndId(code: code, id: name)] {
let flagString = emojiFlagForISOCountryCode(name)
let localizedName: String = AuthorizationSequenceCountrySelectionController.lookupCountryNameById(name, strings: strongSelf.strings) ?? countryName
- strongSelf.countryButton.setTitle("\(flagString) \(localizedName)", with: Font.regular(20.0), with: theme.list.itemPrimaryTextColor, for: [])
+ strongSelf.countryButton.setTitle("\(flagString) \(localizedName)", with: Font.regular(20.0), with: theme.list.itemAccentColor, for: [])
strongSelf.phoneInputNode.numberField.textField.attributedPlaceholder = NSAttributedString(string: strings.Login_PhonePlaceholder, font: Font.regular(20.0), textColor: theme.list.itemPlaceholderTextColor)
} else if let code = Int(code), let (countryId, countryName) = countryCodeToIdAndName[code] {
let flagString = emojiFlagForISOCountryCode(countryId)
let localizedName: String = AuthorizationSequenceCountrySelectionController.lookupCountryNameById(countryId, strings: strongSelf.strings) ?? countryName
- strongSelf.countryButton.setTitle("\(flagString) \(localizedName)", with: Font.regular(20.0), with: theme.list.itemPrimaryTextColor, for: [])
+ strongSelf.countryButton.setTitle("\(flagString) \(localizedName)", with: Font.regular(20.0), with: theme.list.itemAccentColor, for: [])
strongSelf.phoneInputNode.numberField.textField.attributedPlaceholder = NSAttributedString(string: strings.Login_PhonePlaceholder, font: Font.regular(20.0), textColor: theme.list.itemPlaceholderTextColor)
} else {
- strongSelf.countryButton.setTitle(strings.Login_SelectCountry_Title, with: Font.regular(20.0), with: theme.list.itemPlaceholderTextColor, for: [])
+ strongSelf.countryButton.setTitle(strings.Login_SelectCountry_Title, with: Font.regular(20.0), with: theme.list.itemAccentColor, for: [])
strongSelf.phoneInputNode.mask = nil
strongSelf.phoneInputNode.numberField.textField.attributedPlaceholder = NSAttributedString(string: strings.Login_PhonePlaceholder, font: Font.regular(20.0), textColor: theme.list.itemPlaceholderTextColor)
}
@@ -241,10 +244,12 @@ final class AuthorizationSequencePhoneEntryControllerNode: ASDisplayNode {
private let theme: PresentationTheme
private let hasOtherAccounts: Bool
+ private let animationNode: AnimatedStickerNode
private let titleNode: ASTextNode
private let noticeNode: ASTextNode
private let phoneAndCountryNode: PhoneAndCountryNode
private let contactSyncNode: ContactSyncNode
+ private let proceedNode: SolidRoundedButtonNode
private var qrNode: ASImageNode?
private let exportTokenDisposable = MetaDisposable()
@@ -295,6 +300,10 @@ final class AuthorizationSequencePhoneEntryControllerNode: ASDisplayNode {
self.debugAction = debugAction
self.hasOtherAccounts = hasOtherAccounts
+ self.animationNode = DefaultAnimatedStickerNodeImpl()
+ self.animationNode.setup(source: AnimatedStickerNodeLocalFileSource(name: "IntroPhone"), width: 256, height: 256, playbackMode: .loop, mode: .direct(cachePathPrefix: nil))
+ self.animationNode.visibility = true
+
self.titleNode = ASTextNode()
self.titleNode.isUserInteractionEnabled = true
self.titleNode.displaysAsynchronously = false
@@ -310,6 +319,8 @@ final class AuthorizationSequencePhoneEntryControllerNode: ASDisplayNode {
self.phoneAndCountryNode = PhoneAndCountryNode(strings: strings, theme: theme)
+ self.proceedNode = SolidRoundedButtonNode(title: "Continue", theme: SolidRoundedButtonTheme(theme: self.theme), height: 50.0, cornerRadius: 11.0, gloss: false)
+
super.init()
self.setViewBlock({
@@ -322,6 +333,8 @@ final class AuthorizationSequencePhoneEntryControllerNode: ASDisplayNode {
self.addSubnode(self.noticeNode)
self.addSubnode(self.phoneAndCountryNode)
self.addSubnode(self.contactSyncNode)
+ self.addSubnode(self.proceedNode)
+ self.addSubnode(self.animationNode)
self.contactSyncNode.isHidden = true
self.phoneAndCountryNode.selectCountryCode = { [weak self] in
@@ -335,6 +348,10 @@ final class AuthorizationSequencePhoneEntryControllerNode: ASDisplayNode {
|> deliverOnMainQueue).start(next: { [weak self] _ in
self?.refreshQrToken()
}))
+
+ self.proceedNode.pressed = { [weak self] in
+ self?.checkPhone?()
+ }
}
deinit {
@@ -363,19 +380,19 @@ final class AuthorizationSequencePhoneEntryControllerNode: ASDisplayNode {
insets.bottom += max(inputHeight, layout.standardInputHeight)
}
- if max(layout.size.width, layout.size.height) > 1023.0 {
- self.titleNode.attributedText = NSAttributedString(string: strings.Login_PhoneTitle, font: Font.light(40.0), textColor: self.theme.list.itemPrimaryTextColor)
- } else {
- self.titleNode.attributedText = NSAttributedString(string: strings.Login_PhoneTitle, font: Font.light(30.0), textColor: self.theme.list.itemPrimaryTextColor)
- }
+ self.titleNode.attributedText = NSAttributedString(string: strings.Login_PhoneTitle, font: Font.semibold(28.0), textColor: self.theme.list.itemPrimaryTextColor)
+ let animationSize = CGSize(width: 88.0, height: 88.0)
let titleSize = self.titleNode.measure(CGSize(width: layout.size.width, height: CGFloat.greatestFiniteMagnitude))
let noticeSize = self.noticeNode.measure(CGSize(width: min(274.0, layout.size.width - 28.0), height: CGFloat.greatestFiniteMagnitude))
+ let proceedHeight = self.proceedNode.updateLayout(width: layout.size.width - 48.0, transition: transition)
+ let proceedSize = CGSize(width: layout.size.width - 48.0, height: proceedHeight)
var items: [AuthorizationLayoutItem] = [
- AuthorizationLayoutItem(node: self.titleNode, size: titleSize, spacingBefore: AuthorizationLayoutItemSpacing(weight: 0.0, maxValue: 0.0), spacingAfter: AuthorizationLayoutItemSpacing(weight: 0.0, maxValue: 0.0)),
- AuthorizationLayoutItem(node: self.noticeNode, size: noticeSize, spacingBefore: AuthorizationLayoutItemSpacing(weight: 18.0, maxValue: 18.0), spacingAfter: AuthorizationLayoutItemSpacing(weight: 0.0, maxValue: 0.0)),
- AuthorizationLayoutItem(node: self.phoneAndCountryNode, size: CGSize(width: layout.size.width, height: 115.0), spacingBefore: AuthorizationLayoutItemSpacing(weight: 44.0, maxValue: 44.0), spacingAfter: AuthorizationLayoutItemSpacing(weight: 0.0, maxValue: 0.0))
+ AuthorizationLayoutItem(node: self.animationNode, size: animationSize, spacingBefore: AuthorizationLayoutItemSpacing(weight: 0.0, maxValue: 0.0), spacingAfter: AuthorizationLayoutItemSpacing(weight: 0.0, maxValue: 0.0)),
+ AuthorizationLayoutItem(node: self.titleNode, size: titleSize, spacingBefore: AuthorizationLayoutItemSpacing(weight: 18.0, maxValue: 18.0), spacingAfter: AuthorizationLayoutItemSpacing(weight: 0.0, maxValue: 0.0)),
+ AuthorizationLayoutItem(node: self.noticeNode, size: noticeSize, spacingBefore: AuthorizationLayoutItemSpacing(weight: 20.0, maxValue: 20.0), spacingAfter: AuthorizationLayoutItemSpacing(weight: 0.0, maxValue: 0.0)),
+ AuthorizationLayoutItem(node: self.phoneAndCountryNode, size: CGSize(width: layout.size.width, height: 115.0), spacingBefore: AuthorizationLayoutItemSpacing(weight: 44.0, maxValue: 44.0), spacingAfter: AuthorizationLayoutItemSpacing(weight: 0.0, maxValue: 0.0)),
]
let contactSyncSize = self.contactSyncNode.updateLayout(width: layout.size.width)
if self.hasOtherAccounts {
@@ -385,6 +402,10 @@ final class AuthorizationSequencePhoneEntryControllerNode: ASDisplayNode {
self.contactSyncNode.isHidden = true
}
+ items.append(AuthorizationLayoutItem(node: self.proceedNode, size: proceedSize, spacingBefore: AuthorizationLayoutItemSpacing(weight: 48.0, maxValue: 100.0), spacingAfter: AuthorizationLayoutItemSpacing(weight: 0.0, maxValue: 0.0)))
+
+ self.animationNode.updateLayout(size: animationSize)
+
let _ = layoutAuthorizationItems(bounds: CGRect(origin: CGPoint(x: 0.0, y: insets.top), size: CGSize(width: layout.size.width, height: layout.size.height - insets.top - insets.bottom - 10.0)), items: items, transition: transition, failIfDoesNotFit: false)
}