| 401 | } |
| 402 | |
| 403 | void SimpleLimitBox( |
| 404 | not_null<Ui::GenericBox*> box, |
| 405 | const style::PremiumLimits *stOverride, |
| 406 | not_null<Main::Session*> session, |
| 407 | bool premiumPossible, |
| 408 | rpl::producer<QString> title, |
| 409 | rpl::producer<TextWithEntities> text, |
| 410 | const QString &refAddition, |
| 411 | const InfographicDescriptor &descriptor, |
| 412 | bool fixed = false) { |
| 413 | const auto &st = stOverride ? *stOverride : st::defaultPremiumLimits; |
| 414 | |
| 415 | box->setWidth(st::boxWideWidth); |
| 416 | |
| 417 | const auto top = fixed |
| 418 | ? box->setPinnedToTopContent(object_ptr<Ui::VerticalLayout>(box)) |
| 419 | : box->verticalLayout(); |
| 420 | |
| 421 | Ui::AddSkip(top, st::premiumInfographicPadding.top()); |
| 422 | Ui::Premium::AddBubbleRow( |
| 423 | top, |
| 424 | st::defaultPremiumBubble, |
| 425 | BoxShowFinishes(box), |
| 426 | 0, |
| 427 | descriptor.current, |
| 428 | (descriptor.complexRatio |
| 429 | ? descriptor.premiumLimit |
| 430 | : 2 * descriptor.current), |
| 431 | ChooseBubbleType(premiumPossible), |
| 432 | descriptor.phrase, |
| 433 | descriptor.icon); |
| 434 | Ui::AddSkip(top, st::premiumLineTextSkip); |
| 435 | if (premiumPossible) { |
| 436 | Ui::Premium::AddLimitRow( |
| 437 | top, |
| 438 | st, |
| 439 | descriptor.premiumLimit, |
| 440 | descriptor.phrase, |
| 441 | 0, |
| 442 | (descriptor.complexRatio |
| 443 | ? (float64(descriptor.current) / descriptor.premiumLimit) |
| 444 | : Ui::Premium::kLimitRowRatio)); |
| 445 | Ui::AddSkip(top, st::premiumInfographicPadding.bottom()); |
| 446 | } |
| 447 | |
| 448 | box->setTitle(std::move(title)); |
| 449 | |
| 450 | auto padding = st::boxPadding; |
| 451 | padding.setTop(padding.bottom()); |
| 452 | top->add( |
| 453 | object_ptr<Ui::FlatLabel>( |
| 454 | box, |
| 455 | std::move(text), |
| 456 | st::aboutRevokePublicLabel), |
| 457 | padding); |
| 458 | |
| 459 | if (session->premium() || !premiumPossible) { |
| 460 | box->addButton(tr::lng_box_ok(), [=] { |
no test coverage detected