2
0
mirror of https://github.com/kotatogram/kotatogram-desktop synced 2025-08-31 06:35:14 +00:00

Reactivate window on payment close.

This commit is contained in:
John Preston
2021-03-31 09:56:45 +04:00
parent 619f70ab22
commit b08d9fe0b8
4 changed files with 57 additions and 26 deletions

View File

@@ -28,8 +28,10 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "data/data_changes.h"
#include "data/data_group_call.h" // Data::GroupCall::id().
#include "core/application.h"
#include "core/click_handler_types.h"
#include "calls/calls_instance.h" // Core::App().calls().joinGroupCall.
#include "window/notifications_manager.h"
#include "window/window_controller.h"
#include "window/window_session_controller.h"
#include "storage/storage_shared_media.h"
#include "payments/payments_checkout_process.h" // CheckoutProcess::Start.
@@ -976,10 +978,16 @@ void HistoryService::createFromMtp(const MTPDmessageService &message) {
const auto id = fullId();
const auto owner = &history()->owner();
payment->amount = Ui::FillAmountAndCurrency(amount, currency);
payment->invoiceLink = std::make_shared<LambdaClickHandler>([=] {
payment->invoiceLink = std::make_shared<LambdaClickHandler>([=](
ClickContext context) {
using namespace Payments;
const auto my = context.other.value<ClickHandlerContext>();
const auto weak = my.sessionWindow;
if (const auto item = owner->message(id)) {
CheckoutProcess::Start(item, Mode::Receipt);
CheckoutProcess::Start(
item,
Mode::Receipt,
crl::guard(weak, [=] { weak->window().activate(); }));
}
});
} else if (message.vaction().type() == mtpc_messageActionGroupCall) {