From 86ad985ef33beb0d4894faa7080c4b364a1434da Mon Sep 17 00:00:00 2001 From: Ali <> Date: Fri, 29 Nov 2019 16:15:59 +0400 Subject: [PATCH 1/2] Add search event logging for future local search optimization --- .../Sources/ChatListSearchContainerNode.swift | 20 ++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/submodules/ChatListUI/Sources/ChatListSearchContainerNode.swift b/submodules/ChatListUI/Sources/ChatListSearchContainerNode.swift index 626a91151c..7f325e7bb6 100644 --- a/submodules/ChatListUI/Sources/ChatListSearchContainerNode.swift +++ b/submodules/ChatListUI/Sources/ChatListSearchContainerNode.swift @@ -580,11 +580,25 @@ public final class ChatListSearchContainerNode: SearchDisplayControllerContentNo private let filter: ChatListNodePeersFilter - public init(context: AccountContext, filter: ChatListNodePeersFilter, groupId: PeerGroupId, openPeer: @escaping (Peer, Bool) -> Void, openRecentPeerOptions: @escaping (Peer) -> Void, openMessage: @escaping (Peer, MessageId) -> Void, addContact: ((String) -> Void)?, peerContextAction: ((Peer, ChatListSearchContextActionSource, ASDisplayNode, ContextGesture?) -> Void)?) { + public init(context: AccountContext, filter: ChatListNodePeersFilter, groupId: PeerGroupId, openPeer originalOpenPeer: @escaping (Peer, Bool) -> Void, openRecentPeerOptions: @escaping (Peer) -> Void, openMessage originalOpenMessage: @escaping (Peer, MessageId) -> Void, addContact: ((String) -> Void)?, peerContextAction: ((Peer, ChatListSearchContextActionSource, ASDisplayNode, ContextGesture?) -> Void)?) { self.context = context self.filter = filter self.dimNode = ASDisplayNode() + let openPeer: (Peer, Bool) -> Void = { peer, value in + originalOpenPeer(peer, value) + + if peer.id.namespace != Namespaces.Peer.SecretChat { + addAppLogEvent(postbox: context.account.postbox, time: Date().timeIntervalSince1970, type: "search_global_open_peer", peerId: peer.id, data: .dictionary([:])) + } + } + + let openMessage: (Peer, MessageId) -> Void = { peer, messageId in + if peer.id.namespace != Namespaces.Peer.SecretChat { + addAppLogEvent(postbox: context.account.postbox, time: Date().timeIntervalSince1970, type: "search_global_open_message", peerId: peer.id, data: .dictionary(["msg_id": .number(Double(messageId.id))])) + } + } + self.presentationData = context.sharedContext.currentPresentationData.with { $0 } self.presentationDataPromise = Promise(ChatListPresentationData(theme: self.presentationData.theme, fontSize: self.presentationData.fontSize, strings: self.presentationData.strings, dateTimeFormat: self.presentationData.dateTimeFormat, nameSortOrder: self.presentationData.nameSortOrder, nameDisplayOrder: self.presentationData.nameDisplayOrder, disableAnimations: self.presentationData.disableAnimations)) @@ -705,6 +719,10 @@ public final class ChatListSearchContainerNode: SearchDisplayControllerContentNo if filter.contains(.doNotSearchMessages) { foundRemoteMessages = .single((([], [:], 0), false)) } else { + if !query.isEmpty { + addAppLogEvent(postbox: context.account.postbox, time: Date().timeIntervalSince1970, type: "search_global_query", peerId: nil, data: .dictionary([:])) + } + let searchSignal = searchMessages(account: context.account, location: location, query: query, state: nil, limit: 50) |> map { result, updatedState -> ChatListSearchMessagesResult in return ChatListSearchMessagesResult(query: query, messages: result.messages.sorted(by: { $0.index > $1.index }), readStates: result.readStates, hasMore: !result.completed, state: updatedState) From 7c58012d38c5cb71dfa94228367c42e7b9c7326f Mon Sep 17 00:00:00 2001 From: Ali <> Date: Fri, 29 Nov 2019 16:44:31 +0400 Subject: [PATCH 2/2] Remove legacy framework from ipadiff --- tools/ipadiff.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/tools/ipadiff.py b/tools/ipadiff.py index 532e0ea363..e64a561f50 100644 --- a/tools/ipadiff.py +++ b/tools/ipadiff.py @@ -51,8 +51,6 @@ def remove_codesign_files(files): continue if re.match('Frameworks/.*\\.framework/_CodeSignature/CodeResources', f): continue - if f == 'Frameworks/ModernProto.framework/ModernProto': - continue result.add(f) return result