From ef280dae3e20448e38a506ca8ab8d666e454ad92 Mon Sep 17 00:00:00 2001 From: John Preston Date: Mon, 30 Jun 2025 16:56:42 +0400 Subject: [PATCH] Open ready-preloaded TON section. --- .../view/media/history_view_premium_gift.cpp | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/Telegram/SourceFiles/history/view/media/history_view_premium_gift.cpp b/Telegram/SourceFiles/history/view/media/history_view_premium_gift.cpp index b4ec167ae3..48b7c986a0 100644 --- a/Telegram/SourceFiles/history/view/media/history_view_premium_gift.cpp +++ b/Telegram/SourceFiles/history/view/media/history_view_premium_gift.cpp @@ -249,10 +249,23 @@ bool PremiumGift::buttonMinistars() { ClickHandlerPtr PremiumGift::createViewLink() { if (tonGift()) { + const auto lifetime = std::make_shared(); return std::make_shared([=](ClickContext context) { const auto my = context.other.value(); - if (const auto window = my.sessionWindow.get()) { - window->showSettings(Settings::CreditsId()); + const auto weak = my.sessionWindow; + if (const auto window = weak.get()) { + window->session().credits().tonLoad(); + *lifetime = window->session().credits().tonLoadedValue( + ) | rpl::filter([=] { + if (const auto window = weak.get()) { + return window->session().credits().tonLoaded(); + } + return false; + }) | rpl::take(1) | rpl::start_with_next([=] { + if (const auto window = weak.get()) { + window->showSettings(Settings::CurrencyId()); + } + }); } }); }