Reload emoji sticker sets once.

This commit is contained in:
levlam 2022-12-21 15:18:42 +03:00
parent 6516210321
commit 0d4c918fea
3 changed files with 15 additions and 8 deletions

View File

@ -3715,6 +3715,7 @@ StickerSetId StickersManager::on_get_messages_sticker_set(StickerSetId sticker_s
s->is_loaded_ = true;
s->is_changed_ = true;
s->are_keywords_loaded_ = true;
s->is_sticker_has_text_color_loaded_ = true;
FlatHashMap<int64, FileId> document_id_to_sticker_id;
@ -5415,8 +5416,8 @@ void StickersManager::on_load_sticker_set_from_database(StickerSetId sticker_set
<< format::as_hex_dump<4>(Slice(value));
}
}
if (!sticker_set->are_keywords_loaded_ || !sticker_set->is_thumbnail_reloaded_ ||
!sticker_set->are_legacy_sticker_thumbnails_reloaded_) {
if (!sticker_set->is_sticker_has_text_color_loaded_ || !sticker_set->are_keywords_loaded_ ||
!sticker_set->is_thumbnail_reloaded_ || !sticker_set->are_legacy_sticker_thumbnails_reloaded_) {
do_reload_sticker_set(sticker_set_id, get_input_sticker_set(sticker_set), 0, Auto(),
"on_load_sticker_set_from_database 2");
}

View File

@ -448,7 +448,8 @@ class StickersManager final : public Actor {
bool is_inited_ = false; // basic information about the set
bool was_loaded_ = false;
bool is_loaded_ = false;
bool are_keywords_loaded_ = false;
bool are_keywords_loaded_ = false; // stored in telegram_api::messages_stickerSet
bool is_sticker_has_text_color_loaded_ = false; // stored in telegram_api::messages_stickerSet
StickerSetId id_;
int64 access_hash_ = 0;
@ -475,11 +476,11 @@ class StickersManager final : public Actor {
bool is_archived_ = false;
bool is_official_ = false;
bool is_viewed_ = true;
bool is_thumbnail_reloaded_ = false;
bool are_legacy_sticker_thumbnails_reloaded_ = false;
mutable bool was_update_sent_ = false; // does the sticker set is known to the client
bool is_changed_ = true; // have new changes that need to be sent to the client and database
bool need_save_to_database_ = true; // have new changes that need only to be saved to the database
bool is_thumbnail_reloaded_ = false; // stored in telegram_api::stickerSet
bool are_legacy_sticker_thumbnails_reloaded_ = false; // stored in telegram_api::stickerSet
mutable bool was_update_sent_ = false; // does the sticker set is known to the client
bool is_changed_ = true; // have new changes that need to be sent to the client and database
bool need_save_to_database_ = true; // have new changes that need only to be saved to the database
vector<uint32> load_requests_;
vector<uint32> load_without_stickers_requests_;

View File

@ -207,6 +207,7 @@ void StickersManager::store_sticker_set(const StickerSet *sticker_set, bool with
STORE_FLAG(is_emojis);
STORE_FLAG(has_thumbnail_document_id);
STORE_FLAG(sticker_set->are_keywords_loaded_);
STORE_FLAG(sticker_set->is_sticker_has_text_color_loaded_);
END_STORE_FLAGS();
store(sticker_set->id_.get(), storer);
store(sticker_set->access_hash_, storer);
@ -289,6 +290,7 @@ void StickersManager::parse_sticker_set(StickerSet *sticker_set, ParserT &parser
PARSE_FLAG(is_emojis);
PARSE_FLAG(has_thumbnail_document_id);
PARSE_FLAG(sticker_set->are_keywords_loaded_);
PARSE_FLAG(sticker_set->is_sticker_has_text_color_loaded_);
END_PARSE_FLAGS();
int64 sticker_set_id;
int64 access_hash;
@ -306,6 +308,9 @@ void StickersManager::parse_sticker_set(StickerSet *sticker_set, ParserT &parser
sticker_format = StickerFormat::Webp;
}
auto sticker_type = ::td::get_sticker_type(is_masks, is_emojis);
if (!is_emojis) {
sticker_set->is_sticker_has_text_color_loaded_ = true;
}
if (sticker_set->is_inited_) {
string title;