Introduce td_api::gradientInfo.
GitOrigin-RevId: 436fd124ee3417851031ee32b094a93a8e550599
This commit is contained in:
parent
04eb931c72
commit
51611ae422
@ -2096,6 +2096,10 @@ deviceTokenTizenPush reg_id:string = DeviceToken;
|
||||
pushReceiverId id:int64 = PushReceiverId;
|
||||
|
||||
|
||||
//@description Describes a gradient background @top_color A top color of the background in the RGB24 format @bottom_color A bottom color of the background in the RGB24 format
|
||||
gradientInfo top_color:int32 bottom_color:int32 = GradientInfo;
|
||||
|
||||
|
||||
//@class BackgroundType @description Describes a type of a background
|
||||
|
||||
//@description A wallpaper in JPEG format
|
||||
@ -2109,11 +2113,11 @@ backgroundTypeWallpaper is_blurred:Bool is_moving:Bool = BackgroundType;
|
||||
//@intensity Intensity of the pattern when it is shown above the main background color, 0-100
|
||||
backgroundTypePattern is_moving:Bool color:int32 intensity:int32 = BackgroundType;
|
||||
|
||||
//@description A solid background @color A color of the background in RGB24 format
|
||||
//@description A solid background @color A color of the background in the RGB24 format
|
||||
backgroundTypeSolid color:int32 = BackgroundType;
|
||||
|
||||
//@description A gradient background @top_color A top color of the background in RGB24 format @bottom_color A bottom color of the background in RGB24 format
|
||||
backgroundTypeGradient top_color:int32 bottom_color:int32 = BackgroundType;
|
||||
//@description A gradient background @gradient Gradient description
|
||||
backgroundTypeGradient gradient:gradientInfo = BackgroundType;
|
||||
|
||||
|
||||
//@description Describes a chat background
|
||||
|
Binary file not shown.
@ -70,7 +70,10 @@ Result<BackgroundType> get_background_type(const td_api::BackgroundType *type) {
|
||||
}
|
||||
case td_api::backgroundTypeGradient::ID: {
|
||||
auto gradient = static_cast<const td_api::backgroundTypeGradient *>(type);
|
||||
result = BackgroundType(gradient->top_color_, gradient->bottom_color_);
|
||||
if (gradient->gradient_ == nullptr) {
|
||||
return Status::Error(400, "Gradient info must not be empty");
|
||||
}
|
||||
result = BackgroundType(gradient->gradient_->top_color_, gradient->gradient_->bottom_color_);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
@ -123,6 +126,10 @@ BackgroundType get_background_type(bool is_pattern,
|
||||
}
|
||||
}
|
||||
|
||||
td_api::object_ptr<td_api::gradientInfo> get_gradient_info_object(int32 top_color, int32 bottom_color) {
|
||||
return td_api::make_object<td_api::gradientInfo>(top_color, bottom_color);
|
||||
}
|
||||
|
||||
td_api::object_ptr<td_api::BackgroundType> get_background_type_object(const BackgroundType &type) {
|
||||
switch (type.type) {
|
||||
case BackgroundType::Type::Wallpaper:
|
||||
@ -132,7 +139,7 @@ td_api::object_ptr<td_api::BackgroundType> get_background_type_object(const Back
|
||||
case BackgroundType::Type::Solid:
|
||||
return td_api::make_object<td_api::backgroundTypeSolid>(type.color);
|
||||
case BackgroundType::Type::Gradient:
|
||||
return td_api::make_object<td_api::backgroundTypeGradient>(type.color, type.intensity);
|
||||
return td_api::make_object<td_api::backgroundTypeGradient>(get_gradient_info_object(type.color, type.intensity));
|
||||
default:
|
||||
UNREACHABLE();
|
||||
return nullptr;
|
||||
|
@ -1271,6 +1271,11 @@ class CliClient final : public Actor {
|
||||
return td_api::make_object<td_api::messageSchedulingStateSendAtDate>(send_date);
|
||||
}
|
||||
|
||||
td_api::object_ptr<td_api::backgroundTypeGradient> get_gradient_background(int32 top_color, int32 bottom_color) {
|
||||
auto gradient_info = td_api::make_object<td_api::gradientInfo>(top_color, bottom_color);
|
||||
return td_api::make_object<td_api::backgroundTypeGradient>(std::move(gradient_info));
|
||||
}
|
||||
|
||||
static td_api::object_ptr<td_api::Object> execute(td_api::object_ptr<td_api::Function> f) {
|
||||
if (GET_VERBOSITY_LEVEL() < VERBOSITY_NAME(td_requests)) {
|
||||
LOG(ERROR) << "Execute request: " << to_string(f);
|
||||
@ -2102,9 +2107,9 @@ class CliClient final : public Actor {
|
||||
send_get_background_url(td_api::make_object<td_api::backgroundTypeSolid>(-1));
|
||||
send_get_background_url(td_api::make_object<td_api::backgroundTypeSolid>(0xABCDEF));
|
||||
send_get_background_url(td_api::make_object<td_api::backgroundTypeSolid>(0x1000000));
|
||||
send_get_background_url(td_api::make_object<td_api::backgroundTypeGradient>(0xABCDEF, 0xFEDCBA));
|
||||
send_get_background_url(td_api::make_object<td_api::backgroundTypeGradient>(0, 0));
|
||||
send_get_background_url(td_api::make_object<td_api::backgroundTypeGradient>(-1, -1));
|
||||
send_get_background_url(get_gradient_background(0xABCDEF, 0xFEDCBA));
|
||||
send_get_background_url(get_gradient_background(0, 0));
|
||||
send_get_background_url(get_gradient_background(-1, -1));
|
||||
} else if (op == "sbg") {
|
||||
send_request(td_api::make_object<td_api::searchBackground>(args));
|
||||
} else if (op == "sbgd") {
|
||||
@ -2124,8 +2129,7 @@ class CliClient final : public Actor {
|
||||
string top_color;
|
||||
string bottom_color;
|
||||
std::tie(top_color, bottom_color) = split(args);
|
||||
auto background_type = td_api::make_object<td_api::backgroundTypeGradient>(to_integer<int32>(top_color),
|
||||
to_integer<int32>(bottom_color));
|
||||
auto background_type = get_gradient_background(to_integer<int32>(top_color), to_integer<int32>(bottom_color));
|
||||
send_request(td_api::make_object<td_api::setBackground>(nullptr, std::move(background_type), op == "sbggd"));
|
||||
} else if (op == "sbgwid" || op == "sbgwidd") {
|
||||
send_request(td_api::make_object<td_api::setBackground>(
|
||||
|
Loading…
Reference in New Issue
Block a user