2
0
mirror of https://github.com/telegramdesktop/tdesktop synced 2025-09-01 06:55:58 +00:00

Replaced SetupSwipeHandler signature from arguments to struct.

This commit is contained in:
23rd
2025-03-24 14:50:11 +03:00
parent a30951dc91
commit f734c0475b
10 changed files with 120 additions and 46 deletions

View File

@@ -1051,8 +1051,7 @@ void MainMenu::setupSwipe() {
});
}
Ui::Controls::SetupSwipeHandler(_inner, _scroll.data(), [=](
Ui::Controls::SwipeContextData data) {
auto update = [=](Ui::Controls::SwipeContextData data) {
if (data.translation < 0) {
if (!_swipeBackData.callback) {
_swipeBackData = Ui::Controls::SetupSwipeBack(
@@ -1069,13 +1068,22 @@ void MainMenu::setupSwipe() {
} else if (_swipeBackData.lifetime) {
_swipeBackData = {};
}
}, [=](int, Qt::LayoutDirection direction) {
};
auto init = [=](int, Qt::LayoutDirection direction) {
if (direction != Qt::LeftToRight) {
return Ui::Controls::SwipeHandlerFinishData();
}
return Ui::Controls::DefaultSwipeBackHandlerFinishData([=] {
closeLayer();
});
};
Ui::Controls::SetupSwipeHandler({
.widget = _inner,
.scroll = _scroll.data(),
.update = std::move(update),
.init = std::move(init),
});
}