| 957 | } |
| 958 | |
| 959 | void GiftCodePendingBox( |
| 960 | not_null<Ui::GenericBox*> box, |
| 961 | not_null<Window::SessionNavigation*> controller, |
| 962 | const Api::GiftCode &data) { |
| 963 | box->setWidth(st::boxWideWidth); |
| 964 | box->setStyle(st::giveawayGiftCodeBox); |
| 965 | box->setNoContentMargin(true); |
| 966 | |
| 967 | { |
| 968 | const auto peerTo = controller->session().data().peer(data.to); |
| 969 | const auto clickContext = [=, weak = base::make_weak(controller)] { |
| 970 | if (const auto strong = weak.get()) { |
| 971 | strong->uiShow()->showBox( |
| 972 | PrepareShortInfoBox(peerTo, strong)); |
| 973 | } |
| 974 | return QVariant(); |
| 975 | }; |
| 976 | const auto &st = st::giveawayGiftCodeCover; |
| 977 | const auto resultToName = st.about.style.font->elided( |
| 978 | peerTo->shortName(), |
| 979 | st.about.minWidth / 2, |
| 980 | Qt::ElideMiddle); |
| 981 | const auto bar = box->setPinnedToTopContent( |
| 982 | object_ptr<Ui::Premium::TopBar>( |
| 983 | box, |
| 984 | st, |
| 985 | Ui::Premium::TopBarDescriptor{ |
| 986 | .clickContextOther = clickContext, |
| 987 | .title = tr::lng_gift_link_title(), |
| 988 | .about = tr::lng_gift_link_pending_about( |
| 989 | lt_user, |
| 990 | rpl::single(tr::link(resultToName)), |
| 991 | tr::rich), |
| 992 | .light = true, |
| 993 | })); |
| 994 | |
| 995 | const auto max = st::giveawayGiftCodeTopHeight; |
| 996 | bar->setMaximumHeight(max); |
| 997 | bar->setMinimumHeight(st::infoLayerTopBarHeight); |
| 998 | |
| 999 | bar->resize(bar->width(), bar->maximumHeight()); |
| 1000 | } |
| 1001 | |
| 1002 | { |
| 1003 | const auto linkLabel = box->addRow( |
| 1004 | Ui::MakeLinkLabel(box, nullptr, nullptr, nullptr, nullptr), |
| 1005 | st::giveawayGiftCodeLinkMargin); |
| 1006 | const auto spoiler = Ui::CreateChild<Ui::AbstractButton>(linkLabel); |
| 1007 | spoiler->lifetime().make_state<Ui::Animations::Basic>([=] { |
| 1008 | spoiler->update(); |
| 1009 | })->start(); |
| 1010 | linkLabel->sizeValue( |
| 1011 | ) | rpl::on_next([=](const QSize &s) { |
| 1012 | spoiler->setGeometry(Rect(s)); |
| 1013 | }, spoiler->lifetime()); |
| 1014 | const auto spoilerCached = Ui::SpoilerMessCached( |
| 1015 | Ui::DefaultTextSpoilerMask(), |
| 1016 | st::giveawayGiftCodeLink.textFg->c); |
nothing calls this directly
no test coverage detected