From d5429e769fba1bf9e29d9bbdcf89a6afb6505e81 Mon Sep 17 00:00:00 2001 From: John Preston Date: Wed, 11 Oct 2023 14:33:59 +0400 Subject: [PATCH] Allow sharing gift code link. --- Telegram/SourceFiles/boxes/gift_premium_box.cpp | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/Telegram/SourceFiles/boxes/gift_premium_box.cpp b/Telegram/SourceFiles/boxes/gift_premium_box.cpp index 092260711..9dfbaa4f8 100644 --- a/Telegram/SourceFiles/boxes/gift_premium_box.cpp +++ b/Telegram/SourceFiles/boxes/gift_premium_box.cpp @@ -22,6 +22,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "data/data_user.h" #include "lang/lang_keys.h" #include "main/main_session.h" +#include "mainwidget.h" #include "settings/settings_premium.h" #include "ui/basic_click_handlers.h" // UrlClickHandler::Open. #include "ui/boxes/boost_box.h" // StartFireworks. @@ -36,6 +37,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "ui/widgets/gradient_round_button.h" #include "ui/wrap/padding_wrap.h" #include "ui/wrap/table_layout.h" +#include "window/window_peer_menu.h" // ShowChooseRecipientBox. #include "window/window_session_controller.h" #include "styles/style_boxes.h" #include "styles/style_layers.h" @@ -580,7 +582,14 @@ void GiftCodeBox( st::giveawayGiftCodeFooter), st::giveawayGiftCodeFooterMargin); footer->setClickHandlerFilter([=](const auto &...) { - box->uiShow()->showToast(u"Sharing..."_q); + const auto chosen = [=](not_null thread) { + const auto content = controller->content(); + return content->shareUrl( + thread, + MakeGiftCodeLink(&controller->session(), slug).link, + QString()); + }; + Window::ShowChooseRecipientBox(controller, chosen); return false; });