mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-10-09 03:20:48 +00:00
Update API
This commit is contained in:
parent
cc7ad065f9
commit
54de3e7b9f
@ -6919,3 +6919,6 @@ Ads should no longer be synonymous with abuse of user privacy. Let us redefine h
|
|||||||
"MemberRequests.RequestToJoinSent" = "Request to join Sent";
|
"MemberRequests.RequestToJoinSent" = "Request to join Sent";
|
||||||
"MemberRequests.RequestToJoinSentDescriptionGroup" = "You will be added to the group once it admins approve your request.";
|
"MemberRequests.RequestToJoinSentDescriptionGroup" = "You will be added to the group once it admins approve your request.";
|
||||||
"MemberRequests.RequestToJoinSentDescriptionChannel" = "You will be added to the channel once it admins approve your request.";
|
"MemberRequests.RequestToJoinSentDescriptionChannel" = "You will be added to the channel once it admins approve your request.";
|
||||||
|
|
||||||
|
"Notification.JoinedGroupByRequest" = "Your request to join the group was approved";
|
||||||
|
"Notification.JoinedChannelByRequest" = "Your request to join the channel was approved";
|
||||||
|
@ -578,7 +578,7 @@ fileprivate let parsers: [Int32 : (BufferReader) -> Any?] = {
|
|||||||
dict[-1032140601] = { return Api.BotCommand.parse_botCommand($0) }
|
dict[-1032140601] = { return Api.BotCommand.parse_botCommand($0) }
|
||||||
dict[1474462241] = { return Api.account.ContentSettings.parse_contentSettings($0) }
|
dict[1474462241] = { return Api.account.ContentSettings.parse_contentSettings($0) }
|
||||||
dict[-193506890] = { return Api.phone.GroupParticipants.parse_groupParticipants($0) }
|
dict[-193506890] = { return Api.phone.GroupParticipants.parse_groupParticipants($0) }
|
||||||
dict[-1574303204] = { return Api.ChatInviteImporter.parse_chatInviteImporter($0) }
|
dict[-1940201511] = { return Api.ChatInviteImporter.parse_chatInviteImporter($0) }
|
||||||
dict[-2066640507] = { return Api.messages.AffectedMessages.parse_affectedMessages($0) }
|
dict[-2066640507] = { return Api.messages.AffectedMessages.parse_affectedMessages($0) }
|
||||||
dict[-402498398] = { return Api.messages.SavedGifs.parse_savedGifsNotModified($0) }
|
dict[-402498398] = { return Api.messages.SavedGifs.parse_savedGifsNotModified($0) }
|
||||||
dict[-2069878259] = { return Api.messages.SavedGifs.parse_savedGifs($0) }
|
dict[-2069878259] = { return Api.messages.SavedGifs.parse_savedGifs($0) }
|
||||||
@ -836,6 +836,7 @@ fileprivate let parsers: [Int32 : (BufferReader) -> Any?] = {
|
|||||||
dict[-1781355374] = { return Api.MessageAction.parse_messageActionChannelCreate($0) }
|
dict[-1781355374] = { return Api.MessageAction.parse_messageActionChannelCreate($0) }
|
||||||
dict[-519864430] = { return Api.MessageAction.parse_messageActionChatMigrateTo($0) }
|
dict[-519864430] = { return Api.MessageAction.parse_messageActionChatMigrateTo($0) }
|
||||||
dict[-365344535] = { return Api.MessageAction.parse_messageActionChannelMigrateFrom($0) }
|
dict[-365344535] = { return Api.MessageAction.parse_messageActionChannelMigrateFrom($0) }
|
||||||
|
dict[-339958837] = { return Api.MessageAction.parse_messageActionChatJoinedByRequest($0) }
|
||||||
dict[-1799538451] = { return Api.MessageAction.parse_messageActionPinMessage($0) }
|
dict[-1799538451] = { return Api.MessageAction.parse_messageActionPinMessage($0) }
|
||||||
dict[-1615153660] = { return Api.MessageAction.parse_messageActionHistoryClear($0) }
|
dict[-1615153660] = { return Api.MessageAction.parse_messageActionHistoryClear($0) }
|
||||||
dict[-1834538890] = { return Api.MessageAction.parse_messageActionGameScore($0) }
|
dict[-1834538890] = { return Api.MessageAction.parse_messageActionGameScore($0) }
|
||||||
|
@ -14824,17 +14824,18 @@ public extension Api {
|
|||||||
|
|
||||||
}
|
}
|
||||||
public enum ChatInviteImporter: TypeConstructorDescription {
|
public enum ChatInviteImporter: TypeConstructorDescription {
|
||||||
case chatInviteImporter(flags: Int32, userId: Int64, date: Int32, approvedBy: Int64?)
|
case chatInviteImporter(flags: Int32, userId: Int64, date: Int32, about: String?, approvedBy: Int64?)
|
||||||
|
|
||||||
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
||||||
switch self {
|
switch self {
|
||||||
case .chatInviteImporter(let flags, let userId, let date, let approvedBy):
|
case .chatInviteImporter(let flags, let userId, let date, let about, let approvedBy):
|
||||||
if boxed {
|
if boxed {
|
||||||
buffer.appendInt32(-1574303204)
|
buffer.appendInt32(-1940201511)
|
||||||
}
|
}
|
||||||
serializeInt32(flags, buffer: buffer, boxed: false)
|
serializeInt32(flags, buffer: buffer, boxed: false)
|
||||||
serializeInt64(userId, buffer: buffer, boxed: false)
|
serializeInt64(userId, buffer: buffer, boxed: false)
|
||||||
serializeInt32(date, buffer: buffer, boxed: false)
|
serializeInt32(date, buffer: buffer, boxed: false)
|
||||||
|
if Int(flags) & Int(1 << 2) != 0 {serializeString(about!, buffer: buffer, boxed: false)}
|
||||||
if Int(flags) & Int(1 << 1) != 0 {serializeInt64(approvedBy!, buffer: buffer, boxed: false)}
|
if Int(flags) & Int(1 << 1) != 0 {serializeInt64(approvedBy!, buffer: buffer, boxed: false)}
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
@ -14842,8 +14843,8 @@ public extension Api {
|
|||||||
|
|
||||||
public func descriptionFields() -> (String, [(String, Any)]) {
|
public func descriptionFields() -> (String, [(String, Any)]) {
|
||||||
switch self {
|
switch self {
|
||||||
case .chatInviteImporter(let flags, let userId, let date, let approvedBy):
|
case .chatInviteImporter(let flags, let userId, let date, let about, let approvedBy):
|
||||||
return ("chatInviteImporter", [("flags", flags), ("userId", userId), ("date", date), ("approvedBy", approvedBy)])
|
return ("chatInviteImporter", [("flags", flags), ("userId", userId), ("date", date), ("about", about), ("approvedBy", approvedBy)])
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -14854,14 +14855,17 @@ public extension Api {
|
|||||||
_2 = reader.readInt64()
|
_2 = reader.readInt64()
|
||||||
var _3: Int32?
|
var _3: Int32?
|
||||||
_3 = reader.readInt32()
|
_3 = reader.readInt32()
|
||||||
var _4: Int64?
|
var _4: String?
|
||||||
if Int(_1!) & Int(1 << 1) != 0 {_4 = reader.readInt64() }
|
if Int(_1!) & Int(1 << 2) != 0 {_4 = parseString(reader) }
|
||||||
|
var _5: Int64?
|
||||||
|
if Int(_1!) & Int(1 << 1) != 0 {_5 = reader.readInt64() }
|
||||||
let _c1 = _1 != nil
|
let _c1 = _1 != nil
|
||||||
let _c2 = _2 != nil
|
let _c2 = _2 != nil
|
||||||
let _c3 = _3 != nil
|
let _c3 = _3 != nil
|
||||||
let _c4 = (Int(_1!) & Int(1 << 1) == 0) || _4 != nil
|
let _c4 = (Int(_1!) & Int(1 << 2) == 0) || _4 != nil
|
||||||
if _c1 && _c2 && _c3 && _c4 {
|
let _c5 = (Int(_1!) & Int(1 << 1) == 0) || _5 != nil
|
||||||
return Api.ChatInviteImporter.chatInviteImporter(flags: _1!, userId: _2!, date: _3!, approvedBy: _4)
|
if _c1 && _c2 && _c3 && _c4 && _c5 {
|
||||||
|
return Api.ChatInviteImporter.chatInviteImporter(flags: _1!, userId: _2!, date: _3!, about: _4, approvedBy: _5)
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
return nil
|
return nil
|
||||||
@ -21033,6 +21037,7 @@ public extension Api {
|
|||||||
case messageActionChannelCreate(title: String)
|
case messageActionChannelCreate(title: String)
|
||||||
case messageActionChatMigrateTo(channelId: Int64)
|
case messageActionChatMigrateTo(channelId: Int64)
|
||||||
case messageActionChannelMigrateFrom(title: String, chatId: Int64)
|
case messageActionChannelMigrateFrom(title: String, chatId: Int64)
|
||||||
|
case messageActionChatJoinedByRequest
|
||||||
case messageActionPinMessage
|
case messageActionPinMessage
|
||||||
case messageActionHistoryClear
|
case messageActionHistoryClear
|
||||||
case messageActionGameScore(gameId: Int64, score: Int32)
|
case messageActionGameScore(gameId: Int64, score: Int32)
|
||||||
@ -21129,6 +21134,12 @@ public extension Api {
|
|||||||
}
|
}
|
||||||
serializeString(title, buffer: buffer, boxed: false)
|
serializeString(title, buffer: buffer, boxed: false)
|
||||||
serializeInt64(chatId, buffer: buffer, boxed: false)
|
serializeInt64(chatId, buffer: buffer, boxed: false)
|
||||||
|
break
|
||||||
|
case .messageActionChatJoinedByRequest:
|
||||||
|
if boxed {
|
||||||
|
buffer.appendInt32(-339958837)
|
||||||
|
}
|
||||||
|
|
||||||
break
|
break
|
||||||
case .messageActionPinMessage:
|
case .messageActionPinMessage:
|
||||||
if boxed {
|
if boxed {
|
||||||
@ -21295,6 +21306,8 @@ public extension Api {
|
|||||||
return ("messageActionChatMigrateTo", [("channelId", channelId)])
|
return ("messageActionChatMigrateTo", [("channelId", channelId)])
|
||||||
case .messageActionChannelMigrateFrom(let title, let chatId):
|
case .messageActionChannelMigrateFrom(let title, let chatId):
|
||||||
return ("messageActionChannelMigrateFrom", [("title", title), ("chatId", chatId)])
|
return ("messageActionChannelMigrateFrom", [("title", title), ("chatId", chatId)])
|
||||||
|
case .messageActionChatJoinedByRequest:
|
||||||
|
return ("messageActionChatJoinedByRequest", [])
|
||||||
case .messageActionPinMessage:
|
case .messageActionPinMessage:
|
||||||
return ("messageActionPinMessage", [])
|
return ("messageActionPinMessage", [])
|
||||||
case .messageActionHistoryClear:
|
case .messageActionHistoryClear:
|
||||||
@ -21451,6 +21464,9 @@ public extension Api {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
public static func parse_messageActionChatJoinedByRequest(_ reader: BufferReader) -> MessageAction? {
|
||||||
|
return Api.MessageAction.messageActionChatJoinedByRequest
|
||||||
|
}
|
||||||
public static func parse_messageActionPinMessage(_ reader: BufferReader) -> MessageAction? {
|
public static func parse_messageActionPinMessage(_ reader: BufferReader) -> MessageAction? {
|
||||||
return Api.MessageAction.messageActionPinMessage
|
return Api.MessageAction.messageActionPinMessage
|
||||||
}
|
}
|
||||||
|
@ -195,7 +195,7 @@ func apiMessagePeerIds(_ message: Api.Message) -> [PeerId] {
|
|||||||
}
|
}
|
||||||
|
|
||||||
switch action {
|
switch action {
|
||||||
case .messageActionChannelCreate, .messageActionChatDeletePhoto, .messageActionChatEditPhoto, .messageActionChatEditTitle, .messageActionEmpty, .messageActionPinMessage, .messageActionHistoryClear, .messageActionGameScore, .messageActionPaymentSent, .messageActionPaymentSentMe, .messageActionPhoneCall, .messageActionScreenshotTaken, .messageActionCustomAction, .messageActionBotAllowed, .messageActionSecureValuesSent, .messageActionSecureValuesSentMe, .messageActionContactSignUp, .messageActionGroupCall, .messageActionSetMessagesTTL, .messageActionGroupCallScheduled, .messageActionSetChatTheme:
|
case .messageActionChannelCreate, .messageActionChatDeletePhoto, .messageActionChatEditPhoto, .messageActionChatEditTitle, .messageActionEmpty, .messageActionPinMessage, .messageActionHistoryClear, .messageActionGameScore, .messageActionPaymentSent, .messageActionPaymentSentMe, .messageActionPhoneCall, .messageActionScreenshotTaken, .messageActionCustomAction, .messageActionBotAllowed, .messageActionSecureValuesSent, .messageActionSecureValuesSentMe, .messageActionContactSignUp, .messageActionGroupCall, .messageActionSetMessagesTTL, .messageActionGroupCallScheduled, .messageActionSetChatTheme, .messageActionChatJoinedByRequest:
|
||||||
break
|
break
|
||||||
case let .messageActionChannelMigrateFrom(_, chatId):
|
case let .messageActionChannelMigrateFrom(_, chatId):
|
||||||
result.append(PeerId(namespace: Namespaces.Peer.CloudGroup, id: PeerId.Id._internalFromInt64Value(chatId)))
|
result.append(PeerId(namespace: Namespaces.Peer.CloudGroup, id: PeerId.Id._internalFromInt64Value(chatId)))
|
||||||
|
@ -79,6 +79,8 @@ func telegramMediaActionFromApiAction(_ action: Api.MessageAction) -> TelegramMe
|
|||||||
}
|
}
|
||||||
case let .messageActionSetChatTheme(emoji):
|
case let .messageActionSetChatTheme(emoji):
|
||||||
return TelegramMediaAction(action: .setChatTheme(emoji: emoji))
|
return TelegramMediaAction(action: .setChatTheme(emoji: emoji))
|
||||||
|
case .messageActionChatJoinedByRequest:
|
||||||
|
return TelegramMediaAction(action: .joinedByRequest)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -49,6 +49,7 @@ public enum TelegramMediaActionType: PostboxCoding, Equatable {
|
|||||||
case groupPhoneCall(callId: Int64, accessHash: Int64, scheduleDate: Int32?, duration: Int32?)
|
case groupPhoneCall(callId: Int64, accessHash: Int64, scheduleDate: Int32?, duration: Int32?)
|
||||||
case inviteToGroupPhoneCall(callId: Int64, accessHash: Int64, peerIds: [PeerId])
|
case inviteToGroupPhoneCall(callId: Int64, accessHash: Int64, peerIds: [PeerId])
|
||||||
case setChatTheme(emoji: String)
|
case setChatTheme(emoji: String)
|
||||||
|
case joinedByRequest
|
||||||
|
|
||||||
public init(decoder: PostboxDecoder) {
|
public init(decoder: PostboxDecoder) {
|
||||||
let rawValue: Int32 = decoder.decodeInt32ForKey("_rawValue", orElse: 0)
|
let rawValue: Int32 = decoder.decodeInt32ForKey("_rawValue", orElse: 0)
|
||||||
@ -113,6 +114,8 @@ public enum TelegramMediaActionType: PostboxCoding, Equatable {
|
|||||||
self = .inviteToGroupPhoneCall(callId: decoder.decodeInt64ForKey("callId", orElse: 0), accessHash: decoder.decodeInt64ForKey("accessHash", orElse: 0), peerIds: peerIds)
|
self = .inviteToGroupPhoneCall(callId: decoder.decodeInt64ForKey("callId", orElse: 0), accessHash: decoder.decodeInt64ForKey("accessHash", orElse: 0), peerIds: peerIds)
|
||||||
case 24:
|
case 24:
|
||||||
self = .setChatTheme(emoji: decoder.decodeStringForKey("emoji", orElse: ""))
|
self = .setChatTheme(emoji: decoder.decodeStringForKey("emoji", orElse: ""))
|
||||||
|
case 25:
|
||||||
|
self = .joinedByRequest
|
||||||
default:
|
default:
|
||||||
self = .unknown
|
self = .unknown
|
||||||
}
|
}
|
||||||
@ -225,6 +228,8 @@ public enum TelegramMediaActionType: PostboxCoding, Equatable {
|
|||||||
case let .setChatTheme(emoji):
|
case let .setChatTheme(emoji):
|
||||||
encoder.encodeInt32(24, forKey: "_rawValue")
|
encoder.encodeInt32(24, forKey: "_rawValue")
|
||||||
encoder.encodeString(emoji, forKey: "emoji")
|
encoder.encodeString(emoji, forKey: "emoji")
|
||||||
|
case .joinedByRequest:
|
||||||
|
encoder.encodeInt32(25, forKey: "_rawValue")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -643,6 +643,7 @@ public struct PeerInvitationImportersState: Equatable {
|
|||||||
public struct Importer: Equatable {
|
public struct Importer: Equatable {
|
||||||
public var peer: RenderedPeer
|
public var peer: RenderedPeer
|
||||||
public var date: Int32
|
public var date: Int32
|
||||||
|
public var about: String?
|
||||||
public var approvedBy: PeerId?
|
public var approvedBy: PeerId?
|
||||||
}
|
}
|
||||||
public var importers: [Importer]
|
public var importers: [Importer]
|
||||||
@ -838,15 +839,17 @@ private final class PeerInvitationImportersContextImpl {
|
|||||||
for importer in importers {
|
for importer in importers {
|
||||||
let peerId: PeerId
|
let peerId: PeerId
|
||||||
let date: Int32
|
let date: Int32
|
||||||
|
let about: String?
|
||||||
let approvedBy: PeerId?
|
let approvedBy: PeerId?
|
||||||
switch importer {
|
switch importer {
|
||||||
case let .chatInviteImporter(_, userId, dateValue, approvedByValue):
|
case let .chatInviteImporter(_, userId, dateValue, aboutValue, approvedByValue):
|
||||||
peerId = PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt64Value(userId))
|
peerId = PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt64Value(userId))
|
||||||
date = dateValue
|
date = dateValue
|
||||||
|
about = aboutValue
|
||||||
approvedBy = approvedByValue.flatMap { PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt64Value($0)) }
|
approvedBy = approvedByValue.flatMap { PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt64Value($0)) }
|
||||||
}
|
}
|
||||||
if let peer = transaction.getPeer(peerId) {
|
if let peer = transaction.getPeer(peerId) {
|
||||||
resultImporters.append(PeerInvitationImportersState.Importer(peer: RenderedPeer(peer: peer), date: date, approvedBy: approvedBy))
|
resultImporters.append(PeerInvitationImportersState.Importer(peer: RenderedPeer(peer: peer), date: date, about: about, approvedBy: approvedBy))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if populateCache {
|
if populateCache {
|
||||||
|
@ -257,6 +257,8 @@ public func universalServiceMessageString(presentationData: (PresentationTheme,
|
|||||||
}
|
}
|
||||||
case .joinedByLink:
|
case .joinedByLink:
|
||||||
attributedString = addAttributesToStringWithRanges(strings.Notification_JoinedGroupByLink(authorName)._tuple, body: bodyAttributes, argumentAttributes: peerMentionsAttributes(primaryTextColor: primaryTextColor, peerIds: [(0, message.author?.id)]))
|
attributedString = addAttributesToStringWithRanges(strings.Notification_JoinedGroupByLink(authorName)._tuple, body: bodyAttributes, argumentAttributes: peerMentionsAttributes(primaryTextColor: primaryTextColor, peerIds: [(0, message.author?.id)]))
|
||||||
|
case .joinedByRequest:
|
||||||
|
attributedString = NSAttributedString(string: isChannel ? strings.Notification_JoinedChannelByRequest : strings.Notification_JoinedGroupByRequest, font: titleFont, textColor: primaryTextColor)
|
||||||
case .channelMigratedFromGroup, .groupMigratedToChannel:
|
case .channelMigratedFromGroup, .groupMigratedToChannel:
|
||||||
attributedString = NSAttributedString(string: "", font: titleFont, textColor: primaryTextColor)
|
attributedString = NSAttributedString(string: "", font: titleFont, textColor: primaryTextColor)
|
||||||
case let .messageAutoremoveTimeoutUpdated(timeout):
|
case let .messageAutoremoveTimeoutUpdated(timeout):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user