Skip to content

Commit 5995f5d

Browse files
committed
Add td_api::settingsSectionBusiness.
1 parent b5ec650 commit 5995f5d

3 files changed

Lines changed: 30 additions & 0 deletions

File tree

td/generate/scheme/td_api.tl

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8291,6 +8291,10 @@ settingsSectionAppearance subsection:string = SettingsSection;
82918291
//@description The "Ask a question" section
82928292
settingsSectionAskQuestion = SettingsSection;
82938293

8294+
//@description The Telegram Business section @subsection Subsection of the section if any; may be one of
8295+
//-"do-not-hide-ads"
8296+
settingsSectionBusiness subsection:string = SettingsSection;
8297+
82948298
//@description The chat folder settings section @subsection Subsection of the section if any; may be one of
82958299
//-"edit", "create", "add-recommended", "show-tags", "tab-view"
82968300
settingsSectionChatFolders subsection:string = SettingsSection;

td/telegram/LinkManager.cpp

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -187,6 +187,11 @@ static const vector<string> &get_appearance_settings_subsections() {
187187
return subsections;
188188
}
189189

190+
static const vector<string> &get_business_settings_subsections() {
191+
static const vector<string> subsections{"do-not-hide-ads"};
192+
return subsections;
193+
}
194+
190195
static const vector<string> &get_data_settings_subsections() {
191196
static const vector<string> subsections{
192197
"storage", "storage/edit", "storage/auto-remove", "storage/clear-cache", "max-cache", "usage", "usage/mobile",
@@ -1021,6 +1026,12 @@ class LinkManager::InternalLinkSettings final : public InternalLink {
10211026
if (path_[0] == "auto_delete") {
10221027
return td_api::make_object<td_api::settingsSectionPrivacyAndSecurity>("auto-delete");
10231028
}
1029+
if (path_[0] == "business") {
1030+
if (td::contains(get_business_settings_subsections(), subsection)) {
1031+
return td_api::make_object<td_api::settingsSectionBusiness>(subsection);
1032+
}
1033+
return td_api::make_object<td_api::settingsSectionBusiness>();
1034+
}
10241035
if (path_[0] == "change_number") {
10251036
return td_api::make_object<td_api::settingsSectionEditProfile>("change-number");
10261037
}
@@ -3143,6 +3154,13 @@ Result<string> LinkManager::get_internal_link_impl(const td_api::InternalLinkTyp
31433154
}
31443155
return "tg://settings/themes";
31453156
}
3157+
case td_api::settingsSectionBusiness::ID: {
3158+
const auto &subsection = static_cast<const td_api::settingsSectionBusiness *>(section_ptr)->subsection_;
3159+
if (td::contains(get_business_settings_subsections(), subsection)) {
3160+
return PSTRING() << "tg://settings/business/" << subsection;
3161+
}
3162+
return "tg://settings/business";
3163+
}
31463164
case td_api::settingsSectionAskQuestion::ID:
31473165
return "tg://settings/ask-question";
31483166
case td_api::settingsSectionChatFolders::ID: {

test/link.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -187,6 +187,10 @@ static auto ask_question() {
187187
return settings(td::td_api::make_object<td::td_api::settingsSectionAskQuestion>());
188188
}
189189

190+
static auto business(td::string subsection = td::string()) {
191+
return settings(td::td_api::make_object<td::td_api::settingsSectionBusiness>(subsection));
192+
}
193+
190194
static auto chat_folder_settings(td::string subsection = td::string()) {
191195
return settings(td::td_api::make_object<td::td_api::settingsSectionChatFolders>(subsection));
192196
}
@@ -1828,6 +1832,10 @@ TEST(Link, parse_internal_link_part4) {
18281832
parse_internal_link("tg://ask-question", unknown_deep_link("tg://ask-question"));
18291833
parse_internal_link("tg://settings/ask-question", ask_question());
18301834

1835+
parse_internal_link("tg://settings/business", business());
1836+
parse_internal_link("tg://settings/business/share", business());
1837+
parse_internal_link("tg://settings/business/do-not-hide-ads", business("do-not-hide-ads"));
1838+
18311839
parse_internal_link("tg://faq", unknown_deep_link("tg://faq"));
18321840
parse_internal_link("tg://settings/faq", faq());
18331841

0 commit comments

Comments
 (0)