Support custom forwarded text in url auth button.

This commit is contained in:
John Preston 2019-05-27 15:26:12 +02:00
parent db66e93258
commit 65a36e49bd
2 changed files with 10 additions and 2 deletions

View File

@ -733,9 +733,11 @@ HistoryMessageMarkupButton::HistoryMessageMarkupButton(
Type type,
const QString &text,
const QByteArray &data,
const QString &forwardText,
int32 buttonId)
: type(type)
, text(text)
, forwardText(forwardText)
, data(data)
, buttonId(buttonId) {
}
@ -806,6 +808,7 @@ void HistoryMessageReplyMarkup::createFromButtonRows(
Type::Auth,
qs(data.vtext),
qba(data.vurl),
data.has_fwd_text() ? qs(data.vfwd_text) : QString(),
data.vbutton_id.v);
}, [&](const MTPDinputKeyboardButtonUrlAuth &data) {
LOG(("API Error: inputKeyboardButtonUrlAuth received."));
@ -866,10 +869,14 @@ void HistoryMessageReplyMarkup::create(
const auto newType = (button.type != Type::SwitchInlineSame)
? button.type
: Type::SwitchInline;
const auto text = button.forwardText.isEmpty()
? button.text
: button.forwardText;
row.emplace_back(
newType,
button.text,
text,
button.data,
QString(),
button.buttonId);
}
if (!row.empty()) {

View File

@ -171,6 +171,7 @@ struct HistoryMessageMarkupButton {
Type type,
const QString &text,
const QByteArray &data = QByteArray(),
const QString &forwardText = QString(),
int32 buttonId = 0);
static HistoryMessageMarkupButton *Get(
@ -179,7 +180,7 @@ struct HistoryMessageMarkupButton {
int column);
Type type;
QString text;
QString text, forwardText;
QByteArray data;
int32 buttonId = 0;
mutable mtpRequestId requestId = 0;