2
0
mirror of https://github.com/telegramdesktop/tdesktop synced 2025-08-31 14:38:15 +00:00

Improve items resize in history and feed.

This commit is contained in:
John Preston
2018-01-19 20:10:58 +03:00
parent e6baf8ef5b
commit b91ebad8be
31 changed files with 311 additions and 333 deletions

View File

@@ -158,9 +158,17 @@ rpl::producer<not_null<const ViewElement*>> Session::viewLayoutChanged() const {
void Session::notifyItemIdChange(IdChange event) {
_itemIdChanges.fire_copy(event);
enumerateItemViews(
event.item,
[](not_null<ViewElement*> view) { view->refreshDataId(); });
const auto refreshViewDataId = [](not_null<ViewElement*> view) {
view->refreshDataId();
};
enumerateItemViews(event.item, refreshViewDataId);
if (const auto group = Auth().data().groups().find(event.item)) {
const auto leader = group->items.back();
if (leader != event.item) {
enumerateItemViews(leader, refreshViewDataId);
}
}
}
rpl::producer<Session::IdChange> Session::itemIdChanged() const {
@@ -198,9 +206,7 @@ rpl::producer<not_null<const HistoryItem*>> Session::itemResizeRequest() const {
}
void Session::requestViewResize(not_null<ViewElement*> view) {
if (view == view->data()->mainView()) {
view->setPendingResize();
}
view->setPendingResize();
_viewResizeRequest.fire_copy(view);
}
@@ -252,8 +258,8 @@ rpl::producer<not_null<const History*>> Session::historyCleared() const {
}
void Session::notifyHistoryChangeDelayed(not_null<History*> history) {
history->setHasPendingResizedItems();
_historiesChanged.insert(history);
history->setPendingResize();
}
rpl::producer<not_null<History*>> Session::historyChanged() const {