mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-06-05 22:54:01 +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 = {};
|
_swipeBackData = {};
|
||||||
}
|
}
|
||||||
}, [=](int, Qt::LayoutDirection direction) {
|
}, [=](int, Qt::LayoutDirection direction) {
|
||||||
const auto can = [&] {
|
return (direction == Qt::RightToLeft && _controller->hasBackButton())
|
||||||
using Type = Section::Type;
|
? Ui::Controls::DefaultSwipeBackHandlerFinishData([=] {
|
||||||
if (direction != Qt::RightToLeft) {
|
checkBeforeClose(crl::guard(this, [=] {
|
||||||
return false;
|
_controller->parentController()->hideLayer();
|
||||||
} else if (_controller->wrap() == Wrap::Side) {
|
_controller->showBackFromStack();
|
||||||
return (_controller->section().type() != Type::Profile);
|
}));
|
||||||
} else if (_controller->wrap() == Wrap::Narrow) {
|
})
|
||||||
return true;
|
: Ui::Controls::SwipeHandlerFinishData();
|
||||||
} else {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}();
|
|
||||||
|
|
||||||
return !can
|
|
||||||
? Ui::Controls::SwipeHandlerFinishData()
|
|
||||||
: Ui::Controls::DefaultSwipeBackHandlerFinishData([=] {
|
|
||||||
_controller->showBackFromStack();
|
|
||||||
});
|
|
||||||
}, nullptr);
|
}, nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -358,6 +358,10 @@ void Controller::setSection(not_null<ContentMemento*> memento) {
|
||||||
updateSearchControllers(memento);
|
updateSearchControllers(memento);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool Controller::hasBackButton() const {
|
||||||
|
return _widget->hasBackButton();
|
||||||
|
}
|
||||||
|
|
||||||
void Controller::updateSearchControllers(
|
void Controller::updateSearchControllers(
|
||||||
not_null<ContentMemento*> memento) {
|
not_null<ContentMemento*> memento) {
|
||||||
using Type = Section::Type;
|
using Type = Section::Type;
|
||||||
|
|
|
@ -311,6 +311,7 @@ public:
|
||||||
[[nodiscard]] rpl::producer<Wrap> wrapValue() const;
|
[[nodiscard]] rpl::producer<Wrap> wrapValue() const;
|
||||||
[[nodiscard]] not_null<Ui::RpWidget*> wrapWidget() const;
|
[[nodiscard]] not_null<Ui::RpWidget*> wrapWidget() const;
|
||||||
void setSection(not_null<ContentMemento*> memento);
|
void setSection(not_null<ContentMemento*> memento);
|
||||||
|
[[nodiscard]] bool hasBackButton() const;
|
||||||
|
|
||||||
Ui::SearchFieldController *searchFieldController() const {
|
Ui::SearchFieldController *searchFieldController() const {
|
||||||
return _searchFieldController.get();
|
return _searchFieldController.get();
|
||||||
|
|
|
@ -122,6 +122,7 @@ public:
|
||||||
|
|
||||||
object_ptr<Ui::RpWidget> createTopBarSurrogate(QWidget *parent);
|
object_ptr<Ui::RpWidget> createTopBarSurrogate(QWidget *parent);
|
||||||
|
|
||||||
|
[[nodiscard]] bool hasBackButton() const;
|
||||||
[[nodiscard]] bool closeByOutsideClick() const;
|
[[nodiscard]] bool closeByOutsideClick() const;
|
||||||
|
|
||||||
void updateGeometry(
|
void updateGeometry(
|
||||||
|
@ -181,7 +182,6 @@ private:
|
||||||
void highlightTopBar();
|
void highlightTopBar();
|
||||||
void setupShortcuts();
|
void setupShortcuts();
|
||||||
|
|
||||||
[[nodiscard]] bool hasBackButton() const;
|
|
||||||
[[nodiscard]] bool willHaveBackButton(
|
[[nodiscard]] bool willHaveBackButton(
|
||||||
const Window::SectionShow ¶ms) const;
|
const Window::SectionShow ¶ms) const;
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue