Add "can_use_text_entities_in_story_caption" option.

This commit is contained in:
levlam 2023-08-09 15:27:28 +03:00
parent 6c0878e738
commit 2cb463dceb
3 changed files with 18 additions and 3 deletions

View File

@ -1907,6 +1907,11 @@ void ConfigManager::process_app_config(tl_object_ptr<telegram_api::JSONValue> &c
get_json_value_int(std::move(key_value->value_), key));
continue;
}
if (key == "stories_entities") {
G()->set_option_boolean("need_premium_for_story_caption_entities",
get_json_value_string(std::move(key_value->value_), key) == "premium");
continue;
}
new_values.push_back(std::move(key_value));
}

View File

@ -102,7 +102,7 @@ class ConfigManager final : public NetQueryCallback {
private:
struct AppConfig {
static constexpr int32 CURRENT_VERSION = 10;
static constexpr int32 CURRENT_VERSION = 11;
int32 version_ = 0;
int32 hash_ = 0;
telegram_api::object_ptr<telegram_api::JSONValue> config_;

View File

@ -295,8 +295,8 @@ bool OptionManager::is_internal_option(Slice name) {
case 'm':
return name == "my_phone_number";
case 'n':
return name == "need_synchronize_archive_all_stories" || name == "notification_cloud_delay_ms" ||
name == "notification_default_delay_ms";
return name == "need_premium_for_story_caption_entities" || name == "need_synchronize_archive_all_stories" ||
name == "notification_cloud_delay_ms" || name == "notification_default_delay_ms";
case 'o':
return name == "online_cloud_timeout_ms" || name == "online_update_period_ms" || name == "otherwise_relogin_days";
case 'p':
@ -411,6 +411,11 @@ void OptionManager::on_option_updated(Slice name) {
G()->net_query_dispatcher().update_mtproto_header();
}
}
if (name == "is_premium") {
set_option_boolean(
"can_use_text_entities_in_story_caption",
!get_option_boolean("need_premium_for_story_caption_entities") || get_option_boolean("is_premium"));
}
break;
case 'l':
if (name == "language_pack_id") {
@ -431,6 +436,11 @@ void OptionManager::on_option_updated(Slice name) {
}
break;
case 'n':
if (name == "need_premium_for_story_caption_entities") {
set_option_boolean(
"can_use_text_entities_in_story_caption",
!get_option_boolean("need_premium_for_story_caption_entities") || get_option_boolean("is_premium"));
}
if (name == "need_synchronize_archive_all_stories") {
send_closure(td_->story_manager_actor_, &StoryManager::try_synchronize_archive_all_stories);
}