mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-04-16 14:17:12 +02:00
Better saved credentials processing.
This commit is contained in:
parent
fede1ff173
commit
f0f7318978
3 changed files with 8 additions and 13 deletions
|
@ -46,6 +46,10 @@ class Media;
|
|||
class MessageReactions;
|
||||
} // namespace Data
|
||||
|
||||
namespace Main {
|
||||
class Session;
|
||||
} // namespace Main
|
||||
|
||||
namespace Window {
|
||||
class SessionController;
|
||||
} // namespace Window
|
||||
|
|
|
@ -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<MTPPaymentFormMethod> &list) {
|
||||
_paymentMethod.ui.additionalMethods = ranges::views::all(
|
||||
|
|
|
@ -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<MTPPaymentFormMethod> &list);
|
||||
void processShippingOptions(const QVector<MTPShippingOption> &data);
|
||||
|
|
Loading…
Add table
Reference in a new issue