Support supergroup boost options.

This commit is contained in:
levlam 2024-02-09 14:03:53 +03:00
parent 665d04296b
commit 83a92d5258
3 changed files with 18 additions and 2 deletions

View File

@ -1975,7 +1975,10 @@ void ConfigManager::process_app_config(tl_object_ptr<telegram_api::JSONValue> &c
} }
if (key == "channel_bg_icon_level_min" || key == "channel_custom_wallpaper_level_min" || 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_emoji_status_level_min" || key == "channel_profile_bg_icon_level_min" ||
key == "channel_wallpaper_level_min" || key == "pm_read_date_expire_period") { key == "channel_wallpaper_level_min" || key == "pm_read_date_expire_period" ||
key == "group_transcribe_level_min" || key == "group_emoji_stickers_level_min" ||
key == "group_profile_bg_icon_level_min" || key == "group_emoji_status_level_min" ||
key == "group_wallpaper_level_min" || key == "group_custom_wallpaper_level_min") {
G()->set_option_integer(key, get_json_value_int(std::move(key_value->value_), key)); G()->set_option_integer(key, get_json_value_int(std::move(key_value->value_), key));
continue; continue;
} }

View File

@ -132,6 +132,12 @@ OptionManager::OptionManager(Td *td)
set_default_integer_option("channel_profile_bg_icon_level_min", is_test_dc ? 1 : 7); set_default_integer_option("channel_profile_bg_icon_level_min", is_test_dc ? 1 : 7);
set_default_integer_option("channel_wallpaper_level_min", is_test_dc ? 3 : 9); set_default_integer_option("channel_wallpaper_level_min", is_test_dc ? 3 : 9);
set_default_integer_option("pm_read_date_expire_period", 604800); set_default_integer_option("pm_read_date_expire_period", 604800);
set_default_integer_option("group_transcribe_level_min", is_test_dc ? 4 : 6);
set_default_integer_option("group_emoji_stickers_level_min", is_test_dc ? 1 : 4);
set_default_integer_option("group_profile_bg_icon_level_min", is_test_dc ? 1 : 5);
set_default_integer_option("group_emoji_status_level_min", is_test_dc ? 2 : 8);
set_default_integer_option("group_wallpaper_level_min", is_test_dc ? 3 : 9);
set_default_integer_option("group_custom_wallpaper_level_min", is_test_dc ? 4 : 10);
if (options.isset("my_phone_number") || !options.isset("my_id")) { if (options.isset("my_phone_number") || !options.isset("my_id")) {
update_premium_options(); update_premium_options();
@ -360,6 +366,12 @@ bool OptionManager::is_internal_option(Slice name) {
"edit_time_limit", "edit_time_limit",
"emoji_sounds", "emoji_sounds",
"fragment_prefixes", "fragment_prefixes",
"group_transcribe_level_min",
"group_emoji_stickers_level_min",
"group_profile_bg_icon_level_min",
"group_emoji_status_level_min",
"group_wallpaper_level_min",
"group_custom_wallpaper_level_min",
"hidden_members_group_size_min", "hidden_members_group_size_min",
"ignored_restriction_reasons", "ignored_restriction_reasons",
"language_pack_version", "language_pack_version",

View File

@ -458,7 +458,8 @@ void ThemeManager::tear_down() {
ThemeManager::DialogBoostAvailableCounts ThemeManager::get_dialog_boost_available_count(int32 level, ThemeManager::DialogBoostAvailableCounts ThemeManager::get_dialog_boost_available_count(int32 level,
bool for_megagroup) { bool for_megagroup) {
DialogBoostAvailableCounts result; DialogBoostAvailableCounts result;
if (level >= td_->option_manager_->get_option_integer("channel_wallpaper_level_min")) { if (level >= td_->option_manager_->get_option_integer(for_megagroup ? Slice("group_wallpaper_level_min")
: Slice("channel_wallpaper_level_min"))) {
result.chat_theme_count_ = static_cast<int32>(chat_themes_.themes.size()); result.chat_theme_count_ = static_cast<int32>(chat_themes_.themes.size());
} }
auto &min_boost_levels = auto &min_boost_levels =