From 4e345ac6881a89c060aeccf7753ab5be974a35ba Mon Sep 17 00:00:00 2001 From: 23rd <23rd@vivaldi.net> Date: Wed, 26 Feb 2020 14:25:51 +0300 Subject: [PATCH] Returned display of message status for self and last messages. --- .../SourceFiles/history/view/history_view_element.cpp | 10 ++++++++++ .../SourceFiles/history/view/history_view_element.h | 2 ++ .../history/view/media/history_view_gif.cpp | 3 ++- .../history/view/media/history_view_media_grouped.cpp | 4 +++- .../view/media/history_view_media_unwrapped.cpp | 1 + .../history/view/media/history_view_photo.cpp | 4 +++- 6 files changed, 21 insertions(+), 3 deletions(-) diff --git a/Telegram/SourceFiles/history/view/history_view_element.cpp b/Telegram/SourceFiles/history/view/history_view_element.cpp index 4a287222d..6921d7aa8 100644 --- a/Telegram/SourceFiles/history/view/history_view_element.cpp +++ b/Telegram/SourceFiles/history/view/history_view_element.cpp @@ -280,6 +280,16 @@ bool Element::isUnderCursor() const { return _delegate->elementUnderCursor(this); } +bool Element::isLastAndSelfMessage() const { + if (!hasOutLayout()) { + return false; + } + if (const auto last = data()->_history->lastMessage()) { + return last == data(); + } + return false; +} + void Element::setPendingResize() { _flags |= Flag::NeedsResize; if (_context == Context::History) { diff --git a/Telegram/SourceFiles/history/view/history_view_element.h b/Telegram/SourceFiles/history/view/history_view_element.h index 734ba8a79..d23b08f17 100644 --- a/Telegram/SourceFiles/history/view/history_view_element.h +++ b/Telegram/SourceFiles/history/view/history_view_element.h @@ -158,6 +158,8 @@ public: bool pendingResize() const; bool isUnderCursor() const; + bool isLastAndSelfMessage() const; + bool isAttachedToPrevious() const; bool isAttachedToNext() const; diff --git a/Telegram/SourceFiles/history/view/media/history_view_gif.cpp b/Telegram/SourceFiles/history/view/media/history_view_gif.cpp index 3b584aba2..6c3c3bdd8 100644 --- a/Telegram/SourceFiles/history/view/media/history_view_gif.cpp +++ b/Telegram/SourceFiles/history/view/media/history_view_gif.cpp @@ -1444,7 +1444,8 @@ bool Gif::dataLoaded() const { bool Gif::needInfoDisplay() const { return _parent->data()->isSending() || _data->uploading() - || _parent->isUnderCursor(); + || _parent->isUnderCursor() + || _parent->isLastAndSelfMessage(); } bool Gif::needCornerStatusDisplay() const { diff --git a/Telegram/SourceFiles/history/view/media/history_view_media_grouped.cpp b/Telegram/SourceFiles/history/view/media/history_view_media_grouped.cpp index 0b742bbe2..13ab8e046 100644 --- a/Telegram/SourceFiles/history/view/media/history_view_media_grouped.cpp +++ b/Telegram/SourceFiles/history/view/media/history_view_media_grouped.cpp @@ -453,7 +453,9 @@ bool GroupedMedia::computeNeedBubble() const { } bool GroupedMedia::needInfoDisplay() const { - return (_parent->data()->id < 0 || _parent->isUnderCursor()); + return (_parent->data()->id < 0 + || _parent->isUnderCursor() + || _parent->isLastAndSelfMessage()); } } // namespace HistoryView diff --git a/Telegram/SourceFiles/history/view/media/history_view_media_unwrapped.cpp b/Telegram/SourceFiles/history/view/media/history_view_media_unwrapped.cpp index 3f989962a..7b49cd2b1 100644 --- a/Telegram/SourceFiles/history/view/media/history_view_media_unwrapped.cpp +++ b/Telegram/SourceFiles/history/view/media/history_view_media_unwrapped.cpp @@ -367,6 +367,7 @@ bool UnwrappedMedia::needInfoDisplay() const { return (_parent->data()->id < 0) || (_parent->isUnderCursor()) || (_parent->displayRightAction()) + || (_parent->isLastAndSelfMessage()) || (_parent->hasOutLayout() && !Adaptive::ChatWide() && _content->alwaysShowOutTimestamp()); diff --git a/Telegram/SourceFiles/history/view/media/history_view_photo.cpp b/Telegram/SourceFiles/history/view/media/history_view_photo.cpp index 2b326315b..2d5cb756e 100644 --- a/Telegram/SourceFiles/history/view/media/history_view_photo.cpp +++ b/Telegram/SourceFiles/history/view/media/history_view_photo.cpp @@ -480,7 +480,9 @@ bool Photo::dataLoaded() const { } bool Photo::needInfoDisplay() const { - return (_parent->data()->id < 0 || _parent->isUnderCursor()); + return (_parent->data()->id < 0 + || _parent->isUnderCursor() + || _parent->isLastAndSelfMessage()); } void Photo::validateGroupedCache(