From 0f7193172b4ee4e7deedd892e0c8b3f128896557 Mon Sep 17 00:00:00 2001 From: levlam Date: Mon, 18 Sep 2023 19:47:34 +0300 Subject: [PATCH] Add premiumLimitTypeStorySuggestedReactionAreaCount. --- td/generate/scheme/td_api.tl | 3 +++ td/telegram/ConfigManager.cpp | 4 ++++ td/telegram/ConfigManager.h | 2 +- td/telegram/OptionManager.cpp | 3 ++- td/telegram/Premium.cpp | 8 +++++++- 5 files changed, 17 insertions(+), 3 deletions(-) diff --git a/td/generate/scheme/td_api.tl b/td/generate/scheme/td_api.tl index ca8542bdf..546538ee7 100644 --- a/td/generate/scheme/td_api.tl +++ b/td/generate/scheme/td_api.tl @@ -4223,6 +4223,9 @@ premiumLimitTypeMonthlySentStoryCount = PremiumLimitType; //@description The maximum length of captions of sent stories premiumLimitTypeStoryCaptionLength = PremiumLimitType; +//@description The maximum number of suggested reaction areas on a story +premiumLimitTypeStorySuggestedReactionAreaCount = PremiumLimitType; + //@class PremiumFeature @description Describes a feature available to Premium users diff --git a/td/telegram/ConfigManager.cpp b/td/telegram/ConfigManager.cpp index 7eb3e3d40..3027f944b 100644 --- a/td/telegram/ConfigManager.cpp +++ b/td/telegram/ConfigManager.cpp @@ -2025,6 +2025,8 @@ void ConfigManager::process_app_config(tl_object_ptr &c options.get_option_integer("stories_sent_monthly_limit_premium", 3000)); options.set_option_integer("story_caption_length_max", options.get_option_integer("story_caption_length_limit_premium", 2048)); + options.set_option_integer("story_suggested_reaction_area_count_max", + options.get_option_integer("stories_suggested_reactions_limit_premium", 5)); options.set_option_integer("bio_length_max", options.get_option_integer("about_length_limit_premium", 140)); options.set_option_integer("saved_animations_limit", options.get_option_integer("saved_gifs_limit_premium", 400)); options.set_option_integer("favorite_stickers_limit", @@ -2048,6 +2050,8 @@ void ConfigManager::process_app_config(tl_object_ptr &c options.get_option_integer("stories_sent_monthly_limit_default", 30)); options.set_option_integer("story_caption_length_max", options.get_option_integer("story_caption_length_limit_default", 200)); + options.set_option_integer("story_suggested_reaction_area_count_max", + options.get_option_integer("stories_suggested_reactions_limit_default", 1)); options.set_option_integer("bio_length_max", options.get_option_integer("about_length_limit_default", 70)); options.set_option_integer("saved_animations_limit", options.get_option_integer("saved_gifs_limit_default", 200)); options.set_option_integer("favorite_stickers_limit", diff --git a/td/telegram/ConfigManager.h b/td/telegram/ConfigManager.h index c00e0ab77..4848703c8 100644 --- a/td/telegram/ConfigManager.h +++ b/td/telegram/ConfigManager.h @@ -102,7 +102,7 @@ class ConfigManager final : public NetQueryCallback { private: struct AppConfig { - static constexpr int32 CURRENT_VERSION = 13; + static constexpr int32 CURRENT_VERSION = 14; int32 version_ = 0; int32 hash_ = 0; telegram_api::object_ptr config_; diff --git a/td/telegram/OptionManager.cpp b/td/telegram/OptionManager.cpp index 970a8f40f..392940791 100644 --- a/td/telegram/OptionManager.cpp +++ b/td/telegram/OptionManager.cpp @@ -315,7 +315,8 @@ bool OptionManager::is_internal_option(Slice name) { name == "stickers_normal_by_emoji_per_premium_num" || name == "stickers_premium_by_emoji_num" || name == "stories_changelog_user_id" || name == "stories_sent_monthly_limit_default" || name == "stories_sent_monthly_limit_premium" || name == "stories_sent_weekly_limit_default" || - name == "stories_sent_weekly_limit_premium" || name == "story_caption_length_limit_default" || + name == "stories_sent_weekly_limit_premium" || name == "stories_suggested_reactions_limit_default" || + name == "stories_suggested_reactions_limit_premium" || name == "story_caption_length_limit_default" || name == "story_caption_length_limit_premium" || name == "story_expiring_limit_default" || name == "story_expiring_limit_premium"; case 'v': diff --git a/td/telegram/Premium.cpp b/td/telegram/Premium.cpp index c8e92c78f..2d5e63921 100644 --- a/td/telegram/Premium.cpp +++ b/td/telegram/Premium.cpp @@ -309,7 +309,8 @@ const vector &get_premium_limit_keys() { "story_expiring", "story_caption_length", "stories_sent_weekly", - "stories_sent_monthly"}; + "stories_sent_monthly", + "stories_suggested_reactions"}; return limit_keys; } @@ -348,6 +349,8 @@ static Slice get_limit_type_key(const td_api::PremiumLimitType *limit_type) { return Slice("stories_sent_weekly"); case td_api::premiumLimitTypeMonthlySentStoryCount::ID: return Slice("stories_sent_monthly"); + case td_api::premiumLimitTypeStorySuggestedReactionAreaCount::ID: + return Slice("stories_suggested_reactions"); default: UNREACHABLE(); return Slice(); @@ -517,6 +520,9 @@ static td_api::object_ptr get_premium_limit_object(Slice k if (key == "stories_sent_monthly") { return td_api::make_object(); } + if (key == "stories_suggested_reactions") { + return td_api::make_object(); + } UNREACHABLE(); return nullptr; }();