2
0
mirror of https://github.com/telegramdesktop/tdesktop synced 2025-08-31 14:38:15 +00:00

Move recent emoji and variants to common settings.

Fixes #16163, fixes #4018, partially fixes #10123.
This commit is contained in:
John Preston
2021-04-25 12:12:32 +04:00
parent 68e35b232d
commit 5bb73d8d3d
12 changed files with 276 additions and 190 deletions

View File

@@ -734,13 +734,6 @@ void Account::writeSessionSettings(Main::SessionSettings *stored) {
writeMapQueued();
}
auto recentEmojiPreloadData = cRecentEmojiPreload();
if (recentEmojiPreloadData.isEmpty()) {
recentEmojiPreloadData.reserve(GetRecentEmoji().size());
for (auto &item : GetRecentEmoji()) {
recentEmojiPreloadData.push_back(qMakePair(item.first->id(), item.second));
}
}
auto userDataInstance = stored
? stored
: _owner->getSessionSettings();
@@ -759,13 +752,6 @@ void Account::writeSessionSettings(Main::SessionSettings *stored) {
uint32 size = 24 * (sizeof(quint32) + sizeof(qint32));
size += sizeof(quint32);
size += sizeof(quint32) + sizeof(qint32);
for (auto &item : recentEmojiPreloadData) {
size += Serialize::stringSize(item.first) + sizeof(item.second);
}
size += sizeof(quint32) + sizeof(qint32) + cEmojiVariants().size() * (sizeof(uint32) + sizeof(uint64));
size += sizeof(quint32) + sizeof(qint32) + recentStickers.size() * (sizeof(uint64) + sizeof(ushort));
size += sizeof(quint32) + 3 * sizeof(qint32);
size += sizeof(quint32) + 2 * sizeof(qint32);
@@ -780,8 +766,6 @@ void Account::writeSessionSettings(Main::SessionSettings *stored) {
if (!userData.isEmpty()) {
data.stream << quint32(dbiSessionSettings) << userData;
}
data.stream << quint32(dbiRecentEmoji) << recentEmojiPreloadData;
data.stream << quint32(dbiEmojiVariants) << cEmojiVariants();
data.stream << quint32(dbiRecentStickers) << recentStickers;
FileWriteDescriptor file(_settingsKey, _basePath);