mirror of
https://github.com/telegramdesktop/tdesktop
synced 2025-08-31 14:38:15 +00:00
Support gifting premium for stars.
This commit is contained in:
@@ -66,7 +66,6 @@ void CheckoutProcess::Start(
|
||||
Mode mode,
|
||||
Fn<void(CheckoutResult)> reactivate,
|
||||
Fn<void(NonPanelPaymentForm)> nonPanelPaymentFormProcess) {
|
||||
const auto hasNonPanelPaymentFormProcess = !!nonPanelPaymentFormProcess;
|
||||
auto &processes = LookupSessionProcesses(&item->history()->session());
|
||||
const auto media = item->media();
|
||||
const auto invoice = media ? media->invoice() : nullptr;
|
||||
@@ -87,9 +86,7 @@ void CheckoutProcess::Start(
|
||||
i->second->setReactivateCallback(std::move(reactivate));
|
||||
i->second->setNonPanelPaymentFormProcess(
|
||||
std::move(nonPanelPaymentFormProcess));
|
||||
if (!hasNonPanelPaymentFormProcess) {
|
||||
i->second->requestActivate();
|
||||
}
|
||||
i->second->requestActivate();
|
||||
return;
|
||||
}
|
||||
const auto j = processes.byItem.emplace(
|
||||
@@ -100,9 +97,7 @@ void CheckoutProcess::Start(
|
||||
std::move(reactivate),
|
||||
std::move(nonPanelPaymentFormProcess),
|
||||
PrivateTag{})).first;
|
||||
if (!hasNonPanelPaymentFormProcess) {
|
||||
j->second->requestActivate();
|
||||
}
|
||||
j->second->requestActivate();
|
||||
}
|
||||
|
||||
void CheckoutProcess::Start(
|
||||
@@ -110,16 +105,13 @@ void CheckoutProcess::Start(
|
||||
const QString &slug,
|
||||
Fn<void(CheckoutResult)> reactivate,
|
||||
Fn<void(NonPanelPaymentForm)> nonPanelPaymentFormProcess) {
|
||||
const auto hasNonPanelPaymentFormProcess = !!nonPanelPaymentFormProcess;
|
||||
auto &processes = LookupSessionProcesses(session);
|
||||
const auto i = processes.bySlug.find(slug);
|
||||
if (i != end(processes.bySlug)) {
|
||||
i->second->setReactivateCallback(std::move(reactivate));
|
||||
i->second->setNonPanelPaymentFormProcess(
|
||||
std::move(nonPanelPaymentFormProcess));
|
||||
if (!hasNonPanelPaymentFormProcess) {
|
||||
i->second->requestActivate();
|
||||
}
|
||||
i->second->requestActivate();
|
||||
return;
|
||||
}
|
||||
const auto j = processes.bySlug.emplace(
|
||||
@@ -130,20 +122,21 @@ void CheckoutProcess::Start(
|
||||
std::move(reactivate),
|
||||
std::move(nonPanelPaymentFormProcess),
|
||||
PrivateTag{})).first;
|
||||
if (!hasNonPanelPaymentFormProcess) {
|
||||
j->second->requestActivate();
|
||||
}
|
||||
j->second->requestActivate();
|
||||
}
|
||||
|
||||
void CheckoutProcess::Start(
|
||||
InvoicePremiumGiftCode giftCodeInvoice,
|
||||
Fn<void(CheckoutResult)> reactivate) {
|
||||
Fn<void(CheckoutResult)> reactivate,
|
||||
Fn<void(NonPanelPaymentForm)> nonPanelPaymentFormProcess) {
|
||||
const auto randomId = giftCodeInvoice.randomId;
|
||||
auto id = InvoiceId{ std::move(giftCodeInvoice) };
|
||||
auto &processes = LookupSessionProcesses(SessionFromId(id));
|
||||
const auto i = processes.byRandomId.find(randomId);
|
||||
if (i != end(processes.byRandomId)) {
|
||||
i->second->setReactivateCallback(std::move(reactivate));
|
||||
i->second->setNonPanelPaymentFormProcess(
|
||||
std::move(nonPanelPaymentFormProcess));
|
||||
i->second->requestActivate();
|
||||
return;
|
||||
}
|
||||
@@ -153,7 +146,7 @@ void CheckoutProcess::Start(
|
||||
std::move(id),
|
||||
Mode::Payment,
|
||||
std::move(reactivate),
|
||||
nullptr,
|
||||
std::move(nonPanelPaymentFormProcess),
|
||||
PrivateTag{})).first;
|
||||
j->second->requestActivate();
|
||||
}
|
||||
@@ -372,7 +365,9 @@ void CheckoutProcess::setNonPanelPaymentFormProcess(
|
||||
}
|
||||
|
||||
void CheckoutProcess::requestActivate() {
|
||||
_panel->requestActivate();
|
||||
if (!_nonPanelPaymentFormProcess) {
|
||||
_panel->requestActivate();
|
||||
}
|
||||
}
|
||||
|
||||
not_null<Ui::PanelDelegate*> CheckoutProcess::panelDelegate() {
|
||||
|
Reference in New Issue
Block a user