From 53091389808b9b2b17c8583f97399d866359af8b Mon Sep 17 00:00:00 2001 From: John Preston Date: Thu, 21 Nov 2024 22:09:54 +0400 Subject: [PATCH] Support display of messageActionPaymentSentMe. --- Telegram/Resources/langs/lang.strings | 2 ++ Telegram/SourceFiles/history/history_item.cpp | 17 ++++++++++++++++- 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/Telegram/Resources/langs/lang.strings b/Telegram/Resources/langs/lang.strings index b29aa7693..43fa84602 100644 --- a/Telegram/Resources/langs/lang.strings +++ b/Telegram/Resources/langs/lang.strings @@ -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}."; diff --git a/Telegram/SourceFiles/history/history_item.cpp b/Telegram/SourceFiles/history/history_item.cpp index c8f21a423..2c566ab1a 100644 --- a/Telegram/SourceFiles/history/history_item.cpp +++ b/Telegram/SourceFiles/history/history_item.cpp @@ -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, + preparePaymentSentMe, PrepareErrorText, prepareGroupCall, prepareInviteToGroupCall,