Add td_api::updateStickerSet.

GitOrigin-RevId: 4c4299138929e45a2c5a044895f18bd49045256a
This commit is contained in:
levlam 2020-04-17 15:56:57 +03:00
parent 34eb79bbb5
commit 6225237cb9
4 changed files with 13 additions and 3 deletions

View File

@ -3010,6 +3010,9 @@ updateUnreadChatCount chat_list:ChatList total_count:int32 unread_count:int32 un
//@description An option changed its value @name The option name @value The new option value
updateOption name:string value:OptionValue = Update;
//@description A sticker set has changed @sticker_set The sticker set
updateStickerSet sticker_set:stickerSet = Update;
//@description The list of installed sticker sets was updated @is_masks True, if the list of installed mask sticker sets was updated @sticker_set_ids The new list of installed ordinary sticker sets
updateInstalledStickerSets is_masks:Bool sticker_set_ids:vector<int64> = Update;

Binary file not shown.

View File

@ -1221,6 +1221,7 @@ tl_object_ptr<td_api::stickerSet> StickersManager::get_sticker_set_object(Sticke
const StickerSet *sticker_set = get_sticker_set(sticker_set_id);
CHECK(sticker_set != nullptr);
CHECK(sticker_set->was_loaded);
sticker_set->was_update_sent = true;
std::vector<tl_object_ptr<td_api::sticker>> stickers;
std::vector<tl_object_ptr<td_api::emojis>> emojis;
@ -1268,6 +1269,7 @@ tl_object_ptr<td_api::stickerSetInfo> StickersManager::get_sticker_set_info_obje
const StickerSet *sticker_set = get_sticker_set(sticker_set_id);
CHECK(sticker_set != nullptr);
CHECK(sticker_set->is_inited);
sticker_set->was_update_sent = true;
std::vector<tl_object_ptr<td_api::sticker>> stickers;
for (auto sticker_id : sticker_set->sticker_ids) {
@ -2976,7 +2978,7 @@ string StickersManager::get_sticker_set_database_value(const StickerSet *s, bool
void StickersManager::update_sticker_set(StickerSet *sticker_set) {
CHECK(sticker_set != nullptr);
if (sticker_set->is_changed || sticker_set->need_save_to_database) {
if (G()->parameters().use_file_db) {
if (G()->parameters().use_file_db && sticker_set->need_save_to_database) {
LOG(INFO) << "Save " << sticker_set->id << " to database";
if (sticker_set->is_inited) {
G()->td_db()->get_sqlite_pmc()->set(get_sticker_set_database_key(sticker_set->id),
@ -2987,6 +2989,10 @@ void StickersManager::update_sticker_set(StickerSet *sticker_set) {
get_sticker_set_database_value(sticker_set, true), Auto());
}
}
if (sticker_set->is_changed && sticker_set->was_loaded && sticker_set->was_update_sent) {
send_closure(G()->td(), &Td::send_update,
td_api::make_object<td_api::updateStickerSet>(get_sticker_set_object(sticker_set->id)));
}
sticker_set->is_changed = false;
sticker_set->need_save_to_database = false;
if (sticker_set->is_inited) {

View File

@ -325,8 +325,9 @@ class StickersManager : public Actor {
bool is_masks = false;
bool is_viewed = true;
bool is_thumbnail_reloaded = false;
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
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;