Update API and fix pinned message selection [skip ci]

This commit is contained in:
Ali 2020-10-15 03:09:52 +04:00
parent 3add0f8c0b
commit 99f53102bf
16 changed files with 181 additions and 152 deletions

View File

@ -1250,7 +1250,7 @@ ios_application(
":AppStringResources",
],
extensions = [
#":ShareExtension",
":ShareExtension",
#":NotificationServiceExtension",
],
#watch_application = ":TelegramWatchApp",

View File

@ -7,7 +7,7 @@ fileprivate let parsers: [Int32 : (BufferReader) -> Any?] = {
dict[-1255641564] = { return parseString($0) }
dict[-1240849242] = { return Api.messages.StickerSet.parse_stickerSet($0) }
dict[-457104426] = { return Api.InputGeoPoint.parse_inputGeoPointEmpty($0) }
dict[-206066487] = { return Api.InputGeoPoint.parse_inputGeoPoint($0) }
dict[1210199983] = { return Api.InputGeoPoint.parse_inputGeoPoint($0) }
dict[-784000893] = { return Api.payments.ValidatedRequestedInfo.parse_validatedRequestedInfo($0) }
dict[461151667] = { return Api.ChatFull.parse_chatFull($0) }
dict[-253335766] = { return Api.ChatFull.parse_channelFull($0) }
@ -209,7 +209,6 @@ fileprivate let parsers: [Int32 : (BufferReader) -> Any?] = {
dict[1417832080] = { return Api.Update.parse_updateBotInlineQuery($0) }
dict[239663460] = { return Api.Update.parse_updateBotInlineSend($0) }
dict[457133559] = { return Api.Update.parse_updateEditChannelMessage($0) }
dict[-1738988427] = { return Api.Update.parse_updateChannelPinnedMessage($0) }
dict[-415938591] = { return Api.Update.parse_updateBotCallbackQuery($0) }
dict[-469536605] = { return Api.Update.parse_updateEditMessage($0) }
dict[-103646630] = { return Api.Update.parse_updateInlineBotCallbackQuery($0) }
@ -373,9 +372,9 @@ fileprivate let parsers: [Int32 : (BufferReader) -> Any?] = {
dict[-440664550] = { return Api.InputMedia.parse_inputMediaPhotoExternal($0) }
dict[-78455655] = { return Api.InputMedia.parse_inputMediaDocumentExternal($0) }
dict[-122978821] = { return Api.InputMedia.parse_inputMediaContact($0) }
dict[-833715459] = { return Api.InputMedia.parse_inputMediaGeoLive($0) }
dict[261416433] = { return Api.InputMedia.parse_inputMediaPoll($0) }
dict[-428884101] = { return Api.InputMedia.parse_inputMediaDice($0) }
dict[-1574158066] = { return Api.InputMedia.parse_inputMediaGeoLive($0) }
dict[2134579434] = { return Api.InputPeer.parse_inputPeerEmpty($0) }
dict[2107670217] = { return Api.InputPeer.parse_inputPeerSelf($0) }
dict[396093539] = { return Api.InputPeer.parse_inputPeerChat($0) }
@ -569,13 +568,13 @@ fileprivate let parsers: [Int32 : (BufferReader) -> Any?] = {
dict[-1557277184] = { return Api.MessageMedia.parse_messageMediaWebPage($0) }
dict[-38694904] = { return Api.MessageMedia.parse_messageMediaGame($0) }
dict[-2074799289] = { return Api.MessageMedia.parse_messageMediaInvoice($0) }
dict[2084316681] = { return Api.MessageMedia.parse_messageMediaGeoLive($0) }
dict[784356159] = { return Api.MessageMedia.parse_messageMediaVenue($0) }
dict[1766936791] = { return Api.MessageMedia.parse_messageMediaPhoto($0) }
dict[-1666158377] = { return Api.MessageMedia.parse_messageMediaDocument($0) }
dict[-873313984] = { return Api.MessageMedia.parse_messageMediaContact($0) }
dict[1272375192] = { return Api.MessageMedia.parse_messageMediaPoll($0) }
dict[1065280907] = { return Api.MessageMedia.parse_messageMediaDice($0) }
dict[-967079536] = { return Api.MessageMedia.parse_messageMediaGeoLive($0) }
dict[-842892769] = { return Api.PaymentSavedCredentials.parse_paymentSavedCredentialsCard($0) }
dict[1450380236] = { return Api.Null.parse_null($0) }
dict[1923290508] = { return Api.auth.CodeType.parse_codeTypeSms($0) }
@ -624,7 +623,7 @@ fileprivate let parsers: [Int32 : (BufferReader) -> Any?] = {
dict[668375447] = { return Api.InputFileLocation.parse_inputPeerPhotoFileLocation($0) }
dict[230353641] = { return Api.InputFileLocation.parse_inputStickerSetThumb($0) }
dict[286776671] = { return Api.GeoPoint.parse_geoPointEmpty($0) }
dict[43446532] = { return Api.GeoPoint.parse_geoPoint($0) }
dict[-955487525] = { return Api.GeoPoint.parse_geoPoint($0) }
dict[506920429] = { return Api.InputPhoneCall.parse_inputPhoneCall($0) }
dict[-1551583367] = { return Api.ReceivedNotifyMessage.parse_receivedNotifyMessage($0) }
dict[-57668565] = { return Api.ChatParticipants.parse_chatParticipantsForbidden($0) }
@ -777,6 +776,7 @@ fileprivate let parsers: [Int32 : (BufferReader) -> Any?] = {
dict[455635795] = { return Api.MessageAction.parse_messageActionSecureValuesSentMe($0) }
dict[-648257196] = { return Api.MessageAction.parse_messageActionSecureValuesSent($0) }
dict[-202219658] = { return Api.MessageAction.parse_messageActionContactSignUp($0) }
dict[-1730095465] = { return Api.MessageAction.parse_messageActionGeoProximityReached($0) }
dict[1399245077] = { return Api.PhoneCall.parse_phoneCallEmpty($0) }
dict[462375633] = { return Api.PhoneCall.parse_phoneCallWaiting($0) }
dict[-2014659757] = { return Api.PhoneCall.parse_phoneCallRequested($0) }

View File

@ -1903,7 +1903,7 @@ public struct messages {
public extension Api {
public enum InputGeoPoint: TypeConstructorDescription {
case inputGeoPointEmpty
case inputGeoPoint(lat: Double, long: Double)
case inputGeoPoint(flags: Int32, lat: Double, long: Double, accuracyRadius: Int32?)
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
switch self {
@ -1913,12 +1913,14 @@ public extension Api {
}
break
case .inputGeoPoint(let lat, let long):
case .inputGeoPoint(let flags, let lat, let long, let accuracyRadius):
if boxed {
buffer.appendInt32(-206066487)
buffer.appendInt32(1210199983)
}
serializeInt32(flags, buffer: buffer, boxed: false)
serializeDouble(lat, buffer: buffer, boxed: false)
serializeDouble(long, buffer: buffer, boxed: false)
if Int(flags) & Int(1 << 0) != 0 {serializeInt32(accuracyRadius!, buffer: buffer, boxed: false)}
break
}
}
@ -1927,8 +1929,8 @@ public extension Api {
switch self {
case .inputGeoPointEmpty:
return ("inputGeoPointEmpty", [])
case .inputGeoPoint(let lat, let long):
return ("inputGeoPoint", [("lat", lat), ("long", long)])
case .inputGeoPoint(let flags, let lat, let long, let accuracyRadius):
return ("inputGeoPoint", [("flags", flags), ("lat", lat), ("long", long), ("accuracyRadius", accuracyRadius)])
}
}
@ -1936,14 +1938,20 @@ public extension Api {
return Api.InputGeoPoint.inputGeoPointEmpty
}
public static func parse_inputGeoPoint(_ reader: BufferReader) -> InputGeoPoint? {
var _1: Double?
_1 = reader.readDouble()
var _1: Int32?
_1 = reader.readInt32()
var _2: Double?
_2 = reader.readDouble()
var _3: Double?
_3 = reader.readDouble()
var _4: Int32?
if Int(_1!) & Int(1 << 0) != 0 {_4 = reader.readInt32() }
let _c1 = _1 != nil
let _c2 = _2 != nil
if _c1 && _c2 {
return Api.InputGeoPoint.inputGeoPoint(lat: _1!, long: _2!)
let _c3 = _3 != nil
let _c4 = (Int(_1!) & Int(1 << 0) == 0) || _4 != nil
if _c1 && _c2 && _c3 && _c4 {
return Api.InputGeoPoint.inputGeoPoint(flags: _1!, lat: _2!, long: _3!, accuracyRadius: _4)
}
else {
return nil
@ -6128,7 +6136,6 @@ public extension Api {
case updateBotInlineQuery(flags: Int32, queryId: Int64, userId: Int32, query: String, geo: Api.GeoPoint?, offset: String)
case updateBotInlineSend(flags: Int32, userId: Int32, query: String, geo: Api.GeoPoint?, id: String, msgId: Api.InputBotInlineMessageID?)
case updateEditChannelMessage(message: Api.Message, pts: Int32, ptsCount: Int32)
case updateChannelPinnedMessage(channelId: Int32, id: Int32)
case updateBotCallbackQuery(flags: Int32, queryId: Int64, userId: Int32, peer: Api.Peer, msgId: Int32, chatInstance: Int64, data: Buffer?, gameShortName: String?)
case updateEditMessage(message: Api.Message, pts: Int32, ptsCount: Int32)
case updateInlineBotCallbackQuery(flags: Int32, queryId: Int64, userId: Int32, msgId: Api.InputBotInlineMessageID, chatInstance: Int64, data: Buffer?, gameShortName: String?)
@ -6491,13 +6498,6 @@ public extension Api {
serializeInt32(pts, buffer: buffer, boxed: false)
serializeInt32(ptsCount, buffer: buffer, boxed: false)
break
case .updateChannelPinnedMessage(let channelId, let id):
if boxed {
buffer.appendInt32(-1738988427)
}
serializeInt32(channelId, buffer: buffer, boxed: false)
serializeInt32(id, buffer: buffer, boxed: false)
break
case .updateBotCallbackQuery(let flags, let queryId, let userId, let peer, let msgId, let chatInstance, let data, let gameShortName):
if boxed {
buffer.appendInt32(-415938591)
@ -6999,8 +6999,6 @@ public extension Api {
return ("updateBotInlineSend", [("flags", flags), ("userId", userId), ("query", query), ("geo", geo), ("id", id), ("msgId", msgId)])
case .updateEditChannelMessage(let message, let pts, let ptsCount):
return ("updateEditChannelMessage", [("message", message), ("pts", pts), ("ptsCount", ptsCount)])
case .updateChannelPinnedMessage(let channelId, let id):
return ("updateChannelPinnedMessage", [("channelId", channelId), ("id", id)])
case .updateBotCallbackQuery(let flags, let queryId, let userId, let peer, let msgId, let chatInstance, let data, let gameShortName):
return ("updateBotCallbackQuery", [("flags", flags), ("queryId", queryId), ("userId", userId), ("peer", peer), ("msgId", msgId), ("chatInstance", chatInstance), ("data", data), ("gameShortName", gameShortName)])
case .updateEditMessage(let message, let pts, let ptsCount):
@ -7737,20 +7735,6 @@ public extension Api {
return nil
}
}
public static func parse_updateChannelPinnedMessage(_ reader: BufferReader) -> Update? {
var _1: Int32?
_1 = reader.readInt32()
var _2: Int32?
_2 = reader.readInt32()
let _c1 = _1 != nil
let _c2 = _2 != nil
if _c1 && _c2 {
return Api.Update.updateChannelPinnedMessage(channelId: _1!, id: _2!)
}
else {
return nil
}
}
public static func parse_updateBotCallbackQuery(_ reader: BufferReader) -> Update? {
var _1: Int32?
_1 = reader.readInt32()
@ -11191,9 +11175,9 @@ public extension Api {
case inputMediaPhotoExternal(flags: Int32, url: String, ttlSeconds: Int32?)
case inputMediaDocumentExternal(flags: Int32, url: String, ttlSeconds: Int32?)
case inputMediaContact(phoneNumber: String, firstName: String, lastName: String, vcard: String)
case inputMediaGeoLive(flags: Int32, geoPoint: Api.InputGeoPoint, period: Int32?)
case inputMediaPoll(flags: Int32, poll: Api.Poll, correctAnswers: [Buffer]?, solution: String?, solutionEntities: [Api.MessageEntity]?)
case inputMediaDice(emoticon: String)
case inputMediaGeoLive(flags: Int32, geoPoint: Api.InputGeoPoint, heading: Int32, period: Int32?)
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
switch self {
@ -11321,14 +11305,6 @@ public extension Api {
serializeString(lastName, buffer: buffer, boxed: false)
serializeString(vcard, buffer: buffer, boxed: false)
break
case .inputMediaGeoLive(let flags, let geoPoint, let period):
if boxed {
buffer.appendInt32(-833715459)
}
serializeInt32(flags, buffer: buffer, boxed: false)
geoPoint.serialize(buffer, true)
if Int(flags) & Int(1 << 1) != 0 {serializeInt32(period!, buffer: buffer, boxed: false)}
break
case .inputMediaPoll(let flags, let poll, let correctAnswers, let solution, let solutionEntities):
if boxed {
buffer.appendInt32(261416433)
@ -11353,6 +11329,15 @@ public extension Api {
}
serializeString(emoticon, buffer: buffer, boxed: false)
break
case .inputMediaGeoLive(let flags, let geoPoint, let heading, let period):
if boxed {
buffer.appendInt32(-1574158066)
}
serializeInt32(flags, buffer: buffer, boxed: false)
geoPoint.serialize(buffer, true)
serializeInt32(heading, buffer: buffer, boxed: false)
if Int(flags) & Int(1 << 1) != 0 {serializeInt32(period!, buffer: buffer, boxed: false)}
break
}
}
@ -11384,12 +11369,12 @@ public extension Api {
return ("inputMediaDocumentExternal", [("flags", flags), ("url", url), ("ttlSeconds", ttlSeconds)])
case .inputMediaContact(let phoneNumber, let firstName, let lastName, let vcard):
return ("inputMediaContact", [("phoneNumber", phoneNumber), ("firstName", firstName), ("lastName", lastName), ("vcard", vcard)])
case .inputMediaGeoLive(let flags, let geoPoint, let period):
return ("inputMediaGeoLive", [("flags", flags), ("geoPoint", geoPoint), ("period", period)])
case .inputMediaPoll(let flags, let poll, let correctAnswers, let solution, let solutionEntities):
return ("inputMediaPoll", [("flags", flags), ("poll", poll), ("correctAnswers", correctAnswers), ("solution", solution), ("solutionEntities", solutionEntities)])
case .inputMediaDice(let emoticon):
return ("inputMediaDice", [("emoticon", emoticon)])
case .inputMediaGeoLive(let flags, let geoPoint, let heading, let period):
return ("inputMediaGeoLive", [("flags", flags), ("geoPoint", geoPoint), ("heading", heading), ("period", period)])
}
}
@ -11658,25 +11643,6 @@ public extension Api {
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 << 1) != 0 {_3 = reader.readInt32() }
let _c1 = _1 != nil
let _c2 = _2 != nil
let _c3 = (Int(_1!) & Int(1 << 1) == 0) || _3 != nil
if _c1 && _c2 && _c3 {
return Api.InputMedia.inputMediaGeoLive(flags: _1!, geoPoint: _2!, period: _3)
}
else {
return nil
}
}
public static func parse_inputMediaPoll(_ reader: BufferReader) -> InputMedia? {
var _1: Int32?
_1 = reader.readInt32()
@ -11717,6 +11683,28 @@ public extension Api {
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?
_3 = reader.readInt32()
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.InputMedia.inputMediaGeoLive(flags: _1!, geoPoint: _2!, heading: _3!, period: _4)
}
else {
return nil
}
}
}
public enum InputPeer: TypeConstructorDescription {
@ -16448,13 +16436,13 @@ public extension Api {
case messageMediaWebPage(webpage: Api.WebPage)
case messageMediaGame(game: Api.Game)
case messageMediaInvoice(flags: Int32, title: String, description: String, photo: Api.WebDocument?, receiptMsgId: Int32?, currency: String, totalAmount: Int64, startParam: String)
case messageMediaGeoLive(geo: Api.GeoPoint, period: Int32)
case messageMediaVenue(geo: Api.GeoPoint, title: String, address: String, provider: String, venueId: String, venueType: String)
case messageMediaPhoto(flags: Int32, photo: Api.Photo?, ttlSeconds: Int32?)
case messageMediaDocument(flags: Int32, document: Api.Document?, ttlSeconds: Int32?)
case messageMediaContact(phoneNumber: String, firstName: String, lastName: String, vcard: String, userId: Int32)
case messageMediaPoll(poll: Api.Poll, results: Api.PollResults)
case messageMediaDice(value: Int32, emoticon: String)
case messageMediaGeoLive(geo: Api.GeoPoint, heading: Int32, period: Int32)
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
switch self {
@ -16501,13 +16489,6 @@ public extension Api {
serializeInt64(totalAmount, buffer: buffer, boxed: false)
serializeString(startParam, buffer: buffer, boxed: false)
break
case .messageMediaGeoLive(let geo, let period):
if boxed {
buffer.appendInt32(2084316681)
}
geo.serialize(buffer, true)
serializeInt32(period, buffer: buffer, boxed: false)
break
case .messageMediaVenue(let geo, let title, let address, let provider, let venueId, let venueType):
if boxed {
buffer.appendInt32(784356159)
@ -16559,6 +16540,14 @@ public extension Api {
serializeInt32(value, buffer: buffer, boxed: false)
serializeString(emoticon, buffer: buffer, boxed: false)
break
case .messageMediaGeoLive(let geo, let heading, let period):
if boxed {
buffer.appendInt32(-967079536)
}
geo.serialize(buffer, true)
serializeInt32(heading, buffer: buffer, boxed: false)
serializeInt32(period, buffer: buffer, boxed: false)
break
}
}
@ -16576,8 +16565,6 @@ public extension Api {
return ("messageMediaGame", [("game", game)])
case .messageMediaInvoice(let flags, let title, let description, let photo, let receiptMsgId, let currency, let totalAmount, let startParam):
return ("messageMediaInvoice", [("flags", flags), ("title", title), ("description", description), ("photo", photo), ("receiptMsgId", receiptMsgId), ("currency", currency), ("totalAmount", totalAmount), ("startParam", startParam)])
case .messageMediaGeoLive(let geo, let period):
return ("messageMediaGeoLive", [("geo", geo), ("period", period)])
case .messageMediaVenue(let geo, let title, let address, let provider, let venueId, let venueType):
return ("messageMediaVenue", [("geo", geo), ("title", title), ("address", address), ("provider", provider), ("venueId", venueId), ("venueType", venueType)])
case .messageMediaPhoto(let flags, let photo, let ttlSeconds):
@ -16590,6 +16577,8 @@ public extension Api {
return ("messageMediaPoll", [("poll", poll), ("results", results)])
case .messageMediaDice(let value, let emoticon):
return ("messageMediaDice", [("value", value), ("emoticon", emoticon)])
case .messageMediaGeoLive(let geo, let heading, let period):
return ("messageMediaGeoLive", [("geo", geo), ("heading", heading), ("period", period)])
}
}
@ -16672,22 +16661,6 @@ public extension Api {
return nil
}
}
public static func parse_messageMediaGeoLive(_ reader: BufferReader) -> MessageMedia? {
var _1: Api.GeoPoint?
if let signature = reader.readInt32() {
_1 = Api.parse(reader, signature: signature) as? Api.GeoPoint
}
var _2: Int32?
_2 = reader.readInt32()
let _c1 = _1 != nil
let _c2 = _2 != nil
if _c1 && _c2 {
return Api.MessageMedia.messageMediaGeoLive(geo: _1!, period: _2!)
}
else {
return nil
}
}
public static func parse_messageMediaVenue(_ reader: BufferReader) -> MessageMedia? {
var _1: Api.GeoPoint?
if let signature = reader.readInt32() {
@ -16809,6 +16782,25 @@ public extension Api {
return nil
}
}
public static func parse_messageMediaGeoLive(_ reader: BufferReader) -> MessageMedia? {
var _1: Api.GeoPoint?
if let signature = reader.readInt32() {
_1 = Api.parse(reader, signature: signature) as? Api.GeoPoint
}
var _2: Int32?
_2 = reader.readInt32()
var _3: Int32?
_3 = reader.readInt32()
let _c1 = _1 != nil
let _c2 = _2 != nil
let _c3 = _3 != nil
if _c1 && _c2 && _c3 {
return Api.MessageMedia.messageMediaGeoLive(geo: _1!, heading: _2!, period: _3!)
}
else {
return nil
}
}
}
public enum PaymentSavedCredentials: TypeConstructorDescription {
@ -18093,7 +18085,7 @@ public extension Api {
}
public enum GeoPoint: TypeConstructorDescription {
case geoPointEmpty
case geoPoint(long: Double, lat: Double, accessHash: Int64)
case geoPoint(flags: Int32, long: Double, lat: Double, accuracyRadius: Int32?)
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
switch self {
@ -18103,13 +18095,14 @@ public extension Api {
}
break
case .geoPoint(let long, let lat, let accessHash):
case .geoPoint(let flags, let long, let lat, let accuracyRadius):
if boxed {
buffer.appendInt32(43446532)
buffer.appendInt32(-955487525)
}
serializeInt32(flags, buffer: buffer, boxed: false)
serializeDouble(long, buffer: buffer, boxed: false)
serializeDouble(lat, buffer: buffer, boxed: false)
serializeInt64(accessHash, buffer: buffer, boxed: false)
if Int(flags) & Int(1 << 0) != 0 {serializeInt32(accuracyRadius!, buffer: buffer, boxed: false)}
break
}
}
@ -18118,8 +18111,8 @@ public extension Api {
switch self {
case .geoPointEmpty:
return ("geoPointEmpty", [])
case .geoPoint(let long, let lat, let accessHash):
return ("geoPoint", [("long", long), ("lat", lat), ("accessHash", accessHash)])
case .geoPoint(let flags, let long, let lat, let accuracyRadius):
return ("geoPoint", [("flags", flags), ("long", long), ("lat", lat), ("accuracyRadius", accuracyRadius)])
}
}
@ -18127,17 +18120,20 @@ public extension Api {
return Api.GeoPoint.geoPointEmpty
}
public static func parse_geoPoint(_ reader: BufferReader) -> GeoPoint? {
var _1: Double?
_1 = reader.readDouble()
var _1: Int32?
_1 = reader.readInt32()
var _2: Double?
_2 = reader.readDouble()
var _3: Int64?
_3 = reader.readInt64()
var _3: Double?
_3 = reader.readDouble()
var _4: Int32?
if Int(_1!) & Int(1 << 0) != 0 {_4 = reader.readInt32() }
let _c1 = _1 != nil
let _c2 = _2 != nil
let _c3 = _3 != nil
if _c1 && _c2 && _c3 {
return Api.GeoPoint.geoPoint(long: _1!, lat: _2!, accessHash: _3!)
let _c4 = (Int(_1!) & Int(1 << 0) == 0) || _4 != nil
if _c1 && _c2 && _c3 && _c4 {
return Api.GeoPoint.geoPoint(flags: _1!, long: _2!, lat: _3!, accuracyRadius: _4)
}
else {
return nil
@ -21141,6 +21137,7 @@ public extension Api {
case messageActionSecureValuesSentMe(values: [Api.SecureValue], credentials: Api.SecureCredentialsEncrypted)
case messageActionSecureValuesSent(types: [Api.SecureValueType])
case messageActionContactSignUp
case messageActionGeoProximityReached(fromId: Api.Peer, toId: Api.Peer, distance: Int32)
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
switch self {
@ -21311,6 +21308,14 @@ public extension Api {
buffer.appendInt32(-202219658)
}
break
case .messageActionGeoProximityReached(let fromId, let toId, let distance):
if boxed {
buffer.appendInt32(-1730095465)
}
fromId.serialize(buffer, true)
toId.serialize(buffer, true)
serializeInt32(distance, buffer: buffer, boxed: false)
break
}
}
@ -21363,6 +21368,8 @@ public extension Api {
return ("messageActionSecureValuesSent", [("types", types)])
case .messageActionContactSignUp:
return ("messageActionContactSignUp", [])
case .messageActionGeoProximityReached(let fromId, let toId, let distance):
return ("messageActionGeoProximityReached", [("fromId", fromId), ("toId", toId), ("distance", distance)])
}
}
@ -21631,6 +21638,27 @@ public extension Api {
public static func parse_messageActionContactSignUp(_ reader: BufferReader) -> MessageAction? {
return Api.MessageAction.messageActionContactSignUp
}
public static func parse_messageActionGeoProximityReached(_ reader: BufferReader) -> MessageAction? {
var _1: Api.Peer?
if let signature = reader.readInt32() {
_1 = Api.parse(reader, signature: signature) as? Api.Peer
}
var _2: Api.Peer?
if let signature = reader.readInt32() {
_2 = Api.parse(reader, signature: signature) as? Api.Peer
}
var _3: Int32?
_3 = reader.readInt32()
let _c1 = _1 != nil
let _c2 = _2 != nil
let _c3 = _3 != nil
if _c1 && _c2 && _c3 {
return Api.MessageAction.messageActionGeoProximityReached(fromId: _1!, toId: _2!, distance: _3!)
}
else {
return nil
}
}
}
public enum PhoneCall: TypeConstructorDescription {

View File

@ -2963,6 +2963,22 @@ public extension Api {
})
}
public static func updatePinnedMessage(flags: Int32, peer: Api.InputPeer, id: Int32) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.Updates>) {
let buffer = Buffer()
buffer.appendInt32(-760547348)
serializeInt32(flags, buffer: buffer, boxed: false)
peer.serialize(buffer, true)
serializeInt32(id, buffer: buffer, boxed: false)
return (FunctionDescription(name: "messages.updatePinnedMessage", parameters: [("flags", flags), ("peer", peer), ("id", id)]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.Updates? in
let reader = BufferReader(buffer)
var result: Api.Updates?
if let signature = reader.readInt32() {
result = Api.parse(reader, signature: signature) as? Api.Updates
}
return result
})
}
public static func sendVote(peer: Api.InputPeer, msgId: Int32, options: [Buffer]) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.Updates>) {
let buffer = Buffer()
buffer.appendInt32(283795844)
@ -3765,17 +3781,19 @@ public extension Api {
})
}
public static func updatePinnedMessage(flags: Int32, peer: Api.InputPeer, id: Int32) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.Updates>) {
public static func requestProximityNotification(flags: Int32, peer: Api.InputPeer, msgId: Int32, ownLocation: Api.InputGeoPoint?, maxDistance: Int32?) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.Bool>) {
let buffer = Buffer()
buffer.appendInt32(-760547348)
buffer.appendInt32(-699657935)
serializeInt32(flags, buffer: buffer, boxed: false)
peer.serialize(buffer, true)
serializeInt32(id, buffer: buffer, boxed: false)
return (FunctionDescription(name: "messages.updatePinnedMessage", parameters: [("flags", flags), ("peer", peer), ("id", id)]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.Updates? in
serializeInt32(msgId, buffer: buffer, boxed: false)
if Int(flags) & Int(1 << 0) != 0 {ownLocation!.serialize(buffer, true)}
if Int(flags) & Int(1 << 0) != 0 {serializeInt32(maxDistance!, buffer: buffer, boxed: false)}
return (FunctionDescription(name: "messages.requestProximityNotification", parameters: [("flags", flags), ("peer", peer), ("msgId", msgId), ("ownLocation", ownLocation), ("maxDistance", maxDistance)]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.Bool? in
let reader = BufferReader(buffer)
var result: Api.Updates?
var result: Api.Bool?
if let signature = reader.readInt32() {
result = Api.parse(reader, signature: signature) as? Api.Updates
result = Api.parse(reader, signature: signature) as? Api.Bool
}
return result
})

View File

@ -1115,19 +1115,6 @@ private func finalStateWithUpdatesAndServerTime(postbox: Postbox, network: Netwo
return peer
}
})
case let .updateChannelPinnedMessage(channelId, id):
let channelPeerId = PeerId(namespace: Namespaces.Peer.CloudChannel, id: channelId)
updatedState.updateMessagesPinned(ids: [MessageId(peerId: channelPeerId, namespace: Namespaces.Message.Cloud, id: id)], pinned: true)
/*updatedState.updateCachedPeerData(channelPeerId, { current in
let previous: CachedChannelData
if let current = current as? CachedChannelData {
previous = current
} else {
previous = CachedChannelData()
}
return previous.withUpdatedPinnedMessageId(id == 0 ? nil : MessageId(peerId: channelPeerId, namespace: Namespaces.Message.Cloud, id: id))
})*/
case let .updatePinnedChannelMessages(flags, channelId, messages, pts, ptsCount):
let peerId = PeerId(namespace: Namespaces.Peer.CloudChannel, id: channelId)
if let previousState = updatedState.channelStates[peerId] {
@ -1934,16 +1921,6 @@ private func pollChannel(network: Network, peer: Peer, state: AccountMutableStat
} else {
Logger.shared.log("State", "Invalid updateEditChannelMessage")
}
case let .updateChannelPinnedMessage(_, id):
updatedState.updateCachedPeerData(peer.id, { current in
let previous: CachedChannelData
if let current = current as? CachedChannelData {
previous = current
} else {
previous = CachedChannelData()
}
return previous.withUpdatedPinnedMessageId(id == 0 ? nil : MessageId(peerId: peer.id, namespace: Namespaces.Message.Cloud, id: id))
})
case let .updatePinnedChannelMessages(flags, channelId, messages, _, _):
let channelPeerId = PeerId(namespace: Namespaces.Peer.CloudChannel, id: channelId)
updatedState.updateMessagesPinned(ids: messages.map { id in

View File

@ -8,7 +8,7 @@ extension PeerGeoLocation {
init?(apiLocation: Api.ChannelLocation) {
switch apiLocation {
case let .channelLocation(geopoint, address):
if case let .geoPoint(longitude, latitude, _) = geopoint {
if case let .geoPoint(_, longitude, latitude, _) = geopoint {
self.init(latitude: latitude, longitude: longitude, address: address)
} else {
return nil

View File

@ -25,7 +25,7 @@ private func createChannel(account: Account, title: String, description: String?
var address: String?
if let location = location {
flags |= (1 << 2)
geoPoint = .inputGeoPoint(lat: location.latitude, long: location.longitude)
geoPoint = .inputGeoPoint(flags: 0, lat: location.latitude, long: location.longitude, accuracyRadius: nil)
address = location.address
}

View File

@ -158,7 +158,7 @@ extension InstantPageBlock {
self = .relatedArticles(title: RichText(apiText: title), articles: articles.map({ InstantPageRelatedArticle(apiRelatedArticle: $0) }))
case let .pageBlockMap(geo, zoom, w, h, caption):
switch geo {
case let .geoPoint(long, lat, _):
case let .geoPoint(_, long, lat, _):
self = .map(latitude: lat, longitude: long, zoom: zoom, dimensions: PixelDimensions(width: w, height: h), caption: InstantPageCaption(apiCaption: caption))
default:
self = .unsupported

View File

@ -33,10 +33,10 @@ public func updatePeersNearbyVisibility(account: Account, update: PeerNearbyVisi
switch update {
case let .visible(latitude, longitude):
flags |= (1 << 0)
geoPoint = .inputGeoPoint(lat: latitude, long: longitude)
geoPoint = .inputGeoPoint(flags: 0, lat: latitude, long: longitude, accuracyRadius: nil)
selfExpires = 0x7fffffff
case let .location(latitude, longitude):
geoPoint = .inputGeoPoint(lat: latitude, long: longitude)
geoPoint = .inputGeoPoint(flags: 0, lat: latitude, long: longitude, accuracyRadius: nil)
case .invisible:
flags |= (1 << 0)
geoPoint = .inputGeoPointEmpty
@ -87,7 +87,7 @@ public final class PeersNearbyContext {
public init(network: Network, stateManager: AccountStateManager, coordinate: (latitude: Double, longitude: Double)) {
let expiryExtension: Double = 10.0
let poll = network.request(Api.functions.contacts.getLocated(flags: 0, geoPoint: .inputGeoPoint(lat: coordinate.latitude, long: coordinate.longitude), selfExpires: nil))
let poll = network.request(Api.functions.contacts.getLocated(flags: 0, geoPoint: .inputGeoPoint(flags: 0, lat: coordinate.latitude, long: coordinate.longitude, accuracyRadius: nil), selfExpires: nil))
|> map(Optional.init)
|> `catch` { _ -> Signal<Api.Updates?, NoError> in
return .single(nil)
@ -234,7 +234,7 @@ public func updateChannelGeoLocation(postbox: Postbox, network: Network, channel
let geoPoint: Api.InputGeoPoint
if let (latitude, longitude) = coordinate, let _ = address {
geoPoint = .inputGeoPoint(lat: latitude, long: longitude)
geoPoint = .inputGeoPoint(flags: 0, lat: latitude, long: longitude, accuracyRadius: nil)
} else {
geoPoint = .inputGeoPointEmpty
}

View File

@ -143,11 +143,11 @@ func mediaContentToUpload(network: Network, postbox: Postbox, auxiliaryMethods:
} else if let map = media as? TelegramMediaMap {
let input: Api.InputMedia
if let liveBroadcastingTimeout = map.liveBroadcastingTimeout {
input = .inputMediaGeoLive(flags: 1 << 1, geoPoint: Api.InputGeoPoint.inputGeoPoint(lat: map.latitude, long: map.longitude), period: liveBroadcastingTimeout)
input = .inputMediaGeoLive(flags: 1 << 1, geoPoint: Api.InputGeoPoint.inputGeoPoint(flags: 0, lat: map.latitude, long: map.longitude, accuracyRadius: nil), heading: 0, period: liveBroadcastingTimeout)
} else if let venue = map.venue {
input = .inputMediaVenue(geoPoint: Api.InputGeoPoint.inputGeoPoint(lat: map.latitude, long: map.longitude), title: venue.title, address: venue.address ?? "", provider: venue.provider ?? "", venueId: venue.id ?? "", venueType: venue.type ?? "")
input = .inputMediaVenue(geoPoint: Api.InputGeoPoint.inputGeoPoint(flags: 0, lat: map.latitude, long: map.longitude, accuracyRadius: nil), title: venue.title, address: venue.address ?? "", provider: venue.provider ?? "", venueId: venue.id ?? "", venueType: venue.type ?? "")
} else {
input = .inputMediaGeoPoint(geoPoint: Api.InputGeoPoint.inputGeoPoint(lat: map.latitude, long: map.longitude))
input = .inputMediaGeoPoint(geoPoint: Api.InputGeoPoint.inputGeoPoint(flags: 0, lat: map.latitude, long: map.longitude, accuracyRadius: nil))
}
return .single(.content(PendingMessageUploadedContentAndReuploadInfo(content: .media(input, text), reuploadInfo: nil)))
} else if let poll = media as? TelegramMediaPoll {

View File

@ -116,7 +116,8 @@ public func requestChatContextResults(account: Account, botId: PeerId, peerId: P
}
if let (latitude, longitude) = location {
flags |= (1 << 0)
geoPoint = Api.InputGeoPoint.inputGeoPoint(lat: latitude, long: longitude)
var geoPointFlags: Int32 = 0
geoPoint = Api.InputGeoPoint.inputGeoPoint(flags: geoPointFlags, lat: latitude, long: longitude, accuracyRadius: nil)
}
var signal: Signal<RequestChatContextResultsResult?, RequestChatContextResultsError> = account.network.request(Api.functions.messages.getInlineBotResults(flags: flags, bot: inputBot, peer: inputPeer, geoPoint: geoPoint, query: query, offset: offset))

View File

@ -273,9 +273,9 @@ public func requestEditLiveLocation(postbox: Postbox, network: Network, stateMan
}
let inputMedia: Api.InputMedia
if let coordinate = coordinate, let liveBroadcastingTimeout = media.liveBroadcastingTimeout {
inputMedia = .inputMediaGeoLive(flags: 1 << 1, geoPoint: .inputGeoPoint(lat: coordinate.latitude, long: coordinate.longitude), period: liveBroadcastingTimeout)
inputMedia = .inputMediaGeoLive(flags: 1 << 1, geoPoint: .inputGeoPoint(flags: 0, lat: coordinate.latitude, long: coordinate.longitude, accuracyRadius: nil), heading: 0, period: liveBroadcastingTimeout)
} else {
inputMedia = .inputMediaGeoLive(flags: 1 << 0, geoPoint: .inputGeoPoint(lat: media.latitude, long: media.longitude), period: nil)
inputMedia = .inputMediaGeoLive(flags: 1 << 0, geoPoint: .inputGeoPoint(flags: 0, lat: media.latitude, long: media.longitude, accuracyRadius: nil), heading: 0, period: nil)
}
return network.request(Api.functions.messages.editMessage(flags: 1 << 14, peer: inputPeer, id: messageId.id, message: nil, media: inputMedia, replyMarkup: nil, entities: nil, scheduleDate: nil))
|> map(Optional.init)

View File

@ -206,6 +206,9 @@ func apiMessagePeerIds(_ message: Api.Message) -> [PeerId] {
result.append(PeerId(namespace: Namespaces.Peer.CloudUser, id: inviterId))
case let .messageActionChatMigrateTo(channelId):
result.append(PeerId(namespace: Namespaces.Peer.CloudChannel, id: channelId))
case let .messageActionGeoProximityReached(fromId, toId, _):
result.append(fromId.peerId)
result.append(toId.peerId)
}
return result
@ -257,7 +260,7 @@ func textMediaAndExpirationTimerFromApiMedia(_ media: Api.MessageMedia?, _ peerI
case let .messageMediaVenue(geo, title, address, provider, venueId, venueType):
let mediaMap = telegramMediaMapFromApiGeoPoint(geo, title: title, address: address, provider: provider, venueId: venueId, venueType: venueType, liveBroadcastingTimeout: nil)
return (mediaMap, nil)
case let .messageMediaGeoLive(geo, period):
case let .messageMediaGeoLive(geo, heading, period):
let mediaMap = telegramMediaMapFromApiGeoPoint(geo, title: nil, address: nil, provider: nil, venueId: nil, venueType: nil, liveBroadcastingTimeout: period)
return (mediaMap, nil)
case let .messageMediaDocument(_, document, ttlSeconds):

View File

@ -57,6 +57,8 @@ func telegramMediaActionFromApiAction(_ action: Api.MessageAction) -> TelegramMe
return TelegramMediaAction(action: .botSentSecureValues(types: types.map(SentSecureValueType.init)))
case .messageActionContactSignUp:
return TelegramMediaAction(action: .peerJoined)
case let .messageActionGeoProximityReached(fromId, toId, distance):
return nil
}
}

View File

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

View File

@ -3279,7 +3279,7 @@ public final class ChatControllerImpl: TelegramBaseController, ChatController, G
if message == nil {
matches = true
} else if let topVisibleMessageRange = topVisibleMessageRange {
if entry.message.id < topVisibleMessageRange.upperBound {
if entry.message.id <= topVisibleMessageRange.upperBound {
matches = true
}
} else {