Add ChatFullInfo.unique_gift_colors.

main
levlam 8 months ago
parent 448ce43809
commit add87b0276

@ -981,6 +981,26 @@ class Client::JsonUserRating final : public td::Jsonable {
const td_api::userRating *user_rating_; const td_api::userRating *user_rating_;
}; };
class Client::JsonUniqueGiftColors final : public td::Jsonable {
public:
explicit JsonUniqueGiftColors(const td_api::upgradedGiftColors *gift_colors) : gift_colors_(gift_colors) {
}
void store(td::JsonValueScope *scope) const {
auto object = scope->enter_object();
object("model_custom_emoji_id", td::to_string(gift_colors_->model_custom_emoji_id_));
object("symbol_custom_emoji_id", td::to_string(gift_colors_->symbol_custom_emoji_id_));
object("light_theme_main_color", gift_colors_->light_theme_accent_color_);
object("light_theme_other_colors",
td::json_array(gift_colors_->light_theme_colors_, [](int32 color) { return color; }));
object("dark_theme_main_color", gift_colors_->dark_theme_accent_color_);
object("dark_theme_other_colors",
td::json_array(gift_colors_->dark_theme_colors_, [](int32 color) { return color; }));
}
private:
const td_api::upgradedGiftColors *gift_colors_;
};
class Client::JsonMessage final : public td::Jsonable { class Client::JsonMessage final : public td::Jsonable {
public: public:
JsonMessage(const MessageInfo *message, bool need_reply, const td::string &source, const Client *client) JsonMessage(const MessageInfo *message, bool need_reply, const td::string &source, const Client *client)
@ -1276,6 +1296,9 @@ class Client::JsonChat final : public td::Jsonable {
if (chat_info->background_custom_emoji_id != 0) { if (chat_info->background_custom_emoji_id != 0) {
object("background_custom_emoji_id", td::to_string(chat_info->background_custom_emoji_id)); object("background_custom_emoji_id", td::to_string(chat_info->background_custom_emoji_id));
} }
if (chat_info->upgraded_gift_colors != nullptr) {
object("unique_gift_colors", JsonUniqueGiftColors(chat_info->upgraded_gift_colors.get()));
}
if (chat_info->profile_accent_color_id != -1) { if (chat_info->profile_accent_color_id != -1) {
object("profile_accent_color_id", chat_info->profile_accent_color_id); object("profile_accent_color_id", chat_info->profile_accent_color_id);
} }
@ -8371,6 +8394,7 @@ void Client::on_update(object_ptr<td_api::Object> result) {
set_chat_available_reactions(chat_info, std::move(chat->available_reactions_)); set_chat_available_reactions(chat_info, std::move(chat->available_reactions_));
chat_info->accent_color_id = chat->accent_color_id_; chat_info->accent_color_id = chat->accent_color_id_;
chat_info->background_custom_emoji_id = chat->background_custom_emoji_id_; chat_info->background_custom_emoji_id = chat->background_custom_emoji_id_;
chat_info->upgraded_gift_colors = std::move(chat->upgraded_gift_colors_);
chat_info->profile_accent_color_id = chat->profile_accent_color_id_; chat_info->profile_accent_color_id = chat->profile_accent_color_id_;
chat_info->profile_background_custom_emoji_id = chat->profile_background_custom_emoji_id_; chat_info->profile_background_custom_emoji_id = chat->profile_background_custom_emoji_id_;
chat_info->has_protected_content = chat->has_protected_content_; chat_info->has_protected_content = chat->has_protected_content_;
@ -8426,6 +8450,7 @@ void Client::on_update(object_ptr<td_api::Object> result) {
CHECK(chat_info->type != ChatInfo::Type::Unknown); CHECK(chat_info->type != ChatInfo::Type::Unknown);
chat_info->accent_color_id = update->accent_color_id_; chat_info->accent_color_id = update->accent_color_id_;
chat_info->background_custom_emoji_id = update->background_custom_emoji_id_; chat_info->background_custom_emoji_id = update->background_custom_emoji_id_;
chat_info->upgraded_gift_colors = std::move(update->upgraded_gift_colors_);
chat_info->profile_accent_color_id = update->profile_accent_color_id_; chat_info->profile_accent_color_id = update->profile_accent_color_id_;
chat_info->profile_background_custom_emoji_id = update->profile_background_custom_emoji_id_; chat_info->profile_background_custom_emoji_id = update->profile_background_custom_emoji_id_;
break; break;

@ -191,6 +191,7 @@ class Client final : public WebhookActor::Callback {
class JsonUniqueGiftBackdropColors; class JsonUniqueGiftBackdropColors;
class JsonUniqueGiftBackdrop; class JsonUniqueGiftBackdrop;
class JsonUniqueGift; class JsonUniqueGift;
class JsonUniqueGiftColors;
class JsonMessageReactionUpdated; class JsonMessageReactionUpdated;
class JsonMessageReactionCountUpdated; class JsonMessageReactionCountUpdated;
class JsonBusinessBotRights; class JsonBusinessBotRights;
@ -1039,6 +1040,7 @@ class Client final : public WebhookActor::Callback {
int32 profile_accent_color_id = -1; int32 profile_accent_color_id = -1;
int64 background_custom_emoji_id = 0; int64 background_custom_emoji_id = 0;
int64 profile_background_custom_emoji_id = 0; int64 profile_background_custom_emoji_id = 0;
object_ptr<td_api::upgradedGiftColors> upgraded_gift_colors;
bool has_protected_content = false; bool has_protected_content = false;
int32 max_reaction_count = 0; int32 max_reaction_count = 0;
object_ptr<td_api::chatAvailableReactionsSome> available_reactions; object_ptr<td_api::chatAvailableReactionsSome> available_reactions;

Loading…
Cancel
Save