Show IV button only if supported.

This commit is contained in:
John Preston 2024-03-12 18:17:43 +04:00
parent d43f0be0da
commit e20770e256
5 changed files with 27 additions and 3 deletions

View File

@ -172,7 +172,7 @@ WebPageType ParseWebPageType(
}
bool IgnoreIv(WebPageType type) {
return (type == WebPageType::Message);
return !Iv::ShowButton() || (type == WebPageType::Message);
}
WebPageType ParseWebPageType(const MTPDwebPage &page) {

View File

@ -8,11 +8,17 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "iv/iv_data.h"
#include "iv/iv_prepare.h"
#include "webview/webview_interface.h"
#include <QtCore/QRegularExpression>
#include <QtCore/QUrl>
namespace Iv {
namespace {
bool FailureRecorded/* = false*/;
} // namespace
QByteArray GeoPointId(Geo point) {
const auto lat = int(point.lat * 1000000);
@ -89,4 +95,17 @@ QString SiteNameFromUrl(const QString &url) {
return QString();
}
bool ShowButton() {
static const auto Supported = Webview::NavigateToDataSupported();
return Supported;
}
void RecordShowFailure() {
FailureRecorded = true;
}
bool FailedToShow() {
return FailureRecorded;
}
} // namespace Iv

View File

@ -53,4 +53,9 @@ private:
[[nodiscard]] QString SiteNameFromUrl(const QString &url);
[[nodiscard]] bool ShowButton();
void RecordShowFailure();
[[nodiscard]] bool FailedToShow();
} // namespace Iv

View File

@ -1060,4 +1060,4 @@ boostsMessageIcon: icon {{ "stories/boosts_mini", windowFg }};
boostsMessageIconPadding: margins(0px, 2px, 0px, 0px);
historyIvIcon: icon{{ "boosts/boost_mini2", windowFg }};
historyIvIconPadding: margins(2px, 3px, 2px, 0px);
historyIvIconPadding: margins(2px, 2px, 2px, 0px);

@ -1 +1 @@
Subproject commit fbf9dd54787df90c98cf230cb53323527e0b0639
Subproject commit cf8ef94d0b12f8484e247d6a2d88dd1c11a6b964