Rename business intro to start page.

This commit is contained in:
levlam 2024-04-08 03:29:57 +03:00
parent 4c1fa3b45d
commit 9e4cda7133
10 changed files with 38 additions and 36 deletions

View File

@ -630,17 +630,17 @@ businessGreetingMessageSettings shortcut_id:int32 recipients:businessRecipients
//@can_reply True, if the bot can send messages to the private chats; false otherwise
businessConnectedBot bot_user_id:int53 recipients:businessRecipients can_reply:Bool = BusinessConnectedBot;
//@description Describes settings for a business account intro
//@title Title text of the intro
//@message Message text of the intro
//@sticker Greeting sticker of the intro; may be null if none
businessIntro title:string message:string sticker:sticker = BusinessIntro;
//@description Describes settings for a business account start page
//@title Title text of the start page
//@message Message text of the start page
//@sticker Greeting sticker of the start page; may be null if none
businessStartPage title:string message:string sticker:sticker = BusinessStartPage;
//@description Describes settings for a business account intro to set
//@title Title text of the intro; 0-getOption("business_intro_title_length_max") characters
//@message Message text of the intro; 0-getOption("business_intro_message_length_max") characters
//@sticker Greeting sticker of the intro; pass null if none. The sticker must belong to a sticker set and must not be a custom emoji
inputBusinessIntro title:string message:string sticker:InputFile = InputBusinessIntro;
//@description Describes settings for a business account start page to set
//@title Title text of the start page; 0-getOption("business_start_page_title_length_max") characters
//@message Message text of the start page; 0-getOption("business_start_page_message_length_max") characters
//@sticker Greeting sticker of the start page; pass null if none. The sticker must belong to a sticker set and must not be a custom emoji
inputBusinessStartPage title:string message:string sticker:InputFile = InputBusinessStartPage;
//@description Describes an interval of time when the business is open
//@start_minute The first minute of the interval since start of the week; 0-7*24*60
@ -655,8 +655,8 @@ businessOpeningHours time_zone_id:string opening_hours:vector<businessOpeningHou
//@opening_hours Opening hours of the business; may be null if none. The hours are guaranteed to be valid and has already been split by week days
//@greeting_message_settings The greeting message; may be null if none or the Business account is not of the current user
//@away_message_settings The away message; may be null if none or the Business account is not of the current user
//@intro Information about intro of the business; may be null if none
businessInfo location:businessLocation opening_hours:businessOpeningHours greeting_message_settings:businessGreetingMessageSettings away_message_settings:businessAwayMessageSettings intro:businessIntro = BusinessInfo;
//@start_page Information about start page of the account; may be null if none
businessInfo location:businessLocation opening_hours:businessOpeningHours greeting_message_settings:businessGreetingMessageSettings away_message_settings:businessAwayMessageSettings start_page:businessStartPage = BusinessInfo;
//@class ChatPhotoStickerType @description Describes type of a sticker, which was used to create a chat photo
@ -5033,8 +5033,8 @@ businessFeatureAwayMessage = BusinessFeature;
//@description The ability to create links to the business account with predefined message text
businessFeatureAccountLinks = BusinessFeature;
//@description The ability to customize intro
businessFeatureIntro = BusinessFeature;
//@description The ability to customize start page
businessFeatureStartPage = BusinessFeature;
//@description The ability to connect a bot to the account
businessFeatureBots = BusinessFeature;
@ -9701,8 +9701,8 @@ setBusinessGreetingMessageSettings greeting_message_settings:businessGreetingMes
//@description Changes the business away message settings of the current user. Requires Telegram Business subscription @away_message_settings The new settings for the away message of the business; pass null to disable the away message
setBusinessAwayMessageSettings away_message_settings:businessAwayMessageSettings = Ok;
//@description Changes the business intro of the current user. Requires Telegram Business subscription @intro The new intro of the business; pass null to remove the intro
setBusinessIntro intro:inputBusinessIntro = Ok;
//@description Changes the business start page of the current user. Requires Telegram Business subscription @start_page The new start page of the business; pass null to remove custom start page
setBusinessStartPage start_page:inputBusinessStartPage = Ok;
//@description Changes the phone number of the user and sends an authentication code to the user's new phone number; for official Android and iOS applications only. On success, returns information about the sent code
//@phone_number The new phone number of the user in international format

