Support display of messageActionPaymentSentMe.

This commit is contained in:
John Preston 2024-11-21 22:09:54 +04:00
parent a5e927ea4f
commit 5309138980
2 changed files with 18 additions and 1 deletions

View file

@ -1862,6 +1862,8 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
"lng_action_payment_init_recurring_for" = "You successfully transferred {amount} to {user} for {invoice} and allowed future recurring payments";
"lng_action_payment_init_recurring" = "You successfully transferred {amount} to {user} and allowed future recurring payments";
"lng_action_payment_used_recurring" = "You were charged {amount} via recurring payment";
"lng_action_payment_bot_done" = "Bot connected to this account received {amount}";
"lng_action_payment_bot_recurring" = "Bot connected to this account received {amount} via recurring payment";
"lng_action_took_screenshot" = "{from} took a screenshot!";
"lng_action_you_took_screenshot" = "You took a screenshot!";
"lng_action_bot_allowed_from_domain" = "You allowed this bot to message you when you logged in on {domain}.";

View file

@ -4558,6 +4558,21 @@ void HistoryItem::setServiceMessageByAction(const MTPmessageAction &action) {
return preparePaymentSentText();
};
auto preparePaymentSentMe = [&](const MTPDmessageActionPaymentSentMe &data) {
auto result = PreparedServiceText();
result.text = (data.is_recurring_used()
? tr::lng_action_payment_bot_recurring
: tr::lng_action_payment_bot_done)(
tr::now,
lt_amount,
AmountAndStarCurrency(
&_history->session(),
data.vtotal_amount().v,
qs(data.vcurrency())),
Ui::Text::WithEntities);
return result;
};
auto prepareScreenshotTaken = [this](const MTPDmessageActionScreenshotTaken &) {
auto result = PreparedServiceText();
if (out()) {
@ -5361,7 +5376,7 @@ void HistoryItem::setServiceMessageByAction(const MTPmessageAction &action) {
prepareSecureValuesSent,
prepareContactSignUp,
prepareProximityReached,
PrepareErrorText<MTPDmessageActionPaymentSentMe>,
preparePaymentSentMe,
PrepareErrorText<MTPDmessageActionSecureValuesSentMe>,
prepareGroupCall,
prepareInviteToGroupCall,