File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -491,6 +491,7 @@ PRIVATE
491491 chat_helpers/ttl_media_layer_widget.h
492492 core/application.cpp
493493 core/application.h
494+ core/cached_webview_availability.h
494495 core/bank_card_click_handler.cpp
495496 core/bank_card_click_handler.h
496497 core/base_integration.cpp
Original file line number Diff line number Diff line change @@ -88,7 +88,7 @@ For license and copyright information please follow this link:
8888#include " boxes/premium_limits_box.h"
8989#include " ui/accessible/ui_accessible_factory.h"
9090#include " ui/boxes/confirm_box.h"
91- #include " ui/controls/location_picker .h"
91+ #include " core/cached_webview_availability .h"
9292#include " styles/style_window.h"
9393
9494#include < QtCore/QStandardPaths>
@@ -326,9 +326,8 @@ void Application::run() {
326326 QMimeDatabase ().mimeTypeForName (u" text/plain" _q);
327327
328328 // Check now to avoid re-entrance later.
329- [[maybe_unused]] const auto ivSupported = Iv::ShowButton ();
330- [[maybe_unused]] const auto lpAvailable = Ui::LocationPicker::Available (
331- {});
329+ [[maybe_unused]] const auto &webviewAvailability
330+ = Core::CachedWebviewAvailability ();
332331
333332 _windows.emplace (nullptr , std::make_unique<Window::Controller>());
334333 setLastActiveWindow (_windows.front ().second .get ());
Original file line number Diff line number Diff line change 1+ /*
2+ This file is part of Telegram Desktop,
3+ the official desktop application for the Telegram messaging service.
4+
5+ For license and copyright information please follow this link:
6+ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
7+ */
8+ #pragma once
9+
10+ #include " webview/webview_interface.h"
11+
12+ namespace Core {
13+
14+ [[nodiscard]] inline const Webview::Available &CachedWebviewAvailability () {
15+ static const auto result = Webview::Availability ();
16+ return result;
17+ }
18+
19+ } // namespace Core
Original file line number Diff line number Diff line change @@ -8,7 +8,7 @@ For license and copyright information please follow this link:
88#include " iv/iv_data.h"
99
1010#include " iv/iv_prepare.h"
11- #include " webview/webview_interface .h"
11+ #include " core/cached_webview_availability .h"
1212
1313#include < QtCore/QRegularExpression>
1414#include < QtCore/QUrl>
@@ -102,12 +102,9 @@ QString SiteNameFromUrl(const QString &url) {
102102}
103103
104104bool ShowButton () {
105- static const auto Supported = [&] {
106- const auto availability = Webview::Availability ();
107- return availability.customSchemeRequests
108- && availability.customRangeRequests ;
109- }();
110- return Supported;
105+ const auto &availability = Core::CachedWebviewAvailability ();
106+ return availability.customSchemeRequests
107+ && availability.customRangeRequests ;
111108}
112109
113110void RecordShowFailure () {
Original file line number Diff line number Diff line change @@ -38,6 +38,7 @@ For license and copyright information please follow this link:
3838#include " webview/webview_data_stream_memory.h"
3939#include " webview/webview_embed.h"
4040#include " webview/webview_interface.h"
41+ #include " core/cached_webview_availability.h"
4142#include " window/themes/window_theme.h"
4243#include " styles/style_chat_helpers.h"
4344#include " styles/style_dialogs.h"
@@ -772,12 +773,10 @@ std::shared_ptr<Main::SessionShow> LocationPicker::uiShow() {
772773}
773774
774775bool LocationPicker::Available (const LocationPickerConfig &config) {
775- static const auto Supported = [&] {
776- const auto availability = Webview::Availability ();
777- return availability.customSchemeRequests
778- && availability.customReferer ;
779- }();
780- return Supported && !config.mapsToken .isEmpty ();
776+ const auto &availability = Core::CachedWebviewAvailability ();
777+ return availability.customSchemeRequests
778+ && availability.customReferer
779+ && !config.mapsToken .isEmpty ();
781780}
782781
783782void LocationPicker::setup (const Descriptor &descriptor) {
You can’t perform that action at this time.
0 commit comments