Move get_update_suggested_actions_object to SuggestedAction.cpp.
This commit is contained in:
parent
c07a1dac22
commit
a41bca4b0e
@ -1130,12 +1130,6 @@ void ConfigManager::do_set_archive_and_mute(bool archive_and_mute) {
|
|||||||
G()->shared_config().set_option_boolean("archive_and_mute_new_chats_from_unknown_users", archive_and_mute);
|
G()->shared_config().set_option_boolean("archive_and_mute_new_chats_from_unknown_users", archive_and_mute);
|
||||||
}
|
}
|
||||||
|
|
||||||
td_api::object_ptr<td_api::updateSuggestedActions> ConfigManager::get_update_suggested_actions(
|
|
||||||
const vector<SuggestedAction> &added_actions, const vector<SuggestedAction> &removed_actions) {
|
|
||||||
return td_api::make_object<td_api::updateSuggestedActions>(transform(added_actions, get_suggested_action_object),
|
|
||||||
transform(removed_actions, get_suggested_action_object));
|
|
||||||
}
|
|
||||||
|
|
||||||
void ConfigManager::dismiss_suggested_action(SuggestedAction suggested_action, Promise<Unit> &&promise) {
|
void ConfigManager::dismiss_suggested_action(SuggestedAction suggested_action, Promise<Unit> &&promise) {
|
||||||
if (suggested_action == SuggestedAction::Empty) {
|
if (suggested_action == SuggestedAction::Empty) {
|
||||||
return promise.set_error(Status::Error(400, "Action must be non-empty"));
|
return promise.set_error(Status::Error(400, "Action must be non-empty"));
|
||||||
@ -1162,7 +1156,7 @@ void ConfigManager::dismiss_suggested_action(SuggestedAction suggested_action, P
|
|||||||
|
|
||||||
void ConfigManager::do_dismiss_suggested_action(SuggestedAction suggested_action) {
|
void ConfigManager::do_dismiss_suggested_action(SuggestedAction suggested_action) {
|
||||||
if (td::remove(suggested_actions_, suggested_action)) {
|
if (td::remove(suggested_actions_, suggested_action)) {
|
||||||
send_closure(G()->td(), &Td::send_update, get_update_suggested_actions({}, {suggested_action}));
|
send_closure(G()->td(), &Td::send_update, get_update_suggested_actions_object({}, {suggested_action}));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1809,14 +1803,14 @@ void ConfigManager::process_app_config(tl_object_ptr<telegram_api::JSONValue> &c
|
|||||||
CHECK(!added_actions.empty() || !removed_actions.empty());
|
CHECK(!added_actions.empty() || !removed_actions.empty());
|
||||||
suggested_actions_ = std::move(suggested_actions);
|
suggested_actions_ = std::move(suggested_actions);
|
||||||
send_closure(G()->td(), &Td::send_update,
|
send_closure(G()->td(), &Td::send_update,
|
||||||
get_update_suggested_actions(std::move(added_actions), std::move(removed_actions)));
|
get_update_suggested_actions_object(std::move(added_actions), std::move(removed_actions)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ConfigManager::get_current_state(vector<td_api::object_ptr<td_api::Update>> &updates) const {
|
void ConfigManager::get_current_state(vector<td_api::object_ptr<td_api::Update>> &updates) const {
|
||||||
if (!suggested_actions_.empty()) {
|
if (!suggested_actions_.empty()) {
|
||||||
updates.push_back(get_update_suggested_actions(suggested_actions_, {}));
|
updates.push_back(get_update_suggested_actions_object(suggested_actions_, {}));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -157,9 +157,6 @@ class ConfigManager : public NetQueryCallback {
|
|||||||
|
|
||||||
void do_set_archive_and_mute(bool archive_and_mute);
|
void do_set_archive_and_mute(bool archive_and_mute);
|
||||||
|
|
||||||
static td_api::object_ptr<td_api::updateSuggestedActions> get_update_suggested_actions(
|
|
||||||
const vector<SuggestedAction> &added_actions, const vector<SuggestedAction> &removed_actions);
|
|
||||||
|
|
||||||
void do_dismiss_suggested_action(SuggestedAction suggested_action);
|
void do_dismiss_suggested_action(SuggestedAction suggested_action);
|
||||||
|
|
||||||
static Timestamp load_config_expire_time();
|
static Timestamp load_config_expire_time();
|
||||||
|
@ -6,6 +6,8 @@
|
|||||||
//
|
//
|
||||||
#include "td/telegram/SuggestedAction.h"
|
#include "td/telegram/SuggestedAction.h"
|
||||||
|
|
||||||
|
#include "td/utils/algorithm.h"
|
||||||
|
|
||||||
namespace td {
|
namespace td {
|
||||||
|
|
||||||
SuggestedAction get_suggested_action(Slice action_str) {
|
SuggestedAction get_suggested_action(Slice action_str) {
|
||||||
@ -62,4 +64,10 @@ td_api::object_ptr<td_api::SuggestedAction> get_suggested_action_object(Suggeste
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
td_api::object_ptr<td_api::updateSuggestedActions> get_update_suggested_actions_object(
|
||||||
|
const vector<SuggestedAction> &added_actions, const vector<SuggestedAction> &removed_actions) {
|
||||||
|
return td_api::make_object<td_api::updateSuggestedActions>(transform(added_actions, get_suggested_action_object),
|
||||||
|
transform(removed_actions, get_suggested_action_object));
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace td
|
} // namespace td
|
||||||
|
@ -23,4 +23,7 @@ SuggestedAction get_suggested_action(const td_api::object_ptr<td_api::SuggestedA
|
|||||||
|
|
||||||
td_api::object_ptr<td_api::SuggestedAction> get_suggested_action_object(SuggestedAction action);
|
td_api::object_ptr<td_api::SuggestedAction> get_suggested_action_object(SuggestedAction action);
|
||||||
|
|
||||||
|
td_api::object_ptr<td_api::updateSuggestedActions> get_update_suggested_actions_object(
|
||||||
|
const vector<SuggestedAction> &added_actions, const vector<SuggestedAction> &removed_actions);
|
||||||
|
|
||||||
} // namespace td
|
} // namespace td
|
||||||
|
Loading…
Reference in New Issue
Block a user