View File

@ -17,7 +17,7 @@ td_api::object_ptr<td_api::businessInfo> BusinessInfo::get_business_info_object(
return td_api::make_object<td_api::businessInfo>(
location_.get_business_location_object(), work_hours_.get_business_opening_hours_object(),
greeting_message_.get_business_greeting_message_settings_object(td),
away_message_.get_business_away_message_settings_object(td), intro_.get_business_intro_object(td));
away_message_.get_business_away_message_settings_object(td), intro_.get_business_start_page_object(td));
}
bool BusinessInfo::is_empty_location(const DialogLocation &location) {

View File

@ -34,7 +34,7 @@ BusinessIntro::BusinessIntro(Td *td, telegram_api::object_ptr<telegram_api::busi
td->stickers_manager_->on_get_sticker_document(std::move(intro->sticker_), StickerFormat::Unknown).second;
}
BusinessIntro::BusinessIntro(Td *td, td_api::object_ptr<td_api::inputBusinessIntro> intro) {
BusinessIntro::BusinessIntro(Td *td, td_api::object_ptr<td_api::inputBusinessStartPage> intro) {
if (intro == nullptr) {
return;
}
@ -53,12 +53,12 @@ BusinessIntro::BusinessIntro(Td *td, td_api::object_ptr<td_api::inputBusinessInt
sticker_file_id_ = file_id;
}
td_api::object_ptr<td_api::businessIntro> BusinessIntro::get_business_intro_object(Td *td) const {
td_api::object_ptr<td_api::businessStartPage> BusinessIntro::get_business_start_page_object(Td *td) const {
if (is_empty()) {
return nullptr;
}
return td_api::make_object<td_api::businessIntro>(title_, description_,
td->stickers_manager_->get_sticker_object(sticker_file_id_));
return td_api::make_object<td_api::businessStartPage>(title_, description_,
td->stickers_manager_->get_sticker_object(sticker_file_id_));
}
telegram_api::object_ptr<telegram_api::inputBusinessIntro> BusinessIntro::get_input_business_intro(Td *td) const {

View File

@ -23,9 +23,9 @@ class BusinessIntro {
BusinessIntro(Td *td, telegram_api::object_ptr<telegram_api::businessIntro> intro);
BusinessIntro(Td *td, td_api::object_ptr<td_api::inputBusinessIntro> intro);
BusinessIntro(Td *td, td_api::object_ptr<td_api::inputBusinessStartPage> intro);
td_api::object_ptr<td_api::businessIntro> get_business_intro_object(Td *td) const;
td_api::object_ptr<td_api::businessStartPage> get_business_start_page_object(Td *td) const;
telegram_api::object_ptr<telegram_api::inputBusinessIntro> get_input_business_intro(Td *td) const;

View File

@ -2010,12 +2010,12 @@ void ConfigManager::process_app_config(tl_object_ptr<telegram_api::JSONValue> &c
continue;
}
if (key == "intro_title_length_limit") {
G()->set_option_integer("business_intro_title_length_max",
G()->set_option_integer("business_start_page_title_length_max",
get_json_value_int(std::move(key_value->value_), key));
continue;
}
if (key == "intro_description_length_limit") {
G()->set_option_integer("business_intro_message_length_max",
G()->set_option_integer("business_start_page_message_length_max",
get_json_value_int(std::move(key_value->value_), key));
continue;
}

View File

@ -143,14 +143,16 @@ OptionManager::OptionManager(Td *td)
set_default_integer_option("group_custom_wallpaper_level_min", is_test_dc ? 4 : 10);
set_default_integer_option("quick_reply_shortcut_count_max", is_test_dc ? 10 : 100);
set_default_integer_option("quick_reply_shortcut_message_count_max", 20);
set_default_integer_option("business_intro_title_length_max", 32);
set_default_integer_option("business_intro_message_length_max", 70);
set_default_integer_option("business_start_page_title_length_max", 32);
set_default_integer_option("business_start_page_message_length_max", 70);
if (options.isset("my_phone_number") || !options.isset("my_id")) {
update_premium_options();
}
set_option_empty("archive_and_mute_new_chats_from_unknown_users");
set_option_empty("business_intro_title_length_max");
set_option_empty("business_intro_message_length_max");
set_option_empty("channel_custom_accent_color_boost_level_min");
set_option_empty("chat_filter_count_max");
set_option_empty("chat_filter_chosen_chat_count_max");

View File

@ -138,7 +138,7 @@ static td_api::object_ptr<td_api::BusinessFeature> get_business_feature_object(S
return td_api::make_object<td_api::businessFeatureAccountLinks>();
}
if (business_feature == "business_intro") {
return td_api::make_object<td_api::businessFeatureIntro>();
return td_api::make_object<td_api::businessFeatureStartPage>();
}
if (business_feature == "business_bots") {
return td_api::make_object<td_api::businessFeatureBots>();
@ -848,7 +848,7 @@ static string get_premium_source(const td_api::BusinessFeature *feature) {
return "away_message";
case td_api::businessFeatureAccountLinks::ID:
return "business_links";
case td_api::businessFeatureIntro::ID:
case td_api::businessFeatureStartPage::ID:
return "business_intro";
case td_api::businessFeatureBots::ID:
return "business_bots";

View File

@ -7914,10 +7914,10 @@ void Td::on_request(uint64 id, td_api::setBusinessAwayMessageSettings &request)
std::move(promise));
}
void Td::on_request(uint64 id, td_api::setBusinessIntro &request) {
void Td::on_request(uint64 id, td_api::setBusinessStartPage &request) {
CHECK_IS_USER();
CREATE_OK_REQUEST_PROMISE();
business_manager_->set_business_intro(BusinessIntro(this, std::move(request.intro_)), std::move(promise));
business_manager_->set_business_intro(BusinessIntro(this, std::move(request.start_page_)), std::move(promise));
}
void Td::on_request(uint64 id, td_api::setProfilePhoto &request) {

View File

@ -1421,7 +1421,7 @@ class Td final : public Actor {
void on_request(uint64 id, td_api::setBusinessAwayMessageSettings &request);
void on_request(uint64 id, td_api::setBusinessIntro &request);
void on_request(uint64 id, td_api::setBusinessStartPage &request);
void on_request(uint64 id, td_api::setProfilePhoto &request);

View File

@ -6136,16 +6136,16 @@ class CliClient final : public Actor {
td_api::make_object<td_api::businessAwayMessageSettings>(shortcut_id, as_business_recipients(chat_ids),
std::move(schedule_object), op == "sbamso")));
}
} else if (op == "sbi") {
} else if (op == "sbsp") {
string title;
string message;
string sticker;
get_args(args, title, message, sticker);
if (title.empty()) {
send_request(td_api::make_object<td_api::setBusinessIntro>(nullptr));
send_request(td_api::make_object<td_api::setBusinessStartPage>(nullptr));
} else {
send_request(td_api::make_object<td_api::setBusinessIntro>(
td_api::make_object<td_api::inputBusinessIntro>(title, message, as_input_file(sticker))));
send_request(td_api::make_object<td_api::setBusinessStartPage>(
td_api::make_object<td_api::inputBusinessStartPage>(title, message, as_input_file(sticker))));
}
} else if (op == "gbcb") {
send_request(td_api::make_object<td_api::getBusinessConnectedBot>());