Bug fixes

This commit is contained in:
Ali 2020-10-08 20:20:36 +01:00
parent 8aee2109df
commit 168a07a607
8 changed files with 29 additions and 54 deletions

View File

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

View File

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

View File

@ -9991,7 +9991,6 @@ public extension Api {
case channelParticipantsSearch(q: String) case channelParticipantsSearch(q: String)
case channelParticipantsKicked(q: String) case channelParticipantsKicked(q: String)
case channelParticipantsContacts(q: String) case channelParticipantsContacts(q: String)
case channelParticipantsMentions(flags: Int32, q: String?, topMsgId: Int32?)
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) { public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
switch self { switch self {
@ -10037,14 +10036,6 @@ public extension Api {
} }
serializeString(q, buffer: buffer, boxed: false) serializeString(q, buffer: buffer, boxed: false)
break 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
} }
} }
@ -10064,8 +10055,6 @@ public extension Api {
return ("channelParticipantsKicked", [("q", q)]) return ("channelParticipantsKicked", [("q", q)])
case .channelParticipantsContacts(let q): case .channelParticipantsContacts(let q):
return ("channelParticipantsContacts", [("q", q)]) return ("channelParticipantsContacts", [("q", q)])
case .channelParticipantsMentions(let flags, let q, let topMsgId):
return ("channelParticipantsMentions", [("flags", flags), ("q", q), ("topMsgId", topMsgId)])
} }
} }
@ -10122,23 +10111,6 @@ public extension Api {
return nil 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 { public enum WebPage: TypeConstructorDescription {

View File

@ -3737,26 +3737,9 @@ public extension Api {
}) })
} }
public static func setTyping(flags: Int32, peer: Api.InputPeer, topMsgId: Int32?, action: Api.SendMessageAction) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.Bool>) { 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>) {
let buffer = Buffer() let buffer = Buffer()
buffer.appendInt32(1486110434) buffer.appendInt32(1310163211)
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) serializeInt32(flags, buffer: buffer, boxed: false)
peer.serialize(buffer, true) peer.serialize(buffer, true)
serializeString(q, buffer: buffer, boxed: false) serializeString(q, buffer: buffer, boxed: false)
@ -3780,6 +3763,23 @@ public extension Api {
return result 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 struct channels {
public static func readHistory(channel: Api.InputChannel, maxId: Int32) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.Bool>) { public static func readHistory(channel: Api.InputChannel, maxId: Int32) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.Bool>) {

View File

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

View File

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

View File

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

View File

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