From ad64e068db185b748a7c59aaf0cfbf46f815a566 Mon Sep 17 00:00:00 2001 From: 23rd <23rd@vivaldi.net> Date: Tue, 18 Feb 2025 19:51:27 +0300 Subject: [PATCH] Allowed swipe-to-back in side info section. --- .../SourceFiles/info/info_content_widget.cpp | 25 +++++++++++++------ 1 file changed, 18 insertions(+), 7 deletions(-) diff --git a/Telegram/SourceFiles/info/info_content_widget.cpp b/Telegram/SourceFiles/info/info_content_widget.cpp index 39d9d99d4a..0ae10c1dd2 100644 --- a/Telegram/SourceFiles/info/info_content_widget.cpp +++ b/Telegram/SourceFiles/info/info_content_widget.cpp @@ -404,13 +404,24 @@ void ContentWidget::setupSwipeReply() { _swipeBackData = {}; } }, [=](int, Qt::LayoutDirection direction) { - if (_controller->wrap() != Wrap::Narrow - || direction != Qt::RightToLeft) { - return HistoryView::SwipeHandlerFinishData(); - } - return HistoryView::DefaultSwipeBackHandlerFinishData([=] { - _controller->showBackFromStack(); - }); + const auto can = [&] { + using Type = Section::Type; + if (direction != Qt::RightToLeft) { + return false; + } else if (_controller->wrap() == Wrap::Side) { + return (_controller->section().type() != Type::Profile); + } else if (_controller->wrap() == Wrap::Narrow) { + return true; + } else { + return false; + } + }(); + + return !can + ? HistoryView::SwipeHandlerFinishData() + : HistoryView::DefaultSwipeBackHandlerFinishData([=] { + _controller->showBackFromStack(); + }); }, nullptr); }