diff --git a/Telegram/Resources/langs/lang.strings b/Telegram/Resources/langs/lang.strings index 32888bec3..9cd62fde0 100644 --- a/Telegram/Resources/langs/lang.strings +++ b/Telegram/Resources/langs/lang.strings @@ -4992,6 +4992,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL "lng_channel_earn_history_out" = "Withdrawal"; "lng_channel_earn_history_out_failed" = "Not Completed"; "lng_channel_earn_history_out_about_failed" = "Withdrawal failed"; +"lng_channel_earn_history_out_button" = "View in Blockchain Explorer"; "lng_channel_earn_history_return" = "Refund"; "lng_channel_earn_history_return_about" = "Refunded back"; "lng_channel_earn_history_pending" = "Pending"; diff --git a/Telegram/SourceFiles/info/channel_statistics/earn/info_earn_inner_widget.cpp b/Telegram/SourceFiles/info/channel_statistics/earn/info_earn_inner_widget.cpp index b21b13a6d..b79a6855e 100644 --- a/Telegram/SourceFiles/info/channel_statistics/earn/info_earn_inner_widget.cpp +++ b/Telegram/SourceFiles/info/channel_statistics/earn/info_earn_inner_widget.cpp @@ -9,13 +9,10 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "api/api_earn.h" #include "api/api_statistics.h" -#include "base/random.h" -#include "base/unixtime.h" #include "boxes/peers/edit_peer_color_box.h" // AddLevelBadge. #include "chat_helpers/stickers_emoji_pack.h" #include "core/ui_integration.h" // Core::MarkedTextContext. #include "data/data_channel.h" -#include "data/data_peer.h" #include "data/data_premium_limits.h" #include "data/data_session.h" #include "data/stickers/data_custom_emoji.h" @@ -24,20 +21,20 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "info/profile/info_profile_values.h" // Info::Profile::NameValue. #include "info/statistics/info_statistics_inner_widget.h" // FillLoading. #include "lang/lang_keys.h" +#include "ui/widgets/popup_menu.h" #include "main/main_app_config.h" #include "main/main_session.h" #include "statistics/chart_widget.h" +#include "ui/basic_click_handlers.h" #include "ui/boxes/boost_box.h" #include "ui/controls/userpic_button.h" #include "ui/effects/animation_value_f.h" -#include "ui/effects/fade_animation.h" #include "ui/effects/toggle_arrow.h" #include "ui/layers/generic_box.h" #include "ui/painter.h" #include "ui/rect.h" #include "ui/text/text_utilities.h" #include "ui/vertical_list.h" -#include "ui/widgets/continuous_sliders.h" #include "ui/widgets/fields/input_field.h" #include "ui/wrap/slide_wrap.h" #include "styles/style_boxes.h" @@ -105,6 +102,16 @@ constexpr auto kDot = QChar('.'); return session->appConfig().get(key, false); } +void ShowMenu(not_null box, const QString &text) { + const auto menu = Ui::CreateChild(box.get()); + menu->addAction(tr::lng_context_copy_link(tr::now), [=] { + TextUtilities::SetClipboardText(TextForMimeData::Simple(text)); + box->uiShow()->showToast(tr::lng_background_link_copied(tr::now)); + }); + menu->popup(QCursor::pos()); +} + + void AddArrow(not_null parent) { const auto arrow = Ui::CreateChild(parent.get()); arrow->paintRequest( @@ -842,6 +849,32 @@ void InnerWidget::fill() { p.drawRoundedRect(rect, radius, radius); }, peerBubble->lifetime()); } + { + const auto &st = st::premiumPreviewDoubledLimitsBox; + box->setStyle(st); + auto button = object_ptr( + container, + (!entry.successLink.isEmpty()) + ? tr::lng_channel_earn_history_out_button() + : tr::lng_box_ok(), + st::defaultActiveButton); + button->resizeToWidth(box->width() + - st.buttonPadding.left() + - st.buttonPadding.left()); + if (!entry.successLink.isEmpty()) { + button->setAcceptBoth(); + button->addClickHandler([=](Qt::MouseButton button) { + if (button == Qt::LeftButton) { + UrlClickHandler::Open(entry.successLink); + } else if (button == Qt::RightButton) { + ShowMenu(box, entry.successLink); + } + }); + } else { + button->setClickedCallback([=] { box->closeBox(); }); + } + box->addButton(std::move(button)); + } Ui::AddSkip(box->verticalLayout()); Ui::AddSkip(box->verticalLayout()); box->addButton(tr::lng_box_ok(), [=] { box->closeBox(); });