From 618e7f56411b04c65e783ca10294581ad02a9933 Mon Sep 17 00:00:00 2001 From: John Preston Date: Wed, 23 Oct 2024 18:36:47 +0400 Subject: [PATCH] f Update TDLib to 1.8.18 and fix the build. --- .../SourceFiles/core/local_url_handlers.cpp | 48 ++++++++++++++++--- 1 file changed, 42 insertions(+), 6 deletions(-) diff --git a/Telegram/SourceFiles/core/local_url_handlers.cpp b/Telegram/SourceFiles/core/local_url_handlers.cpp index 589944af7d397e..25ff024ecaa023 100644 --- a/Telegram/SourceFiles/core/local_url_handlers.cpp +++ b/Telegram/SourceFiles/core/local_url_handlers.cpp @@ -1728,15 +1728,15 @@ bool HandleLocalUrl( .openWebAppUrl = openWebAppUrl, })); }); - }, [&](const TLDinternalLinkTypeSideMenuBot &data) { + }, [&](const TLDinternalLinkTypeMainWebApp &data) { if (!controller) { return false; } - // todo controller->showPeerByLink(Window::PeerByLinkInfo{ .usernameOrId = data.vbot_username().v, - .attachBotToggleCommand = data.vurl().v, - //.attachBotMenuOpen = true, + .attachBotToggleCommand = data.vstart_parameter().v, + .attachBotMainOpen = true, + .attachBotMainCompact = data.vis_compact().v, .clickFromMessageId = my.itemId, }); controller->window().activate(); @@ -2145,10 +2145,46 @@ bool HandleLocalUrl( if (!controller) { return false; } - const auto ref = data.vreferrer().v; - controller->showGiftPremiumsBox(ref.isEmpty() ? u"gift_url"_q : ref); + Ui::ChooseStarGiftRecipient(controller); controller->window().activate(); return true; + }, [&](const TLDinternalLinkTypeBuyStars &data) { + if (!controller) { + return false; + } + const auto amount = std::clamp( + data.vstar_count().v, + int64(1), + int64(1'000'000)); + const auto purpose = data.vpurpose().v; + const auto weak = base::make_weak(controller); + const auto done = [=](::Settings::SmallBalanceResult result) { + if (result == ::Settings::SmallBalanceResult::Already) { + if (const auto strong = weak.get()) { + const auto filter = [=](const auto &...) { + strong->showSettings(::Settings::CreditsId()); + return false; + }; + strong->showToast(Ui::Toast::Config{ + .text = tr::lng_credits_enough( + tr::now, + lt_link, + Ui::Text::Link( + Ui::Text::Bold( + tr::lng_credits_enough_link(tr::now))), + Ui::Text::RichLangValue), + .filter = filter, + .duration = 4 * crl::time(1000), + }); + } + } + }; + ::Settings::MaybeRequestBalanceIncrease( + controller->uiShow(), + amount, + ::Settings::SmallBalanceDeepLink{ .purpose = purpose }, + done); + return true; }); }