MCPcopy Create free account
hub / github.com/TDesktop-x64/tdesktop / started

Method started

Telegram/SourceFiles/inline_bots/bot_attach_web_view.cpp:1491–1539  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1489}
1490
1491void WebViewInstance::started(uint64 queryId) {
1492 if (v::is<WebViewSourceJoinChat>(_source)) {
1493 if (!queryId) {
1494 return;
1495 }
1496 _session->attachWebView().watchJoinChatWebView(
1497 queryId,
1498 _parentShow,
1499 _context.controller,
1500 this);
1501 return;
1502 }
1503
1504 Expects(_context.action.has_value());
1505
1506 if (!queryId) {
1507 return;
1508 }
1509
1510 _session->data().webViewResultSent(
1511 ) | rpl::filter([=](const Data::Session::WebViewResultSent &sent) {
1512 return (sent.queryId == queryId);
1513 }) | rpl::on_next([=] {
1514 close();
1515 }, _panel->lifetime());
1516
1517 const auto action = *_context.action;
1518 base::timer_each(
1519 kProlongTimeout
1520 ) | rpl::on_next([=] {
1521 using Flag = MTPmessages_ProlongWebView::Flag;
1522 _session->api().request(base::take(_prolongId)).cancel();
1523 _prolongId = _session->api().request(MTPmessages_ProlongWebView(
1524 MTP_flags(Flag(0)
1525 | (action.replyTo ? Flag::f_reply_to : Flag(0))
1526 | (action.options.sendAs ? Flag::f_send_as : Flag(0))
1527 | (action.options.silent ? Flag::f_silent : Flag(0))),
1528 action.history->peer->input(),
1529 _bot->inputUser(),
1530 MTP_long(queryId),
1531 action.mtpReplyTo(),
1532 (action.options.sendAs
1533 ? action.options.sendAs->input()
1534 : MTP_inputPeerEmpty())
1535 )).done([=] {
1536 _prolongId = 0;
1537 }).send();
1538 }, _panel->lifetime());
1539}
1540
1541Webview::ThemeParams WebViewInstance::botThemeParams() {
1542 auto result = Window::Theme::WebViewParams();

Callers 6

paintMethod · 0.45
clipCallbackMethod · 0.45
setupScrollAnimationMethod · 0.45
setupScrollHandlingMethod · 0.45
CreateWorkingHoursFunction · 0.45

Calls 15

MTP_flagsFunction · 0.85
MTP_longFunction · 0.85
watchJoinChatWebViewMethod · 0.80
has_valueMethod · 0.80
webViewResultSentMethod · 0.80
apiMethod · 0.80
inputUserMethod · 0.80
mtpReplyToMethod · 0.80
FlagEnum · 0.50
dataMethod · 0.45
cancelMethod · 0.45
requestMethod · 0.45

Tested by

no test coverage detected