diff --git a/Telegram/SourceFiles/history/view/media/history_view_web_page.cpp b/Telegram/SourceFiles/history/view/media/history_view_web_page.cpp index a4cd1d66ad..9c4c1ef05e 100644 --- a/Telegram/SourceFiles/history/view/media/history_view_web_page.cpp +++ b/Telegram/SourceFiles/history/view/media/history_view_web_page.cpp @@ -598,6 +598,7 @@ QSize WebPage::countCurrentSize(int newWidth) { : FactcheckMetrics(); if (factcheck) { factcheck->expandable = factcheckMetrics.expandable; + factcheck->expanded = factcheckMetrics.expanded; _openl = factcheck->expandable ? ToggleFactcheckClickHandler(_parent) : nullptr; @@ -779,11 +780,12 @@ void WebPage::draw(Painter &p, const PaintContext &context) const { auto paintw = inner.width(); const auto sponsored = sponsoredData(); + const auto factcheck = factcheckData(); const auto selected = context.selected(); const auto view = parent(); const auto from = view->data()->contentColorsFrom(); - const auto colorIndex = factcheckData() + const auto colorIndex = factcheck ? 0 // red : (sponsored && sponsored->colorIndex) ? sponsored->colorIndex @@ -793,8 +795,9 @@ void WebPage::draw(Painter &p, const PaintContext &context) const { const auto cache = context.outbg ? stm->replyCache[st->colorPatternIndex(colorIndex)].get() : st->coloredReplyCache(selected, colorIndex).get(); - const auto backgroundEmojiId = (sponsored - && sponsored->backgroundEmojiId) + const auto backgroundEmojiId = factcheck + ? DocumentId() + : (sponsored && sponsored->backgroundEmojiId) ? sponsored->backgroundEmojiId : from ? from->backgroundEmojiId() @@ -821,6 +824,15 @@ void WebPage::draw(Painter &p, const PaintContext &context) const { if (!backgroundEmojiCache->frames[0].isNull()) { FillBackgroundEmoji(p, outer, false, *backgroundEmojiCache); } + } else if (factcheck && factcheck->expandable) { + const auto &icon = factcheck->expanded + ? st::factcheckIconCollapse + : st::factcheckIconExpand; + icon.paint( + p, + outer.x() + outer.width() - icon.width() - _st.padding.right(), + outer.y() + _st.padding.top(), + width()); } if (_ripple) { @@ -1487,6 +1499,7 @@ WebPage::FactcheckMetrics WebPage::computeFactcheckMetrics( return { .lines = allowExpanding ? possible : kFactcheckCollapsedLines, .expandable = expandable, + .expanded = expanded, }; } diff --git a/Telegram/SourceFiles/history/view/media/history_view_web_page.h b/Telegram/SourceFiles/history/view/media/history_view_web_page.h index 47cba266c0..4637adb31c 100644 --- a/Telegram/SourceFiles/history/view/media/history_view_web_page.h +++ b/Telegram/SourceFiles/history/view/media/history_view_web_page.h @@ -104,6 +104,7 @@ private: struct FactcheckMetrics { int lines = 0; bool expandable = false; + bool expanded = false; }; struct HintData { QSize size; @@ -129,6 +130,7 @@ private: struct FactcheckData { HintData hint; bool expandable = false; + bool expanded = false; }; using AdditionalData = std::variant< StickerSetData, diff --git a/Telegram/SourceFiles/ui/chat/chat.style b/Telegram/SourceFiles/ui/chat/chat.style index 1d7361bdd2..6c398f2367 100644 --- a/Telegram/SourceFiles/ui/chat/chat.style +++ b/Telegram/SourceFiles/ui/chat/chat.style @@ -1132,3 +1132,6 @@ effectPreviewPromoPadding: margins(4px, 6px, 4px, 6px); effectPreviewLoading: InfiniteRadialAnimation(defaultInfiniteRadialAnimation) { thickness: 2px; } + +factcheckIconExpand: icon {{ "fast_to_original-rotate_cw", historyPeer1NameFg }}; +factcheckIconCollapse: icon {{ "fast_to_original-rotate_ccw", historyPeer1NameFg }}; diff --git a/Telegram/codegen b/Telegram/codegen index 6462cda46e..0af1361240 160000 --- a/Telegram/codegen +++ b/Telegram/codegen @@ -1 +1 @@ -Subproject commit 6462cda46ec5d48a9ae452ba1b6f7dfe1b6d882d +Subproject commit 0af136124083369073b8fdaf45f0816fd2b10bad