Treat url auth button as an url button.

This commit is contained in:
John Preston 2019-06-05 20:42:10 +03:00
parent 351ba3a912
commit b9bd937aaa
2 changed files with 11 additions and 8 deletions

View File

@ -352,8 +352,9 @@ ReplyMarkupClickHandler::ReplyMarkupClickHandler(
// Copy to clipboard support. // Copy to clipboard support.
QString ReplyMarkupClickHandler::copyToClipboardText() const { QString ReplyMarkupClickHandler::copyToClipboardText() const {
if (auto button = getButton()) { if (const auto button = getButton()) {
if (button->type == HistoryMessageMarkupButton::Type::Url) { using Type = HistoryMessageMarkupButton::Type;
if (button->type == Type::Url || button->type == Type::Auth) {
return QString::fromUtf8(button->data); return QString::fromUtf8(button->data);
} }
} }
@ -361,8 +362,9 @@ QString ReplyMarkupClickHandler::copyToClipboardText() const {
} }
QString ReplyMarkupClickHandler::copyToClipboardContextItemText() const { QString ReplyMarkupClickHandler::copyToClipboardContextItemText() const {
if (auto button = getButton()) { if (const auto button = getButton()) {
if (button->type == HistoryMessageMarkupButton::Type::Url) { using Type = HistoryMessageMarkupButton::Type;
if (button->type == Type::Url || button->type == Type::Auth) {
return lang(lng_context_copy_link); return lang(lng_context_copy_link);
} }
} }

View File

@ -88,7 +88,8 @@ void KeyboardStyle::paintButtonIcon(
using Type = HistoryMessageMarkupButton::Type; using Type = HistoryMessageMarkupButton::Type;
const auto getIcon = [](Type type) -> const style::icon* { const auto getIcon = [](Type type) -> const style::icon* {
switch (type) { switch (type) {
case Type::Url: return &st::msgBotKbUrlIcon; case Type::Url:
case Type::Auth: return &st::msgBotKbUrlIcon;
case Type::SwitchInlineSame: case Type::SwitchInlineSame:
case Type::SwitchInline: return &st::msgBotKbSwitchPmIcon; case Type::SwitchInline: return &st::msgBotKbSwitchPmIcon;
} }
@ -109,12 +110,12 @@ int KeyboardStyle::minButtonWidth(
using Type = HistoryMessageMarkupButton::Type; using Type = HistoryMessageMarkupButton::Type;
int result = 2 * buttonPadding(), iconWidth = 0; int result = 2 * buttonPadding(), iconWidth = 0;
switch (type) { 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::SwitchInlineSame:
case Type::SwitchInline: iconWidth = st::msgBotKbSwitchPmIcon.width(); break; case Type::SwitchInline: iconWidth = st::msgBotKbSwitchPmIcon.width(); break;
case Type::Callback: case Type::Callback:
case Type::Game: case Type::Game: iconWidth = st::historySendingInvertedIcon.width(); break;
case Type::Auth: iconWidth = st::historySendingInvertedIcon.width(); break;
} }
if (iconWidth > 0) { if (iconWidth > 0) {
result = std::max(result, 2 * iconWidth + 4 * int(st::msgBotKbIconPadding)); result = std::max(result, 2 * iconWidth + 4 * int(st::msgBotKbIconPadding));