mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-04-18 23:27:09 +02:00
Fix build with updated submodules.
This commit is contained in:
parent
b412b2141e
commit
cdc295c1d7
8 changed files with 54 additions and 72 deletions
|
@ -326,7 +326,9 @@ void StickersBox::prepare() {
|
|||
_session->api().updateStickers();
|
||||
|
||||
if (_installed.widget()) {
|
||||
connect(_installed.widget(), SIGNAL(draggingScrollDelta(int)), this, SLOT(onDraggingScrollDelta(int)));
|
||||
connect(_installed.widget(), &Inner::draggingScrollDelta, [=](int delta) {
|
||||
scrollByDraggingDelta(delta);
|
||||
});
|
||||
if (!_megagroupSet) {
|
||||
boxClosing() | rpl::start_with_next([=] {
|
||||
saveChanges();
|
||||
|
|
|
@ -61,68 +61,68 @@ void UiIntegration::startFontsEnd() {
|
|||
}
|
||||
|
||||
std::shared_ptr<ClickHandler> UiIntegration::createLinkHandler(
|
||||
EntityType type,
|
||||
const QString &text,
|
||||
const QString &data,
|
||||
const TextParseOptions &options) {
|
||||
switch (type) {
|
||||
const EntityLinkData &data,
|
||||
const std::any &context) {
|
||||
const auto my = std::any_cast<Context>(&context);
|
||||
switch (data.type) {
|
||||
case EntityType::Url:
|
||||
return (!data.isEmpty() && UrlClickHandler::IsSuspicious(data))
|
||||
? std::make_shared<HiddenUrlClickHandler>(data)
|
||||
: nullptr;
|
||||
return (!data.data.isEmpty()
|
||||
&& UrlClickHandler::IsSuspicious(data.data))
|
||||
? std::make_shared<HiddenUrlClickHandler>(data.data)
|
||||
: Integration::createLinkHandler(data, context);
|
||||
|
||||
case EntityType::CustomUrl:
|
||||
return !data.isEmpty()
|
||||
? std::make_shared<HiddenUrlClickHandler>(data)
|
||||
: nullptr;
|
||||
return !data.data.isEmpty()
|
||||
? std::make_shared<HiddenUrlClickHandler>(data.data)
|
||||
: Integration::createLinkHandler(data, context);
|
||||
|
||||
case EntityType::BotCommand:
|
||||
return std::make_shared<BotCommandClickHandler>(data);
|
||||
return std::make_shared<BotCommandClickHandler>(data.data);
|
||||
|
||||
case EntityType::Hashtag:
|
||||
if (options.flags & TextTwitterMentions) {
|
||||
if (my && my->type == HashtagMentionType::Twitter) {
|
||||
return std::make_shared<UrlClickHandler>(
|
||||
(qsl("https://twitter.com/hashtag/")
|
||||
+ data.mid(1)
|
||||
+ data.data.mid(1)
|
||||
+ qsl("?src=hash")),
|
||||
true);
|
||||
} else if (options.flags & TextInstagramMentions) {
|
||||
} else if (my && my->type == HashtagMentionType::Instagram) {
|
||||
return std::make_shared<UrlClickHandler>(
|
||||
(qsl("https://instagram.com/explore/tags/")
|
||||
+ data.mid(1)
|
||||
+ data.data.mid(1)
|
||||
+ '/'),
|
||||
true);
|
||||
}
|
||||
return std::make_shared<HashtagClickHandler>(data);
|
||||
return std::make_shared<HashtagClickHandler>(data.data);
|
||||
|
||||
case EntityType::Cashtag:
|
||||
return std::make_shared<CashtagClickHandler>(data);
|
||||
return std::make_shared<CashtagClickHandler>(data.data);
|
||||
|
||||
case EntityType::Mention:
|
||||
if (options.flags & TextTwitterMentions) {
|
||||
if (my && my->type == HashtagMentionType::Twitter) {
|
||||
return std::make_shared<UrlClickHandler>(
|
||||
qsl("https://twitter.com/") + data.mid(1),
|
||||
qsl("https://twitter.com/") + data.data.mid(1),
|
||||
true);
|
||||
} else if (options.flags & TextInstagramMentions) {
|
||||
} else if (my && my->type == HashtagMentionType::Instagram) {
|
||||
return std::make_shared<UrlClickHandler>(
|
||||
qsl("https://instagram.com/") + data.mid(1) + '/',
|
||||
qsl("https://instagram.com/") + data.data.mid(1) + '/',
|
||||
true);
|
||||
}
|
||||
return std::make_shared<MentionClickHandler>(data);
|
||||
return std::make_shared<MentionClickHandler>(data.data);
|
||||
|
||||
case EntityType::MentionName: {
|
||||
auto fields = TextUtilities::MentionNameDataToFields(data);
|
||||
auto fields = TextUtilities::MentionNameDataToFields(data.data);
|
||||
if (fields.userId) {
|
||||
return std::make_shared<MentionNameClickHandler>(
|
||||
text,
|
||||
data.text,
|
||||
fields.userId,
|
||||
fields.accessHash);
|
||||
} else {
|
||||
LOG(("Bad mention name: %1").arg(data));
|
||||
LOG(("Bad mention name: %1").arg(data.data));
|
||||
}
|
||||
} break;
|
||||
}
|
||||
return nullptr;
|
||||
return Integration::createLinkHandler(data, context);
|
||||
}
|
||||
|
||||
bool UiIntegration::handleUrlClick(
|
||||
|
|
|
@ -13,6 +13,15 @@ namespace Core {
|
|||
|
||||
class UiIntegration : public Ui::Integration {
|
||||
public:
|
||||
enum class HashtagMentionType : uchar {
|
||||
Telegram,
|
||||
Twitter,
|
||||
Instagram,
|
||||
};
|
||||
struct Context {
|
||||
HashtagMentionType type = HashtagMentionType::Telegram;
|
||||
};
|
||||
|
||||
void postponeCall(FnMut<void()> &&callable) override;
|
||||
void registerLeaveSubscription(not_null<QWidget*> widget) override;
|
||||
void unregisterLeaveSubscription(not_null<QWidget*> widget) override;
|
||||
|
@ -27,10 +36,8 @@ public:
|
|||
void startFontsEnd() override;
|
||||
|
||||
std::shared_ptr<ClickHandler> createLinkHandler(
|
||||
EntityType type,
|
||||
const QString &text,
|
||||
const QString &data,
|
||||
const TextParseOptions &options) override;
|
||||
const EntityLinkData &data,
|
||||
const std::any &context) override;
|
||||
bool handleUrlClick(
|
||||
const QString &url,
|
||||
const QVariant &context) override;
|
||||
|
|
|
@ -9,6 +9,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||
|
||||
#include "layout.h"
|
||||
#include "core/click_handler_types.h"
|
||||
#include "core/ui_integration.h"
|
||||
#include "lang/lang_keys.h"
|
||||
#include "history/history_item_components.h"
|
||||
#include "history/history_item.h"
|
||||
|
@ -199,10 +200,17 @@ QSize WebPage::countOptimalSize() {
|
|||
- st::msgPadding.right()
|
||||
- st::webPageLeft);
|
||||
}
|
||||
auto context = Core::UiIntegration::Context();
|
||||
if (_data->siteName == qstr("Twitter")) {
|
||||
context.type = Core::UiIntegration::HashtagMentionType::Twitter;
|
||||
} else if (_data->siteName == qstr("Instagram")) {
|
||||
context.type = Core::UiIntegration::HashtagMentionType::Instagram;
|
||||
}
|
||||
_description.setMarkedText(
|
||||
st::webPageDescriptionStyle,
|
||||
text,
|
||||
Ui::WebpageTextDescriptionOptions(_data->siteName));
|
||||
Ui::WebpageTextDescriptionOptions(),
|
||||
context);
|
||||
}
|
||||
if (!displayedSiteName().isEmpty()) {
|
||||
_siteNameLines = 1;
|
||||
|
|
|
@ -110,32 +110,6 @@ TextParseOptions WebpageDescriptionOptions = {
|
|||
Qt::LayoutDirectionAuto, // dir
|
||||
};
|
||||
|
||||
TextParseOptions TwitterDescriptionOptions = {
|
||||
TextParseLinks
|
||||
| TextParseMentions
|
||||
| TextTwitterMentions
|
||||
| TextParseHashtags
|
||||
| TextTwitterHashtags
|
||||
| TextParseMultiline
|
||||
| TextParseRichText, // flags
|
||||
0, // maxw
|
||||
0, // maxh
|
||||
Qt::LayoutDirectionAuto, // dir
|
||||
};
|
||||
|
||||
TextParseOptions InstagramDescriptionOptions = {
|
||||
TextParseLinks
|
||||
| TextParseMentions
|
||||
| TextInstagramMentions
|
||||
| TextParseHashtags
|
||||
| TextInstagramHashtags
|
||||
| TextParseMultiline
|
||||
| TextParseRichText, // flags
|
||||
0, // maxw
|
||||
0, // maxh
|
||||
Qt::LayoutDirectionAuto, // dir
|
||||
};
|
||||
|
||||
bool UseBotTextOptions(
|
||||
not_null<History*> history,
|
||||
not_null<PeerData*> author) {
|
||||
|
@ -171,8 +145,6 @@ void InitTextOptions() {
|
|||
WebpageTitleOptions.maxh = st::webPageTitleFont->height * 2;
|
||||
WebpageTitleOptions.maxw
|
||||
= WebpageDescriptionOptions.maxw
|
||||
= TwitterDescriptionOptions.maxw
|
||||
= InstagramDescriptionOptions.maxw
|
||||
= st::msgMaxWidth
|
||||
- st::msgPadding.left()
|
||||
- st::webPageLeft
|
||||
|
@ -204,13 +176,7 @@ const TextParseOptions &WebpageTextTitleOptions() {
|
|||
return WebpageTitleOptions;
|
||||
}
|
||||
|
||||
const TextParseOptions &WebpageTextDescriptionOptions(
|
||||
const QString &siteName) {
|
||||
if (siteName == qstr("Twitter")) {
|
||||
return TwitterDescriptionOptions;
|
||||
} else if (siteName == qstr("Instagram")) {
|
||||
return InstagramDescriptionOptions;
|
||||
}
|
||||
const TextParseOptions &WebpageTextDescriptionOptions() {
|
||||
return WebpageDescriptionOptions;
|
||||
}
|
||||
|
||||
|
|
|
@ -23,8 +23,7 @@ const TextParseOptions &ItemTextBotNoMonoOptions();
|
|||
const TextParseOptions &ItemTextServiceOptions();
|
||||
|
||||
const TextParseOptions &WebpageTextTitleOptions();
|
||||
const TextParseOptions &WebpageTextDescriptionOptions(
|
||||
const QString &siteName = QString());
|
||||
const TextParseOptions &WebpageTextDescriptionOptions();
|
||||
|
||||
const TextParseOptions &NameTextOptions();
|
||||
const TextParseOptions &DialogTextOptions();
|
||||
|
|
|
@ -1 +1 @@
|
|||
Subproject commit 4ef97b57f6925ac9f1e3221676f49dffb4fe8c19
|
||||
Subproject commit 4e6763d1769e6305a3da158e1a332ccd6a30398a
|
2
cmake
2
cmake
|
@ -1 +1 @@
|
|||
Subproject commit b558136e64edd851901ac2b48a4f186d186c1723
|
||||
Subproject commit eb97b772a330ee370ea37c753a54c6862ca96644
|
Loading…
Add table
Reference in a new issue