From f0f7318978b7128b3d942cff89d6e37546238c7b Mon Sep 17 00:00:00 2001 From: John Preston Date: Mon, 15 Aug 2022 12:20:17 +0300 Subject: [PATCH] Better saved credentials processing. --- Telegram/SourceFiles/history/history_item.h | 4 ++++ Telegram/SourceFiles/payments/payments_form.cpp | 15 ++++----------- Telegram/SourceFiles/payments/payments_form.h | 2 -- 3 files changed, 8 insertions(+), 13 deletions(-) diff --git a/Telegram/SourceFiles/history/history_item.h b/Telegram/SourceFiles/history/history_item.h index 0f53f8e85..89ece7de5 100644 --- a/Telegram/SourceFiles/history/history_item.h +++ b/Telegram/SourceFiles/history/history_item.h @@ -46,6 +46,10 @@ class Media; class MessageReactions; } // namespace Data +namespace Main { +class Session; +} // namespace Main + namespace Window { class SessionController; } // namespace Window diff --git a/Telegram/SourceFiles/payments/payments_form.cpp b/Telegram/SourceFiles/payments/payments_form.cpp index 9ca0f9682..8dd8b2d42 100644 --- a/Telegram/SourceFiles/payments/payments_form.cpp +++ b/Telegram/SourceFiles/payments/payments_form.cpp @@ -319,10 +319,12 @@ void Form::processForm(const MTPDpayments_paymentForm &data) { if (const auto credentials = data.vsaved_credentials()) { _paymentMethod.savedCredentials.reserve(credentials->v.size()); for (const auto &saved : credentials->v) { - saved.match([&](const auto &data) { - addSavedCredentials(data); + _paymentMethod.savedCredentials.push_back({ + .id = qs(saved.data().vid()), + .title = qs(saved.data().vtitle()), }); } + refreshPaymentMethodDetails(); } if (const auto additional = data.vadditional_methods()) { processAdditionalPaymentMethods(additional->v); @@ -473,15 +475,6 @@ void Form::processSavedInformation(const MTPDpaymentRequestedInfo &data) { }; } -void Form::addSavedCredentials( - const MTPDpaymentSavedCredentialsCard &data) { - _paymentMethod.savedCredentials.push_back({ - .id = qs(data.vid()), - .title = qs(data.vtitle()), - }); - refreshPaymentMethodDetails(); -} - void Form::processAdditionalPaymentMethods( const QVector &list) { _paymentMethod.ui.additionalMethods = ranges::views::all( diff --git a/Telegram/SourceFiles/payments/payments_form.h b/Telegram/SourceFiles/payments/payments_form.h index 1811dc8e2..4290edee4 100644 --- a/Telegram/SourceFiles/payments/payments_form.h +++ b/Telegram/SourceFiles/payments/payments_form.h @@ -256,8 +256,6 @@ private: void processDetails(const MTPDpayments_paymentForm &data); void processDetails(const MTPDpayments_paymentReceipt &data); void processSavedInformation(const MTPDpaymentRequestedInfo &data); - void addSavedCredentials( - const MTPDpaymentSavedCredentialsCard &data); void processAdditionalPaymentMethods( const QVector &list); void processShippingOptions(const QVector &data);