Show IV button only if supported.
This commit is contained in:
parent
d43f0be0da
commit
e20770e256
|
@ -172,7 +172,7 @@ WebPageType ParseWebPageType(
|
||||||
}
|
}
|
||||||
|
|
||||||
bool IgnoreIv(WebPageType type) {
|
bool IgnoreIv(WebPageType type) {
|
||||||
return (type == WebPageType::Message);
|
return !Iv::ShowButton() || (type == WebPageType::Message);
|
||||||
}
|
}
|
||||||
|
|
||||||
WebPageType ParseWebPageType(const MTPDwebPage &page) {
|
WebPageType ParseWebPageType(const MTPDwebPage &page) {
|
||||||
|
|
|
@ -8,11 +8,17 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||||
#include "iv/iv_data.h"
|
#include "iv/iv_data.h"
|
||||||
|
|
||||||
#include "iv/iv_prepare.h"
|
#include "iv/iv_prepare.h"
|
||||||
|
#include "webview/webview_interface.h"
|
||||||
|
|
||||||
#include <QtCore/QRegularExpression>
|
#include <QtCore/QRegularExpression>
|
||||||
#include <QtCore/QUrl>
|
#include <QtCore/QUrl>
|
||||||
|
|
||||||
namespace Iv {
|
namespace Iv {
|
||||||
|
namespace {
|
||||||
|
|
||||||
|
bool FailureRecorded/* = false*/;
|
||||||
|
|
||||||
|
} // namespace
|
||||||
|
|
||||||
QByteArray GeoPointId(Geo point) {
|
QByteArray GeoPointId(Geo point) {
|
||||||
const auto lat = int(point.lat * 1000000);
|
const auto lat = int(point.lat * 1000000);
|
||||||
|
@ -89,4 +95,17 @@ QString SiteNameFromUrl(const QString &url) {
|
||||||
return QString();
|
return QString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool ShowButton() {
|
||||||
|
static const auto Supported = Webview::NavigateToDataSupported();
|
||||||
|
return Supported;
|
||||||
|
}
|
||||||
|
|
||||||
|
void RecordShowFailure() {
|
||||||
|
FailureRecorded = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool FailedToShow() {
|
||||||
|
return FailureRecorded;
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace Iv
|
} // namespace Iv
|
||||||
|
|
|
@ -53,4 +53,9 @@ private:
|
||||||
|
|
||||||
[[nodiscard]] QString SiteNameFromUrl(const QString &url);
|
[[nodiscard]] QString SiteNameFromUrl(const QString &url);
|
||||||
|
|
||||||
|
[[nodiscard]] bool ShowButton();
|
||||||
|
|
||||||
|
void RecordShowFailure();
|
||||||
|
[[nodiscard]] bool FailedToShow();
|
||||||
|
|
||||||
} // namespace Iv
|
} // namespace Iv
|
||||||
|
|
|
@ -1060,4 +1060,4 @@ boostsMessageIcon: icon {{ "stories/boosts_mini", windowFg }};
|
||||||
boostsMessageIconPadding: margins(0px, 2px, 0px, 0px);
|
boostsMessageIconPadding: margins(0px, 2px, 0px, 0px);
|
||||||
|
|
||||||
historyIvIcon: icon{{ "boosts/boost_mini2", windowFg }};
|
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
|
Loading…
Reference in New Issue