From 7ee16ba45c392b65b298b417e8e18751d3715433 Mon Sep 17 00:00:00 2001 From: John Preston Date: Tue, 14 May 2019 12:50:44 +0300 Subject: [PATCH] Clear hidden animated stickers. --- .../boxes/background_preview_box.cpp | 28 ---------- .../boxes/background_preview_box.h | 12 +---- Telegram/SourceFiles/data/data_session.cpp | 52 +++++++++++++++++++ Telegram/SourceFiles/data/data_session.h | 12 +++++ .../admin_log/history_admin_log_inner.cpp | 11 ++++ .../admin_log/history_admin_log_inner.h | 4 ++ .../history/history_inner_widget.cpp | 37 ++++++++++++- .../history/history_inner_widget.h | 6 +++ .../SourceFiles/history/history_widget.cpp | 7 ++- Telegram/SourceFiles/history/history_widget.h | 1 - .../SourceFiles/history/media/history_media.h | 3 ++ .../history/media/history_media_sticker.cpp | 17 +++++- .../history/media/history_media_sticker.h | 5 ++ .../history/view/history_view_element.cpp | 43 +++++++++++++++ .../history/view/history_view_element.h | 24 +++++++++ .../history/view/history_view_list_widget.cpp | 11 ++++ .../history/view/history_view_list_widget.h | 4 ++ Telegram/SourceFiles/mainwidget.cpp | 4 -- Telegram/SourceFiles/mainwidget.h | 1 - .../settings/settings_privacy_controllers.cpp | 30 ----------- .../settings/settings_privacy_controllers.h | 12 +---- .../support/support_autocomplete.cpp | 27 ---------- .../support/support_autocomplete.h | 12 +---- 23 files changed, 233 insertions(+), 130 deletions(-) diff --git a/Telegram/SourceFiles/boxes/background_preview_box.cpp b/Telegram/SourceFiles/boxes/background_preview_box.cpp index f89f18ee3..7eb0e6c65 100644 --- a/Telegram/SourceFiles/boxes/background_preview_box.cpp +++ b/Telegram/SourceFiles/boxes/background_preview_box.cpp @@ -756,31 +756,3 @@ bool BackgroundPreviewBox::Start( HistoryView::Context BackgroundPreviewBox::elementContext() { return HistoryView::Context::ContactPreview; } - -std::unique_ptr BackgroundPreviewBox::elementCreate( - not_null message) { - return std::make_unique(delegate(), message); -} - -std::unique_ptr BackgroundPreviewBox::elementCreate( - not_null message) { - Unexpected("Service message in BackgroundPreviewBox."); -} - -bool BackgroundPreviewBox::elementUnderCursor( - not_null view) { - return false; -} - -void BackgroundPreviewBox::elementAnimationAutoplayAsync( - not_null element) { -} - -crl::time BackgroundPreviewBox::elementHighlightTime( - not_null element) { - return crl::time(0); -} - -bool BackgroundPreviewBox::elementInSelectionMode() { - return false; -} diff --git a/Telegram/SourceFiles/boxes/background_preview_box.h b/Telegram/SourceFiles/boxes/background_preview_box.h index a24d91f85..3d7cbb2df 100644 --- a/Telegram/SourceFiles/boxes/background_preview_box.h +++ b/Telegram/SourceFiles/boxes/background_preview_box.h @@ -21,7 +21,7 @@ class Checkbox; class BackgroundPreviewBox : public BoxContent - , private HistoryView::ElementDelegate { + , private HistoryView::SimpleElementDelegate { public: BackgroundPreviewBox(QWidget*, const Data::WallPaper &paper); @@ -38,16 +38,6 @@ private: using Element = HistoryView::Element; not_null delegate(); HistoryView::Context elementContext() override; - std::unique_ptr elementCreate( - not_null message) override; - std::unique_ptr elementCreate( - not_null message) override; - bool elementUnderCursor(not_null view) override; - void elementAnimationAutoplayAsync( - not_null element) override; - crl::time elementHighlightTime( - not_null element) override; - bool elementInSelectionMode() override; void apply(); void share(); diff --git a/Telegram/SourceFiles/data/data_session.cpp b/Telegram/SourceFiles/data/data_session.cpp index 381889b85..80c9cd672 100644 --- a/Telegram/SourceFiles/data/data_session.cpp +++ b/Telegram/SourceFiles/data/data_session.cpp @@ -1251,6 +1251,58 @@ void Session::sendHistoryChangeNotifications() { } } +void Session::registerHeavyViewPart(not_null view) { + _heavyViewParts.emplace(view); +} + +void Session::unregisterHeavyViewPart(not_null view) { + _heavyViewParts.remove(view); +} + +void Session::unloadHeavyViewParts( + not_null delegate) { + if (_heavyViewParts.empty()) { + return; + } + const auto remove = ranges::count(_heavyViewParts, delegate, [](not_null element) { + return element->delegate(); + }); + if (remove == _heavyViewParts.size()) { + for (const auto view : base::take(_heavyViewParts)) { + view->unloadHeavyPart(); + } + } else { + auto remove = std::vector>(); + for (const auto view : _heavyViewParts) { + if (view->delegate() == delegate) { + remove.push_back(view); + } + } + for (const auto view : remove) { + view->unloadHeavyPart(); + } + } +} + +void Session::unloadHeavyViewParts( + not_null delegate, + int from, + int till) { + if (_heavyViewParts.empty()) { + return; + } + auto remove = std::vector>(); + for (const auto view : _heavyViewParts) { + if (view->delegate() == delegate + && !delegate->elementIntersectsRange(view, from, till)) { + remove.push_back(view); + } + } + for (const auto view : remove) { + view->unloadHeavyPart(); + } +} + void Session::removeMegagroupParticipant( not_null channel, not_null user) { diff --git a/Telegram/SourceFiles/data/data_session.h b/Telegram/SourceFiles/data/data_session.h index 45b970fc3..43ef82839 100644 --- a/Telegram/SourceFiles/data/data_session.h +++ b/Telegram/SourceFiles/data/data_session.h @@ -30,6 +30,7 @@ enum class NewMessageType; namespace HistoryView { struct Group; class Element; +class ElementDelegate; } // namespace HistoryView class AuthSession; @@ -198,6 +199,15 @@ public: [[nodiscard]] rpl::producer> historyChanged() const; void sendHistoryChangeNotifications(); + void registerHeavyViewPart(not_null view); + void unregisterHeavyViewPart(not_null view); + void unloadHeavyViewParts( + not_null delegate); + void unloadHeavyViewParts( + not_null delegate, + int from, + int till); + using MegagroupParticipant = std::tuple< not_null, not_null>; @@ -909,6 +919,8 @@ private: not_null, std::vector>> _views; + base::flat_set> _heavyViewParts; + PeerData *_proxyPromoted = nullptr; NotifySettings _defaultUserNotifySettings; diff --git a/Telegram/SourceFiles/history/admin_log/history_admin_log_inner.cpp b/Telegram/SourceFiles/history/admin_log/history_admin_log_inner.cpp index c9c1e83a4..388c47ea6 100644 --- a/Telegram/SourceFiles/history/admin_log/history_admin_log_inner.cpp +++ b/Telegram/SourceFiles/history/admin_log/history_admin_log_inner.cpp @@ -525,6 +525,17 @@ bool InnerWidget::elementInSelectionMode() { return false; } +bool InnerWidget::elementIntersectsRange( + not_null view, + int from, + int till) { + Expects(view->delegate() == this); + + const auto top = itemTop(view); + const auto bottom = top + view->height(); + return (top < till && bottom > from); +} + void InnerWidget::saveState(not_null memento) { memento->setFilter(std::move(_filter)); memento->setAdmins(std::move(_admins)); diff --git a/Telegram/SourceFiles/history/admin_log/history_admin_log_inner.h b/Telegram/SourceFiles/history/admin_log/history_admin_log_inner.h index 998c22ebb..86edd7f0c 100644 --- a/Telegram/SourceFiles/history/admin_log/history_admin_log_inner.h +++ b/Telegram/SourceFiles/history/admin_log/history_admin_log_inner.h @@ -89,6 +89,10 @@ public: crl::time elementHighlightTime( not_null element) override; bool elementInSelectionMode() override; + bool elementIntersectsRange( + not_null view, + int from, + int till) override; ~InnerWidget(); diff --git a/Telegram/SourceFiles/history/history_inner_widget.cpp b/Telegram/SourceFiles/history/history_inner_widget.cpp index bc1344c4f..7edb52422 100644 --- a/Telegram/SourceFiles/history/history_inner_widget.cpp +++ b/Telegram/SourceFiles/history/history_inner_widget.cpp @@ -51,6 +51,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL namespace { constexpr auto kScrollDateHideTimeout = 1000; +constexpr auto kUnloadHeavyPartsPages = 3; // Helper binary search for an item in a list that is not completely // above the given top of the visible area or below the given bottom of the visible area @@ -76,6 +77,8 @@ int BinarySearchBlocksOrItems(const T &list, int edge) { // flick scroll taken from http://qt-project.org/doc/qt-4.8/demos-embedded-anomaly-src-flickcharm-cpp.html +HistoryInner *HistoryInner::Instance = nullptr; + class HistoryInner::BotAbout : public ClickHandlerHost { public: BotAbout(not_null parent, not_null info); @@ -127,6 +130,8 @@ HistoryInner::HistoryInner( , _scroll(scroll) , _scrollDateCheck([this] { scrollDateCheck(); }) , _scrollDateHideTimer([this] { scrollDateHideByTimer(); }) { + Instance = this; + _touchSelectTimer.setSingleShot(true); connect(&_touchSelectTimer, SIGNAL(timeout()), this, SLOT(onTouchSelect())); @@ -2097,6 +2102,7 @@ void HistoryInner::visibleAreaUpdated(int top, int bottom) { auto scrolledUp = (top < _visibleAreaTop); _visibleAreaTop = top; _visibleAreaBottom = bottom; + const auto visibleAreaHeight = bottom - top; // if history has pending resize events we should not update scrollTopItem if (hasPendingResizedItems()) { @@ -2130,6 +2136,12 @@ void HistoryInner::visibleAreaUpdated(int top, int bottom) { } else { scrollDateHideByTimer(); } + + // Unload lottie animations. + const auto pages = kUnloadHeavyPartsPages; + const auto from = _visibleAreaTop - pages * visibleAreaHeight; + const auto till = _visibleAreaBottom + pages * visibleAreaHeight; + Auth().data().unloadHeavyViewParts(ElementDelegate(), from, till); } bool HistoryInner::displayScrollDate() const { @@ -2243,6 +2255,9 @@ void HistoryInner::leaveEventHook(QEvent *e) { } HistoryInner::~HistoryInner() { + if (Instance == this) { + Instance = nullptr; + } delete _menu; _mouseAction = MouseAction::None; } @@ -2345,6 +2360,18 @@ bool HistoryInner::inSelectionMode() const { return false; } +bool HistoryInner::elementIntersectsRange( + not_null view, + int from, + int till) const { + const auto top = itemTop(view); + if (top < 0) { + return false; + } + const auto bottom = top + view->height(); + return (top < till && bottom > from); +} + auto HistoryInner::getSelectionState() const -> HistoryView::TopBarWidget::SelectedState { auto result = HistoryView::TopBarWidget::SelectedState {}; @@ -3179,7 +3206,15 @@ not_null HistoryInner::ElementDelegate() { return crl::time(0); } bool elementInSelectionMode() override { - return App::main()->historyInSelectionMode(); + return Instance ? Instance->inSelectionMode() : false; + } + bool elementIntersectsRange( + not_null view, + int from, + int till) override { + return Instance + ? Instance->elementIntersectsRange(view, from, till) + : false; } }; diff --git a/Telegram/SourceFiles/history/history_inner_widget.h b/Telegram/SourceFiles/history/history_inner_widget.h index 3ccfcf2e9..29b7d545d 100644 --- a/Telegram/SourceFiles/history/history_inner_widget.h +++ b/Telegram/SourceFiles/history/history_inner_widget.h @@ -73,6 +73,10 @@ public: MessageIdsList getSelectedItems() const; void selectItem(not_null item); bool inSelectionMode() const; + bool elementIntersectsRange( + not_null view, + int from, + int till) const; void updateBotInfo(bool recount = true); @@ -296,6 +300,8 @@ private: // Does any of the shown histories has this flag set. bool hasPendingResizedItems() const; + static HistoryInner *Instance; + not_null _controller; const not_null _peer; diff --git a/Telegram/SourceFiles/history/history_widget.cpp b/Telegram/SourceFiles/history/history_widget.cpp index d9858ccc4..777e1a9c5 100644 --- a/Telegram/SourceFiles/history/history_widget.cpp +++ b/Telegram/SourceFiles/history/history_widget.cpp @@ -850,10 +850,6 @@ int HistoryWidget::itemTopForHighlight( return qMax(itemTop - (heightLeft / 2), 0); } -bool HistoryWidget::inSelectionMode() const { - return _list ? _list->inSelectionMode() : false; -} - void HistoryWidget::start() { Auth().data().stickersUpdated( ) | rpl::start_with_next([this] { @@ -1643,6 +1639,9 @@ void HistoryWidget::showHistory( _showAtMsgId = showAtMsgId; _historyInited = false; + // Unload lottie animations. + Auth().data().unloadHeavyViewParts(HistoryInner::ElementDelegate()); + if (peerId) { _peer = Auth().data().peer(peerId); _channel = peerToChannel(_peer->id); diff --git a/Telegram/SourceFiles/history/history_widget.h b/Telegram/SourceFiles/history/history_widget.h index 60605c972..07b7594f2 100644 --- a/Telegram/SourceFiles/history/history_widget.h +++ b/Telegram/SourceFiles/history/history_widget.h @@ -186,7 +186,6 @@ public: void enqueueMessageHighlight(not_null view); crl::time highlightStartTime(not_null item) const; - bool inSelectionMode() const; MessageIdsList getSelectedItems() const; void itemEdited(HistoryItem *item); diff --git a/Telegram/SourceFiles/history/media/history_media.h b/Telegram/SourceFiles/history/media/history_media.h index 8ec8eb448..2799f711c 100644 --- a/Telegram/SourceFiles/history/media/history_media.h +++ b/Telegram/SourceFiles/history/media/history_media.h @@ -220,6 +220,9 @@ public: return true; } + virtual void unloadHeavyPart() { + } + // Should be called only by Data::Session. virtual void updateSharedContactUserId(UserId userId) { } diff --git a/Telegram/SourceFiles/history/media/history_media_sticker.cpp b/Telegram/SourceFiles/history/media/history_media_sticker.cpp index f5054d6a9..57f38d9f1 100644 --- a/Telegram/SourceFiles/history/media/history_media_sticker.cpp +++ b/Telegram/SourceFiles/history/media/history_media_sticker.cpp @@ -39,7 +39,9 @@ HistorySticker::HistorySticker( } } -HistorySticker::~HistorySticker() = default; +HistorySticker::~HistorySticker() { + unloadLottie(); +} QSize HistorySticker::countOptimalSize() { auto sticker = _data->sticker(); @@ -93,9 +95,14 @@ QSize HistorySticker::countCurrentSize(int newWidth) { } void HistorySticker::setupLottie() { + if (_lottie) { + return; + } _lottie = _data->data().isEmpty() ? Lottie::FromFile(_data->filepath()) : Lottie::FromData(_data->data()); + _parent->data()->history()->owner().registerHeavyViewPart(_parent); + _lottie->updates( ) | rpl::start_with_next_error([=](Lottie::Update update) { update.data.match([&](const Lottie::Information &information) { @@ -107,6 +114,14 @@ void HistorySticker::setupLottie() { }, _lifetime); } +void HistorySticker::unloadLottie() { + if (!_lottie) { + return; + } + _lottie = nullptr; + _parent->data()->history()->owner().unregisterHeavyViewPart(_parent); +} + void HistorySticker::draw(Painter &p, const QRect &r, TextSelection selection, crl::time ms) const { if (!_lottie && _data->filename().endsWith(qstr(".json"))) { if (_data->loaded()) { diff --git a/Telegram/SourceFiles/history/media/history_media_sticker.h b/Telegram/SourceFiles/history/media/history_media_sticker.h index def8df863..484045251 100644 --- a/Telegram/SourceFiles/history/media/history_media_sticker.h +++ b/Telegram/SourceFiles/history/media/history_media_sticker.h @@ -55,6 +55,10 @@ public: return true; } + void unloadHeavyPart() override { + unloadLottie(); + } + private: QSize countOptimalSize() override; QSize countCurrentSize(int newWidth) override; @@ -64,6 +68,7 @@ private: int additionalWidth() const; void setupLottie(); + void unloadLottie(); int _pixw = 1; int _pixh = 1; diff --git a/Telegram/SourceFiles/history/view/history_view_element.cpp b/Telegram/SourceFiles/history/view/history_view_element.cpp index b9b888b87..df7fcc47a 100644 --- a/Telegram/SourceFiles/history/view/history_view_element.cpp +++ b/Telegram/SourceFiles/history/view/history_view_element.cpp @@ -8,6 +8,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "history/view/history_view_element.h" #include "history/view/history_view_service_message.h" +#include "history/view/history_view_message.h" #include "history/history_item_components.h" #include "history/history_item.h" #include "history/media/history_media.h" @@ -47,6 +48,42 @@ bool IsAttachedToPreviousInSavedMessages( } // namespace + +std::unique_ptr SimpleElementDelegate::elementCreate( + not_null message) { + return std::make_unique(this, message); +} + +std::unique_ptr SimpleElementDelegate::elementCreate( + not_null message) { + return std::make_unique(this, message); +} + +bool SimpleElementDelegate::elementUnderCursor( + not_null view) { + return false; +} + +void SimpleElementDelegate::elementAnimationAutoplayAsync( + not_null element) { +} + +crl::time SimpleElementDelegate::elementHighlightTime( + not_null element) { + return crl::time(0); +} + +bool SimpleElementDelegate::elementInSelectionMode() { + return false; +} + +bool SimpleElementDelegate::elementIntersectsRange( + not_null view, + int from, + int till) { + return true; +} + TextSelection UnshiftItemSelection( TextSelection selection, uint16 byLength) { @@ -526,6 +563,12 @@ bool Element::hasVisibleText() const { return false; } +void Element::unloadHeavyPart() { + if (_media) { + _media->unloadHeavyPart(); + } +} + HistoryBlock *Element::block() { return _block; } diff --git a/Telegram/SourceFiles/history/view/history_view_element.h b/Telegram/SourceFiles/history/view/history_view_element.h index 6815b35d3..d942bd8fc 100644 --- a/Telegram/SourceFiles/history/view/history_view_element.h +++ b/Telegram/SourceFiles/history/view/history_view_element.h @@ -46,9 +46,31 @@ public: virtual crl::time elementHighlightTime( not_null element) = 0; virtual bool elementInSelectionMode() = 0; + virtual bool elementIntersectsRange( + not_null view, + int from, + int till) = 0; }; +class SimpleElementDelegate : public ElementDelegate { +public: + std::unique_ptr elementCreate( + not_null message) override; + std::unique_ptr elementCreate( + not_null message) override; + bool elementUnderCursor(not_null view) override; + void elementAnimationAutoplayAsync( + not_null element) override; + crl::time elementHighlightTime( + not_null element) override; + bool elementInSelectionMode() override; + bool elementIntersectsRange( + not_null view, + int from, + int till) override; +}; + TextSelection UnshiftItemSelection( TextSelection selection, uint16 byLength); @@ -232,6 +254,8 @@ public: virtual TimeId displayedEditDate() const; virtual bool hasVisibleText() const; + virtual void unloadHeavyPart(); + // Legacy blocks structure. HistoryBlock *block(); const HistoryBlock *block() const; diff --git a/Telegram/SourceFiles/history/view/history_view_list_widget.cpp b/Telegram/SourceFiles/history/view/history_view_list_widget.cpp index 2ce8990d8..5d433ba11 100644 --- a/Telegram/SourceFiles/history/view/history_view_list_widget.cpp +++ b/Telegram/SourceFiles/history/view/history_view_list_widget.cpp @@ -1126,6 +1126,17 @@ bool ListWidget::elementInSelectionMode() { return hasSelectedItems() || !_dragSelected.empty(); } +bool ListWidget::elementIntersectsRange( + not_null view, + int from, + int till) { + Expects(view->delegate() == this); + + const auto top = itemTop(view); + const auto bottom = top + view->height(); + return (top < till && bottom > from); +} + void ListWidget::saveState(not_null memento) { memento->setAroundPosition(_aroundPosition); auto state = countScrollState(); diff --git a/Telegram/SourceFiles/history/view/history_view_list_widget.h b/Telegram/SourceFiles/history/view/history_view_list_widget.h index 58f079208..d96896b9e 100644 --- a/Telegram/SourceFiles/history/view/history_view_list_widget.h +++ b/Telegram/SourceFiles/history/view/history_view_list_widget.h @@ -180,6 +180,10 @@ public: not_null view) override; crl::time elementHighlightTime(not_null element) override; bool elementInSelectionMode() override; + bool elementIntersectsRange( + not_null view, + int from, + int till) override; ~ListWidget(); diff --git a/Telegram/SourceFiles/mainwidget.cpp b/Telegram/SourceFiles/mainwidget.cpp index 8e7927735..02e49a8d6 100644 --- a/Telegram/SourceFiles/mainwidget.cpp +++ b/Telegram/SourceFiles/mainwidget.cpp @@ -967,10 +967,6 @@ crl::time MainWidget::highlightStartTime(not_null item) cons return _history->highlightStartTime(item); } -bool MainWidget::historyInSelectionMode() const { - return _history->inSelectionMode(); -} - MsgId MainWidget::currentReplyToIdFor(not_null history) const { if (_history->history() == history) { return _history->replyToId(); diff --git a/Telegram/SourceFiles/mainwidget.h b/Telegram/SourceFiles/mainwidget.h index b98fe2687..5241b7e8d 100644 --- a/Telegram/SourceFiles/mainwidget.h +++ b/Telegram/SourceFiles/mainwidget.h @@ -199,7 +199,6 @@ public: // While HistoryInner is not HistoryView::ListWidget. crl::time highlightStartTime(not_null item) const; - bool historyInSelectionMode() const; MsgId currentReplyToIdFor(not_null history) const; diff --git a/Telegram/SourceFiles/settings/settings_privacy_controllers.cpp b/Telegram/SourceFiles/settings/settings_privacy_controllers.cpp index a090b5419..5d33c00ee 100644 --- a/Telegram/SourceFiles/settings/settings_privacy_controllers.cpp +++ b/Telegram/SourceFiles/settings/settings_privacy_controllers.cpp @@ -682,36 +682,6 @@ HistoryView::Context ForwardsPrivacyController::elementContext() { return HistoryView::Context::ContactPreview; } -auto ForwardsPrivacyController::elementCreate( - not_null message) --> std::unique_ptr { - return std::make_unique(delegate(), message); -} - -auto ForwardsPrivacyController::elementCreate( - not_null message) --> std::unique_ptr { - Unexpected("Service message in ForwardsPrivacyController."); -} - -bool ForwardsPrivacyController::elementUnderCursor( - not_null view) { - return false; -} - -void ForwardsPrivacyController::elementAnimationAutoplayAsync( - not_null element) { -} - -crl::time ForwardsPrivacyController::elementHighlightTime( - not_null element) { - return crl::time(0); -} - -bool ForwardsPrivacyController::elementInSelectionMode() { - return false; -} - ApiWrap::Privacy::Key ProfilePhotoPrivacyController::key() { return Key::ProfilePhoto; } diff --git a/Telegram/SourceFiles/settings/settings_privacy_controllers.h b/Telegram/SourceFiles/settings/settings_privacy_controllers.h index 5013cd51d..1eff6b321 100644 --- a/Telegram/SourceFiles/settings/settings_privacy_controllers.h +++ b/Telegram/SourceFiles/settings/settings_privacy_controllers.h @@ -109,7 +109,7 @@ public: class ForwardsPrivacyController : public EditPrivacyBox::Controller - , private HistoryView::ElementDelegate { + , private HistoryView::SimpleElementDelegate { public: using Option = EditPrivacyBox::Option; using Exception = EditPrivacyBox::Exception; @@ -132,16 +132,6 @@ private: using Element = HistoryView::Element; not_null delegate(); HistoryView::Context elementContext() override; - std::unique_ptr elementCreate( - not_null message) override; - std::unique_ptr elementCreate( - not_null message) override; - bool elementUnderCursor(not_null view) override; - void elementAnimationAutoplayAsync( - not_null element) override; - crl::time elementHighlightTime( - not_null element) override; - bool elementInSelectionMode() override; static void PaintForwardedTooltip( Painter &p, diff --git a/Telegram/SourceFiles/support/support_autocomplete.cpp b/Telegram/SourceFiles/support/support_autocomplete.cpp index b9ed85507..8c8b03bd6 100644 --- a/Telegram/SourceFiles/support/support_autocomplete.cpp +++ b/Telegram/SourceFiles/support/support_autocomplete.cpp @@ -577,31 +577,4 @@ HistoryView::Context ConfirmContactBox::elementContext() { return HistoryView::Context::ContactPreview; } -std::unique_ptr ConfirmContactBox::elementCreate( - not_null message) { - return std::make_unique(this, message); -} - -std::unique_ptr ConfirmContactBox::elementCreate( - not_null message) { - return std::make_unique(this, message); -} - -bool ConfirmContactBox::elementUnderCursor(not_null view) { - return false; -} - -void ConfirmContactBox::elementAnimationAutoplayAsync( - not_null element) { -} - -crl::time ConfirmContactBox::elementHighlightTime( - not_null element) { - return crl::time(0); -} - -bool ConfirmContactBox::elementInSelectionMode() { - return false; -} - } // namespace Support diff --git a/Telegram/SourceFiles/support/support_autocomplete.h b/Telegram/SourceFiles/support/support_autocomplete.h index 4bdae8c25..5a2169a07 100644 --- a/Telegram/SourceFiles/support/support_autocomplete.h +++ b/Telegram/SourceFiles/support/support_autocomplete.h @@ -59,7 +59,7 @@ private: class ConfirmContactBox : public BoxContent - , public HistoryView::ElementDelegate { + , public HistoryView::SimpleElementDelegate { public: ConfirmContactBox( QWidget*, @@ -69,16 +69,6 @@ public: using Element = HistoryView::Element; HistoryView::Context elementContext() override; - std::unique_ptr elementCreate( - not_null message) override; - std::unique_ptr elementCreate( - not_null message) override; - bool elementUnderCursor(not_null view) override; - void elementAnimationAutoplayAsync( - not_null element) override; - crl::time elementHighlightTime( - not_null element) override; - bool elementInSelectionMode() override; protected: void prepare() override;