MCPcopy Create free account
hub / github.com/TDesktop-x64/tdesktop / UpgradeBox

Function UpgradeBox

Telegram/SourceFiles/boxes/star_gift_box.cpp:3841–4182  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3839}
3840
3841void UpgradeBox(
3842 not_null<GenericBox*> box,
3843 not_null<Window::SessionController*> controller,
3844 UpgradeArgs &&args) {
3845 struct State {
3846 base::Timer timer;
3847 std::unique_ptr<UpgradePriceValue> cost;
3848 rpl::variable<bool> upgrading = false;
3849 rpl::event_stream<std::shared_ptr<Data::GiftUpgradeResult>> upgraded;
3850 Ui::FlatLabel *pricesLink = nullptr;
3851 bool preserveDetails = false;
3852 bool sent = false;
3853 };
3854 const auto state = std::make_shared<State>();
3855
3856 box->setNoContentMargin(true);
3857 box->setWidth(st::boxWideWidth);
3858
3859 const auto show = controller->uiShow();
3860 const auto container = box->verticalLayout();
3861 const auto spinner = std::make_shared<Data::GiftUpgradeSpinner>();
3862 spinner->attributes = Data::UniqueGiftAttributes{
3863 .models = args.models,
3864 .backdrops = args.backdrops,
3865 .patterns = args.patterns,
3866 };
3867
3868 AddUpgradeGiftCover(
3869 show,
3870 container,
3871 args,
3872 spinner,
3873 state->upgraded.events());
3874 const auto contentIndex = container->count();
3875
3876 AddSkip(container, st::defaultVerticalListSkip * 2);
3877
3878 const auto features = std::vector<Ui::FeatureListEntry>{
3879 {
3880 st::menuIconUnique,
3881 tr::lng_gift_upgrade_unique_title(tr::now),
3882 (args.savedId
3883 ? tr::lng_gift_upgrade_unique_about(tr::now, tr::marked)
3884 : (args.peer->isBroadcast()
3885 ? tr::lng_gift_upgrade_unique_about_channel
3886 : tr::lng_gift_upgrade_unique_about_user)(
3887 tr::now,
3888 lt_name,
3889 tr::marked(args.peer->shortName()),
3890 tr::marked)),
3891 },
3892 {
3893 st::menuIconReplace,
3894 tr::lng_gift_upgrade_transferable_title(tr::now),
3895 (args.savedId
3896 ? tr::lng_gift_upgrade_transferable_about(
3897 tr::now,
3898 tr::marked)

Callers

nothing calls this directly

Calls 15

AddUpgradeGiftCoverFunction · 0.85
MakeFeatureListEntryFunction · 0.85
GiftUpgradeFunction · 0.85
PeerIdClass · 0.85
ShowGiftUpgradedToastFunction · 0.85
UpgradeGiftFunction · 0.85
AddChildToWidgetCenterFunction · 0.85
SetButtonTwoLabelsFunction · 0.85
AddUniqueCloseButtonFunction · 0.85

Tested by

no test coverage detected