Load animation search options on start and remove redundant fields.

This commit is contained in:
levlam 2022-08-17 22:16:16 +03:00
parent 3fe53c7d1d
commit e897298527
3 changed files with 10 additions and 6 deletions

View File

@ -125,6 +125,8 @@ class SaveGifQuery final : public Td::ResultHandler {
};
AnimationsManager::AnimationsManager(Td *td, ActorShared<> parent) : td_(td), parent_(std::move(parent)) {
on_update_animation_search_emojis();
on_update_animation_search_provider();
on_update_saved_animations_limit();
next_saved_animations_load_time_ = Time::now();
@ -400,7 +402,7 @@ SecretInputMedia AnimationsManager::get_secret_input_media(FileId animation_file
layer};
}
void AnimationsManager::on_update_animation_search_emojis(string animation_search_emojis) {
void AnimationsManager::on_update_animation_search_emojis() {
if (G()->close_flag()) {
return;
}
@ -409,6 +411,7 @@ void AnimationsManager::on_update_animation_search_emojis(string animation_searc
return;
}
auto animation_search_emojis = G()->get_option_string("animation_search_emojis");
is_animation_search_emojis_inited_ = true;
if (animation_search_emojis_ == animation_search_emojis) {
return;
@ -418,7 +421,7 @@ void AnimationsManager::on_update_animation_search_emojis(string animation_searc
try_send_update_animation_search_parameters();
}
void AnimationsManager::on_update_animation_search_provider(string animation_search_provider) {
void AnimationsManager::on_update_animation_search_provider() {
if (G()->close_flag()) {
return;
}
@ -427,6 +430,7 @@ void AnimationsManager::on_update_animation_search_provider(string animation_sea
return;
}
string animation_search_provider = G()->get_option_string("animation_search_provider");
is_animation_search_provider_inited_ = true;
if (animation_search_provider_ == animation_search_provider) {
return;

View File

@ -61,9 +61,9 @@ class AnimationsManager final : public Actor {
void merge_animations(FileId new_id, FileId old_id);
void on_update_animation_search_emojis(string animation_search_emojis);
void on_update_animation_search_emojis();
void on_update_animation_search_provider(string animation_search_provider);
void on_update_animation_search_provider();
void on_update_saved_animations_limit();

View File

@ -195,10 +195,10 @@ void OptionManager::on_option_updated(const string &name) {
// nothing to do: animated emoji zoom is updated only at launch
}
if (name == "animation_search_emojis") {
td_->animations_manager_->on_update_animation_search_emojis(G()->get_option_string(name));
td_->animations_manager_->on_update_animation_search_emojis();
}
if (name == "animation_search_provider") {
td_->animations_manager_->on_update_animation_search_provider(G()->get_option_string(name));
td_->animations_manager_->on_update_animation_search_provider();
}
break;
case 'b':