void BotGameUrlClickHandler::onClick(ClickContext context) const { const auto url = tryConvertUrlToLocal(this->url()); if (Core::InternalPassportLink(url)) { return; } const auto open = [=] { UrlClickHandler::Open(url, context.other); }; if (url.startsWith(qstr("tg://"), Qt::CaseInsensitive)) { open(); } else if (!_bot || _bot->isVerified() || Local::isBotTrusted(_bot)) { open(); } else { const auto callback = [=, bot = _bot] { Ui::hideLayer(); Local::makeBotTrusted(bot); open(); }; Ui::show(Box<ConfirmBox>( lng_allow_bot_pass(lt_bot_name, _bot->name), lang(lng_allow_bot), callback)); } }
void BotGameUrlClickHandler::onClick(Qt::MouseButton button) const { auto urlText = tryConvertUrlToLocal(url()); if (urlText.startsWith(qstr("tg://"))) { App::openLocalUrl(urlText); } else if (!_bot || _bot->isVerified() || Local::isBotTrusted(_bot)) { doOpen(urlText); } else { Ui::show(Box<ConfirmBox>(lng_allow_bot_pass(lt_bot_name, _bot->name), lang(lng_allow_bot), [bot = _bot, urlText] { Ui::hideLayer(); Local::makeBotTrusted(bot); UrlClickHandler::doOpen(urlText); })); } }
ConfirmBotGameBox::ConfirmBotGameBox(UserData *bot, const QString &url) : ConfirmBox(lng_allow_bot_pass(lt_bot_name, bot->name), lang(lng_allow_bot)) , _bot(bot) , _url(url) { connect(this, SIGNAL(confirmed()), this, SLOT(onOpenLink())); }