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

Allow HiddenUrlClickHandler to work in a payment form.

This commit is contained in:
John Preston
2022-06-20 17:14:14 +04:00
parent 7027c0db0b
commit 66e9c5ef16
8 changed files with 45 additions and 11 deletions

View File

@@ -123,16 +123,17 @@ void HiddenUrlClickHandler::Open(QString url, QVariant context) {
const auto use = controller
? &controller->window()
: Core::App().activeWindow();
if (use) {
use->show(
Ui::MakeConfirmBox({
.text = (tr::lng_open_this_link(tr::now)
+ qsl("\n\n")
+ displayUrl),
.confirmed = [=](Fn<void()> hide) { hide(); open(); },
.confirmText = tr::lng_open_link(),
}),
Ui::LayerOption::KeepOther);
auto box = Ui::MakeConfirmBox({
.text = (tr::lng_open_this_link(tr::now)
+ qsl("\n\n")
+ displayUrl),
.confirmed = [=](Fn<void()> hide) { hide(); open(); },
.confirmText = tr::lng_open_link(),
});
if (my.show) {
my.show->showBox(std::move(box));
} else if (use) {
use->show(std::move(box), Ui::LayerOption::KeepOther);
}
} else {
open();

View File

@@ -8,6 +8,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#pragma once
#include "ui/basic_click_handlers.h"
#include "data/data_msg_id.h"
constexpr auto kPeerLinkPeerIdProperty = 0x01;
constexpr auto kPhotoLinkMediaProperty = 0x02;
@@ -15,6 +16,10 @@ constexpr auto kDocumentLinkMediaProperty = 0x03;
constexpr auto kSendReactionEmojiProperty = 0x04;
constexpr auto kReactionsCountEmojiProperty = 0x05;
namespace Ui {
class Show;
} // namespace Ui
namespace Main {
class Session;
} // namespace Main
@@ -35,6 +40,7 @@ struct ClickHandlerContext {
// Is filled from sections.
Fn<HistoryView::ElementDelegate*()> elementDelegate;
base::weak_ptr<Window::SessionController> sessionWindow;
std::shared_ptr<Ui::Show> show;
bool skipBotAutoLogin = false;
bool botStartAutoSubmit = false;
// Is filled from peer info.