| 1489 | } |
| 1490 | |
| 1491 | void 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 | |
| 1541 | Webview::ThemeParams WebViewInstance::botThemeParams() { |
| 1542 | auto result = Window::Theme::WebViewParams(); |
no test coverage detected