Don't show root pinned bar in topic messages list.

This commit is contained in:
John Preston 2022-10-04 21:04:12 +04:00
parent 57b752c232
commit f3c664859d

View file

@ -219,7 +219,9 @@ RepliesWidget::RepliesWidget(
_topBar->resizeToWidth(width()); _topBar->resizeToWidth(width());
_topBar->show(); _topBar->show();
_rootView->move(0, _topBar->height()); if (_rootView) {
_rootView->move(0, _topBar->height());
}
_topBar->deleteSelectionRequest( _topBar->deleteSelectionRequest(
) | rpl::start_with_next([=] { ) | rpl::start_with_next([=] {
@ -234,7 +236,9 @@ RepliesWidget::RepliesWidget(
clearSelected(); clearSelected();
}, _topBar->lifetime()); }, _topBar->lifetime());
_rootView->raise(); if (_rootView) {
_rootView->raise();
}
_topBarShadow->raise(); _topBarShadow->raise();
controller->adaptive().value( controller->adaptive().value(
@ -414,6 +418,9 @@ void RepliesWidget::setupRoot() {
} }
void RepliesWidget::setupRootView() { void RepliesWidget::setupRootView() {
if (_topic) {
return;
}
_rootView = std::make_unique<Ui::PinnedBar>(this, [=] { _rootView = std::make_unique<Ui::PinnedBar>(this, [=] {
return controller()->isGifPausedAtLeastFor( return controller()->isGifPausedAtLeastFor(
Window::GifPauseReason::Any); Window::GifPauseReason::Any);
@ -471,6 +478,11 @@ void RepliesWidget::setupTopicViewer() {
void RepliesWidget::setTopic(Data::ForumTopic *topic) { void RepliesWidget::setTopic(Data::ForumTopic *topic) {
if ((_topic = topic)) { if ((_topic = topic)) {
refreshTopBarActiveChat(); refreshTopBarActiveChat();
if (_rootView) {
_rootView = nullptr;
_rootViewHeight = 0;
updateControlsGeometry();
}
} }
} }
@ -1618,8 +1630,12 @@ QPixmap RepliesWidget::grabForShowAnimation(const Window::SectionSlideParams &pa
_composeControls->showForGrab(); _composeControls->showForGrab();
} }
auto result = Ui::GrabWidget(this); auto result = Ui::GrabWidget(this);
if (params.withTopBarShadow) _topBarShadow->show(); if (params.withTopBarShadow) {
_rootView->hide(); _topBarShadow->show();
}
if (_rootView) {
_rootView->hide();
}
return result; return result;
} }
@ -1808,7 +1824,6 @@ void RepliesWidget::updateControlsGeometry() {
if (_rootView) { if (_rootView) {
_rootView->resizeToWidth(contentWidth); _rootView->resizeToWidth(contentWidth);
} }
_rootView->resizeToWidth(contentWidth);
const auto bottom = height(); const auto bottom = height();
const auto controlsHeight = _joinGroup const auto controlsHeight = _joinGroup
@ -1894,7 +1909,7 @@ void RepliesWidget::updatePinnedVisibility() {
} }
void RepliesWidget::setPinnedVisibility(bool shown) { void RepliesWidget::setPinnedVisibility(bool shown) {
if (animatingShow()) { if (animatingShow() || _topic) {
return; return;
} else if (!_rootViewInited) { } else if (!_rootViewInited) {
const auto height = shown ? st::historyReplyHeight : 0; const auto height = shown ? st::historyReplyHeight : 0;
@ -1935,7 +1950,9 @@ void RepliesWidget::showFinishedHook() {
} else { } else {
_composeControls->showFinished(); _composeControls->showFinished();
} }
_rootView->show(); if (_rootView) {
_rootView->show();
}
// We should setup the drag area only after // We should setup the drag area only after
// the section animation is finished, // the section animation is finished,