mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-06-16 05:55:20 +00:00
Update API
This commit is contained in:
parent
c0652152c2
commit
70d148102b
@ -288,7 +288,7 @@ fileprivate let parsers: [Int32 : (BufferReader) -> Any?] = {
|
|||||||
dict[1149094475] = { return Api.ChannelParticipant.parse_channelParticipantCreator($0) }
|
dict[1149094475] = { return Api.ChannelParticipant.parse_channelParticipantCreator($0) }
|
||||||
dict[-859915345] = { return Api.ChannelParticipant.parse_channelParticipantAdmin($0) }
|
dict[-859915345] = { return Api.ChannelParticipant.parse_channelParticipantAdmin($0) }
|
||||||
dict[1352785878] = { return Api.ChannelParticipant.parse_channelParticipantBanned($0) }
|
dict[1352785878] = { return Api.ChannelParticipant.parse_channelParticipantBanned($0) }
|
||||||
dict[-1010402965] = { return Api.ChannelParticipant.parse_channelParticipantLeft($0) }
|
dict[453242886] = { return Api.ChannelParticipant.parse_channelParticipantLeft($0) }
|
||||||
dict[-1567730343] = { return Api.MessageUserVote.parse_messageUserVote($0) }
|
dict[-1567730343] = { return Api.MessageUserVote.parse_messageUserVote($0) }
|
||||||
dict[909603888] = { return Api.MessageUserVote.parse_messageUserVoteInputOption($0) }
|
dict[909603888] = { return Api.MessageUserVote.parse_messageUserVoteInputOption($0) }
|
||||||
dict[244310238] = { return Api.MessageUserVote.parse_messageUserVoteMultiple($0) }
|
dict[244310238] = { return Api.MessageUserVote.parse_messageUserVoteMultiple($0) }
|
||||||
@ -471,7 +471,6 @@ fileprivate let parsers: [Int32 : (BufferReader) -> Any?] = {
|
|||||||
dict[-1036572727] = { return Api.account.PasswordInputSettings.parse_passwordInputSettings($0) }
|
dict[-1036572727] = { return Api.account.PasswordInputSettings.parse_passwordInputSettings($0) }
|
||||||
dict[878078826] = { return Api.PageTableCell.parse_pageTableCell($0) }
|
dict[878078826] = { return Api.PageTableCell.parse_pageTableCell($0) }
|
||||||
dict[-1626209256] = { return Api.ChatBannedRights.parse_chatBannedRights($0) }
|
dict[-1626209256] = { return Api.ChatBannedRights.parse_chatBannedRights($0) }
|
||||||
dict[423690591] = { return Api.ChatBannedRights.parse_chatBannedRightsChannel($0) }
|
|
||||||
dict[1968737087] = { return Api.InputClientProxy.parse_inputClientProxy($0) }
|
dict[1968737087] = { return Api.InputClientProxy.parse_inputClientProxy($0) }
|
||||||
dict[649453030] = { return Api.messages.MessageEditData.parse_messageEditData($0) }
|
dict[649453030] = { return Api.messages.MessageEditData.parse_messageEditData($0) }
|
||||||
dict[-886477832] = { return Api.LabeledPrice.parse_labeledPrice($0) }
|
dict[-886477832] = { return Api.LabeledPrice.parse_labeledPrice($0) }
|
||||||
|
@ -7363,7 +7363,7 @@ public extension Api {
|
|||||||
case channelParticipantCreator(flags: Int32, userId: Int32, adminRights: Api.ChatAdminRights, rank: String?)
|
case channelParticipantCreator(flags: Int32, userId: Int32, adminRights: Api.ChatAdminRights, rank: String?)
|
||||||
case channelParticipantAdmin(flags: Int32, userId: Int32, inviterId: Int32?, promotedBy: Int32, date: Int32, adminRights: Api.ChatAdminRights, rank: String?)
|
case channelParticipantAdmin(flags: Int32, userId: Int32, inviterId: Int32?, promotedBy: Int32, date: Int32, adminRights: Api.ChatAdminRights, rank: String?)
|
||||||
case channelParticipantBanned(flags: Int32, peer: Api.Peer, kickedBy: Int32, date: Int32, bannedRights: Api.ChatBannedRights)
|
case channelParticipantBanned(flags: Int32, peer: Api.Peer, kickedBy: Int32, date: Int32, bannedRights: Api.ChatBannedRights)
|
||||||
case channelParticipantLeft(userId: Int32)
|
case channelParticipantLeft(peer: Api.Peer)
|
||||||
|
|
||||||
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
||||||
switch self {
|
switch self {
|
||||||
@ -7413,11 +7413,11 @@ public extension Api {
|
|||||||
serializeInt32(date, buffer: buffer, boxed: false)
|
serializeInt32(date, buffer: buffer, boxed: false)
|
||||||
bannedRights.serialize(buffer, true)
|
bannedRights.serialize(buffer, true)
|
||||||
break
|
break
|
||||||
case .channelParticipantLeft(let userId):
|
case .channelParticipantLeft(let peer):
|
||||||
if boxed {
|
if boxed {
|
||||||
buffer.appendInt32(-1010402965)
|
buffer.appendInt32(453242886)
|
||||||
}
|
}
|
||||||
serializeInt32(userId, buffer: buffer, boxed: false)
|
peer.serialize(buffer, true)
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -7434,8 +7434,8 @@ public extension Api {
|
|||||||
return ("channelParticipantAdmin", [("flags", flags), ("userId", userId), ("inviterId", inviterId), ("promotedBy", promotedBy), ("date", date), ("adminRights", adminRights), ("rank", rank)])
|
return ("channelParticipantAdmin", [("flags", flags), ("userId", userId), ("inviterId", inviterId), ("promotedBy", promotedBy), ("date", date), ("adminRights", adminRights), ("rank", rank)])
|
||||||
case .channelParticipantBanned(let flags, let peer, let kickedBy, let date, let bannedRights):
|
case .channelParticipantBanned(let flags, let peer, let kickedBy, let date, let bannedRights):
|
||||||
return ("channelParticipantBanned", [("flags", flags), ("peer", peer), ("kickedBy", kickedBy), ("date", date), ("bannedRights", bannedRights)])
|
return ("channelParticipantBanned", [("flags", flags), ("peer", peer), ("kickedBy", kickedBy), ("date", date), ("bannedRights", bannedRights)])
|
||||||
case .channelParticipantLeft(let userId):
|
case .channelParticipantLeft(let peer):
|
||||||
return ("channelParticipantLeft", [("userId", userId)])
|
return ("channelParticipantLeft", [("peer", peer)])
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -7551,11 +7551,13 @@ public extension Api {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
public static func parse_channelParticipantLeft(_ reader: BufferReader) -> ChannelParticipant? {
|
public static func parse_channelParticipantLeft(_ reader: BufferReader) -> ChannelParticipant? {
|
||||||
var _1: Int32?
|
var _1: Api.Peer?
|
||||||
_1 = reader.readInt32()
|
if let signature = reader.readInt32() {
|
||||||
|
_1 = Api.parse(reader, signature: signature) as? Api.Peer
|
||||||
|
}
|
||||||
let _c1 = _1 != nil
|
let _c1 = _1 != nil
|
||||||
if _c1 {
|
if _c1 {
|
||||||
return Api.ChannelParticipant.channelParticipantLeft(userId: _1!)
|
return Api.ChannelParticipant.channelParticipantLeft(peer: _1!)
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
return nil
|
return nil
|
||||||
@ -12069,7 +12071,6 @@ public extension Api {
|
|||||||
}
|
}
|
||||||
public enum ChatBannedRights: TypeConstructorDescription {
|
public enum ChatBannedRights: TypeConstructorDescription {
|
||||||
case chatBannedRights(flags: Int32, untilDate: Int32)
|
case chatBannedRights(flags: Int32, untilDate: Int32)
|
||||||
case chatBannedRightsChannel(flags: Int32)
|
|
||||||
|
|
||||||
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
||||||
switch self {
|
switch self {
|
||||||
@ -12080,12 +12081,6 @@ public extension Api {
|
|||||||
serializeInt32(flags, buffer: buffer, boxed: false)
|
serializeInt32(flags, buffer: buffer, boxed: false)
|
||||||
serializeInt32(untilDate, buffer: buffer, boxed: false)
|
serializeInt32(untilDate, buffer: buffer, boxed: false)
|
||||||
break
|
break
|
||||||
case .chatBannedRightsChannel(let flags):
|
|
||||||
if boxed {
|
|
||||||
buffer.appendInt32(423690591)
|
|
||||||
}
|
|
||||||
serializeInt32(flags, buffer: buffer, boxed: false)
|
|
||||||
break
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -12093,8 +12088,6 @@ public extension Api {
|
|||||||
switch self {
|
switch self {
|
||||||
case .chatBannedRights(let flags, let untilDate):
|
case .chatBannedRights(let flags, let untilDate):
|
||||||
return ("chatBannedRights", [("flags", flags), ("untilDate", untilDate)])
|
return ("chatBannedRights", [("flags", flags), ("untilDate", untilDate)])
|
||||||
case .chatBannedRightsChannel(let flags):
|
|
||||||
return ("chatBannedRightsChannel", [("flags", flags)])
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -12112,17 +12105,6 @@ public extension Api {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public static func parse_chatBannedRightsChannel(_ reader: BufferReader) -> ChatBannedRights? {
|
|
||||||
var _1: Int32?
|
|
||||||
_1 = reader.readInt32()
|
|
||||||
let _c1 = _1 != nil
|
|
||||||
if _c1 {
|
|
||||||
return Api.ChatBannedRights.chatBannedRightsChannel(flags: _1!)
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
public enum InputClientProxy: TypeConstructorDescription {
|
public enum InputClientProxy: TypeConstructorDescription {
|
||||||
|
@ -211,7 +211,7 @@ extension ChannelParticipant {
|
|||||||
case let .channelParticipantSelf(userId, _, date):
|
case let .channelParticipantSelf(userId, _, date):
|
||||||
self = .member(id: PeerId(namespace: Namespaces.Peer.CloudUser, id: userId), invitedAt: date, adminInfo: nil, banInfo: nil, rank: nil)
|
self = .member(id: PeerId(namespace: Namespaces.Peer.CloudUser, id: userId), invitedAt: date, adminInfo: nil, banInfo: nil, rank: nil)
|
||||||
case let .channelParticipantLeft(userId):
|
case let .channelParticipantLeft(userId):
|
||||||
self = .member(id: PeerId(namespace: Namespaces.Peer.CloudUser, id: userId), invitedAt: 0, adminInfo: nil, banInfo: nil, rank: nil)
|
self = .member(id: userId.peerId, invitedAt: 0, adminInfo: nil, banInfo: nil, rank: nil)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -160,17 +160,9 @@ public func updateChannelMemberBannedRights(account: Account, peerId: PeerId, me
|
|||||||
|
|
||||||
let apiRights: Api.ChatBannedRights
|
let apiRights: Api.ChatBannedRights
|
||||||
if let rights = rights, !rights.flags.isEmpty {
|
if let rights = rights, !rights.flags.isEmpty {
|
||||||
if memberId.namespace == Namespaces.Peer.CloudChannel {
|
apiRights = rights.apiBannedRights
|
||||||
apiRights = .chatBannedRightsChannel(flags: 1 << 0)
|
|
||||||
} else {
|
|
||||||
apiRights = rights.apiBannedRights
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
if memberId.namespace == Namespaces.Peer.CloudChannel {
|
apiRights = .chatBannedRights(flags: 0, untilDate: 0)
|
||||||
apiRights = .chatBannedRightsChannel(flags: 0)
|
|
||||||
} else {
|
|
||||||
apiRights = .chatBannedRights(flags: 0, untilDate: 0)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return account.network.request(Api.functions.channels.editBanned(channel: inputChannel, participant: inputPeer, bannedRights: apiRights))
|
return account.network.request(Api.functions.channels.editBanned(channel: inputChannel, participant: inputPeer, bannedRights: apiRights))
|
||||||
|
@ -9,9 +9,6 @@ extension TelegramChatBannedRights {
|
|||||||
switch apiBannedRights {
|
switch apiBannedRights {
|
||||||
case let .chatBannedRights(flags, untilDate):
|
case let .chatBannedRights(flags, untilDate):
|
||||||
self.init(flags: TelegramChatBannedRightsFlags(rawValue: flags), untilDate: untilDate)
|
self.init(flags: TelegramChatBannedRightsFlags(rawValue: flags), untilDate: untilDate)
|
||||||
case let .chatBannedRightsChannel(flags):
|
|
||||||
let isKicked = (flags & (1 << 0)) != 0
|
|
||||||
self.init(flags: [.banReadMessages], untilDate: Int32.max)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user