From b9bd937aaa63e515cb13b09c4e238fb3a6ef8c8a Mon Sep 17 00:00:00 2001 From: John Preston Date: Wed, 5 Jun 2019 20:42:10 +0300 Subject: [PATCH] Treat url auth button as an url button. --- .../SourceFiles/history/history_item_components.cpp | 10 ++++++---- .../SourceFiles/history/view/history_view_message.cpp | 9 +++++---- 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/Telegram/SourceFiles/history/history_item_components.cpp b/Telegram/SourceFiles/history/history_item_components.cpp index dfcbfc6df..b95e882a4 100644 --- a/Telegram/SourceFiles/history/history_item_components.cpp +++ b/Telegram/SourceFiles/history/history_item_components.cpp @@ -352,8 +352,9 @@ ReplyMarkupClickHandler::ReplyMarkupClickHandler( // Copy to clipboard support. QString ReplyMarkupClickHandler::copyToClipboardText() const { - if (auto button = getButton()) { - if (button->type == HistoryMessageMarkupButton::Type::Url) { + if (const auto button = getButton()) { + using Type = HistoryMessageMarkupButton::Type; + if (button->type == Type::Url || button->type == Type::Auth) { return QString::fromUtf8(button->data); } } @@ -361,8 +362,9 @@ QString ReplyMarkupClickHandler::copyToClipboardText() const { } QString ReplyMarkupClickHandler::copyToClipboardContextItemText() const { - if (auto button = getButton()) { - if (button->type == HistoryMessageMarkupButton::Type::Url) { + if (const auto button = getButton()) { + using Type = HistoryMessageMarkupButton::Type; + if (button->type == Type::Url || button->type == Type::Auth) { return lang(lng_context_copy_link); } } diff --git a/Telegram/SourceFiles/history/view/history_view_message.cpp b/Telegram/SourceFiles/history/view/history_view_message.cpp index 5f62b5c5b..8ef3a2713 100644 --- a/Telegram/SourceFiles/history/view/history_view_message.cpp +++ b/Telegram/SourceFiles/history/view/history_view_message.cpp @@ -88,7 +88,8 @@ void KeyboardStyle::paintButtonIcon( using Type = HistoryMessageMarkupButton::Type; const auto getIcon = [](Type type) -> const style::icon* { switch (type) { - case Type::Url: return &st::msgBotKbUrlIcon; + case Type::Url: + case Type::Auth: return &st::msgBotKbUrlIcon; case Type::SwitchInlineSame: case Type::SwitchInline: return &st::msgBotKbSwitchPmIcon; } @@ -109,12 +110,12 @@ int KeyboardStyle::minButtonWidth( using Type = HistoryMessageMarkupButton::Type; int result = 2 * buttonPadding(), iconWidth = 0; switch (type) { - case Type::Url: iconWidth = st::msgBotKbUrlIcon.width(); break; + case Type::Url: + case Type::Auth: iconWidth = st::msgBotKbUrlIcon.width(); break; case Type::SwitchInlineSame: case Type::SwitchInline: iconWidth = st::msgBotKbSwitchPmIcon.width(); break; case Type::Callback: - case Type::Game: - case Type::Auth: iconWidth = st::historySendingInvertedIcon.width(); break; + case Type::Game: iconWidth = st::historySendingInvertedIcon.width(); break; } if (iconWidth > 0) { result = std::max(result, 2 * iconWidth + 4 * int(st::msgBotKbIconPadding));