2
0
mirror of https://github.com/telegramdesktop/tdesktop synced 2025-08-31 06:26:18 +00:00

Move some settings from global to Session.

This commit is contained in:
John Preston
2019-08-02 11:40:35 +01:00
parent 7e4c9f98a6
commit 93a52bb66e
30 changed files with 315 additions and 169 deletions

View File

@@ -708,6 +708,7 @@ void GifsReceived(const QVector<MTPDocument> &items, int32 hash) {
}
std::vector<not_null<DocumentData*>> GetListByEmoji(
not_null<Main::Session*> session,
not_null<EmojiPtr> emoji,
uint64 seed) {
const auto original = emoji->original();
@@ -717,7 +718,7 @@ std::vector<not_null<DocumentData*>> GetListByEmoji(
TimeId date = 0;
};
auto result = std::vector<StickerWithDate>();
auto &sets = Auth().data().stickerSetsRef();
auto &sets = session->data().stickerSetsRef();
auto setsToRequest = base::flat_map<uint64, uint64>();
const auto add = [&](not_null<DocumentData*> document, TimeId date) {
@@ -831,21 +832,21 @@ std::vector<not_null<DocumentData*>> GetListByEmoji(
};
addList(
Auth().data().stickerSetsOrder(),
session->data().stickerSetsOrder(),
MTPDstickerSet::Flag::f_archived);
//addList(
// Auth().data().featuredStickerSetsOrder(),
// session->data().featuredStickerSetsOrder(),
// MTPDstickerSet::Flag::f_installed_date);
if (!setsToRequest.empty()) {
for (const auto &[setId, accessHash] : setsToRequest) {
Auth().api().scheduleStickerSetRequest(setId, accessHash);
session->api().scheduleStickerSetRequest(setId, accessHash);
}
Auth().api().requestStickerSets();
session->api().requestStickerSets();
}
if (Global::SuggestStickersByEmoji()) {
const auto others = Auth().api().stickersByEmoji(original);
if (session->settings().suggestStickersByEmoji()) {
const auto others = session->api().stickersByEmoji(original);
if (!others) {
return {};
}