Added fireworks effect on success credit sending.

This commit is contained in:
23rd 2024-05-25 01:36:17 +03:00 committed by John Preston
parent 7d75c25214
commit 0bd780b20f
3 changed files with 13 additions and 3 deletions

View file

@ -43,7 +43,8 @@ namespace Ui {
void SendCreditsBox(
not_null<Ui::GenericBox*> box,
std::shared_ptr<Payments::CreditsFormData> form) {
std::shared_ptr<Payments::CreditsFormData> form,
Fn<void()> sent) {
if (!form) {
return;
}
@ -145,6 +146,7 @@ void SendCreditsBox(
).done([=](auto result) {
state->confirmButtonBusy = false;
box->closeBox();
sent();
}).fail([=](const MTP::Error &error) {
state->confirmButtonBusy = false;
box->uiShow()->showToast(error.type());

View file

@ -19,6 +19,7 @@ class GenericBox;
void SendCreditsBox(
not_null<Ui::GenericBox*> box,
std::shared_ptr<Payments::CreditsFormData> data);
std::shared_ptr<Payments::CreditsFormData> data,
Fn<void()> sent);
} // namespace Ui

View file

@ -16,9 +16,11 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "history/history_item.h"
#include "history/history_item_components.h"
#include "main/main_session.h"
#include "mainwidget.h"
#include "payments/payments_checkout_process.h" // NonPanelPaymentForm.
#include "payments/payments_form.h"
#include "settings/settings_credits_graphics.h"
#include "ui/boxes/boost_box.h" // Ui::StartFireworks.
#include "ui/layers/generic_box.h"
#include "ui/text/format_values.h"
#include "window/window_session_controller.h"
@ -49,7 +51,12 @@ Fn<void(NonPanelPaymentForm)> ProcessNonPanelPaymentFormFactory(
controller->session().user());
const auto sendBox = [=, weak = base::make_weak(controller)] {
if (const auto strong = weak.get()) {
controller->uiShow()->show(Box(Ui::SendCreditsBox, form));
controller->uiShow()->show(Box(
Ui::SendCreditsBox,
form,
crl::guard(strong, [=] {
Ui::StartFireworks(strong->content());
})));
}
};
const auto weak = base::make_weak(controller);