Add td_api::getDefaultBackgroundCustomEmojiStickers.

This commit is contained in:
levlam 2023-10-19 15:23:04 +03:00
parent 40017310dd
commit 8a7322cef2
8 changed files with 28 additions and 5 deletions

View File

@ -8494,6 +8494,9 @@ getDefaultChatPhotoCustomEmojiStickers = Stickers;
//@description Returns default list of custom emoji stickers for placing on a profile photo //@description Returns default list of custom emoji stickers for placing on a profile photo
getDefaultProfilePhotoCustomEmojiStickers = Stickers; getDefaultProfilePhotoCustomEmojiStickers = Stickers;
//@description Returns default list of custom emoji stickers for reply background
getDefaultBackgroundCustomEmojiStickers = Stickers;
//@description Returns saved animations //@description Returns saved animations
getSavedAnimations = Animations; getSavedAnimations = Animations;

View File

@ -14,6 +14,8 @@ string get_sticker_list_type_database_key(StickerListType sticker_list_type) {
return "default_dialog_photo_custom_emoji_ids"; return "default_dialog_photo_custom_emoji_ids";
case StickerListType::UserProfilePhoto: case StickerListType::UserProfilePhoto:
return "default_profile_photo_custom_emoji_ids"; return "default_profile_photo_custom_emoji_ids";
case StickerListType::Background:
return "default_background_custom_emoji_ids";
default: default:
UNREACHABLE(); UNREACHABLE();
return string(); return string();
@ -26,6 +28,8 @@ StringBuilder &operator<<(StringBuilder &string_builder, StickerListType sticker
return string_builder << "default chat photo custom emoji identifiers"; return string_builder << "default chat photo custom emoji identifiers";
case StickerListType::UserProfilePhoto: case StickerListType::UserProfilePhoto:
return string_builder << "default user profile photo custom emoji identifiers"; return string_builder << "default user profile photo custom emoji identifiers";
case StickerListType::Background:
return string_builder << "default background custom emoji identifiers";
default: default:
UNREACHABLE(); UNREACHABLE();
return string_builder; return string_builder;

View File

@ -11,9 +11,9 @@
namespace td { namespace td {
enum class StickerListType : int32 { DialogPhoto, UserProfilePhoto }; enum class StickerListType : int32 { DialogPhoto, UserProfilePhoto, Background };
static constexpr int32 MAX_STICKER_LIST_TYPE = 2; static constexpr int32 MAX_STICKER_LIST_TYPE = 3;
string get_sticker_list_type_database_key(StickerListType sticker_list_type); string get_sticker_list_type_database_key(StickerListType sticker_list_type);

View File

@ -1454,6 +1454,9 @@ class GetDefaultDialogPhotoEmojisQuery final : public Td::ResultHandler {
case StickerListType::UserProfilePhoto: case StickerListType::UserProfilePhoto:
send_query(G()->net_query_creator().create(telegram_api::account_getDefaultProfilePhotoEmojis(hash))); send_query(G()->net_query_creator().create(telegram_api::account_getDefaultProfilePhotoEmojis(hash)));
break; break;
case StickerListType::Background:
send_query(G()->net_query_creator().create(telegram_api::account_getDefaultBackgroundEmojis(hash)));
break;
default: default:
UNREACHABLE(); UNREACHABLE();
break; break;
@ -1464,6 +1467,9 @@ class GetDefaultDialogPhotoEmojisQuery final : public Td::ResultHandler {
static_assert(std::is_same<telegram_api::account_getDefaultProfilePhotoEmojis::ReturnType, static_assert(std::is_same<telegram_api::account_getDefaultProfilePhotoEmojis::ReturnType,
telegram_api::account_getDefaultGroupPhotoEmojis::ReturnType>::value, telegram_api::account_getDefaultGroupPhotoEmojis::ReturnType>::value,
""); "");
static_assert(std::is_same<telegram_api::account_getDefaultBackgroundEmojis::ReturnType,
telegram_api::account_getDefaultGroupPhotoEmojis::ReturnType>::value,
"");
auto result_ptr = fetch_result<telegram_api::account_getDefaultGroupPhotoEmojis>(packet); auto result_ptr = fetch_result<telegram_api::account_getDefaultGroupPhotoEmojis>(packet);
if (result_ptr.is_error()) { if (result_ptr.is_error()) {
return on_error(result_ptr.move_as_error()); return on_error(result_ptr.move_as_error());

View File

@ -1123,10 +1123,10 @@ class StickersManager final : public Actor {
vector<Promise<td_api::object_ptr<td_api::emojiCategories>>> emoji_group_load_queries_[MAX_EMOJI_GROUP_TYPE]; vector<Promise<td_api::object_ptr<td_api::emojiCategories>>> emoji_group_load_queries_[MAX_EMOJI_GROUP_TYPE];
vector<CustomEmojiId> default_custom_emoji_ids_[MAX_STICKER_LIST_TYPE]; vector<CustomEmojiId> default_custom_emoji_ids_[MAX_STICKER_LIST_TYPE];
int64 default_custom_emoji_ids_hash_[MAX_STICKER_LIST_TYPE] = {0, 0}; int64 default_custom_emoji_ids_hash_[MAX_STICKER_LIST_TYPE] = {0, 0, 0};
vector<Promise<td_api::object_ptr<td_api::stickers>>> default_custom_emoji_ids_load_queries_[MAX_STICKER_LIST_TYPE]; vector<Promise<td_api::object_ptr<td_api::stickers>>> default_custom_emoji_ids_load_queries_[MAX_STICKER_LIST_TYPE];
bool are_default_custom_emoji_ids_loaded_[MAX_STICKER_LIST_TYPE] = {false, false}; bool are_default_custom_emoji_ids_loaded_[MAX_STICKER_LIST_TYPE] = {false, false, false};
bool are_default_custom_emoji_ids_being_loaded_[MAX_STICKER_LIST_TYPE] = {false, false}; bool are_default_custom_emoji_ids_being_loaded_[MAX_STICKER_LIST_TYPE] = {false, false, false};
WaitFreeHashMap<CustomEmojiId, FileId, CustomEmojiIdHash> custom_emoji_to_sticker_id_; WaitFreeHashMap<CustomEmojiId, FileId, CustomEmojiIdHash> custom_emoji_to_sticker_id_;

View File

@ -8001,6 +8001,12 @@ void Td::on_request(uint64 id, const td_api::getDefaultProfilePhotoCustomEmojiSt
stickers_manager_->get_default_custom_emoji_stickers(StickerListType::UserProfilePhoto, false, std::move(promise)); stickers_manager_->get_default_custom_emoji_stickers(StickerListType::UserProfilePhoto, false, std::move(promise));
} }
void Td::on_request(uint64 id, const td_api::getDefaultBackgroundCustomEmojiStickers &request) {
CHECK_IS_USER();
CREATE_REQUEST_PROMISE();
stickers_manager_->get_default_custom_emoji_stickers(StickerListType::Background, false, std::move(promise));
}
void Td::on_request(uint64 id, const td_api::getSavedAnimations &request) { void Td::on_request(uint64 id, const td_api::getSavedAnimations &request) {
CHECK_IS_USER(); CHECK_IS_USER();
CREATE_NO_ARGS_REQUEST(GetSavedAnimationsRequest); CREATE_NO_ARGS_REQUEST(GetSavedAnimationsRequest);

View File

@ -1401,6 +1401,8 @@ class Td final : public Actor {
void on_request(uint64 id, const td_api::getDefaultProfilePhotoCustomEmojiStickers &request); void on_request(uint64 id, const td_api::getDefaultProfilePhotoCustomEmojiStickers &request);
void on_request(uint64 id, const td_api::getDefaultBackgroundCustomEmojiStickers &request);
void on_request(uint64 id, const td_api::getFavoriteStickers &request); void on_request(uint64 id, const td_api::getFavoriteStickers &request);
void on_request(uint64 id, td_api::addFavoriteSticker &request); void on_request(uint64 id, td_api::addFavoriteSticker &request);

View File

@ -3434,6 +3434,8 @@ class CliClient final : public Actor {
send_request(td_api::make_object<td_api::getDefaultChatPhotoCustomEmojiStickers>()); send_request(td_api::make_object<td_api::getDefaultChatPhotoCustomEmojiStickers>());
} else if (op == "gdppces") { } else if (op == "gdppces") {
send_request(td_api::make_object<td_api::getDefaultProfilePhotoCustomEmojiStickers>()); send_request(td_api::make_object<td_api::getDefaultProfilePhotoCustomEmojiStickers>());
} else if (op == "gdbces") {
send_request(td_api::make_object<td_api::getDefaultBackgroundCustomEmojiStickers>());
} else if (op == "gsan") { } else if (op == "gsan") {
send_request(td_api::make_object<td_api::getSavedAnimations>()); send_request(td_api::make_object<td_api::getSavedAnimations>());
} else if (op == "asan") { } else if (op == "asan") {