diff --git a/Telegram/SourceFiles/menu/menu_sponsored.cpp b/Telegram/SourceFiles/menu/menu_sponsored.cpp index f836106d0..495da6a85 100644 --- a/Telegram/SourceFiles/menu/menu_sponsored.cpp +++ b/Telegram/SourceFiles/menu/menu_sponsored.cpp @@ -37,11 +37,13 @@ namespace { void AboutBox( not_null box, - not_null session) { + std::shared_ptr show) { constexpr auto kUrl = "https://promote.telegram.org"_cs; box->setNoContentMargin(true); + const auto session = &show->session(); + const auto content = box->verticalLayout().get(); const auto levels = Data::LevelLimits(session) .channelRestrictSponsoredLevelMin(); @@ -101,7 +103,7 @@ void AboutBox( st::channelEarnSemiboldLabel), padding); Ui::AddSkip(content, st::channelEarnHistoryThreeSkip); - content->add( + const auto label = content->add( object_ptr( content, std::move(about), @@ -121,6 +123,7 @@ void AboutBox( (g.left() - left->width()) / 2, g.top() + st::channelEarnHistoryThreeSkip); }, left->lifetime()); + return label; }; addEntry( tr::lng_sponsored_revenued_info1_title(), @@ -144,10 +147,14 @@ void AboutBox( lt_link, tr::lng_settings_privacy_premium_link( ) | rpl::map([=](QString t) { - return Ui::Text::Link(t, kUrl.utf16()); + return Ui::Text::Link(std::move(t), u"internal:"_q); }), Ui::Text::RichLangValue), - st::sponsoredAboutRemoveIcon); + st::sponsoredAboutRemoveIcon)->setClickHandlerFilter([=]( + const auto &...) { + ShowPremiumPreviewBox(show, PremiumFeature::NoAds); + return true; + }); Ui::AddSkip(content); Ui::AddSkip(content); } @@ -339,7 +346,7 @@ void ShowSponsored( st::popupMenuWithIcons); menu->addAction(tr::lng_sponsored_menu_revenued_about(tr::now), [=] { - show->show(Box(AboutBox, &item->history()->session())); + show->show(Box(AboutBox, show)); }, &st::menuIconInfo); menu->addAction(tr::lng_sponsored_menu_revenued_report(tr::now), [=] { @@ -363,7 +370,7 @@ void ShowSponsored( void ShowSponsoredAbout(std::shared_ptr show) { show->showBox(Box([=](not_null box) { - AboutBox(box, &show->session()); + AboutBox(box, show); })); }