mirror of
https://github.com/vale981/tdesktop
synced 2025-03-06 02:01:40 -05:00
Closed beta 1000018002: more phrases for payments.
Also replacing the Buy keyboard button with Receipt if the invoice was payed already (like in mobile apps). This required to move the inline markup apply before the media apply in message editing.
This commit is contained in:
parent
a7d0473a1a
commit
23b39923ad
10 changed files with 57 additions and 18 deletions
|
@ -1105,6 +1105,11 @@ Copyright (c) 2014-2017 John Preston, https://desktop.telegram.org
|
|||
"lng_theme_editor_export_button" = "Export theme";
|
||||
|
||||
"lng_payments_not_supported" = "Sorry, Telegram Desktop doesn't support payments yet. Please use one of our mobile apps to do this.";
|
||||
"lng_payments_receipt_label" = "Receipt";
|
||||
"lng_payments_receipt_label_test" = "Test receipt";
|
||||
"lng_payments_invoice_label" = "Invoice";
|
||||
"lng_payments_invoice_label_test" = "Test invoice";
|
||||
"lng_payments_receipt_button" = "Receipt";
|
||||
|
||||
// Not used
|
||||
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
<Identity Name="TelegramDesktop"
|
||||
ProcessorArchitecture="x64"
|
||||
Publisher="CN=Telegram Messenger LLP, O=Telegram Messenger LLP, L=London, C=GB"
|
||||
Version="1.0.18.1" />
|
||||
Version="1.0.18.2" />
|
||||
<Properties>
|
||||
<DisplayName>Telegram Desktop</DisplayName>
|
||||
<PublisherDisplayName>Telegram Messenger LLP</PublisherDisplayName>
|
||||
|
|
|
@ -34,8 +34,8 @@ IDI_ICON1 ICON "..\\art\\icon256.ico"
|
|||
//
|
||||
|
||||
VS_VERSION_INFO VERSIONINFO
|
||||
FILEVERSION 1,0,18,1
|
||||
PRODUCTVERSION 1,0,18,1
|
||||
FILEVERSION 1,0,18,2
|
||||
PRODUCTVERSION 1,0,18,2
|
||||
FILEFLAGSMASK 0x3fL
|
||||
#ifdef _DEBUG
|
||||
FILEFLAGS 0x1L
|
||||
|
@ -52,10 +52,10 @@ BEGIN
|
|||
BEGIN
|
||||
VALUE "CompanyName", "Telegram Messenger LLP"
|
||||
VALUE "FileDescription", "Telegram Desktop"
|
||||
VALUE "FileVersion", "1.0.18.1"
|
||||
VALUE "FileVersion", "1.0.18.2"
|
||||
VALUE "LegalCopyright", "Copyright (C) 2014-2017"
|
||||
VALUE "ProductName", "Telegram Desktop"
|
||||
VALUE "ProductVersion", "1.0.18.1"
|
||||
VALUE "ProductVersion", "1.0.18.2"
|
||||
END
|
||||
END
|
||||
BLOCK "VarFileInfo"
|
||||
|
|
|
@ -25,8 +25,8 @@ LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
|
|||
//
|
||||
|
||||
VS_VERSION_INFO VERSIONINFO
|
||||
FILEVERSION 1,0,18,1
|
||||
PRODUCTVERSION 1,0,18,1
|
||||
FILEVERSION 1,0,18,2
|
||||
PRODUCTVERSION 1,0,18,2
|
||||
FILEFLAGSMASK 0x3fL
|
||||
#ifdef _DEBUG
|
||||
FILEFLAGS 0x1L
|
||||
|
@ -43,10 +43,10 @@ BEGIN
|
|||
BEGIN
|
||||
VALUE "CompanyName", "Telegram Messenger LLP"
|
||||
VALUE "FileDescription", "Telegram Desktop Updater"
|
||||
VALUE "FileVersion", "1.0.18.1"
|
||||
VALUE "FileVersion", "1.0.18.2"
|
||||
VALUE "LegalCopyright", "Copyright (C) 2014-2017"
|
||||
VALUE "ProductName", "Telegram Desktop"
|
||||
VALUE "ProductVersion", "1.0.18.1"
|
||||
VALUE "ProductVersion", "1.0.18.2"
|
||||
END
|
||||
END
|
||||
BLOCK "VarFileInfo"
|
||||
|
|
|
@ -22,7 +22,7 @@ Copyright (c) 2014-2017 John Preston, https://desktop.telegram.org
|
|||
|
||||
#include "core/utils.h"
|
||||
|
||||
#define BETA_VERSION_MACRO (1000018001ULL)
|
||||
#define BETA_VERSION_MACRO (1000018002ULL)
|
||||
|
||||
constexpr int AppVersion = 1000018;
|
||||
constexpr str_const AppVersionStr = "1.0.18";
|
||||
|
|
|
@ -3482,13 +3482,24 @@ void HistoryInvoice::fillFromData(const MTPDmessageMediaInvoice &data) {
|
|||
}
|
||||
}
|
||||
|
||||
auto labelText = [&data] {
|
||||
if (data.has_receipt_msg_id()) {
|
||||
if (data.is_test()) {
|
||||
return lang(lng_payments_receipt_label_test);
|
||||
}
|
||||
return lang(lng_payments_receipt_label);
|
||||
} else if (data.is_test()) {
|
||||
return lang(lng_payments_invoice_label_test);
|
||||
}
|
||||
return lang(lng_payments_invoice_label);
|
||||
};
|
||||
auto statusText = TextWithEntities { fillAmountAndCurrency(data.vtotal_amount.v, qs(data.vcurrency)), EntitiesInText() };
|
||||
statusText.entities.push_back(EntityInText(EntityInTextBold, 0, statusText.text.size()));
|
||||
if (data.is_test()) {
|
||||
statusText.text += " TEST";
|
||||
}
|
||||
statusText.text += ' ' + labelText().toUpper();
|
||||
_status.setMarkedText(st::defaultTextStyle, statusText, itemTextOptions(_parent));
|
||||
|
||||
_receiptMsgId = data.has_receipt_msg_id() ? data.vreceipt_msg_id.v : 0;
|
||||
|
||||
// init strings
|
||||
auto description = qs(data.vdescription);
|
||||
if (!description.isEmpty()) {
|
||||
|
|
|
@ -885,6 +885,9 @@ public:
|
|||
void initDimensions() override;
|
||||
int resizeGetHeight(int width) override;
|
||||
|
||||
MsgId getReceiptMsgId() const {
|
||||
return _receiptMsgId;
|
||||
}
|
||||
QString getTitle() const {
|
||||
return _title.originalText();
|
||||
}
|
||||
|
@ -946,12 +949,14 @@ private:
|
|||
|
||||
std::unique_ptr<HistoryMedia> _attach;
|
||||
|
||||
int _titleHeight;
|
||||
int _descriptionHeight;
|
||||
int _titleHeight = 0;
|
||||
int _descriptionHeight = 0;
|
||||
Text _title;
|
||||
Text _description;
|
||||
Text _status;
|
||||
|
||||
MsgId _receiptMsgId = 0;
|
||||
|
||||
};
|
||||
|
||||
class LocationCoords;
|
||||
|
|
|
@ -568,7 +568,6 @@ bool HistoryMessage::displayEditedBadge(bool hasViaBotOrInlineMarkup) const {
|
|||
return true;
|
||||
}
|
||||
|
||||
|
||||
void HistoryMessage::createComponents(const CreateConfig &config) {
|
||||
uint64 mask = 0;
|
||||
if (config.replyTo) {
|
||||
|
@ -729,10 +728,25 @@ void HistoryMessage::initMedia(const MTPMessageMedia *media) {
|
|||
} break;
|
||||
case mtpc_messageMediaInvoice: {
|
||||
_media = std::make_unique<HistoryInvoice>(this, media->c_messageMediaInvoice());
|
||||
if (static_cast<HistoryInvoice*>(getMedia())->getReceiptMsgId()) {
|
||||
replaceBuyWithReceiptInMarkup();
|
||||
}
|
||||
} break;
|
||||
};
|
||||
}
|
||||
|
||||
void HistoryMessage::replaceBuyWithReceiptInMarkup() {
|
||||
if (auto markup = inlineReplyMarkup()) {
|
||||
for (auto &row : markup->rows) {
|
||||
for (auto &button : row) {
|
||||
if (button.type == HistoryMessageReplyMarkup::Button::Type::Buy) {
|
||||
button.text = lang(lng_payments_receipt_button);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void HistoryMessage::initMediaFromDocument(DocumentData *doc, const QString &caption) {
|
||||
if (doc->sticker()) {
|
||||
_media = std::make_unique<HistorySticker>(this, doc);
|
||||
|
@ -901,8 +915,8 @@ void HistoryMessage::applyEdition(const MTPDmessage &message) {
|
|||
textWithEntities.entities = entitiesFromMTP(message.ventities.v);
|
||||
}
|
||||
setText(textWithEntities);
|
||||
setMedia(message.has_media() ? (&message.vmedia) : nullptr);
|
||||
setReplyMarkup(message.has_reply_markup() ? (&message.vreply_markup) : nullptr);
|
||||
setMedia(message.has_media() ? (&message.vmedia) : nullptr);
|
||||
setViewsCount(message.has_views() ? message.vviews.v : -1);
|
||||
|
||||
finishEdition(keyboardTop);
|
||||
|
|
|
@ -156,6 +156,10 @@ private:
|
|||
|
||||
void setEmptyText();
|
||||
|
||||
// For an invoice button we replace the button text with a "Receipt" key.
|
||||
// It should show the receipt for the payed invoice. Still let mobile apps do that.
|
||||
void replaceBuyWithReceiptInMarkup();
|
||||
|
||||
void initDimensions() override;
|
||||
int resizeGetHeight_(int width) override;
|
||||
int performResizeGetHeight(int width);
|
||||
|
|
|
@ -3,4 +3,4 @@ AppVersionStrMajor 1.0
|
|||
AppVersionStrSmall 1.0.18
|
||||
AppVersionStr 1.0.18
|
||||
AlphaChannel 0
|
||||
BetaVersion 1000018001
|
||||
BetaVersion 1000018002
|
||||
|
|
Loading…
Add table
Reference in a new issue