mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-04-19 07:37:11 +02:00
Show correct outbox ticks in replies section.
This commit is contained in:
parent
13ad590a51
commit
247b1f64ca
12 changed files with 48 additions and 1 deletions
|
@ -595,6 +595,10 @@ bool InnerWidget::elementHideReply(not_null<const Element*> view) {
|
|||
return true;
|
||||
}
|
||||
|
||||
bool InnerWidget::elementShownUnread(not_null<const Element*> view) {
|
||||
return view->data()->unread();
|
||||
}
|
||||
|
||||
void InnerWidget::saveState(not_null<SectionMemento*> memento) {
|
||||
memento->setFilter(std::move(_filter));
|
||||
memento->setAdmins(std::move(_admins));
|
||||
|
|
|
@ -114,6 +114,8 @@ public:
|
|||
bool elementIsGifPaused() override;
|
||||
bool elementHideReply(
|
||||
not_null<const HistoryView::Element*> view) override;
|
||||
bool elementShownUnread(
|
||||
not_null<const HistoryView::Element*> view) override;
|
||||
|
||||
~InnerWidget();
|
||||
|
||||
|
|
|
@ -3411,6 +3411,9 @@ not_null<HistoryView::ElementDelegate*> HistoryInner::ElementDelegate() {
|
|||
bool elementHideReply(not_null<const Element*> view) override {
|
||||
return false;
|
||||
}
|
||||
bool elementShownUnread(not_null<const Element*> view) override {
|
||||
return view->data()->unread();
|
||||
}
|
||||
};
|
||||
|
||||
static Result result;
|
||||
|
|
|
@ -116,6 +116,11 @@ bool SimpleElementDelegate::elementHideReply(not_null<const Element*> view) {
|
|||
return false;
|
||||
}
|
||||
|
||||
bool SimpleElementDelegate::elementShownUnread(
|
||||
not_null<const Element*> view) {
|
||||
return view->data()->unread();
|
||||
}
|
||||
|
||||
TextSelection UnshiftItemSelection(
|
||||
TextSelection selection,
|
||||
uint16 byLength) {
|
||||
|
|
|
@ -65,6 +65,7 @@ public:
|
|||
Fn<void()> hiddenCallback) = 0;
|
||||
virtual bool elementIsGifPaused() = 0;
|
||||
virtual bool elementHideReply(not_null<const Element*> view) = 0;
|
||||
virtual bool elementShownUnread(not_null<const Element*> view) = 0;
|
||||
|
||||
};
|
||||
|
||||
|
@ -96,6 +97,7 @@ public:
|
|||
Fn<void()> hiddenCallback) override;
|
||||
bool elementIsGifPaused() override;
|
||||
bool elementHideReply(not_null<const Element*> view) override;
|
||||
bool elementShownUnread(not_null<const Element*> view) override;
|
||||
|
||||
private:
|
||||
const not_null<Window::SessionController*> _controller;
|
||||
|
|
|
@ -1279,6 +1279,10 @@ bool ListWidget::elementHideReply(not_null<const Element*> view) {
|
|||
return _delegate->listElementHideReply(view);
|
||||
}
|
||||
|
||||
bool ListWidget::elementShownUnread(not_null<const Element*> view) {
|
||||
return _delegate->listElementShownUnread(view);
|
||||
}
|
||||
|
||||
void ListWidget::saveState(not_null<ListMemento*> memento) {
|
||||
memento->setAroundPosition(_aroundPosition);
|
||||
auto state = countScrollState();
|
||||
|
|
|
@ -84,6 +84,7 @@ public:
|
|||
virtual void listContentRefreshed() = 0;
|
||||
virtual ClickHandlerPtr listDateLink(not_null<Element*> view) = 0;
|
||||
virtual bool listElementHideReply(not_null<const Element*> view) = 0;
|
||||
virtual bool listElementShownUnread(not_null<const Element*> view) = 0;
|
||||
virtual bool listIsGoodForAroundPosition(
|
||||
not_null<const Element*> view) = 0;
|
||||
|
||||
|
@ -229,6 +230,7 @@ public:
|
|||
Fn<void()> hiddenCallback) override;
|
||||
bool elementIsGifPaused() override;
|
||||
bool elementHideReply(not_null<const Element*> view) override;
|
||||
bool elementShownUnread(not_null<const Element*> view) override;
|
||||
|
||||
~ListWidget();
|
||||
|
||||
|
|
|
@ -1774,7 +1774,7 @@ void Message::drawInfo(
|
|||
if (outbg) {
|
||||
auto icon = [&] {
|
||||
if (item->id > 0) {
|
||||
if (item->unread()) {
|
||||
if (delegate()->elementShownUnread(this)) {
|
||||
return &(invertedsprites ? st::historySentInvertedIcon : (selected ? st::historySentSelectedIcon : st::historySentIcon));
|
||||
}
|
||||
return &(invertedsprites ? st::historyReceivedInvertedIcon : (selected ? st::historyReceivedSelectedIcon : st::historyReceivedIcon));
|
||||
|
|
|
@ -211,6 +211,13 @@ RepliesWidget::RepliesWidget(
|
|||
}
|
||||
}, lifetime());
|
||||
|
||||
_history->session().changes().historyUpdates(
|
||||
_history,
|
||||
Data::HistoryUpdate::Flag::OutboxRead
|
||||
) | rpl::start_with_next([=] {
|
||||
_inner->update();
|
||||
}, lifetime());
|
||||
|
||||
setupScrollDownButton();
|
||||
setupComposeControls();
|
||||
}
|
||||
|
@ -252,6 +259,7 @@ void RepliesWidget::setupRoot() {
|
|||
if (_readRequestPending) {
|
||||
sendReadTillRequest();
|
||||
}
|
||||
_inner->update();
|
||||
}
|
||||
updatePinnedVisibility();
|
||||
refreshRootView();
|
||||
|
@ -1580,6 +1588,17 @@ bool RepliesWidget::listElementHideReply(not_null<const Element*> view) {
|
|||
return (view->data()->replyToId() == _rootId);
|
||||
}
|
||||
|
||||
bool RepliesWidget::listElementShownUnread(not_null<const Element*> view) {
|
||||
if (!_root) {
|
||||
return false;
|
||||
}
|
||||
const auto item = view->data();
|
||||
const auto till = item->out()
|
||||
? _root->computeRepliesOutboxReadTillFull()
|
||||
: _root->computeRepliesInboxReadTillFull();
|
||||
return (item->id > till);
|
||||
}
|
||||
|
||||
bool RepliesWidget::listIsGoodForAroundPosition(
|
||||
not_null<const Element*> view) {
|
||||
return IsServerMsgId(view->data()->id);
|
||||
|
|
|
@ -123,6 +123,7 @@ public:
|
|||
void listContentRefreshed() override;
|
||||
ClickHandlerPtr listDateLink(not_null<Element*> view) override;
|
||||
bool listElementHideReply(not_null<const Element*> view) override;
|
||||
bool listElementShownUnread(not_null<const Element*> view) override;
|
||||
bool listIsGoodForAroundPosition(not_null<const Element*> view) override;
|
||||
|
||||
protected:
|
||||
|
|
|
@ -1150,6 +1150,10 @@ bool ScheduledWidget::listElementHideReply(not_null<const Element*> view) {
|
|||
return false;
|
||||
}
|
||||
|
||||
bool ScheduledWidget::listElementShownUnread(not_null<const Element*> view) {
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ScheduledWidget::listIsGoodForAroundPosition(
|
||||
not_null<const Element*> view) {
|
||||
return true;
|
||||
|
|
|
@ -111,6 +111,7 @@ public:
|
|||
void listContentRefreshed() override;
|
||||
ClickHandlerPtr listDateLink(not_null<Element*> view) override;
|
||||
bool listElementHideReply(not_null<const Element*> view) override;
|
||||
bool listElementShownUnread(not_null<const Element*> view) override;
|
||||
bool listIsGoodForAroundPosition(not_null<const Element *> view) override;
|
||||
|
||||
protected:
|
||||
|
|
Loading…
Add table
Reference in a new issue