mirror of
https://github.com/telegramdesktop/tdesktop
synced 2025-01-14 03:01:15 +00:00
Refresh main message view for inactive accounts.
This commit is contained in:
parent
895c65d518
commit
f2577265ee
@ -1279,7 +1279,8 @@ rpl::producer<not_null<ViewElement*>> Session::viewResizeRequest() const {
|
||||
|
||||
void Session::requestItemViewRefresh(not_null<HistoryItem*> item) {
|
||||
if (const auto view = item->mainView()) {
|
||||
view->setPendingResize();
|
||||
notifyHistoryChangeDelayed(item->history());
|
||||
view->refreshInBlock();
|
||||
}
|
||||
_itemViewRefreshRequest.fire_copy(item);
|
||||
}
|
||||
|
@ -178,10 +178,6 @@ HistoryInner::HistoryInner(
|
||||
) | rpl::start_with_next(
|
||||
[this](auto view) { viewRemoved(view); },
|
||||
lifetime());
|
||||
session().data().itemViewRefreshRequest(
|
||||
) | rpl::start_with_next(
|
||||
[this](auto item) { refreshView(item); },
|
||||
lifetime());
|
||||
rpl::merge(
|
||||
session().data().historyUnloaded(),
|
||||
session().data().historyCleared()
|
||||
@ -1316,32 +1312,15 @@ void HistoryInner::itemRemoved(not_null<const HistoryItem*> item) {
|
||||
}
|
||||
|
||||
void HistoryInner::viewRemoved(not_null<const Element*> view) {
|
||||
if (_dragSelFrom == view) {
|
||||
_dragSelFrom = nullptr;
|
||||
}
|
||||
if (_dragSelTo == view) {
|
||||
_dragSelTo = nullptr;
|
||||
}
|
||||
if (_scrollDateLastItem == view) {
|
||||
_scrollDateLastItem = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
void HistoryInner::refreshView(not_null<HistoryItem*> item) {
|
||||
const auto dragSelFrom = (_dragSelFrom && _dragSelFrom->data() == item);
|
||||
const auto dragSelTo = (_dragSelTo && _dragSelTo->data() == item);
|
||||
const auto scrollDateLastItem = (_scrollDateLastItem
|
||||
&& _scrollDateLastItem->data() == item);
|
||||
item->refreshMainView();
|
||||
if (dragSelFrom) {
|
||||
_dragSelFrom = item->mainView();
|
||||
}
|
||||
if (dragSelTo) {
|
||||
_dragSelTo = item->mainView();
|
||||
}
|
||||
if (scrollDateLastItem) {
|
||||
_scrollDateLastItem = item->mainView();
|
||||
}
|
||||
const auto refresh = [&](auto &saved) {
|
||||
if (saved == view) {
|
||||
const auto now = view->data()->mainView();
|
||||
saved = (now && now != view) ? now : nullptr;
|
||||
}
|
||||
};
|
||||
refresh(_dragSelFrom);
|
||||
refresh(_dragSelTo);
|
||||
refresh(_scrollDateLastItem);
|
||||
}
|
||||
|
||||
void HistoryInner::mouseActionFinish(
|
||||
|
@ -239,7 +239,6 @@ private:
|
||||
|
||||
void itemRemoved(not_null<const HistoryItem*> item);
|
||||
void viewRemoved(not_null<const Element*> view);
|
||||
void refreshView(not_null<HistoryItem*> item);
|
||||
|
||||
void touchResetSpeed();
|
||||
void touchUpdateSpeed();
|
||||
|
@ -502,15 +502,6 @@ HistoryWidget::HistoryWidget(
|
||||
}
|
||||
}, lifetime());
|
||||
|
||||
session().data().itemViewRefreshRequest(
|
||||
) | rpl::start_with_next([=](not_null<HistoryItem*> item) {
|
||||
// While HistoryInner doesn't own item views we must refresh them
|
||||
// even if the list is not yet created / was destroyed.
|
||||
if (!_list) {
|
||||
item->refreshMainView();
|
||||
}
|
||||
}, lifetime());
|
||||
|
||||
Core::App().settings().largeEmojiChanges(
|
||||
) | rpl::start_with_next([=] {
|
||||
crl::on_main(this, [=] {
|
||||
|
Loading…
Reference in New Issue
Block a user