Restore changes [skip ci]

This commit is contained in:
Ali 2020-10-08 21:47:32 +01:00
parent d8c66309fa
commit a64220e6eb
8 changed files with 54 additions and 30 deletions

View File

@ -3,7 +3,7 @@
@implementation Serialization
- (NSUInteger)currentLayer {
return 119;
return 120;
}
- (id _Nullable)parseMessage:(NSData * _Nullable)data {

View File

@ -322,6 +322,7 @@ fileprivate let parsers: [Int32 : (BufferReader) -> Any?] = {
dict[106343499] = { return Api.ChannelParticipantsFilter.parse_channelParticipantsSearch($0) }
dict[-1548400251] = { return Api.ChannelParticipantsFilter.parse_channelParticipantsKicked($0) }
dict[-1150621555] = { return Api.ChannelParticipantsFilter.parse_channelParticipantsContacts($0) }
dict[-531931925] = { return Api.ChannelParticipantsFilter.parse_channelParticipantsMentions($0) }
dict[-350980120] = { return Api.WebPage.parse_webPageEmpty($0) }
dict[-981018084] = { return Api.WebPage.parse_webPagePending($0) }
dict[-392411726] = { return Api.WebPage.parse_webPage($0) }

View File

@ -9991,6 +9991,7 @@ public extension Api {
case channelParticipantsSearch(q: String)
case channelParticipantsKicked(q: String)
case channelParticipantsContacts(q: String)
case channelParticipantsMentions(flags: Int32, q: String?, topMsgId: Int32?)
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
switch self {
@ -10036,6 +10037,14 @@ public extension Api {
}
serializeString(q, buffer: buffer, boxed: false)
break
case .channelParticipantsMentions(let flags, let q, let topMsgId):
if boxed {
buffer.appendInt32(-531931925)
}
serializeInt32(flags, buffer: buffer, boxed: false)
if Int(flags) & Int(1 << 0) != 0 {serializeString(q!, buffer: buffer, boxed: false)}
if Int(flags) & Int(1 << 1) != 0 {serializeInt32(topMsgId!, buffer: buffer, boxed: false)}
break
}
}
@ -10055,6 +10064,8 @@ public extension Api {
return ("channelParticipantsKicked", [("q", q)])
case .channelParticipantsContacts(let q):
return ("channelParticipantsContacts", [("q", q)])
case .channelParticipantsMentions(let flags, let q, let topMsgId):
return ("channelParticipantsMentions", [("flags", flags), ("q", q), ("topMsgId", topMsgId)])
}
}
@ -10111,6 +10122,23 @@ public extension Api {
return nil
}
}
public static func parse_channelParticipantsMentions(_ reader: BufferReader) -> ChannelParticipantsFilter? {
var _1: Int32?
_1 = reader.readInt32()
var _2: String?
if Int(_1!) & Int(1 << 0) != 0 {_2 = parseString(reader) }
var _3: Int32?
if Int(_1!) & Int(1 << 1) != 0 {_3 = reader.readInt32() }
let _c1 = _1 != nil
let _c2 = (Int(_1!) & Int(1 << 0) == 0) || _2 != nil
let _c3 = (Int(_1!) & Int(1 << 1) == 0) || _3 != nil
if _c1 && _c2 && _c3 {
return Api.ChannelParticipantsFilter.channelParticipantsMentions(flags: _1!, q: _2, topMsgId: _3)
}
else {
return nil
}
}
}
public enum WebPage: TypeConstructorDescription {

View File

@ -3737,9 +3737,26 @@ public extension Api {
})
}
public static func search(flags: Int32, peer: Api.InputPeer, q: String, fromId: Api.InputUser?, topMsgId: Int32?, filter: Api.MessagesFilter, minDate: Int32, maxDate: Int32, offsetId: Int32, addOffset: Int32, limit: Int32, maxId: Int32, minId: Int32, hash: Int32) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.messages.Messages>) {
public static func setTyping(flags: Int32, peer: Api.InputPeer, topMsgId: Int32?, action: Api.SendMessageAction) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.Bool>) {
let buffer = Buffer()
buffer.appendInt32(1310163211)
buffer.appendInt32(1486110434)
serializeInt32(flags, buffer: buffer, boxed: false)
peer.serialize(buffer, true)
if Int(flags) & Int(1 << 0) != 0 {serializeInt32(topMsgId!, buffer: buffer, boxed: false)}
action.serialize(buffer, true)
return (FunctionDescription(name: "messages.setTyping", parameters: [("flags", flags), ("peer", peer), ("topMsgId", topMsgId), ("action", action)]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.Bool? in
let reader = BufferReader(buffer)
var result: Api.Bool?
if let signature = reader.readInt32() {
result = Api.parse(reader, signature: signature) as? Api.Bool
}
return result
})
}
public static func search(flags: Int32, peer: Api.InputPeer, q: String, fromId: Api.InputPeer?, topMsgId: Int32?, filter: Api.MessagesFilter, minDate: Int32, maxDate: Int32, offsetId: Int32, addOffset: Int32, limit: Int32, maxId: Int32, minId: Int32, hash: Int32) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.messages.Messages>) {
let buffer = Buffer()
buffer.appendInt32(204812012)
serializeInt32(flags, buffer: buffer, boxed: false)
peer.serialize(buffer, true)
serializeString(q, buffer: buffer, boxed: false)
@ -3763,23 +3780,6 @@ public extension Api {
return result
})
}
public static func setTyping(flags: Int32, peer: Api.InputPeer, topMsgId: Int32?, action: Api.SendMessageAction) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.Bool>) {
let buffer = Buffer()
buffer.appendInt32(1486110434)
serializeInt32(flags, buffer: buffer, boxed: false)
peer.serialize(buffer, true)
if Int(flags) & Int(1 << 0) != 0 {serializeInt32(topMsgId!, buffer: buffer, boxed: false)}
action.serialize(buffer, true)
return (FunctionDescription(name: "messages.setTyping", parameters: [("flags", flags), ("peer", peer), ("topMsgId", topMsgId), ("action", action)]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.Bool? in
let reader = BufferReader(buffer)
var result: Api.Bool?
if let signature = reader.readInt32() {
result = Api.parse(reader, signature: signature) as? Api.Bool
}
return result
})
}
}
public struct channels {
public static func readHistory(channel: Api.InputChannel, maxId: Int32) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.Bool>) {

View File

@ -34,8 +34,7 @@ public func channelMembers(postbox: Postbox, network: Network, accountPeerId: Pe
apiFilter = .channelParticipantsSearch(q: query)
}
case let .mentions(threadId, filter):
return .single([])
/*switch filter {
switch filter {
case .all:
var flags: Int32 = 0
if threadId != nil {
@ -51,7 +50,7 @@ public func channelMembers(postbox: Postbox, network: Network, accountPeerId: Pe
flags |= 1 << 0
}
apiFilter = .channelParticipantsMentions(flags: flags, q: query.isEmpty ? nil : query, topMsgId: threadId?.id)
}*/
}
case .admins:
apiFilter = .channelParticipantsAdmins
case let .contacts(filter):

View File

@ -221,10 +221,10 @@ public func searchMessages(account: Account, location: SearchMessagesLocation, q
guard let inputPeer = apiInputPeer(peer) else {
return .single((nil, nil))
}
var fromInputPeer: Api.InputUser? = nil
var fromInputPeer: Api.InputPeer? = nil
var flags: Int32 = 0
if let from = values.from {
fromInputPeer = apiInputUser(from)
fromInputPeer = apiInputPeer(from)
if let _ = fromInputPeer {
flags |= (1 << 0)
}

View File

@ -210,7 +210,7 @@ public class BoxedMessage: NSObject {
public class Serialization: NSObject, MTSerialization {
public func currentLayer() -> UInt {
return 119
return 120
}
public func parseMessage(_ data: Data!) -> Any! {

View File

@ -189,10 +189,6 @@ final class ChatSearchInputPanelNode: ChatInputPanelNode {
canSearchMembers = false
}
}
if case .replyThread = interfaceState.chatLocation {
canSearchMembers = false
}
self.membersButton.isHidden = (!(interfaceState.search?.query.isEmpty ?? true)) || self.displayActivity || !canSearchMembers
let resultsEnabled = (resultCount ?? 0) > 0