mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-06-03 21:54:05 +02:00
Allow more Info sections swipe-back.
This commit is contained in:
parent
31cb2f1999
commit
fd718dfd5c
4 changed files with 14 additions and 19 deletions
|
@ -404,24 +404,14 @@ void ContentWidget::setupSwipeReply() {
|
|||
_swipeBackData = {};
|
||||
}
|
||||
}, [=](int, Qt::LayoutDirection direction) {
|
||||
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
|
||||
? Ui::Controls::SwipeHandlerFinishData()
|
||||
: Ui::Controls::DefaultSwipeBackHandlerFinishData([=] {
|
||||
_controller->showBackFromStack();
|
||||
});
|
||||
return (direction == Qt::RightToLeft && _controller->hasBackButton())
|
||||
? Ui::Controls::DefaultSwipeBackHandlerFinishData([=] {
|
||||
checkBeforeClose(crl::guard(this, [=] {
|
||||
_controller->parentController()->hideLayer();
|
||||
_controller->showBackFromStack();
|
||||
}));
|
||||
})
|
||||
: Ui::Controls::SwipeHandlerFinishData();
|
||||
}, nullptr);
|
||||
}
|
||||
|
||||
|
|
|
@ -358,6 +358,10 @@ void Controller::setSection(not_null<ContentMemento*> memento) {
|
|||
updateSearchControllers(memento);
|
||||
}
|
||||
|
||||
bool Controller::hasBackButton() const {
|
||||
return _widget->hasBackButton();
|
||||
}
|
||||
|
||||
void Controller::updateSearchControllers(
|
||||
not_null<ContentMemento*> memento) {
|
||||
using Type = Section::Type;
|
||||
|
|
|
@ -311,6 +311,7 @@ public:
|
|||
[[nodiscard]] rpl::producer<Wrap> wrapValue() const;
|
||||
[[nodiscard]] not_null<Ui::RpWidget*> wrapWidget() const;
|
||||
void setSection(not_null<ContentMemento*> memento);
|
||||
[[nodiscard]] bool hasBackButton() const;
|
||||
|
||||
Ui::SearchFieldController *searchFieldController() const {
|
||||
return _searchFieldController.get();
|
||||
|
|
|
@ -122,6 +122,7 @@ public:
|
|||
|
||||
object_ptr<Ui::RpWidget> createTopBarSurrogate(QWidget *parent);
|
||||
|
||||
[[nodiscard]] bool hasBackButton() const;
|
||||
[[nodiscard]] bool closeByOutsideClick() const;
|
||||
|
||||
void updateGeometry(
|
||||
|
@ -181,7 +182,6 @@ private:
|
|||
void highlightTopBar();
|
||||
void setupShortcuts();
|
||||
|
||||
[[nodiscard]] bool hasBackButton() const;
|
||||
[[nodiscard]] bool willHaveBackButton(
|
||||
const Window::SectionShow ¶ms) const;
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue