Added initial implementation of smart stickers search.

This commit is contained in:
23rd
2025-12-24 12:48:09 +03:00
parent 5739a37c7f
commit dc4e5185ed
4 changed files with 150 additions and 36 deletions
@@ -286,7 +286,6 @@ private:
bool paused,
bool selected,
bool deleteSelected);
void paintEmptySearchResults(Painter &p);
void ensureLottiePlayer(Set &set);
void setupLottie(Set &set, int section, int index);
@@ -357,11 +356,13 @@ private:
void cancelSetsSearch();
void showSearchResults();
void searchResultsDone(const MTPmessages_FoundStickerSets &result);
void searchStickersResultsDone(const MTPmessages_FoundStickers &result);
void refreshSearchRows();
void refreshSearchRows(const std::vector<uint64> *cloudSets);
void fillFilteredStickersRow();
void fillLocalSearchRows(const QString &query);
void fillCloudSearchRows(const std::vector<uint64> &cloudSets);
void fillFoundStickersRow(const std::vector<DocumentId> &stickerIds);
void addSearchRow(not_null<Data::StickersSet*> set);
void toggleSearchLoading(bool loading);
@@ -442,11 +443,14 @@ private:
std::vector<not_null<DocumentData*>> _filteredStickers;
std::vector<EmojiPtr> _filterStickersCornerEmoji;
rpl::variable<int> _recentShownCount;
std::map<QString, std::vector<uint64>> _searchCache;
std::map<QString, std::vector<uint64>> _searchSetsCache;
std::map<QString, std::vector<DocumentId>> _searchStickersCache;
std::vector<std::pair<uint64, QStringList>> _searchIndex;
base::Timer _searchRequestTimer;
QString _searchQuery, _searchNextQuery;
mtpRequestId _searchRequestId = 0;
mtpRequestId _searchSetsRequestId = 0;
mtpRequestId _searchStickersRequestId = 0;
bool _searchLoading = false;
rpl::event_stream<FileChosen> _chosen;
rpl::event_stream<> _scrollUpdated;