diff --git a/submodules/AuthorizationUI/Sources/AuthorizationOptionText.swift b/submodules/AuthorizationUI/Sources/AuthorizationOptionText.swift index e9a6dd5ae7..1b9df36546 100644 --- a/submodules/AuthorizationUI/Sources/AuthorizationOptionText.swift +++ b/submodules/AuthorizationUI/Sources/AuthorizationOptionText.swift @@ -14,7 +14,7 @@ public func authorizationCurrentOptionText(_ type: SentAuthorizationCodeType, st let body = MarkdownAttributeSet(font: Font.regular(16.0), textColor: primaryColor) let bold = MarkdownAttributeSet(font: Font.semibold(16.0), textColor: primaryColor) return parseMarkdownIntoAttributedString(strings.Login_CodeSentInternal, attributes: MarkdownAttributes(body: body, bold: bold, link: body, linkAttribute: { _ in nil }), textAlignment: .center) - case .call, .flashCall: + case .call, .flashCall, .missedCall: return NSAttributedString(string: strings.ChangePhoneNumberCode_Called, font: Font.regular(16.0), textColor: primaryColor, paragraphAlignment: .center) } } @@ -31,7 +31,7 @@ public func authorizationNextOptionText(currentType: SentAuthorizationCodeType, let timeString = NSString(format: "%d:%.02d", Int(minutes), Int(seconds)) return (NSAttributedString(string: strings.Login_WillSendSms(timeString as String).string, font: Font.regular(16.0), textColor: primaryColor, paragraphAlignment: .center), false) } - case .call, .flashCall: + case .call, .flashCall, .missedCall: if timeout <= 0 { return (NSAttributedString(string: strings.ChangePhoneNumberCode_Called, font: Font.regular(16.0), textColor: primaryColor, paragraphAlignment: .center), false) } else { diff --git a/submodules/TelegramApi/Sources/Api0.swift b/submodules/TelegramApi/Sources/Api0.swift index ddb54345c8..8df71aae5d 100644 --- a/submodules/TelegramApi/Sources/Api0.swift +++ b/submodules/TelegramApi/Sources/Api0.swift @@ -342,7 +342,7 @@ fileprivate let parsers: [Int32 : (BufferReader) -> Any?] = { dict[-842824308] = { return Api.account.WallPapers.parse_wallPapers($0) } dict[1012306921] = { return Api.InputTheme.parse_inputTheme($0) } dict[-175567375] = { return Api.InputTheme.parse_inputThemeSlug($0) } - dict[-1199954735] = { return Api.MessageReactions.parse_messageReactions($0) } + dict[142306870] = { return Api.MessageReactions.parse_messageReactions($0) } dict[-2032041631] = { return Api.Poll.parse_poll($0) } dict[-1195615476] = { return Api.InputNotifyPeer.parse_inputNotifyPeer($0) } dict[423314455] = { return Api.InputNotifyPeer.parse_inputNotifyUsers($0) } @@ -479,6 +479,7 @@ fileprivate let parsers: [Int32 : (BufferReader) -> Any?] = { dict[1855199800] = { return Api.ChannelAdminLogEventAction.parse_channelAdminLogEventActionChangeHistoryTTL($0) } dict[-1347021750] = { return Api.ChannelAdminLogEventAction.parse_channelAdminLogEventActionParticipantJoinByRequest($0) } dict[-886388890] = { return Api.ChannelAdminLogEventAction.parse_channelAdminLogEventActionToggleNoForwards($0) } + dict[663693416] = { return Api.ChannelAdminLogEventAction.parse_channelAdminLogEventActionSendMessage($0) } dict[-1271602504] = { return Api.auth.ExportedAuthorization.parse_exportedAuthorization($0) } dict[2103482845] = { return Api.SecurePlainData.parse_securePlainPhone($0) } dict[569137759] = { return Api.SecurePlainData.parse_securePlainEmail($0) } @@ -520,7 +521,7 @@ fileprivate let parsers: [Int32 : (BufferReader) -> Any?] = { dict[-2128640689] = { return Api.account.SentEmailCode.parse_sentEmailCode($0) } dict[-1038136962] = { return Api.EncryptedFile.parse_encryptedFileEmpty($0) } dict[1248893260] = { return Api.EncryptedFile.parse_encryptedFile($0) } - dict[-557924733] = { return Api.CodeSettings.parse_codeSettings($0) } + dict[-1973130814] = { return Api.CodeSettings.parse_codeSettings($0) } dict[-1343921601] = { return Api.phone.JoinAsPeers.parse_joinAsPeers($0) } dict[-391902247] = { return Api.SecureValueError.parse_secureValueErrorData($0) } dict[12467706] = { return Api.SecureValueError.parse_secureValueErrorFrontSide($0) } @@ -623,7 +624,7 @@ fileprivate let parsers: [Int32 : (BufferReader) -> Any?] = { dict[1682413576] = { return Api.messages.Messages.parse_channelMessages($0) } dict[1951620897] = { return Api.messages.Messages.parse_messagesNotModified($0) } dict[215516896] = { return Api.Invoice.parse_invoice($0) } - dict[-1474130642] = { return Api.PeerSettings.parse_peerSettings($0) } + dict[-1525149427] = { return Api.PeerSettings.parse_peerSettings($0) } dict[1577067778] = { return Api.auth.SentCode.parse_sentCode($0) } dict[480546647] = { return Api.InputChatPhoto.parse_inputChatPhotoEmpty($0) } dict[-968723890] = { return Api.InputChatPhoto.parse_inputChatUploadedPhoto($0) } @@ -660,6 +661,7 @@ fileprivate let parsers: [Int32 : (BufferReader) -> Any?] = { dict[1923290508] = { return Api.auth.CodeType.parse_codeTypeSms($0) } dict[1948046307] = { return Api.auth.CodeType.parse_codeTypeCall($0) } dict[577556219] = { return Api.auth.CodeType.parse_codeTypeFlashCall($0) } + dict[-702884114] = { return Api.auth.CodeType.parse_codeTypeMissedCall($0) } dict[1815593308] = { return Api.DocumentAttribute.parse_documentAttributeImageSize($0) } dict[297109817] = { return Api.DocumentAttribute.parse_documentAttributeAnimated($0) } dict[1662637586] = { return Api.DocumentAttribute.parse_documentAttributeSticker($0) } @@ -684,6 +686,7 @@ fileprivate let parsers: [Int32 : (BufferReader) -> Any?] = { dict[42402760] = { return Api.InputStickerSet.parse_inputStickerSetAnimatedEmoji($0) } dict[-427863538] = { return Api.InputStickerSet.parse_inputStickerSetDice($0) } dict[215889721] = { return Api.InputStickerSet.parse_inputStickerSetAnimatedEmojiAnimations($0) } + dict[1189248700] = { return Api.InputStickerSet.parse_inputStickerSetAnimatedEmojiReactions($0) } dict[-1231326505] = { return Api.messages.ChatAdminsWithInvites.parse_chatAdminsWithInvites($0) } dict[460632885] = { return Api.BotInfo.parse_botInfo($0) } dict[-2046910401] = { return Api.stickers.SuggestedShortName.parse_suggestedShortName($0) } @@ -788,7 +791,7 @@ fileprivate let parsers: [Int32 : (BufferReader) -> Any?] = { dict[-290921362] = { return Api.upload.CdnFile.parse_cdnFileReuploadNeeded($0) } dict[-1449145777] = { return Api.upload.CdnFile.parse_cdnFile($0) } dict[415997816] = { return Api.help.InviteText.parse_inviteText($0) } - dict[-764945220] = { return Api.MessageUserReaction.parse_messageUserReaction($0) } + dict[-1826077446] = { return Api.MessageUserReaction.parse_messageUserReaction($0) } dict[1984755728] = { return Api.BotInlineMessage.parse_botInlineMessageMediaAuto($0) } dict[-1937807902] = { return Api.BotInlineMessage.parse_botInlineMessageText($0) } dict[85477117] = { return Api.BotInlineMessage.parse_botInlineMessageMediaGeo($0) } @@ -929,6 +932,7 @@ fileprivate let parsers: [Int32 : (BufferReader) -> Any?] = { dict[-1073693790] = { return Api.auth.SentCodeType.parse_sentCodeTypeSms($0) } dict[1398007207] = { return Api.auth.SentCodeType.parse_sentCodeTypeCall($0) } dict[-1425815847] = { return Api.auth.SentCodeType.parse_sentCodeTypeFlashCall($0) } + dict[-2113903484] = { return Api.auth.SentCodeType.parse_sentCodeTypeMissedCall($0) } dict[1577484359] = { return Api.PageListOrderedItem.parse_pageListOrderedItemText($0) } dict[-1730311882] = { return Api.PageListOrderedItem.parse_pageListOrderedItemBlocks($0) } dict[-1417756512] = { return Api.EncryptedChat.parse_encryptedChatEmpty($0) } @@ -938,6 +942,7 @@ fileprivate let parsers: [Int32 : (BufferReader) -> Any?] = { dict[505183301] = { return Api.EncryptedChat.parse_encryptedChatDiscarded($0) } dict[-901375139] = { return Api.PeerLocated.parse_peerLocated($0) } dict[-118740917] = { return Api.PeerLocated.parse_peerSelfLocated($0) } + dict[-1957096922] = { return Api.auth.LoggedOut.parse_loggedOut($0) } dict[922273905] = { return Api.Document.parse_documentEmpty($0) } dict[512177195] = { return Api.Document.parse_document($0) } dict[-1707344487] = { return Api.messages.HighScores.parse_highScores($0) } @@ -1655,6 +1660,8 @@ public struct Api { _1.serialize(buffer, boxed) case let _1 as Api.PeerLocated: _1.serialize(buffer, boxed) + case let _1 as Api.auth.LoggedOut: + _1.serialize(buffer, boxed) case let _1 as Api.Document: _1.serialize(buffer, boxed) case let _1 as Api.messages.HighScores: diff --git a/submodules/TelegramApi/Sources/Api2.swift b/submodules/TelegramApi/Sources/Api2.swift index 0481491c28..21800c6d3d 100644 --- a/submodules/TelegramApi/Sources/Api2.swift +++ b/submodules/TelegramApi/Sources/Api2.swift @@ -8902,13 +8902,13 @@ public extension Api { } public enum MessageReactions: TypeConstructorDescription { - case messageReactions(flags: Int32, results: [Api.ReactionCount]) + case messageReactions(flags: Int32, results: [Api.ReactionCount], recentReactons: [Api.MessageUserReaction]?) public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) { switch self { - case .messageReactions(let flags, let results): + case .messageReactions(let flags, let results, let recentReactons): if boxed { - buffer.appendInt32(-1199954735) + buffer.appendInt32(142306870) } serializeInt32(flags, buffer: buffer, boxed: false) buffer.appendInt32(481674261) @@ -8916,14 +8916,19 @@ public extension Api { for item in results { item.serialize(buffer, true) } + if Int(flags) & Int(1 << 1) != 0 {buffer.appendInt32(481674261) + buffer.appendInt32(Int32(recentReactons!.count)) + for item in recentReactons! { + item.serialize(buffer, true) + }} break } } public func descriptionFields() -> (String, [(String, Any)]) { switch self { - case .messageReactions(let flags, let results): - return ("messageReactions", [("flags", flags), ("results", results)]) + case .messageReactions(let flags, let results, let recentReactons): + return ("messageReactions", [("flags", flags), ("results", results), ("recentReactons", recentReactons)]) } } @@ -8934,10 +8939,15 @@ public extension Api { if let _ = reader.readInt32() { _2 = Api.parseVector(reader, elementSignature: 0, elementType: Api.ReactionCount.self) } + var _3: [Api.MessageUserReaction]? + if Int(_1!) & Int(1 << 1) != 0 {if let _ = reader.readInt32() { + _3 = Api.parseVector(reader, elementSignature: 0, elementType: Api.MessageUserReaction.self) + } } let _c1 = _1 != nil let _c2 = _2 != nil - if _c1 && _c2 { - return Api.MessageReactions.messageReactions(flags: _1!, results: _2!) + let _c3 = (Int(_1!) & Int(1 << 1) == 0) || _3 != nil + if _c1 && _c2 && _c3 { + return Api.MessageReactions.messageReactions(flags: _1!, results: _2!, recentReactons: _3) } else { return nil @@ -11664,6 +11674,7 @@ public extension Api { case channelAdminLogEventActionChangeHistoryTTL(prevValue: Int32, newValue: Int32) case channelAdminLogEventActionParticipantJoinByRequest(invite: Api.ExportedChatInvite, approvedBy: Int64) case channelAdminLogEventActionToggleNoForwards(newValue: Api.Bool) + case channelAdminLogEventActionSendMessage(message: Api.Message) public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) { switch self { @@ -11886,6 +11897,12 @@ public extension Api { } newValue.serialize(buffer, true) break + case .channelAdminLogEventActionSendMessage(let message): + if boxed { + buffer.appendInt32(663693416) + } + message.serialize(buffer, true) + break } } @@ -11959,6 +11976,8 @@ public extension Api { return ("channelAdminLogEventActionParticipantJoinByRequest", [("invite", invite), ("approvedBy", approvedBy)]) case .channelAdminLogEventActionToggleNoForwards(let newValue): return ("channelAdminLogEventActionToggleNoForwards", [("newValue", newValue)]) + case .channelAdminLogEventActionSendMessage(let message): + return ("channelAdminLogEventActionSendMessage", [("message", message)]) } } @@ -12433,6 +12452,19 @@ public extension Api { return nil } } + public static func parse_channelAdminLogEventActionSendMessage(_ reader: BufferReader) -> ChannelAdminLogEventAction? { + var _1: Api.Message? + if let signature = reader.readInt32() { + _1 = Api.parse(reader, signature: signature) as? Api.Message + } + let _c1 = _1 != nil + if _c1 { + return Api.ChannelAdminLogEventAction.channelAdminLogEventActionSendMessage(message: _1!) + } + else { + return nil + } + } } public enum SecurePlainData: TypeConstructorDescription { @@ -13240,32 +13272,42 @@ public extension Api { } public enum CodeSettings: TypeConstructorDescription { - case codeSettings(flags: Int32) + case codeSettings(flags: Int32, logoutTokens: [Buffer]?) public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) { switch self { - case .codeSettings(let flags): + case .codeSettings(let flags, let logoutTokens): if boxed { - buffer.appendInt32(-557924733) + buffer.appendInt32(-1973130814) } serializeInt32(flags, buffer: buffer, boxed: false) + if Int(flags) & Int(1 << 6) != 0 {buffer.appendInt32(481674261) + buffer.appendInt32(Int32(logoutTokens!.count)) + for item in logoutTokens! { + serializeBytes(item, buffer: buffer, boxed: false) + }} break } } public func descriptionFields() -> (String, [(String, Any)]) { switch self { - case .codeSettings(let flags): - return ("codeSettings", [("flags", flags)]) + case .codeSettings(let flags, let logoutTokens): + return ("codeSettings", [("flags", flags), ("logoutTokens", logoutTokens)]) } } public static func parse_codeSettings(_ reader: BufferReader) -> CodeSettings? { var _1: Int32? _1 = reader.readInt32() + var _2: [Buffer]? + if Int(_1!) & Int(1 << 6) != 0 {if let _ = reader.readInt32() { + _2 = Api.parseVector(reader, elementSignature: -1255641564, elementType: Buffer.self) + } } let _c1 = _1 != nil - if _c1 { - return Api.CodeSettings.codeSettings(flags: _1!) + let _c2 = (Int(_1!) & Int(1 << 6) == 0) || _2 != nil + if _c1 && _c2 { + return Api.CodeSettings.codeSettings(flags: _1!, logoutTokens: _2) } else { return nil @@ -15880,17 +15922,17 @@ public extension Api { } public enum PeerSettings: TypeConstructorDescription { - case peerSettings(flags: Int32, geoDistance: Int32?, requestChat: Api.Peer?, requestChatDate: Int32?) + case peerSettings(flags: Int32, geoDistance: Int32?, requestChatTitle: String?, requestChatDate: Int32?) public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) { switch self { - case .peerSettings(let flags, let geoDistance, let requestChat, let requestChatDate): + case .peerSettings(let flags, let geoDistance, let requestChatTitle, let requestChatDate): if boxed { - buffer.appendInt32(-1474130642) + buffer.appendInt32(-1525149427) } serializeInt32(flags, buffer: buffer, boxed: false) if Int(flags) & Int(1 << 6) != 0 {serializeInt32(geoDistance!, buffer: buffer, boxed: false)} - if Int(flags) & Int(1 << 9) != 0 {requestChat!.serialize(buffer, true)} + if Int(flags) & Int(1 << 9) != 0 {serializeString(requestChatTitle!, buffer: buffer, boxed: false)} if Int(flags) & Int(1 << 9) != 0 {serializeInt32(requestChatDate!, buffer: buffer, boxed: false)} break } @@ -15898,8 +15940,8 @@ public extension Api { public func descriptionFields() -> (String, [(String, Any)]) { switch self { - case .peerSettings(let flags, let geoDistance, let requestChat, let requestChatDate): - return ("peerSettings", [("flags", flags), ("geoDistance", geoDistance), ("requestChat", requestChat), ("requestChatDate", requestChatDate)]) + case .peerSettings(let flags, let geoDistance, let requestChatTitle, let requestChatDate): + return ("peerSettings", [("flags", flags), ("geoDistance", geoDistance), ("requestChatTitle", requestChatTitle), ("requestChatDate", requestChatDate)]) } } @@ -15908,10 +15950,8 @@ public extension Api { _1 = reader.readInt32() var _2: Int32? if Int(_1!) & Int(1 << 6) != 0 {_2 = reader.readInt32() } - var _3: Api.Peer? - if Int(_1!) & Int(1 << 9) != 0 {if let signature = reader.readInt32() { - _3 = Api.parse(reader, signature: signature) as? Api.Peer - } } + var _3: String? + if Int(_1!) & Int(1 << 9) != 0 {_3 = parseString(reader) } var _4: Int32? if Int(_1!) & Int(1 << 9) != 0 {_4 = reader.readInt32() } let _c1 = _1 != nil @@ -15919,7 +15959,7 @@ public extension Api { let _c3 = (Int(_1!) & Int(1 << 9) == 0) || _3 != nil let _c4 = (Int(_1!) & Int(1 << 9) == 0) || _4 != nil if _c1 && _c2 && _c3 && _c4 { - return Api.PeerSettings.peerSettings(flags: _1!, geoDistance: _2, requestChat: _3, requestChatDate: _4) + return Api.PeerSettings.peerSettings(flags: _1!, geoDistance: _2, requestChatTitle: _3, requestChatDate: _4) } else { return nil @@ -17328,6 +17368,7 @@ public extension Api { case inputStickerSetAnimatedEmoji case inputStickerSetDice(emoticon: String) case inputStickerSetAnimatedEmojiAnimations + case inputStickerSetAnimatedEmojiReactions public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) { switch self { @@ -17367,6 +17408,12 @@ public extension Api { buffer.appendInt32(215889721) } + break + case .inputStickerSetAnimatedEmojiReactions: + if boxed { + buffer.appendInt32(1189248700) + } + break } } @@ -17385,6 +17432,8 @@ public extension Api { return ("inputStickerSetDice", [("emoticon", emoticon)]) case .inputStickerSetAnimatedEmojiAnimations: return ("inputStickerSetAnimatedEmojiAnimations", []) + case .inputStickerSetAnimatedEmojiReactions: + return ("inputStickerSetAnimatedEmojiReactions", []) } } @@ -17433,6 +17482,9 @@ public extension Api { public static func parse_inputStickerSetAnimatedEmojiAnimations(_ reader: BufferReader) -> InputStickerSet? { return Api.InputStickerSet.inputStickerSetAnimatedEmojiAnimations } + public static func parse_inputStickerSetAnimatedEmojiReactions(_ reader: BufferReader) -> InputStickerSet? { + return Api.InputStickerSet.inputStickerSetAnimatedEmojiReactions + } } public enum BotInfo: TypeConstructorDescription { @@ -20130,15 +20182,15 @@ public extension Api { } public enum MessageUserReaction: TypeConstructorDescription { - case messageUserReaction(userId: Int32, reaction: String) + case messageUserReaction(userId: Int64, reaction: String) public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) { switch self { case .messageUserReaction(let userId, let reaction): if boxed { - buffer.appendInt32(-764945220) + buffer.appendInt32(-1826077446) } - serializeInt32(userId, buffer: buffer, boxed: false) + serializeInt64(userId, buffer: buffer, boxed: false) serializeString(reaction, buffer: buffer, boxed: false) break } @@ -20152,8 +20204,8 @@ public extension Api { } public static func parse_messageUserReaction(_ reader: BufferReader) -> MessageUserReaction? { - var _1: Int32? - _1 = reader.readInt32() + var _1: Int64? + _1 = reader.readInt64() var _2: String? _2 = parseString(reader) let _c1 = _1 != nil diff --git a/submodules/TelegramApi/Sources/Api3.swift b/submodules/TelegramApi/Sources/Api3.swift index 5168528c9f..1adbf6e282 100644 --- a/submodules/TelegramApi/Sources/Api3.swift +++ b/submodules/TelegramApi/Sources/Api3.swift @@ -1236,6 +1236,7 @@ public struct auth { case codeTypeSms case codeTypeCall case codeTypeFlashCall + case codeTypeMissedCall public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) { switch self { @@ -1256,6 +1257,12 @@ public struct auth { buffer.appendInt32(577556219) } + break + case .codeTypeMissedCall: + if boxed { + buffer.appendInt32(-702884114) + } + break } } @@ -1268,6 +1275,8 @@ public struct auth { return ("codeTypeCall", []) case .codeTypeFlashCall: return ("codeTypeFlashCall", []) + case .codeTypeMissedCall: + return ("codeTypeMissedCall", []) } } @@ -1280,6 +1289,9 @@ public struct auth { public static func parse_codeTypeFlashCall(_ reader: BufferReader) -> CodeType? { return Api.auth.CodeType.codeTypeFlashCall } + public static func parse_codeTypeMissedCall(_ reader: BufferReader) -> CodeType? { + return Api.auth.CodeType.codeTypeMissedCall + } } public enum SentCodeType: TypeConstructorDescription { @@ -1287,6 +1299,7 @@ public struct auth { case sentCodeTypeSms(length: Int32) case sentCodeTypeCall(length: Int32) case sentCodeTypeFlashCall(pattern: String) + case sentCodeTypeMissedCall(prefix: String, length: Int32) public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) { switch self { @@ -1314,6 +1327,13 @@ public struct auth { } serializeString(pattern, buffer: buffer, boxed: false) break + case .sentCodeTypeMissedCall(let prefix, let length): + if boxed { + buffer.appendInt32(-2113903484) + } + serializeString(prefix, buffer: buffer, boxed: false) + serializeInt32(length, buffer: buffer, boxed: false) + break } } @@ -1327,6 +1347,8 @@ public struct auth { return ("sentCodeTypeCall", [("length", length)]) case .sentCodeTypeFlashCall(let pattern): return ("sentCodeTypeFlashCall", [("pattern", pattern)]) + case .sentCodeTypeMissedCall(let prefix, let length): + return ("sentCodeTypeMissedCall", [("prefix", prefix), ("length", length)]) } } @@ -1374,6 +1396,62 @@ public struct auth { return nil } } + public static func parse_sentCodeTypeMissedCall(_ reader: BufferReader) -> SentCodeType? { + var _1: String? + _1 = parseString(reader) + var _2: Int32? + _2 = reader.readInt32() + let _c1 = _1 != nil + let _c2 = _2 != nil + if _c1 && _c2 { + return Api.auth.SentCodeType.sentCodeTypeMissedCall(prefix: _1!, length: _2!) + } + else { + return nil + } + } + + } + public enum LoggedOut: TypeConstructorDescription { + case loggedOut(flags: Int32, futureAuthToken: Buffer?, futureAuthExpires: Int32?) + + public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) { + switch self { + case .loggedOut(let flags, let futureAuthToken, let futureAuthExpires): + if boxed { + buffer.appendInt32(-1957096922) + } + serializeInt32(flags, buffer: buffer, boxed: false) + if Int(flags) & Int(1 << 0) != 0 {serializeBytes(futureAuthToken!, buffer: buffer, boxed: false)} + if Int(flags) & Int(1 << 0) != 0 {serializeInt32(futureAuthExpires!, buffer: buffer, boxed: false)} + break + } + } + + public func descriptionFields() -> (String, [(String, Any)]) { + switch self { + case .loggedOut(let flags, let futureAuthToken, let futureAuthExpires): + return ("loggedOut", [("flags", flags), ("futureAuthToken", futureAuthToken), ("futureAuthExpires", futureAuthExpires)]) + } + } + + public static func parse_loggedOut(_ reader: BufferReader) -> LoggedOut? { + var _1: Int32? + _1 = reader.readInt32() + var _2: Buffer? + if Int(_1!) & Int(1 << 0) != 0 {_2 = parseBytes(reader) } + var _3: Int32? + if Int(_1!) & Int(1 << 0) != 0 {_3 = reader.readInt32() } + let _c1 = _1 != nil + let _c2 = (Int(_1!) & Int(1 << 0) == 0) || _2 != nil + let _c3 = (Int(_1!) & Int(1 << 0) == 0) || _3 != nil + if _c1 && _c2 && _c3 { + return Api.auth.LoggedOut.loggedOut(flags: _1!, futureAuthToken: _2, futureAuthExpires: _3) + } + else { + return nil + } + } } } diff --git a/submodules/TelegramApi/Sources/Api4.swift b/submodules/TelegramApi/Sources/Api4.swift index 3b973c5282..9ff5b07d59 100644 --- a/submodules/TelegramApi/Sources/Api4.swift +++ b/submodules/TelegramApi/Sources/Api4.swift @@ -5426,15 +5426,15 @@ public extension Api { }) } - public static func logOut() -> (FunctionDescription, Buffer, DeserializeFunctionResponse) { + public static func logOut() -> (FunctionDescription, Buffer, DeserializeFunctionResponse) { let buffer = Buffer() - buffer.appendInt32(1461180992) + buffer.appendInt32(1047706137) - return (FunctionDescription(name: "auth.logOut", parameters: []), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.Bool? in + return (FunctionDescription(name: "auth.logOut", parameters: []), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.auth.LoggedOut? in let reader = BufferReader(buffer) - var result: Api.Bool? + var result: Api.auth.LoggedOut? if let signature = reader.readInt32() { - result = Api.parse(reader, signature: signature) as? Api.Bool + result = Api.parse(reader, signature: signature) as? Api.auth.LoggedOut } return result }) diff --git a/submodules/TelegramCore/Sources/Account/AccountManager.swift b/submodules/TelegramCore/Sources/Account/AccountManager.swift index 7505bdee4f..1db3b79e63 100644 --- a/submodules/TelegramCore/Sources/Account/AccountManager.swift +++ b/submodules/TelegramCore/Sources/Account/AccountManager.swift @@ -426,8 +426,8 @@ private func cleanupAccount(networkArguments: NetworkInitializationArguments, ac account.shouldBeServiceTaskMaster.set(.single(.always)) return account.network.request(Api.functions.auth.logOut()) |> map(Optional.init) - |> `catch` { _ -> Signal in - return .single(.boolFalse) + |> `catch` { _ -> Signal in + return .single(nil) } |> mapToSignal { _ -> Signal in account.shouldBeServiceTaskMaster.set(.single(.never)) diff --git a/submodules/TelegramCore/Sources/ApiUtils/ReactionsMessageAttribute.swift b/submodules/TelegramCore/Sources/ApiUtils/ReactionsMessageAttribute.swift index 86e2fad870..2a4b008e46 100644 --- a/submodules/TelegramCore/Sources/ApiUtils/ReactionsMessageAttribute.swift +++ b/submodules/TelegramCore/Sources/ApiUtils/ReactionsMessageAttribute.swift @@ -5,7 +5,7 @@ import TelegramApi extension ReactionsMessageAttribute { func withUpdatedResults(_ reactions: Api.MessageReactions) -> ReactionsMessageAttribute { switch reactions { - case let .messageReactions(flags, results): + case let .messageReactions(flags, results, _): let min = (flags & (1 << 0)) != 0 var reactions = results.map { result -> MessageReaction in switch result { @@ -87,7 +87,7 @@ public func mergedMessageReactions(attributes: [MessageAttribute]) -> ReactionsM extension ReactionsMessageAttribute { convenience init(apiReactions: Api.MessageReactions) { switch apiReactions { - case let .messageReactions(_, results): + case let .messageReactions(_, results, _): self.init(reactions: results.map { result in switch result { case let .reactionCount(flags, reaction, count): diff --git a/submodules/TelegramCore/Sources/ApiUtils/TelegramMediaFile.swift b/submodules/TelegramCore/Sources/ApiUtils/TelegramMediaFile.swift index bd68db3422..ad25745dbf 100644 --- a/submodules/TelegramCore/Sources/ApiUtils/TelegramMediaFile.swift +++ b/submodules/TelegramCore/Sources/ApiUtils/TelegramMediaFile.swift @@ -62,6 +62,8 @@ extension StickerPackReference { self = .dice(emoticon) case .inputStickerSetAnimatedEmojiAnimations: self = .animatedEmojiAnimations + case .inputStickerSetAnimatedEmojiReactions: + self = .animatedEmojiAnimations } } } diff --git a/submodules/TelegramCore/Sources/Authorization.swift b/submodules/TelegramCore/Sources/Authorization.swift index bccf7ce12d..eef1d711d1 100644 --- a/submodules/TelegramCore/Sources/Authorization.swift +++ b/submodules/TelegramCore/Sources/Authorization.swift @@ -72,7 +72,9 @@ private func ~=(pattern: Regex, matchable: T) -> } public func sendAuthorizationCode(accountManager: AccountManager, account: UnauthorizedAccount, phoneNumber: String, apiId: Int32, apiHash: String, syncContacts: Bool) -> Signal { - let sendCode = Api.functions.auth.sendCode(phoneNumber: phoneNumber, apiId: apiId, apiHash: apiHash, settings: .codeSettings(flags: 0)) + var flags: Int32 = 0 + flags |= 1 << 5 //allowMissedCall + let sendCode = Api.functions.auth.sendCode(phoneNumber: phoneNumber, apiId: apiId, apiHash: apiHash, settings: .codeSettings(flags: flags, logoutTokens: nil)) let codeAndAccount = account.network.request(sendCode, automaticFloodWait: false) |> map { result in @@ -111,7 +113,7 @@ public func sendAuthorizationCode(accountManager: AccountManager timeout(20.0, queue: Queue.concurrentDefaultQueue(), alternate: .fail(.timeout)) return codeAndAccount - |> mapToSignal { (sentCode, account) -> Signal in + |> mapToSignal { sentCode, account -> Signal in return account.postbox.transaction { transaction -> UnauthorizedAccount in switch sentCode { case let .sentCode(_, type, phoneCodeHash, nextType, timeout): diff --git a/submodules/TelegramCore/Sources/Settings/PeerContactSettings.swift b/submodules/TelegramCore/Sources/Settings/PeerContactSettings.swift index b8de0b9e52..7fc623db02 100644 --- a/submodules/TelegramCore/Sources/Settings/PeerContactSettings.swift +++ b/submodules/TelegramCore/Sources/Settings/PeerContactSettings.swift @@ -6,7 +6,7 @@ import SwiftSignalKit extension PeerStatusSettings { init(apiSettings: Api.PeerSettings) { switch apiSettings { - case let .peerSettings(flags, geoDistance, requestChat, requestChatDate): + case let .peerSettings(flags, geoDistance, _, requestChatDate): var result = PeerStatusSettings.Flags() if (flags & (1 << 1)) != 0 { result.insert(.canAddContact) @@ -32,7 +32,7 @@ extension PeerStatusSettings { if (flags & (1 << 8)) != 0 { result.insert(.suggestAddMembers) } - self = PeerStatusSettings(flags: result, geoDistance: geoDistance, requestChatPeerId: requestChat?.peerId, requestChatDate: requestChatDate) + self = PeerStatusSettings(flags: result, geoDistance: geoDistance, requestChatPeerId: nil, requestChatDate: requestChatDate) } } } diff --git a/submodules/TelegramCore/Sources/State/AccountState.swift b/submodules/TelegramCore/Sources/State/AccountState.swift index 5660db71be..2d9dfe0b78 100644 --- a/submodules/TelegramCore/Sources/State/AccountState.swift +++ b/submodules/TelegramCore/Sources/State/AccountState.swift @@ -28,6 +28,8 @@ extension SentAuthorizationCodeType { self = .call(length: length) case let .sentCodeTypeFlashCall(pattern): self = .flashCall(pattern: pattern) + case let .sentCodeTypeMissedCall(prefix, length): + self = .missedCall(numberPrefix: prefix, length: length) } } } @@ -41,6 +43,8 @@ extension AuthorizationCodeNextType { self = .call case .codeTypeFlashCall: self = .flashCall + case .codeTypeMissedCall: + self = .missedCall } } } diff --git a/submodules/TelegramCore/Sources/SyncCore/SyncCore_TelegramMediaFile.swift b/submodules/TelegramCore/Sources/SyncCore/SyncCore_TelegramMediaFile.swift index 5bfa7765c0..4d78279cc1 100644 --- a/submodules/TelegramCore/Sources/SyncCore/SyncCore_TelegramMediaFile.swift +++ b/submodules/TelegramCore/Sources/SyncCore/SyncCore_TelegramMediaFile.swift @@ -54,41 +54,6 @@ public enum StickerPackReference: PostboxCoding, Hashable, Equatable { encoder.encodeInt32(4, forKey: "r") } } - - public static func ==(lhs: StickerPackReference, rhs: StickerPackReference) -> Bool { - switch lhs { - case let .id(id, accessHash): - if case .id(id, accessHash) = rhs { - return true - } else { - return false - } - case let .name(name): - if case .name(name) = rhs { - return true - } else { - return false - } - case .animatedEmoji: - if case .animatedEmoji = rhs { - return true - } else { - return false - } - case let .dice(emoji): - if case .dice(emoji) = rhs { - return true - } else { - return false - } - case .animatedEmojiAnimations: - if case .animatedEmojiAnimations = rhs { - return true - } else { - return false - } - } - } } public struct TelegramMediaVideoFlags: OptionSet { diff --git a/submodules/TelegramCore/Sources/SyncCore/SyncCore_UnauthorizedAccountState.swift b/submodules/TelegramCore/Sources/SyncCore/SyncCore_UnauthorizedAccountState.swift index 677f9bb838..910eca6e48 100644 --- a/submodules/TelegramCore/Sources/SyncCore/SyncCore_UnauthorizedAccountState.swift +++ b/submodules/TelegramCore/Sources/SyncCore/SyncCore_UnauthorizedAccountState.swift @@ -5,6 +5,7 @@ private enum SentAuthorizationCodeTypeValue: Int32 { case sms = 1 case call = 2 case flashCall = 3 + case missedCall = 4 } public enum SentAuthorizationCodeType: PostboxCoding, Equatable { @@ -12,6 +13,7 @@ public enum SentAuthorizationCodeType: PostboxCoding, Equatable { case sms(length: Int32) case call(length: Int32) case flashCall(pattern: String) + case missedCall(numberPrefix: String, length: Int32) public init(decoder: PostboxDecoder) { switch decoder.decodeInt32ForKey("v", orElse: 0) { @@ -23,6 +25,8 @@ public enum SentAuthorizationCodeType: PostboxCoding, Equatable { self = .call(length: decoder.decodeInt32ForKey("l", orElse: 0)) case SentAuthorizationCodeTypeValue.flashCall.rawValue: self = .flashCall(pattern: decoder.decodeStringForKey("p", orElse: "")) + case SentAuthorizationCodeTypeValue.missedCall.rawValue: + self = .missedCall(numberPrefix: decoder.decodeStringForKey("n", orElse: ""), length: decoder.decodeInt32ForKey("l", orElse: 0)) default: preconditionFailure() } @@ -42,35 +46,10 @@ public enum SentAuthorizationCodeType: PostboxCoding, Equatable { case let .flashCall(pattern): encoder.encodeInt32(SentAuthorizationCodeTypeValue.flashCall.rawValue, forKey: "v") encoder.encodeString(pattern, forKey: "p") - } - } - - public static func ==(lhs: SentAuthorizationCodeType, rhs: SentAuthorizationCodeType) -> Bool { - switch lhs { - case let .otherSession(length): - if case .otherSession(length) = rhs { - return true - } else { - return false - } - case let .sms(length): - if case .sms(length) = rhs { - return true - } else { - return false - } - case let .call(length): - if case .call(length) = rhs { - return true - } else { - return false - } - case let .flashCall(pattern): - if case .flashCall(pattern) = rhs { - return true - } else { - return false - } + case let .missedCall(numberPrefix, length): + encoder.encodeInt32(SentAuthorizationCodeTypeValue.missedCall.rawValue, forKey: "v") + encoder.encodeString(numberPrefix, forKey: "n") + encoder.encodeInt32(length, forKey: "l") } } } @@ -79,6 +58,7 @@ public enum AuthorizationCodeNextType: Int32 { case sms = 0 case call = 1 case flashCall = 2 + case missedCall = 3 } private enum UnauthorizedAccountStateContentsValue: Int32 { diff --git a/submodules/TelegramCore/Sources/TelegramEngine/AccountData/ChangeAccountPhoneNumber.swift b/submodules/TelegramCore/Sources/TelegramEngine/AccountData/ChangeAccountPhoneNumber.swift index 6364b4514a..f8e0f5ce7e 100644 --- a/submodules/TelegramCore/Sources/TelegramEngine/AccountData/ChangeAccountPhoneNumber.swift +++ b/submodules/TelegramCore/Sources/TelegramEngine/AccountData/ChangeAccountPhoneNumber.swift @@ -37,7 +37,7 @@ public enum RequestChangeAccountPhoneNumberVerificationError { } func _internal_requestChangeAccountPhoneNumberVerification(account: Account, phoneNumber: String) -> Signal { - return account.network.request(Api.functions.account.sendChangePhoneCode(phoneNumber: phoneNumber, settings: .codeSettings(flags: 0)), automaticFloodWait: false) + return account.network.request(Api.functions.account.sendChangePhoneCode(phoneNumber: phoneNumber, settings: .codeSettings(flags: 0, logoutTokens: nil)), automaticFloodWait: false) |> mapError { error -> RequestChangeAccountPhoneNumberVerificationError in if error.errorDescription.hasPrefix("FLOOD_WAIT") { return .limitExceeded diff --git a/submodules/TelegramCore/Sources/TelegramEngine/Auth/CancelAccountReset.swift b/submodules/TelegramCore/Sources/TelegramEngine/Auth/CancelAccountReset.swift index 25a18b27dd..757644691d 100644 --- a/submodules/TelegramCore/Sources/TelegramEngine/Auth/CancelAccountReset.swift +++ b/submodules/TelegramCore/Sources/TelegramEngine/Auth/CancelAccountReset.swift @@ -18,7 +18,7 @@ public enum RequestCancelAccountResetDataError { } func _internal_requestCancelAccountResetData(network: Network, hash: String) -> Signal { - return network.request(Api.functions.account.sendConfirmPhoneCode(hash: hash, settings: .codeSettings(flags: 0)), automaticFloodWait: false) + return network.request(Api.functions.account.sendConfirmPhoneCode(hash: hash, settings: .codeSettings(flags: 0, logoutTokens: nil)), automaticFloodWait: false) |> mapError { error -> RequestCancelAccountResetDataError in if error.errorDescription.hasPrefix("FLOOD_WAIT") { return .limitExceeded diff --git a/submodules/TelegramCore/Sources/TelegramEngine/Peers/ChannelAdminEventLogs.swift b/submodules/TelegramCore/Sources/TelegramEngine/Peers/ChannelAdminEventLogs.swift index 90c8dfbe47..7276d19d2d 100644 --- a/submodules/TelegramCore/Sources/TelegramEngine/Peers/ChannelAdminEventLogs.swift +++ b/submodules/TelegramCore/Sources/TelegramEngine/Peers/ChannelAdminEventLogs.swift @@ -256,6 +256,8 @@ func channelAdminLogEvents(postbox: Postbox, network: Network, peerId: PeerId, m action = .participantJoinByRequest(invitation: ExportedInvitation(apiExportedInvite: invite), approvedBy: PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt64Value(approvedBy))) case let .channelAdminLogEventActionToggleNoForwards(new): action = .toggleCopyProtection(boolFromApiValue(new)) + case .channelAdminLogEventActionSendMessage: + action = nil } let peerId = PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt64Value(userId)) if let action = action { diff --git a/submodules/TelegramCore/Sources/TelegramEngine/SecureId/VerifySecureIdValue.swift b/submodules/TelegramCore/Sources/TelegramEngine/SecureId/VerifySecureIdValue.swift index 4921d35659..43dfe11dff 100644 --- a/submodules/TelegramCore/Sources/TelegramEngine/SecureId/VerifySecureIdValue.swift +++ b/submodules/TelegramCore/Sources/TelegramEngine/SecureId/VerifySecureIdValue.swift @@ -19,7 +19,7 @@ public struct SecureIdPreparePhoneVerificationPayload { } public func secureIdPreparePhoneVerification(network: Network, value: SecureIdPhoneValue) -> Signal { - return network.request(Api.functions.account.sendVerifyPhoneCode(phoneNumber: value.phone, settings: .codeSettings(flags: 0)), automaticFloodWait: false) + return network.request(Api.functions.account.sendVerifyPhoneCode(phoneNumber: value.phone, settings: .codeSettings(flags: 0, logoutTokens: nil)), automaticFloodWait: false) |> mapError { error -> SecureIdPreparePhoneVerificationError in if error.errorDescription.hasPrefix("FLOOD_WAIT") { return .flood diff --git a/submodules/TelegramUI/Sources/AuthorizationSequenceCodeEntryController.swift b/submodules/TelegramUI/Sources/AuthorizationSequenceCodeEntryController.swift index 939a015821..cc3979a465 100644 --- a/submodules/TelegramUI/Sources/AuthorizationSequenceCodeEntryController.swift +++ b/submodules/TelegramUI/Sources/AuthorizationSequenceCodeEntryController.swift @@ -137,6 +137,8 @@ final class AuthorizationSequenceCodeEntryController: ViewController { minimalCodeLength = Int(length) case .flashCall: break + case let .missedCall(_, length): + minimalCodeLength = Int(length) } if self.controllerNode.currentCode.count < minimalCodeLength {