Replace getQuickReplyShortcuts with loadQuickReplyShortcuts.
This commit is contained in:
parent
99f1369e8c
commit
1d76beadeb
@ -3738,9 +3738,6 @@ quickReplyMessage id:int53 sending_state:MessageSendingState forward_info:messag
|
||||
//@message_count The total number of messages in the shortcut
|
||||
quickReplyShortcut name:string first_message:quickReplyMessage message_count:int32 = QuickReplyShortcut;
|
||||
|
||||
//@description Represents a list of quick reply shortcuts created by the current user @shortcuts A list of shortcuts
|
||||
quickReplyShortcuts shortcuts:vector<quickReplyShortcut> = QuickReplyShortcuts;
|
||||
|
||||
|
||||
//@class PublicForward @description Describes a public forward or repost of a story
|
||||
|
||||
@ -6583,7 +6580,7 @@ updateSavedMessagesTopic topic:savedMessagesTopic = Update;
|
||||
//@description Number of Saved Messages topics has changed @topic_count Approximate total number of Saved Messages topics
|
||||
updateSavedMessagesTopicCount topic_count:int32 = Update;
|
||||
|
||||
//@description Basic information about a quick reply shortcut has changed. This update is guaranteed to come before the quick shortcut identifier is returned to the application
|
||||
//@description Basic information about a quick reply shortcut has changed. This update is guaranteed to come before the quick shortcut name is returned to the application
|
||||
//@shortcut New data about the shortcut
|
||||
updateQuickReplyShortcut shortcut:quickReplyShortcut = Update;
|
||||
|
||||
@ -7720,8 +7717,8 @@ editInlineMessageReplyMarkup inline_message_id:string reply_markup:ReplyMarkup =
|
||||
editMessageSchedulingState chat_id:int53 message_id:int53 scheduling_state:MessageSchedulingState = Ok;
|
||||
|
||||
|
||||
//@description Returns shortcuts created by the current user
|
||||
getQuickReplyShortcuts = QuickReplyShortcuts;
|
||||
//@description Loads quick reply shortcuts created by the current user. The loaded topics will be sent through updateQuickReplyShortcuts
|
||||
loadQuickReplyShortcuts = Ok;
|
||||
|
||||
|
||||
//@description Returns list of custom emojis, which can be used as forum topic icon by all users
|
||||
|
@ -249,24 +249,15 @@ td_api::object_ptr<td_api::quickReplyShortcut> QuickReplyManager::get_quick_repl
|
||||
s->name_, get_quick_reply_message_object(s->messages_[0].get(), source), get_shortcut_message_count(s));
|
||||
}
|
||||
|
||||
td_api::object_ptr<td_api::quickReplyShortcuts> QuickReplyManager::get_quick_reply_shortcuts_object(
|
||||
const char *source) const {
|
||||
CHECK(shortcuts_.are_inited_);
|
||||
return td_api::make_object<td_api::quickReplyShortcuts>(
|
||||
transform(shortcuts_.shortcuts_, [this, source](const unique_ptr<Shortcut> &shortcut) {
|
||||
return get_quick_reply_shortcut_object(shortcut.get(), source);
|
||||
}));
|
||||
}
|
||||
|
||||
void QuickReplyManager::get_quick_reply_shortcuts(Promise<td_api::object_ptr<td_api::quickReplyShortcuts>> &&promise) {
|
||||
void QuickReplyManager::get_quick_reply_shortcuts(Promise<Unit> &&promise) {
|
||||
if (shortcuts_.are_inited_) {
|
||||
return promise.set_value(get_quick_reply_shortcuts_object("get_quick_reply_shortcuts"));
|
||||
return promise.set_value(Unit());
|
||||
}
|
||||
|
||||
load_quick_reply_shortcuts(std::move(promise));
|
||||
}
|
||||
|
||||
void QuickReplyManager::load_quick_reply_shortcuts(Promise<td_api::object_ptr<td_api::quickReplyShortcuts>> &&promise) {
|
||||
void QuickReplyManager::load_quick_reply_shortcuts(Promise<Unit> &&promise) {
|
||||
shortcuts_.load_queries_.push_back(std::move(promise));
|
||||
if (shortcuts_.load_queries_.size() != 1) {
|
||||
return;
|
||||
@ -412,13 +403,7 @@ void QuickReplyManager::on_reload_quick_reply_shortcuts(
|
||||
}
|
||||
|
||||
void QuickReplyManager::on_load_quick_reply_success() {
|
||||
auto promises = std::move(shortcuts_.load_queries_);
|
||||
reset_to_empty(shortcuts_.load_queries_);
|
||||
for (auto &promise : promises) {
|
||||
if (promise) {
|
||||
promise.set_value(get_quick_reply_shortcuts_object("on_load_quick_reply_success"));
|
||||
}
|
||||
}
|
||||
set_promises(shortcuts_.load_queries_);
|
||||
}
|
||||
|
||||
void QuickReplyManager::on_load_quick_reply_fail(Status error) {
|
||||
|
@ -28,7 +28,7 @@ class QuickReplyManager final : public Actor {
|
||||
public:
|
||||
QuickReplyManager(Td *td, ActorShared<> parent);
|
||||
|
||||
void get_quick_reply_shortcuts(Promise<td_api::object_ptr<td_api::quickReplyShortcuts>> &&promise);
|
||||
void get_quick_reply_shortcuts(Promise<Unit> &&promise);
|
||||
|
||||
void reload_quick_reply_shortcuts();
|
||||
|
||||
@ -103,7 +103,7 @@ class QuickReplyManager final : public Actor {
|
||||
vector<unique_ptr<Shortcut>> shortcuts_;
|
||||
bool are_inited_ = false;
|
||||
|
||||
vector<Promise<td_api::object_ptr<td_api::quickReplyShortcuts>>> load_queries_;
|
||||
vector<Promise<Unit>> load_queries_;
|
||||
};
|
||||
|
||||
void tear_down() final;
|
||||
@ -126,11 +126,9 @@ class QuickReplyManager final : public Actor {
|
||||
td_api::object_ptr<td_api::quickReplyShortcut> get_quick_reply_shortcut_object(const Shortcut *s,
|
||||
const char *source) const;
|
||||
|
||||
td_api::object_ptr<td_api::quickReplyShortcuts> get_quick_reply_shortcuts_object(const char *source) const;
|
||||
|
||||
static int32 get_shortcut_message_count(const Shortcut *s);
|
||||
|
||||
void load_quick_reply_shortcuts(Promise<td_api::object_ptr<td_api::quickReplyShortcuts>> &&promise);
|
||||
void load_quick_reply_shortcuts(Promise<Unit> &&promise);
|
||||
|
||||
void on_reload_quick_reply_shortcuts(
|
||||
Result<telegram_api::object_ptr<telegram_api::messages_QuickReplies>> r_shortcuts);
|
||||
|
@ -5759,9 +5759,9 @@ void Td::on_request(uint64 id, td_api::editMessageSchedulingState &request) {
|
||||
std::move(request.scheduling_state_), std::move(promise));
|
||||
}
|
||||
|
||||
void Td::on_request(uint64 id, const td_api::getQuickReplyShortcuts &request) {
|
||||
void Td::on_request(uint64 id, const td_api::loadQuickReplyShortcuts &request) {
|
||||
CHECK_IS_USER();
|
||||
CREATE_REQUEST_PROMISE();
|
||||
CREATE_OK_REQUEST_PROMISE();
|
||||
quick_reply_manager_->get_quick_reply_shortcuts(std::move(promise));
|
||||
}
|
||||
|
||||
|
@ -864,7 +864,7 @@ class Td final : public Actor {
|
||||
|
||||
void on_request(uint64 id, td_api::editMessageSchedulingState &request);
|
||||
|
||||
void on_request(uint64 id, const td_api::getQuickReplyShortcuts &request);
|
||||
void on_request(uint64 id, const td_api::loadQuickReplyShortcuts &request);
|
||||
|
||||
void on_request(uint64 id, const td_api::getStory &request);
|
||||
|
||||
|
@ -4825,8 +4825,8 @@ class CliClient final : public Actor {
|
||||
get_args(args, chat_id, message_id, date);
|
||||
send_request(td_api::make_object<td_api::editMessageSchedulingState>(chat_id, message_id,
|
||||
as_message_scheduling_state(date)));
|
||||
} else if (op == "gqrs") {
|
||||
send_request(td_api::make_object<td_api::getQuickReplyShortcuts>());
|
||||
} else if (op == "lqrs") {
|
||||
send_request(td_api::make_object<td_api::loadQuickReplyShortcuts>());
|
||||
} else if (op == "gftdi") {
|
||||
send_request(td_api::make_object<td_api::getForumTopicDefaultIcons>());
|
||||
} else if (op == "cft") {
|
||||
|
Loading…
Reference in New Issue
Block a user