Add td_api::hideContactCloseBirthdays.
This commit is contained in:
parent
02d8cef6c5
commit
b3ef7d3539
@ -8431,6 +8431,9 @@ stopPoll chat_id:int53 message_id:int53 reply_markup:ReplyMarkup = Ok;
|
||||
//@description Hides a suggested action @action Suggested action to hide
|
||||
hideSuggestedAction action:SuggestedAction = Ok;
|
||||
|
||||
//@description Hides the list of contacts that have close birthdays for 24 hours
|
||||
hideContactCloseBirthdays = Ok;
|
||||
|
||||
|
||||
//@description Returns information about a business connection by its identifier; for bots only @connection_id Identifier of the business connection to return
|
||||
getBusinessConnection connection_id:string = BusinessConnection;
|
||||
|
@ -8892,6 +8892,13 @@ void Td::on_request(uint64 id, const td_api::hideSuggestedAction &request) {
|
||||
dismiss_suggested_action(SuggestedAction(request.action_), std::move(promise));
|
||||
}
|
||||
|
||||
void Td::on_request(uint64 id, const td_api::hideContactCloseBirthdays &request) {
|
||||
CHECK_IS_USER();
|
||||
CREATE_OK_REQUEST_PROMISE();
|
||||
option_manager_->set_option_boolean("dismiss_birthday_contact_today", true);
|
||||
user_manager_->hide_contact_birthdays(std::move(promise));
|
||||
}
|
||||
|
||||
void Td::on_request(uint64 id, td_api::getBusinessConnection &request) {
|
||||
CHECK_IS_BOT();
|
||||
CLEAN_INPUT_STRING(request.connection_id_);
|
||||
|
@ -1693,6 +1693,8 @@ class Td final : public Actor {
|
||||
|
||||
void on_request(uint64 id, const td_api::hideSuggestedAction &request);
|
||||
|
||||
void on_request(uint64 id, const td_api::hideContactCloseBirthdays &request);
|
||||
|
||||
void on_request(uint64 id, td_api::getBusinessConnection &request);
|
||||
|
||||
void on_request(uint64 id, const td_api::getLoginUrlInfo &request);
|
||||
|
@ -137,6 +137,32 @@ class GetContactsBirthdaysQuery final : public Td::ResultHandler {
|
||||
}
|
||||
};
|
||||
|
||||
class DismissContactBirtdaysSuggestionQuery final : public Td::ResultHandler {
|
||||
Promise<Unit> promise_;
|
||||
|
||||
public:
|
||||
explicit DismissContactBirtdaysSuggestionQuery(Promise<Unit> &&promise) : promise_(std::move(promise)) {
|
||||
}
|
||||
|
||||
void send() {
|
||||
send_query(G()->net_query_creator().create(telegram_api::help_dismissSuggestion(
|
||||
telegram_api::make_object<telegram_api::inputPeerEmpty>(), "BIRTHDAY_CONTACTS_TODAY")));
|
||||
}
|
||||
|
||||
void on_result(BufferSlice packet) final {
|
||||
auto result_ptr = fetch_result<telegram_api::help_dismissSuggestion>(packet);
|
||||
if (result_ptr.is_error()) {
|
||||
return on_error(result_ptr.move_as_error());
|
||||
}
|
||||
|
||||
promise_.set_value(Unit());
|
||||
}
|
||||
|
||||
void on_error(Status status) final {
|
||||
promise_.set_error(std::move(status));
|
||||
}
|
||||
};
|
||||
|
||||
class GetContactsStatusesQuery final : public Td::ResultHandler {
|
||||
public:
|
||||
void send() {
|
||||
@ -6546,6 +6572,10 @@ void UserManager::on_get_contact_birthdates(
|
||||
// there is no need to save them between restarts
|
||||
}
|
||||
|
||||
void UserManager::hide_contact_birthdays(Promise<Unit> &&promise) {
|
||||
td_->create_handler<DismissContactBirtdaysSuggestionQuery>(std::move(promise))->send();
|
||||
}
|
||||
|
||||
vector<UserId> UserManager::get_close_friends(Promise<Unit> &&promise) {
|
||||
if (!are_contacts_loaded_) {
|
||||
load_contacts(std::move(promise));
|
||||
|
@ -421,6 +421,8 @@ class UserManager final : public Actor {
|
||||
|
||||
void on_get_contact_birthdates(telegram_api::object_ptr<telegram_api::contacts_contactBirthdays> &&birthdays);
|
||||
|
||||
void hide_contact_birthdays(Promise<Unit> &&promise);
|
||||
|
||||
vector<UserId> get_close_friends(Promise<Unit> &&promise);
|
||||
|
||||
void set_close_friends(vector<UserId> user_ids, Promise<Unit> &&promise);
|
||||
|
@ -6650,6 +6650,8 @@ class CliClient final : public Actor {
|
||||
send_request(td_api::make_object<td_api::getStatisticalGraph>(chat_id, token, x));
|
||||
} else if (op == "hsa") {
|
||||
send_request(td_api::make_object<td_api::hideSuggestedAction>(as_suggested_action(args)));
|
||||
} else if (op == "hccb") {
|
||||
send_request(td_api::make_object<td_api::hideContactCloseBirthdays>());
|
||||
} else if (op == "glui" || op == "glu" || op == "glua") {
|
||||
ChatId chat_id;
|
||||
MessageId message_id;
|
||||
|
Loading…
Reference in New Issue
Block a user