Support internal min boost level options.

This commit is contained in:
levlam 2023-12-26 19:12:00 +03:00
parent cd27c67beb
commit e4038723b2
3 changed files with 33 additions and 10 deletions

View File

@ -1975,6 +1975,12 @@ 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 == "channel_bg_icon_level_min" || key == "channel_custom_wallpaper_level_min" ||
key == "channel_emoji_status_level_min" || key == "channel_profile_bg_icon_level_min" ||
key == "channel_wallpaper_level_min") {
G()->set_option_integer(key, get_json_value_int(std::move(key_value->value_), key));
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 = 27;
static constexpr int32 CURRENT_VERSION = 28;
int32 version_ = 0;
int32 hash_ = 0;
telegram_api::object_ptr<telegram_api::JSONValue> config_;

View File

@ -144,9 +144,6 @@ OptionManager::OptionManager(Td *td)
if (!have_option("giveaway_duration_max")) {
set_option_integer("giveaway_duration_max", 7 * 86400);
}
if (!have_option("channel_custom_accent_color_boost_level_min")) {
set_option_integer("channel_custom_accent_color_boost_level_min", 5);
}
if (!have_option("premium_gift_boost_count")) {
set_option_integer("premium_gift_boost_count", 3);
}
@ -156,6 +153,24 @@ OptionManager::OptionManager(Td *td)
if (!have_option("chat_available_reaction_count_max")) {
set_option_integer("chat_available_reaction_count_max", 100);
}
if (!have_option("channel_custom_accent_color_boost_level_min")) {
set_option_integer("channel_custom_accent_color_boost_level_min", G()->is_test_dc() ? 1 : 5);
}
if (!have_option("channel_bg_icon_level_min")) {
set_option_integer("channel_bg_icon_level_min", G()->is_test_dc() ? 1 : 4);
}
if (!have_option("channel_custom_wallpaper_level_min")) {
set_option_integer("channel_custom_wallpaper_level_min", G()->is_test_dc() ? 4 : 10);
}
if (!have_option("channel_emoji_status_level_min")) {
set_option_integer("channel_emoji_status_level_min", G()->is_test_dc() ? 2 : 8);
}
if (!have_option("channel_profile_bg_icon_level_min")) {
set_option_integer("channel_profile_bg_icon_level_min", G()->is_test_dc() ? 1 : 7);
}
if (!have_option("channel_wallpaper_level_min")) {
set_option_integer("channel_wallpaper_level_min", G()->is_test_dc() ? 3 : 9);
}
update_premium_options();
@ -344,12 +359,14 @@ bool OptionManager::is_internal_option(Slice name) {
case 'c':
return name == "call_receive_timeout_ms" || name == "call_ring_timeout_ms" ||
name == "caption_length_limit_default" || name == "caption_length_limit_premium" ||
name == "channels_limit_default" || name == "channels_limit_premium" ||
name == "channels_public_limit_default" || name == "channels_public_limit_premium" ||
name == "channels_read_media_period" || name == "chat_read_mark_expire_period" ||
name == "chat_read_mark_size_threshold" || name == "chatlist_invites_limit_default" ||
name == "chatlist_invites_limit_premium" || name == "chatlists_joined_limit_default" ||
name == "chatlists_joined_limit_premium";
name == "channel_bg_icon_level_min" || name == "channel_custom_wallpaper_level_min" ||
name == "channel_emoji_status_level_min" || name == "channel_profile_bg_icon_level_min" ||
name == "channel_wallpaper_level_min" || name == "channels_limit_default" ||
name == "channels_limit_premium" || name == "channels_public_limit_default" ||
name == "channels_public_limit_premium" || name == "channels_read_media_period" ||
name == "chat_read_mark_expire_period" || name == "chat_read_mark_size_threshold" ||
name == "chatlist_invites_limit_default" || name == "chatlist_invites_limit_premium" ||
name == "chatlists_joined_limit_default" || name == "chatlists_joined_limit_premium";
case 'd':
return name == "dc_txt_domain_name" || name == "default_reaction" || name == "default_reaction_needs_sync" ||
name == "dialog_filters_chats_limit_default" || name == "dialog_filters_chats_limit_premium" ||